Code Monkey home page Code Monkey logo

linkblab's Introduction

Linkblab - A Reddit Clone in PHP w/ Zend FW

Thoughts on the project

Just like Gabriel Weinberg brought to my attention over at http://www.gabrielweinberg.com/blog/2010/11/code-icebergs.html, creating a website like Reddit is a lot like the coding equivalelent of an iceberg in that, "they expose what a casual observer or competitor imagines is a weekend hackathon, but underneath there is a humongous mass of necessarily complicated code." I know this application mught be a little fugly on the outside, but on the inside it was an engineering labor of love. I tried to incorporate the same functionality Reddit offers with some of my own tweaks as I attempted to reverse engineer the Python code base.

I've used this project to become better acquainted with Zend Framework and their MVC implementation as well as experiment with Ajax a bit. I make heavy use of Jquery as well.

TODO

  • Putting "NSFW" in some subblabs automatically (toggle in blab settings?).
  • alt. Name for karma -- cred?
  • Implement User Profile Page
  • User page actions

To Change for Production

  • check line 17 of decoda.php on live site

linkblab's People

Contributors

kevinroberts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

linkblab's Issues

Registration / account recovery emails fail due to hardcoded SMTP information

Was playing around with this and found I couldn't create new accounts or do password recovery - it's because it's hardcoded to try to send through your gmail account and the hardcoded login information is no longer good :D

We'll probably end up just changing it to send mail through our server locally but figured this was something that should be configurable at least for the auth information if not the method (i.e. SMTP without login, SMTP with login, ... not to mention the actual server address )

Subscriptions can't be added if user has zero subscriptions existing, can't see random or all in blab list

Figured out why I was having the problem, sort of. TL;DR: The add blab logic was inserting at the start of the list, but that didn't work if there wasn't any list ...

Here's my fix for that, plus removing the minimum of 3 blabs restriction (not sure why that was there, but I only had 3 I was testing with so that was annoying), and fixing the all and random blab links to work even if user has zero subs (when logged in and no subs, wouldn't even get the random and all options).

# diff -Bb repo/application/controllers/BlabsController.php application/controllers/BlabsController.php
371,375d370
<                                                                       if (count($results) < 4) {
<                                                                               $msg = "You must maintain at least 3 items on your front page. Please add some more first.";
<                                                                               return $this->_redirect("/index/notfound?m=".urlencode($msg));
<                                                                       }
<
429,438d423
<                                                                       $oldFirstItem = array();
<                                                                       $i = 0;
<
<                                                                       if (isset($results[0]["id"])) {
<
<                                                                               $oldFirstItem["id"] = $results[0]["id"];
<                                                                               $oldFirstItem["user_id"] = $results[0]["user_id"];
<                                                                               $oldFirstItem["blab_id"] = $results[0]["blab_id"];
<                                                                               $oldFirstItem["display_order"] = $results[0]["display_order"];
<                                                                               // Update first row with new blab id
440c425,427
<                                                                       'blab_id'      => $blabId

---
>                                                         'blab_id'      => $blabId,
>                                                         'user_id'      => $loggedInId,
>                                                         'display_order' => $count++,
442,446c429,430
<                                                                               $update = $db->update("subscriptions", $data, "id = ".$oldFirstItem["id"]);
<
<                                                                               // shift all the other subscriptions down one row
<                                                                               $shifter = $this->moveBlabsDown($count, $oldFirstItem);
<                                                                       }

---
>                                                         // Add blab as next available display order
>                                                         $insert = $db->insert("subscriptions", $data);
453,455d436
<                                                 }
<
<
458a440
>     }

# diff -Bb repo/application/views/helpers/BuildBlabCategories.php application/views/helpers/BuildBlabCategories.php
55,57d54
<                       foreach ($results as $row) {
<                               $class = ($row['title'] == $category) ? 'class="activeBlab"' : 'class=""';
<                               if ($i == 0) {
62a60,62
>                       foreach ($results as $row) {
>                               $class = ($row['title'] == $category) ? 'class="activeBlab"' : 'class=""';
>                               if ($i == 0) {
64,65d63
<                                       $blabs .= '<a '.$class.' href="/b/'.$row['title'].'">'.$row['title'].'</a>';
<                                       $blabs .= " - ";
67,69c65,67
<                               else {
<                               $blabs .= '<a '.$class.' href="/b/'.$row['title'].'">'.$row['title'].'</a>';
<                               $blabs .= " - ";

---
>                 else
>                 {
>                     $blabs .= ' - ';
70a69
>                               $blabs .= '<a '.$class.' href="/b/'.$row['title'].'">'.$row['title'].'</a>';
74,75d72
<                       $blabs = substr($blabs,0,-1);
<                       $blabs = substr($blabs,0,-1);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.