/** * Class process method wnich is used to execute this component. */ public function process() { //DROPBOX //Request Unlink Dropbox Acount if ($this->request()->get('unlink')) { Phpfox::getService('backuprestore.dropboxfront')->unlink_account(); $this->isAccess = null; $page = $_SERVER['HTTP_REFERER']; $sec = "0"; header("Refresh: {$sec}; url={$page}"); } $canCall = false; if (!$this->request()->get('db_authorize')) { $this->dropbox = PhpFox::getService('backuprestore.dropboxfront'); $canCall = true; } $dbauthorize = array(); if ($canCall) { $dbauthorize['Url'] = $this->dropbox->get_authorize_url(); if ($this->dropbox->is_authorized()) { //User Dropbox info $dbaccount_info = $this->dropbox->get_account_info(); $dbaccount_details = array('account_owner' => $dbaccount_info->display_name, 'used_space' => round(($dbaccount_info->quota_info->quota - ($dbaccount_info->quota_info->normal + $dbaccount_info->quota_info->shared)) / 1073741824, 1), 'quota' => round($dbaccount_info->quota_info->quota / 1073741824, 1)); $dbaccount_details['used_percent'] = round($dbaccount_details['used_space'] / $dbaccount_details['quota'] * 100, 0); $this->authorized['dropbox'] = 1; } else { if ($this->request()->get('continue')) { if (!$this->dropbox->is_authorized()) { $dbauthorize['error_not_authorized'] = 'yes'; } $dbauthorize['submitbutton'] = 'Authorize'; } } } //Request Authorize Dropbox Account if ($this->request()->get('db_authorize')) { $dbauthorize['submitbutton'] = 'Continue'; } $this->template()->assign(array('dbauthorize' => $dbauthorize, 'DBADetails' => !empty($dbaccount_details) ? $dbaccount_details : null, 'authorized' => $this->authorized)); }
private function _import() { Phpfox::getLib('phpfox.process')->import(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'version' . PHPFOX_XML_SUFFIX)); PhpFox::getService('core.country.process')->importForInstall(Phpfox::getLib('xml.parser')->parse(PHPFOX_DIR_XML . 'country' . PHPFOX_XML_SUFFIX)); // $this->_pass(); /* $this->_oTpl->assign(array( 'sMessage' => 'Imports complete...', 'sNext' => $this->_step('language') )); */ return ['message' => 'Importing language package', 'next' => 'language']; }
public function add($aVals, $bClean = false) { $sPhrase = $this->prepare($aVals['var_name']); $oParseInput = Phpfox_Parse_Input::instance(); if (isset($aVals['module'])) { $aParts = explode('|', $aVals['module']); } foreach ($aVals['text'] as $iId => $sText) { $sText = trim($sText); if (empty($sText)) { // continue; } if ($bClean === true) { $sText = $oParseInput->clean($sText); } else { $sText = $oParseInput->convert($sText); } $this->database()->insert($this->_sTable, array('language_id' => $iId, 'module_id' => isset($aParts) ? $aParts[0] : 'core', 'product_id' => $aVals['product_id'], 'version_id' => PhpFox::getId(), 'var_name' => $sPhrase, 'text' => $sText, 'text_default' => $sText, 'added' => PHPFOX_TIME)); } $sFinalPhrase = isset($aVals['module']) ? $aParts[1] . '.' . $sPhrase : $sPhrase; if (isset($aVals['is_help'])) { Phpfox::getService('help.process')->add(array('var_name' => $sFinalPhrase)); } Phpfox::getService('log.staff')->add('phrase', 'add', array('phrase' => $sPhrase)); $this->cache()->remove('locale', 'substr'); return $sFinalPhrase; }
public function __construct() { require_once 'module/backuprestore/Dropbox/API.php'; require_once 'module/backuprestore/Dropbox/OAuth/Consumer/ConsumerAbstract.class.php'; require_once 'module/backuprestore/Dropbox/OAuth/Consumer/Curl.class.php'; $this->btdbsett = PhpFox::getService('backuprestore.backuprestore'); if (!extension_loaded('curl')) { Phpfox_Error::set(Phpfox::getPhrase('testsearch.curl_not_loaded_message')); } $this->oauth = new Backuprestore_Dropbox_OAuth_Consumer_Curl($this->app_key, $this->app_secret); if ($dbarray = $this->btdbsett->getBTDBSettingByName('dropbox_tokens')) { $this->tokens = unserialize(array_shift($dbarray)); } //Convert array to stdClass for the new API if ($this->tokens && is_array($this->tokens['access'])) { $accessToken = new stdClass(); $accessToken->oauth_token = $this->tokens['access']["token"]; $accessToken->oauth_token_secret = $this->tokens['access']["token_secret"]; $this->tokens['access'] = $accessToken; $this->tokens['state'] = 'access'; } try { $this->init(); //If we are in the access state and are still not authorized then unlink and re init if ($this->tokens['state'] == 'access' && !$this->is_authorized()) { throw new Exception(); } } catch (Exception $e) { $this->unlink_account(); $this->init(); } }
public function add($aVals, $aFiles) { $sInteraction = $aVals['name']; $sAction = $aVals['action']; if ($this->database()->select('id')->from(Phpfox::getT('interactions'))->where('name = "' . $sInteraction . '"')->execute('getSlaveField')) { Phpfox_Error::set(Phpfox::getPhrase('interact.already_added')); return false; } if ($aFiles['image']['name'] != '') { $oFile = Phpfox::getLib('file'); $oImage = Phpfox::getLib('image'); if ($oFile->load('image', array('jpg', 'png', 'gif'))) { $sPath = Phpfox::getParam('core.dir_pic') . 'interact/'; $sFileName = basename($aFiles['image']['name']); move_uploaded_file($aFiles['image']['tmp_name'], $sPath . $sFileName); $aSize = getimagesize($sPath . $sFileName); if ($aSize[0] < 120 || $aSize[1] < 120) { Phpfox_Error::set(Phpfox::getPhrase('interact.image_too_small')); return false; } if ($aSize[0] > 120 || $aSize[1] > 120) { $oImage->createThumbnail($sPath . $sFileName, $sPath . substr_replace(basename($sFileName), '_120', -4, 0), 120, 120); $oImage->createThumbnail($sPath . $sFileName, $sPath . substr_replace(basename($sFileName), '_75', -4, 0), 75, 75); unlink($sPath . $sFileName); } } } $aDisallow = array(); $aUserGroups = Phpfox::getService('user.group')->get(); foreach ($aUserGroups as $aKey => $aUserGroup) { if ($aUserGroups[$aKey]['user_group_id'] == 3 || $aUserGroups[$aKey]['user_group_id'] == 5) { unset($aUserGroups[$aKey]); } } if (isset($aVals['allow_access'])) { foreach ($aUserGroups as $aUserGroup) { if (!in_array($aUserGroup['user_group_id'], $aVals['allow_access'])) { $aDisallow[] = $aUserGroup['user_group_id']; } } } else { foreach ($aUserGroups as $aUserGroup) { $aDisallow[] = $aUserGroup['user_group_id']; } } $aVals['disallow_access'] = count($aDisallow) ? serialize($aDisallow) : null; $iOldPos = $this->database()->select('`position`')->from(Phpfox::getT('interactions'))->order('position DESC')->limit(1)->execute('getField'); $iId = $this->database()->insert(Phpfox::getT('interactions'), array('name' => Phpfox::getLib('parse.input')->clean($sInteraction, 255), 'action' => Phpfox::getLib('parse.input')->clean($sAction, 255), 'image' => $aFiles['image']['name'] ? substr_replace(basename($aFiles['image']['name']), '%s', -4, 0) : '', 'disallow_access' => $aVals['disallow_access'], 'position' => $iOldPos + 1)); $aLangs = $this->database()->select('`language_id`')->from(Phpfox::getT('language'))->execute('getRows'); $oParseInput = Phpfox::getLib('parse.input'); foreach ($aLangs as $aKey => $sLang) { $sInteraction = Phpfox::getLib('parse.input')->clean($sInteraction, 128); $sIntName = Phpfox::getService('language.phrase.process')->prepare($sInteraction); $this->database()->insert(Phpfox::getT('language_phrase'), array('language_id' => $sLang['language_id'], 'module_id' => 'interact', 'product_id' => 'rael_interact', 'version_id' => PhpFox::getId(), 'var_name' => 'name_' . $sIntName, 'text' => $sInteraction, 'text_default' => $sInteraction, 'added' => PHPFOX_TIME)); $sAction = Phpfox::getLib('parse.input')->clean($sAction, 128); $this->database()->insert(Phpfox::getT('language_phrase'), array('language_id' => $sLang['language_id'], 'module_id' => 'interact', 'product_id' => 'rael_interact', 'version_id' => PhpFox::getId(), 'var_name' => 'action_' . $sIntName, 'text' => $sAction, 'text_default' => $sAction, 'added' => PHPFOX_TIME)); } $this->cache()->remove('locale', 'substr'); return $iId; }
/** * Class process method wnich is used to execute this component. */ public function process() { //DROPBOX $canCall = false; if (!$this->request()->get('db_authorize')) { $this->dropbox = PhpFox::getService('backuprestore.dropboxfront'); $canCall = true; } $dbauthorize = array(); if ($canCall) { $dbauthorize['Url'] = $this->dropbox->get_authorize_url(); if ($this->dropbox->is_authorized()) { //User Dropbox info $dbaccount_info = $this->dropbox->get_account_info(); $dbaccount_details = array('account_owner' => $dbaccount_info->display_name, 'used_space' => round(($dbaccount_info->quota_info->quota - ($dbaccount_info->quota_info->normal + $dbaccount_info->quota_info->shared)) / 1073741824, 1), 'quota' => round($dbaccount_info->quota_info->quota / 1073741824, 1)); $dbaccount_details['used_percent'] = round($dbaccount_details['used_space'] / $dbaccount_details['quota'] * 100, 0); $this->authorized['dropbox'] = 1; } else { if ($this->request()->get('continue')) { if (!$this->dropbox->is_authorized()) { $dbauthorize['error_not_authorized'] = 'yes'; } $dbauthorize['submitbutton'] = 'Authorize'; } } } //Request Authorize Dropbox Account if ($this->request()->get('db_authorize')) { $dbauthorize['submitbutton'] = 'Continue'; } //Google DRIVE $gdrive = PhpFox::getService('backuprestore.googledrivefront'); $tokens = $gdrive->getAccessTokens(); //Check Google drive User Authorization if ($gdrive->is_authorized()) { //User Google Drive info try { if (isset($tokens)) { $drive = $gdrive->buildService($tokens); $gdrive_info = $gdrive->getAcountInfo($drive); $this->authorized['gdrive'] = 1; } } catch (Exception $e) { throw $e; } } // Google Drive Authorize if ($this->request()->get('gd_authorize')) { if (!$gdrive->initClientKeys()) { $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements'); } try { $gdrive->gdrive_auth_request(); } catch (Exception $e) { Phpfox::addMessage($e->getMessage()); } } $this->template()->assign(array('dbauthorize' => $dbauthorize, 'gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'DBADetails' => !empty($dbaccount_details) ? $dbaccount_details : null, 'authorized' => $this->authorized)); }
public function add($aVals, $bIsUpdate = false) { if (empty($aVals['module_id'])) { $aVals['module_id'] = 'core|core'; } $aModule = explode('|', $aVals['module_id']); // Find the user groups we disallowed $aDisallow = array(); $aUserGroups = Phpfox::getService('user.group')->get(); if (isset($aVals['allow_access'])) { foreach ($aUserGroups as $aUserGroup) { if (!in_array($aUserGroup['user_group_id'], $aVals['allow_access'])) { $aDisallow[] = $aUserGroup['user_group_id']; } } } else { foreach ($aUserGroups as $aUserGroup) { $aDisallow[] = $aUserGroup['user_group_id']; } } foreach ($aVals['text'] as $iId => $sText) { $sVarName = $aModule[0] . '_' . Phpfox::getService('language.phrase.process')->prepare($sText); break; } $sVarName = 'menu_' . $sVarName . '_' . md5($aVals['m_connection']); $aInsert = array('page_id' => isset($aVals['page_id']) ? (int) $aVals['page_id'] : 0, 'm_connection' => strtolower($aVals['m_connection']), 'module_id' => $aModule[0], 'product_id' => $aVals['product_id'], 'is_active' => 1, 'url_value' => $aVals['url_value'], 'disallow_access' => count($aDisallow) ? serialize($aDisallow) : null, 'mobile_icon' => empty($aVals['mobile_icon']) ? null : $aVals['mobile_icon']); if (preg_match('/child\\|(.*)/i', $aVals['m_connection'], $aMatches)) { if (isset($aMatches[1])) { $aInsert['m_connection'] = null; $aInsert['parent_id'] = $aMatches[1]; } } else { if ($aVals['m_connection'] == 'explore' || $aVals['m_connection'] == 'main') { $aInsert['parent_id'] = 0; } } if ($bIsUpdate) { $this->database()->update($this->_sTable, $aInsert, 'menu_id = ' . (int) $aVals['menu_id']); foreach ($aVals['text'] as $iId => $sText) { Phpfox::getService('language.phrase.process')->update($iId, $sText, array('module_id' => $aModule[0])); } } else { // Get the last order number $iLastCount = $this->database()->select('ordering')->from($this->_sTable)->order('ordering DESC')->execute('getField'); // Define some remaining vars we plan to insert $aInsert['ordering'] = $iLastCount + 1; $aInsert['version_id'] = PhpFox::getId(); $aInsert['var_name'] = $sVarName; // Insert into DB $this->database()->insert($this->_sTable, $aInsert); // Add the new phrase Phpfox::getService('language.phrase.process')->add(array('var_name' => $sVarName, 'module' => $aVals['module_id'], 'product_id' => $aVals['product_id'], 'text' => $aVals['text'])); } // Clear the menu cache using the substr method, which will clear anything that has a "menu" prefix $this->cache()->remove(); return true; }
public function get() { $oFile = Phpfox::getLib('file'); $bSlaveEnabled = Phpfox::getParam(array('db', 'slave')); $sDriver = Phpfox::getParam(array('db', 'driver')); $aStats = array ( Phpfox::getPhrase('admincp.phpfox_version') => PhpFox::getVersion() . '<i>(build ' . Phpfox::getBuild() . ')</i>', Phpfox::getPhrase('admincp.php_version') => '<a href="' . Phpfox::getLib('url')->makeUrl('admincp.core.phpinfo') . '">' . PHP_VERSION . '</a>', Phpfox::getPhrase('admincp.php_sapi') => php_sapi_name(), Phpfox::getPhrase('admincp.php_safe_mode') => (PHPFOX_SAFE_MODE ? Phpfox::getPhrase('admincp.true') : Phpfox::getPhrase('admincp.false')), Phpfox::getPhrase('admincp.php_open_basedir') => (PHPFOX_OPEN_BASE_DIR ? Phpfox::getPhrase('admincp.true') : Phpfox::getPhrase('admincp.false')), Phpfox::getPhrase('admincp.php_disabled_functions') => (@ini_get('disable_functions') ? str_replace( ",", ", ", @ini_get('disable_functions') ) : Phpfox::getPhrase('admincp.none')), Phpfox::getPhrase('admincp.php_loaded_extensions') => implode(' ', get_loaded_extensions()), Phpfox::getPhrase('admincp.operating_system') => PHP_OS, Phpfox::getPhrase('admincp.server_time_stamp') => date('F j, Y, g:i a', PHPFOX_TIME) . ' (GMT)', Phpfox::getPhrase('admincp.gzip') => (Phpfox::getParam('core.use_gzip') ? Phpfox::getPhrase('admincp.enabled') : Phpfox::getPhrase('admincp.disabled')), Phpfox::getPhrase('admincp.sql_driver_version') => ($sDriver == 'DATABASE_DRIVER' ? Phpfox::getPhrase('admincp.n_a') : Phpfox::getLib('database')->getServerInfo()), Phpfox::getPhrase('admincp.sql_slave_enabled') => ($bSlaveEnabled ? Phpfox::getPhrase('admincp.yes') : Phpfox::getPhrase('admincp.no')), Phpfox::getPhrase('admincp.sql_total_slaves') => ($bSlaveEnabled ? count(Phpfox::getParam(array('db', 'slave_servers'))) : Phpfox::getPhrase('admincp.n_a')), Phpfox::getPhrase('admincp.sql_slave_server') => ($bSlaveEnabled ? Phpfox::getLib('database')->sSlaveServer : Phpfox::getPhrase('admincp.n_a')), Phpfox::getPhrase('admincp.memory_limit') => $oFile->filesize($this->_getUsableMemory()) . ' (' . @ini_get('memory_limit') . ')', Phpfox::getPhrase('admincp.load_balancing_enabled') => (Phpfox::getParam(array('balancer', 'enabled')) ? Phpfox::getPhrase('admincp.yes') : Phpfox::getPhrase('admincp.no')) ); if(strpos(strtolower(PHP_OS), 'win') === 0 || PHPFOX_SAFE_MODE || PHPFOX_OPEN_BASE_DIR) { } else { $sMemory = @shell_exec("free -m"); $aMemory = explode("\n", str_replace( "\r", "", $sMemory)); if (is_array($aMemory)) { $aMemory = array_slice($aMemory, 1, 1); if (isset($aMemory[0])) { $aMemory = preg_split("#\s+#", $aMemory[0]); $aStats[Phpfox::getPhrase('admincp.total_server_memory')] = (isset($aMemory[1]) ? $aMemory[1] . ' MB' : '--'); $aStats[Phpfox::getPhrase('admincp.available_server_memory')] = (isset($aMemory[3]) ? $aMemory[3] . ' MB' : '--'); } } } if (!PHPFOX_OPEN_BASE_DIR && ($sLoad = Phpfox::getService('core.load')->get()) !== null) { $aStats[Phpfox::getPhrase('admincp.current_server_load')] = $sLoad; } return $aStats; }
public function displayCaptcha($sText) { Phpfox::getParam('captcha.captcha_use_font') && function_exists('imagettftext') ? $this->_writeFromFont($sText) : $this->_writeFromString($sText); ob_clean(); header("X-Content-Encoded-By: phpFox " . PhpFox::getVersion()); header("Pragma: no-cache"); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Content-Type: image/jpeg'); imagejpeg($this->_hImg); imagedestroy($this->_hImg); }
public function process() { $this->googledrive = PhpFox::getService('backuprestore.googledrivefront'); $this->btdbsett = PhpFox::getService('backuprestore.backuprestore'); //Clients deny for Application Register if (isset($_GET['error'])) { $this->url()->forward($this->url()->makeUrl('backuprestore.continue'), Phpfox::getPhrase('backuprestore.gd_auth_deny')); } //Get Access Tokens usung authorization code returnedfrom Google API if (isset($_GET['code'])) { try { $this->tokens['access_token'] = $this->googledrive->exchangeCode($_GET['code']); if (!empty($this->tokens['access_token'])) { $this->btdbsett->addBTDBSetting('googledrive_tokens', serialize(json_decode($this->tokens['access_token'], true))); } //Redirct to main page $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.destination'), Phpfox::getPhrase('backuprestore.gd_register_complete')); } catch (Exception $e) { $e->getMessage(); } } //Insert GDrive client keys if ($aVals = $this->request()->getArray('val')) { if (empty($aVals['gdrive_clientid'])) { return Phpfox_Error::set(Phpfox::getPhrase('backuprestore.please_insert_your_application_client_id')); } if (empty($aVals['gdrive_clientsecret'])) { return Phpfox_Error::set(Phpfox::getPhrase('backuprestore.please_insert_your_application_client_secret_key')); } if (Phpfox_Error::isPassed()) { if ($gdrive = Phpfox::getService('backuprestore.process')->addGDriveKeys($aVals)) { $this->url()->send('admincp.backuprestore.gdrivesett', null, Phpfox::getPhrase('backuprestore.changes_successfully_saved')); } } } //Values from DB for edit $gdkeys = Phpfox::getService('backuprestore.backuprestore')->getBTDBSettingByName('gdclient_keys'); if (!empty($gdkeys)) { $gdkeys = unserialize(array_shift($gdkeys)); $this->template()->assign('aForms', $gdkeys); } $this->template()->assign(array('redirect_url' => 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'support_page' => $this->url()->makeUrl('admincp.backuprestore.gdrivesupp'))); $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.google_drive'), $this->url()->makeUrl('admincp.backuprestore.gdrivesett'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore')); }
public function __construct() { require_once 'module/backuprestore/Google/Google_Client.php'; require_once 'module/backuprestore/Google/contrib/Google_DriveService.php'; require_once 'module/backuprestore/Google/contrib/Google_Oauth2Service.php'; $this->btdbsett = PhpFox::getService('backuprestore.backuprestore'); if (!$this->initClientKeys()) { return; // Phpfox::addMessage('Error'); } $this->client = new Google_Client(); $this->client->setApplicationName(Phpfox::getPhrase('backuprestore.phpfox_backup_into_cloud')); $this->client->setScopes($this->SCOPES); try { $this->init(); //If we are in the access state and are still not authorized then unlink and re init if (!$this->is_authorized()) { throw new Exception(); } } catch (Exception $e) { //Phpfox::addMessage(Phpfox::getPhrase('backuprestore.google_drive_error_when_requesting_access_token')); //re authorize user } }
/** * Class process method wnich is used to execute this component. */ public function process() { // Google Drive Authorize if ($this->request()->get('gd_authorize')) { if (!PhpFox::getService('backuprestore.googledrivefront')->initClientKeys()) { $this->url()->forward($this->url()->makeUrl('admincp.backuprestore.gdrivesett'), 'In order to use Google Drive Service fill below requirements'); } try { PhpFox::getService('backuprestore.googledrivefront')->gdrive_auth_request(); } catch (Exception $e) { Phpfox::addMessage($e->getMessage()); } } // Google Drive Unauthorize if ($this->request()->get('gd_unauthorize')) { try { Phpfox::getService('backuprestore.googledrivefront')->gdrive_auth_revoke(); } catch (Exception $re) { } } $gdrive = PhpFox::getService('backuprestore.googledrivefront'); $tokens = $gdrive->getAccessTokens(); //Check Google drive User Authorization if ($gdrive->is_authorized()) { //User Google Drive info try { if (isset($tokens)) { $drive = $gdrive->buildService($tokens); $gdrive_info = $gdrive->getAcountInfo($drive); $this->authorized['gdrive'] = 1; } } catch (Exception $e) { throw $e; } } $this->template()->assign(array('gdrive_info' => !empty($gdrive_info) ? $gdrive_info : null, 'authorized' => $this->authorized)); }
public function add($aVals) { switch ($aVals['type']) { case 'array': // Make sure its an array if (preg_match("/^array\\((.*)\\);\$/i", $aVals['value'])) { $aVals['value'] = serialize($aVals['value']); } else { return Phpfox_Error::set(Phpfox::getPhrase('admincp.not_valid_array')); } break; case 'integer': if (!is_numeric($aVals['value'])) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.value_must_be_numeric')); } break; case 'drop': $aDropDowns = explode(',', $aVals['value']); $aVals['value'] = serialize(array('default' => $aDropDowns[0], 'values' => $aDropDowns)); break; default: break; } $iGroupId = $aVals['group_id']; $iModule = $aVals['module_id']; $iProductId = $aVals['product_id']; $aVals['var_name'] = preg_replace('/ +/', '_', preg_replace('/[^0-9a-zA-Z_ ]+/', '', trim($aVals['var_name']))); $aVals['var_name'] = strtolower($aVals['var_name']); $sPhrase = 'setting_' . Phpfox::getService('language.phrase.process')->prepare($aVals['var_name']); $iLastOrder = $this->database()->select('ordering')->from($this->_sTable)->where("group_id = '{$iGroupId}' AND module_id = '{$iModule}' AND product_id = '{$iProductId}'")->order('ordering DESC')->execute('getSlaveField'); $iId = $this->database()->insert($this->_sTable, array('group_id' => empty($iGroupId) ? null : $iGroupId, 'module_id' => empty($iModule) ? null : $iModule, 'product_id' => $iProductId, 'version_id' => PhpFox::getId(), 'type_id' => $aVals['type'], 'var_name' => $aVals['var_name'], 'phrase_var_name' => $sPhrase, 'value_actual' => $aVals['value'], 'value_default' => $aVals['value'], 'ordering' => (int) $iLastOrder + 1)); $sPhrase = Phpfox::getService('language.phrase.process')->add(array('var_name' => 'setting_' . $aVals['var_name'], 'product_id' => $iProductId, 'module' => empty($iModule) ? 'core|core' : $iModule . '|' . $iModule, 'text' => array('en' => '<title>' . $aVals['title'] . '</title><info>' . $aVals['info'] . '</info>'))); // Clear the setting cache $this->cache()->remove('setting'); return (empty($iModule) ? '' : $iModule . '.') . $aVals['var_name']; }
/** * Creates an XML export of all the files in the product and includes an MD5 hash * that identifies each of the files content * * @return string XML output */ public function export() { $oXmlBuilder = Phpfox::getLib('xml.builder'); $oXmlBuilder->addGroup('files', array('version' => PhpFox::getId())); $aFiles = $this->_getFiles(rtrim(PHPFOX_DIR, PHPFOX_DS)); sort($aFiles); foreach ($aFiles as $sFile) { if (preg_match("/\\.svn/i", $sFile) || preg_match("/tiny_mce/i", $sFile) || preg_match("/fckeditor/i", $sFile) || preg_match("/file\\/cache/i", $sFile) || preg_match("/jscript\\/jquery/i", $sFile) || preg_match("/include\\/hook/i", $sFile) || preg_match("/file\\\\cache/i", $sFile) || preg_match("/file\\\\static/i", $sFile) || preg_match("/jscript\\\\jquery/i", $sFile) || preg_match("/include\\\\plugin/i", $sFile) || substr($sFile, -4) != '.php' && substr($sFile, -5) != '.html' && substr($sFile, -4) != '.css' && substr($sFile, -3) != '.js') { continue; } $aFile = file($sFile); $sSource = ''; foreach ($aFile as $sLine) { $sCheckLine = trim($sLine); if ($sCheckLine == '' || $sCheckLine == '/**' || $sCheckLine == '*' || $sCheckLine == '*/' || substr($sCheckLine, 0, 1) == '*' || substr($sCheckLine, 0, 2) == '//') { continue; } $sSource .= $sLine; } $oXmlBuilder->addTag('file', str_replace('\\', '/', str_replace(PHPFOX_DIR, '', $sFile)), array('hash' => md5($sSource))); } $oXmlBuilder->closeGroup(); return $oXmlBuilder->output(); }
/** * Class constructor */ public function __construct() { $this->_sTable = PhpFox::getT('quiz'); }
/** * Class process method wnich is used to execute this component. */ public function process() { Phpfox::getUserParam('admincp.has_admin_access', true); if (Phpfox::getParam('admincp.admin_cp') != $this->request()->get('req1')) { return Phpfox::getLib('module')->setController('error.404'); } if (!Phpfox::getService('user.auth')->isActiveAdminSession()) { return Phpfox::getLib('module')->setController('admincp.login'); } if (Phpfox::getParam('core.phpfox_is_hosted')) { $sMaxHistory = Phpfox::getParam('core.phpfox_total_users_online_history'); if (!empty($sMaxHistory) && Phpfox::getLib('parse.format')->isSerialized($sMaxHistory)) { $aMaxHistory = unserialize($sMaxHistory); $this->template()->assign(array( 'aMaxHistory' => $aMaxHistory ) ); } } $this->_sModule = (($sReq2 = $this->request()->get('req2')) ? strtolower($sReq2) : Phpfox::getParam('admincp.admin_cp')); if ($this->_sModule == 'logout') { $this->_sController = $this->_sModule; $this->_sModule = 'admincp'; } else { $this->_sController = (($sReq3 = $this->request()->get('req3')) ? $sReq3 : $this->_sController); } if ($sReq4 = $this->request()->get('req4')) { $sReq4 = str_replace(' ', '', strtolower(str_replace('-', ' ', $sReq4))); } $sReq5 = $this->request()->get('req5'); $bPass = false; if (file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController; $bPass = true; } if (!$bPass && $sReq5 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . $sReq5 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.' . $sReq5; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $this->_sController; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . 'index.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.index'; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . 'index.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.index'; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = $this->_sModule . '.' . $this->_sController; $this->_sModule = 'admincp'; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = $this->_sModule . '.' . $this->_sController . '.' . $sReq4; $this->_sModule = 'admincp'; $bPass = true; } if (!$bPass && Phpfox::getParam('admincp.admin_cp') != 'admincp' && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) { $bPass = true; } // Get the menu we will used to display all the "Modules" $aModules = Phpfox::getService('admincp.module')->getAdminMenu(); // Create AdminCP menu $aMenus = array( 'admincp.dashboard' => 'admincp', 'admincp.cms' => array( 'admincp.menus' => array( 'admincp.manage_menus' => 'admincp.menu', 'admincp.add_new_menu' => 'admincp.menu.add' ), 'admincp.blocks' => array( 'admincp.manage_blocks' => 'admincp.block', 'admincp.add_new_block' => 'admincp.block.add' ), 'admincp.pages' => array( 'admincp.manage_pages' => 'admincp.page', 'admincp.add_new_page' => 'admincp.page.add' ) ), 'admincp.users' => array( 'admincp.browse_members' => 'admincp.user.browse', 'admincp.user_group_manager' => array( 'admincp.manage_user_groups' => 'admincp.user.group', 'admincp.create_user_group' => 'admincp.user.group.add', 'admincp.add_user_group_setting' => 'admincp.user.group.setting' ), 'admincp.user_cancellation_options' => array( 'admincp.user_cancellation_options_add' => 'admincp.user.cancellations.add', 'admincp.user_cancellation_options_manage' => 'admincp.user.cancellations.manage', 'admincp.user_cancellations_feedback' => 'admincp.user.cancellations.feedback' ), 'user.promotions' => array( 'user.manage_promotions' => 'admincp.user.promotion', 'user.add_promotion' => 'admincp.user.promotion.add' ), 'admincp.inactive_members' => 'admincp.user.inactivereminder' ), 'admincp.extensions' => array( 'admincp.module' => array( 'admincp.manage_modules' => 'admincp.module', 'admincp.create_new_module' => 'admincp.module.add', 'admincp.add_component' => 'admincp.component.add', 'admincp.manage_components' => 'admincp.component' ), 'admincp.language' => array( 'admincp.manage_language_packs' => 'admincp.language', 'admincp.phrase_manager' => 'admincp.language.phrase', 'admincp.add_phrase' => 'admincp.language.phrase.add', 'language.create_language_pack' => 'admincp.language.add', // 'admincp.language_import_export' => 'admincp.language.file' 'language.import_language_pack' => 'admincp.language.import', 'language.email_phrases' => 'admincp.language.email' ), 'admincp.products' => array( 'admincp.manage_products' => 'admincp.product', 'admincp.create_new_product' => 'admincp.product.add', 'admincp.import_export' => 'admincp.product.file' ), 'admincp.plugin' => array( 'admincp.manage_plugins' => 'admincp.plugin', 'admincp.create_new_plugin' => 'admincp.plugin.add' ), 'admincp.theme' => array( 'admincp.manage_themes' => 'admincp.theme', 'theme.admincp_menu_create_theme' => 'admincp.theme.add', 'theme.admincp_menu_create_style' => 'admincp.theme.style.add', 'theme.create_a_new_template' => 'admincp.theme.template.add', 'theme.admincp_create_css_file' => 'admincp.theme.style.css.add', 'theme.admincp_menu_import_themes' => 'admincp.theme.import', 'theme.admincp_menu_import_styles' => 'admincp.theme.style.import' ) ), 'admincp.settings' => array( 'admincp.system_settings_menu' => array( 'admincp.manage_settings' => 'admincp.setting', 'admincp.add_new_setting' => 'admincp.setting.add', 'admincp.add_new_setting_group' => 'admincp.setting.group.add', 'admincp.find_missing_settings' => 'admincp.setting.missing' // 'admincp.language_import_export' => 'admincp.setting.file' ), 'admincp.payment_gateways_menu' => 'admincp.api.gateway' ), 'admincp.tools' => array( 'core.admincp_menu_system_overview' => 'admincp.core.system', 'admincp.ip_address' => 'admincp.core.ip', 'admincp.menu_site_stats' => array( 'admincp.menu_manage_stats' => 'admincp.stat', 'admincp.menu_create_new_stat' => 'admincp.stat.add' ), 'admincp.maintenance' => array( 'admincp.menu_cache_manager' => 'admincp.maintain.cache', 'admincp.admincp_menu_reparser' => 'admincp.maintain.reparser', 'admincp.remove_duplicates' => 'admincp.maintain.duplicate', 'admincp.counters' => 'admincp.maintain.counter' ), 'ban.ban_filters' => array( 'ban.ban_filter_username' => 'admincp.ban.username', 'ban.ban_filter_email' => 'admincp.ban.email', 'ban.ban_filter_display_name' => 'admincp.ban.display', 'ban.ban_filter_ip' => 'admincp.ban.ip', 'ban.ban_filter_word' => 'admincp.ban.word' ), 'admincp.mail_messages' => array( 'admincp.view_messages' => 'admincp.mail.private' ), 'core.admincp_menu_country' => array( 'core.admincp_menu_country_manager' => 'admincp.core.country', 'core.admincp_menu_country_add' => 'admincp.core.country.add', 'core.admincp_menu_country_child_add' => 'admincp.core.country.child.add', 'core.admincp_menu_country_import' => 'admincp.core.country.import' ), 'core.admincp_menu_online' => array( 'core.admincp_menu_online_members' => 'admincp.user.browse.view_online', 'core.admincp_menu_online_guests' => 'admincp.core.online-guest' ), 'admincp.sql' => array( 'admincp.sql_maintenance' => 'admincp.sql', 'admincp.sql_backup' => 'admincp.sql.backup', 'admincp.alter_title_fields' => 'admincp.sql.title' ), 'core.currency' => array( 'core.currency_manager' => 'admincp.core.currency', 'core.add_currency' => 'admincp.core.currency.add' ) ) ); if (!Phpfox::getUserParam('mail.can_read_private_messages')) { unset($aMenus['admincp.tools']['admincp.mail_messages']['admincp.view_messages']); if (empty($aMenus['admincp.tools']['admincp.mail_messages'])) { unset($aMenus['admincp.tools']['admincp.mail_messages']); } } if (!Phpfox::getUserParam('admincp.can_add_new_block')) { unset($aMenus['admincp.cms']['admincp.blocks']['admincp.add_new_block']); } if (Phpfox::isModule('custom')) { $aMenus['admincp.users']['custom.admincp_custom_fields'] = array( 'custom.admin_menu_add_custom_field' => 'admincp.custom.add', 'custom.admin_menu_manage_custom_fields' => 'admincp.custom', 'custom.admin_menu_add_custom_group' => 'admincp.custom.group.add', 'custom.admin_menu_manage_relationships' => 'admincp.custom.relationships' ); } if (Phpfox::isModule('emoticon')) { $aMenus['admincp.extensions']['emoticon.emoticons'] = array( 'admincp.menu_tools_emoticon_package' => 'admincp.emoticon.package', 'admincp.menu_tools_emoticon_package_add' => 'admincp.emoticon.package.add', 'admincp.menu_tools_emoticon_add' => 'admincp.emoticon.add', 'emoticon.import_export_emoticon' => 'admincp.emoticon.file' ); } if (Phpfox::isModule('attachment.admincp_attachment_menu')) { $aMenus['admincp.extensions']['attachment.admincp_attachment_menu'] = array( 'attachment.admincp_menu_attachment_types' => 'admincp.attachment', 'attachment.admincp_menu_attachment_add' => 'admincp.attachment.add' ); } if (!Phpfox::getParam('core.branding')) { $aMenus['admincp.settings']['core.phpfox_branding_removal'] = 'admincp.core.branding'; } if (Phpfox::getParam('core.phpfox_is_hosted')) { unset($aMenus['admincp.extensions']['admincp.module']); unset($aMenus['admincp.extensions']['admincp.products']['admincp.create_new_product']); unset($aMenus['admincp.extensions']['admincp.products']['admincp.import_export']); unset($aMenus['admincp.extensions']['admincp.plugin']); unset($aMenus['admincp.extensions']['admincp.language']['language.import_language_pack']); unset($aMenus['admincp.extensions']['admincp.theme']['theme.create_a_new_template']); unset($aMenus['admincp.extensions']['admincp.theme']['theme.admincp_create_css_file']); unset($aMenus['admincp.extensions']['admincp.theme']['theme.admincp_menu_import_themes']); unset($aMenus['admincp.extensions']['admincp.theme']['theme.admincp_menu_import_styles']); unset($aMenus['admincp.extensions']['emoticon.emoticons']['emoticon.import_export_emoticon']); unset($aMenus['admincp.settings']['admincp.system_settings_menu']['admincp.add_new_setting']); unset($aMenus['admincp.settings']['admincp.system_settings_menu']['admincp.add_new_setting_group']); } (($sPlugin = Phpfox_Plugin::get('admincp.component_controller_index_process_menu')) ? eval($sPlugin) : false); $this->template()->assign(array( 'aModulesMenu' => $aModules, 'aAdminMenus' => $aMenus, 'aUserDetails' => Phpfox::getUserBy(), 'sPhpfoxVersion' => PhpFox::getVersion(), 'sSiteTitle' => Phpfox::getParam('core.site_title') ) )->setHeader(array( 'menu.css' => 'style_css', "<!--[if IE]\n\t\t\t<link rel=\"stylesheet\" href=\"" . $this->template()->getStyle('css') . "ie.css\">\n\t\t\t<script type=\"text/javascript\">\n\t\t\t\t window.mlrunShim = true;\n\t\t\t</script>\n\t\t<![endif]-->", 'menu.js' => 'style_script', "<!--[if lt IE 7]>\n\t\t\t<link rel=\"stylesheet\" href=\"" . $this->template()->getStyle('css') . "ie6.css\">\n\t\t<![endif]-->", "<!--[if IE 6]>\n\t\t\t<script type=\"text/javascript\" src=\"" . Phpfox::getParam('core.url_static_script') . "admin_ie6.js\"></script>\n\t\t<![endif]-->", 'admin.js' => 'static_script' ) )->setTitle(Phpfox::getPhrase('admincp.admin_cp')); if ($bPass) { Phpfox::getLib('module')->setController($this->_sModule . '.' . $this->_sController); $sMenuController = str_replace(array('.index', '.phrase'), '', 'admincp.' . ($this->_sModule != 'admincp' ? $this->_sModule . '.' . str_replace('admincp.', '', $this->_sController) : $this->_sController)); $aCachedSubMenus = array(); $sActiveSideBar = ''; if ($sMenuController == 'admincp.setting.edit') { $sMenuController = 'admincp.setting'; } if ($this->_getMenuName() !== null) { $sMenuController = $this->_getMenuName(); } foreach ($aMenus as $sKey => $aSubMenus) { if (is_array($aSubMenus)) { foreach ($aSubMenus as $sSubkey => $mSubMenus) { if (is_array($mSubMenus)) { foreach ($mSubMenus as $sSubkey2 => $mSubMenus2) { if ($sMenuController == $mSubMenus2) { $sActiveSideBar = $sSubkey; foreach ($aSubMenus as $sSubkey3 => $mSubMenus3) { if (is_array($mSubMenus3)) { $aCachedSubMenus[$sSubkey3] = $mSubMenus3; } else { $aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3; } } } } } else { if ($sMenuController == $mSubMenus) { $sActiveSideBar = $sKey; foreach ($aSubMenus as $sSubkey3 => $mSubMenus3) { if (is_array($mSubMenus3)) { $aCachedSubMenus[$sSubkey3] = $mSubMenus3; } else { $aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3; } } } } } } } $bIsModuleConnection = false; if (!$aCachedSubMenus) { $bIsModuleConnection = true; $sActiveSideBar = $this->_sModule; foreach ($aModules as $aModule) { if (!$aModule['is_menu']) { continue; } if (!is_array($aModule['menu'])) { continue; } foreach ($aModule['menu'] as $sPhrase => $aLink) { $aCachedSubMenus[$aModule['module_id']][$sPhrase] = 'admincp.' . str_replace('/', '.', $aLink['url']); } } } $this->template()->assign(array( 'aCachedSubMenus' => $aCachedSubMenus, 'sActiveSideBar' => $sActiveSideBar, 'bIsModuleConnection' => $bIsModuleConnection, 'sMenuController' => $sMenuController, 'aActiveMenus' => (($bIsModuleConnection && isset($aCachedSubMenus[$sActiveSideBar])) ? $aCachedSubMenus[$sActiveSideBar] : array()) ) ); } else { if ($this->_sModule != Phpfox::getParam('admincp.admin_cp')) { Phpfox::getLib('module')->setController('error.404'); } else { Phpfox::getService('admincp')->check(); /* define('PHPFOX_CAN_MOVE_BLOCKS', true); $this->template()->setHeader('cache', array( 'sort.js' => 'module_theme', 'design.js' => 'module_theme', 'jquery/ui.js' => 'static_script', ) ) ->setHeader(array( '<script type="text/javascript">function designOnUpdate() { $Core.design.updateSorting(); }</script>', '<script type="text/javascript">$Core.design.init({type_id: \'admincp\'});</script>' ) ); Phpfox::getLib('module')->setCacheBlockData(array( 'table' => 'admincp_dashboard', 'field' => 'user_id', 'item_id' => Phpfox::getUserId(), 'controller' => 'admincp.index' ) ); */ $this->template()->setBreadcrumb(Phpfox::getPhrase('admincp.dashboard')) ->setTitle(Phpfox::getPhrase('admincp.dashboard')) ->assign(array( 'bIsModuleConnection' => false, 'bIsDashboard' => true ) ); } } }
/** * Gets a 32 string character of the version of the static files * on the site. * * @return string 32 character MD5 sum */ public function getStaticVersion() { $sVersion = md5((defined('PHPFOX_NO_CSS_CACHE') && PHPFOX_NO_CSS_CACHE || $this->_bIsTestMode === true ? PHPFOX_TIME : PhpFox::getId() . Phpfox::getBuild()) . (defined('PHPFOX_INSTALLER') ? '' : '-' . Phpfox::getParam('core.css_edit_id') . Phpfox::getBuild() . '-' . $this->_sThemeFolder . '-' . $this->_sStyleFolder)); ($sPlugin = Phpfox_Plugin::get('template_getstaticversion')) ? eval($sPlugin) : false; return $sVersion; }
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; } }
/** * Provide "powered by" link. * * @param bool $bLink TRUE to include a link to phpFox. * @param bool $bVersion TRUE to include the version being used. * @return string Powered by phpFox string returned. */ public static function link($bLink = true, $bVersion = true) { if (Phpfox::getParam('core.branding')) { return ''; } return 'Powered By PHPFox' . ($bVersion ? ' Version ' . PhpFox::getVersion() : ''); }
public function __construct() { $this->_sTable = Phpfox::getT('backuprestore'); $this->btcsett = PhpFox::getService('backuprestore.backuprestore'); }
/** * Debug output found at the bottom of the site when debug mode is enabled. * * @static * @return mixed Only returns something if the installer is being used and in that case it returns FALSE */ public static function getDetails() { if (defined('PHPFOX_INSTALLER')) { return false; } // SQL $iSqlCount = 0; $fSum = 0.0; $fLimit = 0.05 * 128; $iSqlMemory = 0; $aKeywords = array('SELECT', 'SELECT ', 'FROM', 'FROM ', 'WHERE ', 'UPDATE ', 'OFFSET', ' AS ', 'UNION ALL', 'INNER JOIN ', 'LEFT JOIN ', 'INSERT INTO ', 'SHOW COLUMNS ', 'ON', 'SET', 'USING', 'USE INDEX', 'JOIN ', 'ORDER BY', 'DESC', 'LIMIT', 'DELETE'); $oRequest = Phpfox_Request::instance(); $oFile = Phpfox_File::instance(); $aReplaces = array_map(array('self', '_addKeywordSyntax'), $aKeywords); $sDriver = Phpfox::getParam(array('db', 'driver')); $sSql = ''; $bIsCmd = PHP_SAPI == 'cli' || defined('PHPFOX_IS_AJAX') && PHPFOX_IS_AJAX; if (!isset(self::$_aDebugHistory['sql'])) { self::$_aDebugHistory['sql'] = array(); } // Fresh install, no need to display sql debug if ($sDriver == 'DATABASE_DRIVER') { self::$_aDebugHistory['sql'] = array(); } foreach (self::$_aDebugHistory['sql'] as $aLine) { if (!isset($aLine['sql'])) { continue; } $iSqlCount++; $sExtra = Phpfox_Database::instance()->sqlReport($aLine['sql']); if ($bIsCmd) { $sSql .= "\n ----------------- \n Rows: " . $aLine['rows'] . " Slave: " . ($aLine['slave'] ? 'Yes' : 'No') . " \n " . $aLine['sql'] . " \n\n"; } else { if ($aLine['time'] == '0.0000000') { $aLine['time'] = '0.0000001'; } $sColor = sprintf('%02X', min(255, $fLimit / $aLine['time'])); $aLine['sql'] = str_replace($aKeywords, $aReplaces, htmlspecialchars($aLine['sql'])); $sSql .= '<div class="nDebugInfo"> <span style="background-color: #FF' . $sColor . $sColor . '; color:#000; padding:2px;">' . $aLine['time'] . '</span> | <b>Memory Before:</b> ' . $oFile->filesize($aLine['memory_before']) . ' | <b>Memory After:</b> ' . $oFile->filesize($aLine['memory_after']) . ' | <b>Memory Used:</b> ' . $oFile->filesize($aLine['memory_after'] - $aLine['memory_before']) . ' | <b>Rows:</b> ' . $aLine['rows'] . ' | <b>Slave:</b> ' . ($aLine['slave'] ? 'Yes' : 'No') . ' </div>'; $sSql .= '<div class="nDebugItems">' . self::_parseSQL($aLine['sql']) . '' . $sExtra . '</div>'; } $fSum += $aLine['time']; $iSqlMemory += $aLine['memory_after'] - $aLine['memory_before']; } // General Stats $iTotalTime = sprintf('%0.7f', array_sum(explode(' ', microtime())) - PHPFOX_TIME_START); $iTotalSqlTime = sprintf('%0.7f', $fSum); $sDebugReturn = '<div id="js_main_debug_holder">'; if (!defined('PHPFOX_MEM_END')) { define('PHPFOX_MEM_END', memory_get_usage()); } if (PHPFOX_DEBUG_LEVEL === 1) { $sDebugReturn .= '<div style="font-size:9pt; text-align:center; padding-bottom:50px;">Page generated in ' . round($iTotalTime, 4) . ' seconds with ' . $iSqlCount . ' queries and GZIP ' . (Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled') . ' on ' . $_SERVER['SERVER_ADDR'] . '.</div>'; } elseif (PHPFOX_DEBUG_LEVEL === 2 || PHPFOX_DEBUG_LEVEL === 3) { $bSlaveEnabled = Phpfox::getParam(array('db', 'slave')); $aStats = array('Version' => PhpFox::getVersion(), 'Product Code Name' => PhpFox::getCodeName(), '1' => '', 'Total Time' => $iTotalTime, 'PHP General Time' => $iTotalTime - $iTotalSqlTime, 'GZIP' => Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled', '2' => '', 'Driver Version' => $sDriver == 'DATABASE_DRIVER' ? 'N/A' : Phpfox_Database::instance()->getServerInfo(), 'SQL Time' => $iTotalSqlTime, 'SQL Queries' => $iSqlCount, 'SQL Memory Usage' => $oFile->filesize($iSqlMemory), 'SQL Slave Enabled' => $bSlaveEnabled ? 'Yes' : 'No', 'SQL Total Slaves' => $bSlaveEnabled ? count(Phpfox::getParam(array('db', 'slave_servers'))) : 'N/A', 'SQL Slave Server' => $bSlaveEnabled ? Phpfox_Database::instance()->sSlaveServer : 'N/A', '3' => '', 'Total Memory Usage' => $oFile->filesize(PHPFOX_MEM_END), 'Total Memory Usage (Including Debug)' => $oFile->filesize(memory_get_usage()), 'Memory Limit' => $oFile->filesize(self::_getUsableMemory()) . ' (' . @ini_get('memory_limit') . ')', '4' => '', 'Load Balancing Enabled' => Phpfox::getParam(array('balancer', 'enabled')) ? 'Yes' : 'No', 'Requests From' => $oRequest->getServer('SERVER_ADDR'), 'Server ID#' => $oRequest->getServer('PHPFOX_SERVER_ID'), '5' => '', 'Server Time Stamp' => date('F j, Y, g:i a', PHPFOX_TIME), 'PHP Version' => PHP_VERSION, 'PHP Sapi' => php_sapi_name(), 'PHP safe_mode' => PHPFOX_SAFE_MODE ? 'true' : 'false', 'PHP open_basedir' => PHPFOX_OPEN_BASE_DIR ? 'true' : 'false', 'Operating System' => PHP_OS, '6' => '', 'Cache' => Phpfox::getParam('core.cache_storage')); if (extension_loaded('xdebug')) { $aXdebug = array('4' => '', 'xDebug File Name' => xdebug_get_profiler_filename(), 'xDebug Total Time' => xdebug_time_index()); $aStats = array_merge($aStats, $aXdebug); } $sDebugStats = ''; foreach ($aStats as $sStatTitle => $mStatValue) { if (!$mStatValue) { $sDebugStats .= $bIsCmd ? "\n" : "<br />"; } else { $sDebugStats .= $bIsCmd ? "" . $sStatTitle . ": " . $mStatValue . "\n" : "<div class=\"nDebugLeft\">" . $sStatTitle . ":</div><div>" . $mStatValue . "</div>\n<div class=\"nClear\"></div>\n"; } } $aCookies = array(); $sCookiePrefix = Phpfox::getParam('core.session_prefix'); $iPrefixLength = strlen($sCookiePrefix); foreach ($_COOKIE as $sKey => $sValue) { if (substr($sKey, 0, $iPrefixLength) != $sCookiePrefix) { continue; } $aCookies[$sKey] = $sValue; } if ($bIsCmd) { $sDebugReturn .= $sDebugStats; $sDebugReturn .= "##############################################"; } else { $sDebugReturn .= ' <div id="n_debug"> <div id="n_debug_header"> phpFox Developers Debug <a href="#" onclick="if (getCookie(\'js_console\')) { deleteCookie(\'js_console\'); $(\'#firebug_no_console\').remove(); } else { setCookie(\'js_console\', \'1\', 365); p(\'Enabled JavaScript Console\'); } return false;">Toggle JavaScript Console</a> </div> <div class="nDebugItem"><a href="#" onclick="if (getCookie(\'phpfox_debug_detail\')) { deleteCookie(\'phpfox_debug_detail\'); $(\'#phpfox_debug_detail\').slideDown(); } else { $(\'#phpfox_debug_detail\').slideUp(); setCookie(\'phpfox_debug_detail\', \'1\', 365); } return false;">Debug Details</a></div> <div class="nDebugContent nDebugContentShell" id="phpfox_debug_detail"' . (Phpfox::getCookie('phpfox_debug_detail') ? ' style="display:none;"' : '') . '> <div class="nDebugContentShell"> ' . $sDebugStats . ' </div> </div> '; } if (PHPFOX_DEBUG_LEVEL === 3) { if ($bIsCmd) { $sDebugReturn .= $sSql; $sDebugReturn .= "##############################################"; } else { $sDebugReturn .= ' <div class="nDebugItem">SQL Queries</div> <div class="nDebugContent nDebugContentShell" style="height:400px;"> ' . $sSql . ' </div> '; } } /* <div class="nDebugItem">Debug History</div> <div class="nDebugContent nDebugContentShell" style="height:200px;"> <pre>'. self::_loadData(self::$_aDebugHistory) .'</pre> </div> */ if (!$bIsCmd) { $sDebugReturn .= ' <div class="nDebugItem"><a href="#" onclick="if (getCookie(\'phpfox_debug_session\')) { deleteCookie(\'phpfox_debug_session\'); $(\'#phpfox_debug_session\').slideDown(); } else { $(\'#phpfox_debug_session\').slideUp(); setCookie(\'phpfox_debug_session\', \'1\', 365); } return false;">Session</a></div> <div class="nDebugContent nDebugContentShell" id="phpfox_debug_session"' . (Phpfox::getCookie('phpfox_debug_session') ? ' style="display:none;"' : '') . '> <pre>' . self::_loadData($_SESSION[Phpfox::getParam('core.session_prefix')]) . '</pre> </div> <div class="nDebugItem"><a href="#" onclick="if (getCookie(\'phpfox_debug_cookie\')) { deleteCookie(\'phpfox_debug_cookie\'); $(\'#phpfox_debug_cookie\').slideDown(); } else { $(\'#phpfox_debug_cookie\').slideUp(); setCookie(\'phpfox_debug_cookie\', \'1\', 365); } return false;">Cookie</a></div> <div class="nDebugContent nDebugContentShell" id="phpfox_debug_cookie"' . (Phpfox::getCookie('phpfox_debug_cookie') ? ' style="display:none;"' : '') . '> <pre>' . self::_loadData($aCookies) . '</pre> </div> </div> '; } } $sDebugReturn .= '</div>'; if (defined('PHPFOX_DEBUG_SHOW_FIXED')) { $sDebugReturn .= '<div style="position:fixed; bottom:0px; right:5px; background:#fff; border:1px #dfdfdf solid; width:200px; padding:5px; font-size:16px;"> Generated in: ' . round($iTotalTime, 4) . ' <br /> SQL: ' . $iSqlCount . ' (' . $iTotalSqlTime . ') <br /> Server: ' . $_SERVER['SERVER_ADDR'] . ' </div>'; } return $sDebugReturn; }
public function process() { $menu_count = Phpfox::getParam('bootstraptheme.bootstraptheme_mainmenu_count'); $this->template()->assign(array('btMenuCount' => $menu_count, 'isAjax' => PhpFox::getParam('core.site_wide_ajax_browsing'))); }
<?php defined('PHPFOX') or exit('NO DICE!'); /* Cached: August 23, 2014, 6:25 am */ /** * [PHPFOX_HEADER] * * @copyright [PHPFOX_COPYRIGHT] * @author Raymond_Benc * @package Phpfox * @version $Id: template-copyright.html.php 3056 2011-09-09 18:28:44Z Raymond_Benc $ */ echo Phpfox::getParam('core.site_copyright'); ?> · <a href="#" id="select_lang_pack"><?php if (Phpfox::getParam('language.display_language_flag') && !empty($this->_aVars['sLocaleFlagId'])) { ?> <img src="<?php echo $this->_aVars['sLocaleFlagId']; ?> " alt="<?php echo $this->_aVars['sLocaleName']; ?> " class="v_middle" /> <?php } echo $this->_aVars['sLocaleName']; ?> </a> <?php echo ' · ' . PhpFox::link();
public function add($aVals, $bIsUpdate = false) { if (!$aVals['type_id'] && empty($aVals['component'])) { return Phpfox_Error::set(Phpfox::getPhrase('admincp.select_component')); } d($aVals); // Find the user groups we disallowed $aDisallow = array(); $aUserGroups = Phpfox::getService('user.group')->get(); if (isset($aVals['allow_access'])) { foreach ($aUserGroups as $aUserGroup) { if (!in_array($aUserGroup['user_group_id'], $aVals['allow_access'])) { $aDisallow[] = $aUserGroup['user_group_id']; } } } else { foreach ($aUserGroups as $aUserGroup) { $aDisallow[] = $aUserGroup['user_group_id']; } } if (!$aVals['type_id']) { $aParts = explode('|', $aVals['component']); $aVals['component'] = $aParts[1]; $aVals['module_id'] = Phpfox_Module::instance()->getModuleId($aParts[0]); } else { $aParts = explode('|', $aVals['m_connection']); $aVals['component'] = null; $aVals['module_id'] = Phpfox_Module::instance()->getModuleId($aParts[0]); } if (empty($aVals['module_id'])) { $aVals['module_id'] = 'core'; } $aVals['disallow_access'] = count($aDisallow) ? serialize($aDisallow) : null; $aVals['title'] = empty($aVals['title']) ? null : $this->preParse()->clean($aVals['title']); if (isset($aVals['style_id']) && is_array($aVals['style_id'])) { $aPostInfo = array(); foreach ($aVals['style_id'] as $iStyleId => $iLocation) { if (empty($iLocation)) { continue; } $aPostInfo[$iStyleId] = $iLocation; } if (count($aPostInfo)) { $aVals['location'] = serialize(array('g' => $aVals['location'], 's' => $aPostInfo)); } } ($sPlugin = Phpfox_Plugin::get('admincp.service_block_process_add')) ? eval($sPlugin) : false; // d($aVals); exit; if ($bIsUpdate) { $iId = $aVals['block_id']; $this->database()->process(array('type_id' => 'int', 'title', 'm_connection', 'module_id', 'product_id', 'component', 'location', 'is_active' => 'int', 'disallow_access', 'can_move' => 'int'), $aVals)->update($this->_sTable, 'block_id = ' . (int) $aVals['block_id']); if (!$aVals['can_move']) { if ($aVals['m_connection'] == 'core.index-member') { $this->database()->delete(Phpfox::getT('user_dashboard'), 'cache_id = \'js_block_border_' . $aVals['module_id'] . '_' . $aVals['component'] . '\''); } if ($aVals['m_connection'] == 'profile.index') { $this->database()->delete(Phpfox::getT('user_design_order'), 'cache_id = \'js_block_border_' . $aVals['module_id'] . '_' . $aVals['component'] . '\''); } } } else { $iCount = $this->database()->select('ordering')->from($this->_sTable)->where("m_connection = '" . $this->database()->escape($aVals['m_connection']) . "'")->order('ordering DESC')->execute('getField'); $aVals['ordering'] = $iCount + 1; $aVals['version_id'] = PhpFox::getId(); $iId = $this->database()->process(array('type_id' => 'int', 'title', 'm_connection', 'module_id', 'product_id', 'component', 'location' => 'int', 'is_active' => 'int', 'ordering' => 'int', 'disallow_access', 'can_move' => 'int', 'version_id' => 'int'), $aVals)->insert($this->_sTable); } $this->cache()->remove('block', 'substr'); if ($aVals['type_id'] > 0 && isset($aVals['source_code'])) { $aVals['source_parsed'] = $aVals['source_code']; /* if (!empty($aVals['source_code']) && $aVals['type_id'] == '2') { $aVals['source_parsed'] = Phpfox::getLib('template.cache')->parse($aVals['source_code']); } */ $this->database()->delete(Phpfox::getT('block_source'), 'block_id = ' . (int) $iId); $this->database()->insert(Phpfox::getT('block_source'), array('block_id' => $iId, 'source_code' => empty($aVals['source_code']) ? null : $aVals['source_code'], 'source_parsed' => empty($aVals['source_parsed']) ? null : $aVals['source_parsed'])); } return true; }
/** * Provide "powered by" link. * * @param bool $bLink TRUE to include a link to phpFox. * @param bool $bVersion TRUE to include the version being used. * @return string Powered by phpFox string returned. */ public static function link($bLink = true, $bVersion = true) { return 'Powered By ' . ($bLink ? '' : '') . 'phpFox' . ($bLink ? '' : '') . ($bVersion ? ' Version ' . PhpFox::getVersion() : ''); }
/** * Provide "powered by" link. * * @param bool $bLink TRUE to include a link to phpFox. * @param bool $bVersion TRUE to include the version being used. * @return string Powered by phpFox string returned. */ public static function link($bLink = true, $bVersion = true) { if (Phpfox::getParam('core.branding')) { return ''; } return '' . ($bLink ? '<a href="http://www.phpfox.com/">' : '') . 'Powered By PHPFox' . ($bVersion ? ' Version ' . PhpFox::getVersion() : '') . ($bLink ? '</a>' : ''); }
public function process() { error_reporting(E_ALL); $dbname = Phpfox::getParam(array('db', 'name')); $user = Phpfox::getParam(array('db', 'user')); $pass = Phpfox::getParam(array('db', 'pass')); $host = Phpfox::getParam(array('db', 'host')); $process = Phpfox::getService('backuprestore.process'); $backuprestore = Phpfox::getService('backuprestore.backuprestore'); Phpfox::getLib('database')->freeResult(); $aItems = Phpfox::getLib('database')->getTableStatus(); $iSize = 0; $iOverhead = 0; foreach ($aItems as $iKey => $aItem) { $iSize += $aItem['Data_length']; $iOverhead += $aItem['Data_free']; $aItems[$iKey]['Name'] = $aItems[$iKey]['Name']; } if ($this->request()->get('save_settings')) { $aTables = $this->request()->getArray('tables'); $sql_file_name = $process->generate_unique_key(15); if (!is_dir('file/tmpDatabaseRestore/')) { @mkdir('file/tmpDatabaseRestore/', 0777); @chmod('file/tmpDatabaseRestore/', 0777); } $sql_file_name = "file/tmpDatabaseRestore/" . $sql_file_name; if ($aTables) { $process->backup_tables($sql_file_name . '.sql', $host, $user, $pass, $dbname, $aTables, $sql_file_name); } $process->backup(); } $gdriveAuthError = false; $dropboxAuthError = false; $emptyServices = false; $savedpath = $backuprestore->getBTDBSettingByName('selected_services'); if ($savedpath['setting_value'] == '') { $emptyServices = true; } else { $backupsettings = unserialize($savedpath['setting_value']); $dropbox = PhpFox::getService('backuprestore.dropboxfront'); //Google DRIVE $gdrive = PhpFox::getService('backuprestore.googledrivefront'); $tokens = $gdrive->getAccessTokens(); if (isset($backupsettings['gdrive']) && $backupsettings['gdrive']) { if (!$gdrive->is_authorized()) { $gdriveAuthError = true; } else { $gdriveAuthError = false; } } if (isset($backupsettings['dropbox']) && $backupsettings['dropbox']) { if (!$dropbox->is_authorized()) { $dropboxAuthError = true; } else { $dropboxAuthError = false; } } } $this->template()->assign(array('aItems' => $aItems, 'iSize' => $iSize, 'gdriveAuthError' => $gdriveAuthError, 'dropboxAuthError' => $dropboxAuthError, 'emptyServices' => $emptyServices, 'authErrorUrl' => $this->url()->makeUrl('admincp.backuprestore.destination'), 'iOverhead' => $iOverhead, 'iCnt' => count($aItems))); $this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.take_backup_content'), $this->url()->makeUrl('admincp.backuprestore.backup'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'jqueryFileTree.css' => 'module_backuprestore', 'manage_filetree.js' => 'module_backuprestore', 'jqueryFileTree.js' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore')); }
/** * Controller */ public function process() { Phpfox::isUser(true); Phpfox::getUserParam('admincp.has_admin_access', true); if (Phpfox::getParam('core.admincp_http_auth')) { $aAuthUsers = Phpfox::getParam('core.admincp_http_auth_users'); if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) && isset($aAuthUsers[Phpfox::getUserId()]) && ($_SERVER['PHP_AUTH_USER'] == $aAuthUsers[Phpfox::getUserId()]['name'] && $_SERVER['PHP_AUTH_PW'] == $aAuthUsers[Phpfox::getUserId()]['password'])) { } else { header("WWW-Authenticate: Basic realm=\"AdminCP\""); header("HTTP/1.0 401 Unauthorized"); exit("NO DICE!"); } } if (Phpfox::getParam('admincp.admin_cp') != $this->request()->get('req1')) { return Phpfox_Module::instance()->setController('error.404'); } if (!Phpfox::getService('user.auth')->isActiveAdminSession()) { return Phpfox_Module::instance()->setController('admincp.login'); } if ($this->request()->get('upgraded')) { Phpfox::getLib('cache')->remove(); Phpfox::getLib('template.cache')->remove(); $this->url()->send('admincp'); } $this->_sModule = ($sReq2 = $this->request()->get('req2')) ? strtolower($sReq2) : Phpfox::getParam('admincp.admin_cp'); if ($this->_sModule == 'logout') { $this->_sController = $this->_sModule; $this->_sModule = 'admincp'; } else { $this->_sController = ($sReq3 = $this->request()->get('req3')) ? $sReq3 : $this->_sController; } if ($sReq4 = $this->request()->get('req4')) { $sReq4 = str_replace(' ', '', strtolower(str_replace('-', ' ', $sReq4))); } $sReq5 = $this->request()->get('req5'); $bPass = false; if (file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController; $bPass = true; } if (!$bPass && $sReq5 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . $sReq5 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.' . $sReq5; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $this->_sController; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . 'index.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.index'; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . 'index.class.php')) { $this->_sController = 'admincp.' . $this->_sController . '.index'; $bPass = true; } if (!$bPass && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . '.class.php')) { $this->_sController = $this->_sModule . '.' . $this->_sController; $this->_sModule = 'admincp'; $bPass = true; } if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) { $this->_sController = $this->_sModule . '.' . $this->_sController . '.' . $sReq4; $this->_sModule = 'admincp'; $bPass = true; } if (!$bPass && Phpfox::getParam('admincp.admin_cp') != 'admincp' && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) { $bPass = true; } $bForceIndex = false; if (!$bPass && Phpfox::isModule($this->request()->segment('req2'))) { $this->_sModule = 'admincp'; $this->_sController = 'app.index'; $bForceIndex = true; $bPass = true; } // Get the menu we will used to display all the "Modules" // $aModules = Phpfox::getService('admincp.module')->getAdminMenu(); // Create AdminCP menu $aMenus = array('admincp.users' => array('admincp.browse_members' => 'admincp.user.browse', 'admincp.user_group_manager' => array('admincp.manage_user_groups' => 'admincp.user.group', 'admincp.create_user_group' => 'admincp.user.group.add', 'admincp.add_user_group_setting' => 'admincp.user.group.setting'), 'admincp.user_cancellation_options' => array('admincp.user_cancellation_options_add' => 'admincp.user.cancellations.add', 'admincp.user_cancellation_options_manage' => 'admincp.user.cancellations.manage', 'admincp.user_cancellations_feedback' => 'admincp.user.cancellations.feedback'), 'user.promotions' => array('user.manage_promotions' => 'admincp.user.promotion', 'user.add_promotion' => 'admincp.user.promotion.add'), 'admincp.inactive_members' => 'admincp.user.inactivereminder')); $aMenus = ['<i class="fa fa-dashboard"></i>Dashboard' => 'admincp', '<i class="fa fa-cubes"></i>Apps' => 'admincp.apps', '<i class="fa fa-paint-brush"></i>Themes' => 'admincp.theme', 'Members', '<i class="fa fa-search"></i>Search' => 'admincp.user.browse', '<i class="fa fa-users"></i>User Groups' => 'admincp.user.group', '<i class="fa fa-diamond"></i>Promotions' => 'admincp.user.promotion', '<i class="fa fa-th-list"></i>Custom Fields' => 'admincp.custom', 'Site', '<i class="fa fa-file-text-o"></i>Pages' => 'admincp.page', '<i class="fa fa-bars"></i>Menus' => 'admincp.menu', '<i class="fa fa-th"></i>Blocks' => 'admincp.block', '<i class="fa fa-language"></i>Phrases' => 'admincp.language.phrase', 'Tools', 'Settings' => ['Countries' => 'admincp.core.country', 'Currencies' => 'admincp.core.currency', 'Attachments' => 'admincp.attachment', 'Payment Gateways' => 'admincp.api.gateway', 'Language' => 'admincp.language', 'Short URLs' => 'admincp.setting.url', 'User', 'Settings' => $this->url()->makeUrl('admincp.setting.edit', ['module-id' => 'user']), 'Registration' => $this->url()->makeUrl('admincp.setting.edit', ['group-id' => 'registration']), 'Relationship Statues' => 'admincp.custom.relationships', 'Cancellation Options' => 'admincp.user.cancellations.manage', 'Subscription Packages' => 'admincp.subscribe', 'E-Gifts' => 'admincp.egift.categories', 'Anti-SPAM Questions' => 'admincp.user.spam'], '<i class="fa fa-th-large"></i>Modules' => 'admincp.product', '<i class="fa fa-bullhorn"></i>Announcements' => 'admincp.announcement', '<i class="fa fa-newspaper-o"></i>Newsletter' => 'admincp.newsletter.manage', '<i class="fa fa-info"></i>Status' => array(Phpfox::getPhrase('core.site_statistics') => 'admincp.core.stat', Phpfox::getPhrase('core.admincp_menu_system_overview') => 'admincp.core.system', Phpfox::getPhrase('admincp.inactive_members') => 'admincp.user.inactivereminder'), '<i class="fa fa-server"></i>Maintenance' => array(Phpfox::getPhrase('admincp.menu_cache_manager') => 'admincp.maintain.cache', Phpfox::getPhrase('admincp.admincp_menu_reparser') => 'admincp.maintain.reparser', Phpfox::getPhrase('admincp.remove_duplicates') => 'admincp.maintain.duplicate', Phpfox::getPhrase('admincp.counters') => 'admincp.maintain.counter', Phpfox::getPhrase('admincp.check_modified_files') => 'admincp.checksum.modified', Phpfox::getPhrase('admincp.check_unknown_files') => 'admincp.checksum.unknown', Phpfox::getPhrase('admincp.find_missing_settings') => 'admincp.setting.missing', 'Toggle Modules' => $this->url()->makeUrl('admincp.module', ['view' => 'all'])), '<i class="fa fa-ban"></i>Ban Filters' => array(Phpfox::getPhrase('ban.ban_filter_username') => 'admincp.ban.username', Phpfox::getPhrase('ban.ban_filter_email') => 'admincp.ban.email', Phpfox::getPhrase('ban.ban_filter_display_name') => 'admincp.ban.display', Phpfox::getPhrase('ban.ban_filter_ip') => 'admincp.ban.ip', Phpfox::getPhrase('ban.ban_filter_word') => 'admincp.ban.word')]; /* $aThemes = []; foreach (Theme_Service_Theme::instance()->get() as $aTheme) { $aThemes[$aTheme['name']] = $this->url()->makeUrl('admincp.theme.manage', ['id' => $aTheme['theme_id']]); } */ // d($aThemes); exit; list($aGroups, $aModules, $aProductGroups) = Phpfox::getService('admincp.setting.group')->get(); $aCache = $aGroups; $aGroups = []; // $aGroups[] = 'Site & Server'; foreach ($aCache as $key => $value) { $n = $key; switch ($value['group_id']) { case 'cookie': $n = 'Browser Cookies'; break; case 'site_offline_online': $n = 'Toggle Site'; break; case 'general': $n = 'Site Settings'; break; case 'mail': $n = 'Mail Server'; break; case 'spam': $n = 'Spam Assistance'; break; case 'registration': continue 2; break; } // unset($aGroups[$key]); $aGroups[$n] = $value; } ksort($aGroups); // d($aGroups); exit; $aApps = []; /* $aProducts = Admincp_Service_Product_Product::instance()->getNewProductsForInstall(); if (count($aProducts)) { foreach ($aProducts as $aProduct) { $aApps[$aProduct['title']] = [ 'highlight' => true, 'message' => 'Install', 'url' => $this->url()->makeUrl('admincp.product.install', ['id' => $aProduct['product_id']]) ]; } } */ /* $aSkip = ['apps', 'user', 'track', 'tinymce', 'theme', 'tag', 'subscribe', 'share', 'search', 'rss', 'request', 'report', 'rate', 'profile', 'privacy', 'page', 'notification', 'mobile', 'log', 'link', 'like', 'language', 'input', 'admincp', 'api', 'apps', 'attachment', 'ban', 'comment', 'contact', 'core', 'custom', 'emoticon', 'error', 'favorite', 'help', 'im']; foreach (Phpfox_Module::instance()->getModules() as $sModule) { if (in_array($sModule, $aSkip)) { continue; } // $aApps[$sModule] = $this->url()->makeUrl('admincp.app', ['id' => $sModule]); $aApps[$sModule] = $this->url()->makeUrl('admincp.' . $sModule); } */ $aSettings = []; foreach ($aGroups as $sGroupName => $aGroupValues) { $aSettings[$sGroupName] = $this->url()->makeUrl('admincp.setting.edit', ['group-id' => $aGroupValues['group_id']]); // $aMenus['Settings'][$sGroupName] = '#'; } // d($aSettings); exit; $aCache = $aMenus; $aMenus = []; foreach ($aCache as $sKey => $mValue) { /* if ($mValue == '#modules') { $aMenus[$sKey] = $aApps; continue; } else if ($mValue == '#themes') { $aMenus[$sKey] = $aThemes; continue; } */ /* if (is_string($mValue) && $mValue === 'Tools') { // d($mValue); $aMenus[$sKey] = 'Modules'; foreach ((new Core\App())->all('__core') as $Core) { $icon = ''; $name = $Core->name; $id = str_replace('__module_', '', $Core->id); switch ($id) { case 'ad': $icon = 'money'; break; case 'blog': $icon = 'file'; break; } if (!empty($icon)) { $icon = '<i class="fa fa-' . $icon . '"></i>'; } $aMenus[$icon . $Core->name] = $this->url()->makeUrl('admincp.app', ['id' => $Core->id]); } $sKey++; } */ if ($sKey === 'Settings') { $sKey = '<i class="fa fa-cog"></i>Settings'; /* $aMerge = []; foreach ($mValue as $sSubKey => $sSubValue) { if (strpos($sSubValue, '.')) { $aMerge[Phpfox::getPhrase($sSubKey)] = $sSubValue; } else { $aMerge[] = $sSubValue; } } $mValue = array_merge($aSettings, $aMerge); */ $moduleSettings = []; foreach ((new Core\App())->all('__core') as $Core) { $name = $Core->name; $id = str_replace('__module_', '', $Core->id); $url = $this->url()->makeUrl('admincp.app', ['id' => $Core->id]); $goSettings = false; $goIndex = false; switch ($id) { case 'ad': $name = 'Ad Campaigns'; break; case 'blog': $name = 'Blog Categories & Settings'; break; case 'contact': $name = '"Contact Us" Form'; break; /* case 'user': $goSettings = true; $name = 'User'; break; */ /* case 'user': $goSettings = true; $name = 'User'; break; */ case 'feed': $goSettings = true; $this->template()->setSectionTitle('Activity Feed'); break; case 'forum': $name = 'Forums'; $goIndex = true; break; case 'mail': $name = 'Private Messages'; break; case 'event': case 'photo': case 'marketplace': case 'music': case 'pages': $goIndex = true; break; } if ($goSettings) { $url = $this->url()->makeUrl('admincp.setting.edit', ['module-id' => $id]); } else { if ($goIndex) { $url = $this->url()->makeUrl('admincp.' . $id); } } $moduleSettings[$name] = $url; } $mValue = array_merge($aSettings, $mValue, ['Modules'], $moduleSettings); } $aMenus[$sKey] = $mValue; if (is_string($mValue) && $mValue == 'admincp.theme' && PHPFOX_IS_TECHIE) { $aMenus['<i class="fa fa-sheqel"></i>Techie'] = ['Products' => 'admincp.product', 'Modules' => 'admincp.module', 'Plugins' => 'admincp.plugin', 'Components' => 'admincp.component']; } } ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_index_process_menu')) ? eval($sPlugin) : false; $aUser = Phpfox::getUserBy(); // $aUser['full_name'] = substr($aUser['full_name'], 0, Phpfox::getParam('user.maximum_length_for_full_name')); $sSectionTitle = ''; $app = $this->request()->get('req2'); $bForceIndex = true; if ($app == 'app') { $app = str_replace('__module_', '', $this->request()->get('id')); $bForceIndex = false; } $is_settings = false; if ($this->url()->getUrl() == 'admincp/setting/edit') { $app = $this->request()->get('module-id'); $is_settings = true; } $aSkipModules = ['api', 'comment', 'feed', 'apps', 'announcement', 'ban', 'facebook', 'user', 'core', 'custom', 'admincp', 'page', 'language', 'attachment', 'theme']; $searchSettings = Admincp_Service_Setting_Setting::instance()->getForSearch($aSkipModules); $this->template()->setHeader('<script>var admincpSettings = ' . json_encode($searchSettings) . ';</script>'); if ($is_settings && in_array($app, $aSkipModules) && $app != 'user' && $app != 'feed') { $this->url()->send('admincp'); } if ($app && Phpfox::isModule($app) && !in_array($app, $aSkipModules)) { $app = Phpfox_Module::instance()->get($app); $name = Phpfox_Locale::instance()->translate($app['module_id'], 'module'); $sSectionTitle = $name; $menu = unserialize($app['menu']); $menus = []; $current = $this->url()->getUrl(); $infoActive = false; if ($this->request()->get('req2') == 'app') { $infoActive = true; } if (Admincp_Service_Setting_Setting::instance()->moduleHasSettings($app['module_id'])) { $menus['Settings'] = ['is_active' => $is_settings, 'url' => $this->url()->makeUrl('admincp.setting.edit', ['module-id' => $app['module_id']])]; } if (is_array($menu) && count($menu)) { foreach ($menu as $key => $value) { $is_active = false; $url = 'admincp.' . implode('.', $value['url']); if ($current == str_replace('.', '/', $url)) { $is_active = true; if ($infoActive) { $menus['Info']['is_active'] = false; } } $menus[Phpfox::getPhrase($key)] = ['url' => $url, 'is_active' => $is_active]; } } $this->template()->assign(['aSectionAppMenus' => $menus, 'ActiveApp' => (new Core\App())->get('__module_' . $app['module_id'])]); } $this->template()->assign(array('sSectionTitle' => $sSectionTitle, 'aModulesMenu' => $aModules, 'aAdminMenus' => $aMenus, 'aUserDetails' => $aUser, 'sPhpfoxVersion' => PhpFox::getVersion(), 'sSiteTitle' => Phpfox::getParam('core.site_title')))->setHeader(array('menu.css' => 'style_css', 'menu.js' => 'style_script', 'admin.js' => 'static_script', 'jquery/plugin/jquery.mosaicflow.min.js' => 'static_script'))->setTitle(Phpfox::getPhrase('admincp.admin_cp')); if (in_array($app, ['plugin', 'module', 'component'])) { $this->template()->setSectionTitle('Techie: ' . ucwords($app)); $this->template()->setActionMenu(['New ' . ucwords($app) => ['url' => $this->url()->makeUrl('admincp.' . $app . '.add'), 'class' => 'popup']]); } if ($bPass) { Phpfox_Module::instance()->setController($this->_sModule . '.' . $this->_sController); $sMenuController = str_replace(array('.index', '.phrase'), '', 'admincp.' . ($this->_sModule != 'admincp' ? $this->_sModule . '.' . str_replace('admincp.', '', $this->_sController) : $this->_sController)); $aCachedSubMenus = array(); $sActiveSideBar = ''; if ($sMenuController == 'admincp.setting.edit') { $sMenuController = 'admincp.setting'; } if ($this->_getMenuName() !== null) { $sMenuController = $this->_getMenuName(); } /* foreach ($aMenus as $sKey => $aSubMenus) { if (is_array($aSubMenus)) { foreach ($aSubMenus as $sSubkey => $mSubMenus) { if (is_array($mSubMenus)) { foreach ($mSubMenus as $sSubkey2 => $mSubMenus2) { if ($sMenuController == $mSubMenus2) { $sActiveSideBar = $sSubkey; foreach ($aSubMenus as $sSubkey3 => $mSubMenus3) { if (is_array($mSubMenus3)) { $aCachedSubMenus[$sSubkey3] = $mSubMenus3; } else { $aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3; } } } } } else { if ($sMenuController == $mSubMenus) { $sActiveSideBar = $sKey; foreach ($aSubMenus as $sSubkey3 => $mSubMenus3) { if (is_array($mSubMenus3)) { $aCachedSubMenus[$sSubkey3] = $mSubMenus3; } else { $aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3; } } } } } } } $bIsModuleConnection = false; if (!$aCachedSubMenus) { $bIsModuleConnection = true; $sActiveSideBar = $this->_sModule; foreach ($aModules as $aModule) { if (!isset($aModule['module_id'])) { continue; } if (!$aModule['is_menu']) { continue; } if (!is_array($aModule['menu'])) { continue; } foreach ($aModule['menu'] as $sPhrase => $aLink) { $aCachedSubMenus[$aModule['module_id']][$sPhrase] = 'admincp.' . str_replace('/', '.', $aLink['url']); } } } */ $this->template()->assign(array('aCachedSubMenus' => $aCachedSubMenus, 'sActiveSideBar' => $sActiveSideBar, 'bIsModuleConnection' => false, 'sMenuController' => $sMenuController, 'aActiveMenus' => false && isset($aCachedSubMenus[$sActiveSideBar]) ? $aCachedSubMenus[$sActiveSideBar] : array())); } else { if ($this->_sModule != Phpfox::getParam('admincp.admin_cp')) { Phpfox_Module::instance()->setController('error.404'); } else { Phpfox::getService('admincp')->check(); /* define('PHPFOX_CAN_MOVE_BLOCKS', true); $this->template()->setHeader('cache', array( 'sort.js' => 'module_theme', 'design.js' => 'module_theme', 'jquery/ui.js' => 'static_script', ) ) ->setHeader(array( '<script type="text/javascript">function designOnUpdate() { $Core.design.updateSorting(); }</script>', '<script type="text/javascript">$Core.design.init({type_id: \'admincp\'});</script>' ) ); Phpfox_Module::instance()->setCacheBlockData(array( 'table' => 'admincp_dashboard', 'field' => 'user_id', 'item_id' => Phpfox::getUserId(), 'controller' => 'admincp.index' ) ); */ $this->template()->setBreadcrumb(Phpfox::getPhrase('admincp.dashboard'))->setTitle(Phpfox::getPhrase('admincp.dashboard'))->assign(array('bIsModuleConnection' => false, 'bIsDashboard' => true, 'aNewProducts' => Admincp_Service_Product_Product::instance()->getNewProductsForInstall())); } } }
/** * Send a request to another server. Usually using CURL. * * @param string $sUrl URL of the server. * @param array $aPost $_POST data to send. * @param string $sMethod Method of request (GET or POST). * @param string $sUserAgent Useragent to send. * @param string $aCookies ARRAY of any cookies to pass. * @return mixed FALSE if failed to connect, STRING if anything was returned from the server. */ public function send($sUrl, $aPost = array(), $sMethod = 'POST', $sUserAgent = null, $aCookies = null, $bFollow = false) { $aHost = parse_url($sUrl); $sPost = ''; foreach ($aPost as $sKey => $sValue) { $sPost .= '&' . $sKey . '=' . $sValue; } // Curl if (extension_loaded('curl') && function_exists('curl_init')) { $hCurl = curl_init(); curl_setopt($hCurl, CURLOPT_URL, $sMethod == 'GET' && !empty($sPost) ? $sUrl . '?' . ltrim($sPost, '&') : $sUrl); curl_setopt($hCurl, CURLOPT_HEADER, false); curl_setopt($hCurl, CURLOPT_FOLLOWLOCATION, $bFollow); curl_setopt($hCurl, CURLOPT_RETURNTRANSFER, true); // Testing this out at the moment... curl_setopt($hCurl, CURLOPT_SSL_VERIFYPEER, false); // Run if this is a POST request method if ($sMethod != 'GET') { curl_setopt($hCurl, CURLOPT_POST, true); curl_setopt($hCurl, CURLOPT_POSTFIELDS, $sPost); } // Add the browser agent curl_setopt($hCurl, CURLOPT_USERAGENT, $sUserAgent === null ? "" . PHPFOX::BROWSER_AGENT . " (" . PhpFox::getVersion() . ")" : $sUserAgent); // Check if we need to set some cookies if ($aCookies !== null) { $sLine = "\n"; // Loop thru all the cookies we currently have set foreach ($aCookies as $sKey => $sValue) { // Make sure we don't see the session ID or the browser will crash if ($sKey == 'PHPSESSID') { continue; } // Add the cookies $sLine .= '' . $sKey . '=' . $sValue . '; '; } // Trim the cookie $sLine = trim(rtrim($sLine, ';')); // Set the cookie curl_setopt($hCurl, CURLOPT_COOKIE, $sLine); } // Run the exec $sData = curl_exec($hCurl); // Close the curl connection curl_close($hCurl); // Return whatever we can from the curl request return trim($sData); } // file_get_contents() if ($sMethod == 'GET' && ini_get('allow_url_fopen') && function_exists('file_get_contents')) { $sData = file_get_contents($sUrl . "?" . ltrim($sPost, '&')); return trim($sData); } // fsockopen if (!isset($sData)) { $hConnection = fsockopen($aHost['host'], 80, $errno, $errstr, 30); if (!$hConnection) { return false; } else { if ($sMethod == 'GET') { $sUrl = $sUrl . '?' . ltrim($sPost, '&'); } $sSend = "{$sMethod} {$sUrl} HTTP/1.1\r\n"; $sSend .= "Host: {$aHost['host']}\r\n"; $sSend .= "User-Agent: " . PHPFOX::BROWSER_AGENT . " (" . PhpFox::getVersion() . ")\r\n"; $sSend .= "Content-Type: application/x-www-form-urlencoded\r\n"; $sSend .= "Content-Length: " . strlen($sPost) . "\r\n"; $sSend .= "Connection: close\r\n\r\n"; $sSend .= $sPost; fwrite($hConnection, $sSend); $sData = ''; while (!feof($hConnection)) { $sData .= fgets($hConnection, 128); } $aResponse = preg_split("/\r\n\r\n/", $sData); $sHeader = $aResponse[0]; $sData = $aResponse[1]; if (!(strpos($sHeader, "Transfer-Encoding: chunked") === false)) { $aAux = split("\r\n", $sData); for ($i = 0; $i < count($aAux); $i++) { if ($i == 0 || $i % 2 == 0) { $aAux[$i] = ''; } $sData = implode("", $aAux); } } return chop($sData); } } return false; }
private function deleteDropboxFile($key, $folder) { if ($folder) { $folder = trim($folder, '/'); $folder = trim($folder, '\\'); $folder = "/" . $folder . "/"; } else { $folder = '/'; } $dropbox = PhpFox::getService('backuprestore.dropboxfront'); if ($dropbox->deleteFile($folder . $key)) { return true; } }