本文整理汇总了PHP中PhpFox类的典型用法代码示例。如果您正苦于以下问题:PHP PhpFox类的具体用法?PHP PhpFox怎么用?PHP PhpFox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhpFox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* 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));
}
示例2: _import
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'];
}
示例3: add
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;
}
示例4: __construct
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();
}
}
示例5: add
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;
}
示例6: process
/**
* 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));
}
示例7: add
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;
}
示例8: get
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;
}
示例9: displayCaptcha
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);
}
示例10: process
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'));
}
示例11: __construct
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
}
}
示例12: process
/**
* 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));
}
示例13: add
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'];
}
示例14: export
/**
* 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();
}
示例15: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->_sTable = PhpFox::getT('quiz');
}