Exemple #1
0
 /**
  * Gibt Liste mit Modulen zurück, die von Modul-Server angeboten werden
  * @param bool $init
  * @return array
  */
 public function getModulesRemote($init = true)
 {
     if (!\fpcm\classes\baseconfig::canConnect()) {
         return array();
     }
     $moduleUpdater = new \fpcm\model\updater\modules();
     $moduleUpdater->getModulelist();
     $remoteModues = $moduleUpdater->getRemoteData();
     if (!is_array($remoteModues)) {
         return array();
     }
     $modules = array();
     foreach ($remoteModues as $key => $value) {
         if (version_compare($this->config->system_version, $value['minsysverion'], '<') || version_compare($this->config->system_version, $value['maxsysverion'], '>')) {
             continue;
         }
         $value['description'] = isset($value['description']) ? $value['description'] : '';
         $value['author'] = isset($value['author']) ? $value['author'] : '';
         $value['link'] = isset($value['link']) ? $value['link'] : '';
         $value['systemMinVersion'] = isset($value['minsysverion']) ? $value['minsysverion'] : '';
         $mlConfig = $this->getConfigByModuleKey($key, 'modulelist');
         $moduleItem = new \fpcm\model\modules\listitem($key, $value['name'], isset($mlConfig['version']) ? $mlConfig['version'] : '-', $value['version'], $value['description'], $value['author'], $value['link'], $value['systemMinVersion'], $init);
         if (isset($value['dependencies'])) {
             $moduleItem->setDependencies($value['dependencies']);
         }
         $modules[$key] = $moduleItem;
     }
     return $modules;
 }
Exemple #2
0
 /**
  * Controller-Processing
  * @return boolean
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'moduleinstaller.js'));
     $tempFile = new \fpcm\model\files\tempfile('installkeys');
     if (!$tempFile->getContent()) {
         trigger_error('No module key data found!');
         $this->view->addErrorMessage('MODULES_FAILED_TEMPKEYS');
         $this->view->assign('nokeys', true);
         $this->view->render();
         return false;
     }
     $startStep = $this->forceStep ? $this->forceStep : (\fpcm\classes\baseconfig::canConnect() ? 1 : 4);
     $keys = json_decode($tempFile->getContent(), true);
     $params = $this->initPkgManagerData();
     $params['fpcmModuleKeys'] = $keys;
     $params['fpcmModuleUrl'] = \fpcm\classes\baseconfig::$moduleServer . 'packages/{{pkgkey}}.zip';
     $params['fpcmUpdaterStartStep'] = $this->forceStep ? $this->forceStep : (\fpcm\classes\baseconfig::canConnect() ? 1 : 4);
     $params['fpcmProgressbarMax'] = count($keys);
     $params['fpcmUpdaterMessages']['EXIT_1'] = $this->lang->translate('MODULES_SUCCESS_INSTALL');
     $params['fpcmUpdaterMessages']['4_0'] = $this->lang->translate('MODULES_FAILED_INSTALL');
     $this->view->addJsVars($params);
     $this->view->render();
     $tempFile->delete();
 }
Exemple #3
0
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->assignModules($this->moduleList);
     $this->view->addJsLangVars(array('detailsHeadline' => $this->lang->translate('MODULES_LIST_INFORMATIONS')));
     $this->view->addJsVars(array('fpcmJqUploadInit' => 0));
     $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'modulelist.js', \fpcm\classes\baseconfig::$jsPath . 'filemanager.js'));
     if (!$this->permissions->check(array('modules' => 'install'))) {
         unset($this->moduleActions[$this->lang->translate('MODULES_LIST_INSTALL')], $this->moduleActions[$this->lang->translate('MODULES_LIST_UPDATE')]);
     }
     if (!$this->permissions->check(array('modules' => 'uninstall'))) {
         unset($this->moduleActions[$this->lang->translate('MODULES_LIST_UNINSTALL')]);
     }
     if (!$this->permissions->check(array('modules' => 'enable'))) {
         unset($this->moduleActions[$this->lang->translate('MODULES_LIST_ENABLE')], $this->moduleActions[$this->lang->translate('MODULES_LIST_DISABLE')]);
     }
     $this->view->assign('moduleManagerMode', true);
     if (!\fpcm\classes\baseconfig::canConnect()) {
         unset($this->moduleActions[$this->lang->translate('MODULES_LIST_INSTALL')], $this->moduleActions[$this->lang->translate('MODULES_LIST_UPDATE')]);
         $this->view->assign('moduleManagerMode', false);
     }
     $translInfo = array('{{filecount}}' => 1, '{{filesize}}' => \fpcm\classes\tools::calcSize(\fpcm\classes\baseconfig::uploadFilesizeLimit(true), 0));
     $this->view->assign('maxFilesInfo', $this->lang->translate('FILE_LIST_PHPMAXINFO', $translInfo));
     $this->view->assign('actionPath', \fpcm\classes\baseconfig::$rootPath . $this->getControllerLink('modules/list'));
     $this->view->assign('moduleActions', $this->moduleActions);
     $this->view->render();
 }
Exemple #4
0
 /**
  * Content rendern
  */
 private function renderContent()
 {
     if (!\fpcm\classes\baseconfig::canConnect()) {
         $this->content = $this->language->translate('GLOBAL_NOTFOUND2');
         return false;
     }
     $xmlString = simplexml_load_file('https://nobody-knows.org/category/fanpress-cm/feed/');
     if (!$xmlString) {
         $this->content = $this->language->translate('GLOBAL_NOTFOUND2');
         return false;
     }
     $items = $xmlString->channel->item;
     $idx = 0;
     $content = array();
     $content[] = '<table class="fpcm-ui-table fpcm-ui-rssnews fpcm-ui-large-td">';
     foreach ($items as $item) {
         if ($idx >= 10) {
             break;
         }
         $content[] = '<tr class="fpcm-small-text">';
         $content[] = '  <td class="fpcm-ui-articlelist-open">';
         $content[] = '  <a class="fpcm-ui-button fpcm-ui-button-blank fpcm-openlink-btn" href="' . \fpcm\model\view\helper::escapeVal(strip_tags($item->link)) . '" target="_blank" title="' . $this->language->translate('GLOBAL_OPENNEWWIN') . '">' . $this->language->translate('GLOBAL_OPENNEWWIN') . '</a>';
         $content[] = '  </td>';
         $content[] = '  <td>';
         $content[] = '  <strong>' . \fpcm\model\view\helper::escapeVal(strip_tags($item->title)) . '</strong><br>';
         $content[] = '  <span>' . date($this->config->system_dtmask, strtotime($item->pubDate)) . '</span>';
         $content[] = '  </td>';
         $content[] = '</tr>';
         $idx++;
     }
     $content[] = '</table>';
     $this->content = implode(PHP_EOL, $content);
     $this->cache->write($this->content, $this->config->system_cache_timeout);
 }
Exemple #5
0
 /**
  * Check ausführen
  */
 protected function runCheck()
 {
     $checkFolders = array($this->language->translate('SYSCHECK_FOLDER_DATA') => \fpcm\classes\baseconfig::$dataDir, $this->language->translate('SYSCHECK_FOLDER_CACHE') => \fpcm\classes\baseconfig::$cacheDir, $this->language->translate('SYSCHECK_FOLDER_CONFIG') => \fpcm\classes\baseconfig::$configDir, $this->language->translate('SYSCHECK_FOLDER_FILEMANAGER') => \fpcm\classes\baseconfig::$filemanagerTempDir, $this->language->translate('SYSCHECK_FOLDER_LOGS') => \fpcm\classes\baseconfig::$logDir, $this->language->translate('SYSCHECK_FOLDER_MODULES') => \fpcm\classes\baseconfig::$moduleDir, $this->language->translate('SYSCHECK_FOLDER_SHARE') => \fpcm\classes\baseconfig::$shareDir, $this->language->translate('SYSCHECK_FOLDER_SMILEYS') => \fpcm\classes\baseconfig::$smileyDir, $this->language->translate('SYSCHECK_FOLDER_STYLES') => \fpcm\classes\baseconfig::$stylesDir, $this->language->translate('SYSCHECK_FOLDER_TEMP') => \fpcm\classes\baseconfig::$tempDir, $this->language->translate('SYSCHECK_FOLDER_UPLOADS') => \fpcm\classes\baseconfig::$uploadDir, $this->language->translate('SYSCHECK_FOLDER_DBDUMPS') => \fpcm\classes\baseconfig::$dbdumpDir, $this->language->translate('SYSCHECK_FOLDER_DRAFTS') => \fpcm\classes\baseconfig::$articleTemplatesDir);
     natcasesort($checkFolders);
     $this->tableContent[] = '<tr colspan="2"><td class="fpcm-ui-center"><a class="fpcm-ui-button fpcm-ui-margin-icon fpcm-syscheck-btn" href="index.php?module=system/options&syscheck=1">' . $this->language->translate('SYSCHECK_COMPLETE') . '</a></td></tr>';
     $this->tableContent[] = '<tr><td colspan="2" class="fpcm-td-spacer" style="padding-bottom:0.5em;"></td></tr>';
     foreach ($checkFolders as $description => $folderPath) {
         $checkres = $this->boolToText(is_writable($folderPath));
         $linePath = \fpcm\model\files\ops::removeBaseDir($folderPath, true);
         $this->tableContent[] = "<tr><td title=\"{$linePath}\"><strong>{$description}:</strong></td><td class=\"fpcm-ui-center\">{$checkres}</td></tr>";
     }
     $this->tableContent[] = '<tr><td><strong>' . $this->language->translate('SYSTEM_CHECK_CONNECT') . ':</strong></td><td class="fpcm-ui-center">' . $this->boolToText2(\fpcm\classes\baseconfig::canConnect()) . '</td></tr>';
 }
Exemple #6
0
 /**
  * System-Check ausführen
  * @return array
  */
 protected function getCheckOptionsSystem()
 {
     $checkOptions = array();
     $loadedExtensions = array_map('strtolower', get_loaded_extensions());
     $phpVer = '5.4.0';
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPVERSION')] = array('current' => phpversion(), 'recommend' => $phpVer, 'result' => version_compare(phpversion(), $phpVer, '>='), 'helplink' => 'http://php.net/', 'optional' => 0);
     $recomVal = 64;
     $curVal = \fpcm\classes\baseconfig::memoryLimit();
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPMEMLIMIT')] = array('current' => $curVal . ' MiB', 'recommend' => $recomVal . ' MiB', 'result' => $curVal >= $recomVal ? true : false, 'helplink' => 'http://php.net/manual/de/info.configuration.php', 'optional' => 1);
     $recomVal = 10;
     $curVal = ini_get('max_execution_time');
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_PHPMAXEXECTIME')] = array('current' => $curVal . ' sec', 'recommend' => $recomVal . ' sec', 'result' => $curVal >= $recomVal ? true : false, 'helplink' => 'http://php.net/manual/de/info.configuration.php', 'optional' => 1);
     $dbDrivers = \PDO::getAvailableDrivers();
     $resultMySql = in_array('mysql', $dbDrivers);
     $resultPgSql = in_array('pgsql', $dbDrivers);
     $sqlhelp = 'http://php.net/manual/de/pdo.getavailabledrivers.php';
     $current = $resultMySql || $resultPgSql ? true : false;
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_MYSQL')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => $resultMySql, 'helplink' => $sqlhelp, 'optional' => !$resultMySql && $resultPgSql ? 1 : 0);
     $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_PGSQL')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => $resultPgSql, 'helplink' => $sqlhelp, 'optional' => $resultMySql ? 1 : 0);
     if (is_object(\fpcm\classes\baseconfig::$fpcmDatabase)) {
         $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBDRV_ACTIVE')] = array('current' => \fpcm\classes\baseconfig::$fpcmDatabase->getDbtype(), 'recommend' => implode(', ', array_intersect($dbDrivers, array_keys(\fpcm\classes\database::$supportedDBMS))), 'result' => true, 'helplink' => 'http://php.net/manual/de/pdo.getavailabledrivers.php', 'optional' => 0);
         $checkOptions[$this->lang->translate('SYSTEM_OPTIONS_SYSCHECK_DBVERSION')] = array('current' => \fpcm\classes\baseconfig::$fpcmDatabase->getDbVersion(), 'recommend' => \fpcm\classes\baseconfig::$fpcmDatabase->getRecommendVersion(), 'result' => \fpcm\classes\baseconfig::$fpcmDatabase->checkDbVersion(), 'helplink' => 'http://php.net/manual/de/pdo.getattribute.php', 'optional' => 0);
     }
     $current = in_array('pdo', $loadedExtensions) && in_array('pdo_mysql', $loadedExtensions);
     $checkOptions['PHP Data Objects (PDO)'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.pdo.php', 'optional' => 0);
     $current = CRYPT_SHA256 == 1 ? true : false;
     $current = $current && in_array(\fpcm\classes\security::defaultHashAlgo, hash_algos());
     $checkOptions['SHA256 Hash Algorithm'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/function.hash-algos.php', 'optional' => 0);
     $current = in_array('gd', $loadedExtensions);
     $checkOptions['GD Lib'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/book.image.php', 'optional' => 0);
     $current = in_array('json', $loadedExtensions);
     $checkOptions['JSON'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/book.json.php', 'optional' => 0);
     $current = in_array('xml', $loadedExtensions) && in_array('simplexml', $loadedExtensions) && class_exists('DOMDocument');
     $checkOptions['XML, SimpleXML, DOMDocument'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.simplexmlelement.php', 'optional' => 0);
     $current = in_array('zip', $loadedExtensions);
     $checkOptions['ZipArchive'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'helplink' => 'http://php.net/manual/en/class.ziparchive.php', 'optional' => 0);
     $externalCon = \fpcm\classes\baseconfig::canConnect();
     $checkOptions['allow_url_fopen = 1 (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $externalCon ? 'true' : false, 'recommend' => 'true', 'result' => true && $externalCon, 'helplink' => 'http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen', 'optional' => 1);
     $current = in_array('curl', $loadedExtensions);
     $checkOptions['cURL (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => false || $current, 'helplink' => 'http://php.net/manual/en/book.curl.php', 'optional' => 1);
     $current = in_array('phar', $loadedExtensions);
     $checkOptions['Phar (' . $this->lang->translate('GLOBAL_OPTIONAL') . ')'] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => false || $current, 'helplink' => 'http://php.net/manual/en/class.phar.php', 'optional' => 1);
     $checkFolders = $this->getCheckFolders();
     foreach ($checkFolders as $description => $folderPath) {
         $current = is_writable($folderPath);
         $pathOutput = \fpcm\model\files\ops::removeBaseDir($folderPath, true);
         $checkOptions['<i>' . $description . ' ' . $pathOutput . '</i> ' . $this->lang->translate('GLOBAL_WRITABLE')] = array('current' => $current ? 'true' : 'false', 'recommend' => 'true', 'result' => true && $current, 'optional' => 0);
     }
     return $checkOptions;
 }
Exemple #7
0
 /**
  * Liefert System-Update-HTML zurück
  * @since FPCM 3.1.0
  */
 private function getSystemUpdateStatus()
 {
     $this->systemCheckresult = $this->systemUpdates->checkUpdates();
     if ($this->systemCheckresult === false || $this->systemCheckresult === \fpcm\model\updater\system::SYSTEMUPDATER_FORCE_UPDATE) {
         $iconClass = 'fa-cloud-download';
         $statusClass = 'fpcm-dashboard-updates-outdated';
         $replace = array('{{versionlink}}' => 'index.php?module=package/sysupdate', '{{version}}' => $this->systemUpdates->getRemoteData('version'));
         $statusText = $this->language->translate('UPDATE_VERSIONCHECK_NEW', $replace);
     } elseif ($this->systemCheckresult === \fpcm\model\updater\system::SYSTEMUPDATER_FURLOPEN_ERROR) {
         $iconClass = 'fa-exclamation-triangle';
         $statusClass = 'fpcm-dashboard-updates-checkerror';
         $statusText = $this->language->translate('UPDATE_NOTAUTOCHECK');
         if (\fpcm\classes\baseconfig::canConnect()) {
             $this->autoCheckFailed = true;
         }
     } else {
         $iconClass = 'fa-check';
         $statusClass = 'fpcm-dashboard-updates-current';
         $statusText = $this->language->translate('UPDATE_VERSIONCHECK_CURRENT', array('{{releaseinfo}}' => $this->systemUpdates->getRemoteData('notice') ? '<a href="' . $this->systemUpdates->getRemoteData('notice') . '">Release-Infos</a>' : '', '{{releasmsg}}' => $this->systemUpdates->getRemoteData('message')));
     }
     $this->renderTable($iconClass, $statusClass, $statusText);
 }
Exemple #8
0
 /**
  * Controller-Processing
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     if (!is_writable(\fpcm\classes\baseconfig::$versionFile)) {
         $this->view->addErrorMessage('UPDATE_WRITEERROR');
         $this->view->render();
         return false;
     }
     $this->config->setMaintenanceMode(false);
     $updater = new \fpcm\model\updater\system();
     $updater->checkUpdates();
     $remoteFilePath = $updater->getRemoteData('filepath');
     $params = $this->initPkgManagerData();
     $params['fpcmUpdaterMaxStep'] = 6;
     $params['fpcmUpdaterStartStep'] = $this->forceStep ? $this->forceStep : (\fpcm\classes\baseconfig::canConnect() ? 1 : 4);
     $params['fpcmUpdaterMessages']['1_START'] = $this->lang->translate('PACKAGES_RUN_DOWNLOAD', array('{{pkglink}}' => is_array($remoteFilePath) ? '' : $remoteFilePath));
     $params['fpcmUpdaterMessages']['EXIT_1'] = $this->lang->translate('UPDATES_SUCCESS');
     $this->view->addJsVars($params);
     $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'updater.js'));
     $this->view->render();
 }
 /**
  * Konstruktor
  */
 public function __construct()
 {
     parent::__construct();
     $this->checkPermission = array('system' => 'options', 'modules' => 'configure', 'modules' => 'install');
     $this->canConnect = \fpcm\classes\baseconfig::canConnect();
 }
Exemple #10
0
 /**
  * Konstruktor
  * @param int $init
  */
 public function __construct()
 {
     parent::__construct();
     $this->canConnect = \fpcm\classes\baseconfig::canConnect();
 }
Exemple #11
0
 /**
  * Prüft ob neue System-Updates vorhanden sind, erzeugt ggf. Meldung mit Möglichkeit, Update zu starten
  * @return void
  */
 protected function checkUpdates()
 {
     if (!$this->updateCheckEnabled) {
         return;
     }
     $asyncMail = $this->session->exists() ? false : true;
     $res = $this->crons->registerCron('updateCheck', $asyncMail);
     if ($res === \fpcm\model\updater\system::SYSTEMUPDATER_FURLOPEN_ERROR || !\fpcm\classes\baseconfig::canConnect()) {
         $updater = new \fpcm\model\updater\system();
         $this->view->addJsVars(array('fpcmManualCheckUrl' => $updater->getManualCheckAddress(), 'fpcmManualCheckHeadline' => $this->lang->translate('HL_PACKAGEMGR_SYSUPDATES')));
         $this->view->assign('includeManualCheck', true);
         if (!\fpcm\classes\baseconfig::canConnect() && $updater->checkManual()) {
             $this->view->assign('autoDialog', is_null($res) ? false : true);
         } else {
             $this->view->assign('autoDialog', false);
         }
         return;
     } elseif ($res === \fpcm\model\updater\system::SYSTEMUPDATER_FORCE_UPDATE) {
         $this->redirect('package/sysupdate');
         return;
     } elseif ($res === false) {
         $systemUpdates = new \fpcm\model\updater\system();
         $replace = array('{{versionlink}}' => $this->getControllerLink('package/sysupdate'), '{{version}}' => $systemUpdates->getRemoteData('version'));
         $this->view->addErrorMessage('UPDATE_VERSIONCHECK_NEW', $replace);
     }
 }
Exemple #12
0
 /**
  * Gibt gemeinsame initiale Daten für Paketmanager zurück,
  * beeinhaltet Benachrichtigungen, Statusinfos, etc.
  * @return array
  */
 public function initPkgManagerData()
 {
     return array('fpcmCronAsyncDiabled' => true, 'fpcmUpdaterProcessTime' => $this->lang->translate('PACKAGES_PROCESS_TIME'), 'fpcmUpdaterMaxStep' => $this->forceStep ? $this->forceStep : 5, 'fpcmUpdaterProgressbar' => (int) \fpcm\classes\baseconfig::canConnect(), 'fpcmUpdaterMessages' => array('1_START' => $this->lang->translate('PACKAGES_RUN_DOWNLOAD'), '2_START' => $this->lang->translate('PACKAGES_RUN_EXTRACT'), '3_START' => $this->lang->translate('PACKAGES_RUN_COPY'), '4_START' => $this->lang->translate('PACKAGES_RUN_ADDITIONAL'), '5_START' => $this->lang->translate('PACKAGES_FILE_LIST'), 'EXIT_1' => $this->lang->translate('UPDATES_SUCCESS'), '1_1' => $this->lang->translate('PACKAGES_SUCCESS_DOWNLOAD'), '1_0' => $this->lang->translate('PACKAGES_FAILED_GENERAL'), '2_1' => $this->lang->translate('PACKAGES_SUCCESS_EXTRACT'), '2_0' => $this->lang->translate('PACKAGES_FAILED_GENERAL'), '3_1' => $this->lang->translate('PACKAGES_SUCCESS_COPY'), '3_0' => $this->lang->translate('PACKAGES_FAILED_GENERAL'), '4_1' => $this->lang->translate('PACKAGES_SUCCESS_ADDITIONAL'), '4_0' => $this->lang->translate('UPDATES_FAILED'), '5_1' => $this->lang->translate('PACKAGES_SUCCESS_LOGDONE'), '6_1' => $this->lang->translate('PACKAGES_UPDATE_NEW_VERSION'), '1_' . \fpcm\model\packages\package::FPCMPACKAGE_REMOTEFILE_ERROR => $this->lang->translate('PACKAGES_FAILED_REMOTEFILE'), '1_' . \fpcm\model\packages\package::FPCMPACKAGE_LOCALFILE_ERROR => $this->lang->translate('PACKAGES_FAILED_LOCALFILE'), '1_' . \fpcm\model\packages\package::FPCMPACKAGE_LOCALWRITE_ERROR => $this->lang->translate('PACKAGES_FAILED_LOCALWRITE'), '1_' . \fpcm\model\packages\package::FPCMPACKAGE_LOCALEXISTS_ERROR => $this->lang->translate('PACKAGES_FAILED_LOCALEXISTS'), '1_' . \fpcm\model\packages\package::FPCMPACKAGE_HASHCHECK_ERROR => $this->lang->translate('PACKAGES_FAILED_HASHCHECK'), '2_' . \fpcm\model\packages\package::FPCMPACKAGE_ZIPOPEN_ERROR => $this->lang->translate('PACKAGES_FAILED_ZIPOPEN'), '2_' . \fpcm\model\packages\package::FPCMPACKAGE_ZIPEXTRACT_ERROR => $this->lang->translate('PACKAGES_FAILED_ZIPEXTRACT'), '3_' . \fpcm\model\packages\package::FPCMPACKAGE_FILESCOPY_ERROR => $this->lang->translate('PACKAGES_FAILED_FILESCOPY')));
 }
Exemple #13
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();
 }
Exemple #14
0
 /**
  * Erzeugt einen Tweet bei Twitter, wenn Verbindung aktiv und Events ausgewählt
  * @return boolean
  */
 public function createTweet()
 {
     if (!\fpcm\classes\baseconfig::canConnect() || !$this->config->twitter_events['create'] && !$this->config->twitter_events['update']) {
         return false;
     }
     /* @var $eventResult article */
     $eventResult = $this->events->runEvent('articleCreateTweet', $this);
     $author = new \fpcm\model\users\author($eventResult->getCreateuser());
     $tpl = new \fpcm\model\pubtemplates\tweet();
     $tpl->setReplacementTags(array('{{headline}}' => $eventResult->getTitle(), '{{author}}' => $author->getDisplayname(), '{{date}}' => date($this->config->system_dtmask), '{{permaLink}}' => $eventResult->getArticleLink(), '{{shortLink}}' => $eventResult->getArticleShortLink()));
     if ($this->tweetOverride !== false) {
         $tpl->setContent($this->tweetOverride);
     }
     $twitter = new \fpcm\model\system\twitter();
     return $twitter->updateStatus($tpl->parse());
 }
Exemple #15
0
 /**
  * @see \fpcm\controller\abstracts\controller::process()
  * @return mixed
  */
 public function process()
 {
     if (!parent::process()) {
         return false;
     }
     $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId());
     $this->view->assign('editorMode', 1);
     $this->view->assign('showRevisions', true);
     $this->view->assign('postponedTimer', $this->article->getCreatetime());
     $this->view->assign('users', $this->userList->getUsersByIds(array($this->article->getCreateuser(), $this->article->getChangeuser())));
     $this->view->assign('commentCount', array_sum($this->commentList->countComments(array($this->article->getId()))));
     $this->view->assign('comments', $this->commentList->getCommentsByCondition($this->article->getId(), -1, -1, -1));
     $this->view->assign('commentsMode', 2);
     $revisions = $this->article->getRevisions();
     $this->view->assign('revisions', $revisions);
     $this->view->assign('revisionCount', count($revisions));
     $this->view->assign('revisionPermission', $this->permissions->check(array('article' => 'revisions')));
     $this->view->addJsVars(array('fpcmEditorCommentLayerSave' => $this->lang->translate('GLOBAL_SAVE'), 'fpcmCanConnect' => \fpcm\classes\baseconfig::canConnect() ? 1 : 0, 'fpcmNavigationActiveItemId' => 'itemnav-id-editnews'));
     $this->view->addJsLangVars(array('editorCommentLayerHeader' => $this->lang->translate('COMMENTS_EDIT')));
     if (!$this->permissions->check(array('article' => 'approve')) && $this->article->getApproval()) {
         $this->view->addMessage('Um den Artikel freizugeben, speichere ihn einfach erneut ab.');
     }
     $this->initPermissions();
     $this->view->assign('isRevision', false);
     if ($this->showRevision) {
         $this->view->assign('currentArticle', $this->currentArticle);
         $this->view->assign('editorFile', \fpcm\classes\baseconfig::$viewsDir . 'articles/editors/revisiondiff.php');
         $this->view->assign('isRevision', true);
         $this->view->assign('showRevisions', false);
         $this->view->assign('showComments', false);
         $this->view->assign('editorAction', 'articles/edit&articleid=' . $this->article->getId() . '&rev=' . $this->getRequestVar('rev'));
     }
     $this->view->render();
 }