Example #1
0
   the GNU Affero General Public License along with this program.  

   If not, see <http://www.gnu.org/licenses/>.

*/
require_once 'database.php';
require 'data/User.php';
require 'data/List.php';
if (isset($_REQUEST['hs'])) {
    // foo
} else {
    //If we're not handshaking we display the start page
    require_once 'templating.php';
    if ($auth) {
        $user = new User($casuid);
        $userid = $user->id;
        // error_log($userid);
        $list = new UserList();
        $listitems = $list->getUserTopList(20, $userid);
        $selection = $list->getNewList(5);
        $smarty->assign('list', $listitems);
        if ($_GET['msg'] != "") {
            $msg = "Your image will be processed shortly, and the item will be hidden from your list.";
        }
        $smarty->assign('newlist', $selection);
        $smarty->assign('msg', $msg);
        $smarty->display('my-list.tpl');
    } else {
        $smarty->display('noauth.tpl');
    }
}
Example #2
0
with('/api/userlist/delete', function () {
    respond('POST', '/[:userid]/[:id]', function ($request, $response) {
        $userid = $request->userid;
        $listitem = $request->id;
        $skey = $request->param('skey');
        $list = new UserList();
        $response = $list->deleteItem($userid, $listitem, $skey);
        $output = json_encode($response, JSON_PRETTY_PRINT);
        echo $output;
    });
});
with('/api/userlist', function () {
    respond('GET', '/[:id]', function ($request, $response) {
        $id = $request->id;
        $list = new UserList();
        $selection = $list->getUserTopList(100, $id);
        $output = json_encode($selection, JSON_PRETTY_PRINT);
        echo $output;
    });
    respond('POST', '/[:user]/[:id]', function ($request, $response) {
        $item = $request->id;
        $userid = $request->user;
        // We'll need to figure out a way to do these more securely
        $list = new UserList();
        $save = $list->addToMyList($item, $userid);
        echo "[]";
    });
});
with('/api/usercategories/add', function () {
    respond('POST', '/[:user]/[:id]', function ($request, $response) {
        $categoryid = $request->id;