本文整理汇总了PHP中osCommerce\OM\Core\OSCOM::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP OSCOM::getConfig方法的具体用法?PHP OSCOM::getConfig怎么用?PHP OSCOM::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osCommerce\OM\Core\OSCOM
的用法示例。
在下文中一共展示了OSCOM::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
public static function start()
{
$OSCOM_Language = Registry::get('Language');
$OSCOM_MessageStack = Registry::get('MessageStack');
if (SERVICE_DEBUG_CHECK_LOCALE == '1') {
$setlocale = setlocale(LC_TIME, explode(',', $OSCOM_Language->getLocale()));
if ($setlocale === false || $setlocale === null) {
$OSCOM_MessageStack->add('debug', 'Error: Locale does not exist: ' . $OSCOM_Language->getLocale(), 'error');
}
}
if (SERVICE_DEBUG_CHECK_INSTALLATION_MODULE == '1' && file_exists(OSCOM::BASE_DIRECTORY . 'Core/Site/Setup')) {
$OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_install_directory_exists'), OSCOM::BASE_DIRECTORY . 'Core/Site/Setup'), 'warning');
}
if (SERVICE_DEBUG_CHECK_CONFIGURATION == '1' && is_writeable(OSCOM::BASE_DIRECTORY . 'Config/settings.ini')) {
$OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_config_file_writeable'), OSCOM::BASE_DIRECTORY . 'Config//settings.ini'), 'warning');
}
if (SERVICE_DEBUG_CHECK_SESSION_DIRECTORY == '1' && OSCOM::getConfig('store_sessions') == '') {
if (!is_dir(OSCOM_Registry::get('Session')->getSavePath())) {
$OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_session_directory_non_existent'), OSCOM_Registry::get('Session')->getSavePath()), 'warning');
} elseif (!is_writeable(OSCOM_Registry::get('Session')->getSavePath())) {
$OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_session_directory_not_writeable'), OSCOM_Registry::get('Session')->getSavePath()), 'warning');
}
}
if (SERVICE_DEBUG_CHECK_SESSION_AUTOSTART == '1' && (bool) ini_get('session.auto_start')) {
$OSCOM_MessageStack->add('debug', OSCOM::getDef('warning_session_auto_start'), 'warning');
}
if (SERVICE_DEBUG_CHECK_DOWNLOAD_DIRECTORY == '1' && DOWNLOAD_ENABLED == '1') {
if (!is_dir(DIR_FS_DOWNLOAD)) {
$OSCOM_MessageStack->add('debug', sprintf(OSCOM::getDef('warning_download_directory_non_existent'), DIR_FS_DOWNLOAD), 'warning');
}
}
return true;
}
示例2: start
/**
* Verify an existing session ID and create or resume the session if the existing session ID is valid
*
* @return boolean
* @since v3.0.0
*/
public function start()
{
if ($this->_life_time > 0) {
ini_set('session.gc_maxlifetime', $this->_life_time);
} else {
$this->_life_time = ini_get('session.gc_maxlifetime');
}
session_set_cookie_params(0, OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('http_cookie_path') : OSCOM::getConfig('https_cookie_path'), OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('http_cookie_domain') : OSCOM::getConfig('https_cookie_domain'));
if (isset($_GET[$this->_name]) && (empty($_GET[$this->_name]) || !ctype_alnum($_GET[$this->_name]) || !$this->exists($_GET[$this->_name]))) {
unset($_GET[$this->_name]);
}
if (isset($_POST[$this->_name]) && (empty($_POST[$this->_name]) || !ctype_alnum($_POST[$this->_name]) || !$this->exists($_POST[$this->_name]))) {
unset($_POST[$this->_name]);
}
if (isset($_COOKIE[$this->_name]) && (empty($_COOKIE[$this->_name]) || !ctype_alnum($_COOKIE[$this->_name]) || !$this->exists($_COOKIE[$this->_name]))) {
setcookie($this->_name, '', time() - 42000, $this->getCookieParameters('path'), $this->getCookieParameters('domain'));
}
if (session_start()) {
register_shutdown_function(array($this, 'close'));
$this->_is_started = true;
$this->_id = session_id();
return true;
}
return false;
}
示例3: hasAccess
public static function hasAccess($application)
{
if (OSCOM::configExists('offline') && OSCOM::getConfig('offline') == 'true' && $application != 'Offline') {
return false;
}
return true;
}
示例4: process
protected function process() {
$OSCOM_MessageStack = Registry::get('MessageStack');
$this->_page_title = OSCOM::getDef('heading_title');
if ( isset($_GET['cid']) && is_numeric($_GET['cid']) ) {
$this->_category_id = $_GET['cid'];
}
$this->_tree = new CategoryTree();
Registry::set('CategoryTree', $this->_tree);
Registry::set('Currencies', new Currencies());
Registry::set('Tax', new Tax());
Registry::set('Image', new Image());
// check if the products image directory exists
if ( is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products') ) {
if ( !is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products') ) {
$OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products'), 'error');
}
} else {
$OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'products'), 'error');
}
// check for imagemagick or GD
if ( !Image::hasGDSupport() && ((strlen(CFG_APP_IMAGEMAGICK_CONVERT) < 1) || !file_exists(CFG_APP_IMAGEMAGICK_CONVERT)) ) {
$OSCOM_MessageStack->add('header', OSCOM::getDef('ms_warning_image_processor_not_available'), 'warning');
}
}
示例5: initialize
public static function initialize()
{
Registry::set('MessageStack', new MessageStack());
Registry::set('Cache', new Cache());
Registry::set('PDO', PDO::initialize());
foreach (OSCOM::callDB('Shop\\GetConfiguration', null, 'Site') as $param) {
define($param['cfgKey'], $param['cfgValue']);
}
Registry::set('Session', Session::load('adminSid'));
Registry::get('Session')->start();
Registry::get('MessageStack')->loadFromSession();
Registry::set('Language', new Language());
if (!self::hasAccess(OSCOM::getSiteApplication())) {
Registry::get('MessageStack')->add('header', 'No access.', 'error');
OSCOM::redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()));
}
$application = 'osCommerce\\OM\\Core\\Site\\Admin\\Application\\' . OSCOM::getSiteApplication() . '\\Controller';
Registry::set('Application', new $application());
Registry::set('Template', new Template());
Registry::get('Template')->setApplication(Registry::get('Application'));
// HPDL move following checks elsewhere
// check if a default currency is set
if (!defined('DEFAULT_CURRENCY')) {
Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_error_no_default_currency'), 'error');
}
// check if a default language is set
if (!defined('DEFAULT_LANGUAGE')) {
Registry::get('MessageStack')->add('header', ERROR_NO_DEFAULT_LANGUAGE_DEFINED, 'error');
}
if (function_exists('ini_get') && (bool) ini_get('file_uploads') == false) {
Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_uploads_disabled'), 'warning');
}
// check if Work directories are writable
$work_dirs = array();
foreach (array('Cache', 'CoreUpdate', 'Database', 'Logs', 'Session', 'Temp') as $w) {
if (!is_writable(OSCOM::BASE_DIRECTORY . 'Work/' . $w)) {
$work_dirs[] = $w;
}
}
if (!empty($work_dirs)) {
Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_work_directories_not_writable'), OSCOM::BASE_DIRECTORY . 'Work/', implode(', ', $work_dirs)), 'error');
}
if (!OSCOM::configExists('time_zone', 'OSCOM')) {
Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_time_zone_not_defined'), 'warning');
}
if (!OSCOM::configExists('dir_fs_public', 'OSCOM') || !file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM'))) {
Registry::get('MessageStack')->add('header', OSCOM::getDef('ms_warning_dir_fs_public_not_defined'), 'warning');
}
// check if the upload directory exists
if (is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
if (!is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload')) {
Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
}
} else {
Registry::get('MessageStack')->add('header', sprintf(OSCOM::getDef('ms_error_upload_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload'), 'error');
}
}
示例6: load
/**
* Loads the session storage handler
*
* @param string $name The name of the session
* @access public
*/
public static function load($name = null)
{
$class_name = 'osCommerce\\OM\\Core\\Session\\' . OSCOM::getConfig('store_sessions');
if (class_exists($class_name)) {
return new $class_name($name);
}
trigger_error('Session Handler \'' . $class_name . '\' does not exist, using default \'osCommerce\\OM\\Core\\Session\\File\'', E_USER_ERROR);
return new Session\File($name);
}
示例7: execute
public static function execute($id)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
$data = $OSCOM_CategoryTree->getData($id);
if (!empty($data['image']) && file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image'])) {
unlink(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $data['image']);
}
}
示例8: execute
public static function execute()
{
$result = array('images' => array());
$OSCOM_DL = new DirectoryListing(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload');
$OSCOM_DL->setIncludeDirectories(false);
$OSCOM_DL->setCheckExtension('gif');
$OSCOM_DL->setCheckExtension('jpg');
$OSCOM_DL->setCheckExtension('png');
foreach ($OSCOM_DL->getFiles() as $f) {
$result['images'][] = $f['name'];
}
$result['rpcStatus'] = RPC::STATUS_SUCCESS;
echo json_encode($result);
}
示例9: execute
public static function execute()
{
$error = true;
$image = new Upload('qqfile', OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload', null, array('gif', 'jpg', 'png'));
if ($image->check() && $image->save()) {
$error = false;
}
if ($error === false) {
$result = array('success' => true, 'filename' => $image->getFilename());
} else {
$result = array('error' => 'Error');
}
echo json_encode($result);
}
示例10: execute
public static function execute()
{
$result = array();
$db_time = OSCOM::callDB('Admin\\ServerInfo\\GetTime');
$db_uptime = OSCOM::callDB('Admin\\ServerInfo\\GetUptime');
$db_version = OSCOM::callDB('Admin\\ServerInfo\\GetVersion');
$uptime = '---';
if (!in_array('exec', explode(',', str_replace(' ', '', ini_get('disable_functions'))))) {
$uptime = @exec('uptime');
}
$data = array(array('key' => 'date', 'title' => OSCOM::getDef('field_server_date'), 'value' => DateTime::getShort(null, true)), array('key' => 'system', 'title' => OSCOM::getDef('field_server_operating_system'), 'value' => php_uname('s') . ' ' . php_uname('r')), array('key' => 'host', 'title' => OSCOM::getDef('field_server_host'), 'value' => php_uname('n') . ' (' . gethostbyname(php_uname('n')) . ')'), array('key' => 'uptime', 'title' => OSCOM::getDef('field_server_up_time'), 'value' => $uptime), array('key' => 'http_server', 'title' => OSCOM::getDef('field_http_server'), 'value' => $_SERVER['SERVER_SOFTWARE']), array('key' => 'php', 'title' => OSCOM::getDef('field_php_version'), 'value' => 'PHP v' . PHP_VERSION . ' / Zend v' . zend_version()), array('key' => 'db_server', 'title' => OSCOM::getDef('field_database_host'), 'value' => OSCOM::getConfig('db_server') . ' (' . gethostbyname(OSCOM::getConfig('db_server')) . ')'), array('key' => 'db_version', 'title' => OSCOM::getDef('field_database_version'), 'value' => $db_version), array('key' => 'db_date', 'title' => OSCOM::getDef('field_database_date'), 'value' => DateTime::getShort($db_time, true)), array('key' => 'db_uptime', 'title' => OSCOM::getDef('field_database_up_time'), 'value' => $db_uptime));
$result['entries'] = $data;
$result['total'] = count($data);
return $result;
}
示例11: process
protected function process()
{
$OSCOM_MessageStack = Registry::get('MessageStack');
$this->_page_title = OSCOM::getDef('heading_title');
if (isset($_GET['cid']) && is_numeric($_GET['cid'])) {
$this->_category_id = $_GET['cid'];
}
$this->_tree = new CategoryTree();
Registry::set('CategoryTree', $this->_tree);
// check if the categories image directory exists
if (is_dir(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories')) {
if (!is_writeable(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories')) {
$OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_not_writable'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories'), 'error');
}
} else {
$OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('ms_error_image_directory_non_existant'), OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories'), 'error');
}
}
示例12: execute
public static function execute($id = null, $data)
{
if (Registry::exists('CategoryTree')) {
$OSCOM_CategoryTree = Registry::get('CategoryTree');
} else {
$OSCOM_CategoryTree = new CategoryTree();
Registry::set('CategoryTree', $OSCOM_CategoryTree);
}
if (is_numeric($id)) {
$data['id'] = $id;
}
// Prevent another big bang and check if category is not being moved to a child category
if (isset($data['id']) && $OSCOM_CategoryTree->getParentID($data['id']) != $data['parent_id']) {
if (in_array($data['id'], explode('_', $OSCOM_CategoryTree->buildBreadcrumb($data['parent_id'])))) {
return false;
}
}
if (isset($data['image'])) {
$new_image = $data['image'];
while (file_exists(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $new_image)) {
$new_image = rand(10, 99) . $new_image;
}
if (rename(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'upload/' . $data['image'], OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $new_image)) {
if (is_numeric($id)) {
$old_image = Categories::get($id, 'categories_image');
unlink(OSCOM::getConfig('dir_fs_public', 'OSCOM') . 'categories/' . $old_image);
}
$data['image'] = $new_image;
} else {
$data['image'] = null;
}
}
if (OSCOM::callDB('Admin\\Categories\\Save', $data)) {
Cache::clear('categories');
Cache::clear('category_tree');
Cache::clear('also_purchased');
return true;
}
return false;
}
示例13: _autoPrefixTables
protected function _autoPrefixTables($statement) {
if ( OSCOM::configExists('db_table_prefix') ) {
$statement = str_replace(':table_', OSCOM::getConfig('db_table_prefix'), $statement);
}
return $statement;
}
示例14: getAddress
public function getAddress($image, $group = 'default')
{
$group_id = $this->getID($group);
$url = OSCOM::getRequestType() == 'NONSSL' ? OSCOM::getConfig('product_images_http_server') . OSCOM::getConfig('product_images_dir_ws_http_server') : OSCOM::getConfig('product_images_http_server') . OSCOM::getConfig('product_images_dir_ws_http_server');
return $url . $this->_groups[$group_id]['code'] . '/' . $image;
}
示例15: execute
public function execute($input_parameters = array())
{
$query_action = strtolower(substr($this->queryString, 0, strpos($this->queryString, ' ')));
$db_table_prefix = OSCOM::getConfig('db_table_prefix');
if ($query_action == 'delete') {
$query_data = explode(' ', $this->queryString, 4);
$query_table = substr($query_data[2], strlen($db_table_prefix));
if ($this->_pdo->hasForeignKey($query_table)) {
// check for RESTRICT constraints first
foreach ($this->_pdo->getForeignKeys($query_table) as $fk) {
if ($fk['on_delete'] == 'restrict') {
$Qchild = $this->_pdo->prepare('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
foreach ($this->_binded_params as $key => $value) {
$Qchild->bindValue($key, $value['value'], $value['data_type']);
}
$Qchild->execute();
while ($Qchild->fetch()) {
$Qcheck = $this->_pdo->prepare('select ' . $fk['from_field'] . ' from ' . $db_table_prefix . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $Qchild->value($fk['to_field']) . '" limit 1');
$Qcheck->execute();
if (count($Qcheck->fetchAll()) === 1) {
trigger_error('RESTRICT constraint condition from table ' . $db_table_prefix . $fk['from_table']);
return false;
}
}
}
}
foreach ($this->_pdo->getForeignKeys($query_table) as $fk) {
$Qparent = $this->_pdo->prepare('select * from ' . $query_data[2] . ' ' . $query_data[3]);
foreach ($this->_binded_params as $key => $value) {
$Qparent->bindValue($key, $value['value'], $value['data_type']);
}
$Qparent->execute();
while ($Qparent->fetch()) {
if ($fk['on_delete'] == 'cascade') {
$Qdel = $this->_pdo->prepare('delete from ' . $db_table_prefix . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = :' . $fk['from_field']);
$Qdel->bindValue(':' . $fk['from_field'], $Qparent->value($fk['to_field']));
$Qdel->execute();
} elseif ($fk['on_delete'] == 'set_null') {
$Qupdate = $this->_pdo->prepare('update ' . $db_table_prefix . $fk['from_table'] . ' set ' . $fk['from_field'] . ' = null where ' . $fk['from_field'] . ' = :' . $fk['from_field']);
$Qupdate->bindValue(':' . $fk['from_field'], $Qparent->value($fk['to_field']));
$Qupdate->execute();
}
}
}
}
} elseif ($query_action == 'update') {
$query_data = explode(' ', $this->queryString, 3);
$query_table = substr($query_data[1], strlen($db_table_prefix));
if ($this->_pdo->hasForeignKey($query_table)) {
// check for RESTRICT constraints first
foreach ($this->_pdo->getForeignKeys($query_table) as $fk) {
if ($fk['on_update'] == 'restrict') {
$Qchild = $this->_pdo->prepare('select ' . $fk['to_field'] . ' from ' . $query_data[2] . ' ' . $query_data[3]);
foreach ($this->_binded_params as $key => $value) {
$Qchild->bindValue($key, $value['value'], $value['data_type']);
}
$Qchild->execute();
while ($Qchild->fetch()) {
$Qcheck = $this->_pdo->prepare('select ' . $fk['from_field'] . ' from ' . $db_table_prefix . $fk['from_table'] . ' where ' . $fk['from_field'] . ' = "' . $Qchild->value($fk['to_field']) . '" limit 1');
$Qcheck->execute();
if (count($Qcheck->fetchAll()) === 1) {
trigger_error('RESTRICT constraint condition from table ' . $db_table_prefix . $fk['from_table']);
return false;
}
}
}
}
foreach ($this->_pdo->getForeignKeys($query_table) as $fk) {
// check to see if foreign key column value is being changed
if (strpos(substr($this->queryString, strpos($this->queryString, ' set ') + 4, strpos($this->queryString, ' where ') - strpos($this->queryString, ' set ') - 4), ' ' . $fk['to_field'] . ' ') !== false) {
$Qparent = $this->_pdo->prepare('select * from ' . $query_data[1] . substr($this->queryString, strrpos($this->queryString, ' where ')));
foreach ($this->_binded_params as $key => $value) {
if (preg_match('/:\\b' . substr($key, 1) . '\\b/', $Qparent->queryString)) {
$Qparent->bindValue($key, $value['value'], $value['data_type']);
}
}
$Qparent->execute();
while ($Qparent->fetch()) {
if ($fk['on_update'] == 'cascade' || $fk['on_update'] == 'set_null') {
$on_update_value = '';
if ($fk['on_update'] == 'cascade') {
$on_update_value = $this->_binded_params[':' . $fk['to_field']]['value'];
}
$Qupdate = $this->_pdo->prepare('update ' . $db_table_prefix . $fk['from_table'] . ' set ' . $fk['from_field'] . ' = :' . $fk['from_field'] . ' where ' . $fk['from_field'] . ' = :' . $fk['from_field'] . '_orig');
if (empty($on_update_value)) {
$Qupdate->bindNull(':' . $fk['from_field']);
} else {
$Qupdate->bindValue(':' . $fk['from_field'], $on_update_value);
}
$Qupdate->bindValue(':' . $fk['from_field'] . '_orig', $Qparent->value($fk['to_field']));
$Qupdate->execute();
}
}
}
}
}
}
return parent::execute($input_parameters);
}