$SQL->SELECT('*');
$SQL->FROM('T_antispam__iprange');
$count_SQL = new SQL();
$count_SQL->SELECT('SQL_NO_CACHE COUNT( aipr_ID )');
$count_SQL->FROM('T_antispam__iprange');
if (!empty($ip_address)) {
    // Filter by IP address
    $ip_address = ip2int($ip_address);
    $SQL->WHERE('aipr_IPv4start <= ' . $DB->quote($ip_address));
    $SQL->WHERE_and('aipr_IPv4end >= ' . $DB->quote($ip_address));
    $count_SQL->WHERE('aipr_IPv4start <= ' . $DB->quote($ip_address));
    $count_SQL->WHERE_and('aipr_IPv4end >= ' . $DB->quote($ip_address));
}
// Create result set:
$Results = new Results($SQL->get(), 'aipr_', 'A', $UserSettings->get('results_per_page'), $count_SQL->get());
$Results->title = T_('IP Ranges') . ' (' . $Results->get_total_rows() . ')' . get_manual_link('ip-ranges');
$Results->Cache = get_IPRangeCache();
/**
 * Callback to add filters on top of the result set
 *
 * @param Form
 */
function filter_email_blocked(&$Form)
{
    $Form->text_input('ip_address', get_param('ip_address'), 40, T_('IP address'));
}
$Results->filter_area = array('callback' => 'filter_email_blocked', 'presets' => array('all' => array(T_('All'), $admin_url . '?ctrl=antispam' . $tab_param . '&amp;tab3=ipranges')));
$Results->cols[] = array('th' => T_('ID'), 'td' => '$aipr_ID$', 'order' => 'aipr_ID', 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap');
$Results->cols[] = array('th' => T_('Status'), 'td' => $current_User->check_perm('spamblacklist', 'edit') ? '<a href="#" rel="$aipr_status$">%aipr_status_title( #aipr_status# )%</a>' : '%aipr_status_title( #aipr_status# )%', 'td_class' => 'iprange_status_edit', 'order' => 'aipr_status', 'extra' => array('style' => 'background-color: %aipr_status_color( "#aipr_status#" )%;', 'format_to_output' => false));
$Results->cols[] = array('th' => T_('IP Range Start'), 'td' => $current_User->check_perm('spamblacklist', 'edit') ? '<a href="' . $admin_url . '?ctrl=antispam&amp;tab3=ipranges&amp;iprange_ID=$aipr_ID$&amp;action=iprange_edit">%int2ip( #aipr_IPv4start# )%</a>' : '%int2ip( #aipr_IPv4start# )%', 'order' => 'aipr_IPv4start');
$Results->cols[] = array('th' => T_('IP Range End'), 'td' => $current_User->check_perm('spamblacklist', 'edit') ? '<a href="' . $admin_url . '?ctrl=antispam&amp;tab3=ipranges&amp;iprange_ID=$aipr_ID$&amp;action=iprange_edit">%int2ip( #aipr_IPv4end# )%</a>' : '%int2ip( #aipr_IPv4end# )%', 'order' => 'aipr_IPv4end');
Exemplo n.º 2
0
 *
 * @package admin
 */
if (!defined('EVO_MAIN_INIT')) {
    die('Please, do not access this page directly.');
}
global $current_User;
$current_User->check_perm('blogs', 'editall', true);
param_action('emptytrash', true);
$SQL = new SQL();
$SQL->SELECT('DISTINCT(blog_ID), blog_name, count(comment_ID) as comments_number');
// select target_title for sorting
$SQL->FROM('T_blogs LEFT OUTER JOIN T_categories ON blog_ID = cat_blog_ID');
$SQL->FROM_add('LEFT OUTER JOIN T_items__item ON cat_ID = post_main_cat_ID');
$SQL->FROM_add('LEFT OUTER JOIN T_comments ON post_ID = comment_item_ID');
$SQL->WHERE('comment_status = "trash"');
$SQL->GROUP_BY('blog_ID');
$count_SQL = new SQL();
$count_SQL->SELECT('COUNT( comment_ID )');
$count_SQL->FROM('T_comments');
$count_SQL->WHERE('comment_status = "trash"');
// Create result set:
$Results = new Results($SQL->get(), 'emptytrash_', '', NULL, $count_SQL->get());
$Results->title = T_('Comment recycle bins') . ' (' . $Results->get_total_rows() . ')';
$Results->cols[] = array('th' => T_('Blog ID'), 'th_class' => 'shrinkwrap', 'order' => 'blog_ID', 'td' => '$blog_ID$', 'td_class' => 'shrinkwrap');
$Results->cols[] = array('th' => T_('Blog name'), 'order' => 'blog_name', 'td' => '$blog_name$');
$Results->cols[] = array('th' => T_('Comments in recycle bin'), 'th_class' => 'shrinkwrap', 'order' => 'comments_number', 'td' => '$comments_number$', 'td_class' => 'shrinkwrap');
$Results->cols[] = array('th' => T_('Actions'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => action_icon(TS_('Empty blog\'s recycle bin'), 'recycle_empty', regenerate_url('action', 'blog_ID=$blog_ID$&amp;action=trash_delete') . '&amp;' . url_crumb('comment')));
$Results->global_icon(T_('Cancel empty recycle bin'), 'close', regenerate_url('action', 'action=list&filter=reset'), 3, 4);
echo '<p>[<a href="' . regenerate_url('action,blog_ID', 'action=trash_delete') . '&amp;' . url_crumb('comment') . '">' . T_('Empty all blogs\' recycle bin') . '</a>]</p>';
$Results->display();
Exemplo n.º 3
0
/**
 * Display blogs results table
 *
 * @param array Params
 */
function blogs_user_results_block($params = array())
{
    // Make sure we are not missing any param:
    $params = array_merge(array('edited_User' => NULL, 'results_param_prefix' => 'actv_blog_', 'results_title' => T_('Blogs owned by the user'), 'results_no_text' => T_('User does not own any blogs')), $params);
    if (!is_logged_in()) {
        // Only logged in users can access to this function
        return;
    }
    global $current_User;
    if (!$current_User->check_perm('users', 'moderate') || !$current_User->check_perm('blogs', 'view')) {
        // Check minimum permission:
        return;
    }
    $edited_User = $params['edited_User'];
    if (!$edited_User) {
        // No defined User, probably the function is calling from AJAX request
        $user_ID = param('user_ID', 'integer', 0);
        if (empty($user_ID)) {
            // Bad request, Exit here
            return;
        }
        $UserCache =& get_UserCache();
        if (($edited_User =& $UserCache->get_by_ID($user_ID, false)) === false) {
            // Bad request, Exit here
            return;
        }
    }
    global $DB, $AdminUI;
    param('user_tab', 'string', '', true);
    param('user_ID', 'integer', 0, true);
    $SQL = new SQL();
    $SQL->SELECT('*');
    $SQL->FROM('T_blogs');
    $SQL->WHERE('blog_owner_user_ID = ' . $DB->quote($edited_User->ID));
    // Create result set:
    $blogs_Results = new Results($SQL->get(), $params['results_param_prefix']);
    $blogs_Results->Cache =& get_BlogCache();
    $blogs_Results->title = $params['results_title'];
    $blogs_Results->no_results_text = $params['results_no_text'];
    // Get a count of the blogs which current user can delete
    $deleted_blogs_count = count($edited_User->get_deleted_blogs());
    if ($blogs_Results->get_total_rows() > 0 && $deleted_blogs_count > 0) {
        // Display action icon to delete all records if at least one record exists & user can delete at least one blog
        $blogs_Results->global_icon(sprintf(T_('Delete all blogs owned by %s'), $edited_User->login), 'delete', '?ctrl=user&amp;user_tab=activity&amp;action=delete_all_blogs&amp;user_ID=' . $edited_User->ID . '&amp;' . url_crumb('user'), ' ' . T_('Delete all'), 3, 4);
    }
    // Initialize Results object
    blogs_results($blogs_Results, array('display_type' => false, 'display_owner' => false, 'display_plist' => false, 'display_order' => false, 'display_caching' => false, 'display_fav' => false));
    if (is_ajax_content()) {
        // init results param by template name
        if (!isset($params['skin_type']) || !isset($params['skin_name'])) {
            debug_die('Invalid ajax results request!');
        }
        $blogs_Results->init_params_by_skin($params['skin_type'], $params['skin_name']);
    }
    $results_params = $AdminUI->get_template('Results');
    $display_params = array('before' => str_replace('>', ' style="margin-top:25px" id="owned_blogs_result">', $results_params['before']));
    $blogs_Results->display($display_params);
    if (!is_ajax_content()) {
        // Create this hidden div to get a function name for AJAX request
        echo '<div id="' . $params['results_param_prefix'] . 'ajax_callback" style="display:none">' . __FUNCTION__ . '</div>';
    }
}
Exemplo n.º 4
0
/**
 * Author:
 */
$Results->cols[] = array('th' => T_('Author'), 'th_class' => 'shrinkwrap', 'td_class' => 'center top', 'td' => '%col_msg_author( #msg_user_ID#, #msg_datetime#)%');
/**
 * Message:
 */
$Results->cols[] = array('th' => T_('Message'), 'td_class' => 'left top message_text', 'td' => '%col_msg_format_text( #msg_ID#, #msg_text# )%');
/**
 * Read?:
 */
$Results->cols[] = array('th' => T_('Read?'), 'th_class' => 'shrinkwrap', 'td_class' => 'top', 'td' => '%col_msg_read_by( #msg_ID# )%');
/**
 * Actions:
 */
if ($current_User->check_perm('perm_messaging', 'delete') && $Results->get_total_rows() > 1 && $action != 'preview') {
    // We have permission to modify and there are more than 1 message (otherwise it's better to delete the whole thread):
    $Results->cols[] = array('th' => T_('Del'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'td' => '%col_msg_actions( #msg_thread_ID#, #msg_ID#)%');
}
if ($is_recipient) {
    // Current user is involved in this thread, only involved users can send a message
    // we had to check this because admin user can see all messages in 'Abuse management', but should not be able to reply
    // get all available recipient in this thread
    $available_recipients = array();
    foreach ($recipient_list as $recipient_ID) {
        $recipient_User =& $UserCache->get_by_ID($recipient_ID, false);
        if ($recipient_ID != $current_User->ID && $recipient_User && !$recipient_User->check_status('is_closed') && empty($leave_status_list[$recipient_ID])) {
            $available_recipients[$recipient_ID] = $recipient_User->login;
        }
    }
    global $Messages;
Exemplo n.º 5
0
$Form->hidden('action', $creating ? 'create' : 'update');
$Form->hiddens_by_key(get_memorized('action' . ($creating ? ',tag_ID' : '')));
$Form->text_input('tag_name', $edited_ItemTag->get('name'), 50, T_('Tag'), '', array('maxlength' => 255, 'required' => true));
$Form->end_form(array(array('submit', 'submit', $creating ? T_('Record') : T_('Save Changes!'), 'SaveButton')));
// Item list with this tag:
if ($edited_ItemTag->ID > 0) {
    $SQL = new SQL();
    $SQL->SELECT('T_items__item.*, blog_shortname');
    $SQL->FROM('T_items__itemtag');
    $SQL->FROM_add('INNER JOIN T_items__item ON itag_itm_ID = post_ID');
    $SQL->FROM_add('INNER JOIN T_categories ON post_main_cat_ID = cat_ID');
    $SQL->FROM_add('INNER JOIN T_blogs ON cat_blog_ID = blog_ID');
    $SQL->WHERE('itag_tag_ID = ' . $DB->quote($edited_ItemTag->ID));
    // Create result set:
    $Results = new Results($SQL->get(), 'tagitem_', 'A');
    $Results->title = T_('Posts that have this tag') . ' (' . $Results->get_total_rows() . ')';
    $Results->Cache = get_ItemCache();
    $Results->cols[] = array('th' => T_('Post ID'), 'th_class' => 'shrinkwrap', 'td_class' => 'shrinkwrap', 'order' => 'post_ID', 'td' => '$post_ID$');
    $Results->cols[] = array('th' => T_('Collection'), 'order' => 'blog_shortname', 'td' => '$blog_shortname$');
    $Results->cols[] = array('th' => T_('Post title'), 'order' => 'post_title', 'td' => '<a href="@get_permanent_url()@">$post_title$</a>');
    function tagitem_edit_actions($Item)
    {
        global $current_User, $edited_ItemTag;
        // Display the edit icon if current user has the rights:
        $r = $Item->get_edit_link(array('before' => '', 'after' => ' ', 'text' => get_icon('edit'), 'title' => '#', 'class' => ''));
        if ($current_User->check_perm('item_post!CURSTATUS', 'edit', false, $Item)) {
            // Display the unlink icon if current user has the rights:
            $r .= action_icon(T_('Unlink this tag from post!'), 'unlink', regenerate_url('tag_ID,action,tag_filter', 'tag_ID=' . $edited_ItemTag->ID . '&amp;item_ID=' . $Item->ID . '&amp;action=unlink&amp;' . url_crumb('tag')), NULL, NULL, NULL, array('onclick' => 'return confirm(\'' . format_to_output(sprintf(TS_('Are you sure you want to remove the tag "%s" from "%s"?'), $edited_ItemTag->dget('name'), $Item->dget('title')) . '\');', 'htmlattr')));
        }
        return $r;
    }
Exemplo n.º 6
0
}
if ($filter_item_ID = get_param('tag_item_ID')) {
    // add filter for item ID
    if (is_number($filter_item_ID)) {
        $sql_item_left_join = 'LEFT JOIN T_items__itemtag AS it2 ON it2.itag_tag_ID = tag_ID';
        $sql_item_where = 'it2.itag_itm_ID = ' . $DB->quote($filter_item_ID);
        $SQL->FROM_add($sql_item_left_join);
        $SQL->WHERE_and($sql_item_where);
        $count_SQL->FROM_add($sql_item_left_join);
        $count_SQL->WHERE_and($sql_item_where);
        $list_is_filtered = true;
    }
}
// Create result set:
$Results = new Results($SQL->get(), 'tag_', 'A', NULL, $count_SQL->get());
$Results->title = T_('Tags') . ' (' . $Results->get_total_rows() . ')' . get_manual_link('item-tags-list');
$Results->Cache = get_ItemTagCache();
if ($list_is_filtered) {
    // List is filtered, offer option to reset filters:
    $Results->global_icon(T_('Reset all filters!'), 'reset_filters', $admin_url . '?ctrl=itemtags', T_('Reset filters'), 3, 3, array('class' => 'action_icon btn-warning'));
}
/**
 * Callback to add filters on top of the result set
 *
 * @param Form
 */
function filter_tags(&$Form)
{
    $Form->text_input('tag_filter', get_param('tag_filter'), 24, T_('Tag'), '', array('maxlength' => 50));
    $item_ID_filter_note = '';
    if ($filter_item_ID = get_param('tag_item_ID')) {
Exemplo n.º 7
0
}
if ($filter_type = get_param('slug_type')) {
    // add filter for post type
    $SQL->WHERE_and('slug_type = "' . $DB->escape(get_param('slug_ftype')) . '"');
    $list_is_filtered = true;
}
if ($filter_item_ID = get_param('slug_item_ID')) {
    // add filter for item ID
    if (is_number($filter_item_ID)) {
        $SQL->WHERE_and('slug_itm_ID = ' . $DB->quote($filter_item_ID));
        $list_is_filtered = true;
    }
}
// Create result set:
$Results = new Results($SQL->get(), 'slug_', 'A');
$Results->title = T_('Slugs') . ' (' . $Results->get_total_rows() . ')' . get_manual_link('slugs-list');
$Results->Cache = get_SlugCache();
if ($list_is_filtered) {
    // List is filtered, offer option to reset filters:
    $Results->global_icon(T_('Reset all filters!'), 'reset_filters', $admin_url . '?ctrl=slugs', T_('Reset filters'), 3, 3, array('class' => 'action_icon btn-warning'));
}
/**
 * Callback to add filters on top of the result set
 *
 * @param Form
 */
function filter_slugs(&$Form)
{
    $Form->text_input('slug_filter', get_param('slug_filter'), 24, T_('Slug'), '', array('maxlength' => 253));
    $item_ID_filter_note = '';
    if ($filter_item_ID = get_param('slug_item_ID')) {