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


PHP cmsFramework::getDB方法代码示例

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


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

示例1: uninstall

 function uninstall()
 {
     $db = cmsFramework::getDB();
     // Delete GeoMaps module
     $query = "DELETE FROM #__modules WHERE module = 'mod_jreviews_geomaps'";
     $db->setQuery($query);
     $db->query();
     if ($this->cmsVersion == CMS_JOOMLA16) {
         $query = "DELETE FROM #__extensions WHERE name = 'mod_jreviews_geomaps'";
         $db->setQuery($query);
         $db->query();
     }
     // Remove GeoMaps module files
     $target = PATH_ROOT . 'modules' . DS . 'mod_jreviews_geomaps';
     $Folder = new Folder();
     if (@$Folder->delete($target)) {
         return '<div style="color:green;">GeoMaps Module successfully uninstalled.</div>';
     } else {
         return '<div style="color:red;">There was a problem uninstalling the GeoMaps module.</div>';
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:21,代码来源:admin_geomaps_uninstall_controller.php

示例2: install

 function install()
 {
     $db = cmsFramework::getDB();
     // Create the marker_icon column in the JReviews categories table
     $cat_table_cols = current($db->getTableFields('#__jreviews_categories'));
     if (!in_array('marker_icon', array_keys($cat_table_cols))) {
         $query = "ALTER TABLE `#__jreviews_categories` ADD `marker_icon` VARCHAR(150) AFTER `tmpl_suffix`;";
         $db->setQuery($query);
         $db->query();
     }
     // Install GeoMaps module
     $query = "SELECT count(*) FROM #__modules WHERE module = 'mod_jreviews_geomaps'";
     $db->setQuery($query);
     $count = $db->loadResult();
     if (!$count) {
         // create module entry in database
         $query = "\r\n                INSERT INTO #__modules \r\n                    (`title`, `module`, `published`, `params`) \r\n                VALUES \r\n                    ('Jreviews GeoMaps Module', 'mod_jreviews_geomaps', 0, '');";
         $db->setQuery($query);
         $db->query();
     }
     if ($this->cmsVersion == CMS_JOOMLA16) {
         // Need to add entry to the extensions table
         $query = "SELECT count(*) FROM #__extensions WHERE name = 'mod_jreviews_geomaps'";
         $db->setQuery($query);
         if (!$db->loadResult()) {
             $query = "\r\n                    INSERT INTO #__extensions\r\n                        (`name`,`type`,`element`,`client_id`,`enabled`,`access`,`protected`)\r\n                    VALUES\r\n                        ('mod_jreviews_geomaps','module','mod_jreviews_geomaps',0,1,1,0)\r\n                ";
             $db->setQuery($query);
             $db->query();
         }
     }
     // First extract packages
     $package = PATH_ROOT . 'components' . DS . 'com_jreviews_addons' . DS . 'geomaps' . DS . 'packages' . DS . 'mod_jreviews_geomaps.zip';
     $target = PATH_ROOT . 'modules';
     if ($this->_extract($package, $target)) {
         @copy(PATH_ROOT . 'modules' . DS . 'mod_jreviews_geomaps' . DS . 'en-GB.mod_jreviews_geomaps.ini', PATH_ROOT . 'language' . DS . 'en-GB' . DS . 'en-GB.mod_jreviews_geomaps.ini');
         return '<div style="color:green;">GeoMaps module was successfully installed/updated. You will find it in modules manager.</div>';
     } else {
         return '<div style="color:red;">There was a problem installing/updating the GeoMaps module.</div>';
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:40,代码来源:admin_geomaps_install_controller.php

示例3: beforeFilter

 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Overcome host restrictions
     $query = "SET SQL_BIG_SELECTS=1";
     $this->_db->setQuery($query);
     $this->_db->query();
     # Fix Joomla bug when language filter is active with default language code hidden in url
     if (isset($this->params['lang'])) {
         $this->params['lang'] = cmsFramework::getUrlLanguageCode();
     }
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
             $this->params['default_limit'] = $this->Config->user_limit;
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
             $this->params['default_limit'] = $this->Config->list_limit;
         }
     }
     if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
         $this->params['default_limit'] = $this->Config->user_limit;
     } else {
         $this->params['default_limit'] = $this->Config->list_limit;
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!$this->ajaxRequest) {
         if (!($menu_id = Configure::read('_public_menu_id'))) {
             # Find and set one public Itemid to use for Ajax requests
             $menu_id = '';
             $menu_id = $this->Menu->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             Configure::write('_public_menu_id', $menu_id);
         }
         if (!($search_itemid = Configure::read('_search_itemid'))) {
             // Set search menu Itemid used in several of the controllers
             $option = Sanitize::getString($this->params, 'option');
             $auto_itemid = Sanitize::getBool($this->Config, 'search_itemid', false);
             $hc_itemid = Sanitize::getInt($this->Config, 'search_itemid_hc', '');
             $search_menuid = $this->Menu->get('jr_advsearch');
             $search_itemid = '';
             switch ($option) {
                 case 'com_jreviews':
                     // page Itemid is enabled
                     if (!$auto_itemid && $hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } elseif (!$auto_itemid & $search_menuid > 0) {
                         $search_itemid = $search_menuid;
                     }
                     break;
                 default:
                     // Non-JReviews pages - can't use current page Itemid
                     if ($hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } else {
                         $search_itemid = $search_menuid;
                     }
                     break;
             }
             $search_itemid == '' and $option == 'com_jreviews' and $search_itemid = Sanitize::getString($this->params, 'Itemid');
             Configure::write('_search_itemid', $search_itemid);
         }
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:my_controller.php

示例4: elseif

    // Controller routing
    $act = Sanitize::getString($_REQUEST, 'act');
    if ($act == 'license') {
        $_GET['url'] = 'license';
    } else {
        $_GET['url'] = Sanitize::getString($_GET, 'url', 'about');
    }
    /*******************************************************************
     *                         FRONT-END ROUTING
     ******************************************************************/
} elseif ($menu_id && !isset($_POST['data']['controller']) && (!$url || !isset($route['data']['controller']) || preg_match('/^menu\\//', $route['url']['url']))) {
    // If no task is passed in the url, then this is a menu item and we read the menu parameters
    $segments = array();
    $url_param = $url;
    $url = str_replace('menu', '', $url);
    $db = cmsFramework::getDB();
    $query = "SELECT * FROM #__menu WHERE id = " . $menu_id;
    $db->setQuery($query);
    $menu = end($db->loadObjectList());
    $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params);
    if (isset($mparams['action'])) {
        $action = paramsRoute((int) $mparams['action']);
        $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id;
        // For default - home page menu
        unset($mparams['action']);
        $menu_params['data'] = $mparams;
        $filters = array('dir' => 'dirid', 'section' => 'sectionid', 'cat' => 'catid', 'criteria' => 'criteriaid');
        foreach ($filters as $key => $key2) {
            $menu_params[$key] = Sanitize::getVar($mparams, $key2);
            is_array($menu_params[$key]) and $menu_params[$key] = implode(',', $menu_params[$key]);
        }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:31,代码来源:index.php

示例5: _discoverIDs

 /**
  * Category auto-detect
  */
 function _discoverIDs(&$controller)
 {
     if ($ids = Configure::read('_discoverIDs')) {
         return $ids;
     }
     // Initialize variables
     $id = Sanitize::getInt($controller->params, 'id');
     $cat_id = Sanitize::getInt($controller->params, 'catid');
     $option = Sanitize::getString($controller->params, 'option');
     $view = Sanitize::getString($controller->params, 'view');
     $task = Sanitize::getString($controller->params, 'task');
     switch ($option) {
         case 'com_jreviews':
             # Get url params for current controller/action
             $url = Sanitize::getString($controller->passedArgs, 'url');
             $route['url']['url'] = $url;
             $route = S2Router::parse($route, true, 'jreviews');
             isset($route['data']['action']) and $route['data']['action'] == 'search' and $route = $route['url'];
             $dir_id = Sanitize::getString($route, 'dir');
             $section_id = Sanitize::getString($route, 'section');
             $cat_id = Sanitize::getString($route, 'cat');
             $criteria_id = Sanitize::getString($route, 'criteria');
             if ($cat_id != '') {
                 if ($cat_id[0] == 's') {
                     $section_id = CommonController::makeModParamsUsable(str_replace('s', '', $cat_id));
                     $cat_id = '';
                     break;
                 }
                 $cat_id = CommonController::makeModParamsUsable($cat_id);
             } elseif ($section_id != '') {
                 $section_id = CommonController::makeModParamsUsable($section_id);
             } elseif ($criteria_id != '') {
                 $criteria_id = CommonController::makeModParamsUsable($criteria_id);
             } elseif ($dir_id != '') {
                 $dir_id = CommonController::makeModParamsUsable($dir_id);
             } else {
                 //Discover the params from the menu_id
                 $menu_id = Sanitize::getString($controller->params, 'Itemid');
                 $params = $controller->Menu->getMenuParams($menu_id);
                 $dir_id = cleanIntegerCommaList(Sanitize::getString($params, 'dirid'));
                 $cat_id = cleanIntegerCommaList(Sanitize::getString($params, 'catid'));
                 $section_id = cleanIntegerCommaList(Sanitize::getString($params, 'sectionid'));
             }
             break;
         case 'com_content':
             if ('article' == $view || 'view' == $task) {
                 // If cat id was not available in url then we need to query it, otherwise it was already read above
                 if (!$cat_id) {
                     $db = !isset($this->_db) ? cmsFramework::getDB() : $this->_db;
                     $query = "\r\n                                SELECT \r\n                                    Listing.catid \r\n                                FROM \r\n                                    #__content AS Listing\r\n                                RIGHT JOIN\r\n                                    #__jreviews_categories AS Category ON Listing.catid = Category.id AND Category.option = 'com_content'\r\n                                WHERE \r\n                                    Listing.id = " . $id;
                     $db->setQuery($query);
                     $cat_id = $db->loadResult();
                 }
             } elseif ($view == "section") {
                 $section_id = $id;
             } elseif ($view == "category") {
                 $cat_id = $id;
             }
             break;
         default:
             $cat_id = null;
             // Catid not detected because the page is neither content nor jreviews
             break;
     }
     $ids = array();
     isset($dir_id) and !empty($dir_id) and $ids['dir_id'] = $dir_id;
     isset($section_id) and !empty($section_id) and $ids['section_id'] = $section_id;
     isset($cat_id) and !empty($cat_id) and $ids['cat_id'] = $cat_id;
     isset($criteria_id) and !empty($criteria_id) and $ids['criteria_id'] = $criteria_id;
     Configure::write('_discoverIDs', $ids);
     return $ids;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:75,代码来源:common_controller.php

示例6: getGroupId

 function getGroupId($user_id)
 {
     $db = cmsFramework::getDB();
     if (!$user_id) {
         return $this->cmsVersion == CMS_JOOMLA15 ? array(0) : array(1);
     }
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $query = "\n                SELECT \n                    gid \n                FROM \n                    #__users \n                WHERE \n                    id = " . $user_id;
         $db->setQuery($query);
         return array($db->loadResult());
     } else {
         $query = "\n                SELECT \n                    group_id \n                FROM \n                    #__user_usergroup_map \n                WHERE \n                    user_id = " . $user_id;
         $db->setQuery($query);
         return $db->loadResultArray();
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:16,代码来源:access.php

示例7: __construct

 function __construct()
 {
     # Adds CMS DB and Mainframe methods
     $this->_db =& cmsFramework::getDB();
     parent::__construct();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:6,代码来源:model.php

示例8: getConnection

 function getConnection()
 {
     $db =& cmsFramework::getDB();
     return $db->getConnection();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:5,代码来源:joomla.php

示例9: beforeFilter

 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
         }
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         # Find and set one public Itemid to use for Ajax requests
         $menu_id = '';
         $menu_id = $this->Menu->get('jreviews_public');
         $menu_id = $menu_id != '' ? $menu_id : 99999;
         $this->set('public_menu_id', $menu_id);
         # Add global javascript variables
         $this->assets['head-top'][] = '<script type="text/javascript">
         /* <![CDATA[ */
         var s2AjaxUri = "' . getAjaxUri() . '",
             jrLanguage = new Array(),
             jrVars = new Array(),
             datePickerImage = "' . $this->viewImages . 'calendar.gif",
             jrPublicMenu = ' . $menu_id . ';
         jrLanguage["cancel"] = "' . __t("Cancel", true) . '";
         jrLanguage["submit"] = "' . __t("Submit", true) . '";
         jrLanguage["field.select"] = "' . __t("-- Select --", true) . '";
         jrLanguage["field.select_field"] = "' . __t("-- Select %s --", true) . '";
         jrLanguage["field.no_results"] = "' . __t("No results found, try a different spelling.", true) . '";
         jrLanguage["field.ui_help"] = "' . __t("Start typing for suggestions", true) . '";
         jrLanguage["field.ui_add"] = "' . __t("Add", true) . '";
         jrLanguage["compare.heading"] = "' . __t("Compare", true) . '";
         jrLanguage["compare.compare_all"] = "' . __t("Compare All", true) . '";
         jrLanguage["compare.remove_all"] = "' . __t("Remove All", true) . '";
         jrLanguage["compare.select_more"] = "' . __t("You need to select more than one listing for comparison.", true) . '";
         jrLanguage["compare.select_max"] = "' . __t("You selected maximum number of listings for comparison.", true) . '";
         jrLanguage["geomaps.no_streeview"] = "' . __t("Street view not available for this address.", true) . '";
         jrLanguage["geomaps.cannot_geocode"] = "' . __t("Address could not be geocoded. Modify the address and click on the Geocode Address button to try again.", true) . '";
         jrLanguage["geomaps.drag_marker"] = "' . __t("Drag the marker to fine-tune the geographic location on the map.", true) . '";
         jrLanguage["geomaps.directions_bad_address"] = "' . __t("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.", true) . '";
         jrLanguage["geomaps.directions_request_error"] = "' . __t("The was an error processing the request.", true) . '";
         jrVars["locale"] = "' . cmsFramework::getLocale() . '";
         /* ]]> */
         </script>';
         if ($item_id = Sanitize::getInt($this->params, 'Itemid')) {
             $menu = $this->Menu->getMenuParams($item_id);
             $meta_desc = Sanitize::getString($menu, 'menu-meta_description');
             $meta_keys = Sanitize::getString($menu, 'menu-meta_keywords');
             $meta_desc != '' and cmsFramework::meta('description', $meta_desc);
             $meta_keys != '' and cmsFramework::meta('keywords', $meta_keys);
         }
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Init plugin system
     $this->_initPlugins();
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:100,代码来源:my_controller.php

示例10: store

 function store($arr = null)
 {
     $db = cmsFramework::getDB();
     if (is_null($arr)) {
         $arr = get_object_vars($this);
     }
     while (list($prop, $val) = each($arr)) {
         if ($prop != 'c') {
             if (is_array($val)) {
                 $val = json_encode($val);
             } else {
                 // Fixes an issue where an Array string is added to some values
                 $val = str_replace(',Array', '', $val);
             }
             $db->setQuery("\n                    UPDATE \n                        #__jreviews_config\n\t\t\t\t\tSET \n                        value= '" . $db->getEscaped($val) . "'\n\t\t\t\t\tWHERE \n                        id = '" . $db->getEscaped($prop) . "'");
             $db->query();
             $db->setQuery("SELECT \n                        count(*) \n                    FROM \n                        #__jreviews_config \n                    WHERE \n                        id = '" . $db->getEscaped($prop) . "'");
             $saved = $db->loadResult();
             if (!$saved) {
                 $db->setQuery("\n                        INSERT INTO\n                            #__jreviews_config (id, value) \n\t\t\t\t\t\tVALUES\n                            ('" . $db->getEscaped($prop) . "', '" . $db->getEscaped($val) . "')\n                    ");
                 if (!$db->query()) {
                     echo "<br/>" . $db->getErrorMsg();
                     exit;
                 }
             }
         }
     }
     if (defined('MVC_FRAMEWORK_ADMIN')) {
         // Forces clear cache when config settings are modified in the administration
         clearCache('', 'views');
         clearCache('', '__data');
     } else {
         // Push updates to the cached file
         $cache_file = 'jreviews_config_' . md5(cmsFramework::getConfig('secret'));
         $Config = $this->load();
         S2Cache::write($cache_file, $Config);
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:38,代码来源:config.php


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