/** * Get all page * @return array */ public function getAllPage($iPage) { Phpfox::getLib('request')->set('page', $iPage); $this->search()->set(array('type' => 'pages', 'field' => 'pages.page_id', 'search_tool' => array('table_alias' => 'pages', 'search' => array('action' => '', 'default_value' => Phpfox::getPhrase('pages.search_pages'), 'name' => 'search', 'field' => 'pages.title'), 'sort' => array('latest' => array('pages.time_stamp', Phpfox::getPhrase('pages.latest')), 'most-liked' => array('pages.total_like', Phpfox::getPhrase('pages.most_liked'))), 'show' => array(6)))); $aBrowseParams = array('module_id' => 'pages', 'alias' => 'pages', 'field' => 'page_id', 'table' => Phpfox::getT('pages')); $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 0 AND pages.privacy IN(%PRIVACY%)'); $this->search()->browse()->params($aBrowseParams)->execute(); $aAllPages = $this->search()->browse()->getRows(); $iCnt = $this->search()->browse()->getCount(); Phpfox::getLib('pager')->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount())); $aPages = array(); foreach ($aAllPages as $iKey => $aPage) { // $aPage['picture'] = Phpfox::getParam('core.url_user') . $aPage['profile_user_image']; if (version_compare(Phpfox::getVersion(), '3.6.0', '>=')) { $sUrlImage = 'core.url_user'; } else { $sUrlImage = 'pages.url_image'; } $aPage['picture'] = Phpfox::getLib('image.helper')->display(array('file' => $aPage['profile_user_image'], 'server_id' => $aPage['image_server_id'], 'path' => $sUrlImage, 'suffix' => '_120_square', 'return_url' => true)); $aPages[$iKey] = array('page_id' => $aPage['page_id'], 'title' => $aPage['title'], 'category_name' => Phpfox::getLib('locale')->convert($aPage['category_name']), 'image' => $aPage['picture']); } return array($iCnt, $aPages); }
/** * Performs sql query with error reporting and logging. * * @see mysql_query() * @param string $sSql MySQL query to perform * @param resource $hLink MySQL resource. If nothing is passed we load the default master server. * @return resource Returns the MYSQL resource from the function mysql_query() */ public function query($sSql, &$hLink = '') { if (!$hLink) { $hLink =& $this->_hMaster; } PHPFOX_DEBUG ? Phpfox_Debug::start('sql') : ''; $hRes = @($this->_aCmd['mysql_query'] == 'mysqli_query' ? $this->_aCmd['mysql_query']($hLink, $sSql) : $this->_aCmd['mysql_query']($sSql, $hLink)); if (defined('PHPFOX_LOG_SQL') && Phpfox::getLib('file')->isWritable(PHPFOX_DIR_FILE . 'log' . PHPFOX_DS)) { $hFile = fopen(PHPFOX_DIR_FILE . 'log' . PHPFOX_DS . 'phpfox_query_' . date('d.m.y', PHPFOX_TIME) . '_' . md5(Phpfox::getVersion()) . '.php', 'a'); fwrite($hFile, '<?php defined(\'PHPFOX\') or exit(\'NO DICE!\'); ?>' . "##\n{$sSql}##\n"); fclose($hFile); } if (!$hRes) { Phpfox_Error::trigger('Query Error:' . $this->_sqlError(), PHPFOX_DEBUG ? E_USER_ERROR : E_USER_WARNING); } PHPFOX_DEBUG ? Phpfox_Debug::end('sql', array('sql' => $sSql, 'slave' => $this->_bIsSlave, 'rows' => is_bool($hRes) ? '-' : @$this->_aCmd['mysql_num_rows']($hRes))) : ''; $this->_bIsSlave = false; return $hRes; }
public function get($id) { $app = []; if (substr($id, 0, 9) == '__module_') { $id = substr_replace($id, '', 0, 9); $db = new \Core\Db(); $module = $db->select('m.*, p.*')->from(':module', 'm')->join(':product', 'p', 'p.product_id = m.product_id')->where(['m.module_id' => $id])->get(); if ($module['product_id'] == 'phpfox') { $module['version'] = \Phpfox::getVersion(); } $app = ['id' => '__module_' . $id, 'name' => \Phpfox_Locale::instance()->translate($id, 'module'), 'path' => null, 'is_module' => true, 'version' => $module['version']]; } else { if (!isset($this->_apps[$id])) { throw new \Exception('App not found "' . $id . '".'); } $app = $this->_apps[$id]; } return new App\Object($app); }
/** * Error messages can also be logged into a flat file on the server. The reason * for this certain AJAX request or API callbacks may be hard to find error reports * and by adding all error reports to a flat file it will help with debugging. This * is automatically used with our error handler. * * @see self::errorHandler() * @static * @param string $sMessage Error message to display * @param string $sFile Full path to the file * @param int $iLine Line number of where the error occured */ public static function log($sMessage, $sFile, $iLine) { $aCallbacks = debug_backtrace(); $aBacktrace = array(); foreach ($aCallbacks as $aCallback) { if (isset($aCallback['class']) && $aCallback['class'] == 'Phpfox_Error') { continue; } if (!isset($aCallback['file']) || !isset($aCallback['line'])) { continue; } $aBacktrace[] = array('file' => $aCallback['file'], 'line' => $aCallback['line']); } $sErrorLog = serialize(array('message' => self::_escapeCdata($sMessage), 'backtrace' => var_export($aBacktrace, true), 'request' => var_export($_REQUEST, true), 'ip' => Phpfox::getLib('request')->getServer('REMOTE_ADDR'))); $hFile = fopen(PHPFOX_DIR . 'file' . PHPFOX_DS . 'log' . PHPFOX_DS . 'phpfox_error_log_' . date('d_m_y', time()) . '_' . md5(Phpfox::getVersion()) . '.php', 'a'); fwrite($hFile, '<?php defined(\'PHPFOX\') or exit(\'NO DICE!\'); ?>' . "##\n{$sErrorLog}##\n"); fclose($hFile); }
private function _completed() { if (Phpfox_File::instance()->isWritable(PHPFOX_DIR_SETTINGS . 'server.sett.php')) { $sContent = file_get_contents(PHPFOX_DIR_SETTINGS . 'server.sett.php'); $sContent = preg_replace("/\\\$_CONF\\['core.is_installed'\\] = (.*?);/i", "\\\$_CONF['core.is_installed'] = true;", $sContent); if ($hServerConf = @fopen(PHPFOX_DIR_SETTINGS . 'server.sett.php', 'w')) { fwrite($hServerConf, $sContent); fclose($hServerConf); } } $license = file_get_contents(PHPFOX_DIR_SETTINGS . 'license.php'); file_put_contents(PHPFOX_DIR_SETTINGS . 'license.sett.php', $license); unlink(PHPFOX_DIR_SETTINGS . 'license.php'); /* if (!defined('PHPFOX_SKIP_INSTALL_KEY')) { $oApi = Phpfox::getLib('phpfox.api'); if ($oApi->send('brandingRemoval')) { Phpfox_Database::instance()->update(Phpfox::getT('setting'), array('value_actual' => '1'), "var_name = 'branding'"); } } */ $this->_db()->update(Phpfox::getT('setting'), array('value_actual' => Phpfox::getVersion()), 'var_name = \'phpfox_version\''); $this->_db()->update(Phpfox::getT('setting'), array('value_actual' => date('j/n/Y', PHPFOX_TIME)), 'var_name = \'official_launch_of_site\''); $this->_db()->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'microblog\''); $this->_db()->update(Phpfox::getT('user_group_setting'), array('is_hidden' => '1'), 'name = \'custom_table_name\''); if ($this->_bUpgrade) { $iCurrentVersion = $this->_getCurrentVersion(); if (!$this->_db()->select('COUNT(*)')->from(Phpfox::getT('install_log'))->where('is_upgrade = 1 AND version_id = \'' . $iCurrentVersion . '\' AND upgrade_version_id = \'' . Phpfox::getVersion() . '\'')->execute('getField')) { $this->_db()->insert(Phpfox::getT('install_log'), array('is_upgrade' => '1', 'version_id' => $this->_getCurrentVersion(), 'upgrade_version_id' => Phpfox::getVersion(), 'time_stamp' => PHPFOX_TIME, 'ip_address' => Phpfox::getIp())); } } else { // $this->_db()->update(Phpfox::getT('theme_style'), array('is_default' => '0'), 'style_id > 0'); // $this->_db()->update(Phpfox::getT('theme_style'), array('is_default' => '1'), 'folder = \'nebula\''); if (!$this->_db()->select('COUNT(*)')->from(Phpfox::getT('install_log'))->where('is_upgrade = 0 AND version_id = \'' . Phpfox::getVersion() . '\' AND ' . $this->_db()->isNull('upgrade_version_id') . '')->execute('getField')) { $this->_db()->insert(Phpfox::getT('install_log'), array('version_id' => Phpfox::getVersion(), 'time_stamp' => PHPFOX_TIME, 'ip_address' => Phpfox::getIp())); } } Phpfox::getLib('cache')->remove(); $this->_oTpl->assign(array('bIsUpgrade' => $this->_bUpgrade, 'sUpgradeVersion' => Phpfox::getVersion())); }
if (Phpfox::isModule('bettermobile')) { if (Phpfox::isMobile()) { define('PHPFOX_SKIP_IM', true); } //if (Phpfox::getLib('setting')->isParam('profile_menus')) { if (Phpfox::getLib('setting')->isParam('profile_menus')) { $aProfileMenus = Phpfox::getParam('profile_menus'); if (!empty($aProfileMenus)) { Phpfox::getLib('template')->buildSectionMenu('profile', $aProfileMenus); } } //} $sControllerName = Phpfox::getLib('module')->getFullControllerName(); if (Phpfox::isMobile() || $sControllerName == 'forum.forum') { //check version $sVersion = Phpfox::getVersion(); $aVersion = preg_split('[\\.]', $sVersion); if ($aVersion[0] >= 3 && $aVersion[1] >= 5) { $bNewVersion = true; } Phpfox::getLib('template')->assign(array('bNewVersion' => $bNewVersion, 'iTotalActivityPoints' => (int) Phpfox::getUserBy('activity_points'))); // check language $aLang = Phpfox::getLib('locale')->getLang(); if ($aLang['direction'] == 'rtl') { Phpfox::getLib('template')->setHeader(array(' <script type="text/javascript" language="javascript"> var bRtl = true; </script>')); Phpfox::getLib('template')->setHeader('cache', array('rtl.css' => 'module_bettermobile')); } else { Phpfox::getLib('template')->setHeader(array('
private function _completed() { if (Phpfox_File::instance()->isWritable(PHPFOX_DIR_SETTINGS . 'server.sett.php')) { $sContent = file_get_contents(PHPFOX_DIR_SETTINGS . 'server.sett.php'); $sContent = preg_replace("/\\\$_CONF\\['core.is_installed'\\] = (.*?);/i", "\\\$_CONF['core.is_installed'] = true;", $sContent); if ($hServerConf = @fopen(PHPFOX_DIR_SETTINGS . 'server.sett.php', 'w')) { fwrite($hServerConf, $sContent); fclose($hServerConf); } } $license = file_get_contents(PHPFOX_DIR_SETTINGS . 'license.php'); file_put_contents(PHPFOX_DIR_SETTINGS . 'license.sett.php', $license); unlink(PHPFOX_DIR_SETTINGS . 'license.php'); $old = PHPFOX_DIR . '../include/setting/server.sett.php'; if (file_exists($old)) { unlink($old); } file_put_contents(PHPFOX_DIR_SETTINGS . 'version.sett.php', "<?php\nreturn " . var_export(['version' => Phpfox::getVersion(), 'timestamp' => PHPFOX_TIME], true) . ";\n"); $this->_db()->update(Phpfox::getT('module'), array('is_active' => '0'), 'module_id = \'microblog\''); $this->_db()->update(Phpfox::getT('user_group_setting'), array('is_hidden' => '1'), 'name = \'custom_table_name\''); if (!$this->_bUpgrade) { $this->_db()->update(Phpfox::getT('setting'), array('value_actual' => date('j/n/Y', PHPFOX_TIME)), 'var_name = \'official_launch_of_site\''); } Phpfox::getLib('cache')->remove(); $this->_oTpl->assign(array('bIsUpgrade' => $this->_bUpgrade, 'sUpgradeVersion' => Phpfox::getVersion())); }
public function import($sProductFile, $bOverwrite = false) { $aCache = array(); $aModuleInstall = array(); if (!file_exists(PHPFOX_DIR_XML . $sProductFile . '.xml')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.unable_to_find_xml_file_to_import_for_this_product')); } $aParams = Phpfox::getLib('xml.parser')->parse(file_get_contents(PHPFOX_DIR_XML . $sProductFile . '.xml')); if (isset($aParams['modules'])) { $aModules = is_array($aParams['modules']['module_id']) ? $aParams['modules']['module_id'] : array($aParams['modules']['module_id']); foreach ($aModules as $sModule) { $aModuleInstall[$sModule] = array('table' => 'true', 'installed' => 'false'); } } $iFailed = 0; foreach ($aCache as $sModuleCheck => $mTrue) { if (!Phpfox::isModule($sModuleCheck)) { $iFailed++; Phpfox_Error::set(Phpfox::getPhrase('admincp.the_module_name_is_required', array('name' => $sModuleCheck))); } } if ($iFailed > 0) { return false; } if (!isset($aParams['data']['product_id'])) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.not_a_valid_xml_file')); } Phpfox::getLib('cache')->lock(); if ($bOverwrite) { $this->delete($aParams['data']['product_id']); } $bIsProduct = $this->database()->select('COUNT(*)')->from($this->_sTable)->where("product_id = '" . $this->database()->escape($aParams['data']['product_id']) . "'")->execute('getField'); if ($bIsProduct) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_already_exists')); } if (isset($aParams['dependencies'])) { $aDependencies = isset($aParams['dependencies']['dependency'][1]) ? $aParams['dependencies']['dependency'] : array($aParams['dependencies']['dependency']); foreach ($aDependencies as $aDependancy) { if (!isset($aDependancy['type_id']) || !isset($aDependancy['dependency_start'])) { continue; } switch ($aDependancy['type_id']) { case 'php': if (version_compare(PHP_VERSION, $aDependancy['dependency_start'], '<')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_php_version', array('dependency_start' => $aDependancy['dependency_start']))); } if (isset($aDependancy['dependency_end']) && $aDependancy['dependency_end'] != '') { if (version_compare(PHP_VERSION, $aDependancy['dependency_end'], '>')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_php_version_up_until', array('dependency_start' => $aDependancy['dependency_start'], 'dependency_end' => $aDependancy['dependency_end']))); } } break; case 'phpfox': if (version_compare(Phpfox::getVersion(), $aDependancy['dependency_start'], '<')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_phpfox_version', array('dependency_start', $aDependancy['dependency_start']))); } if (isset($aDependancy['dependency_end']) && $aDependancy['dependency_end'] != '') { if (version_compare(Phpfox::getVersion(), $aDependancy['dependency_end'], '>')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_phpfox_version_up_until', array('dependency_start' => $aDependancy['dependency_start'], 'dependency_end' => $aDependancy['dependency_end']))); } } break; case 'product': if (!isset($aDependancy['check_id'])) { continue; } $aProductVersion = $this->database()->select('product_id, version, title')->from($this->_sTable)->where("product_id = '" . $this->database()->escape($aDependancy['check_id']) . "'")->execute('getRow'); if (isset($aProductVersion['product_id'])) { if (version_compare($aProductVersion['version'], $aDependancy['dependency_start'], '<')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_check_id_version_dependency_start', array('check_id' => $aProductVersion['title'], 'dependency_start' => $aDependancy['dependency_start']))); } if (!empty($aDependancy['dependency_end'])) { if (version_compare($aProductVersion['version'], $aDependancy['dependency_end'], '>')) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.product_requires_check_id_version_dependency_start_up_until_dependency_end', array('check_id' => $aProductVersion['title'], 'dependency_start' => $aDependancy['dependency_start'], 'dependency_end' => $aDependancy['dependency_end']))); } } } else { return Phpfox::getPhrase('admincp.product_requires_check_id_version_dependency_start', array('check_id' => $aDependancy['check_id'], 'dependency_start' => $aDependancy['dependency_start'])); } break; default: break; } } } $this->database()->insert($this->_sTable, array('product_id' => $aParams['data']['product_id'], 'title' => $aParams['data']['title'], 'description' => empty($aParams['data']['description']) ? null : $aParams['data']['description'], 'version' => empty($aParams['data']['version']) ? null : $aParams['data']['version'], 'is_active' => 1, 'url' => empty($aParams['data']['url']) ? null : $aParams['data']['url'], 'url_version_check' => empty($aParams['data']['url_version_check']) ? null : $aParams['data']['url_version_check'])); if (isset($aParams['dependencies'])) { $aDependencies = isset($aParams['dependencies']['dependency'][1]) ? $aParams['dependencies']['dependency'] : array($aParams['dependencies']['dependency']); foreach ($aDependencies as $aDependancy) { $aDependancy['product_id'] = $aParams['data']['product_id']; $this->addDependency($aDependancy); } } if (isset($aParams['installs'])) { $aInstalls = isset($aParams['installs']['install'][1]) ? $aParams['installs']['install'] : array($aParams['installs']['install']); $aInstallOrder = array(); foreach ($aInstalls as $aInstall) { $aInstallOrder[$aInstall['version']] = $aInstall; $aInstall['product_id'] = $aParams['data']['product_id']; $this->addInstall($aInstall); } sort($aInstallOrder); foreach ($aInstallOrder as $aInstall) { if (isset($aInstall['install_code'])) { eval($aInstall['install_code']); } } } $this->cache()->remove(); return array('product_id' => $aParams['data']['product_id'], 'files' => $aModuleInstall); }
public function run() { $oRequest = Phpfox::getLib('request'); $db = PhpFox::getLib('database'); // Limit per page, start offset at zero $iOffset = (int) $oRequest->get('offset', 0); $sAction = $oRequest->get('Confirm', 'Start'); $iLimit = 500; $aPrivacySettings = array(); //Set form token for version 3xx if ((int) substr(Phpfox::getVersion(), 0, 1) < 3) { $s1 = 'v2_no_token'; $s2 = 'v2_no_token'; } else { $s1 = Phpfox::getTokenName(); $s2 = Phpfox::getService('log.session')->getToken(); } // Run only if Userpresets Module is present if (!phpFox::isModule('Userpresets')) { die('User Preset addon must be present.'); } // Set profile privacy based upon admincp setting switch (Phpfox::getParam('user.on_register_privacy_setting')) { case 'network': $aPrivacySettings['profile.view_profile'] = '1'; break; case 'friends_only': $aPrivacySettings['profile.view_profile'] = '2'; break; case 'no_one': $aPrivacySettings['profile.view_profile'] = '4'; break; default: break; } // Get Userpreset parameters and build the privacy array $aSettings = Phpfox::getService('admincp.setting')->search("product_id = 'Preset_New_User'"); foreach ($aSettings as $aSetting) { $aParts = explode('__', $aSetting['var_name']); if (phpFox::isModule($aParts[0])) { $sUserPrivacy = str_replace('__', '.', $aSetting['var_name']); $sGetParam = $aSetting['module_id'] . '.' . $aSetting['var_name']; if ($aSetting['type_id'] == 'drop') { $iPrivacySetting = NULL; $iPrivacySetting = Phpfox::getParam($sGetParam); if (isset($iPrivacySetting) && (int) $iPrivacySetting > 0) { $aPrivacySettings[$sUserPrivacy] = $iPrivacySetting; } } } } if ($sAction == 'Start') { //add confirm form $iTotUsers = $db->select('COUNT(*)')->from(Phpfox::getT('user'))->where('view_id = 0')->execute('getField'); $iTotPrivacy = $db->select('COUNT(*)')->from(Phpfox::getT('user_privacy'))->execute('getField'); $iTotNewPrivacy = count($aPrivacySettings); $sWarn = 'This action will remove approximately ' . $iTotPrivacy . ' Records from ' . $iTotUsers . ' users from the user privacy table and replace them with approximately ' . $iTotUsers * $iTotNewPrivacy . ' records. The new settings will be taken from the parameters that you have set in the New User Privacy Setting Module. <br /><br /> This will not affect the operation of PhpFox but it will nullify any privacy settings that your users have set in favor of the ones that you will be setting. <br /><br />Do you want to continue?'; echo ' <div style="width:500px;margin:0px auto;text-align:left;padding:15px;border:1px solid #333;background-color:#eee;"> <div> ' . $sWarn . ' </div> <form method="POST" name="form" id="form" action="http://' . Phpfox::getParam('core.host') . '/tools/dbfixPRIVACY.php"> <div><input type="hidden" name="' . $s1 . '[security_token]" value="' . $s2 . '" /></div> <div style="width:400px;margin:0px auto;text-align:right;padding:15px;background-color:#eee;"> <input type=hidden name="offset" value="0"> <input type="submit" name="Confirm" value="Continue" /> <input type="submit" name="Confirm" value="Cancel" /> </div> </form> </div>'; } if ($sAction == 'Cancel') { die("No Records Changed"); } // Empty privacy table at start of batch if ($sAction == 'Continue' && $iOffset == 0) { $db->query('TRUNCATE ' . Phpfox::getT('user_privacy')); echo 'Processing records from ' . $iOffset . ' to ' . ($iOffset + $iLimit) . '<br />'; } if ($sAction == 'Continue') { // For each user $aRows = $this->database()->select('user_id')->from(Phpfox::getT('user'))->order('user_id')->where('view_id = 0')->limit($iOffset, $iLimit)->execute('getSlaveRows'); $iCount = 0; foreach ($aRows as $row) { ++$iCount; $userid = $row['user_id']; $s = ''; foreach ($aPrivacySettings as $k => $v) { $s .= "({$userid}, '{$k}',{$v}),"; } $s = 'INSERT INTO ' . Phpfox::getT('user_privacy') . " (`user_id`, `user_privacy`, `user_value`) VALUES" . substr($s, 0, -1); $db->query($s); } // Did do a full batch? if ($iCount == $iLimit) { // Get another batch $iOffset += $iLimit; echo 'Processing records from ' . $iOffset . ' to ' . ($iOffset + $iLimit) . '<br />'; echo ' <form method="POST" name="form2" id="form2" action="http://' . Phpfox::getParam('core.host') . '/tools/dbfixPRIVACY.php?offset=' . $iOffset . '"> <div><input type="hidden" name="' . $s1 . '[security_token]" value="' . $s2 . '" /></div> <input type=hidden name="offset" value="' . $iOffset . '"> <input type=hidden name="Confirm" value="Continue"> </form> <script language=javascript>document.form2.submit();</script> '; exit; } // count < limit we are done echo '<hr><h1>' . ($iCount + $iOffset) . ' Records Processed</h1>'; return; } }
define('PHPFOX_IS_GZIP', true); define('PHPFOX_NO_SESSION', true); define('PHPFOX_NO_USER_SESSION', true); define('PHPFOX_NO_PLUGINS', true); // Require phpFox Init require PHPFOX_DIR . 'include' . PHPFOX_DS . 'init.inc.php'; $sCmd = isset($_GET['cmd']) ? $_GET['cmd'] : ''; switch ($sCmd) { case 'phpinfo': phpinfo(); break; case 'version': header('Content-Type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo '<phpfox>'; echo '<version>' . Phpfox::getVersion() . '</version>'; echo '<build>' . Phpfox::getBuild() . '</build>'; echo '<package>' . Phpfox::PHPFOX_PACKAGE . '</package>'; echo '</phpfox>'; break; case 'modules': header('Content-Type: text/xml'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; echo "<phpfox>\n"; $hDir = opendir(PHPFOX_DIR_MODULE); while ($sFolder = readdir($hDir)) { if ($sFolder == '.' || $sFolder == '..') { continue; } echo "\t<module>" . $sFolder . "</module>\n"; }
public function version() { $this->_out = ['version' => \Phpfox::getVersion()]; }
private function _getCurrentVersion() { static $sVersion = null; if ($sVersion !== null) { return $sVersion; } if ($this->_sUrl == 'install' && !defined('PHPFOX_IS_HOSTED_SCRIPT')) { return Phpfox::getVersion(); } $bIsLegacy = true; if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'setting' . PHPFOX_DS . 'server.sett.php')) { require PHPFOX_DIR . 'include' . PHPFOX_DS . 'setting' . PHPFOX_DS . 'server.sett.php'; if ($_CONF['core.is_installed'] === true) { $aRow = Phpfox::getLib('database')->select('value_actual')->from(Phpfox::getT('setting'))->where('var_name = \'phpfox_version\'')->execute('getRow'); if (isset($aRow['value_actual'])) { $sVersion = $aRow['value_actual']; return $aRow['value_actual']; } } } if (file_exists(PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'version.php')) { require_once PHPFOX_DIR . 'include' . PHPFOX_DS . 'settings' . PHPFOX_DS . 'version.php'; $sVersion = $_CONF['info.version']; return $_CONF['info.version']; } else { $aRow = Phpfox::getLib('database')->select('value_actual')->from(Phpfox::getT('setting'))->where('var_name = \'phpfox_version\'')->execute('getRow'); if (isset($aRow['value_actual'])) { $sVersion = $aRow['value_actual']; return $aRow['value_actual']; } } return Phpfox_Error::set('Unknown version.', E_USER_ERROR); }