Esempio n. 1
0
 /**
  * @return mixed
  */
 public static function hasUpdates()
 {
     if (!UserHelper::isAdmin()) {
         return false;
     }
     return version_compare(self::getVersion(), self::getRemoteVersion(), '<');
 }
Esempio n. 2
0
 /**
  *
  */
 private function add()
 {
     UserHelper::breakOnMissingUserId();
     $notification = new Notifier();
     $notification->notify($_SESSION['user']->userid, $_POST['userid'], 'confirmfriend', 'index.php?m=confirmfriend&action=' . $_POST['userid']);
     $relations = new Db\Table\Relationships();
     $res = $relations->insert(["sender" => $_SESSION['user']->userid, "receiver" => $_POST['userid'], "status" => 1]);
     if ($res) {
         $view = new View($res !== false);
         $view->sendResponse();
     }
 }
Esempio n. 3
0
 /**
  * @param bool $notify
  */
 public static function add($notify = false)
 {
     UserHelper::breakOnMissingUserId();
     $relations = new Relationships();
     $res = $relations->insert(["sender" => $_SESSION['user']->userid, "receiver" => $_POST['userid'], "status" => 1]);
     if ($res) {
         if ($notify) {
             Notifier::notify($_POST['userid'], $_SESSION['user']->userid, "addfriend", "index.php?m=profile&action=" . $_SESSION['user']->username);
         }
         $view = new View($res !== false);
         $view->sendResponse();
     }
 }
Esempio n. 4
0
 /**
  * @throws \Cunity\Core\Exception
  * @throws \Exception
  */
 public function show()
 {
     if (Login::loggedIn() && $_GET['m'] !== "admin") {
         $this->registerScript("search", "livesearch");
         $this->registerScript("messages", "message-modal");
         $this->registerScript("notifications", "notifications");
         $this->registerScript("messages", "chat");
         $this->registerCss("messages", "chat");
         $this->registerCss("search", "livesearch");
         $this->registerCss("messages", "message-modal");
         $this->registerCss("notifications", "notifications");
         $this->registerScript("friends", "friends");
     }
     $announcements = new Announcements();
     $this->assign("announcements", $announcements->getAnnouncements());
     if (Login::loggedIn()) {
         /** @noinspection PhpUndefinedMethodInspection */
         $this->assign('user', $_SESSION['user']->getTable()->get($_SESSION['user']->userid));
     } else {
         $this->assign('user', []);
     }
     $this->assign('isAdmin', UserHelper::isAdmin());
     $this->assign('hasUpdate', UpdateHelper::hasUpdates());
     $this->assign('menu', new Menu());
     $this->registerCunityPlugin("jscrollpane", ["css/jquery.jscrollpane.css", "js/jquery.jscrollpane.min.js"]);
     $this->registerCunityPlugin("bootstrap-validator", ["css/bootstrapValidator.min.css", "js/bootstrapValidator.min.js"]);
     $this->_metadata["module"] = $_GET['m'];
     $this->assign("meta", $this->_metadata);
     $this->assign('script_head', implode("\n", $this->_headScripts));
     $this->assign('css_head', base64_encode(implode(",", $this->_headCss)));
     $modRewrite = false;
     if (function_exists("apache_get_modules")) {
         $modRewrite = (bool) in_array('mod_rewrite', apache_get_modules());
     }
     $this->assign('modrewrite', $modRewrite);
     if ($this->_useWrapper) {
         $this->assign('tpl_name', $this->_templateDir . '/styles/' . $this->_templateFile);
         $this->display($this->_wrapper);
     } else {
         $this->display($this->_templateDir . DIRECTORY_SEPARATOR . 'styles' . DIRECTORY_SEPARATOR . $this->_templateFile);
     }
 }
Esempio n. 5
0
 /**
  *
  */
 private function editThread()
 {
     $threads = new Threads();
     if (isset($_POST['important']) && UserHelper::isAdmin()) {
         $res = $threads->update(["title" => $_POST['title'], "category" => $_POST['category'], "important" => $_POST['important']], $threads->getAdapter()->quoteInto("id=?", $_POST['thread_id']));
     } else {
         $res = $threads->update(["title" => $_POST['title'], "category" => $_POST['category'], "important" => 0], $threads->getAdapter()->quoteInto("id=?", $_POST['thread_id']));
     }
     $view = new View($res !== false);
     $view->sendResponse();
 }