当前位置: 首页>>代码示例>>PHP>>正文


PHP SPFactory::db方法代码示例

本文整理汇总了PHP中SPFactory::db方法的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory::db方法的具体用法?PHP SPFactory::db怎么用?PHP SPFactory::db使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SPFactory的用法示例。


在下文中一共展示了SPFactory::db方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: limits

 private function limits($selected)
 {
     $f = SPConfig::fields($this->settings()->get('section'), array('chbxgroup', 'select', 'radio'));
     $fields = array('' => null);
     if (count($f)) {
         foreach ($f as $id => $type) {
             $labels = SPFactory::db()->select(array('sValue', 'language', 'sKey'), 'spdb_language', array('fid' => $id, 'oType' => 'field_option'))->loadAssocList();
             /** @var SPField $field */
             $field = SPFactory::Model('field');
             $field->init($id)->loadType();
             $options = $field->get('options');
             if (count($options)) {
                 foreach ($options as $value) {
                     $label = $value['label'];
                     foreach ($labels as $l) {
                         if ($l['sKey'] == $value['label']) {
                             $label = $l['sValue'];
                         }
                     }
                     if (isset($value['options'])) {
                         $fields[$type][$id . '::group::' . $value['id']] = '<b>' . $label . '</b>';
                         foreach ($value['options'] as $subOption) {
                             $fields[$type][$id . '::' . $subOption['id']] = $label . ' &gt; ' . $subOption['label'];
                         }
                     } else {
                         $fields[$type][$id . '::' . $value['id']] = $label;
                     }
                 }
             }
         }
     }
     return SPHtml_Input::select('jform[params][spLimit]', $fields, $selected, false, array('style' => 'width: 300px'));
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:33,代码来源:spelements.php

示例2: load

 private function load($task)
 {
     $db =& SPFactory::db();
     $adm = defined('SOBIPRO_ADM') ? 'adm.' : null;
     $cond = array($adm . '*', $adm . $task);
     if (strstr($task, '.')) {
         $t = explode('.', $task);
         $cond[] = $adm . $t[0] . '.*';
         $task = $t[0] . '.' . $t[1];
     }
     $this->_actions[$task] = null;
     try {
         $pids = $db->select('pid', 'spdb_plugin_task', array('onAction' => $cond))->loadResultArray();
     } catch (SPException $x) {
         Sobi::Error('Plugins', $x->getMessage(), SPC::WARNING, 0, __LINE__, __FILE__);
     }
     if (!count($pids)) {
         $this->_actions[$task] = array();
     }
     // get section depend apps
     if (Sobi::Section() && count($pids)) {
         try {
             $this->_actions[$task] = $db->select('pid', 'spdb_plugin_section', array('section' => Sobi::Section(), 'enabled' => 1, 'pid' => $pids))->loadResultArray();
         } catch (SPException $x) {
             Sobi::Error('Plugins', $x->getMessage(), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     } elseif (!(SPRequest::sid() || SPRequest::int('pid'))) {
         $this->_actions[$task] = $pids;
     }
     // here is a special exception for the custom listings
     // it can be l.alpha or list.alpha or listing.alpha
     if (preg_match('/^list\\..*/', $task) || preg_match('/^l\\..*/', $task)) {
         $this->_actions['listing' . '.' . $t[1]] = $pids;
     }
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:35,代码来源:interface.php

示例3: validateData

 protected function validateData($cacheId)
 {
     $sids = SPFactory::db()->select('sid', 'spdb_view_cache_relation', array('cid' => $cacheId))->loadResultArray();
     if ($sids && count($sids)) {
         $this->loadNonStaticData($sids);
         $this->validateNodes();
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:8,代码来源:cache.php

示例4: execute

 public function execute()
 {
     $method = explode('.', $this->_task);
     $this->nid = 'field_' . $method[0];
     $method = 'Proxy' . ucfirst($method[1]);
     $this->fid = SPFactory::db()->select('fid', 'spdb_field', array('nid' => $this->nid, 'section' => Sobi::Section()))->loadResult();
     $this->field = SPFactory::Model('field');
     $this->field->init($this->fid);
     $this->field->{$method}();
     return true;
 }
开发者ID:pelloq1,项目名称:SobiPro,代码行数:11,代码来源:field.php

示例5: minCmsVersion

 /**
  * Return min or recommend Joomla! version
  * @param $recommended
  * @return array
  */
 public static function minCmsVersion($recommended = false)
 {
     $updater = JUpdater::getInstance();
     $updater->findUpdates(700, 0);
     $version = SPFactory::db()->select('version', '#__updates', array('extension_id' => 700))->loadResult();
     $recommendedVersion = array('major' => 3, 'minor' => 2, 'build' => 3);
     if ($version) {
         $version = explode('.', $version);
         $recommendedVersion = array('major' => $version[0], 'minor' => $version[1], 'build' => $version[2]);
     }
     return $recommended ? $recommendedVersion : array('major' => 3, 'minor' => 2, 'build' => 0);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:17,代码来源:helper.php

示例6: getRevision

 public function getRevision($rev)
 {
     if (Sobi::Cfg('entry.versioning', true)) {
         $log = (array) SPFactory::db()->select('*', 'spdb_history', array('revision' => $rev))->loadObject('revision');
         if (count($log)) {
             $log['changes'] = SPConfig::unserialize($log['changes']);
         }
         return $log;
     } else {
         return array();
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:12,代码来源:message.php

示例7: search

 protected function search()
 {
     if (!SPFactory::mainframe()->checkToken()) {
         Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
     }
     //		$selected = SPRequest::int( 'selected', 0 );
     $ssid = SPRequest::base64('ssid');
     $query = SPRequest::string('q', null);
     $session = SPFactory::user()->getUserState('userSelector', null, array());
     $setting = $session[$ssid];
     /* get the site to display */
     $site = SPRequest::int('site', 1);
     $eLim = Sobi::Cfg('user_selector.entries_limit', 18);
     $eLimStart = ($site - 1) * $eLim;
     $params = array();
     if ($query) {
         $q = '%' . $query . '%';
         $params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
     }
     try {
         $count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
         $data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
     } catch (SPException $x) {
         echo $x->getMessage();
         exit;
     }
     $response = array('sites' => ceil($count / $eLim), 'site' => $site);
     if (count($data)) {
         $replacements = array();
         preg_match_all('/\\%[a-z]*/', $setting['format'], $replacements);
         $placeholders = array();
         if (isset($replacements[0]) && count($replacements[0])) {
             foreach ($replacements[0] as $placeholder) {
                 $placeholders[] = str_replace('%', null, $placeholder);
             }
         }
         if (count($replacements)) {
             foreach ($data as $index => $user) {
                 $txt = $setting['format'];
                 foreach ($placeholders as $attribute) {
                     if (isset($user[$attribute])) {
                         $txt = str_replace('%' . $attribute, $user[$attribute], $txt);
                     }
                 }
                 $data[$index]['text'] = $txt;
             }
         }
         $response['users'] = $data;
     }
     SPFactory::mainframe()->cleanBuffer();
     echo json_encode($response);
     exit;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:53,代码来源:user.php

示例8: remove

 public function remove($def)
 {
     $eid = $def->getElementsByTagName('id')->item(0)->nodeValue;
     $name = $def->getElementsByTagName('name')->item(0)->nodeValue;
     $type = $def->getElementsByTagName('type')->item(0)->nodeValue;
     $id = SPFactory::db()->select('extension_id', '#__extensions', array('type' => $type, 'element' => $eid))->loadResult();
     jimport('joomla.installer.installer');
     if (JInstaller::getInstance()->uninstall($type, $id)) {
         SPFactory::db()->delete('spdb_plugins', array('pid' => $eid, 'type' => $type), 1);
         return Sobi::Txt('CMS_EXT_REMOVED', $name);
     }
     return array('msg' => Sobi::Txt('CMS_EXT_NOT_REMOVED', $name), 'msgtype' => 'error');
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:13,代码来源:installer.php

示例9: getSections

 /**
  */
 private function getSections()
 {
     try {
         $sections = SPFactory::db()->select('*', 'spdb_object', array('oType' => 'section'), 'id')->loadObjectList();
     } catch (SPException $x) {
         Sobi::Error($this->name(), SPLang::e('CANNOT_GET_SECTIONS_LIST', $x->getMessage()), SPC::WARNING, 500, __LINE__, __FILE__);
     }
     if (count($sections)) {
         foreach ($sections as $section) {
             if (Sobi::Can('section', 'access', $section->id, 'valid')) {
                 $s = SPFactory::Section($section->id);
                 $s->extend($section);
                 $this->_sections[] = $s;
             }
         }
         Sobi::Trigger($this->name(), __FUNCTION__, array(&$this->_sections));
     }
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:20,代码来源:front.php

示例10: execute

 public function execute($argv)
 {
     Sobi::Initialise();
     $continue = $this->parseParameters($argv);
     if ($continue) {
         if (!$this->section) {
             $this->sections = SPFactory::db()->select('id', 'spdb_object', array('oType' => 'section', 'state' => '1', '@VALID' => SPFactory::db()->valid('validUntil', 'validSince')))->loadResultArray();
         } else {
             $this->sections = SPFactory::db()->select('id', 'spdb_object', array('id' => $this->section, 'oType' => 'section', 'state' => '1', '@VALID' => SPFactory::db()->valid('validUntil', 'validSince')))->loadResultArray();
         }
         if (!$this->liveURL || !preg_match('/http[s]?:\\/\\/.*/i', $this->liveURL)) {
             $this->out('[ERROR] A valid live URL address is required');
         }
         if (count($this->sections)) {
             $this->start = time();
             foreach ($this->sections as $sid) {
                 $this->crawlSobiSection($sid);
             }
         } else {
             $this->out('[ERROR] No valid sections found');
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:23,代码来源:cron.php

示例11: array

 /**
  * @param int $sid
  * @return SPCache
  */
 public static function &cache($sid = 0)
 {
     if (!Sobi::Section()) {
         $path = array();
         $id = $sid;
         while ($id > 0) {
             try {
                 $id = SPFactory::db()->select('pid', 'spdb_relations', array('id' => $id))->loadResult();
                 if ($id) {
                     $path[] = (int) $id;
                 }
             } catch (SPException $x) {
                 Sobi::Error('CoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
             }
         }
         if (count($path)) {
             $path = array_reverse($path);
         }
         SPFactory::registry()->set('current_section', $path[0]);
     }
     SPLoader::loadClass('base.cache');
     return SPCache::getInstance($sid);
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:27,代码来源:factory.php

示例12: download

 private function download()
 {
     //		$file = SPLoader::path( 'tmp.info', 'front', false, 'txt' );
     $cont = null;
     $settings = array();
     $settings['SobiPro'] = array('Version' => SPFactory::CmsHelper()->myVersion(true), 'Version_Num' => implode('.', SPFactory::CmsHelper()->myVersion()));
     $file = SPLoader::path('tmp.info', 'front', false, 'txt');
     //		if ( SPFs::exists( $file ) ) {
     //			$cont = SPFs::read( $file );
     //		}
     //		$cont = explode( "\n", $cont );
     //		if ( count( $cont ) ) {
     //			foreach ( $cont as $line ) {
     //				if ( strstr( $line, '=' ) ) {
     //					$line = explode( "=", $line );
     //					$line[ 1 ] = explode( ';', $line[ 1 ] );
     //					$settings[ $line[ 0 ] ] = array( 'key' => $line[ 0 ], 'response' => $line[ 1 ][ 0 ], 'status' => $line[ 1 ][ 1 ] );
     //				}
     //			}
     //		}
     $this->prepareStoredData($settings);
     $settings['env'] = array('PHP_OS' => PHP_OS, 'php_uname' => php_uname(), 'PHP_VERSION_ID' => PHP_VERSION_ID);
     $settings['ftp'] = $this->ftp();
     $settings['curl'] = $this->curlFull();
     $settings['exec']['response'] = $this->execResp();
     $settings['SOBI_SETTINGS'] = SPFactory::config()->getSettings();
     $c = SPFactory::db()->select('*', 'spdb_config')->loadObjectList();
     $sections = SPFactory::db()->select(array('nid', 'id'), 'spdb_object', array('oType' => 'section'))->loadAssocList('id');
     $as = array();
     foreach ($c as $key) {
         if ($key->section == 0 || !isset($sections[$key->section])) {
             continue;
         }
         $key->section = $sections[$key->section]['nid'];
         if (!isset($as[$key->section])) {
             $as[$key->section] = array();
         }
         if (!isset($as[$key->section][$key->cSection])) {
             $as[$key->section][$key->cSection] = array();
         }
         $_c = explode('_', $key->sKey);
         if ($_c[count($_c) - 1] == 'array') {
             $key->sValue = SPConfig::unserialize($key->sValue);
         }
         $as[$key->section][$key->cSection][$key->sKey] = $key->sValue;
     }
     $settings['SOBI_SETTINGS']['sections'] = $as;
     $apps = SPFactory::db()->select('*', 'spdb_plugins')->loadObjectList();
     foreach ($apps as $app) {
         $settings['Apps'][$app->pid] = get_object_vars($app);
     }
     $settings['SOBI_SETTINGS']['mail']['smtphost'] = $settings['SOBI_SETTINGS']['mail']['smtphost'] ? 'SET' : 0;
     $settings['SOBI_SETTINGS']['mail']['smtpuser'] = $settings['SOBI_SETTINGS']['mail']['smtpuser'] ? 'SET' : 0;
     $settings['SOBI_SETTINGS']['mail']['smtppass'] = $settings['SOBI_SETTINGS']['mail']['smtppass'] ? 'SET' : 0;
     $php = ini_get_all();
     unset($php['extension_dir']);
     unset($php['include_path']);
     unset($php['mysql.default_user']);
     unset($php['mysql.default_password']);
     unset($php['mysqli.default_pw']);
     unset($php['mysqli.default_user']);
     unset($php['open_basedir']);
     unset($php['pdo_mysql.default_socket']);
     unset($php['sendmail_path']);
     unset($php['session.name']);
     unset($php['session.save_path']);
     unset($php['soap.wsdl_cache_dir']);
     unset($php['upload_tmp_dir']);
     unset($php['doc_root']);
     unset($php['docref_ext']);
     unset($php['docref_root']);
     unset($php['mysql.default_socket']);
     $settings['PHP_SETTINGS'] = $php;
     $php = get_loaded_extensions();
     $settings['PHP_EXT'] = $php;
     $out = SPFactory::Instance('types.array');
     $data = $out->toXML($settings, 'settings');
     $data = str_replace(array(SOBI_ROOT, '></'), array('REMOVED', '>0</'), $data);
     $f = SPLang::nid($settings['SOBI_SETTINGS']['general']['site_name'] . '-' . date(DATE_RFC822));
     SPFactory::mainframe()->cleanBuffer();
     header('Cache-Control: no-cache, must-revalidate');
     header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
     header("Content-type: application/xml");
     header("Content-Disposition: attachment; filename=\"sobipro_system_{$f}.xml\"");
     header('Content-Length: ' . strlen($data));
     ob_clean();
     flush();
     echo $data;
     exit;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:90,代码来源:requirements.php

示例13: loadNonStaticData

 protected function loadNonStaticData($objects)
 {
     $this->nonStaticData = SPFactory::db()->select(array('counter', 'sid'), 'spdb_counter', array('sid' => $objects))->loadAssocList('sid');
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:4,代码来源:view.php

示例14: searchData

 public function searchData($request, $section)
 {
     if ($this->dependency) {
         $path = json_decode(Sobi::Clean(SPRequest::string($this->nid . '_path')), true);
         if (count($path)) {
             $request = array_pop($path);
         }
     }
     $sids = array();
     /* check if there was something to search for */
     if (is_array($request) && count($request) || is_string($request) && strlen($request)) {
         /** @var SPDb $db */
         $db = SPFactory::db();
         try {
             /* if we are searching for multiple options
              * and the field contains 'predefined_multi_data_multi_choice'
              * - we have to find entries matches all these options */
             if (is_array($request) && $this->multi) {
                 foreach ($request as $opt) {
                     $db->select('sid', 'spdb_field_option_selected', array('copy' => '0', 'fid' => $this->fid, 'optValue' => $opt));
                     if (!isset($results)) {
                         $results = $db->loadResultArray();
                     } else {
                         $cids = $db->loadResultArray();
                         $results = array_intersect($results, $cids);
                     }
                 }
                 $sids = $results;
             } else {
                 $db->select('sid', 'spdb_field_option_selected', array('copy' => '0', 'fid' => $this->fid, 'optValue' => $request));
                 $sids = $db->loadResultArray();
             }
         } catch (SPException $x) {
             Sobi::Error($this->name(), SPLang::e('CANNOT_SEARCH_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
         }
     }
     return $sids;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:38,代码来源:select.php

示例15: getTemplates

 protected function getTemplates($type)
 {
     $templates = array();
     $templates[''] = Sobi::Txt('SELECT_TEMPLATE_OVERRIDE');
     $template = SPFactory::db()->select('sValue', 'spdb_config', array('section' => SPRequest::int('section'), 'sKey' => 'template', 'cSection' => 'section'))->loadResult();
     $templateDir = $this->templatePath($template);
     $this->listTemplates($templates, $templateDir, $type);
     return $templates;
 }
开发者ID:kishoreweblabs,项目名称:SobiPro,代码行数:9,代码来源:menu.php


注:本文中的SPFactory::db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。