本文整理汇总了PHP中SQL::SELECT方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::SELECT方法的具体用法?PHP SQL::SELECT怎么用?PHP SQL::SELECT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::SELECT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
示例2: 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;
}
示例3: uninstall_b2evolution
/**
* Uninstall b2evolution: Delete DB & Cache files
*/
function uninstall_b2evolution()
{
global $DB;
/* REMOVE PAGE CACHE */
load_class('_core/model/_pagecache.class.php', 'PageCache');
// Remove general page cache
$PageCache = new PageCache(NULL);
$PageCache->cache_delete();
// Skip if T_blogs table is already deleted. Note that db_delete() will not throw any errors on missing tables.
if ($DB->query('SHOW TABLES LIKE "T_blogs"')) {
// Get all blogs
$blogs_SQL = new SQL();
$blogs_SQL->SELECT('blog_ID');
$blogs_SQL->FROM('T_blogs');
$blogs = $DB->get_col($blogs_SQL->get());
$BlogCache =& get_BlogCache('blog_ID');
foreach ($blogs as $blog_ID) {
$Blog = $BlogCache->get_by_ID($blog_ID);
// Remove page cache of current blog
$PageCache = new PageCache($Blog);
$PageCache->cache_delete();
}
}
/* REMOVE DATABASE */
db_delete();
echo '<p>' . T_('Reset done!') . '</p>';
}
示例4: 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;
}
示例5: load
/**
* Load permissions
*
* @param integer Group ID
*/
function load($grp_ID)
{
global $DB, $modules;
// Get default group permission from each module
foreach ($modules as $module) {
$Module =& $GLOBALS[$module . '_Module'];
if (method_exists($Module, 'get_default_group_permissions')) {
// Module has pluggable permissions and we can add them to the current setting
$this->add($module, $Module->get_default_group_permissions($grp_ID), $grp_ID);
}
}
if ($grp_ID != 0) {
// Select current group permission from database
$SQL = new SQL();
$SQL->SELECT('*');
$SQL->FROM('T_groups__groupsettings');
$SQL->WHERE('gset_grp_ID = ' . $grp_ID);
$DB->begin();
// Set current group permissions
$existing_perm = array();
foreach ($DB->get_results($SQL->get()) as $row) {
$existing_perm[] = $row->gset_name;
$this->permission_values[$row->gset_name] = $row->gset_value;
}
// Set default group permission if these permissions don't exist
$update_permissions = false;
foreach ($this->permission_values as $name => $value) {
if (!in_array($name, $existing_perm)) {
$this->set($name, $value, $grp_ID);
$update_permissions = true;
}
}
if ($update_permissions) {
// We can update permission as there are some new permnissions
$this->dbupdate($grp_ID);
}
$DB->commit();
}
}
示例6: 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();
}
示例7: die
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
global $dispatcher;
// Get params from request
$s = param('s', 'string', '', true);
// Search keyword
$c = param('c', 'integer', 0, true);
// Country
$r = param('r', 'integer', 0, true);
// Region
$sr = param('sr', 'integer', 0, true);
// Sub-region
// Create query
$SQL = new SQL();
$SQL->SELECT('city_ID, city_postcode, city_name, city_enabled, city_preferred, ctry_ID, ctry_name, rgn_ID, rgn_name, subrg_ID, subrg_name');
$SQL->FROM('T_regional__city');
$SQL->FROM_add('LEFT JOIN T_regional__country ON city_ctry_ID=ctry_ID');
$SQL->FROM_add('LEFT JOIN T_regional__region ON city_rgn_ID=rgn_ID');
$SQL->FROM_add('LEFT JOIN T_regional__subregion ON city_subrg_ID=subrg_ID');
$SQL->ORDER_BY('*, ctry_name, rgn_name, subrg_name');
$sql_where = array();
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[] = 'CONCAT_WS( " ", city_postcode, city_name ) LIKE "%' . $DB->escape($s) . '%"';
}
if ($c > 0) {
// Filter by country:
$sql_where[] = 'ctry_ID = "' . $DB->escape($c) . '"';
}
示例8: contacts_groups
function contacts_groups($user_ID)
{
global $current_User, $DB, $cache_user_contacts_groups;
if (!is_array($cache_user_contacts_groups)) {
// Execute only first time to init cache
$cache_user_contacts_groups = array();
// Get contacts of current user
$groups_SQL = new SQL();
$groups_SQL->SELECT('cgr_ID AS ID, cgu_user_ID AS user_ID, cgr_name AS name');
$groups_SQL->FROM('T_messaging__contact_groupusers');
$groups_SQL->FROM_add('LEFT JOIN T_messaging__contact_groups ON cgu_cgr_ID = cgr_ID');
$groups_SQL->WHERE('cgr_user_ID = ' . $current_User->ID);
$groups_SQL->ORDER_BY('cgr_name');
$groups = $DB->get_results($groups_SQL->get());
$remove_link = url_add_param(get_dispctrl_url('contacts'), 'action=remove_user&view=contacts&' . url_crumb('messaging_contacts'));
foreach ($groups as $group) {
// Init cache for groups for each contact of current user
$group_name = $group->name . action_icon(T_('Remove user from this group'), 'remove', url_add_param($remove_link, 'user_ID=' . $group->user_ID . '&group_ID=' . $group->ID));
if (isset($cache_user_contacts_groups[$group->user_ID])) {
// nth group of this user
$cache_user_contacts_groups[$group->user_ID] .= '<br />' . $group_name;
} else {
// first group of this user
$cache_user_contacts_groups[$group->user_ID] = $group_name;
}
}
}
if (isset($cache_user_contacts_groups[$user_ID])) {
// user has groups
echo $cache_user_contacts_groups[$user_ID];
}
}
示例9: phpbb_subforums_list
/**
* Display subforums to select what to import
*
* @param object Form
* @param integer Category ID
* @param integer Forum parent ID
*/
function phpbb_subforums_list(&$Form, $cat_id, $forum_parent_id = 0)
{
global $phpbb_DB, $phpbb_subforums_list_level;
// Get the forums from phpbb database
$forums_SQL = new SQL();
$forums_SQL->SELECT('f.forum_id, f.forum_name');
$forums_SQL->FROM('BB_forums f');
$forums_SQL->FROM_add('LEFT JOIN BB_categories c ON f.cat_id = c.cat_id');
if ($cat_id > 0) {
// Get all top forums of the category
$forums_SQL->WHERE('f.cat_id = ' . $phpbb_DB->quote($cat_id));
$forums_SQL->WHERE_AND('f.forum_parent = 0');
} elseif ($forum_parent_id > 0) {
// Get subforums
$forums_SQL->WHERE('f.forum_parent = ' . $phpbb_DB->quote($forum_parent_id));
} else {
// Wrong a call of this function
return;
}
$forums_SQL->ORDER_BY('c.cat_order, f.forum_order');
$forums = $phpbb_DB->get_results($forums_SQL->get());
if (count($forums) == 0) {
return;
}
$phpbb_subforums_list_level++;
// Group all subforums in one div
echo '<div class="phpbb_forums_' . $cat_id . '_' . $forum_parent_id . '">';
$import_forums = phpbb_get_var('import_forums');
foreach ($forums as $forum) {
// Display forums
$Form->checkbox_input('phpbb_forums[]', !is_array($import_forums) || in_array($forum->forum_id, $import_forums), '', array('input_prefix' => '<label>', 'input_suffix' => ' ' . $forum->forum_name . '</label>', 'value' => $forum->forum_id, 'style' => 'margin-left:' . $phpbb_subforums_list_level * 20 . 'px'));
phpbb_subforums_list($Form, 0, $forum->forum_id);
}
echo '</div>';
$phpbb_subforums_list_level--;
}
示例10: SQL
/**
* Get status
*
* @return string Status
*/
function get_status()
{
global $DB;
if ($this->ID > 0) {
$SQL = new SQL('Get status of scheduled job');
$SQL->SELECT('clog_status');
$SQL->FROM('T_cron__log');
$SQL->WHERE('clog_ctsk_ID = ' . $DB->quote($this->ID));
$status = $DB->get_var($SQL->get());
}
if (empty($status)) {
// Set default status for new cron jobs and for cron jobs without log
$status = 'pending';
}
return $status;
}
示例11: ctry_td_enabled
*
* @copyright (c)2009-2015 by Francois Planque - {@link http://fplanque.com/}
* Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}.
*
* @package evocore
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
load_class('regional/model/_currency.class.php', 'Currency');
load_funcs('regional/model/_regional.funcs.php');
// Get params from request
$s = param('s', 'string', '', true);
// Create query
$SQL = new SQL();
$SQL->SELECT('ctry_ID, ctry_code, ctry_name, curr_shortcut, curr_code, ctry_enabled, ctry_preferred, ctry_status, ctry_block_count');
$SQL->FROM('T_regional__country');
$SQL->FROM_add('LEFT JOIN T_regional__currency ON ctry_curr_ID=curr_ID');
$SQL->ORDER_BY('*, ctry_code ASC');
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('CONCAT_WS( " ", ctry_code, ctry_name, curr_code ) LIKE "%' . $DB->escape($s) . '%"');
}
// Create result set:
$Results = new Results($SQL->get(), 'ctry_', '-D');
$Results->title = T_('Countries') . get_manual_link('regional-countries-tab');
/*
* STATUS TD:
*/
function ctry_td_enabled($ctry_enabled, $ctry_ID)
示例12: param
$Form->hidden_ctrl();
$Form->hidden('tab', 'perm');
$Form->hidden('blog', $edited_Blog->ID);
$Form->begin_fieldset(T_('User permissions') . get_manual_link('user_permissions'));
/*
* Query user list:
*/
if (get_param('action') == 'filter2') {
$keywords = param('keywords2', 'string', '', true);
set_param('keywords1', $keywords);
} else {
$keywords = param('keywords1', 'string', '', true);
set_param('keywords2', $keywords);
}
$SQL = new SQL();
$SQL->SELECT('user_ID, user_login, user_level, bloguser_perm_poststatuses + 0 as perm_poststatuses, bloguser_perm_edit, bloguser_ismember,' . 'bloguser_perm_delcmts, bloguser_perm_recycle_owncmts, bloguser_perm_vote_spam_cmts, bloguser_perm_cmtstatuses + 0 as perm_cmtstatuses, bloguser_perm_edit_cmt,' . 'bloguser_perm_delpost, bloguser_perm_edit_ts, bloguser_perm_cats,' . 'bloguser_perm_properties, bloguser_perm_admin, bloguser_perm_media_upload,' . 'bloguser_perm_media_browse, bloguser_perm_media_change, bloguser_perm_page,' . 'bloguser_perm_intro, bloguser_perm_podcast, bloguser_perm_sidebar');
$SQL->FROM('T_users LEFT JOIN T_coll_user_perms ON (
user_ID = bloguser_user_ID
AND bloguser_blog_ID = ' . $edited_Blog->ID . ' )');
$SQL->ORDER_BY('bloguser_ismember DESC, *, user_login, user_ID');
if (!empty($keywords)) {
$SQL->add_search_field('user_login');
$SQL->add_search_field('user_firstname');
$SQL->add_search_field('user_lastname');
$SQL->add_search_field('user_nickname');
$SQL->add_search_field('user_email');
$SQL->WHERE_keywords($keywords, 'AND');
}
// Display wide layout:
?>
示例13: upgrade_b2evo_tables
/**
* upgrade_b2evo_tables(-)
*
* @param string the action param value corresponding the current upgrade process ( evoupgrade, svn_upgrade, auto_upgrade )
*/
function upgrade_b2evo_tables($upgrade_action = 'evoupgrade')
{
global $db_config, $tableprefix;
global $baseurl, $old_db_version, $new_db_version;
global $Group_Admins, $Group_Privileged, $Group_Bloggers, $Group_Users;
global $locales, $locale;
global $DB;
global $admin_url;
global $Settings, $Plugins;
// used for defaults, when upgrading to 1.6
global $use_fileupload, $fileupload_allowedtypes, $fileupload_maxk, $doubleCheckReferers;
// new DB-delta functionality
global $schema_queries, $inc_path;
// used to check script time before starting to create db delta
global $script_start_time;
// Create an option which can be turned on if we need to regenerate the autogenerated excerpts in the end of the upgrade script
global $recreate_autogenerated_excerpts;
$recreate_autogenerated_excerpts = param('recreate_excerpts', 'boolean', 0);
// Load DB schema from modules
load_db_schema();
// Update the progress bar status
update_install_progress_bar();
load_funcs('_core/model/db/_upgrade.funcs.php');
// Force MySQL strict mode:
$DB->query('SET sql_mode = ""', 'REMOVE MySQL "strict" mode in order not to worry about missing defaults until the end of the upgrade.');
echo '<p>' . T_('Checking DB schema version...') . ' ';
$old_db_version = get_db_version();
if (empty($old_db_version)) {
echo '<p><strong>OOPS! b2evolution doesn\'t seem to be installed yet.</strong></p>';
return false;
}
echo $old_db_version, ' : ';
if ($old_db_version < 8000) {
debug_die(T_('This version is too old!'));
}
if ($old_db_version > $new_db_version) {
debug_die(T_('This version is too recent! We cannot downgrade to the version you are trying to install...'));
}
echo "OK.<br />\n";
if ($old_db_version < 8010) {
echo 'Upgrading users table... ';
$query = "ALTER TABLE T_users\n\t\t\t\t\t\t\tMODIFY COLUMN user_pass CHAR(32) NOT NULL";
$DB->query($query);
echo "OK.<br />\n";
echo 'Upgrading blogs table... ';
$query = "ALTER TABLE T_blogs\n\t\t\t\t\t\t\tMODIFY COLUMN blog_lang VARCHAR(20) NOT NULL DEFAULT 'en_US',\n\t\t\t\t\t\t\tMODIFY COLUMN blog_longdesc TEXT NULL DEFAULT NULL";
$DB->query($query);
echo "OK.<br />\n";
echo 'Upgrading categories table... ';
$query = "ALTER TABLE T_categories\n\t\t\t\t\t\t\tADD COLUMN cat_description VARCHAR(250) NULL DEFAULT NULL,\n\t\t\t\t\t\t\tADD COLUMN cat_longdesc TEXT NULL DEFAULT NULL,\n\t\t\t\t\t\t\tADD COLUMN cat_icon VARCHAR(30) NULL DEFAULT NULL";
$DB->query($query);
echo "OK.<br />\n";
echo 'Upgrading posts table... ';
$query = "ALTER TABLE {$tableprefix}posts\n\t\t\t\t\t\t\tMODIFY COLUMN post_lang VARCHAR(20) NOT NULL DEFAULT 'en_US',\n\t\t\t\t\t\t\tADD COLUMN post_urltitle VARCHAR(50) NULL DEFAULT NULL AFTER post_title,\n\t\t\t\t\t\t\tADD COLUMN post_url VARCHAR(250) NULL DEFAULT NULL AFTER post_urltitle,\n\t\t\t\t\t\t\tADD COLUMN post_comments ENUM('disabled', 'open', 'closed') NOT NULL DEFAULT 'open' AFTER post_wordcount";
$DB->query($query);
echo "OK.<br />\n";
echo 'Generating wordcounts... ';
load_funcs('items/model/_item.funcs.php');
$query = "SELECT ID, post_content FROM {$tableprefix}posts WHERE post_wordcount IS NULL";
$i = 0;
foreach ($DB->get_results($query, ARRAY_A) as $row) {
$query_update_wordcount = "UPDATE {$tableprefix}posts\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET post_wordcount = " . bpost_count_words($row['post_content']) . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE ID = " . $row['ID'];
$DB->query($query_update_wordcount);
$i++;
}
echo "OK. ({$i} rows updated)<br />\n";
set_upgrade_checkpoint('8010');
}
if ($old_db_version < 8020) {
echo 'Encoding passwords... ';
$query = "UPDATE T_users\n\t\t\t\t\t\t\tSET user_pass = MD5(user_pass)";
$DB->query($query);
echo "OK.<br />\n";
set_upgrade_checkpoint('8020');
}
if ($old_db_version < 8030) {
echo 'Deleting unecessary logs... ';
$query = "DELETE FROM T_hitlog\n\t\t\t\t\t\t\tWHERE hit_ignore = 'badchar'";
$DB->query($query);
echo "OK.<br />\n";
echo 'Updating blog urls... ';
$query = "SELECT blog_ID, blog_siteurl FROM T_blogs";
$i = 0;
foreach ($DB->get_results($query, ARRAY_A) as $row) {
$blog_ID = $row['blog_ID'];
$blog_siteurl = $row['blog_siteurl'];
// echo $blog_ID.':'.$blog_siteurl;
if (strpos($blog_siteurl . '/', $baseurl) !== 0) {
// If not found at position 0
echo ' <strong>WARNING: please check blog #', $blog_ID, ' manually.</strong><br /> ';
continue;
}
// crop off the baseurl:
$blog_siteurl = utf8_substr($blog_siteurl . '/', utf8_strlen($baseurl));
// echo ' -> ', $blog_siteurl,'<br />';
//.........这里部分代码省略.........
示例14: sprintf
// Load moderator users who would like to get notificaions
$UserCache =& get_UserCache();
$UserCache->clear(true);
$UserCache->load_by_sql($SQL);
$loaded_ids = $UserCache->get_ID_array();
if (empty($loaded_ids)) {
// 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);
示例15: die
* Parts of this file are copyright (c)2005 by Daniel HAHLER - {@link http://thequod.de/contact}.
*
* @license http://b2evolution.net/about/license.html GNU General Public License (GPL)
*
* @package admin
*
* {@internal Below is a list of authors who have contributed to design/coding of this file: }}
* @author efy-asimo: Attila Simo.
*
* @version $Id: _broken_posts.view.php 3328 2013-03-26 11:44:11Z yura $
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
$SQL = new SQL();
$SQL->SELECT('post_ID, post_title, post_main_cat_ID, post_canonical_slug_ID');
$SQL->FROM('T_items__item');
$SQL->WHERE('post_main_cat_ID NOT IN (SELECT cat_ID FROM T_categories )');
$Results = new Results($SQL->get(), 'broken_posts_');
$Results->title = T_('Broken items with no matching category');
$Results->global_icon(T_('Cancel!'), 'close', regenerate_url('action'));
$Results->cols[] = array('th' => T_('Item ID'), 'th_class' => 'shrinkwrap', 'td_class' => 'small center', 'order' => 'post_ID', 'td' => '$post_ID$');
$Results->cols[] = array('th' => T_('Title'), 'th_class' => 'nowrap', 'order' => 'post_title', 'td' => '$post_title$', 'td_class' => 'small');
$Results->cols[] = array('th' => T_('Main Cat ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_main_cat_ID', 'td' => '$post_main_cat_ID$', 'td_class' => 'small center');
$Results->cols[] = array('th' => T_('Canoncical Slug ID'), 'th_class' => 'shrinkwrap', 'order' => 'post_canonical_slug_ID', 'td' => '$post_canonical_slug_ID$', 'td_class' => 'small center');
$Results->display(array('page_url' => regenerate_url('blog,ctrl,action,results_' . $Results->param_prefix . 'page', 'action=' . param_action() . '&' . url_crumb('tools'))));
if ($current_User->check_perm('options', 'edit', true) && $Results->get_num_rows()) {
// display Delete link
$redirect_to = regenerate_url('action', 'action=del_broken_posts&' . url_crumb('tools'));
echo '<p>[<a href="' . $redirect_to . '">' . T_('Delete these posts') . '</a>]</p>';
}