Esempio n. 1
0
 /**
  * @param $form
  * @throws \Exception
  * @throws \Zend_Config_Exception
  */
 private function save($form)
 {
     $res = [];
     switch ($form) {
         case "settings":
         case "headline":
             foreach ($_POST as $key => $value) {
                 if (strpos($key, "settings-") !== false) {
                     $setting = explode("-", $key);
                     /** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
                     $settings = \Cunity\Core\Cunity::get("settings");
                     $res[] = $settings->setSetting(preg_replace('/_/', '.', $setting[1], 1), $value);
                 }
             }
             break;
         case "config":
             $config = new \Zend_Config_Xml("../data/config.xml");
             $configWriter = new \Zend_Config_Writer_Xml(["config" => new \Zend_Config(self::arrayMergeRecursiveDistinct($config->toArray(), $_POST['config'])), "filename" => "../data/config.xml"]);
             $configWriter->write();
             break;
         case "mailtemplates":
             $settings = Cunity::get("settings");
             $res[] = $settings->setSetting("core.mail_header", $_POST['mail_header']);
             $res[] = $settings->setSetting("core.mail_footer", $_POST['mail_footer']);
             break;
         case 'modules':
             Cunity::set('modules', new Modules());
             $modules = Cunity::get("modules");
             $modules->update(['status' => $_POST['status']], 'id = ' . $_POST['id']);
             break;
         case 'update':
             UpdateHelper::update();
             break;
         case 'users':
             Cunity::set('users', new Users());
             /** @var Users $users */
             $users = Cunity::get("users");
             if (null !== $_REQUEST['userid']) {
                 if ('' !== $_REQUEST['groupid']) {
                     $users->update(['groupid' => $_REQUEST['groupid']], 'userid = ' . $_REQUEST['userid']);
                 } else {
                     $users->delete('userid = ' . $_REQUEST['userid']);
                 }
             } else {
                 $users->registerNewUser($_REQUEST);
             }
             break;
     }
     $this->sendResponse($res);
 }
Esempio n. 2
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. 3
0
 /**
  *
  */
 public function __construct()
 {
     $this->assignments['hasUpdate'] = UpdateHelper::hasUpdates();
     $this->render("update");
 }