Ejemplo n.º 1
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     die(strip_tags($this->getRequestVar('text')));
 }
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     die($this->config->system_version);
 }
Ejemplo n.º 3
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $resOk = array();
     $resError = array();
     foreach ($this->articleItems as $article) {
         if (!$article->createTweet()) {
             $resError[] = $article->getTitle();
             continue;
         }
         $resOk[] = $article->getTitle();
         sleep(1);
     }
     $messages = array('notice' => 0, 'error' => 0);
     if (count($resOk)) {
         $messages['notice'] = $this->lang->translate('SAVE_SUCCESS_ARTICLENEWTWEET', array('{{titles}}' => implode(', ', $resOk)));
     }
     if (count($resError)) {
         $messages['error'] = $this->lang->translate('SAVE_FAILED_ARTICLENEWTWEET', array('{{titles}}' => implode(', ', $resError)));
     }
     print json_encode($messages);
     return true;
 }
Ejemplo n.º 4
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->cache->cleanup();
     $updater = new \fpcm\model\updater\modules();
     $updater->checkUpdates(true);
 }
Ejemplo n.º 5
0
 /**
  * Controller-Processing
  * @return boolean
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->getClasses();
     $this->view->assign('containers', $this->containers);
     $this->view->render();
 }
Ejemplo n.º 6
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->cache->cleanup();
     $this->events->runEvent('clearCache');
     $this->returnData[] = array('txt' => $this->lang->translate('CACHE_CLEARED_OK'), 'type' => 'notice', 'id' => md5(uniqid()), 'icon' => 'info-circle');
     $this->getResponse();
 }
Ejemplo n.º 7
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     if (method_exists($this, 'loadLog' . $this->log)) {
         call_user_func(array($this, 'loadLog' . $this->log));
     } else {
         $this->events->runEvent('reloadSystemLog', $this->log);
     }
     $this->events->runEvent('reloadSystemLogs');
 }
Ejemplo n.º 8
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $res = is_numeric($this->log) ? \fpcm\classes\logs::clearLog($this->log) : $this->events->runEvent('clearSystemLog', $this->log);
     $this->events->runEvent('clearSystemLogs');
     $view = new \fpcm\model\view\ajax();
     if ($res) {
         $view->addNoticeMessage('LOGS_CLEARED_LOG_OK');
     } else {
         $view->addErrorMessage('LOGS_CLEARED_LOG_FAILED');
     }
     $view->render();
 }
Ejemplo n.º 9
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $fileList = new \fpcm\model\files\imagelist();
     $page = $this->getRequestVar('page', array(9));
     $list = $fileList->getDatabaseList($this->config->file_list_limit, \fpcm\classes\tools::getPageOffset($page, $this->config->file_list_limit));
     $pagerData = \fpcm\classes\tools::calcPagination($this->config->file_list_limit, $page, $fileList->getDatabaseFileCount(), count($list));
     $list = $this->events->runEvent('reloadFileList', $list);
     $userList = new \fpcm\model\users\userList();
     $this->initViewAssigns($list, $userList->getUsersAll(), $pagerData);
     $this->initPermissions();
     $this->view->initAssigns();
     $this->view->render();
 }
Ejemplo n.º 10
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $draftPath = $this->getRequestVar('path');
     $file = \fpcm\classes\baseconfig::$articleTemplatesDir . $draftPath;
     if (!trim($draftPath) || !file_exists($file)) {
         $this->returnCode = -1;
         $this->returnData = '';
         $this->getResponse();
     }
     $this->returnData = file_get_contents($file);
     $this->returnCode = 1;
     $this->getResponse();
 }
Ejemplo n.º 11
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->initCommentPermissions();
     $this->view->assign('ownArticleIds', $this->articleList->getArticleIDsByUser($this->session->getUserId()));
     $this->view->assign('commentsMode', 1);
     $this->view->render();
 }
Ejemplo n.º 12
0
 /**
  * Konstruktor
  */
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 13
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $users = $this->userList->getUsersNameList();
     $this->view->assign('timesMode', true);
     $this->view->assign('users', array_flip($users));
     $this->view->assign('commentEnabledGlobal', $this->config->system_comments_enabled);
     $this->view->assign('showArchiveStatus', $this->mode == -1 ? true : false);
     $this->view->assign('showDraftStatus', false);
     $this->view->assign('isSearch', true);
     $this->view->assign('showPager', false);
     $this->initEditPermisions();
     $commentCounts = $this->commentList->countComments($this->getArticleListIds());
     $this->view->assign('commentCount', $commentCounts);
     $this->view->assign('commentSum', $commentCounts && count($this->articleItems) ? array_sum($commentCounts) : 0);
     $this->view->assign('list', $this->articleItems);
     $this->view->render();
 }
Ejemplo n.º 14
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     parent::process();
     $spacerText = $this->getRequestVar('spacertext', array(1, 4, 7));
     die("<?php \$api->showTitle('{$spacerText}'); ?>");
 }
Ejemplo n.º 15
0
 /**
  * Request-Handler
  * @return boolean
  */
 public function request()
 {
     $this->fpcm2Path = realpath(dirname(\fpcm\classes\baseconfig::$baseDir) . $this->getRequestVar('path'));
     return parent::request();
 }
Ejemplo n.º 16
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->assignModules($this->modulelist, false);
     $this->view->initAssigns();
     $this->view->render();
 }
Ejemplo n.º 17
0
 /**
  * Konstruktor
  */
 public function __construct()
 {
     $this->checkPermission = array('system' => 'options');
     parent::__construct();
 }
Ejemplo n.º 18
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     if ($this->canConnect) {
         $keyData = \fpcm\model\packages\package::explodeModuleFileName($this->key);
         $pkg = new \fpcm\model\packages\module('module', $keyData[0], $keyData[1]);
     }
     if (!isset($keyData[0]) || !isset($keyData[1])) {
         $this->returnCode = $this->step . '_0';
         $this->getResponse();
     }
     $this->returnData['current'] = $this->step;
     switch ($this->step) {
         case 1:
             $res = $pkg->download();
             $from = $pkg->getRemoteFile();
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Downloaded module package successfully from ' . $from);
                 $this->returnData['nextstep'] = 2;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while downloading module package from' . $from);
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 2:
             $res = $pkg->extract();
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getLocalFile());
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Extracted module package successfully from ' . $from);
                 $this->returnData['nextstep'] = 3;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while extracting module package from ' . $from);
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 3:
             $res = $pkg->copy();
             $dest = \fpcm\model\files\ops::removeBaseDir(\fpcm\classes\baseconfig::$baseDir) . $pkg->getCopyDestination() . $pkg->getKey();
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getExtractPath() . basename($pkg->getKey()));
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Moved module package content successfully from ' . $from . ' to ' . $dest);
                 $this->returnData['nextstep'] = 4;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while moving module package content from ' . $from . ' to ' . $dest);
                 \fpcm\classes\logs::syslogWrite(implode('<br>', $pkg->getCopyErrorPaths()));
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 4:
             $moduleClass = \fpcm\model\abstracts\module::getModuleClassName($keyData[0]);
             $res = class_exists($moduleClass);
             $moduleClassPath = \fpcm\classes\baseconfig::$moduleDir . $keyData[0] . '/' . str_replace(array('\\', '/'), '', $keyData[0]) . '.php';
             if (!file_exists($moduleClassPath)) {
                 $res = false;
                 trigger_error('Module class ' . $moduleClass . ' not found in "' . $moduleClassPath . '"!');
                 $this->returnData['nextstep'] = 5;
                 break;
             }
             if ($res) {
                 $modObj = new $moduleClass($keyData[0], '', $keyData[1]);
                 if (!is_a($modObj, '\\fpcm\\model\\abstracts\\module')) {
                     $res = false;
                     trigger_error('Module class ' . $moduleClass . ' must be an instance of "\\fpcm\\model\\abstracts\\module"!');
                     break;
                 }
                 $res = $modObj->runInstall();
             }
             $this->returnData['nextstep'] = 5;
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Run final module install steps successfully for ' . $pkg->getKey());
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while running final module install steps for ' . $pkg->getKey());
             }
             break;
         case 5:
             if ($this->canConnect) {
                 $pkg->loadPackageFileListFromTemp();
                 \fpcm\classes\logs::pkglogWrite($pkg->getKey() . ' ' . $pkg->getVersion(), $pkg->getFiles());
                 $pkg->cleanup();
             }
             \fpcm\classes\baseconfig::enableAsyncCronjobs(true);
             $this->cache->cleanup();
             $res = true;
             break;
         default:
             $res = false;
             break;
     }
     $this->returnCode = $this->step . '_' . (int) $res;
     $this->getResponse();
 }
Ejemplo n.º 19
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->canConnect = \fpcm\classes\baseconfig::canConnect();
     if ($this->canConnect) {
         $versionDataFile = new \fpcm\model\files\tempfile('newversion');
         if ($versionDataFile->exists() && $versionDataFile->getContent()) {
             $remoteData = json_decode($versionDataFile->getContent(), true);
         } else {
             $updater = new \fpcm\model\updater\system();
             $updater->checkUpdates();
             $remoteData = $updater->getRemoteData();
             $versionDataFile->setContent(json_encode($remoteData));
             $versionDataFile->save();
         }
         $fileInfo = pathinfo($remoteData['filepath'], PATHINFO_FILENAME);
         $tmpFile = new \fpcm\model\files\tempfile('forceUpdateFile');
         if ($tmpFile->exists()) {
             $fileInfo = $tmpFile->getContent();
         }
         $signature = isset($remoteData['signature']) ? $remoteData['signature'] : '';
         $pkg = new \fpcm\model\packages\update('update', $fileInfo, '', $signature);
     }
     $this->returnData['current'] = $this->step;
     switch ($this->step) {
         case 1:
             $res = $pkg->download();
             if ($res === \fpcm\model\packages\package::FPCMPACKAGE_REMOTEFILE_ERROR) {
                 $versionDataFile->delete();
             }
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Downloaded update package successfully from ' . $pkg->getRemoteFile());
                 $this->returnData['nextstep'] = 2;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while downloading update package from ' . $pkg->getRemoteFile());
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 2:
             $res = $pkg->extract();
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getLocalFile());
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Extracted update package successfully from ' . $from);
                 $this->returnData['nextstep'] = 3;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while extracting update package from ' . $from);
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 3:
             $res = $pkg->copy();
             $dest = \fpcm\model\files\ops::removeBaseDir(\fpcm\classes\baseconfig::$baseDir);
             $from = \fpcm\model\files\ops::removeBaseDir($pkg->getExtractPath());
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Moved update package content successfully from ' . $from . ' to ' . $dest);
                 $this->returnData['nextstep'] = 4;
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while moving update package content from ' . $from . ' to ' . $dest);
                 \fpcm\classes\logs::syslogWrite(implode('<br>', $pkg->getCopyErrorPaths()));
                 $this->returnData['nextstep'] = 5;
             }
             break;
         case 4:
             $finalizer = new \fpcm\model\updater\finalizer();
             $res = $finalizer->runUpdate();
             $this->returnData['nextstep'] = $this->forceStep ? 6 : 5;
             if ($res === true) {
                 \fpcm\classes\logs::syslogWrite('Run final update steps successfully!');
             } else {
                 \fpcm\classes\logs::syslogWrite('Error while running final update steps!');
             }
             break;
         case 5:
             if ($this->canConnect) {
                 $pkg->loadPackageFileListFromTemp();
                 \fpcm\classes\logs::pkglogWrite($pkg->getKey() . ' ' . $pkg->getVersion(), $pkg->getFiles());
                 $pkg->cleanup();
             }
             \fpcm\classes\baseconfig::enableAsyncCronjobs(true);
             $this->cache->cleanup();
             $res = true;
             $this->returnData['nextstep'] = 6;
             break;
         case 6:
             $this->returnData['newver'] = $this->config->system_version;
             $res = true;
             if ($versionDataFile->exists()) {
                 $versionDataFile->delete();
             }
             break;
         default:
             $res = false;
             break;
     }
     $this->returnCode = $this->step . '_' . (int) $res;
     $this->getResponse();
 }