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


PHP SQL::WHERE_and方法代码示例

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


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

示例1: fcpf_categories_select

/**
 * Get the categories list
 *
 * @param integer Parent category ID
 * @param integer Level
 * @return array Categories
 */
function fcpf_categories_select($parent_category_ID = -1, $level = 0)
{
    global $blog, $DB;
    $result_Array = array();
    $SQL = new SQL();
    $SQL->SELECT('cat_ID, cat_name');
    $SQL->FROM('T_categories');
    $SQL->WHERE('cat_blog_ID = ' . $DB->quote($blog));
    if ($parent_category_ID == -1) {
        $SQL->WHERE_and('cat_parent_ID IS NULL');
    } else {
        $SQL->WHERE('cat_parent_ID = ' . $DB->quote($parent_category_ID));
    }
    $SQL->ORDER_BY('cat_name');
    $categories = $DB->get_results($SQL->get());
    if (!empty($categories)) {
        foreach ($categories as $category) {
            $result_Array[] = array('value' => $category->cat_ID, 'label' => str_repeat('   ', $level) . $category->cat_name);
            $child_Categories_opts = fcpf_categories_select($category->cat_ID, $level + 1);
            if ($child_Categories_opts != '') {
                foreach ($child_Categories_opts as $cat) {
                    $result_Array[] = $cat;
                }
            }
        }
    }
    return $result_Array;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:35,代码来源:_file_create_posts.form.php

示例2: SQL

 /**
  * Get an object from cache by IP address
  *
  * Load into cache if necessary
  *
  * @param string IP address
  * @param boolean false if you want to return false on error
  * @param boolean true if function should die on empty/null
  */
 function &get_by_ip($req_ip, $halt_on_error = false, $halt_on_empty = false)
 {
     global $DB, $Debuglog;
     if (!isset($this->ip_index[$req_ip])) {
         // not yet in cache:
         $IP = ip2int($req_ip);
         $SQL = new SQL('Get ID of IP range by IP address');
         $SQL->SELECT('aipr_ID');
         $SQL->FROM('T_antispam__iprange');
         $SQL->WHERE('aipr_IPv4start <= ' . $DB->quote($IP));
         $SQL->WHERE_and('aipr_IPv4end >= ' . $DB->quote($IP));
         $IPRange_ID = $DB->get_var($SQL->get());
         // Get object from IPRangeCache bi ID
         $IPRange = $this->get_by_ID($IPRange_ID, $halt_on_error, $halt_on_empty);
         if ($IPRange) {
             // It is in IPRangeCache
             $this->ip_index[$req_ip] = $IPRange;
         } else {
             // not in the IPRangeCache
             if ($halt_on_error) {
                 debug_die("Requested {$this->objtype} does not exist!");
             }
             $this->ip_index[$req_ip] = false;
         }
     } else {
         $Debuglog->add("Retrieving <strong>{$this->objtype}({$req_ip})</strong> from cache");
     }
     return $this->ip_index[$req_ip];
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:38,代码来源:_iprangecache.class.php

示例3: get_newsletter_users_sql

/**
 * Get SQL for active users which accept newsletter email
 *
 * @param array users IDs
 * @return object SQL
 */
function get_newsletter_users_sql($users_IDs)
{
    global $Settings;
    $SQL = new SQL();
    $SQL->SELECT('u.user_ID');
    $SQL->FROM('T_users u');
    $SQL->FROM_add('LEFT OUTER JOIN T_users__usersettings us ON u.user_ID = us.uset_user_ID');
    $SQL->FROM_add('AND us.uset_name = \'newsletter_news\'');
    $SQL->WHERE('u.user_ID IN ( ' . implode(', ', $users_IDs) . ' )');
    $SQL->WHERE_and('u.user_status IN ( \'activated\', \'autoactivated\' )');
    if ($Settings->get('def_newsletter_news')) {
        // If General setting "newsletter_news" = 1 we also should include all users without defined user's setting "newsletter_news"
        $SQL->WHERE_and('( us.uset_value = 1 OR us.uset_value IS NULL )');
    } else {
        // If General setting "newsletter_news" = 0 we take only users which accept newsletter email
        $SQL->WHERE_and('us.uset_value = 1');
    }
    return $SQL;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:25,代码来源:_emailcampaign.funcs.php

示例4: param

 /**
  * Load data from Request form fields.
  *
  * @return boolean true if loaded data seems valid.
  */
 function load_from_Request()
 {
     param_string_not_empty('dom_name', T_('Please enter domain name.'));
     $dom_name = get_param('dom_name');
     $this->set('name', $dom_name);
     $dom_status = param('dom_status', 'string', true);
     $this->set('status', $dom_status, true);
     $dom_type = param('dom_type', 'string', true);
     $this->set('type', $dom_type, true);
     if (!param_errors_detected()) {
         // Check domains with the same name and type
         global $Messages, $DB;
         $SQL = new SQL();
         $SQL->SELECT('dom_ID');
         $SQL->FROM('T_basedomains');
         $SQL->WHERE('dom_ID != ' . $this->ID);
         $SQL->WHERE_and('dom_name = ' . $DB->quote($dom_name));
         $SQL->WHERE_and('dom_type = ' . $DB->quote($dom_type));
         if ($DB->get_var($SQL->get())) {
             $Messages->add(T_('Domain already exists with the same name and type.'));
         }
     }
     return !param_errors_detected();
 }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:29,代码来源:_domain.class.php

示例5: SQL

    // Save new values to Session
    $goal_filters['final'] = $final;
    $goal_filters['s'] = $s;
    $goal_filters['cat'] = $cat;
}
// Save new filters
$Session->set('goal_filters', $goal_filters);
$Session->dbsave();
// Create query:
$SQL = new SQL();
$SQL->SELECT('g.*, gcat_name, gcat_color');
$SQL->FROM('T_track__goal AS g');
$SQL->FROM_add('LEFT JOIN T_track__goalcat ON gcat_ID = goal_gcat_ID');
if (!empty($final)) {
    // We want to filter on final goals only:
    $SQL->WHERE_and('goal_redir_url IS NULL');
}
if (!empty($s)) {
    // We want to filter on search keyword:
    // Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL
    $SQL->WHERE_and('CONCAT_WS( " ", goal_name, goal_key, goal_redir_url ) LIKE "%' . $DB->escape($s) . '%"');
}
if (!empty($cat)) {
    // We want to filter on category:
    $SQL->WHERE_and('goal_gcat_ID = ' . $DB->quote($cat));
}
// Create result set:
$Results = new Results($SQL->get(), 'goals_', '-A');
$Results->Cache =& get_GoalCache();
$Results->title = T_('Goals') . get_manual_link('goal-settings');
/**
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:_stats_goals.view.php

示例6: tool_create_sample_comments

/**
 * Create sample comments and display a process of creating
 *
 * @param integer Blog ID
 * @param integer Number of comments
 * @param integer Number of posts
 */
function tool_create_sample_comments($blog_ID, $num_comments, $num_posts)
{
    global $DB, $posttypes_specialtypes, $localtimenow, $Hit, $Messages, $Debuglog;
    $BlogCache =& get_BlogCache();
    $selected_Blog = $BlogCache->get_by_ID($blog_ID, false, false);
    if ($selected_Blog == NULL) {
        // Incorrect blog ID, Exit here
        return;
    }
    echo T_('Creating of the sample comments...');
    evo_flush();
    /**
     * Disable log queries because it increases the memory and stops the process with error "Allowed memory size of X bytes exhausted..."
     */
    $DB->log_queries = false;
    $curr_orderby = $selected_Blog->get_setting('orderby');
    if ($curr_orderby == 'RAND') {
        $curr_orderby .= '()';
    } else {
        $curr_orderby = 'post_' . $curr_orderby;
    }
    $curr_orderdir = $selected_Blog->get_setting('orderdir');
    // find the $num_posts latest posts in blog
    $SQL = new SQL();
    $SQL->SELECT('post_ID');
    $SQL->FROM('T_items__item');
    $SQL->FROM_add('INNER JOIN T_categories ON post_main_cat_ID = cat_ID');
    $SQL->WHERE('cat_blog_ID = ' . $DB->quote($blog_ID));
    $SQL->WHERE_and('post_status = ' . $DB->quote('published'));
    // Set condition to not create sample comments for special posts
    $SQL->WHERE_and('post_ptyp_ID NOT IN ( ' . $DB->quote($posttypes_specialtypes) . ' )');
    $SQL->ORDER_BY($curr_orderby . ' ' . $curr_orderdir . ', post_ID ' . $curr_orderdir);
    $SQL->LIMIT($num_posts);
    $items_result = $DB->get_results($SQL->get(), ARRAY_A, 'Find the x latest posts in blog');
    $count = 1;
    $fix_content = 'This is an auto generated comment for testing the moderation features.
					http://www.test.com/test_comment_';
    // go through on selected items
    foreach ($items_result as $row) {
        $item_ID = $row['post_ID'];
        $ItemCache =& get_ItemCache();
        $commented_Item =& $ItemCache->get_by_ID($item_ID);
        // create $num_comments comments for each item
        for ($i = 0; $i < $num_comments; $i++) {
            $author = 'Test ' . $count;
            $email = 'test_' . $count . '@test.com';
            $url = 'http://www.test-' . rand(1, 3) . '.com/test_comment_' . $count;
            $content = $fix_content . $count;
            for ($j = 0; $j < 50; $j++) {
                // create 50 random word
                $length = rand(1, 15);
                $word = generate_random_key($length, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
                $content = $content . ' ' . $word;
            }
            // create and save a new comment
            $Comment = new Comment();
            $Comment->set_Item($commented_Item);
            $Comment->set('status', 'draft');
            $Comment->set('author', $author);
            $Comment->set('author_email', $email);
            $Comment->set('author_url', $url);
            $Comment->set('content', $content);
            $Comment->set('date', date('Y-m-d H:i:s', $localtimenow));
            $Comment->set('author_IP', $Hit->IP);
            $Comment->dbsave();
            $count++;
            if ($count % 100 == 0) {
                // Display a process of creating by one dot for 100 comments
                echo ' .';
                evo_flush();
            }
            // Clear all debug messages, To avoid an error about full memory
            $Debuglog->clear('all');
        }
    }
    echo ' OK.';
    $Messages->add(sprintf(T_('Created %d comments.'), $count - 1), 'success');
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:85,代码来源:_tool.funcs.php

示例7: detect_timeout_cron_jobs

/**
 * Detect timed out cron jobs and Send notifications
 *
 * @param array Task with error
 *             'name'
 *             'message'
 */
function detect_timeout_cron_jobs($error_task = NULL)
{
    global $DB, $time_difference, $cron_timeout_delay, $admin_url;
    $SQL = new SQL('Find cron timeouts');
    $SQL->SELECT('ctsk_ID, ctsk_name, ctsk_key');
    $SQL->FROM('T_cron__log');
    $SQL->FROM_add('INNER JOIN T_cron__task ON ctsk_ID = clog_ctsk_ID');
    $SQL->WHERE('clog_status = "started"');
    $SQL->WHERE_and('clog_realstart_datetime < ' . $DB->quote(date2mysql(time() + $time_difference - $cron_timeout_delay)));
    $SQL->GROUP_BY('ctsk_ID');
    $timeout_tasks = $DB->get_results($SQL->get(), OBJECT, $SQL->title);
    $tasks = array();
    if (count($timeout_tasks) > 0) {
        $cron_jobs_names = get_cron_jobs_config('name');
        foreach ($timeout_tasks as $timeout_task) {
            if (!empty($timeout_task->ctsk_name)) {
                // Task name is defined in DB
                $task_name = $timeout_task->ctsk_name;
            } else {
                // Try to get default task name by key:
                $task_name = isset($cron_jobs_names[$timeout_task->ctsk_key]) ? $cron_jobs_names[$timeout_task->ctsk_key] : $timeout_task->ctsk_key;
            }
            $tasks[$timeout_task->ctsk_ID] = array('name' => $task_name, 'message' => NT_('Cron job has timed out.'));
        }
        // Update timed out cron jobs:
        $DB->query('UPDATE T_cron__log
			  SET clog_status = "timeout"
			WHERE clog_ctsk_ID IN ( ' . $DB->quote(array_keys($tasks)) . ' )', 'Mark timeouts in cron jobs.');
    }
    if (!is_null($error_task)) {
        // Send notification with error task
        $tasks[$error_task['ID']] = $error_task;
    }
    if (count($tasks) > 0) {
        // Send notification email about timed out and error cron jobs to users with edit options permission
        $email_template_params = array('tasks' => $tasks);
        send_admin_notification(NT_('Scheduled task error'), 'scheduled_task_error_report', $email_template_params);
    }
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:46,代码来源:_cron.funcs.php

示例8: SQL

 /**
  * Load members of a given blog
  *
  * @todo make a UNION query when we upgrade to MySQL 4
  * @param integer Blog ID to load members for
  * @param integer Limit, 0 - for unlimit
  */
 function load_blogmembers($blog_ID, $limit = 0)
 {
     global $DB, $Debuglog;
     if (isset($this->alreadyCached['blogmembers']) && isset($this->alreadyCached['blogmembers'][$blog_ID])) {
         $Debuglog->add("Already loaded <strong>{$this->objtype}(Blog #{$blog_ID} members)</strong> into cache", 'dataobjects');
         return false;
     }
     // Clear previous users to get only the members of this blog
     $this->clear();
     // Remember this special load:
     $this->alreadyCached['blogmembers'][$blog_ID] = true;
     $Debuglog->add("Loading <strong>{$this->objtype}(Blog #{$blog_ID} members)</strong> into cache", 'dataobjects');
     // Get users which are members of the blog:
     $user_perms_SQL = new SQL();
     $user_perms_SQL->SELECT('T_users.*');
     $user_perms_SQL->FROM('T_users');
     $user_perms_SQL->FROM_add('INNER JOIN T_coll_user_perms ON user_ID = bloguser_user_ID');
     $user_perms_SQL->WHERE('bloguser_blog_ID = ' . $DB->quote($blog_ID));
     $user_perms_SQL->WHERE_and('bloguser_ismember <> 0');
     // Get users which groups are members of the blog:
     $group_perms_SQL = new SQL();
     $group_perms_SQL->SELECT('T_users.*');
     $group_perms_SQL->FROM('T_users');
     $group_perms_SQL->FROM_add('INNER JOIN T_coll_group_perms ON user_grp_ID = bloggroup_group_ID');
     $group_perms_SQL->WHERE('bloggroup_blog_ID = ' . $DB->quote($blog_ID));
     $group_perms_SQL->WHERE_and('bloggroup_ismember <> 0');
     // Union two sql queries to execute one query and save an order as one list
     $users_sql = '( ' . $user_perms_SQL->get() . ' )' . ' UNION ' . '( ' . $group_perms_SQL->get() . ' )' . ' ORDER BY user_login';
     if ($limit > 0) {
         // Limit the users
         $users_sql .= ' LIMIT ' . $limit;
     }
     $users = $DB->get_results($users_sql);
     foreach ($users as $row) {
         if (!isset($this->cache[$row->user_ID])) {
             // Save reinstatiating User if it's already been added
             $this->add(new User($row));
         }
     }
     return true;
 }
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:48,代码来源:_usercache.class.php

示例9: _wp_mw_getcategories

/**
 * metaWeblog.getCategories
 *
 * @see http://www.xmlrpc.com/metaWeblogApi#metawebloggetcategories
 *
 * @param xmlrpcmsg XML-RPC Message
 *					0 blogid (string): Unique identifier of the blog the post will be added to.
 *						Currently ignored in b2evo, in favor of the category.
 *					1 username (string): Login for a Blogger user who has permission to edit the given
 *						post (either the user who originally created it or an admin of the blog).
 *					2 password (string): Password for said username.
 * @param array of params to narrow category selection
 */
function _wp_mw_getcategories($m, $params = array())
{
    global $DB, $Settings;
    // CHECK LOGIN:
    /**
     * @var User
     */
    if (!($current_User =& xmlrpcs_login($m, 1, 2))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    // GET BLOG:
    /**
     * @var Blog
     */
    if (!($Blog =& xmlrpcs_get_Blog($m, 0))) {
        // Login failed, return (last) error:
        return xmlrpcs_resperror();
    }
    $SQL = new SQL();
    $SQL->SELECT('cat_ID, cat_name, cat_order');
    $SQL->FROM('T_categories');
    $SQL->WHERE($Blog->get_sql_where_aggregate_coll_IDs('cat_blog_ID'));
    if (!empty($params['search'])) {
        // Category name starts with 'search'
        $SQL->WHERE_and('cat_name LIKE "' . $DB->like_escape($params['search']) . '%"');
    }
    if ($Settings->get('chapter_ordering') == 'manual') {
        // Manual order
        $SQL->ORDER_BY('cat_order');
    } else {
        // Alphabetic order
        $SQL->ORDER_BY('cat_name');
    }
    $rows = $DB->get_results($SQL->get());
    if ($DB->error) {
        // DB error
        return xmlrpcs_resperror(99, 'DB error: ' . $DB->last_error);
        // user error 9
    }
    $total_rows = count($rows);
    logIO('Categories: ' . $total_rows);
    $ChapterCache =& get_ChapterCache();
    $data = array();
    for ($i = 0; $i < $total_rows; $i++) {
        if (!empty($params['limit']) && $i >= $params['limit']) {
            // We found enough, exit the loop
            break;
        }
        $Chapter =& $ChapterCache->get_by_ID($rows[$i]->cat_ID, false, false);
        if (!$Chapter) {
            continue;
        }
        if (isset($params['search'])) {
            // wp.suggestCategories
            $data[] = new xmlrpcval(array('category_id' => new xmlrpcval(intval($Chapter->ID)), 'category_name' => new xmlrpcval($Chapter->name)), 'struct');
        } else {
            $data[] = new xmlrpcval(array('categoryId' => new xmlrpcval(intval($Chapter->ID)), 'parentId' => new xmlrpcval(intval($Chapter->parent_ID)), 'description' => new xmlrpcval($Chapter->name), 'categoryDescription' => new xmlrpcval($Chapter->description), 'categoryName' => new xmlrpcval($Chapter->name), 'htmlUrl' => new xmlrpcval($Chapter->get_permanent_url()), 'rssUrl' => new xmlrpcval(url_add_param($Chapter->get_permanent_url(), 'tempskin=_rss2'))), 'struct');
        }
    }
    logIO('OK.');
    return new xmlrpcresp(new xmlrpcval($data, 'array'));
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:76,代码来源:_xmlrpcs.funcs.php

示例10: sprintf

    // UserCache result is empty which means nobody wants to receive notifications
    $result_message = sprintf(T_('Could not find any moderators wanting to receive comment moderation notifications for the blogs that have comments pending moderation!'));
    return 1;
}
// load all required Blogs
$BlogCache =& get_BlogCache();
$BlogCache->load_list($moderation_blogs);
// count all comments awaiting for moderation in the required blogs, group by blog/comment_status/author_level
$SQL = new SQL();
$SQL->SELECT('cat_blog_ID as blog_ID, comment_status, IF( comment_author_ID IS NULL, 0, user_level ) as author_level, count( comment_ID ) as cmt_count');
$SQL->FROM('T_comments');
$SQL->FROM_add('LEFT JOIN T_users ON user_ID = comment_author_ID');
$SQL->FROM_add('LEFT JOIN T_items__item ON post_ID = comment_post_ID');
$SQL->FROM_add('LEFT JOIN T_categories ON cat_ID = post_main_cat_ID');
$SQL->WHERE('comment_status IN ( ' . $DB->quote($notify_statuses) . ' )');
$SQL->WHERE_and('post_status IN ( ' . $DB->quote(array('published', 'community', 'protected')) . ' )');
$SQL->WHERE_and('cat_blog_ID IN (' . implode(',', $moderation_blogs) . ')');
$SQL->GROUP_BY('cat_blog_ID, comment_status, author_level');
$blog_comments = $DB->get_results($SQL->get());
// Create a comments map by blog_ID:comment_status:author_level:count. This way it will be much easier to get allowed comments for a specific permission
$comments_map = array();
$last_blog_ID = NULL;
foreach ($blog_comments as $row) {
    if ($last_blog_ID != $row->blog_ID) {
        $Blog =& $BlogCache->get_by_ID($row->blog_ID);
        $blog_moderation_statuses = $Blog->get_setting('moderation_statuses');
        $last_blog_ID = $row->blog_ID;
    }
    if (strpos($blog_moderation_statuses, $row->comment_status) === false) {
        // This status shouldn't be notified on this blog
        continue;
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:_comment_moderation_reminder.job.php

示例11: sprintf

if (empty($loaded_ids)) {
    // UserCache result is empty which means nobody wants to receive notifications
    $result_message = sprintf('Could not find any moderators wanting to receive post moderation notifications for the blogs that have posts pending moderation!');
    return 1;
}
// load all required Blogs
$BlogCache =& get_BlogCache();
$BlogCache->load_list($moderation_blogs);
// count all posts awaiting for moderation in the required blogs, group by blog/post_status/author_level
$SQL = new SQL();
$SQL->SELECT('cat_blog_ID as blog_ID, post_status, user_level as author_level, count( post_ID ) as post_count');
$SQL->FROM('T_items__item');
$SQL->FROM_add('LEFT JOIN T_users ON user_ID = post_creator_user_ID');
$SQL->FROM_add('LEFT JOIN T_categories ON cat_ID = post_main_cat_ID');
$SQL->WHERE('post_status IN ( ' . $DB->quote($notify_statuses) . ' )');
$SQL->WHERE_and('cat_blog_ID IN (' . implode(',', $moderation_blogs) . ')');
$SQL->GROUP_BY('cat_blog_ID, post_status, author_level');
$blog_posts = $DB->get_results($SQL->get());
// Create a posts map by blog_ID:post_status:author_level:count. This way it will be much easier to get allowed posts for a specific permission
$posts_map = array();
$last_blog_ID = NULL;
foreach ($blog_posts as $row) {
    if ($last_blog_ID != $row->blog_ID) {
        $Blog =& $BlogCache->get_by_ID($row->blog_ID);
        $blog_moderation_statuses = $Blog->get_setting('post_moderation_statuses');
        $last_blog_ID = $row->blog_ID;
    }
    if (strpos($blog_moderation_statuses, $row->post_status) === false) {
        // This status shouldn't be notified on this blog
        continue;
    }
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:_post_moderation_reminder.job.php

示例12: SQL

// Create query
$SQL = new SQL();
$SQL->SELECT('*');
$SQL->FROM('T_users__fielddefs RIGHT JOIN T_users__fieldgroups ON ufdf_ufgp_ID = ufgp_ID');
$where_clause = '';
if (!empty($s)) {
    // We want to filter on search keyword:
    // Note: we use CONCAT_WS (Concat With Separator) because CONCAT returns NULL if any arg is NULL
    $where_clause = 'CONCAT_WS( " ", ufdf_name ) LIKE "%' . $DB->escape($s) . '%"';
}
if (!empty($s_type)) {
    // We want to filter on user field type:
    $where_clause = 'ufdf_type LIKE "%' . $DB->escape($s_type) . '%"';
}
if ($where_clause != '') {
    $SQL->WHERE_and($where_clause);
}
$SQL->GROUP_BY('ufdf_ID, ufgp_ID');
$SQL->ORDER_BY('ufgp_order, ufgp_name, ufdf_order');
$count_sql = 'SELECT COUNT(*)
							  FROM T_users__fielddefs';
if ($where_clause != '') {
    $count_sql .= ' WHERE ' . $where_clause;
}
// Create result set:
$Results = new Results($SQL->get(), 'ufdf_', 'A', NULL, $count_sql);
$Results->title = T_('User fields') . get_manual_link('user-fields-list');
/**
 * Callback to enumerate possible user field types
 *
 */
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:31,代码来源:_userfields.view.php

示例13: get_commentcount_in_category

/**
 * Get # of comments for each category in a blog
 *
 * @param integer Category ID
 * @param integer Blog ID
 */
function get_commentcount_in_category($cat_ID, $blog_ID = NULL)
{
    if (is_null($blog_ID)) {
        global $blog;
        $blog_ID = $blog;
    }
    global $DB, $number_of_comments_in_cat;
    if (!isset($number_of_comments_in_cat[(string) $blog_ID])) {
        global $posttypes_specialtypes;
        $SQL = new SQL();
        $SQL->SELECT('cat_ID, COUNT( comment_ID ) c');
        $SQL->FROM('T_comments');
        $SQL->FROM_add('LEFT JOIN T_postcats ON comment_item_ID = postcat_post_ID');
        $SQL->FROM_add('LEFT JOIN T_categories ON postcat_cat_ID = cat_id');
        $SQL->FROM_add('LEFT JOIN T_items__item ON comment_item_ID = post_id');
        $SQL->WHERE('cat_blog_ID = ' . $DB->quote($blog_ID));
        $SQL->WHERE_and('comment_type IN ( "comment", "trackback", "pingback" )');
        $SQL->WHERE_and(statuses_where_clause(get_inskin_statuses($blog_ID, 'comment'), 'comment_', $blog_ID, 'blog_comment!', true));
        // add where condition to show only those posts commetns which are visible for the current User
        $SQL->WHERE_and(statuses_where_clause(get_inskin_statuses($blog_ID, 'post'), 'post_', $blog_ID, 'blog_post!', true));
        if (!empty($posttypes_specialtypes)) {
            // Get content post types, Exclide pages, intros, sidebar links and ads
            $SQL->WHERE_and('post_ityp_ID NOT IN( ' . $DB->quote($posttypes_specialtypes) . ' )');
        }
        $SQL->GROUP_BY('cat_ID');
        $number_of_comments_in_cat[(string) $blog_ID] = $DB->get_assoc($SQL->get());
    }
    return isset($number_of_comments_in_cat[(string) $blog_ID][$cat_ID]) ? (int) $number_of_comments_in_cat[(string) $blog_ID][$cat_ID] : 0;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:35,代码来源:_category.funcs.php

示例14: SQL

if ($min_inappropriate_votes > 0 || $min_spam_votes > 0) {
    // we need to join files vote table to be able to filter by votes
    $hash_SQL->FROM_add('LEFT JOIN T_links AS l ON l.link_file_ID = f.file_ID');
    $hash_SQL->FROM_add('LEFT JOIN T_links__vote AS lv ON lv.lvot_link_ID = l.link_ID');
    if ($min_inappropriate_votes > 0) {
        // Filter by minimum count of inappropriate votes
        $hash_SQL->HAVING_and('SUM( lvot_inappropriate ) >= ' . $DB->quote($min_inappropriate_votes));
    }
    if ($min_spam_votes > 0) {
        // Filter by minimum count of spam votes
        $hash_SQL->HAVING_and('SUM( lvot_spam ) >= ' . $DB->quote($min_spam_votes));
    }
}
if ($file_ID > 0) {
    // Filter by hash of File ID
    $hash_SQL->WHERE_and('( SELECT fh.file_hash FROM T_files AS fh WHERE fh.file_ID =' . $DB->quote($file_ID) . ' ) = f.file_hash');
}
// Get all distinct hash values from what we have duplicates and at least one file from duplicates corresponds to filters
$hash_results = $DB->get_assoc($hash_SQL->get());
$file_hash_values = array_keys($hash_results);
// set the number of count all files which will be displayed
$num_file_results = array_sum($hash_results);
if ($num_file_results > 0) {
    // Create SQL query to build a results table
    $SQL = new SQL();
    $SQL->SELECT('f.*,
		SUM( IFNULL( lvot_like, 0 ) ) as total_like,
		SUM( IFNULL( lvot_inappropriate, 0 ) ) as total_inappropriate,
		SUM( IFNULL( lvot_spam, 0 ) ) as total_spam,
		( SELECT COUNT( file_ID ) FROM T_files AS f2 WHERE f.file_hash = f2.file_hash ) AS total_duplicates');
    $SQL->FROM('T_files AS f');
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:_file_duplicates.view.php

示例15: detect_timeout_cron_jobs

/**
 * Detect timed out cron jobs and Send notifications
 *
 * @param array Task with error
 *             'name'
 *             'message'
 */
function detect_timeout_cron_jobs($error_task = NULL)
{
    global $DB, $time_difference, $cron_timeout_delay, $admin_url;
    $SQL = new SQL('Find cron timeouts');
    $SQL->SELECT('ctsk_ID, ctsk_name');
    $SQL->FROM('T_cron__log');
    $SQL->FROM_add('INNER JOIN T_cron__task ON ctsk_ID = clog_ctsk_ID');
    $SQL->WHERE('clog_status = "started"');
    $SQL->WHERE_and('clog_realstart_datetime < ' . $DB->quote(date2mysql(time() + $time_difference - $cron_timeout_delay)));
    $SQL->GROUP_BY('ctsk_ID');
    $timeouts = $DB->get_assoc($SQL->get(), OBJECT, $SQL->title);
    $tasks = array();
    if (count($timeouts) > 0) {
        foreach ($timeouts as $task_ID => $task_name) {
            $tasks[$task_ID] = array('name' => $task_name, 'message' => T_('Cron job was timed out.'));
        }
        // Update timed out cron jobs
        $DB->query('UPDATE T_cron__log
			  SET clog_status = "timeout"
			WHERE clog_ctsk_ID IN ( ' . $DB->quote(array_keys($tasks)) . ' )', 'Detect cron timeouts.');
    }
    if (!is_null($error_task)) {
        // Send notification with error task
        $tasks[$error_task['ID']] = $error_task;
    }
    if (count($tasks) > 0) {
        // Send notification email about timed out and error cron jobs to users with edit options permission
        $email_template_params = array('tasks' => $tasks);
        send_admin_notification(NT_('Scheduled task error'), 'scheduled_task_error_report', $email_template_params);
    }
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:38,代码来源:_cron.funcs.php


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