require_once "includes/photo.php"; $session = Session::singletone(); if ($session->requireLogin()) { exit; } HTML::startHTML(); HTML::head(_UPLOAD_PHOTO); HTML::startBODY(); $smarty = new Phph_Smarty(_UPLOAD_PHOTO); $ref = Utils::pg("ref"); if (isset($_POST['submit'])) { try { $photo = new Photo(); $photo->upload($_FILES['file'], $_POST['title'], $_POST['description'], $_POST['cid']); } catch (Exception2 $e) { $smarty->assign('error', 1); $smarty->assign('error_title', $e->getMessage()); $smarty->assign('error_description', $e->getDescription()); } } $smarty->assign('l_upload', _UPLOAD); $smarty->assign('l_file', _FILE); $smarty->assign('l_title', _TITLE); $smarty->assign('l_description', _DESCRIPTION); $smarty->assign('l_category', _CATEGORY); $smarty->assign('max_file_size', Config::get("max_file_size") * 1024); $smarty->assign('ref', $ref); function fill_category_tree(&$categories, $ccid, $level) { global $db; $qs = "SELECT category_id, category_name FROM phph_categories ";
require_once "includes/smarty.php"; require_once "includes/photo.php"; require_once "includes/category.php"; require_once "includes/user.php"; require_once "Mail.php"; $url = Config::get("site_url"); $ref = Utils::pg("ref"); $page = Utils::pg("p", 0); $count = Utils::pg("c", 20); $action = Utils::pg("action", "index"); $session = Session::singletone(); if (Config::get("require_login", 0) && $action != 'login' && $session->requireLogin()) { exit; } $smarty = new Phph_Smarty($action); $smarty->assign('ref', $ref); $smarty->assign('self', Utils::selfURL()); $templates = array('index' => 'index.tpl', 'view' => 'view.tpl', 'categories' => 'categories.tpl', 'category' => 'category.tpl', 'user' => 'user.tpl', 'register' => 'register-form.tpl', 'registered' => 'registered.tpl', 'reg-disabled' => 'reg-disabled.tpl', 'activate' => 'activation.tpl', 'login' => 'login.tpl'); $smarty->register_function('url', 'smarty_url'); function url($action, $attrs = array()) { global $ref, $url; $session = Session::singletone(); $s = $url . "/index.php?action={$action}"; $s = $session->addSID($s); if (!empty($ref)) { $s .= "&ref=" . htmlspecialchars(urlencode($ref)); } foreach ($attrs as $id => $val) { $s .= htmlspecialchars("&{$id}=" . urlencode($val)); }