示例#1
0
 function main($action)
 {
     global $db, $config, $template, $lang, $user;
     global $pafiledb_config, $pafiledb_functions;
     $start = request_var('start', 0);
     $start = $start < 0 ? 0 : $start;
     $sort_method = request_var('sort_method', $pafiledb_config['sort_method']);
     $sort_method = check_var_value($sort_method, array('file_name', 'file_time', 'file_dls', 'file_rating', 'file_update_time'));
     $sort_method = $sort_method == 'file_rating' ? 'rating' : $sort_method;
     $sort_order = request_var('order', $pafiledb_config['sort_order']);
     $sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
     if (!$pafiledb_config['settings_viewall']) {
         message_die(GENERAL_MESSAGE, $lang['viewall_disabled']);
     } elseif (!$this->auth_global['auth_viewall']) {
         if (!$user->data['session_logged_in']) {
             redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=viewall', true));
         }
         $message = sprintf($lang['Sorry_auth_viewall'], $this->auth_global['auth_viewall_type']);
         message_die(GENERAL_MESSAGE, $message);
     }
     $template->assign_vars(array('L_VIEWALL' => $lang['Viewall'], 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD' => append_sid('dload.' . PHP_EXT), 'DOWNLOAD' => $pafiledb_config['settings_dbname']));
     $this->display_files($sort_method, $sort_order, $start, true);
     $this->display($lang['Download'], 'pa_viewall_body.tpl');
 }
if ($date <= 0) {
    $date = cal_date(time(), $config['board_timezone']);
}
// date per jumpbox
$start_month = intval($_POST['start_month']);
$start_year = intval($_POST['start_year']);
if (!empty($start_month) && !empty($start_year)) {
    $day = 01;
    if (!empty($date)) {
        $day = gmdate('d', $date);
    }
    $date = gmmktime(0, 0, 0, $start_month, $day, $start_year);
}
// mode
$mode = request_var('mode', '', true);
$mode = check_var_value($mode, array('hour'));
// start
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
// get the period
$year = gmdate('Y', $date);
$month = gmdate('m', $date);
$day = gmdate('d', $date);
$hour = gmdate('H', $date);
$min = gmdate('i', $date);
if ($mode == 'hour') {
    $start_date = gmmktime($hour, 0, 0, $month, $day, $year);
    $end_date = gmmktime($hour + 1, 0, 0, $month, $day, $year);
} else {
    $start_date = gmmktime(0, 0, 0, $month, $day, $year);
    $end_date = gmmktime(0, 0, 0, $month, $day + 1, $year);
示例#3
0
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
if (!$config['allow_drafts']) {
    message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
}
$mode = request_var('mode', '', true);
$mode = check_var_value($mode, array('loadr', 'loadn', 'loadp', 'delete'), '');
if (!empty($_POST['kill_drafts'])) {
    $mode = 'delete';
}
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
if (!$user->data['session_logged_in']) {
    $redirect = isset($start) ? '&start=' . $start : '';
    redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=drafts.' . PHP_EXT . $redirect, true));
}
$draft_id = request_var('d', 0);
$draft_id = $draft_id < 0 ? 0 : $draft_id;
if ($draft_id > 0 || !empty($_POST['kill_drafts'])) {
    if ($mode == 'loadr') {
        redirect(append_sid(CMS_PAGE_POSTING . '?d=' . $draft_id . '&mode=reply' . '&draft_mode=draft_load', true));
    } elseif ($mode == 'loadn') {
示例#4
0
			$mode = $set_mode;
		}
		else
		{
			$username = htmlspecialchars($target_userdata['username']);
		}
	}
	else
	{
		$mode = $set_mode;
	}
}

$psort_types = array('time', 'cat');
$psort = request_var('psort', $psort_types[0]);
$psort = check_var_value($psort, $psort_types);

$nav_server_url = create_server_url();
$breadcrumbs['address'] = $lang['Nav_Separator'] . '<a href="' . $nav_server_url . append_sid('recent.' . PHP_EXT) . '" class="nav-current">' . $lang['Recent_topics'] . '</a>';

$except_forums = build_exclusion_forums_list();

$where_forums = ($special_forums == '0') ? 't.forum_id NOT IN (' . $except_forums . ')' : 't.forum_id NOT IN (' . $except_forums . ') AND t.forum_id IN (' . $forum_ids . ')';
$sql_sort = ' ORDER BY t.topic_last_post_id DESC ';
if ($psort == 'cat')
{
	$sql_sort = ' ORDER BY f.forum_id ASC, t.topic_last_post_id DESC ';
}

$extra_tables = '';
$extra_fields = '';
示例#5
0
$topic_days = request_var('search_time', 0);
if (!empty($topic_days))
{
	$search_time = time() - ($topic_days * 86400);
}
else
{
	$search_time = 0;
	$topic_days = 0;
}

$search_date = request_var('d', 0);

$show_results = request_var('show_results', 'posts');
$show_results = check_var_value($show_results, array('posts', 'topics'));

// $sr is used to allow users to override the default result displaying for new posts
$sr_cn = $config['cookie_name'] . '_sr';
if(isset($_GET['sr']))
{
	$sr_get = (isset($_GET['sr']) && ($_GET['sr'] == 't')) ? 't' : 'p';
	$user->set_cookie('sr', $sr_get, $user->cookie_expire);
	$_COOKIE[$sr_cn] = $sr_get;
}

$sr_cookie = (isset($_COOKIE[$sr_cn]) && ($_COOKIE[$sr_cn] == 't')) ? 't' : 'p';
$sr = $sr_cookie;

$return_chars = request_var('return_chars', 200);
$return_chars = ($return_chars >= -1) ? $return_chars : 200;
示例#6
0
 function main($action)
 {
     global $template, $lang, $pafiledb_config, $user, $config;
     // =======================================================
     // Get the id
     // =======================================================
     $cat_id = request_var('cat_id', 0);
     $file_id = request_var('file_id', 0);
     $action = request_var('action', '');
     if (!empty($cat_id)) {
         $cat_id = $cat_id;
     } elseif ($file_id == 0 && $action != '') {
         $cat_id_array = array();
         $cat_id_array = explode('=', $action);
         $cat_id = $cat_id_array[1];
     } else {
         message_die(GENERAL_MESSAGE, $lang['Cat_not_exist']);
     }
     $start = request_var('start', 0);
     $start = $start < 0 ? 0 : $start;
     $sort_method = request_var('sort_method', $pafiledb_config['sort_method']);
     $sort_method = check_var_value($sort_method, array('file_name', 'file_time', 'file_dls', 'file_rating', 'file_update_time'));
     $sort_method = $sort_method == 'file_rating' ? 'rating' : $sort_method;
     $sort_order = request_var('order', $pafiledb_config['sort_order']);
     $sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
     // =======================================================
     // If user not allowed to view file listing (read) and there is no sub Category
     // or the user is not allowed to view these category we gave him a nice message.
     // =======================================================
     $show_category = false;
     if (isset($this->subcat_rowset[$cat_id])) {
         foreach ($this->subcat_rowset[$cat_id] as $sub_cat_id => $sub_cat_row) {
             if ($this->auth[$sub_cat_id]['auth_view']) {
                 $show_category = true;
                 break;
             }
         }
     }
     if (!$this->auth[$cat_id]['auth_read'] && !$show_category) {
         if (!$user->data['session_logged_in']) {
             redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=category&cat_id=' . $cat_id, true));
         }
         $message = sprintf($lang['Sorry_auth_view'], $this->auth[$cat_id]['auth_read_type']);
         message_die(GENERAL_MESSAGE, $message);
     }
     if (!isset($this->cat_rowset[$cat_id])) {
         message_die(GENERAL_MESSAGE, $lang['Cat_not_exist']);
     }
     //===================================================
     // assign var for naviagation
     //===================================================
     $this->generate_category_nav($cat_id);
     $template->assign_vars(array('L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD' => append_sid('dload.' . PHP_EXT), 'DOWNLOAD' => $pafiledb_config['settings_dbname']));
     $no_file_message = true;
     $filelist = false;
     if (isset($this->subcat_rowset[$cat_id])) {
         $no_file_message = false;
         $this->category_display($cat_id);
     }
     $this->display_files($sort_method, $sort_order, $start, $no_file_message, $cat_id);
     $this->display($lang['Download'], 'pa_category_body.tpl');
 }
示例#7
0
    // --------------------------------
    $allowed_cat .= $allowed_cat == '' ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id'];
}
//
// END of Categories Index
//
// ------------------------------------
// Build the sort method and sort order
// information
// ------------------------------------
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
$sort_method = request_var('sort_method', $album_config['sort_method']);
$sort_method = check_var_value($sort_method, array('pic_time', 'pic_title', 'username', 'pic_view_count', 'rating', 'comments', 'new_comment'));
$sort_order = request_var('sort_order', $album_config['sort_order']);
$sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
$sort_append = '&amp;sort_method=' . $sort_method . '&amp;sort_order=' . $sort_order;
// ------------------------------------
// additional sorting options
// ------------------------------------
if ($album_user_id != ALBUM_PUBLIC_GALLERY) {
    $sort_rating_option = '';
    $sort_comments_option = '';
    $sort_new_comment_option = '';
    if ($album_config['rate'] == 1) {
        $sort_rating_option = '<option value="rating" ';
        $sort_rating_option .= $sort_method == 'rating' ? 'selected="selected"' : '';
        $sort_rating_option .= '>' . $lang['Rating'] . '</option>';
    }
    if ($album_config['comment'] == 1) {
        $sort_comments_option = '<option value="comments" ';
示例#8
0
 function main($action)
 {
     global $template, $lang, $config, $pafiledb_config, $db, $images, $user;
     if (!$this->auth_global['auth_search']) {
         if (!$user->data['session_logged_in']) {
             redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=stats', true));
         }
         $message = sprintf($lang['Sorry_auth_search'], $this->auth_global['auth_search_type']);
         message_die(GENERAL_MESSAGE, $message);
     }
     include IP_ROOT_PATH . 'includes/functions_search.' . PHP_EXT;
     $search_keywords = request_var('search_keywords', '', true);
     $search_keywords = htmlspecialchars_decode($search_keywords, ENT_COMPAT);
     $search_author = request_var('search_author', '', true);
     $search_author = htmlspecialchars_decode($search_author, ENT_COMPAT);
     $search_id = request_var('search_id', 0);
     $search_terms = request_var('search_terms', '');
     $search_terms = $search_terms == 'all' ? 1 : 0;
     $cat_id = request_var('cat_id', 0);
     $comments_search = request_var('comments_search', '');
     $comments_search = $comments_search == 'YES' ? 1 : 0;
     $start = request_var('start', 0);
     $start = $start < 0 ? 0 : $start;
     $sort_method = request_var('sort_method', $pafiledb_config['sort_method']);
     $sort_method = check_var_value($sort_method, array('file_name', 'file_time', 'file_dls', 'file_rating', 'file_update_time'));
     $sort_method = $sort_method == 'file_rating' ? 'rating' : $sort_method;
     $sort_order = request_var('order', $pafiledb_config['sort_order']);
     $sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
     $limit_sql = $start == 0 ? $pafiledb_config['settings_file_page'] : $start . ',' . $pafiledb_config['settings_file_page'];
     // encoding match for workaround
     $multibyte_charset = 'utf-8, big5, shift_jis, euc-kr, gb2312';
     if (isset($_POST['submit']) || $search_author != '' || $search_keywords != '' || $search_id) {
         $store_vars = array('search_results', 'total_match_count', 'split_search', 'sort_method', 'sort_order');
         if ($search_author != '' || $search_keywords != '') {
             if ($search_author != '' && $search_keywords == '') {
                 $search_author = str_replace('*', '%', trim($search_author));
                 $sql = get_users_sql($search_author, true, false, true, false);
                 $result = $db->sql_query($sql);
                 $matching_userids = '';
                 if ($row = $db->sql_fetchrow($result)) {
                     do {
                         $matching_userids .= ($matching_userids != '' ? ', ' : '') . $row['user_id'];
                     } while ($row = $db->sql_fetchrow($result));
                 } else {
                     message_die(GENERAL_MESSAGE, $lang['No_search_match']);
                 }
                 $sql = "SELECT *\n\t\t\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\t\t\tWHERE user_id IN ({$matching_userids})";
                 $result = $db->sql_query($sql);
                 $search_ids = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     if ($this->auth[$row['file_catid']]['auth_view']) {
                         $search_ids[] = $row['file_id'];
                     }
                 }
                 $db->sql_freeresult($result);
                 $total_match_count = sizeof($search_ids);
             } elseif ($search_keywords != '') {
                 stopwords_synonyms_init();
                 $split_search = array();
                 $split_search = !strstr($multibyte_charset, $lang['ENCODING']) ? split_words(clean_words('search', stripslashes($search_keywords), $stopwords_array, $synonyms_array), 'search') : split(' ', $search_keywords);
                 $word_count = 0;
                 $current_match_type = 'or';
                 $word_match = array();
                 $result_list = array();
                 for ($i = 0; $i < sizeof($split_search); $i++) {
                     switch ($split_search[$i]) {
                         case 'and':
                             $current_match_type = 'and';
                             break;
                         case 'or':
                             $current_match_type = 'or';
                             break;
                         case 'not':
                             $current_match_type = 'not';
                             break;
                         default:
                             if (!empty($search_terms)) {
                                 $current_match_type = 'and';
                             }
                             $match_word = addslashes('%' . str_replace('*', '', $split_search[$i]) . '%');
                             $sql = "SELECT file_id\n\t\t\t\t\t\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE (file_name LIKE '{$match_word}'\n\t\t\t\t\t\t\t\t\tOR file_creator LIKE '{$match_word}'\n\t\t\t\t\t\t\t\t\tOR file_desc LIKE '{$match_word}'\n\t\t\t\t\t\t\t\t\tOR file_longdesc LIKE '{$match_word}')";
                             $result = $db->sql_query($sql);
                             $row = array();
                             while ($temp_row = $db->sql_fetchrow($result)) {
                                 $row[$temp_row['file_id']] = 1;
                                 if (!$word_count) {
                                     $result_list[$temp_row['file_id']] = 1;
                                 } elseif ($current_match_type == 'or') {
                                     $result_list[$temp_row['file_id']] = 1;
                                 } elseif ($current_match_type == 'not') {
                                     $result_list[$temp_row['file_id']] = 0;
                                 }
                             }
                             if ($current_match_type == 'and' && $word_count) {
                                 @reset($result_list);
                                 while (list($file_id, $match_count) = @each($result_list)) {
                                     if (!$row[$file_id]) {
                                         $result_list[$file_id] = 0;
                                     }
                                 }
                             }
                             if ($comments_search) {
                                 $sql = "SELECT file_id\n\t\t\t\t\t\t\t\t\tFROM " . PA_COMMENTS_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE (comments_title LIKE '{$match_word}'\n\t\t\t\t\t\t\t\t\tOR comments_text LIKE '{$match_word}')";
                                 $result = $db->sql_query($sql);
                                 $row = array();
                                 while ($temp_row = $db->sql_fetchrow($result)) {
                                     $row[$temp_row['file_id']] = 1;
                                     if (!$word_count) {
                                         $result_list[$temp_row['file_id']] = 1;
                                     } else {
                                         if ($current_match_type == 'or') {
                                             $result_list[$temp_row['file_id']] = 1;
                                         } else {
                                             if ($current_match_type == 'not') {
                                                 $result_list[$temp_row['file_id']] = 0;
                                             }
                                         }
                                     }
                                 }
                                 if ($current_match_type == 'and' && $word_count) {
                                     @reset($result_list);
                                     while (list($file_id, $match_count) = @each($result_list)) {
                                         if (!$row[$file_id]) {
                                             $result_list[$file_id] = 0;
                                         }
                                     }
                                 }
                             }
                             $word_count++;
                             $db->sql_freeresult($result);
                     }
                 }
                 @reset($result_list);
                 $search_ids = array();
                 while (list($file_id, $matches) = each($result_list)) {
                     if ($matches) {
                         $search_ids[] = $file_id;
                     }
                 }
                 unset($result_list);
                 $total_match_count = sizeof($search_ids);
             }
             // Author name search
             if ($search_author != '') {
                 $search_author = str_replace('*', '%', trim($db->sql_escape($search_author)));
             }
             if ($total_match_count) {
                 $where_sql = $cat_id ? 'AND file_catid IN (' . $this->gen_cat_ids($cat_id, '') . ')' : '';
                 if ($search_author == '') {
                     $sql = "SELECT file_id, file_catid\n\t\t\t\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\t\t\t\tWHERE file_id IN (" . implode(", ", $search_ids) . ")\n\t\t\t\t\t\t\t\t{$where_sql}\n\t\t\t\t\t\t\tGROUP BY file_id";
                 } else {
                     $from_sql = PA_FILES_TABLE . " f";
                     if ($search_author != '') {
                         $from_sql .= ", " . USERS_TABLE . " u";
                         $where_sql .= " AND u.user_id = f.user_id AND u.username LIKE '{$search_author}' ";
                     }
                     $where_sql .= $cat_id ? 'AND file_catid IN (' . $this->gen_cat_ids($cat_id, '') . ')' : '';
                     $sql = "SELECT f.file_id, f.file_catid\n\t\t\t\t\t\t\tFROM {$from_sql}\n\t\t\t\t\t\t\tWHERE f.file_id IN (" . implode(", ", $search_ids) . ")\n\t\t\t\t\t\t\t{$where_sql}\n\t\t\t\t\t\t\tGROUP BY f.file_id";
                 }
                 $result = $db->sql_query($sql);
                 $search_ids = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     if ($this->auth[$row['file_catid']]['auth_view']) {
                         $search_ids[] = $row['file_id'];
                     }
                 }
                 $db->sql_freeresult($result);
                 $total_match_count = sizeof($search_ids);
             } else {
                 message_die(GENERAL_MESSAGE, $lang['No_search_match']);
             }
             //
             // Finish building query (for all combinations)
             // and run it ...
             //
             $expiry_time = $current_time - $config['session_length'];
             $sql = "SELECT session_id\n\t\t\t\t\tFROM " . SESSIONS_TABLE . "\n\t\t\t\t\tWHERE session_time > {$expiry_time}";
             $db->sql_return_on_error(true);
             $result = $db->sql_query($sql);
             $db->sql_return_on_error(false);
             if ($result) {
                 $delete_search_ids = array();
                 while ($row = $db->sql_fetchrow($result)) {
                     $delete_search_ids[] = "'" . $row['session_id'] . "'";
                 }
                 if (sizeof($delete_search_ids)) {
                     $sql = "DELETE FROM " . SEARCH_TABLE . "\n\t\t\t\t\t\t\tWHERE session_id NOT IN (" . implode(", ", $delete_search_ids) . ")";
                     $result = $db->sql_query($sql);
                 }
             }
             // Store new result data
             $search_results = implode(', ', $search_ids);
             $store_search_data = array();
             for ($i = 0; $i < sizeof($store_vars); $i++) {
                 $store_search_data[$store_vars[$i]] = ${$store_vars}[$i];
             }
             $result_array = serialize($store_search_data);
             unset($store_search_data);
             mt_srand((double) microtime() * 1000000);
             $search_id = mt_rand();
             $sql = "UPDATE " . SEARCH_TABLE . "\n\t\t\t\t\tSET search_id = {$search_id}, search_array = '" . $db->sql_escape($result_array) . "'\n\t\t\t\t\tWHERE session_id = '" . $user->data['session_id'] . "'";
             $db->sql_return_on_error(true);
             $result = $db->sql_query($sql);
             $db->sql_return_on_error(false);
             if (!$result || !$db->sql_affectedrows()) {
                 $sql = "INSERT INTO " . SEARCH_TABLE . " (search_id, session_id, search_array)\n\t\t\t\t\t\tVALUES({$search_id}, '" . $user->data['session_id'] . "', '" . $db->sql_escape($result_array) . "')";
                 $result = $db->sql_query($sql);
             }
         } else {
             $search_id = intval($search_id);
             if ($search_id) {
                 $sql = "SELECT search_array\n\t\t\t\t\t\tFROM " . SEARCH_TABLE . "\n\t\t\t\t\t\tWHERE search_id = {$search_id}\n\t\t\t\t\t\tAND session_id = '" . $user->data['session_id'] . "'";
                 $result = $db->sql_query($sql);
                 if ($row = $db->sql_fetchrow($result)) {
                     $search_data = unserialize($row['search_array']);
                     for ($i = 0; $i < sizeof($store_vars); $i++) {
                         ${$store_vars}[$i] = $search_data[$store_vars[$i]];
                     }
                 }
             }
         }
         if ($search_results != '') {
             $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, u.user_active, u.user_color, c.cat_id, c.cat_name, COUNT(cm.comments_id) AS total_comments\n\t\t\t\t\tFROM (" . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c)\n\t\t\t\t\t\tLEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file\n\t\t\t\t\t\tLEFT JOIN " . USERS_TABLE . " AS u ON f1.user_id = u.user_id\n\t\t\t\t\t\tLEFT JOIN " . PA_COMMENTS_TABLE . " AS cm ON f1.file_id = cm.file_id\n\t\t\t\t\tWHERE f1.file_id IN ({$search_results})\n\t\t\t\t\tAND c.cat_id = f1.file_catid\n\t\t\t\t\tAND f1.file_approved = '1'\n\t\t\t\t\tGROUP BY f1.file_id\n\t\t\t\t\tORDER BY {$sort_method} {$sort_order}\n\t\t\t\t\tLIMIT {$limit_sql}";
             $result = $db->sql_query($sql);
             $searchset = array();
             while ($row = $db->sql_fetchrow($result)) {
                 $searchset[] = $row;
             }
             $db->sql_freeresult($result);
             $l_search_matches = $total_match_count == 1 ? sprintf($lang['Found_search_match'], $total_match_count) : sprintf($lang['Found_search_matches'], $total_match_count);
             $template->assign_vars(array('L_SEARCH_MATCHES' => $l_search_matches));
             for ($i = 0; $i < sizeof($searchset); $i++) {
                 $cat_url = append_sid('dload.' . PHP_EXT . '?action=category&amp;cat_id=' . $searchset[$i]['cat_id']);
                 $file_url = append_sid('dload.' . PHP_EXT . '?action=file&amp;file_id=' . $searchset[$i]['file_id']);
                 //===================================================
                 // Format the date for the given file
                 //===================================================
                 $date = create_date_ip($config['default_dateformat'], $searchset[$i]['file_time'], $config['board_timezone']);
                 //===================================================
                 // Get rating for the file and format it
                 //===================================================
                 //$rating = ($searchset[$i]['rating'] != 0) ? round($searchset[$i]['rating'], 2) . ' / 10' : $lang['Not_rated'];
                 //$rating2 = ($searchset[$i]['rating'] != 0) ? sprintf("%.1f", round(($searchset[$i]['rating']), 2) / 2) : '0.0';
                 $rating2 = $searchset[$i]['rating'] != 0 ? sprintf("%.1f", round($searchset[$i]['rating'], 0) / 2) : '0.0';
                 //===================================================
                 // If the file is new then put a new image in front of it
                 //===================================================
                 $is_new = false;
                 if (time() - $pafiledb_config['settings_newdays'] * 24 * 60 * 60 < $searchset[$i]['file_time']) {
                     $is_new = true;
                 }
                 $xs_new = $is_new ? '-new' : '';
                 //===================================================
                 // Get the post icon fot this file
                 //===================================================
                 if ($searchset[$i]['file_pin'] != FILE_PINNED) {
                     if ($searchset[$i]['file_posticon'] == 'none' || $searchset[$i]['file_posticon'] == 'none.gif') {
                         $posticon = '<img src="' . IP_ROOT_PATH . FILES_ICONS_DIR . 'default.png" alt="" />';
                         //$posticon = '&nbsp;';
                     } else {
                         $posticon = '<img src="' . FILES_ICONS_DIR . $searchset[$i]['file_posticon'] . '" alt="" />';
                     }
                 } else {
                     $posticon = '<img src="' . $images['forum_link'] . '" alt="" />';
                 }
                 $poster = $searchset[$i]['user_id'] == ANONYMOUS ? $lang['Guest'] : colorize_username($searchset[$i]['user_id'], $searchset[$i]['username'], $searchset[$i]['user_color'], $searchset[$i]['user_active']);
                 $template->assign_block_vars('searchresults', array('CAT_NAME' => $searchset[$i]['cat_name'], 'FILE_NEW_IMAGE' => $images['pa_file_new'], 'PIN_IMAGE' => $posticon, 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'XS_NEW' => $xs_new, 'IS_NEW_FILE' => $is_new, 'FILE_NAME' => $searchset[$i]['file_name'], 'FILE_DESC' => $searchset[$i]['file_desc'], 'FILE_SUBMITER' => $poster, 'DATE' => $date, 'RATING' => $rating2, 'DOWNLOADS' => $searchset[$i]['file_dls'], 'U_FILE' => $file_url, 'U_CAT' => $cat_url));
             }
             $base_url = append_sid('dload.' . PHP_EXT . '?action=search&amp;search_id=' . $search_id);
             $template->assign_vars(array('PAGINATION' => generate_pagination($base_url, $total_match_count, $pafiledb_config['settings_file_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $pafiledb_config['settings_file_page']) + 1, ceil($total_match_count / $pafiledb_config['settings_file_page'])), 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'L_HOME' => $lang['Home'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD' => append_sid('dload.' . PHP_EXT), 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'XS_NEW' => $xs_new, 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_RATE' => $lang['DlRating'], 'L_DOWNLOADS' => $lang['Dls'], 'L_DATE' => $lang['Date'], 'L_NAME' => $lang['Name'], 'L_FILE' => $lang['File'], 'L_SUBMITER' => $lang['Submiter'], 'L_CATEGORY' => $lang['Category'], 'L_NEW_FILE' => $lang['New_file']));
             $this->display($lang['Download'], 'pa_search_result.tpl');
         } else {
             message_die(GENERAL_MESSAGE, $lang['No_search_match']);
         }
     }
     if (!isset($_POST['submit']) || $search_author == '' && $search_keywords == '' && !$search_id) {
         $dropmenu = $this->jumpmenu_option();
         $template->assign_vars(array('S_SEARCH_ACTION' => append_sid('dload.php'), 'S_CAT_MENU' => $dropmenu, 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD' => append_sid('dload.' . PHP_EXT), 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'XS_NEW' => $xs_new, 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'L_SEARCH_OPTIONS' => $lang['Search_options'], 'L_SEARCH_KEYWORDS' => $lang['Search_keywords'], 'L_SEARCH_KEYWORDS_EXPLAIN' => $lang['Search_keywords_explain'], 'L_SEARCH_AUTHOR' => $lang['Search_author'], 'L_SEARCH_AUTHOR_EXPLAIN' => $lang['Search_author_explain'], 'L_SEARCH_ANY_TERMS' => $lang['Search_for_any'], 'L_SEARCH_ALL_TERMS' => $lang['Search_for_all'], 'L_INCLUDE_COMMENTS' => $lang['Include_comments'], 'L_SORT_BY' => $lang['Select_sort_method'], 'L_SORT_DIR' => $lang['Order'], 'L_SORT_ASCENDING' => $lang['Sort_Ascending'], 'L_SORT_DESCENDING' => $lang['Sort_Descending'], 'L_INDEX' => sprintf($lang['Forum_Index'], $config['sitename']), 'L_RATING' => $lang['DlRating'], 'L_DOWNLOADS' => $lang['Dls'], 'L_DATE' => $lang['Date'], 'L_NAME' => $lang['Name'], 'L_UPDATE_TIME' => $lang['Update_time'], 'L_SEARCH' => $lang['Search'], 'L_SEARCH_FOR' => $lang['Search_for'], 'L_ALL' => $lang['All'], 'L_CHOOSE_CAT' => $lang['Choose_cat']));
         $this->display($lang['Download'], 'pa_search_body.tpl');
     }
 }
// GROUP BY - END
// SORT ORDER - BEGIN
$sort_order_select_lang_array = array($lang['REFERER_HITS'], $lang['REFERER_HOST'], $lang['REFERER_URL'], $lang['REFERER_T_URL'], $lang['REFERER_IP'], $lang['REFERER_FIRST'], $lang['REFERER_LAST']);
$sort_order_select_array = array('hits', 'host', 'url', 't_url', 'ip', 'first_visit', 'last_visit');
$mode = request_var('mode', $sort_order_select_array[0]);
$mode = in_array($mode, $sort_order_select_array) ? $mode : $sort_order_select_array[0];
$select_name = 'mode';
$default = $mode;
$select_js = '';
$sort_order_select_box = $class_form->build_select_box($select_name, $default, $sort_order_select_array, $sort_order_select_lang_array, $select_js);
// SORT ORDER - END
// SORT DIR - BEGIN
$sort_dir_select_array = array('ASC', 'DESC');
$sort_dir_select_lang_array = array($lang['Sort_Ascending'], $lang['Sort_Descending']);
$sort_dir = request_var('order', 'DESC');
$sort_dir = check_var_value($sort_dir, array('DESC', 'ASC'));
$select_name = 'order';
$default = $sort_dir == 'ASC' ? 'ASC' : 'DESC';
$select_js = '';
$sort_dir_select_box = $class_form->build_select_box($select_name, $default, $sort_dir_select_array, $sort_dir_select_lang_array, $select_js);
// SORT DIR - END
$smart_delete_fields_array = array('host' => 'host', 'url' => 'url', 't_url' => 't_url', 'ip' => 'ip');
$smart_delete_field = isset($smart_delete_fields_array[$smart_delete]) ? $smart_delete_fields_array[$smart_delete] : $smart_delete_fields_array[0];
$modes_array = array('hits' => 'hits', 'host' => 'host', 'url' => 'url', 't_url' => 't_url', 'ip' => 'ip', 'first_visit' => 'firstvisit', 'last_visit' => 'lastvisit');
$order_by = isset($modes_array[$mode]) ? $modes_array[$mode] : $modes_array[0];
if (isset($_POST['clear'])) {
    $sql = "DELETE FROM " . REFERERS_TABLE;
    $db->sql_query($sql);
    $message = $lang['REFERERS_CLEARED'] . '<br /><br />' . sprintf($lang['CLICK_RETURN_REFERERS'], '<a href="' . append_sid('admin_referers.' . PHP_EXT) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid('index.' . PHP_EXT . '?pane=right') . '">', '</a>');
    message_die(GENERAL_MESSAGE, $message);
}
示例#10
0
		$preview = true;
	}
}

$search_type = request_var('searchvar', '');
$search_value = request_var('searchvalue', '');
$search_value_tmp = request_var('searchvalue2', '');
$search_value = (!empty($search_value) && !empty($search_value_tmp)) ? $search_value_tmp : $search_value;

$refresh = $preview || $submit_search || ($draft && !$draft_confirm);

$mark_list = request_var('mark', array(0));

$folders_array = array('inbox', 'outbox', 'sentbox', 'savebox');
$folder = request_var('folder', 'inbox');
$folder = check_var_value($folder, $folders_array);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management

// Cancel
if ($cancel)
{
	redirect(append_sid(CMS_PAGE_PRIVMSG . '?folder=' . $folder, true));
}

// Check search fields
$search_list = array(
示例#11
0
}
// END permissions
/*
+----------------------------------------------------------
| Main work here...
+----------------------------------------------------------
*/
if (empty($mode)) {
    // --------------------------------
    // Moderator Control Panel
    // --------------------------------
    // Set Variables
    $start = request_var('start', 0);
    $start = $start < 0 ? 0 : $start;
    $sort_method = request_var('sort_method', 'pic_time');
    $sort_method = check_var_value($sort_method, array('pic_time', 'pic_title', 'pic_user_id', 'pic_view_count', 'rating', 'comments', 'new_comment'));
    $sort_order = request_var('order', 'ASC');
    $sort_order = $sort_order == 'ASC' ? 'ASC' : 'DESC';
    // Count Pics
    $sql = "SELECT COUNT(pic_id) AS count\n\t\t\tFROM " . ALBUM_TABLE . "\n\t\t\tWHERE pic_cat_id = '{$cat_id}'";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $total_pics = $row['count'];
    $pics_per_page = $config['topics_per_page'];
    // Text list only
    // get information from DB
    if ($total_pics > 0) {
        $limit_sql = $start == 0 ? $pics_per_page : $start . ', ' . $pics_per_page;
        // Old Approval
        /*
        $pic_approval_sql = '';
示例#12
0
    $module['1610_Users']['220_Bantron'] = $filename;
    return;
}
// Load default header
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './../');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
require 'pagestart.' . PHP_EXT;
// Set Overall Variables
$mode = request_var('mode', '');
$show = request_var('show', 'all');
$order = request_var('order', 'ASC');
$order = check_var_value($order, array('ASC', 'DESC'));
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
if (isset($_POST['delete_submit'])) {
    if (isset($_POST['ban_delete'])) {
        foreach ($_POST['ban_delete'] as $ban_id) {
            $sql = "DELETE FROM " . BANLIST_TABLE . " WHERE ban_id = {$ban_id}";
            if (!$db->sql_query($sql)) {
                message_die(GENERAL_ERROR, "Couldn't delete selected bans from database", "", __LINE__, __FILE__, $sql);
            }
        }
    }
    $db->clear_cache('ban_', USERS_CACHE_FOLDER);
    $message = $lang['Ban_update_sucessful'] . '<br /><br />' . sprintf($lang['Click_return_banadmin'], '<a href="' . append_sid('admin_user_bantron.' . PHP_EXT) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid('index.' . PHP_EXT . '?pane=right') . '">', '</a>');
    message_die(GENERAL_MESSAGE, $message);
} elseif (isset($_POST['submit_add']) || isset($_POST['submit_update'])) {
示例#13
0
$sort_dir_sql = $sort_dir_sql_array[$sort_dir];

// Backward compatibility
if (check_http_var_exists('postorder', true))
{
	$sort_dir_array_old = array('asc', 'desc');
	$sort_dir = strtolower(request_var('postorder', $sort_dir_array_old[0]));
	$sort_dir = check_var_value($sort_dir, $sort_dir_array_old);
	$sort_dir = ($sort_dir == 'asc') ? 'a' : 'd';
	$sort_dir_sql = $sort_dir_sql_array[$sort_dir];
}

if (check_http_var_exists('postdays', true))
{
	$sort_days = request_var('postdays', $default_sort_days);
	$sort_days = check_var_value($sort_days, $sort_days_array);
}

$vt_sort_append_array = array();
if ($sort_days != $sort_days_array[0])
{
	$vt_sort_append_array['st'] = $sort_days;
}
if ($sort_key != $sort_key_array[0])
{
	$vt_sort_append_array['sk'] = $sort_key;
}
if ($sort_dir != $sort_dir_array[0])
{
	$vt_sort_append_array['sd'] = $sort_dir;
}
示例#14
0
        $date = $date - $days * 86400;
        $hours = floor($date / 3600);
        $result = ($years ? $years . ' ' . ($years == '1' ? $lang['Account_year'] : $lang['Account_years']) . ', ' : '') . ($years || $weeks ? $weeks . ' ' . ($weeks == '1' ? $lang['Account_week'] : $lang['Account_weeks']) . ', ' : '') . ($years || $weeks || $days ? $days . ' ' . ($days == '1' ? $lang['Account_day'] : $lang['Account_days']) . ', ' : '') . ($years || $weeks || $days || $hours ? $hours . ' ' . ($hours == '1' ? $lang['Account_hour'] : $lang['Account_hours']) : '');
        return $result;
    }
}
$submit_wait = isset($_POST['submit_wait']) ? true : false;
$confirm = isset($_POST['confirm']) ? true : false;
$delete = isset($_POST['delete']) ? true : false;
$activate = isset($_POST['activate']) ? true : false;
$mark_list = !empty($_POST['mark']) ? $_POST['mark'] : 0;
if (check_http_var_exists('letter', false)) {
    $by_letter = request_var('letter', 'all');
}
$action = request_var('action', 'inactive');
$action = check_var_value($action, array('inactive', 'active'));
$mode = request_var('mode', '');
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
$user_id = request_var(POST_USERS_URL, 0);
$user_id = $user_id < 2 ? ANONYMOUS : $user_id;
if (($delete && $confirm || $activate) && $mark_list) {
    if (sizeof($mark_list)) {
        $email_id = '';
        for ($i = 0; $i < sizeof($mark_list); $i++) {
            $email_id .= ($email_id != '' ? ', ' : '') . intval($mark_list[$i]);
        }
        $sql_mail = "SELECT username, user_email, user_lang, user_active FROM " . USERS_TABLE . " WHERE user_id IN ({$email_id})";
        $result_mail = $db->sql_query($sql_mail);
        while ($mail = $db->sql_fetchrow($result_mail)) {
            if ($delete) {
示例#15
0
// CONFIG - END

// VARS - BEGIN
$tag_id = request_var('tag_id', 0);
$tag_id = ($tag_id < 0) ? 0 : $tag_id;

$tag_text = request_var('tag_text', '', true);
$tag_text = ip_clean_string(urldecode(trim($tag_text)), $lang['ENCODING'], true);

$mode_types = array('cloud', 'list', 'view', 'replace');
$mode = request_var('mode', $mode_types[0]);
$mode = check_var_value($mode, $mode_types);

$action_types = array('list');
$action = request_var('action', $action_types[0]);
$action = check_var_value($action, $action_types);

$start = request_var('start', 0);
$start = ($start < 0) ? 0 : $start;

$per_page = request_var('per_page', 0);
$per_page = (empty($per_page) || ($per_page < 20) || ($per_page > 300)) ? $config['topics_per_page'] : $per_page;

$s_hidden_fields = '';

// SORT ORDER - BEGIN
$sort_order_array = array();
$sort_order_select_array = array();
$sort_order_select_lang_array = array();
foreach ($table_fields as $k => $v)
{
示例#16
0
*
*/
if (!defined('IN_ICYPHOENIX')) {
    die('Hacking attempt');
    exit;
}
/*
if ($config['allow_zebra'] == false)
{
	message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
}
*/
$zmode = 'friends';
$zmode_types = array('friends', 'foes');
$zmode = request_var('zmode', 'friends');
$zmode = check_var_value($zmode, $zmode_types);
// Forced to friends...
$zmode = 'friends';
if (isset($_POST['submit'])) {
    $data = array();
    $error = array();
    $updated = false;
    $var_ary = array('usernames' => array(0), 'add' => '');
    foreach ($var_ary as $var => $default) {
        $data[$var] = request_var($var, $default, true);
    }
    if (!empty($data['add']) || sizeof($data['usernames'])) {
        if ($data['add']) {
            $data['add'] = array_map('trim', explode("\n", $data['add']));
            // Do these name/s exist on a list already? If so, ignore ... we could be
            // 'nice' and automatically handle names added to one list present on
$lang_management = new lang_management();
$value_maxlength = 250;
// Remove the ADMIN / NORMAL options => force $_POST options
$_POST['search_admin'] = 2;
$_POST['new_level'] = 'normal';
// get languages installed
$countries = $lang_management->get_countries();
// get packs installed
$packs = $lang_management->get_packs();
// get entries (all lang keys)
$entries = $lang_management->get_entries();
// get parameters
$mode = request_var('mode', '');
$mode = check_var_value($mode, array('pack', 'key'), '');
$level = request_var('level', 'normal');
$level = check_var_value($level, array('normal', 'admin'));
// pack file
$pack_file = request_post_var('pack_file', '');
$pack_file = empty($pack_file) ? request_get_var('pack', '') : $pack_file;
$pack_file = urldecode($pack_file);
if (!isset($packs[$pack_file])) {
    $pack_file = '';
    $mode = '';
}
// keys
$key_main = request_post_var('key_main', '');
$key_main = empty($key_main) ? request_get_var('key', '') : $key_main;
$key_sub = request_post_var('key_sub', '');
$key_sub = empty($key_sub) ? request_get_var('sub', '') : $key_sub;
if (empty($key_main)) {
    $key_sub = '';
示例#18
0
if (isset($_GET['full']) || isset($_POST['full'])) {
    $picm = false;
    $full_size_param = '&amp;full=true';
} else {
    if ($album_config['midthumb_use'] == 1) {
        $picm = true;
        $full_size_param = '';
    } else {
        $picm = false;
        $full_size_param = '&amp;full=true';
    }
}
$sort_method = request_var('sort_method', $album_config['sort_method']);
$sort_method = check_var_value($sort_method, array('pic_time', 'pic_title', 'pic_view_count'));
$sort_order = request_var('sort_order', $album_config['sort_order']);
$sort_order = check_var_value(strtoupper($sort_order), array('ASC', 'DESC'));
$sort_append = '&amp;sort_method=' . $sort_method . '&amp;sort_order=' . $sort_order;
$is_slideshow = request_var('slideshow', 0);
$is_slideshow = !empty($is_slideshow) ? true : false;
// ------------------------------------
// TEMPLATE ASSIGNEMENT
// ------------------------------------
if ($is_slideshow) {
    $gen_simple_header = true;
    $show_template = 'album_slideshow_body.tpl';
    $nuffimage_pic = $picm == false ? 'album_pic.' : 'album_picm.';
    $nuff_display = false;
} else {
    //$show_template = 'album_showpage_body.tpl';
    if ((isset($_GET['nuffimage']) || isset($_POST['nuffimage'])) && $album_config['enable_nuffimage'] == 1) {
        include ALBUM_MOD_PATH . 'album_nuffimage_box.' . PHP_EXT;
示例#19
0
$start = ($start < 0) ? 0 : $start;

$select_name = 'mode';
$mode_types = array('topic_time', 'username', 'email', 'joindate', 'topic_count', 'website', 'topten');
$mode_types_text = array($lang['Topic_time'], $lang['SORT_USERNAME'], $lang['SORT_EMAIL'], $lang['SORT_JOINED'], $lang['Topic_count'], $lang['SORT_WEBSITE'], $lang['SORT_TOP_TEN']);
$mode = request_var('mode', $mode_types[0]);
$mode = check_var_value($mode, $mode_types);
$default = $mode;
$select_js = '';
$select_sort_mode = $class_form->build_select_box($select_name, $default, $mode_types, $mode_types_text, $select_js);

$select_name = 'order';
$sort_order_select_array = array('ASC', 'DESC');
$sort_order_select_lang_array = array($lang['Sort_Ascending'], $lang['Sort_Descending']);
$sort_order = request_var('order', 'DESC');
$sort_order = check_var_value($sort_order, $sort_order_select_array);
$default = $sort_order;
$select_js = '';
$select_sort_order = $class_form->build_select_box($select_name, $default, $sort_order_select_array, $sort_order_select_lang_array, $select_js);

$base_url = IP_ROOT_PATH . 'topic_view_users.' . PHP_EXT . '?' . (!empty($like) ? ('like=1&amp;' . POST_POST_URL . '=' . $post_id) : (POST_TOPIC_URL . '=' . $topic_id));
$base_url_full = $base_url . '&amp;mode=' . $mode . '&amp;order=' . $sort_order;

switch($mode)
{
	case 'joined':
		$order_by = "u.user_regdate";
		break;
	case 'username':
		$order_by = "u.username";
		break;
示例#20
0
 function main($action)
 {
     global $db, $config, $lang, $images, $user, $debug;
     global $pafiledb_config, $template, $pafiledb_functions;
     $this->init();
     $file_id = request_var('file_id', 0);
     $file_ids = request_var('file_ids', array(0));
     $start = request_var('start', 0);
     $start = $start < 0 ? 0 : $start;
     $mode = request_var('mode', '');
     $mode_js = request_var('mode_js', '');
     /*
     $mode = (isset($_POST['addfile'])) ? 'add' : $mode;
     $mode = (isset($_POST['delete'])) ? 'delete' : $mode;
     */
     $mode = isset($_POST['approve']) ? 'do_approve' : $mode;
     $mode = isset($_POST['unapprove']) ? 'do_unapprove' : $mode;
     if (empty($mode)) {
         $mode = $mode_js;
         $cat_id = request_var('cat_js_id', 0);
         $cat_id = !empty($cat_id) ? $cat_id : request_var('cat_id', 0);
     } else {
         $cat_id = request_var('cat_id', 0);
     }
     $mirrors = isset($_POST['mirrors']) ? true : 0;
     //===================================================
     // Pafiledb auth for mcp
     //===================================================
     if (!$this->auth[$cat_id]['auth_mod'] || !$user->data['session_logged_in']) {
         if (!$user->data['session_logged_in']) {
             redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=dload.' . PHP_EXT . '&action=file&file_id=' . $file_id, true));
         }
         $message = sprintf($lang['Sorry_auth_mcp'], $this->auth[$cat_id]['auth_mod']);
         message_die(GENERAL_MESSAGE, $message);
     }
     $sort_method = request_var('sort_method', $pafiledb_config['sort_method']);
     $sort_method = check_var_value($sort_method, array('file_name', 'file_time', 'file_dls', 'file_rating', 'file_update_time'));
     $sort_method = $sort_method == 'file_rating' ? 'rating' : $sort_method;
     $sort_order = request_var('order', $pafiledb_config['sort_order']);
     $sort_order = check_var_value($sort_order, array('DESC', 'ASC'));
     $s_file_actions = array('approved' => $lang['Approved_files'], 'broken' => $lang['Broken_files'], 'file_cat' => $lang['File_cat'], 'all_file' => $lang['All_files']);
     switch ($mode) {
         case '':
         case 'approved':
         case 'broken':
         case 'do_approve':
         case 'do_unapprove':
             //			case 'delete':
         //			case 'delete':
         case 'file_cat':
         case 'all_file':
         default:
             // MX
             $template_file = 'pa_mcp.tpl';
             $l_title = $lang['MCP_title'];
             $l_explain = $lang['MCP_title_explain'];
             //$s_hidden_fields = '<input type="hidden" name="mode" value="add" />';
             break;
     }
     if ($mode == 'do_approve' || $mode == 'do_unapprove') {
         if ($pafiledb_config['validator'] == 'validator_mod' && $this->auth[$cat_id]['auth_mod'] || $user->data['user_level'] == ADMIN) {
             if (is_array($file_ids) && !empty($file_ids)) {
                 foreach ($file_ids as $temp_file_id) {
                     $this->file_approve($mode, $temp_file_id);
                 }
             } else {
                 $this->file_approve($mode, $file_id);
             }
             $this->_pafiledb();
         } else {
             $message = sprintf($lang['Sorry_auth_approve'], $this->auth[$cat_id]['auth_mod']);
             message_die(GENERAL_MESSAGE, $message);
         }
     }
     $template->set_filenames(array('admin' => $template_file));
     $s_hidden_fields = '<input type="hidden" name="cat_id" value="' . $cat_id . '" />';
     $template->assign_vars(array('L_INDEX' => $lang['Home'], 'L_HOME' => $lang['Home'], 'CURRENT_TIME' => sprintf($lang['Current_time'], create_date($config['default_dateformat'], time(), $config['board_timezone'])), 'U_INDEX_HOME' => append_sid(CMS_PAGE_HOME), 'U_DOWNLOAD_HOME' => append_sid('dload.php'), 'U_DOWNLOAD' => append_sid('dload.php'), 'DOWNLOAD' => $pafiledb_config['settings_dbname'], 'L_MCP_TITLE' => $l_title, 'L_MCP_EXPLAIN' => $l_explain, 'L_ADD_FILE' => $lang['Afiletitle'], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_FILE_ACTION' => append_sid('dload.' . PHP_EXT . '?action=mcp')));
     if (in_array($mode, array('', 'approved', 'broken', 'do_approve', 'do_unapprove', 'file_cat', 'all_file'))) {
         $mode = in_array($mode, array('do_approve', 'do_unapprove')) ? '' : $mode;
         if ($mode != 'approved' && $mode != 'broken') {
             //		$where_sql = ($mode == 'file_cat') ? "AND file_catid = '$cat_id'" : '';
             $where_sql = "AND file_catid = '{$cat_id}'";
             $sql = "SELECT file_name, file_approved, file_id, file_broken\n\t\t\t\t\tFROM " . PA_FILES_TABLE . " as f1\n\t\t\t\t\tWHERE file_approved = '1'\n\t\t\t\t\t{$where_sql}\n\t\t\t\t\tORDER BY file_time DESC";
             if ($mode == '' || $mode == 'file_cat' || $mode == 'all_file') {
                 $result = $db->sql_query($sql);
                 $total_files = $db->sql_numrows($result);
             }
             if (!($result = $pafiledb_functions->sql_query_limit($sql, $pafiledb_config['settings_file_page'], $start))) {
                 message_die(GENERAL_ERROR, 'Couldn\'t get file info', '', __LINE__, __FILE__, $sql);
             }
             while ($row = $db->sql_fetchrow($result)) {
                 $all_file_rowset[] = $row;
             }
         }
         if ($mode == '' || $mode == 'approved' || $mode == 'broken' || $mode == 'file_cat' || $mode == 'all_file') {
             if ($mode == '') {
                 $limit = 5;
                 $temp_start = 0;
             } else {
                 $limit = $pafiledb_config['settings_file_page'];
                 $temp_start = $start;
             }
             if ($mode == '' || $mode == 'approved') {
                 $sql = "SELECT file_name, file_approved, file_id, file_broken\n\t\t\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\t\t\tWHERE file_approved = '0'\n\t\t\t\t\t\tAND file_catid = '{$cat_id}'\n\t\t\t\t\t\tORDER BY file_time DESC";
                 if ($mode == 'approved') {
                     $result = $db->sql_query($sql);
                     $total_files = $db->sql_numrows($result);
                 }
                 if (!($result = $pafiledb_functions->sql_query_limit($sql, $limit, $temp_start))) {
                     message_die(GENERAL_ERROR, 'Couldn\'t get file info', '', __LINE__, __FILE__, $sql);
                 }
                 while ($row = $db->sql_fetchrow($result)) {
                     $approved_file_rowset[] = $row;
                 }
             }
             if ($mode == '' || $mode == 'broken') {
                 $sql = "SELECT file_name, file_approved, file_id, file_broken\n\t\t\t\t\t\tFROM " . PA_FILES_TABLE . "\n\t\t\t\t\t\tWHERE file_broken = '1'\n\t\t\t\t\t\tAND file_catid = '{$cat_id}'\n\t\t\t\t\t\tORDER BY file_time DESC";
                 if ($mode == 'broken') {
                     $result = $db->sql_query($sql);
                     $total_files = $db->sql_numrows($result);
                 }
                 if (!($result = $pafiledb_functions->sql_query_limit($sql, $limit, $temp_start))) {
                     message_die(GENERAL_ERROR, 'Couldn\'t get file info', '', __LINE__, __FILE__, $sql);
                 }
                 while ($row = $db->sql_fetchrow($result)) {
                     $broken_file_rowset[] = $row;
                 }
             }
             if ($mode == '') {
                 $global_array = array(0 => array('lang_var' => $lang['Approved_files'], 'row_set' => $approved_file_rowset, 'approval' => 'approve'), 1 => array('lang_var' => $lang['Broken_files'], 'row_set' => $broken_file_rowset, 'approval' => 'both'), 2 => array('lang_var' => $lang['All_files'], 'row_set' => $all_file_rowset, 'approval' => 'unapprove'));
             } elseif ($mode == 'all_file') {
                 $global_array = array(0 => array('lang_var' => $lang['Approved_files'], 'row_set' => $approved_file_rowset, 'approval' => 'approve'), 1 => array('lang_var' => $lang['Broken_files'], 'row_set' => $broken_file_rowset, 'approval' => 'both'), 2 => array('lang_var' => $lang['All_files'], 'row_set' => $all_file_rowset, 'approval' => 'unapprove'));
             } elseif ($mode == 'file_cat') {
                 $global_array = array(0 => array('lang_var' => $lang['All_files'], 'row_set' => $all_file_rowset, 'approval' => 'unapprove'));
             } elseif ($mode == 'approved') {
                 $global_array = array(0 => array('lang_var' => $lang['Approved_files'], 'row_set' => $approved_file_rowset, 'approval' => 'approve'));
             } elseif ($mode == 'broken') {
                 $global_array = array(0 => array('lang_var' => $lang['Broken_files'], 'row_set' => $broken_file_rowset, 'approval' => 'both'));
             }
         }
         $s_file_list = '';
         foreach ($s_file_actions as $file_mode => $lang_var) {
             $s = '';
             if ($mode == $file_mode) {
                 $s = ' selected="selected"';
             }
             $s_file_list .= '<option value="' . $file_mode . '"' . $s . '>' . $lang_var . '</option>';
         }
         $cat_list = '<select name="cat_js_id">';
         if (!$this->cat_rowset[$cat_id]['cat_parent']) {
             $cat_list .= '<option value="0" selected="selected">' . $lang['None'] . '</option>\\n';
         } else {
             $cat_list .= '<option value="0">' . $lang['None'] . '</option>\\n';
         }
         $cat_list .= $this->jumpmenu_option(0, 0, array($cat_id => 1), true);
         $cat_list .= '</select>';
         $template->assign_vars(array('L_EDIT' => $lang['Editfile'], 'L_DELETE' => $lang['Delete'], 'L_CATEGORY' => $lang['Category'], 'L_MODE' => $lang['View'], 'L_GO' => $lang['Go'], 'L_DELETE_FILE' => $lang['Delete_selected'], 'L_APPROVE' => $lang['Approve'], 'L_UNAPPROVE' => $lang['Unapprove'], 'L_APPROVE_FILE' => $lang['Approve_selected'], 'L_UNAPPROVE_FILE' => $lang['Unapprove_selected'], 'L_NO_FILES' => $lang['No_file'], 'PAGINATION' => generate_pagination(append_sid('dload.' . PHP_EXT . '?action=mcp&amp;mode=' . $mode . '&amp;sort_method=' . $sort_method . '&amp;sort_order=' . $sort_order . '&amp;cat_id=' . $cat_id), $total_files, $pafiledb_config['settings_file_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $pafiledb_config['settings_file_page']) + 1, ceil($total_files / $pafiledb_config['settings_file_page'])), 'S_CAT_LIST' => $cat_list, 'S_MODE_SELECT' => $s_file_list));
         foreach ($global_array as $files_data) {
             $approve = false;
             $unapprove = false;
             if ($files_data['approval'] == 'both') {
                 $approve = $unapprove = true;
             } elseif ($files_data['approval'] == 'approve') {
                 $approve = true;
             } elseif ($files_data['approval'] == 'unapprove') {
                 $unapprove = true;
             }
             $template->assign_block_vars('file_mode', array('L_FILE_MODE' => $files_data['lang_var'], 'DATA' => isset($files_data['row_set']) ? true : false, 'APPROVE' => $approve, 'UNAPPROVE' => $unapprove));
             if (isset($files_data['row_set'])) {
                 $i = $start + 1;
                 foreach ($files_data['row_set'] as $file_data) {
                     $approve_mode = $file_data['file_approved'] ? 'do_unapprove' : 'do_approve';
                     $template->assign_block_vars('file_mode.file_row', array('FILE_NAME' => $file_data['file_name'], 'FILE_NUMBER' => $i++, 'FILE_ID' => $file_data['file_id'], 'U_FILE_EDIT' => append_sid("dload.php?action=user_upload&amp;mode=edit&amp;file_id={$file_data['file_id']}"), 'U_FILE_DELETE' => append_sid("dload.php?action=user_upload&amp;do=delete&amp;file_id={$file_data['file_id']}"), 'U_FILE_APPROVE' => append_sid("dload.php?action=mcp&amp;mode={$approve_mode}&amp;cat_id={$cat_id}&amp;file_id={$file_data['file_id']}"), 'L_APPROVE' => $file_data['file_approved'] ? $lang['Unapprove'] : $lang['Approve']));
                 }
             }
         }
     }
     $template->assign_vars(array('ERROR' => sizeof($this->error) ? implode('<br />', $this->error) : ''));
     $this->display($lang['MCP'], $template_file);
     // $template->display('admin');
     $this->_pafiledb();
     /* Original
     		include(IP_ROOT_PATH . ADM . '/page_footer_admin.' . PHP_EXT);
     		*/
 }
示例#21
0
$categories_fields_list = array('forum_id' => 'id', 'forum_type' => 'forum_type', 'parent_id' => 'main_id', 'main_type' => 'main_type', 'forum_order' => 'order', 'forum_name' => 'name', 'forum_name_clean' => 'name_clean', 'forum_desc' => 'desc', 'icon' => 'icon');
// type of the form fields
$fields_type = array('type' => 'VARCHAR', 'id' => 'INTEGER', 'main_id' => 'INTEGER', 'main_type' => 'VARCHAR', 'order' => 'INTEGER', 'name' => 'HTML', 'name_clean' => 'VARCHAR', 'desc' => 'HTML', 'icon' => 'HTML', 'status' => 'INTEGER', 'forum_likes' => 'INTEGER', 'forum_limit_edit_time' => 'INTEGER', 'forum_sort_box' => 'INTEGER', 'forum_kb_mode' => 'INTEGER', 'forum_index_icons' => 'INTEGER', 'forum_notify' => 'INTEGER', 'forum_rules_switch' => 'INTEGER', 'forum_rules' => 'HTML', 'forum_rules_custom_title' => 'VARCHAR', 'forum_rules_display_title' => 'INTEGER_CB', 'forum_rules_in_viewforum' => 'INTEGER_CB', 'forum_rules_in_viewtopic' => 'INTEGER_CB', 'forum_rules_in_posting' => 'INTEGER_CB', 'forum_recurring_first_post' => 'INTEGER', 'forum_postcount' => 'INTEGER', 'enable' => 'INTEGER', 'link' => 'HTML', 'link_internal' => 'INTEGER', 'link_hit_count' => 'INTEGER', 'link_hit' => 'INTEGER');
$zero_array = array('forum_rules_in_viewforum', 'forum_rules_in_viewtopic', 'forum_rules_in_posting');
// list for pull down menu and check of values :
//		value => lang key entry
$forum_type_list = array(POST_CAT_URL => 'Category', POST_FORUM_URL => 'Forum', POST_FLINK_URL => 'Forum_link');
// forum status
//		value => lang key entry
$forum_status_list = array(FORUM_UNLOCKED => 'Status_unlocked', FORUM_LOCKED => 'Status_locked');
// prune functions
include IP_ROOT_PATH . './includes/prune.' . PHP_EXT;
// return message after update
$return_msg .= '<br /><br />' . sprintf($lang['Click_return_forumadmin'], '<a href="' . append_sid('admin_forums_extend.' . PHP_EXT . '?selected_id=' . $selected_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . append_sid('index.' . PHP_EXT . '?pane=right') . '">', '</a>');
$mode = request_var('mode', '');
$mode = check_var_value($mode, array('edit', 'create', 'delete', 'moveup', 'movedw', 'resync'), '');
$cat_id = request_var(POST_CAT_URL, 0);
$cat_id = $cat_id < 0 ? 0 : $cat_id;
$forum_id = request_var(POST_FORUM_URL, 0);
$forum_id = $forum_id < 0 ? 0 : $forum_id;
// selected id: current displayed id
$selected_id = request_var('selected_id', '');
$type = substr($selected_id, 0, 1);
$id = intval(substr($selected_id, 1));
if (!empty($forum_id)) {
    $type = POST_FORUM_URL;
    $id = $forum_id;
}
if (!empty($cat_id)) {
    $type = POST_CAT_URL;
    $id = $cat_id;
示例#22
0
$file_ids = request_var('file_ids', array(0));
$start = request_var('start', 0);
$start = $start < 0 ? 0 : $start;
$mode = request_var('mode', '');
$mode_js = request_var('mode_js', '');
$mode = isset($_POST['addfile']) ? 'add' : $mode;
$mode = isset($_POST['delete']) ? 'delete' : $mode;
$mode = isset($_POST['approve']) ? 'do_approve' : $mode;
$mode = isset($_POST['unapprove']) ? 'do_unapprove' : $mode;
$mode = empty($mode) ? $mode_js : $mode;
$mirrors = isset($_POST['mirrors']) ? true : 0;
$sort_method = request_var('sort_method', $pafiledb_config['sort_method']);
$sort_method = check_var_value($sort_method, array('file_name', 'file_time', 'file_dls', 'file_rating', 'file_update_time'), $pafiledb_config['sort_method']);
$sort_method = $sort_method == 'file_rating' ? 'rating' : $sort_method;
$sort_order = request_var('order', $pafiledb_config['sort_order']);
$sort_order = check_var_value($sort_order, array('DESC', 'ASC'), $pafiledb_config['sort_order']);
$s_file_actions = array('approved' => $lang['Approved_files'], 'broken' => $lang['Broken_files'], 'file_cat' => $lang['File_cat'], 'all_file' => $lang['All_files'], 'maintenance' => $lang['Maintenance']);
switch ($mode) {
    case '':
    case 'approved':
    case 'broken':
    case 'do_approve':
    case 'do_unapprove':
    case 'delete':
    case 'file_cat':
    case 'all_file':
    default:
        $template_file = ADM_TPL . 'pa_admin_file.tpl';
        $l_title = $lang['File_manage_title'];
        $l_explain = $lang['Fileexplain'];
        //$s_hidden_fields = '<input type="hidden" name="mode" value="add" />';