コード例 #1
0
ファイル: main.php プロジェクト: sea75300/fanpresscm3
 /**
  * Controller-Processing
  * @return boolean
  */
 public function exec()
 {
     $this->registerController();
     $module = !is_null(\fpcm\classes\http::get('module')) ? \fpcm\classes\http::get('module', array(1, 4, 7)) : false;
     if (!$module) {
         header('Location: index.php?module=system/login');
         return true;
     }
     $controllerName = isset($this->controllers[$module]) ? $this->controllers[$module] : '';
     if (strpos($controllerName, 'fpcm/modules/') === false) {
         $controllerName = "fpcm/controller/" . $controllerName;
     }
     $controllerName = str_replace('/', '\\', $controllerName);
     if (!class_exists($controllerName)) {
         trigger_error('Undefined controller called: ' . $module);
         $this->errorPage("The requested controller <b>{$module}</b> does not exist! <span class=\"fa fa-frown-o\"></span>");
     }
     /**
      * @var abstracts\controller
      */
     $controller = new $controllerName();
     if (!is_a($controller, 'fpcm\\controller\\abstracts\\controller')) {
         trigger_error("ERROR: The controller for <b>{$module}</b> must be an instance of <b>fpcm\\controller\\abstracts\\controller</b>.");
         die("Controller class <b>{$module}</b> must be an instance of <b>fpcm\\controller\\abstracts\\controller</b>. <span class=\"fa fa-frown-o\"></span>");
     }
     if (!$controller->request()) {
         return false;
     }
     $controller->process();
 }
コード例 #2
0
 public function checkAnswer()
 {
     if (!\fpcm\classes\http::get('answer') || \fpcm\classes\http::get('answer') != $this->text) {
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: fpcmapi.php プロジェクト: sea75300/fanpresscm3
 /**
  * Artikel anzeigen
  * @return boolean
  */
 public function showArticles()
 {
     if ($this->versionFailed) {
         return false;
     }
     $this->registerController();
     $module = !is_null(\fpcm\classes\http::get('module')) ? \fpcm\classes\http::get('module', array(1, 4, 7)) : 'fpcm/list';
     if (strpos($module, 'fpcm/') === false || !in_array($module, array('fpcm/list', 'fpcm/article', 'fpcm/archive'))) {
         return false;
     }
     $controllerName = "fpcm/controller/";
     $controllerName .= isset($this->controllers[$module]) ? $this->controllers[$module] : ($module ? $module : 'action\\system\\login');
     $controllerName = str_replace('/', '\\', $controllerName);
     if (!class_exists($controllerName)) {
         trigger_error('Undefined controller called: ' . $module);
         return false;
     }
     /**
      * @var abstracts\controller
      */
     $controller = new $controllerName(true);
     if (!is_a($controller, 'fpcm\\controller\\abstracts\\controller')) {
         die("ERROR: The controller for <b>{$module}</b> must be an instance of <b>fpcm\\controller\\abstracts\\controller</b>. ;)");
         return false;
     }
     if (!$controller->request()) {
         return false;
     }
     $controller->process();
 }
コード例 #4
0
ファイル: templates.php プロジェクト: sea75300/fanpresscm3
 /**
  * Request-Handler
  * @return boolean
  */
 public function request()
 {
     if ($this->buttonClicked('uploadFile') && !is_null(\fpcm\classes\http::getFiles())) {
         $uploader = new \fpcm\model\files\fileuploader(\fpcm\classes\http::getFiles());
         $res = $uploader->processArticleTemplateUpload();
         if ($res == true) {
             $this->view->addNoticeMessage('SAVE_SUCCESS_UPLOADTPLFILE');
         } else {
             $this->view->addErrorMessage('SAVE_FAILED_UPLOADTPLFILE');
         }
         return true;
     }
     $delFiles = $this->getRequestVar('deltplfiles');
     if ($this->buttonClicked('fileDelete') && is_array($delFiles) && count($delFiles)) {
         $delFiles = array_map('base64_decode', $delFiles);
         $deletedOk = array();
         $deletedFailed = array();
         foreach ($delFiles as $delFile) {
             $articleTplFile = new \fpcm\model\files\templatefile($delFile);
             if (!$articleTplFile->delete()) {
                 $deletedFailed[] = \fpcm\model\files\ops::removeBaseDir($delFile);
                 continue;
             }
             $deletedOk[] = \fpcm\model\files\ops::removeBaseDir($delFile);
         }
         if (count($deletedOk)) {
             $this->view->addNoticeMessage('DELETE_SUCCESS_FILES', array('{{filenames}}' => implode(', ', $deletedOk)));
         }
         if (count($deletedFailed)) {
             $this->view->addErrorMessage('DELETE_FAILED_FILES', array('{{filenames}}' => implode(', ', $deletedFailed)));
         }
         return true;
     }
     if ($this->buttonClicked('saveTemplates') && !is_null($this->getRequestVar('template'))) {
         $this->cache->cleanup();
         $templateContents = $this->getRequestVar('template');
         $tplSaveError = array();
         $tplSaveOk = array();
         foreach ($templateContents as $templateName => $newContent) {
             $tplObj = $this->{$templateName . 'Template'};
             $tplObj->setContent($newContent);
             $res = $tplObj->save();
             if (is_null($res) && $templateName == 'commentForm') {
                 $this->view->addErrorMessage('SAVE_FAILED_TEMPLATE_CF_URLMISSING');
             } elseif (!$res) {
                 $tplSaveError[] = $tplObj->getFilename();
             } else {
                 $tplSaveOk[] = $tplObj->getFilename();
             }
         }
         if (count($tplSaveError)) {
             $this->view->addErrorMessage('SAVE_FAILED_TEMPLATE', array('{{filenames}}' => implode(', ', $tplSaveError)));
         }
         if (count($tplSaveOk)) {
             $this->view->addNoticeMessage('SAVE_SUCCESS_TEMPLATE', array('{{filenames}}' => implode(', ', $tplSaveOk)));
         }
     }
     return true;
 }
コード例 #5
0
 public function run($params = null)
 {
     if (strpos(\fpcm\classes\http::get('module'), 'modules/config') === false) {
         return $params;
     }
     $params[] = 'inc/modules/nkorg/classicimporter/js/classicimporter.js';
     return $params;
 }
コード例 #6
0
 public function run($params = null)
 {
     if (strpos(\fpcm\classes\http::get('module'), 'nkorg/inactivity_manager/') === false) {
         return $params;
     }
     $params[] = 'inc/modules/nkorg/inactivity_manager/js/inactivitymanager.js';
     return $params;
 }
コード例 #7
0
ファイル: acpConfig.php プロジェクト: sea75300/fanpresscm3
 public function run($params = null)
 {
     if (\fpcm\classes\http::postOnly('btnClearLog') !== null) {
         \fpcm\modules\nkorg\example\model\logfile::cleanup();
     }
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__FILE__), 'acp', 'main');
     $view->addMessage('FPCM_EXAMPLE_HEADLINE');
     $view->addNoticeMessage('FPCM_EXAMPLE_HEADLINE');
     $view->addErrorMessage('FPCM_EXAMPLE_HEADLINE');
     $view->assign('logfiledata', \fpcm\modules\nkorg\example\model\logfile::getLog());
     $view->render();
 }
コード例 #8
0
ファイル: modulelist.php プロジェクト: sea75300/fanpresscm3
 public function request()
 {
     if (!is_null(\fpcm\classes\http::getFiles())) {
         $uploader = new \fpcm\model\files\fileuploader(\fpcm\classes\http::getFiles());
         $res = $uploader->processModuleUpload();
         if ($res == true) {
             $this->view->addNoticeMessage('SAVE_SUCCESS_UPLOADMODULE');
         } else {
             $this->view->addErrorMessage('SAVE_FAILED_UPLOADMODULE');
         }
     }
     return true;
 }
コード例 #9
0
ファイル: main.php プロジェクト: sea75300/fanpresscm3
 public function request()
 {
     if (!\fpcm\classes\baseconfig::installerEnabled()) {
         die('The FanPress CM installer is not enabled!');
         trigger_error('Access to disabled installer from ip address ' . \fpcm\classes\http::getIp());
         return false;
     }
     $this->step = !is_null($this->getRequestVar('step')) ? $this->getRequestVar('step', array(9)) : 1;
     $this->langCode = !is_null($this->getRequestVar('language')) ? $this->getRequestVar('language') : FPCM_DEFAULT_LANGUAGE_CODE;
     $this->lang = new \fpcm\classes\language($this->langCode);
     $this->view = new \fpcm\model\view\installer('main', $this->langCode);
     return true;
 }
コード例 #10
0
ファイル: iplist.php プロジェクト: sea75300/fanpresscm3
 /**
  * Prüft ob IP-Adresse gesperrt ist
  * @param string $lockType
  * @return bool
  */
 public function ipIsLocked($lockType = 'noaccess')
 {
     $delim = strpos(\fpcm\classes\http::getIp(), ':') !== false ? ':' : '.';
     $ipAddress = explode($delim, \fpcm\classes\http::getIp());
     $adresses = array();
     $adresses[] = implode($delim, $ipAddress);
     $where = array('ipaddress ' . $this->dbcon->dbLike() . ' ?');
     $counts = count($ipAddress) - 1;
     for ($i = $counts; $i > 0; $i--) {
         $ipAddress[$i] = '*';
         $adresses[] = implode($delim, $ipAddress);
         $where[] = 'ipaddress ' . $this->dbcon->dbLike() . ' ?';
     }
     $where = "(" . implode(' OR ', $where) . ") AND {$lockType} = 1";
     $result = $this->dbcon->fetch($this->dbcon->select($this->table, 'count(id) AS counted', $where, $adresses));
     return $result->counted ? true : false;
 }
コード例 #11
0
ファイル: fpcmDefault.php プロジェクト: sea75300/fanpresscm3
 /**
  * zusätzliche Prüfungen durchführen
  * @return bool
  */
 public function checkExtras()
 {
     $cdata = \fpcm\classes\http::get('newcomment');
     if ($this->maxCommentTextLinks <= preg_match_all("#(https?)://\\S+[^\\s.,>)\\];'\"!?]#", $cdata['text'])) {
         return true;
     }
     $comment = new \fpcm\model\comments\comment();
     $commentList = new \fpcm\model\comments\commentList();
     $comment->setEmail($cdata['email']);
     $comment->setName($cdata['name']);
     $comment->setWebsite($cdata['website']);
     $comment->setIpaddress(\fpcm\classes\http::getIp());
     if ($commentList->spamExistsbyCommentData($comment)) {
         return true;
     }
     return false;
 }
コード例 #12
0
ファイル: acpConfig.php プロジェクト: sea75300/fanpresscm3
 public function run($params = null)
 {
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $messages = new \fpcm\modules\nkorg\inactivity_manager\model\messages();
     if (!is_null(\fpcm\classes\http::get('added'))) {
         $view->addNoticeMessage('NKORGINACTIVITY_MANAGER_SAVED_OK');
     }
     if (!is_null(\fpcm\classes\http::get('btnDeleteTerms')) && !is_null(\fpcm\classes\http::get('ids'))) {
         $ids = \fpcm\classes\http::get('ids');
         if ($messages->deleteMessage($ids)) {
             $view->addNoticeMessage('NKORGINACTIVITY_MANAGER_DELETE_OK');
         } else {
             $view->addErrorMessage('NKORGINACTIVITY_MANAGER_DELETE_FAILED');
         }
     }
     $view->assign('messages', $messages->getMessages());
     $view->render();
 }
コード例 #13
0
ファイル: acpConfig.php プロジェクト: sea75300/fanpresscm3
 public function run($params = null)
 {
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $termlist = new \fpcm\modules\nkorg\tweetextender\model\termlist();
     if (!is_null(\fpcm\classes\http::get('added'))) {
         $view->addNoticeMessage('NKORG_TWEETENTENDER_SAVED_OK');
     }
     if (!is_null(\fpcm\classes\http::get('btnDeleteTerms')) && !is_null(\fpcm\classes\http::get('ids'))) {
         $ids = \fpcm\classes\http::get('ids');
         if ($termlist->deleteTerms($ids)) {
             $view->addNoticeMessage('NKORG_TWEETENTENDER_DELETE_OK');
         } else {
             $view->addErrorMessage('NKORG_TWEETENTENDER_DELETE_FAILED');
         }
     }
     $terms = $termlist->getTerms();
     $view->assign('terms', $terms);
     $view->render();
 }
コード例 #14
0
ファイル: commentedit.php プロジェクト: sea75300/fanpresscm3
 public function request()
 {
     if (is_null($this->getRequestVar('commentid'))) {
         $this->redirect('comments/list');
     }
     $this->comment = new \fpcm\model\comments\comment($this->getRequestVar('commentid'));
     if (!$this->comment->exists()) {
         $this->view->setNotFound('LOAD_FAILED_COMMENT', 'comments/list');
         return true;
     }
     if (!$this->comment->getEditPermission()) {
         $this->view = new \fpcm\model\view\error();
         $this->view->addErrorMessage('PERMISSIONS_REQUIRED');
         $this->view->render();
         return false;
     }
     if ($this->buttonClicked('commentSave') && $this->getRequestVar('comment')) {
         $commentData = $this->getRequestVar('comment', array(4, 7));
         $this->comment->setText($commentData['text']);
         unset($commentData['text']);
         foreach ($commentData as &$value) {
             $value = \fpcm\classes\http::filter($value, array(1, 3));
         }
         $this->comment->setName($commentData['name']);
         $this->comment->setEmail($commentData['email']);
         $this->comment->setWebsite($commentData['website']);
         if ($this->approve) {
             $this->comment->setApproved(isset($commentData['approved']) ? true : false);
             $this->comment->setSpammer(isset($commentData['spam']) ? true : false);
         }
         if ($this->private) {
             $this->comment->setPrivate(isset($commentData['private']) ? true : false);
         }
         $this->comment->setChangetime(time());
         $this->comment->setChangeuser($this->session->getUserId());
         if ($this->comment->update()) {
             $this->view->addNoticeMessage('SAVE_SUCCESS_COMMENT');
         } else {
             $this->view->addErrorMessage('SAVE_FAILED_COMMENT');
         }
     }
     return true;
 }
コード例 #15
0
ファイル: ipadd.php プロジェクト: sea75300/fanpresscm3
 public function request()
 {
     if ($this->buttonClicked('ipSave') && !$this->checkPageToken()) {
         $this->view->addErrorMessage('CSRF_INVALID');
         return true;
     }
     if ($this->buttonClicked('ipSave')) {
         $this->ipaddress->setIpaddress($this->getRequestVar('ipaddress'));
         $this->ipaddress->setIptime(time());
         $this->ipaddress->setUserid($this->session->getUserId());
         $this->ipaddress->setNoaccess($this->getRequestVar('noaccess') ? true : false);
         $this->ipaddress->setNocomments($this->getRequestVar('nocomments') ? true : false);
         $this->ipaddress->setNologin($this->getRequestVar('nologin') ? true : false);
         if ($this->getRequestVar('ipaddress') && $this->ipaddress->save() && $this->getRequestVar('ipaddress') != \fpcm\classes\http::getIp()) {
             $this->redirect('ips/list', array('added' => 1));
         } else {
             $this->view->addErrorMessage('SAVE_FAILED_IPADDRESS');
         }
     }
     return true;
 }
コード例 #16
0
ファイル: session.php プロジェクト: sea75300/fanpresscm3
 /**
  * Prüft ob Kombination Benutzer und Passwort existiert
  * @param string $username
  * @param string $password
  * @return bool Ja, wenn Benutzer + Passwort vorhanden ist
  */
 public function checkUser($username, $password)
 {
     $userList = new \fpcm\model\users\userList();
     $userid = $userList->getUserIdByUsername($username);
     if (!$userid) {
         trigger_error('Login failed for username ' . $username . '! User not found. Request was made by ' . \fpcm\classes\http::getIp());
         return false;
     }
     $user = new \fpcm\model\users\author($userid);
     if ($user->getDisabled()) {
         trigger_error('Login failed for username ' . $username . '! User is disabled. Request was made by ' . \fpcm\classes\http::getIp());
         return \fpcm\model\users\author::AUTHOR_ERROR_DISABLED;
     }
     if (\fpcm\classes\security::createPasswordHash($password, $user->getPasswd()) == $user->getPasswd()) {
         $timer = time();
         $this->login = $timer;
         $this->lastaction = $timer;
         $this->logout = 0;
         $this->userid = $userid;
         $this->sessionid = \fpcm\classes\security::createSessionId();
         $this->ip = \fpcm\classes\http::getIp();
         $this->sessionExists = true;
         return true;
     }
     trigger_error('Login failed for username ' . $username . '! Wrong username or password. Request was made by ' . \fpcm\classes\http::getIp());
     return false;
 }
コード例 #17
0
ファイル: pub.php プロジェクト: sea75300/fanpresscm3
 /**
  * View-Variablen initialisieren
  */
 protected function initAssigns()
 {
     /**
      * CSS und JS Files
      */
     $this->assign('FPCM_CSS_FILES', $this->config->system_mode && !$this->forceCss ? array() : $this->getViewCssFiles());
     $jsFiles = $this->getViewJsFiles();
     if ($this->config->system_mode && !$this->config->system_loader_jquery) {
         unset($jsFiles[0]);
     }
     $this->assign('FPCM_JS_FILES', $jsFiles);
     $this->assign('FPCM_JS_VARS', $this->getJsVars());
     /**
      * Pfade
      */
     $this->assign('FPCM_BASELINK', \fpcm\classes\baseconfig::$rootPath);
     $this->assign('FPCM_THEMEPATH', \fpcm\classes\baseconfig::$themePath);
     $this->assign('FPCM_BASEMODULELINK', \fpcm\classes\baseconfig::$rootPath . 'index.php?module=');
     $this->assign('FPCM_SELF', $_SERVER['PHP_SELF']);
     /**
      * Sprache
      */
     $this->assign('FPCM_LANG', $this->language);
     /**
      * Meldungen
      */
     $this->assign('FPCM_MESSAGES', $this->getMessages());
     /**
      * Login-Status
      */
     $this->assign('FPCM_LOGGEDIN', $this->session->exists());
     /**
      * System config data
      */
     $this->assign('FPCM_VERSION', $this->config->system_version);
     $this->assign('FPCM_FRONTEND_LINK', $this->config->system_url);
     $this->assign('FPCM_DATETIME_MASK', $this->config->system_dtmask);
     $this->assign('FPCM_DATETIME_ZONE', $this->config->system_timezone);
     $this->assign('FPCM_MAINTENANCE_MODE', $this->config->system_maintenance);
     /**
      * Current module
      */
     $this->assign('FPCM_CURRENT_MODULE', \fpcm\classes\http::get('module'));
     helper::init($this->config->system_lang);
 }
コード例 #18
0
ファイル: commentList.php プロジェクト: sea75300/fanpresscm3
 /**
  * Gibt Zeit zurück, wenn von der aktuellen IP der letzte Kommentar geschrieben wurde
  * @return int
  */
 public function getLastCommentTimeByIP()
 {
     $res = $this->dbcon->fetch($this->dbcon->select($this->table, 'createtime', 'ipaddress ' . $this->dbcon->dbLike() . ' ?' . $this->dbcon->orderBy(array('createtime ASC')) . $this->dbcon->limitQuery(0, 1), array(\fpcm\classes\http::getIp())));
     return isset($res->createtime) ? $res->createtime : 0;
 }
コード例 #19
0
ファイル: controller.php プロジェクト: sea75300/fanpresscm3
 /**
  * Filter
  * @param string $filterString
  * @param array $filters
  * @return string
  */
 public static function filterRequest($filterString, array $filters)
 {
     return \fpcm\classes\http::filter($filterString, $filters);
 }
コード例 #20
0
ファイル: filelist.php プロジェクト: sea75300/fanpresscm3
 public function request()
 {
     if (!is_null($this->getRequestVar('mode'))) {
         $this->mode = (int) $this->getRequestVar('mode');
         if ($this->mode > 1) {
             $this->view->setShowHeader(false);
             $this->view->setShowFooter(false);
         }
     }
     if (!is_null(\fpcm\classes\http::getFiles())) {
         $uploader = new \fpcm\model\files\fileuploader(\fpcm\classes\http::getFiles());
         $result = $uploader->processUpload($this->session->getUserId());
         if (count($result['success'])) {
             $this->view->addNoticeMessage('SAVE_SUCCESS_UPLOADPHP', array('{{filenames}}' => implode(', ', $result['success'])));
         }
         if (count($result['error'])) {
             $this->view->addErrorMessage('SAVE_FAILED_UPLOADPHP', array('{{filenames}}' => implode(', ', $result['error'])));
         }
     }
     if ($this->buttonClicked('deleteFiles') && !is_null($this->getRequestVar('filenames'))) {
         $fileNames = array_map('base64_decode', $this->getRequestVar('filenames'));
         $deletedOk = array();
         $deletedFailed = array();
         foreach ($fileNames as $fileName) {
             $image = new \fpcm\model\files\image($fileName, '', '', false);
             if ($image->delete()) {
                 $deletedOk[] = $fileName;
             } else {
                 $deletedFailed[] = $fileName;
             }
         }
         if (count($deletedOk)) {
             $this->view->addNoticeMessage('DELETE_SUCCESS_FILES', array('{{filenames}}' => implode(', ', $deletedOk)));
         }
         if (count($deletedFailed)) {
             $this->view->addErrorMessage('DELETE_FAILED_FILES', array('{{filenames}}' => implode(', ', $deletedFailed)));
         }
     }
     if ($this->buttonClicked('createThumbs') && !is_null($this->getRequestVar('filenames'))) {
         $fileNames = array_map('base64_decode', $this->getRequestVar('filenames'));
         $success = array();
         $failed = array();
         foreach ($fileNames as $fileName) {
             $image = new \fpcm\model\files\image($fileName, '', '', false);
             if ($image->createThumbnail()) {
                 $success[] = $fileName;
             } else {
                 $deletedFailed[] = $fileName;
             }
         }
         if (count($success)) {
             $this->view->addNoticeMessage('DELETE_SUCCESS_NEWTHUMBS', array('{{filenames}}' => implode(', ', $success)));
         }
         if (count($failed)) {
             $this->view->addErrorMessage('DELETE_FAILED_NEWTHUMBS', array('{{filenames}}' => implode(', ', $failed)));
         }
     }
     if ($this->buttonClicked('renameFiles') && !is_null($this->getRequestVar('filenames') && $this->getRequestVar('newfilename'))) {
         $fileNames = array_map('base64_decode', $this->getRequestVar('filenames'));
         $fileName = array_shift($fileNames);
         $image = new \fpcm\model\files\image($fileName, '', '', false);
         $newname = $this->getRequestVar('newfilename');
         if ($image->rename($newname, $this->session->getUserId())) {
             $this->view->addNoticeMessage('DELETE_SUCCESS_RENAME', array('{{filename1}}' => $fileName, '{{filename2}}' => $newname));
         } else {
             $this->view->addErrorMessage('DELETE_FAILED_RENAME', array('{{filename1}}' => $fileName, '{{filename2}}' => $newname));
         }
         $this->fileList->createFilemanagerThumbs();
     }
     return true;
 }
コード例 #21
0
ファイル: ajax.php プロジェクト: sea75300/fanpresscm3
 /**
  * View-Variablen initialisieren
  */
 public function initAssigns()
 {
     /**
      * Pfade
      */
     $this->assign('FPCM_BASELINK', \fpcm\classes\baseconfig::$rootPath);
     $this->assign('FPCM_THEMEPATH', \fpcm\classes\baseconfig::$themePath);
     $this->assign('FPCM_BASEMODULELINK', \fpcm\classes\baseconfig::$rootPath . 'index.php?module=');
     $this->assign('FPCM_SELF', $_SERVER['PHP_SELF']);
     /**
      * Sprache
      */
     $this->assign('FPCM_LANG', $this->language);
     /**
      * Login-Status
      */
     $this->assign('FPCM_LOGGEDIN', $this->session->exists());
     /**
      * System config data
      */
     $this->assign('FPCM_VERSION', $this->config->system_version);
     $this->assign('FPCM_FRONTEND_LINK', $this->config->system_url);
     $this->assign('FPCM_DATETIME_MASK', $this->config->system_dtmask);
     $this->assign('FPCM_DATETIME_ZONE', $this->config->system_timezone);
     $this->assign('FPCM_MAINTENANCE_MODE', $this->config->system_maintenance);
     $this->assign('FPCM_CRONJOBS_DISABLED', \fpcm\classes\baseconfig::asyncCronjobsEnabled());
     /**
      * Current module
      */
     $this->assign('FPCM_CURRENT_MODULE', \fpcm\classes\http::get('module'));
     if ($this->session->exists()) {
         $this->assign('FPCM_USER', $this->session->currentUser->getDisplayName());
         $this->assign('FPCM_SESSION_LOGIN', $this->session->getLogin());
     }
     helper::init($this->config->system_lang);
 }
コード例 #22
0
ファイル: showsingle.php プロジェクト: sea75300/fanpresscm3
 /**
  * Kommentar-Formular initialisieren
  * @return string
  */
 protected function assignCommentFormData()
 {
     if (!$this->config->system_comments_enabled || !$this->article->getComments()) {
         return '';
     }
     $id = $this->session->exists() ? $this->session->getUserId() : null;
     $author = new \fpcm\model\users\author($id);
     if (!$this->buttonClicked('sendComment') && is_null($this->getRequestVar('newcomment')) && $this->session->exists()) {
         $this->newComment->setName($author->getDisplayname());
         $this->newComment->setEmail($author->getEmail());
         $this->newComment->setWebsite(\fpcm\classes\http::getHttpHost());
     }
     $replacementTags = array('{{formHeadline}}' => $this->lang->translate('COMMENTS_PUBLIC_FORMHEADLINE'), '{{submitUrl}}' => $this->article->getArticleLink(), '{{nameDescription}}' => $this->lang->translate('COMMMENT_AUTHOR'), '{{nameField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[name]" value="' . $this->newComment->getName() . '">', '{{emailDescription}}' => $this->lang->translate('GLOBAL_EMAIL'), '{{emailField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[email]" value="' . $this->newComment->getEmail() . '">', '{{websiteDescription}}' => $this->lang->translate('COMMMENT_WEBSITE'), '{{websiteField}}' => '<input type="text" class="fpcm-pub-textinput" name="newcomment[website]" value="' . $this->newComment->getWebsite() . '">', '{{textfield}}' => '<textarea class="fpcm-pub-textarea" id="newcommenttext" name="newcomment[text]">' . $this->newComment->getText() . '</textarea>', '{{smileysDescription}}' => $this->lang->translate('HL_OPTIONS_SMILEYS'), '{{smileys}}' => $this->getSmileyList(), '{{tags}}' => htmlentities(\fpcm\model\comments\comment::COMMENT_TEXT_HTMLTAGS_FORM), '{{spampluginQuestion}}' => $this->captcha->createPluginText(), '{{spampluginField}}' => $this->captcha->createPluginInput(), '{{privateCheckbox}}' => '<input type="checkbox" class="fpcm-pub-checkboxinput" name="newcomment[private]" value="1">', '{{submitButton}}' => '<button type="submit" name="btnSendComment">' . $this->lang->translate('GLOBAL_SUBMIT') . '</button>', '{{resetButton}}' => '<button type="reset">' . $this->lang->translate('GLOBAL_RESET') . '</button>');
     $this->commentFormTemplate->setReplacementTags($replacementTags);
     $parsed = $this->commentFormTemplate->parse();
     if (!$this->isUtf8) {
         $parsed = utf8_decode($parsed);
     }
     return $parsed;
 }
コード例 #23
0
ファイル: acpConfig.php プロジェクト: sea75300/fanpresscm3
 public function run($params = null)
 {
     $this->dataPath = \fpcm\classes\baseconfig::$dataDir . 'langeditback/';
     $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main');
     $systemFiles = glob(\fpcm\classes\baseconfig::$langDir . '*/*.php');
     $moduleFiles = glob(\fpcm\classes\baseconfig::$moduleDir . '*/*/lang/*/*.php');
     if (!is_array($systemFiles) || !is_array($moduleFiles)) {
         $view->addErrorMessage('NKORG_LANGEDITOR_LOADERROR');
         $view->render();
         return true;
     }
     $langfiles = array_merge($systemFiles, $moduleFiles);
     $selectedFile = '';
     $lines = array();
     if (!is_null(\fpcm\classes\http::postOnly('btnLangfileSelect')) && \fpcm\classes\http::postOnly('langfile')) {
         $selectedFile = base64_decode(\fpcm\classes\http::postOnly('langfile'));
         if (!in_array($selectedFile, $langfiles) || !file_exists($selectedFile)) {
             $view->addErrorMessage('NKORG_LANGEDITOR_SELECTERROR');
             $selectedFile = '';
         } else {
             require $selectedFile;
             if (!isset($lang)) {
                 $view->addErrorMessage('NKORG_LANGEDITOR_FILEERROR');
             } else {
                 $lines = $lang;
             }
         }
     }
     if (!is_null(\fpcm\classes\http::postOnly('btnEditLangfile')) && \fpcm\classes\http::postOnly('langitems') && \fpcm\classes\http::postOnly('langfile')) {
         $selectedFile = base64_decode(\fpcm\classes\http::postOnly('langfile'));
         if (!is_writable(\fpcm\classes\baseconfig::$langDir)) {
             $view->addErrorMessage('NKORG_LANGEDITOR_NOTWRITABLE', array('{{syslangapth}}' => \fpcm\model\files\ops::removeBaseDir(\fpcm\classes\baseconfig::$langDir)));
         } else {
             $langItems = \fpcm\classes\http::postOnly('langitems', array(4, 7));
             $deletedItems = \fpcm\classes\http::postOnly('deleteitems');
             if (!is_array($deletedItems)) {
                 $deletedItems = array();
             }
             $fileLines = array();
             foreach ($langItems as $item) {
                 $name = $item['name'];
                 $value = $item['value'];
                 $hash = md5($name . $value);
                 if (!$name || !$value || in_array($hash, $deletedItems)) {
                     continue;
                 }
                 $fileLines[strtoupper($name)] = str_replace('\\n', PHP_EOL, $value);
             }
             $lines = $fileLines;
             $selectedFileBack = str_replace(DIRECTORY_SEPARATOR, '_', ltrim(\fpcm\model\files\ops::removeBaseDir($selectedFile), DIRECTORY_SEPARATOR));
             $dest = $this->dataPath . $selectedFileBack . '.' . date('YmdHis');
             if (!copy($selectedFile, $dest)) {
                 $dest = \fpcm\model\files\ops::removeBaseDir($dest, true);
                 $view->addErrorMessage('NKORG_LANGEDITOR_BACKUPERROR', array('{{path}}' => $dest));
                 trigger_error('Unable to create backup of ' . \fpcm\model\files\ops::removeBaseDir($selectedFile) . ' in ' . \fpcm\model\files\ops::removeBaseDir($this->dataPath, true));
             } else {
                 $fileContent = file_get_contents($selectedFile);
                 $langVarPos = strpos($fileContent, '$lang');
                 $fileContent = trim(substr($fileContent, 0, $langVarPos));
                 $fileContent .= PHP_EOL . PHP_EOL . '$lang = ' . var_export($fileLines, true) . ';' . PHP_EOL . '?>';
                 if (!file_put_contents($selectedFile, $fileContent)) {
                     trigger_error('Unable to save changes to language file ' . $selectedFile);
                     $view->addErrorMessage('NKORG_LANGEDITOR_SAVEERROR');
                 } else {
                     $view->addNoticeMessage('NKORG_LANGEDITOR_SAVEOK');
                 }
                 $cache = new \fpcm\classes\cache();
                 $cache->cleanup();
             }
         }
     }
     $files = array($this->lang->translate('NKORG_LANGEDITOR_FILE') => '');
     $excludeArray = array('help.php', 'tz.php');
     foreach ($langfiles as $langfile) {
         $basename = basename($langfile);
         if (in_array($basename, $excludeArray)) {
             continue;
         }
         $files[\fpcm\model\files\ops::removeBaseDir($langfile)] = base64_encode($langfile);
     }
     $view->assign('lines', $lines);
     $view->assign('langfiles', $files);
     $view->assign('selectedFile', $selectedFile);
     $view->render();
 }
コード例 #24
0
ファイル: view.php プロジェクト: sea75300/fanpresscm3
 /**
  * String zum Setzten des aktuell aktiven Modules in Navigation
  * @return string
  * @since FPCM 3.4
  */
 protected function getNavigationActiveCheckStr()
 {
     $data = array();
     $module = \fpcm\classes\http::getOnly('module');
     $mode = \fpcm\classes\http::getOnly('mode');
     $key = \fpcm\classes\http::getOnly('key');
     $data[] = \fpcm\classes\http::getOnly('module');
     $data[] = $mode ? '&mode=' . $mode : '';
     $data[] = $key ? '&key=' . $key : '';
     return implode('', $data);
 }
コード例 #25
0
ファイル: acp.php プロジェクト: sea75300/fanpresscm3
 /**
  * View-Variablen initialisieren
  */
 protected function initAssigns()
 {
     /**
      * Current module
      */
     $this->assign('FPCM_CURRENT_MODULE', \fpcm\classes\http::get('module'));
     if ($this->session->exists()) {
         $this->assign('FPCM_USER', $this->session->currentUser->getDisplayName());
         $this->assign('FPCM_SESSION_LOGIN', $this->session->getLogin());
         $nav = new \fpcm\model\theme\navigation();
         $this->assign('FPCM_NAVIGATION', $nav->render());
         $this->assign('FPCM_NAVIGATION_ACTIVE', $this->getNavigationActiveCheckStr());
         $this->jsvars = array('fpcmSessionCheckEnabled' => true) + $this->jsvars;
         $this->addJsLangVars(array('sessionCheckMsg' => $this->language->translate('SESSION_TIMEOUT')));
     }
     /**
      * Meldungen
      */
     $this->addJsVars(array('fpcmMsg' => $this->getMessages()));
     /**
      * CSS und JS Files
      */
     $this->assign('FPCM_CSS_FILES', $this->getViewCssFiles());
     $this->assign('FPCM_JS_FILES', $this->getViewJsFiles());
     $this->assign('FPCM_JS_VARS', $this->getJsVars());
     /**
      * Pfade
      */
     $this->assign('FPCM_BASELINK', \fpcm\classes\baseconfig::$rootPath);
     $this->assign('FPCM_THEMEPATH', \fpcm\classes\baseconfig::$themePath);
     $this->assign('FPCM_BASEMODULELINK', \fpcm\classes\baseconfig::$rootPath . 'index.php?module=');
     $this->assign('FPCM_SELF', $_SERVER['PHP_SELF']);
     /**
      * Sprache
      */
     $this->assign('FPCM_LANG', $this->language);
     /**
      * Login-Status
      */
     $this->assign('FPCM_LOGGEDIN', $this->session->exists());
     /**
      * Aufruf durch mobile Endgerät
      */
     $this->assign('FPCM_ISMOBILE', $this->isMobile);
     /**
      * System config data
      */
     $this->assign('FPCM_VERSION', $this->config->system_version);
     $this->assign('FPCM_FRONTEND_LINK', $this->config->system_url);
     $this->assign('FPCM_DATETIME_MASK', $this->config->system_dtmask);
     $this->assign('FPCM_DATETIME_ZONE', $this->config->system_timezone);
     $this->assign('FPCM_MAINTENANCE_MODE', $this->config->system_maintenance);
     $this->assign('FPCM_CRONJOBS_DISABLED', \fpcm\classes\baseconfig::asyncCronjobsEnabled());
     helper::init($this->config->system_lang);
 }
コード例 #26
0
ファイル: login.php プロジェクト: sea75300/fanpresscm3
 /**
  * Prüft, ob Login gesperrt ist
  */
 protected function loginLocked()
 {
     if (!\fpcm\classes\http::getSessionVar('loginAttempts')) {
         \fpcm\classes\http::setSessionVar('loginAttempts', $this->currentAttempts);
     } else {
         $this->currentAttempts = \fpcm\classes\http::getSessionVar('loginAttempts');
     }
     if (\fpcm\classes\http::getSessionVar('lockedTime')) {
         $this->loginLockedDate = \fpcm\classes\http::getSessionVar('lockedTime');
     }
     if ($this->currentAttempts >= $this->config->system_loginfailed_locked) {
         $this->loginLocked = true;
         if (!$this->loginLockedDate) {
             $this->loginLockedDate = time();
             \fpcm\classes\http::setSessionVar('lockedTime', $this->loginLockedDate);
         }
     }
     if ($this->loginLocked && $this->loginLockedDate + $this->loginLockedExpire <= time()) {
         $this->loginLocked = false;
         $this->loginLockedDate = 0;
         $this->currentAttempts = 0;
         session_destroy();
     }
 }