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


PHP db::get方法代码示例

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


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

示例1: sitemap_forum_get_threads

function sitemap_forum_get_threads($forum_fid)
{
    if (!($db = db::get())) {
        return false;
    }
    // If there are any problems with the function arguments we bail out.
    if (!is_numeric($forum_fid)) {
        return false;
    }
    // Constant for Guest access.
    $user_perm_guest_access = USER_PERM_GUEST_ACCESS;
    // Get the table prefix from the forum fid
    if (!($table_prefix = forum_get_table_prefix($forum_fid))) {
        return false;
    }
    $sql = "SELECT THREAD.TID, UNIX_TIMESTAMP(THREAD.MODIFIED) AS MODIFIED ";
    $sql .= "FROM `{$table_prefix}THREAD` THREAD ";
    $sql .= "INNER JOIN `{$table_prefix}FOLDER` FOLDER ";
    $sql .= "ON (FOLDER.FID = THREAD.FID) ";
    $sql .= "WHERE FOLDER.PERM & {$user_perm_guest_access} > 0 ";
    $sql .= "ORDER BY THREAD.TID";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    return $result;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:29,代码来源:sitemap.inc.php

示例2: user_get_relationship

function user_get_relationship($uid, $peer_uid)
{
    if (!($db = db::get())) {
        return 0;
    }
    if (!is_numeric($uid)) {
        return 0;
    }
    if (!is_numeric($peer_uid)) {
        return 0;
    }
    if (!($table_prefix = get_table_prefix())) {
        return 0;
    }
    $sql = "SELECT RELATIONSHIP FROM `{$table_prefix}USER_PEER` ";
    $sql .= "WHERE UID = '{$uid}' AND PEER_UID = '{$peer_uid}'";
    if (!($result = $db->query($sql))) {
        return 0;
    }
    if ($result->num_rows == 0) {
        return 0;
    }
    list($peer_relationship) = $result->fetch_row();
    return $peer_relationship;
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:25,代码来源:user_rel.inc.php

示例3: saveSession

 public static function saveSession()
 {
     $engine = EngineAPI::singleton();
     $localvars = localvars::getInstance();
     $db = db::get($localvars->get('dbConnectionName'));
     $sql = "INSERT INTO `session`(username,sessionPages,ipAddr) VALUES(?,?,?)";
     $validate = new validate();
     $username = session::get('username');
     $pages = session::get('loggedPages');
     $pages = dbSanitize(implode(',', $pages));
     $ip = $_SERVER['REMOTE_ADDR'];
     $sqlArray = array($username, $pages, $ip);
     $db->beginTransaction();
     try {
         $sqlResult = $db->query($sql, $sqlArray);
         if ($sqlResult->error()) {
             throw new Exception("ERROR SQL" . $sqlResult->errorMsg());
         }
         $db->commit();
     } catch (Exception $e) {
         $db->rollback();
         $localvars->set('feedback', $e->getMessage());
         errorHandle::errorMsg($e->getMessage());
     }
 }
开发者ID:ddavisgraphics,项目名称:LearningApp,代码行数:25,代码来源:progressLog.php

示例4: getRecords

 public function getRecords($id = null)
 {
     try {
         // call engine
         $engine = EngineAPI::singleton();
         $localvars = localvars::getInstance();
         $db = db::get($localvars->get('dbConnectionName'));
         $sql = "SELECT * FROM `timeTracking`";
         $validate = new validate();
         // test to see if Id is present and valid
         if (!isnull($id) && $validate->integer($id)) {
             $sql .= sprintf('WHERE timeID = %s LIMIT 1', $id);
         }
         // if no valid id throw an exception
         if (!$validate->integer($id) && !isnull($id)) {
             throw new Exception("An invalid ID was given!");
         }
         // get the results of the query
         $sqlResult = $db->query($sql);
         // if return no results
         // else return the data
         if ($sqlResult->rowCount() < 1) {
             return "There has been no time tracking done up to this point.";
         } else {
             $data = array();
             while ($row = $sqlResult->fetch()) {
                 $data[] = $row;
             }
             return $data;
         }
     } catch (Exception $e) {
         errorHandle::errorMsg($e->getMessage());
     }
 }
开发者ID:ddavisgraphics,项目名称:TimeTrackerDemoApp_EngineAPI,代码行数:34,代码来源:timeTracker.php

示例5: word_filter_get

function word_filter_get($uid, &$word_filter_array)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    if (!is_array($word_filter_array)) {
        $word_filter_array = array();
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $sql = "SELECT FID, MATCH_TEXT, REPLACE_TEXT, FILTER_TYPE ";
    $sql .= "FROM `{$table_prefix}WORD_FILTER` ";
    $sql .= "WHERE UID = '{$uid}' AND FILTER_ENABLED = 1 ";
    $sql .= "ORDER BY FID ";
    if ($uid != 0) {
        $sql .= "LIMIT 0, 20";
    }
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    while ($word_filter_data = $result->fetch_assoc()) {
        $word_filter_array[] = $word_filter_data;
    }
    return true;
}
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:32,代码来源:word_filter.inc.php

示例6: init

 public static function init()
 {
     session::$db = db::get(true);
     if (!ini_get('session.gc_probability')) {
         @ini_set('session.gc_probability', 1);
     }
     if (!ini_get('session.gc_divisor')) {
         @ini_set('session.gc_divisor', 100);
     }
     session_set_save_handler(array('session', 'open'), array('session', 'close'), array('session', 'read'), array('session', 'write'), array('session', 'destroy'), array('session', 'gc'));
     $hash = null;
     session_name('sess_hash');
     if (!html_get_cookie('sess_hash')) {
         if ($hash = session::restore()) {
             session_id($hash);
         } else {
             html_set_cookie('user_logon', '', time() - YEAR_IN_SECONDS);
             html_set_cookie('user_token', '', time() - YEAR_IN_SECONDS);
         }
     }
     session_start();
     if (!isset($_SESSION['UID'])) {
         $_SESSION['UID'] = 0;
     }
     if (!is_null($hash)) {
         session::refresh_csrf_token();
     }
 }
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:28,代码来源:session.inc.php

示例7: get_version

 public static function get_version()
 {
     $db = db::get();
     $sql = "SELECT VERSION() AS version";
     if (!($result = $db->query($sql))) {
         return false;
     }
     if (!($version_data = $result->fetch_assoc())) {
         $sql = "SHOW VARIABLES LIKE 'version'";
         if (!($result = $db->query($sql))) {
             return false;
         }
         $version_data = $result->fetch_assoc();
     }
     $version_array = explode('.', $version_data['version']);
     if (!isset($version_array[0])) {
         $version_array[0] = 3;
     }
     if (!isset($version_array[1])) {
         $version_array[1] = 21;
     }
     if (!isset($version_array[2])) {
         $version_array[2] = 0;
     }
     return sprintf('%d.%d.%d', $version_array[0], $version_array[1], intval($version_array[2]));
 }
开发者ID:richstokoe,项目名称:BeehiveForum,代码行数:26,代码来源:db.inc.php

示例8: mods_list_forum_leaders

function mods_list_forum_leaders()
{
    if (!($db = db::get())) {
        return false;
    }
    $mod_list_array = array();
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    if (!($forum_fid = get_forum_fid())) {
        return false;
    }
    $user_perm_admin_tools = USER_PERM_ADMIN_TOOLS;
    $sql = "SELECT USERS.UID, USERS.LOGON, COALESCE(USER_PEER.PEER_NICKNAME, USERS.NICKNAME) AS NICKNAME ";
    $sql .= "FROM ((SELECT DISTINCT USER.UID, USER.LOGON, USER.NICKNAME FROM USER INNER JOIN GROUP_USERS ";
    $sql .= "ON (GROUP_USERS.UID = USER.UID) INNER JOIN GROUP_PERMS ON (GROUP_PERMS.GID = GROUP_USERS.GID) ";
    $sql .= "INNER JOIN GROUPS ON (GROUPS.GID = GROUP_PERMS.GID) WHERE GROUPS.FORUM IN (0, {$forum_fid}) ";
    $sql .= "AND GROUP_PERMS.FID IN (0) AND GROUP_PERMS.PERM & {$user_perm_admin_tools}) UNION ALL ";
    $sql .= "(SELECT DISTINCT USER.UID, USER.LOGON, USER.NICKNAME FROM USER INNER JOIN USER_PERM ";
    $sql .= "ON (USER_PERM.UID = USER.UID) WHERE USER_PERM.FORUM IN (0, {$forum_fid}) AND USER_PERM.FID IN (0) ";
    $sql .= "AND USER_PERM.PERM & {$user_perm_admin_tools} > 0)) AS USERS LEFT JOIN `{$table_prefix}USER_PEER` USER_PEER ";
    $sql .= "ON (USER_PEER.PEER_UID = USERS.UID AND USER_PEER.UID = {$_SESSION['UID']})";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    while (($mod_list_data = $result->fetch_assoc()) !== null) {
        $mod_list_array[$mod_list_data['UID']] = $mod_list_data;
    }
    return $mod_list_array;
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:33,代码来源:mods_list.inc.php

示例9: afterInit

	protected function afterInit() {
		parent::afterInit();
		$this->session = session::getInstance(array(
			'nameSpace'=>$this->cfg->sessionNameSpace
		));
		$this->table = db::get('table', $this->cfg->table);
		$this->autoLogin();
	}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:8,代码来源:default.class.php

示例10: replace

 function replace()
 {
     $page_id = params::get('page_id');
     db::table('pages');
     db::limit(1);
     db::where('page_id', $page_id);
     $page_folder = db::get('page_folder');
     headers::url($page_folder);
     //self::loadPage();
 }
开发者ID:rigidus,项目名称:ea,代码行数:10,代码来源:main.handler.php

示例11: getNameByID

 static function getNameByID($db = NULL, $fach_id)
 {
     require_once '/../db/db.class.php';
     if ($db == NULL) {
         $db = new db();
     }
     $result = $db->get('fach_name', 'fach', 'fach_id=' . $fach_id);
     while ($row = mysql_fetch_assoc($result)) {
         return $row['fach_name'];
     }
 }
开发者ID:ajaravete-tgm,项目名称:ArcPlannerPro_Webseite,代码行数:11,代码来源:Fach.class.php

示例12: ajax_chat_online_user_count

function ajax_chat_online_user_count()
{
    if (!($db = db::get())) {
        return 0;
    }
    $config = ajax_chat_get_config();
    $ajax_chat_online = $db->escape($config['dbTableNames']['online']);
    $sql = "SELECT COUNT(*) FROM `{$ajax_chat_online}`";
    $result = $db->query($sql);
    list($ajax_chat_online_users) = $result->fetch_row();
    return $ajax_chat_online_users;
}
开发者ID:DeannaG65,项目名称:BeehiveForum,代码行数:12,代码来源:ajax_chat.inc.php

示例13: start

 function start()
 {
     db::connect();
     if (!router::get(1)) {
         return true;
     }
     self::$map = array('mode' => router::get(0), 'app' => router::get(1), 'module' => 'main', 'action' => router::get(2), 'id' => router::get(4));
     s::set('SYS_PATH', 'http://' . SERVER . SYS_DIR);
     define('APP', APPS . self::get('app') . '/');
     s::set('APP', APP);
     define('MODULE', APP . self::get('module') . '/');
     s::set('MODULE', MODULE);
     if (stristr(self::$map['mode'], 'admin')) {
         self::$map['mode'] = 'admin';
     } else {
         self::$map['mode'] = 'web';
     }
     if (self::$map['mode'] == 'admin') {
         if (defined('ADMIN_USER_SITE_ID')) {
             admin::observer();
             define('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             s::set('ADMIN_SITE_ID', ADMIN_USER_SITE_ID);
             db::table('admin_sites');
             db::where('site_id', ADMIN_USER_SITE_ID);
             db::limit(1);
             $row = db::select();
             define('ADMIN_SITE', db::get('site_domain'));
             s::set('ADMIN_SITE', ADMIN_SITE);
         }
     } else {
         web::getSite();
         $lang = lang::gets(LANG_INDEX, SITE_ID);
         /*
         	Authentification webUser
         */
         web::observer();
     }
     /*
     	Set params
     */
     params::send();
     if (router::get(0) == 'feed' || router::get(0) == 'rss') {
         self::$map['module'] = 'feed';
     }
     if (self::$map['mode'] == 'admin') {
         load::module(self::get('app'), self::get('module'), self::get('action'));
     } else {
         load::handler(self::get('app'), self::get('module'), self::get('action'));
     }
 }
开发者ID:rigidus,项目名称:ea,代码行数:50,代码来源:loader.php

示例14: user

 static function user()
 {
     if (!self::$optionsset) {
         self::$optionsset = true;
         $options = db::get()->assoc('SELECT name, value FROM options WHERE user_id = :user_id', array('user_id' => self::$user->id));
         foreach ($options as $k => $v) {
             $k = strtolower($k);
             self::$user->{$k} = $v;
         }
     }
     if (self::$user->nickname == '') {
         self::$user->nickname = self::$user->username;
     }
     return self::$user;
 }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:15,代码来源:auth.php

示例15: auth

 function auth($username, $password)
 {
     $db = new db("users");
     $query = $db->get($username);
     if (is_array($query)) {
         if (sha1($password) == $query['password']) {
             $this->session($query);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:jakerb,项目名称:Tucan-CMS,代码行数:15,代码来源:user.php


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