loadMe(); $this->layout()->set("me",$me); $this->me = $me; if(!$me->isAdmin()) { // all users can call non-action methods if($this->action != "" || $request != null) { $this->redirect("Dashboard"); } } } protected function indexAction() { if(!$this->me->isAdmin()) { $this->redirect("Dashboard"); } $this->layout()->setTemplate("System/System"); } protected function saveAction($request) { if(!$this->me->isAdmin()) { $this->redirect("Dashboard"); } foreach($request as $name => $value) { $m = []; if(!preg_match('/^system_(.+)$/',$name,$m)) { continue; } $name = str_replace("_", ".", $m[1]); $config = new mfConfig($name); $config->value($value); $config->save(); } $this->redirect("System"); } public function getLastCommit() { $git_path = BASEDIR."/.git"; $output = []; if(defined("GIT_BIN_PATH") && GIT_BIN_PATH) { $git = GIT_BIN_PATH; } else { $git = "/usr/bin/git"; } $cmd = "$git --git-dir $git_path rev-parse HEAD"; if(!exec($cmd, $output)) { $log = mfLoghandler::singleton(); $log->warn("Cannot read git ref!"); } $ref = $output[0]; if(strlen($output[0]) > 8) { $ref = substr($output[0], 0, 8); } return $ref; } }