вопрос
Здравствуйте, поставил себе модуль "Вывод всех пользователей", теперь нужно встроить поиск пользователей из другого модуля в етот.
Файл users_search.tpl - users_search.rar [394 b] (cкачиваний: 8)
safe_mode = true;
$tpl->load_template( 'users_search.tpl' );
$g = 0;
$_GET['count'] = intval($_GET['count']);
$_GET['order'] = addslashes($_GET['order']);
$_GET['sort'] = addslashes($_GET['sort']);
$_GET['usergroups'] = intval($_GET['usergroups']);
$_GET['login'] = addslashes($_GET['login']);
while ( $g++ <= 9 ){
$u = $g * 10;
if($_GET['count'] != $u)
$sel_num .= '';
else
$sel_num .= '';
}
$tpl->set('{count}', $sel_num);
$orders = array('name' => 'Логин', 'user_group' => 'Группа', 'reg_date' => 'Регистрация', 'lastdate' => 'Вход', 'news_num' => 'Новостей', 'comm_num' => 'Комментариев');
foreach ( $orders as $key => $value){
if($_GET['order'] == $key)
$order .= '';
else
$order .= '';
}
$tpl->set('{order}', $order);
$sorts = array('ASC' => 'По возрастанию', 'DESC' => 'По убыванию');
foreach ( $sorts as $key => $value){
if($_GET['sort'] == $key)
$sort .= '';
else
$sort .= '';
}
$tpl->set('{sort}', $sort);
$usergroups = $db->query( "SELECT * FROM " . USERPREFIX . "_usergroups");
while ( $row = $db->get_row( $usergroups ) ) {
if($_GET['usergroups'] == $row['id'])
$group_s .= '';
else
$group_s .= '';
}
$tpl->set('{usergroups}', $group_s);
if ($_GET['count'] != ""){
$searchcount = intval($_GET['count']);
$postfix .= "&count=$searchcount";
}else {
$searchcount = 10;
}
if($_GET['order'] != ""){
$order_by = $_GET['order'];
$postfix .= "&order=".$_GET['order'];
}else
$order_by = "user_group";
if ($_GET['sort'] != ""){
$sort_by = $_GET['sort'];
$postfix .= "&sort=".$_GET['sort'];
}else {
$sort_by = "ASC";
}
if ($_GET['usergroups'] != "" or $_GET['login'] != "") $where_w = "WHERE ";
if ($_GET['usergroups'] != ""){
$where_w .= "user_group=".$_GET['usergroups'];
$postfix .= "&usergroups=".$_GET['usergroups'];
}
if ($_GET['login'] != ""){
if ($_GET['usergroups'] != "") $where_w .= " AND ";
$where_w .= "name like '%".$_GET['login']."%'";
$postfix .= "&login=".$_GET['login'];
$login_val = $_GET['login'];
}
$tpl->set('{login}', $login_val);
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_users $where_w";
$row = $db->super_query($sql_count);
$count_all = $row['count'];
function pluralForm($count_all, $numb1, $numb2, $numb3)
{
$count_all = abs($count_all) % 100;
$n1 = $count_all % 10;
if ($count_all > 10 && $count_all 1 && $n1 set('{numbers}', pluralForm($count_all, 'Найден', 'Найдено', 'Найдено').' '.$count_all.' '.pluralForm($count_all, 'пользователь', 'пользвателя', 'пользователей'));
$tpl->compile('content');
if (!isset($cstart) or ($cstartquery( "SELECT * FROM " . USERPREFIX . "_users $where_w ORDER BY $order_by $sort_by LIMIT $cstartlimit,$searchcount");
$tpl->load_template( 'profile/users.tpl' );
while ( $row = $db->get_row( $sql_result ) ) {
if( $row['banned'] == 'yes' ) $user_group[$row['user_group']]['group_name'] = $lang['user_ban'];
$i++;
$tpl->set( '{numb}', "$i" );
if( $row['allow_mail'] ) {
if ( !$user_group[$member_id['user_group']]['allow_feed'] AND $row['user_group'] != 1 ){
$tpl->set_block( "'\\[email\\](.*?)\\[/email\\]'si", "" );
$tpl->set( '{email}', "" );
$tpl->set( '[not-email]', "" );
$tpl->set( '[/not-email]', "" );
}else{
$tpl->set( '[email]', "" );
$tpl->set( '[/email]', "" );
$tpl->set( '{email}', "$PHP_SELF?do=feedback&user=$row[user_id]" );
$tpl->set_block( "'\\[not-email\\](.*?)\\[/not-email\\]'si", "" );
}
} else {
$tpl->set_block( "'\\[email\\](.*?)\\[/email\\]'si", "" );
$tpl->set( '{email}', "" );
$tpl->set( '[not-email]', "" );
$tpl->set( '[/not-email]', "" );
}
if( $user_group[$member_id['user_group']]['allow_pm'] ) {
$tpl->set( '[pm]', "" );
$tpl->set( '[/pm]', "" );
$tpl->set( '{pm}', "$PHP_SELF?do=pm&doaction=newpm&user=" . $row['user_id'] );
$tpl->set_block( "'\\[not-pm\\](.*?)\\[/not-pm\\]'si", "" );
} else {
$tpl->set_block( "'\\[pm\\](.*?)\\[/pm\\]'si", "" );
$tpl->set( '{pm}', "" );
$tpl->set( '[not-pm]', "" );
$tpl->set( '[/not-pm]', "" );
}
if( $row['foto'] and (file_exists( ROOT_DIR . "/uploads/fotos/" . $row['foto'] )) ) $tpl->set( '{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto'] );
else $tpl->set( '{foto}', "{THEME}/images/noavatar.png" );
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if( $row['fullname'] ) {
$tpl->set( '[fullname]', "" );
$tpl->set( '[/fullname]', "" );
$tpl->set( '{fullname}', stripslashes( $row['fullname'] ) );
$tpl->set_block( "'\\[not-fullname\\](.*?)\\[/not-fullname\\]'si", "" );
} else {
$tpl->set_block( "'\\[fullname\\](.*?)\\[/fullname\\]'si", "" );
$tpl->set( '{fullname}', "" );
$tpl->set( '[not-fullname]', "" );
$tpl->set( '[/not-fullname]', "" );
}
if( $row['icq'] ) {
$tpl->set( '[icq]', "" );
$tpl->set( '[/icq]', "" );
$tpl->set( '{icq}', stripslashes( $row['icq'] ) );
$tpl->set_block( "'\\[not-icq\\](.*?)\\[/not-icq\\]'si", "" );
} else {
$tpl->set_block( "'\\[icq\\](.*?)\\[/icq\\]'si", "" );
$tpl->set( '{icq}', "" );
$tpl->set( '[not-icq]', "" );
$tpl->set( '[/not-icq]', "" );
}
if( $row['land'] ) {
$tpl->set( '[land]', "" );
$tpl->set( '[/land]', "" );
$tpl->set( '{land}', stripslashes( $row['land'] ) );
$tpl->set_block( "'\\[not-land\\](.*?)\\[/not-land\\]'si", "" );
} else {
$tpl->set_block( "'\\[land\\](.*?)\\[/land\\]'si", "" );
$tpl->set( '{land}', "" );
$tpl->set( '[not-land]', "" );
$tpl->set( '[/not-land]', "" );
}
if( $row['info'] ) {
$tpl->set( '[info]', "" );
$tpl->set( '[/info]', "" );
$tpl->set( '{info}', stripslashes( $row['info'] ) );
$tpl->set_block( "'\\[not-info\\](.*?)\\[/not-info\\]'si", "" );
} else {
$tpl->set_block( "'\\[info\\](.*?)\\[/info\\]'si", "" );
$tpl->set( '{info}', "" );
$tpl->set( '[not-info]', "" );
$tpl->set( '[/not-info]', "" );
}
if ( ($row['lastdate'] + 1200) > $_TIME ) {
$tpl->set( '[online]', "" );
$tpl->set( '[/online]', "" );
$tpl->set_block( "'\\[offline\\](.*?)\\[/offline\\]'si", "" );
} else {
$tpl->set( '[offline]', "" );
$tpl->set( '[/offline]', "" );
$tpl->set_block( "'\\[online\\](.*?)\\[/online\\]'si", "" );
}
$tpl->set( '{status}', $user_group[$row['user_group']]['group_prefix'].$user_group[$row['user_group']]['group_name'].$user_group[$row['user_group']]['group_suffix'] );
$tpl->set( '{registration}', langdate( "j F Y H:i", $row['reg_date'] ) );
$tpl->set( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );
if( $user_group[$row['user_group']]['icon'] ) $tpl->set( '{group-icon}', "" );
else $tpl->set( '{group-icon}', "" );
if( $is_logged and $user_group[$row['user_group']]['time_limit'] and ($member_id['user_id'] == $row['user_id'] or $member_id['user_group'] set_block( "'\\[time_limit\\](.*?)\\[/time_limit\\]'si", "\\1" );
if( $row['time_limit'] ) {
$tpl->set( '{time_limit}', langdate( "j F Y H:i", $row['time_limit'] ) );
} else {
$tpl->set( '{time_limit}', $lang['no_limit'] );
}
} else {
$tpl->set_block( "'\\[time_limit\\](.*?)\\[/time_limit\\]'si", "" );
}
if( $row['comm_num'] ) {
$tpl->set( '[comm-num]', "" );
$tpl->set( '[/comm-num]', "" );
$tpl->set( '{comm-num}', $row['comm_num'] );
$tpl->set( '{comments}', "" . $lang['last_comm'] . "" );
$tpl->set_block( "'\\[not-comm-num\\](.*?)\\[/not-comm-num\\]'si", "" );
} else {
$tpl->set( '{comments}', $lang['last_comm'] );
$tpl->set( '{comm-num}', 0 );
$tpl->set_block( "'\\[comm-num\\](.*?)\\[/comm-num\\]'si", "" );
$tpl->set( '[not-comm-num]', "" );
$tpl->set( '[/not-comm-num]', "" );
}
if( $row['news_num'] ) {
if( $config['allow_alt_url'] == "yes" ) {
$tpl->set( '{news}', "" . $lang['all_user_news'] . "" );
$tpl->set( '[rss]', "" );
$tpl->set( '[/rss]', "" );
} else {
$tpl->set( '{news}', "" . $lang['all_user_news'] . "" );
$tpl->set( '[rss]', "" );
$tpl->set( '[/rss]', "" );
}
$tpl->set( '{news-num}', $row['news_num'] );
$tpl->set( '[news-num]', "" );
$tpl->set( '[/news-num]', "" );
$tpl->set_block( "'\\[not-news-num\\](.*?)\\[/not-news-num\\]'si", "" );
} else {
$tpl->set( '{news}', $lang['all_user_news'] );
$tpl->set_block( "'\\[rss\\](.*?)\\[/rss\\]'si", "" );
$tpl->set( '{news-num}', 0 );
$tpl->set_block( "'\\[news-num\\](.*?)\\[/news-num\\]'si", "" );
$tpl->set( '[not-news-num]', "" );
$tpl->set( '[/not-news-num]', "" );
}
if( $row['signature'] and $user_group[$row['user_group']]['allow_signature'] ) {
$tpl->set_block( "'\\[signature\\](.*?)\\[/signature\\]'si", "\\1" );
$tpl->set( '{signature}', stripslashes( $row['signature'] ) );
} else {
$tpl->set_block( "'\\[signature\\](.*?)\\[/signature\\]'si", "" );
$tpl->set( '{signature}', "" );
}
if( $config['allow_alt_url'] == "yes" ){
$profile = $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/" ;
}else{
$profile = $PHP_SELF . "?subaction=userinfo&user=" . urlencode( $row['name'] ) ;
}
$tpl->set( '{profile}', $profile );
$tpl->set( '{profile_m}', "onclick=\"ShowProfile('" . urlencode( $row['name'] ) . "', '" . $profile . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\"" );
$xfieldsaction = "list";
$xfieldsadd = false;
$xfieldsid = $row['xfields'];
include (ENGINE_DIR . '/inc/userfields.php');
$tpl->set( '{xfields}', $output );
// Обработка дополнительных полей
$xfieldsdata = xfieldsdataload( $row['xfields'] );
foreach ( $xfields as $value ) {
$preg_safe_name = preg_quote( $value[0], "'" );
if( $value[5] != 1 OR ($is_logged AND $member_id['user_group'] == 1) OR ($is_logged AND $member_id['user_id'] == $row['user_id']) ) {
if( empty( $xfieldsdata[$value[0]] ) ) {
$tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[/xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template );
} else {
$tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[xfgiven_{$preg_safe_name}]", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[/xfgiven_{$preg_safe_name}]", "", $tpl->copy_template );
}
$tpl->copy_template = preg_replace( "'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes( $xfieldsdata[$value[0]] ), $tpl->copy_template );
} else {
$tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = preg_replace( "'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template );
$tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
}
}
// Обработка дополнительных полей
$tpl->compile( 'content' );
}
$tpl->clear();
$db->free( $sql_result );
//####################################################################################################################
// Навигация по пользователям
//####################################################################################################################
$number = $searchcount;
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 1){
$prev = $cstart-1;
if ($prev == 1)
$prev_page = $PHP_SELF . "?do=users" . $postfix;
else
$prev_page = $PHP_SELF . "?do=users&cstart=" . $prev . $postfix;
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
}else{
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
$no_prev = TRUE;
}
//----------------------------------
// Pages
//----------------------------------
if($number){
$enpages_count = @ceil($count_all/$number);
$pages = "";
if ($enpages_count <= 10 ) {
for($j=1; $j<=$enpages_count; $j++){
if($j != $cstart) {
if ($j == 1)
$pages .= "$j ";
else
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
} else {
$start =1;
$end = 10;
$nav_prefix = "{$lang['nav_trennen']}";
if ($cstart > 0) {
if ($cstart > 6) {
$start = $cstart - 4;
$end = $start + 8;
if ($end >= $enpages_count) {
$start = $enpages_count - 9;
$end = $enpages_count - 1;
$nav_prefix = "";
} else $nav_prefix = "{$lang['nav_trennen']}";
}
}
if ($start >= 2) {
$pages .= "1 ... ";
}
for($j=$start; $j<=$end; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
if ($cstart != $enpages_count) {
$pages .= $nav_prefix."{$enpages_count}";
} else $pages .= "{$enpages_count}";
}
$tpl->set('{pages}', $pages);
}
//----------------------------------
// Next link
//----------------------------------
if($number < $count_all and $i set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1");
}else{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
}
if (!$no_prev or !$no_next){
$tpl->compile('content');
}
$tpl->clear();
?>
$tpl->load_template( 'users_search.tpl' );
$g = 0;
$_GET['count'] = intval($_GET['count']);
$_GET['order'] = addslashes($_GET['order']);
$_GET['sort'] = addslashes($_GET['sort']);
$_GET['usergroups'] = intval($_GET['usergroups']);
$_GET['login'] = addslashes($_GET['login']);
while ( $g++ <= 9 ){
$u = $g * 10;
if($_GET['count'] != $u)
$sel_num .= '';
else
$sel_num .= '';
}
$tpl->set('{count}', $sel_num);
$orders = array('name' => 'Логин', 'user_group' => 'Группа', 'reg_date' => 'Регистрация', 'lastdate' => 'Вход', 'news_num' => 'Новостей', 'comm_num' => 'Комментариев');
foreach ( $orders as $key => $value){
if($_GET['order'] == $key)
$order .= '';
else
$order .= '';
}
$tpl->set('{order}', $order);
$sorts = array('ASC' => 'По возрастанию', 'DESC' => 'По убыванию');
foreach ( $sorts as $key => $value){
if($_GET['sort'] == $key)
$sort .= '';
else
$sort .= '';
}
$tpl->set('{sort}', $sort);
$usergroups = $db->query( "SELECT * FROM " . USERPREFIX . "_usergroups");
while ( $row = $db->get_row( $usergroups ) ) {
if($_GET['usergroups'] == $row['id'])
$group_s .= '';
else
$group_s .= '';
}
$tpl->set('{usergroups}', $group_s);
if ($_GET['count'] != ""){
$searchcount = intval($_GET['count']);
$postfix .= "&count=$searchcount";
}else {
$searchcount = 10;
}
if($_GET['order'] != ""){
$order_by = $_GET['order'];
$postfix .= "&order=".$_GET['order'];
}else
$order_by = "user_group";
if ($_GET['sort'] != ""){
$sort_by = $_GET['sort'];
$postfix .= "&sort=".$_GET['sort'];
}else {
$sort_by = "ASC";
}
if ($_GET['usergroups'] != "" or $_GET['login'] != "") $where_w = "WHERE ";
if ($_GET['usergroups'] != ""){
$where_w .= "user_group=".$_GET['usergroups'];
$postfix .= "&usergroups=".$_GET['usergroups'];
}
if ($_GET['login'] != ""){
if ($_GET['usergroups'] != "") $where_w .= " AND ";
$where_w .= "name like '%".$_GET['login']."%'";
$postfix .= "&login=".$_GET['login'];
$login_val = $_GET['login'];
}
$tpl->set('{login}', $login_val);
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_users $where_w";
$row = $db->super_query($sql_count);
$count_all = $row['count'];
function pluralForm($count_all, $numb1, $numb2, $numb3)
{
$count_all = abs($count_all) % 100;
$n1 = $count_all % 10;
if ($count_all > 10 && $count_all 1 && $n1 set('{numbers}', pluralForm($count_all, 'Найден', 'Найдено', 'Найдено').' '.$count_all.' '.pluralForm($count_all, 'пользователь', 'пользвателя', 'пользователей'));
$tpl->compile('content');
if (!isset($cstart) or ($cstartquery( "SELECT * FROM " . USERPREFIX . "_users $where_w ORDER BY $order_by $sort_by LIMIT $cstartlimit,$searchcount");
$tpl->load_template( 'profile/users.tpl' );
while ( $row = $db->get_row( $sql_result ) ) {
if( $row['banned'] == 'yes' ) $user_group[$row['user_group']]['group_name'] = $lang['user_ban'];
$i++;
$tpl->set( '{numb}', "$i" );
if( $row['allow_mail'] ) {
if ( !$user_group[$member_id['user_group']]['allow_feed'] AND $row['user_group'] != 1 ){
$tpl->set_block( "'\\[email\\](.*?)\\[/email\\]'si", "" );
$tpl->set( '{email}', "" );
$tpl->set( '[not-email]', "" );
$tpl->set( '[/not-email]', "" );
}else{
$tpl->set( '[email]', "" );
$tpl->set( '[/email]', "" );
$tpl->set( '{email}', "$PHP_SELF?do=feedback&user=$row[user_id]" );
$tpl->set_block( "'\\[not-email\\](.*?)\\[/not-email\\]'si", "" );
}
} else {
$tpl->set_block( "'\\[email\\](.*?)\\[/email\\]'si", "" );
$tpl->set( '{email}', "" );
$tpl->set( '[not-email]', "" );
$tpl->set( '[/not-email]', "" );
}
if( $user_group[$member_id['user_group']]['allow_pm'] ) {
$tpl->set( '[pm]', "" );
$tpl->set( '[/pm]', "" );
$tpl->set( '{pm}', "$PHP_SELF?do=pm&doaction=newpm&user=" . $row['user_id'] );
$tpl->set_block( "'\\[not-pm\\](.*?)\\[/not-pm\\]'si", "" );
} else {
$tpl->set_block( "'\\[pm\\](.*?)\\[/pm\\]'si", "" );
$tpl->set( '{pm}', "" );
$tpl->set( '[not-pm]', "" );
$tpl->set( '[/not-pm]', "" );
}
if( $row['foto'] and (file_exists( ROOT_DIR . "/uploads/fotos/" . $row['foto'] )) ) $tpl->set( '{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto'] );
else $tpl->set( '{foto}', "{THEME}/images/noavatar.png" );
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if( $row['fullname'] ) {
$tpl->set( '[fullname]', "" );
$tpl->set( '[/fullname]', "" );
$tpl->set( '{fullname}', stripslashes( $row['fullname'] ) );
$tpl->set_block( "'\\[not-fullname\\](.*?)\\[/not-fullname\\]'si", "" );
} else {
$tpl->set_block( "'\\[fullname\\](.*?)\\[/fullname\\]'si", "" );
$tpl->set( '{fullname}', "" );
$tpl->set( '[not-fullname]', "" );
$tpl->set( '[/not-fullname]', "" );
}
if( $row['icq'] ) {
$tpl->set( '[icq]', "" );
$tpl->set( '[/icq]', "" );
$tpl->set( '{icq}', stripslashes( $row['icq'] ) );
$tpl->set_block( "'\\[not-icq\\](.*?)\\[/not-icq\\]'si", "" );
} else {
$tpl->set_block( "'\\[icq\\](.*?)\\[/icq\\]'si", "" );
$tpl->set( '{icq}', "" );
$tpl->set( '[not-icq]', "" );
$tpl->set( '[/not-icq]', "" );
}
if( $row['land'] ) {
$tpl->set( '[land]', "" );
$tpl->set( '[/land]', "" );
$tpl->set( '{land}', stripslashes( $row['land'] ) );
$tpl->set_block( "'\\[not-land\\](.*?)\\[/not-land\\]'si", "" );
} else {
$tpl->set_block( "'\\[land\\](.*?)\\[/land\\]'si", "" );
$tpl->set( '{land}', "" );
$tpl->set( '[not-land]', "" );
$tpl->set( '[/not-land]', "" );
}
if( $row['info'] ) {
$tpl->set( '[info]', "" );
$tpl->set( '[/info]', "" );
$tpl->set( '{info}', stripslashes( $row['info'] ) );
$tpl->set_block( "'\\[not-info\\](.*?)\\[/not-info\\]'si", "" );
} else {
$tpl->set_block( "'\\[info\\](.*?)\\[/info\\]'si", "" );
$tpl->set( '{info}', "" );
$tpl->set( '[not-info]', "" );
$tpl->set( '[/not-info]', "" );
}
if ( ($row['lastdate'] + 1200) > $_TIME ) {
$tpl->set( '[online]', "" );
$tpl->set( '[/online]', "" );
$tpl->set_block( "'\\[offline\\](.*?)\\[/offline\\]'si", "" );
} else {
$tpl->set( '[offline]', "" );
$tpl->set( '[/offline]', "" );
$tpl->set_block( "'\\[online\\](.*?)\\[/online\\]'si", "" );
}
$tpl->set( '{status}', $user_group[$row['user_group']]['group_prefix'].$user_group[$row['user_group']]['group_name'].$user_group[$row['user_group']]['group_suffix'] );
$tpl->set( '{registration}', langdate( "j F Y H:i", $row['reg_date'] ) );
$tpl->set( '{lastdate}', langdate( "j F Y H:i", $row['lastdate'] ) );
if( $user_group[$row['user_group']]['icon'] ) $tpl->set( '{group-icon}', "" );
else $tpl->set( '{group-icon}', "" );
if( $is_logged and $user_group[$row['user_group']]['time_limit'] and ($member_id['user_id'] == $row['user_id'] or $member_id['user_group'] set_block( "'\\[time_limit\\](.*?)\\[/time_limit\\]'si", "\\1" );
if( $row['time_limit'] ) {
$tpl->set( '{time_limit}', langdate( "j F Y H:i", $row['time_limit'] ) );
} else {
$tpl->set( '{time_limit}', $lang['no_limit'] );
}
} else {
$tpl->set_block( "'\\[time_limit\\](.*?)\\[/time_limit\\]'si", "" );
}
if( $row['comm_num'] ) {
$tpl->set( '[comm-num]', "" );
$tpl->set( '[/comm-num]', "" );
$tpl->set( '{comm-num}', $row['comm_num'] );
$tpl->set( '{comments}', "" . $lang['last_comm'] . "" );
$tpl->set_block( "'\\[not-comm-num\\](.*?)\\[/not-comm-num\\]'si", "" );
} else {
$tpl->set( '{comments}', $lang['last_comm'] );
$tpl->set( '{comm-num}', 0 );
$tpl->set_block( "'\\[comm-num\\](.*?)\\[/comm-num\\]'si", "" );
$tpl->set( '[not-comm-num]', "" );
$tpl->set( '[/not-comm-num]', "" );
}
if( $row['news_num'] ) {
if( $config['allow_alt_url'] == "yes" ) {
$tpl->set( '{news}', "" . $lang['all_user_news'] . "" );
$tpl->set( '[rss]', "" );
$tpl->set( '[/rss]', "" );
} else {
$tpl->set( '{news}', "" . $lang['all_user_news'] . "" );
$tpl->set( '[rss]', "" );
$tpl->set( '[/rss]', "" );
}
$tpl->set( '{news-num}', $row['news_num'] );
$tpl->set( '[news-num]', "" );
$tpl->set( '[/news-num]', "" );
$tpl->set_block( "'\\[not-news-num\\](.*?)\\[/not-news-num\\]'si", "" );
} else {
$tpl->set( '{news}', $lang['all_user_news'] );
$tpl->set_block( "'\\[rss\\](.*?)\\[/rss\\]'si", "" );
$tpl->set( '{news-num}', 0 );
$tpl->set_block( "'\\[news-num\\](.*?)\\[/news-num\\]'si", "" );
$tpl->set( '[not-news-num]', "" );
$tpl->set( '[/not-news-num]', "" );
}
if( $row['signature'] and $user_group[$row['user_group']]['allow_signature'] ) {
$tpl->set_block( "'\\[signature\\](.*?)\\[/signature\\]'si", "\\1" );
$tpl->set( '{signature}', stripslashes( $row['signature'] ) );
} else {
$tpl->set_block( "'\\[signature\\](.*?)\\[/signature\\]'si", "" );
$tpl->set( '{signature}', "" );
}
if( $config['allow_alt_url'] == "yes" ){
$profile = $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/" ;
}else{
$profile = $PHP_SELF . "?subaction=userinfo&user=" . urlencode( $row['name'] ) ;
}
$tpl->set( '{profile}', $profile );
$tpl->set( '{profile_m}', "onclick=\"ShowProfile('" . urlencode( $row['name'] ) . "', '" . $profile . "', '" . $user_group[$member_id['user_group']]['admin_editusers'] . "'); return false;\"" );
$xfieldsaction = "list";
$xfieldsadd = false;
$xfieldsid = $row['xfields'];
include (ENGINE_DIR . '/inc/userfields.php');
$tpl->set( '{xfields}', $output );
// Обработка дополнительных полей
$xfieldsdata = xfieldsdataload( $row['xfields'] );
foreach ( $xfields as $value ) {
$preg_safe_name = preg_quote( $value[0], "'" );
if( $value[5] != 1 OR ($is_logged AND $member_id['user_group'] == 1) OR ($is_logged AND $member_id['user_id'] == $row['user_id']) ) {
if( empty( $xfieldsdata[$value[0]] ) ) {
$tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[/xfnotgiven_{$preg_safe_name}]", "", $tpl->copy_template );
} else {
$tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[xfgiven_{$preg_safe_name}]", "", $tpl->copy_template );
$tpl->copy_template = str_replace( "[/xfgiven_{$preg_safe_name}]", "", $tpl->copy_template );
}
$tpl->copy_template = preg_replace( "'\\[xfvalue_{$preg_safe_name}\\]'i", stripslashes( $xfieldsdata[$value[0]] ), $tpl->copy_template );
} else {
$tpl->copy_template = preg_replace( "'\\[xfgiven_{$preg_safe_name}\\](.*?)\\[/xfgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
$tpl->copy_template = preg_replace( "'\\[xfvalue_{$preg_safe_name}\\]'i", "", $tpl->copy_template );
$tpl->copy_template = preg_replace( "'\\[xfnotgiven_{$preg_safe_name}\\](.*?)\\[/xfnotgiven_{$preg_safe_name}\\]'is", "", $tpl->copy_template );
}
}
// Обработка дополнительных полей
$tpl->compile( 'content' );
}
$tpl->clear();
$db->free( $sql_result );
//####################################################################################################################
// Навигация по пользователям
//####################################################################################################################
$number = $searchcount;
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 1){
$prev = $cstart-1;
if ($prev == 1)
$prev_page = $PHP_SELF . "?do=users" . $postfix;
else
$prev_page = $PHP_SELF . "?do=users&cstart=" . $prev . $postfix;
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
}else{
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
$no_prev = TRUE;
}
//----------------------------------
// Pages
//----------------------------------
if($number){
$enpages_count = @ceil($count_all/$number);
$pages = "";
if ($enpages_count <= 10 ) {
for($j=1; $j<=$enpages_count; $j++){
if($j != $cstart) {
if ($j == 1)
$pages .= "$j ";
else
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
} else {
$start =1;
$end = 10;
$nav_prefix = "{$lang['nav_trennen']}";
if ($cstart > 0) {
if ($cstart > 6) {
$start = $cstart - 4;
$end = $start + 8;
if ($end >= $enpages_count) {
$start = $enpages_count - 9;
$end = $enpages_count - 1;
$nav_prefix = "";
} else $nav_prefix = "{$lang['nav_trennen']}";
}
}
if ($start >= 2) {
$pages .= "1 ... ";
}
for($j=$start; $j<=$end; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
if ($cstart != $enpages_count) {
$pages .= $nav_prefix."{$enpages_count}";
} else $pages .= "{$enpages_count}";
}
$tpl->set('{pages}', $pages);
}
//----------------------------------
// Next link
//----------------------------------
if($number < $count_all and $i set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1");
}else{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
}
if (!$no_prev or !$no_next){
$tpl->compile('content');
}
$tpl->clear();
?>
<?php
/*
=====================================================
Member's List v1.0
-----------------------------------------------------
Copyright (c) 2012
=====================================================
Версия движка: 9.6
=====================================================
Файл: members.php
-----------------------------------------------------
Назначение: Members list
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
///////////////////////////////////////
// Ф-ии
///////////////////////////////////////
function convertorderbyin($orderby) {
if ($orderby == "nameA") $orderby = "name ASC";
if ($orderby == "nameD") $orderby = "name DESC";
if ($orderby == "fnameA") $orderby = "fullname ASC";
if ($orderby == "fnameD") $orderby = "fullname DESC";
if ($orderby == "dataregA") $orderby = "reg_date ASC";
if ($orderby == "dataregD") $orderby = "reg_date DESC";
if ($orderby == "datalastA") $orderby = "lastdate ASC";
if ($orderby == "datalastD") $orderby = "lastdate DESC";
if ($orderby == "groupA") $orderby = "user_group ASC";
if ($orderby == "groupD") $orderby = "user_group DESC";
if ($orderby == "ccommA") $orderby = "comm_num ASC";
if ($orderby == "ccommD") $orderby = "comm_num DESC";
if ($orderby == "cpublicA") $orderby = "news_num ASC";
if ($orderby == "cpublicD") $orderby = "news_num DESC";
return $orderby;
}
function striporderby($orderby) {
if (($orderby == "nameA") or ($orderby == "nameD")) $xreturn = "name";
if (($orderby == "fnameA") or ($orderby == "fnameD")) $xreturn = "fname";
if (($orderby == "groupA") or ($orderby == "groupD")) $xreturn = "group";
if (($orderby == "dataregA") or ($orderby == "dataregD")) $xreturn = "datareg";
if (($orderby == "datalastA") or ($orderby == "datalastD")) $xreturn = "datalast";
if (($orderby == "cpublicA") or ($orderby == "cpublicD")) $xreturn = "cpublic";
if (($orderby == "ccommA") or ($orderby == "ccommD")) $xreturn = "ccomm";
return $xreturn;
}
function createsortlink($uplink,$downlink,$postfix) {
$xreturn = '';
return $xreturn;
}
///////////////////////////////////////
// запросы
///////////////////////////////////////
$postfix = '';
if (isset($_GET['count']))
$searchcount = intval($_GET['count']);
else
$searchcount = 10;
if (isset($_GET['name']))
$searchname = $_GET['name'];
else
$searchname = '';
if (isset($_GET['orderby']))
$orderby = $_GET['orderby'];
else
$orderby = 'dataregA';
$stporder = striporderby($orderby);
$sqlorderby = convertorderbyin($orderby);
///////////////////////////////////////
// End запросы
///////////////////////////////////////
///////////////////////////////////////
// Поиск
///////////////////////////////////////
if (!isset($cstart) or ($cstartsafesql($sql);
$sql_result = $db->query($sql);
$entries_showed = 0;
$entries = "";
$i = 0;
$tpl->load_template('members.tpl');
while($row = $db->get_row($sql_result)) {
$username = stripslashes($row['name']);
// /index.php?subaction=userinfo&user=
$username = ''.$username.'';
$tpl->set('{Name}', $username);
$tpl->set('{FullName}', stripslashes($row['fullname']));
$tpl->set('{DataReg}', langdate($config['timestamp_active'], $row['reg_date']));
$tpl->set('{Group}', stripslashes($user_group[$row['user_group']]['group_name']));
$tpl->set('{DataLast}', langdate($config['timestamp_active'], $row['lastdate']));
$tpl->set( '{Icq}', stripslashes( $row['icq'] ) );
$tpl->set( '{login}', $member_id['name'] );
$tpl->set( '{id}', $row['user_id'] );
@include (ENGINE_DIR.'/modules/repa_out.php');
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if( $row['foto'] and (file_exists( ROOT_DIR . "/uploads/fotos/" . $row['foto'] )) ) $tpl->set( '{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto'] );
else $tpl->set( '{foto}', "{THEME}/images/noavatar.png" );
#**********************************************************
# Статус пользователя
#**********************************************************
$fuser_status = '';
$timer = 10;
$dtime_1 = ( time() + ($config['date_adjust']*60) - ($timer*60) );
$dtime_2 = ( time() + ($config['date_adjust']*60) + ($timer*60) );
if( $row['lastdate'] > $dtime_1 AND $row['lastdate'] set('{statuson}', ""); else $tpl->set('{statuson}', "");
#**********************************************************
# Статус пользователя
#**********************************************************
if ($row['comm_num']>0)
$tpl->set('{Comm}',$row['comm_num']);
else
$tpl->set('{Comm}','0');
if ($row['news_num']>0)
$tpl->set('{Public}',$row['news_num']);
else
$tpl->set('{Public}','0');
/*
if ($row['allow_mail']){
$email = explode("@", $row['email'], 2);
$tpl->set('{email}', "".$lang['news_mail']."");
} else {
$tpl->set('{email}', $lang['news_nomail'], $output);
}*/
/*
$tpl->set('{pm}', "".$lang['news_pmnew']."");
if (!$row['allow_mail']) $mailbox = "checked"; else $mailbox = "";
$tpl->set('{hidemail}', " ".$lang['news_noamail']);
*/
$tpl->compile('SearchResult');
}
$tpl->clear();
///////////////////////////////////////
// End Поиск
///////////////////////////////////////
///////////////////////////////////////
// Вывод заголовка таблицы юзеров
///////////////////////////////////////
$tpl->load_template('members_list.tpl');
if ($searchcount!=10)
$postfix .= '&count='.$searchcount;
if ($searchname!='')
$postfix .= '&name='.$searchname;
$tpl->set('{SortName}', createsortlink('nameA','nameD',$postfix));
$tpl->set('{SortFullName}', createsortlink('fnameA','fnameD',$postfix));
$tpl->set('{SortGroup}', createsortlink('groupA','groupD',$postfix));
$tpl->set('{SortDataReg}', createsortlink('dataregA','dataregD',$postfix));
$tpl->set('{SortDataLast}', createsortlink('datalastA','datalastD',$postfix));
$tpl->set('{SortPublic}', createsortlink('cpublicA','cpublicD',$postfix));
$tpl->set('{SortComm}', createsortlink('ccommA','ccommD',$postfix));
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if ($orderby!='dataregA')
$postfix .= '&orderby='.$orderby;
if ($stporder=='name') {
$tpl->set('[SortName]','');
$tpl->set('[/SortName]','');
} else {
$tpl->set('[SortName]','');
$tpl->set('[/SortName]','');
}
if ($stporder=='fname') {
$tpl->set('[SortFullName]','');
$tpl->set('[/SortFullName]','');
} else {
$tpl->set('[SortFullName]','');
$tpl->set('[/SortFullName]','');
}
if ($stporder=='group') {
$tpl->set('[SortGroup]','');
$tpl->set('[/SortGroup]','');
} else {
$tpl->set('[SortGroup]','');
$tpl->set('[/SortGroup]','');
}
if ($stporder=='datareg') {
$tpl->set('[SortDataReg]','');
$tpl->set('[/SortDataReg]','');
} else {
$tpl->set('[SortDataReg]','');
$tpl->set('[/SortDataReg]','');
}
if ($stporder=='datalast') {
$tpl->set('[SortDataLast]','');
$tpl->set('[/SortDataLast]','');
} else {
$tpl->set('[SortDataLast]','');
$tpl->set('[/SortDataLast]','');
}
if ($stporder=='cpublic') {
$tpl->set('[SortPublic]','');
$tpl->set('[/SortPublic]','');
} else {
$tpl->set('[SortPublic]','');
$tpl->set('[/SortPublic]','');
}
if ($stporder=='ccomm') {
$tpl->set('[SortComm]','');
$tpl->set('[/SortComm]','');
} else {
$tpl->set('[SortComm]','');
$tpl->set('[/SortComm]','');
}
/////////////////////////
// Вывод найденного
/////////////////////////
$tpl->set('{SearchResult}', $tpl->result["SearchResult"]);
/////////////////////////
// End Вывод найденного
/////////////////////////
/////////////////////////
// Опции поиска
/////////////////////////
$SearchOptions = '');
$tpl->set('{SearchByName}','');
$SearchCountResult = '';
$tpl->set('{SearchCountResult}',$SearchCountResult);
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
$tpl->set('{SearchBtn}','');
/////////////////////////
// End Опции поиска
/////////////////////////
$tpl->compile('content');
$tpl->clear();
///////////////////////////////////////
// Навигация
///////////////////////////////////////
$number = $searchcount;
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 1){
$prev = $cstart-1;
$prev_page = $PHP_SELF."?cstart=".$prev."&do=members".$postfix;
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
}else{
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
$no_prev = TRUE;
}
//----------------------------------
// Pages
//----------------------------------
if($number){
$row = $db->super_query($sql_count);
$count_all = $row['count'];
$enpages_count = @ceil($count_all/$number);
$pages = "";
if ($enpages_count <= 10 ) {
for($j=1; $j<=$enpages_count; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
} else {
$start =1;
$end = 10;
$nav_prefix = "... ";
if ($cstart > 0) {
if ($cstart > 5) {
$start = $cstart - 4;
$end = $start + 8;
if ($end >= $enpages_count) {
$start = $enpages_count - 9;
$end = $enpages_count - 1;
$nav_prefix = "";
} else $nav_prefix = "... ";
}
}
if ($start >= 2) {
$pages .= "1 ... ";
}
for($j=$start; $j<=$end; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
if ($cstart != $enpages_count) {
$pages .= $nav_prefix."{$enpages_count}";
} else $pages .= "{$enpages_count} ";
}
$tpl->set('{pages}', $pages);
}
//----------------------------------
// Next link
//----------------------------------
if($number < $count_all and $i set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1");
}else{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
}
if (!$no_prev or !$no_next){
$tpl->compile('content');
};
$tpl->clear();
///////////////////////////////////////
// End Навигация
///////////////////////////////////////
?>
/*
=====================================================
Member's List v1.0
-----------------------------------------------------
Copyright (c) 2012
=====================================================
Версия движка: 9.6
=====================================================
Файл: members.php
-----------------------------------------------------
Назначение: Members list
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
///////////////////////////////////////
// Ф-ии
///////////////////////////////////////
function convertorderbyin($orderby) {
if ($orderby == "nameA") $orderby = "name ASC";
if ($orderby == "nameD") $orderby = "name DESC";
if ($orderby == "fnameA") $orderby = "fullname ASC";
if ($orderby == "fnameD") $orderby = "fullname DESC";
if ($orderby == "dataregA") $orderby = "reg_date ASC";
if ($orderby == "dataregD") $orderby = "reg_date DESC";
if ($orderby == "datalastA") $orderby = "lastdate ASC";
if ($orderby == "datalastD") $orderby = "lastdate DESC";
if ($orderby == "groupA") $orderby = "user_group ASC";
if ($orderby == "groupD") $orderby = "user_group DESC";
if ($orderby == "ccommA") $orderby = "comm_num ASC";
if ($orderby == "ccommD") $orderby = "comm_num DESC";
if ($orderby == "cpublicA") $orderby = "news_num ASC";
if ($orderby == "cpublicD") $orderby = "news_num DESC";
return $orderby;
}
function striporderby($orderby) {
if (($orderby == "nameA") or ($orderby == "nameD")) $xreturn = "name";
if (($orderby == "fnameA") or ($orderby == "fnameD")) $xreturn = "fname";
if (($orderby == "groupA") or ($orderby == "groupD")) $xreturn = "group";
if (($orderby == "dataregA") or ($orderby == "dataregD")) $xreturn = "datareg";
if (($orderby == "datalastA") or ($orderby == "datalastD")) $xreturn = "datalast";
if (($orderby == "cpublicA") or ($orderby == "cpublicD")) $xreturn = "cpublic";
if (($orderby == "ccommA") or ($orderby == "ccommD")) $xreturn = "ccomm";
return $xreturn;
}
function createsortlink($uplink,$downlink,$postfix) {
$xreturn = '';
return $xreturn;
}
///////////////////////////////////////
// запросы
///////////////////////////////////////
$postfix = '';
if (isset($_GET['count']))
$searchcount = intval($_GET['count']);
else
$searchcount = 10;
if (isset($_GET['name']))
$searchname = $_GET['name'];
else
$searchname = '';
if (isset($_GET['orderby']))
$orderby = $_GET['orderby'];
else
$orderby = 'dataregA';
$stporder = striporderby($orderby);
$sqlorderby = convertorderbyin($orderby);
///////////////////////////////////////
// End запросы
///////////////////////////////////////
///////////////////////////////////////
// Поиск
///////////////////////////////////////
if (!isset($cstart) or ($cstartsafesql($sql);
$sql_result = $db->query($sql);
$entries_showed = 0;
$entries = "";
$i = 0;
$tpl->load_template('members.tpl');
while($row = $db->get_row($sql_result)) {
$username = stripslashes($row['name']);
// /index.php?subaction=userinfo&user=
$username = ''.$username.'';
$tpl->set('{Name}', $username);
$tpl->set('{FullName}', stripslashes($row['fullname']));
$tpl->set('{DataReg}', langdate($config['timestamp_active'], $row['reg_date']));
$tpl->set('{Group}', stripslashes($user_group[$row['user_group']]['group_name']));
$tpl->set('{DataLast}', langdate($config['timestamp_active'], $row['lastdate']));
$tpl->set( '{Icq}', stripslashes( $row['icq'] ) );
$tpl->set( '{login}', $member_id['name'] );
$tpl->set( '{id}', $row['user_id'] );
@include (ENGINE_DIR.'/modules/repa_out.php');
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if( $row['foto'] and (file_exists( ROOT_DIR . "/uploads/fotos/" . $row['foto'] )) ) $tpl->set( '{foto}', $config['http_home_url'] . "uploads/fotos/" . $row['foto'] );
else $tpl->set( '{foto}', "{THEME}/images/noavatar.png" );
#**********************************************************
# Статус пользователя
#**********************************************************
$fuser_status = '';
$timer = 10;
$dtime_1 = ( time() + ($config['date_adjust']*60) - ($timer*60) );
$dtime_2 = ( time() + ($config['date_adjust']*60) + ($timer*60) );
if( $row['lastdate'] > $dtime_1 AND $row['lastdate'] set('{statuson}', ""); else $tpl->set('{statuson}', "");
#**********************************************************
# Статус пользователя
#**********************************************************
if ($row['comm_num']>0)
$tpl->set('{Comm}',$row['comm_num']);
else
$tpl->set('{Comm}','0');
if ($row['news_num']>0)
$tpl->set('{Public}',$row['news_num']);
else
$tpl->set('{Public}','0');
/*
if ($row['allow_mail']){
$email = explode("@", $row['email'], 2);
$tpl->set('{email}', "".$lang['news_mail']."");
} else {
$tpl->set('{email}', $lang['news_nomail'], $output);
}*/
/*
$tpl->set('{pm}', "".$lang['news_pmnew']."");
if (!$row['allow_mail']) $mailbox = "checked"; else $mailbox = "";
$tpl->set('{hidemail}', " ".$lang['news_noamail']);
*/
$tpl->compile('SearchResult');
}
$tpl->clear();
///////////////////////////////////////
// End Поиск
///////////////////////////////////////
///////////////////////////////////////
// Вывод заголовка таблицы юзеров
///////////////////////////////////////
$tpl->load_template('members_list.tpl');
if ($searchcount!=10)
$postfix .= '&count='.$searchcount;
if ($searchname!='')
$postfix .= '&name='.$searchname;
$tpl->set('{SortName}', createsortlink('nameA','nameD',$postfix));
$tpl->set('{SortFullName}', createsortlink('fnameA','fnameD',$postfix));
$tpl->set('{SortGroup}', createsortlink('groupA','groupD',$postfix));
$tpl->set('{SortDataReg}', createsortlink('dataregA','dataregD',$postfix));
$tpl->set('{SortDataLast}', createsortlink('datalastA','datalastD',$postfix));
$tpl->set('{SortPublic}', createsortlink('cpublicA','cpublicD',$postfix));
$tpl->set('{SortComm}', createsortlink('ccommA','ccommD',$postfix));
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
if ($orderby!='dataregA')
$postfix .= '&orderby='.$orderby;
if ($stporder=='name') {
$tpl->set('[SortName]','');
$tpl->set('[/SortName]','');
} else {
$tpl->set('[SortName]','');
$tpl->set('[/SortName]','');
}
if ($stporder=='fname') {
$tpl->set('[SortFullName]','');
$tpl->set('[/SortFullName]','');
} else {
$tpl->set('[SortFullName]','');
$tpl->set('[/SortFullName]','');
}
if ($stporder=='group') {
$tpl->set('[SortGroup]','');
$tpl->set('[/SortGroup]','');
} else {
$tpl->set('[SortGroup]','');
$tpl->set('[/SortGroup]','');
}
if ($stporder=='datareg') {
$tpl->set('[SortDataReg]','');
$tpl->set('[/SortDataReg]','');
} else {
$tpl->set('[SortDataReg]','');
$tpl->set('[/SortDataReg]','');
}
if ($stporder=='datalast') {
$tpl->set('[SortDataLast]','');
$tpl->set('[/SortDataLast]','');
} else {
$tpl->set('[SortDataLast]','');
$tpl->set('[/SortDataLast]','');
}
if ($stporder=='cpublic') {
$tpl->set('[SortPublic]','');
$tpl->set('[/SortPublic]','');
} else {
$tpl->set('[SortPublic]','');
$tpl->set('[/SortPublic]','');
}
if ($stporder=='ccomm') {
$tpl->set('[SortComm]','');
$tpl->set('[/SortComm]','');
} else {
$tpl->set('[SortComm]','');
$tpl->set('[/SortComm]','');
}
/////////////////////////
// Вывод найденного
/////////////////////////
$tpl->set('{SearchResult}', $tpl->result["SearchResult"]);
/////////////////////////
// End Вывод найденного
/////////////////////////
/////////////////////////
// Опции поиска
/////////////////////////
$SearchOptions = '');
$tpl->set('{SearchByName}','');
$SearchCountResult = '';
$tpl->set('{SearchCountResult}',$SearchCountResult);
$tpl->set( '{usertitle}', stripslashes( $row['name'] ) );
$tpl->set('{SearchBtn}','');
/////////////////////////
// End Опции поиска
/////////////////////////
$tpl->compile('content');
$tpl->clear();
///////////////////////////////////////
// Навигация
///////////////////////////////////////
$number = $searchcount;
$tpl->load_template('navigation.tpl');
//----------------------------------
// Previous link
//----------------------------------
if($cstart > 1){
$prev = $cstart-1;
$prev_page = $PHP_SELF."?cstart=".$prev."&do=members".$postfix;
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
}else{
$tpl->set_block("'\[prev-link\](.*?)\[/prev-link\]'si", "\\1");
$no_prev = TRUE;
}
//----------------------------------
// Pages
//----------------------------------
if($number){
$row = $db->super_query($sql_count);
$count_all = $row['count'];
$enpages_count = @ceil($count_all/$number);
$pages = "";
if ($enpages_count <= 10 ) {
for($j=1; $j<=$enpages_count; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
} else {
$start =1;
$end = 10;
$nav_prefix = "... ";
if ($cstart > 0) {
if ($cstart > 5) {
$start = $cstart - 4;
$end = $start + 8;
if ($end >= $enpages_count) {
$start = $enpages_count - 9;
$end = $enpages_count - 1;
$nav_prefix = "";
} else $nav_prefix = "... ";
}
}
if ($start >= 2) {
$pages .= "1 ... ";
}
for($j=$start; $j<=$end; $j++){
if($j != $cstart) {
$pages .= "$j ";
} else {
$pages .= "$j ";
}
}
if ($cstart != $enpages_count) {
$pages .= $nav_prefix."{$enpages_count}";
} else $pages .= "{$enpages_count} ";
}
$tpl->set('{pages}', $pages);
}
//----------------------------------
// Next link
//----------------------------------
if($number < $count_all and $i set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1");
}else{
$tpl->set_block("'\[next-link\](.*?)\[/next-link\]'si", "\\1"); $no_next = TRUE;
}
if (!$no_prev or !$no_next){
$tpl->compile('content');
};
$tpl->clear();
///////////////////////////////////////
// End Навигация
///////////////////////////////////////
?>
Файл users_search.tpl - users_search.rar [394 b] (cкачиваний: 8)