public function request() { if (!\fpcm\classes\baseconfig::installerEnabled() && \fpcm\classes\baseconfig::dbConfigExists() && !$this->session->exists()) { return false; } return true; }
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(); }
/** * 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; }
/** * Auszuführender Cron-Code */ public function run() { if (!\fpcm\classes\baseconfig::asyncCronjobsEnabled()) { return false; } if (!is_writable(\fpcm\classes\baseconfig::$tempDir)) { trigger_error('Unable to cleanup ' . \fpcm\classes\baseconfig::$tempDir . '! Access denied!'); return false; } $tempFiles = glob(\fpcm\classes\baseconfig::$tempDir . '*'); if (!is_array($tempFiles) || !count($tempFiles)) { return true; } foreach ($tempFiles as $tempFile) { if ($tempFile == \fpcm\classes\baseconfig::$tempDir . 'index.html') { continue; } if (filectime($tempFile) + 3600 * 24 > time()) { continue; } if (is_dir($tempFile)) { \fpcm\model\files\ops::deleteRecursive($tempFile); continue; } unlink($tempFile); } \fpcm\classes\logs::syslogWrite('Temp files cleanup in ' . \fpcm\classes\baseconfig::$tempDir); return true; }
/** * Request-Handler * @return boolean */ public function request() { if (\fpcm\classes\baseconfig::dbConfigExists()) { return false; } return true; }
/** * 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(); }
/** * 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); }
public function run($params = null) { $dbconf = \fpcm\classes\baseconfig::getDatabaseConfig(); $view = new \fpcm\model\view\module(\fpcm\model\abstracts\module::getModuleKeyByFolder(__DIR__), 'acp', 'main'); $view->assign('dbconfig', $dbconf); $view->render(); }
/** * Request-Handler * @return boolean */ public function request() { if (!\fpcm\classes\baseconfig::dbConfigExists() && !\fpcm\classes\baseconfig::installerEnabled()) { return false; } $this->filename = base64_decode(str_rot13(base64_decode($this->getRequestVar('file')))); return true; }
/** * Konstruktor * @return boolean */ public function __construct() { if (\fpcm\classes\baseconfig::installerEnabled()) { return false; } $this->config = \fpcm\classes\baseconfig::$fpcmConfig; $this->lang = \fpcm\classes\baseconfig::$fpcmLanguage; $this->config->setUserSettings(); }
/** * 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>'; }
/** * Kopiert Inhalt von Paket von Quelle nach Ziel * @return boolean */ public function copy() { if (!file_exists($this->tempListFile)) { \fpcm\classes\baseconfig::enableAsyncCronjobs(true); return false; } $this->loadPackageFileListFromTemp(); if (!count($this->files)) { \fpcm\classes\baseconfig::enableAsyncCronjobs(true); return false; } $res = true; foreach ($this->files as $zipFile) { $source = $this->extractPath . $zipFile; $dest = dirname(\fpcm\classes\baseconfig::$baseDir) . $this->copyDestination . $zipFile; $dest = is_dir($source) ? dirname($dest) . '/' . basename($dest) : $dest; $dest = $this->replaceFanpressDirString($dest); if (substr($dest, -8) === 'fanpress') { continue; } if (is_dir($source)) { if (!file_exists($dest) && !mkdir($dest, 0777)) { if (!is_array($res)) { $res = array(); } $res[] = $dest; } continue; } if (file_exists($dest)) { if (sha1_file($source) == sha1_file($dest)) { continue; } $backFile = $dest . '.back'; if (file_exists($backFile)) { unlink($backFile); } rename($dest, $backFile); } if (!copy($source, $dest)) { if (!is_array($res)) { $res = array(); } $res[] = $dest; } } if (is_array($res)) { $this->copyErrorPaths = $res; } return is_array($res) ? self::FPCMPACKAGE_FILESCOPY_ERROR : $res; }
/** * Konstruktor * @return void */ public function __construct() { $this->events = \fpcm\classes\baseconfig::$fpcmEvents; $this->cache = new \fpcm\classes\cache($this->cacheName ? $this->cacheName : md5(microtime(false)), $this->cacheModule); if (!\fpcm\classes\baseconfig::dbConfigExists()) { return; } $this->session = \fpcm\classes\baseconfig::$fpcmSession; $this->config = \fpcm\classes\baseconfig::$fpcmConfig; $this->language = \fpcm\classes\baseconfig::$fpcmLanguage; if (is_object($this->config)) { $this->config->setUserSettings(); } }
/** * Kopiert Inhalt von Paket von Quelle nach Ziel * @return boolean */ public function copy() { if (!file_exists($this->tempListFile)) { \fpcm\classes\baseconfig::enableAsyncCronjobs(true); return false; } $this->loadPackageFileListFromTemp(); if (!count($this->files)) { \fpcm\classes\baseconfig::enableAsyncCronjobs(true); return false; } $vendorFolder = \fpcm\classes\baseconfig::$baseDir . $this->copyDestination . dirname($this->key); if (!is_dir($vendorFolder) && !mkdir($vendorFolder)) { trigger_error('Unable to create module vendor folder ' . \fpcm\model\files\ops::removeBaseDir($vendorFolder, true)); \fpcm\classes\baseconfig::enableAsyncCronjobs(true); return false; } $res = true; foreach ($this->files as $zipFile) { $source = $this->extractPath . $zipFile; $dest = \fpcm\classes\baseconfig::$baseDir . $this->copyDestination . str_replace(basename($this->key) . '/', $this->key . '/', $zipFile); $dest = $this->replaceFanpressDirString($dest); if (is_dir($source)) { if (!file_exists($dest) && !mkdir($dest, 0777)) { if (!is_array($res)) { $res = array(); } $res[] = $dest; } continue; } if (file_exists($dest)) { if (sha1_file($source) == sha1_file($dest)) { continue; } $backFile = $dest . '.back'; if (file_exists($backFile)) { unlink($backFile); } rename($dest, $backFile); } if (!copy($source, $dest)) { if (!is_array($res)) { $res = array(); } $res[] = $dest; } } return is_array($res) ? self::FPCMPACKAGE_FILESCOPY_ERROR : $res; }
/** * Konstruktor * @param int $id * @return void */ public function __construct() { $this->dbcon = \fpcm\classes\baseconfig::$fpcmDatabase; $this->events = \fpcm\classes\baseconfig::$fpcmEvents; $this->cache = new \fpcm\classes\cache($this->cacheName ? $this->cacheName : md5(microtime(false)), $this->cacheModule); if (\fpcm\classes\baseconfig::installerEnabled()) { return false; } $this->config = \fpcm\classes\baseconfig::$fpcmConfig; $this->language = \fpcm\classes\baseconfig::$fpcmLanguage; if (is_object($this->config)) { $this->config->setUserSettings(); } }
/** * 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; }
/** * Auszuführender Cron-Code */ public function run() { if (\fpcm\classes\baseconfig::$fpcmDatabase->getDbtype() == 'pgsql') { $this->updateLastExecTime(); return true; } include_once \fpcm\classes\loader::libGetFilePath('Ifsnop/Mysqldump', 'Mysqldump.php'); $dbconfig = \fpcm\classes\baseconfig::getDatabaseConfig(); $dumpSettings = array(); $this->dumpfile = \fpcm\classes\baseconfig::$dbdumpDir . '/' . $dbconfig['DBNAME'] . '_' . date('Y-m-d_H-i-s') . '.sql'; if (function_exists('gzopen')) { $dumpSettings['compress'] = \Ifsnop\Mysqldump\Mysqldump::GZIP; $this->dumpfile .= '.gz'; } $dumpSettings['single-transaction'] = false; $dumpSettings['lock-tables'] = false; $dumpSettings['add-locks'] = false; $dumpSettings['extended-insert'] = false; $dumpSettings['no-autocommit'] = false; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableArticles; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableAuthors; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableCategories; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableComments; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableConfig; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableCronjobs; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableFiles; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableIpAdresses; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableModules; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tablePermissions; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableRoll; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableSessions; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableSmileys; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableTexts; $dumpSettings['include-tables'][] = $dbconfig['DBPREF'] . '_' . \fpcm\classes\database::tableRevisions; $dumpSettings['include-tables'] = $this->events->runEvent('cronjobDbDumpIncludeTables', $dumpSettings['include-tables']); \fpcm\classes\logs::syslogWrite('Create new database dump in "' . \fpcm\model\files\ops::removeBaseDir($this->dumpfile, true) . '"...'); $mysqlDump = new \Ifsnop\Mysqldump\Mysqldump($dbconfig['DBNAME'], $dbconfig['DBUSER'], $dbconfig['DBPASS'], $dbconfig['DBHOST'], $dbconfig['DBTYPE'], $dumpSettings); $mysqlDump->start($this->dumpfile); $this->updateLastExecTime(); if (!file_exists($this->dumpfile)) { \fpcm\classes\logs::syslogWrite('Unable to create database dump in "' . \fpcm\model\files\ops::removeBaseDir($this->dumpfile, true) . '", file not found. See system check and error log!'); return false; } \fpcm\classes\logs::syslogWrite('New database dump created in "' . \fpcm\model\files\ops::removeBaseDir($this->dumpfile, true) . '".'); $text = \fpcm\classes\baseconfig::$fpcmLanguage->translate('CRONJOB_DBBACKUPS_TEXT', array('{{filetime}}' => date(\fpcm\classes\baseconfig::$fpcmConfig->system_dtmask, $this->getLastExecTime()), '{{dumpfile}}' => \fpcm\model\files\ops::removeBaseDir($this->dumpfile, true))); $email = new \fpcm\classes\email(\fpcm\classes\baseconfig::$fpcmConfig->system_email, \fpcm\classes\baseconfig::$fpcmLanguage->translate('CRONJOB_DBBACKUPS_SUBJECT'), $text); $email->submit(); return true; }
/** * Konstruktor * @param array $modules * @return boolean */ public function __construct() { $moduleList = new \fpcm\model\modules\modulelist(); $this->cache = new \fpcm\classes\cache('activeeventscache', 'modules'); if (\fpcm\classes\baseconfig::installerEnabled()) { return false; } $config = \fpcm\classes\baseconfig::$fpcmConfig; $config->setUserSettings(); if ($this->cache->isExpired()) { $this->activeModules = $moduleList->getEnabledInstalledModules(); $this->cache->write($this->activeModules, $config->system_cache_timeout); } else { $this->activeModules = $this->cache->read(); } }
/** * Run event $eventName with params $dataParams * @param string $eventName * @param mixed $dataParams * @return mixed */ public function runEvent($eventName, $dataParams = null) { if (!\fpcm\classes\baseconfig::dbConfigExists() || \fpcm\classes\baseconfig::installerEnabled()) { return $dataParams; } if (!file_exists(\fpcm\classes\baseconfig::$incDir . 'model/events/' . $eventName . '.php')) { trigger_error('ERROR: Undefined event called: ' . $eventName); return $dataParams; } /** * @var \fpcm\model\events\event */ $eventClassName = "\\fpcm\\model\\events\\" . $eventName; $event = new $eventClassName(); if (!$event->checkPermissions()) { return $dataParams; } return $event->run($dataParams); }
/** * 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); }
/** * 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(); }
/** * 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); }
/** * Inittiert Objekt mit Daten aus der Datenbank */ public function init() { if (\fpcm\classes\baseconfig::installerEnabled()) { return false; } if ($this->cache->isExpired() || !$this->useCache) { $configData = $this->dbcon->fetch($this->dbcon->select($this->table), true); foreach ($configData as $data) { $this->data[$data->config_name] = $data->config_value; } $this->data['twitter_data'] = json_decode($this->data['twitter_data'], true); $this->data['twitter_events'] = json_decode($this->data['twitter_events'], true); $this->cache->write($this->data, $this->data['system_cache_timeout']); return; } $this->data = $this->cache->read(); }
/** * 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(); }
/** * 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); }
/** * Installer Step 7 */ protected function runStep7() { $res = true; if ($this->afterStepResult) { $res = \fpcm\classes\baseconfig::enableInstaller(false); $res = $res && \fpcm\model\files\ops::deleteRecursive(\fpcm\classes\baseconfig::$dbStructPath); } $this->view->assign('disableInstallerMsg', !$res); $this->view->assign('showNextButton', false); $cache = new \fpcm\classes\cache(); $cache->cleanup(); }
/** * Konstruktor * @param string $key Modul-Key * @param string $name Module-Name * @param string $version Modul-Version * @param string $versionRemote Server-Version * @param string $description Modul-Beschreibung * @param string $author Module-Author * @param string $link Modul-Info-Link * @param string $systemMinVersion minimale System-Version für Modul * @param bool $init */ public function __construct($key, $name, $version, $versionRemote = '-', $description = '-', $author = '-', $link = '', $systemMinVersion = '', $init = true) { $this->dbcon = \fpcm\classes\baseconfig::$fpcmDatabase; if (\fpcm\classes\baseconfig::installerEnabled()) { return false; } $this->config = \fpcm\classes\baseconfig::$fpcmConfig; $this->language = \fpcm\classes\baseconfig::$fpcmLanguage; $this->modkey = $key; $this->name = $name; $this->version = $version; $this->versionRemote = $versionRemote; $this->description = $description; $this->author = $author; $this->link = $link; $this->systemMinVersion = $systemMinVersion; $this->table = \fpcm\classes\database::tableModules; if ($init) { $this->init(); } }
public function process() { if (!parent::process()) { return false; } $loadAjax = $this->fileList->getDatabaseFileCount() >= 1 ? true : false; $this->view->assign('loadAjax', $loadAjax); $this->view->addJsVars(array('fpcmBaseUrl' => \fpcm\classes\baseconfig::$rootPath, 'fpcmFmgrMode' => $this->mode, 'fpcmEditorType' => $this->config->system_editor, 'fpcmJqUploadInit' => $this->config->file_uploader_new)); $this->view->addJsLangVars(array('newNameMsg' => $this->lang->translate('FILE_LIST_RENAME_NEWNAME'))); $this->view->assign('newUploader', $this->config->file_uploader_new); $this->view->assign('jquploadPath', \fpcm\classes\loader::libGetFileUrl('jqupload')); $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'filemanager.js')); if ($this->config->file_uploader_new) { $this->view->assign('actionPath', \fpcm\classes\baseconfig::$rootPath . $this->getControllerLink('ajax/jqupload')); } else { $this->view->assign('actionPath', \fpcm\classes\baseconfig::$rootPath . $this->getControllerLink('files/list', array('mode' => $this->mode))); $translInfo = array('{{filecount}}' => ini_get("max_file_uploads"), '{{filesize}}' => \fpcm\classes\tools::calcSize(\fpcm\classes\baseconfig::uploadFilesizeLimit(true), 0)); $this->view->assign('maxFilesInfo', $this->lang->translate('FILE_LIST_PHPMAXINFO', $translInfo)); } $this->initViewAssigns(array(), array(), \fpcm\classes\tools::calcPagination(1, 1, 0, 0)); $this->initPermissions(); $this->view->render(); }
/** * Controller-Processing * @return boolean */ public function process() { if (!parent::process()) { return false; } $this->view->assign('replacementsArticle', $this->getReplacementTranslations('TEMPLATE_ARTICLE_', $this->articleTemplate->getReplacementTags())); $this->view->assign('contentArticle', $this->articleTemplate->getContent()); if ($this->config->articles_template_active != $this->config->article_template_active) { $this->view->assign('replacementsArticleSingle', $this->getReplacementTranslations('TEMPLATE_ARTICLE_', $this->articleSingleTemplate->getReplacementTags())); $this->view->assign('contentArticleSingle', $this->articleSingleTemplate->getContent()); } $this->view->assign('replacementsComment', $this->getReplacementTranslations('TEMPLATE_COMMMENT_', $this->commentTemplate->getReplacementTags())); $this->view->assign('contentComment', $this->commentTemplate->getContent()); $this->view->assign('replacementsCommentForm', $this->getReplacementTranslations('TEMPLATE_COMMMENTFORM_', $this->commentFormTemplate->getReplacementTags())); $this->view->assign('contentCommentForm', $this->commentFormTemplate->getContent()); $this->view->assign('replacementsLatestNews', $this->getReplacementTranslations('TEMPLATE_ARTICLE_', $this->latestNewsTemplate->getReplacementTags())); $this->view->assign('contentLatestNews', $this->latestNewsTemplate->getContent()); $this->view->assign('replacementsTweet', $this->getReplacementTranslations('TEMPLATE_ARTICLE_', $this->tweetTemplate->getReplacementTags())); $this->view->assign('contentTweet', $this->tweetTemplate->getContent()); $this->view->assign('allowedTags', htmlentities($this->articleTemplate->getAllowedTags(', '))); $this->view->addJsVars(array('fpcmTemplateId' => 1, 'fpcmJqUploadInit' => 0)); $this->view->addJsLangVars(array('previewHeadline' => $this->lang->translate('HL_TEMPLATE_PREVIEW'))); $tplfilelist = new \fpcm\model\files\templatefilelist(); $this->view->assign('templateFiles', $tplfilelist->getFolderObjectList()); $this->view->setViewJsFiles(array(\fpcm\classes\baseconfig::$jsPath . 'filemanager.js', \fpcm\classes\baseconfig::$jsPath . 'templates.js')); $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->render(); }
<?php /** * Combined JavaScript Files * @author Stefan Seehafer <*****@*****.**> * @copyright (c) 2011-2016, Stefan Seehafer * @license http://www.gnu.org/licenses/gpl.txt GPLv3 */ require_once dirname(dirname(__DIR__)) . '/inc/common.php'; $data = array('content' => '', 'filesize' => 0); $cache = new \fpcm\classes\cache('cssfiles', 'theme'); if ($cache->isExpired() || \fpcm\classes\baseconfig::installerEnabled() || FPCM_DEBUG) { $cssFiles = array(__DIR__ . '/style.css', __DIR__ . '/responsive.css', __DIR__ . '/icons.css'); foreach ($cssFiles as $cssFile) { $fileContent = '/* ' . \fpcm\model\files\ops::removeBaseDir($cssFile) . ' */' . PHP_EOL . file_get_contents($cssFile) . PHP_EOL . PHP_EOL; if (!$fileContent) { continue; } $data['content'] .= $fileContent; $data['filesize'] += filesize($cssFile); } $cache->write($data, FPCM_LANGCACHE_TIMEOUT); } else { $data = $cache->read(); } header("Content-Type: text/css"); if (!FPCM_NOJSCSSPHP_FILESIZE_HEADER) { header("Content-Length: " . $data['filesize']); } die($data['content']);