registerFunction('descr', XAJAX_POST, '/load_descr.php'); $xajax->registerFunction('who_my_friends', XAJAX_POST, '/index.php'); $xajax->registerFunction('who_friends', XAJAX_POST, '/index.php'); $xajax->registerFunction('user_menu', XAJAX_POST, '/index.php'); $xajax->processRequests(); $args["xajax_code.body_html"] = $xajax->getJavascript(); //-----xajax------ function who_my_friends($user_id) { global $s_id, $g_root_web_dir; if (!$s_id) { return; } $resp = new xajaxResponse(); require_once($g_root_web_dir."/templater/templater.php"); $html = ''; $limit = 10; $query[0] = "SELECT friend_user_id FROM friend_users WHERE friend_users.member_id=".intval($user_id)." ORDER BY id ASC LIMIT ".$limit.",1000"; $result[0] = get_mysql_result(" $query[0]") or die("err5"); if (mysql_numrows($result[0]) > 0) { $author_id = array(); while ($data = mysql_fetch_row($result[0])) { $author_id[] = $data[0]; } $user_data = get_author($author_id, 'mas'); for ($a = 0; $a < sizeof($author_id); $a++) { $print_user = print_user($user_data[$a]); $args["my_friends_block.datasrc"][] = array( "avatar.body_html" => $print_user['avatar'], "user_text.body_html" => $print_user['text'], ); } } if (!is_array($args["my_friends_block.datasrc"]) or count($args["my_friends_block.datasrc"]) == 0) { $resp->addAlert("Больше друзей нет :)"); return $resp; } foreach ($args["my_friends_block.datasrc"] as $key => $datasrc) { $d = array(); $html .= process_template_initial("who_friend_include.html", $datasrc, $d, '', true); } $resp->addRemove("xajax_my_friends_link"); $resp->addAppend("my_friends_content", 'innerHTML', $html); return $resp; } function who_friends($user_id) { global $s_id, $g_root_web_dir; if (!$s_id) { return; } $resp = new xajaxResponse(); require_once($g_root_web_dir."/templater/templater.php"); $html = ''; $limit = 2; $query[0] = "SELECT member_id FROM friend_users WHERE friend_users.friend_user_id=".intval($user_id)." ORDER BY id ASC LIMIT ".$limit.",1000"; $result[0] = get_mysql_result(" $query[0]") or die("err5"); if (mysql_numrows($result[0]) > 0) { $author_id = array(); while ($data = mysql_fetch_row($result[0])) { $author_id[] = $data[0]; } $user_data = get_author($author_id, 'mas'); for ($a = 0; $a < sizeof($author_id); $a++) { $print_user = print_user($user_data[$a]); $args["my_friends_block.datasrc"][] = array( "avatar.body_html" => $print_user['avatar'], "user_text.body_html" => $print_user['text'], ); } } if (!is_array($args["my_friends_block.datasrc"]) or count($args["my_friends_block.datasrc"]) == 0) { $resp->addAlert("Больше друзей нет :)"); return $resp; } foreach ($args["my_friends_block.datasrc"] as $key => $datasrc) { $d = array(); $html .= process_template_initial("who_friend_include.html", $datasrc, $d, '', true); } $resp->addRemove("xajax_my_friends2_link"); $resp->addAppend("friends_content", 'innerHTML', $html); return $resp; } function user_menu($id) { global $s_id, $s_moder, $s_moder_strike, $g_root_web_dir; global $friend_user_id,$fun_http_host,$main_http_host; $args["fun_http_host"] = $fun_http_host; $args["main_http_host"] = $main_http_host; $resp = new xajaxResponse(); if (!($id > 0)) { $resp->addAlert("Корявый параметр"); return $resp; } $author = get_author($id); if (!$author['author_id']) { $resp->addAlert("Участник не найден"); return $resp; } require_once($g_root_web_dir."/templater/t_settings.php"); $print_user = print_user($author); $args['avatar_big.body_html'] = $print_user['avatar_big_nolink']; $args['user_name.body'] = $author['author_name']; $args['user_link.href.user_name'] = $author['author_name']; $args['user_link.onclick.author_id'] = $author['author_id']; $args['relation.onclick.author_id'] = $author['author_id']; $args['user_div.id.author_id'] = $author['author_id']; $args['user_div.class.author_id'] = $author['author_id']; $args['user_div.onclick.author_id'] = $author['author_id']; $args['user_div.onsubmit.author_id'] = $author['author_id']; $args['post_count.body'] = $author['cache_news']; $args['comment_count.body'] = $author['cache_comments']; if($s_moder==1) { $args['no_banned_comments.visible'] = 1; $args['no_banned_spam.visible'] = 1; $args['no_banned_news.visible'] = 1; if($s_id==3) { //$args['no_banned_news.visible'] = 1; //админ $args['admin_ban.visible'] = 1; //админ } } $args['banned.visible'] = 0; $q = get_mysql_result("SELECT * FROM ban WHERE id_user = '".$author['author_id']."' AND till_timestamp > '".time()."' "); while ($ban=mysql_fetch_array($q)) { if($ban['ban_type']==1) { if($ban['ban_status']==1) { $args['banned_comments.visible'] = 1; $args['time_1'] = date("d.m.Y G:i",$ban['till_timestamp']); } if($ban['ban_status']==1 || $ban['id_moder']==$s_id) { $args['no_banned_comments.visible'] = 0; } } if($ban['ban_type']==2) { if($ban['ban_status']==1) { $args['banned_news.visible'] = 1; $args['time_2'] = date("d.m.Y G:i",$ban['till_timestamp']); } if($ban['ban_status']==1 || $ban['id_moder']==$s_id) { $args['no_banned_news.visible'] = 0; } } if($ban['ban_type']==3) { if($ban['ban_status']==1) { $args['banned_spam.visible'] = 1; $args['time_3'] = date("d.m.Y G:i",$ban['till_timestamp']); } if($ban['ban_status']==1 || $ban['id_moder']==$s_id) { $args['no_banned_spam.visible'] = 0; } } $args['banned.visible'] = 1; } if($author['website']!='' && $author['website']!='http://') { $args['website_field.visible'] = 1; $args['website'] = $author['website']; } if($author['facebook']!='') { $args['facebook_field.visible'] = 1; $args['facebook'] = $author['facebook']; } if($author['vkontakte']!='') { $args['vkontakte_field.visible'] = 1; $args['vkontakte'] = $author['vkontakte']; } if($author['twitter']!='') { $args['twitter_field.visible'] = 1; $args['twitter'] = $author['twitter']; } if($args['website']!='' || $args['facebook']!='' || $args['vkontakte']!='' || $args['twitter']!='') $args['social_field.visible'] = 1; if($author['extra']!='') { $author['extra'] = strip_tags($author['extra']); //if(mb_strlen($author['extra'])>100) { //$author['extra'] = mb_substr($author['extra'], 0, 100).'...
[полный текст в профиле]
'; } $args['extra_field.visible'] = 1; $args['extra'] = $author['extra']; } $online_users = cache_get_online_users(); if (in_array($id, $online_users)) { $args['online.visible'] = 1; } $isfriend = in_array($author['author_id'], $friend_user_id); if ($s_id != $id && $s_id !='') { if (!$isfriend) { $args["add_to_friends.visible"] = 1; } else { $args["del_from_friends.visible"] = 1; } if ($s_id > 0) { $args['user_relations_block.visible'] = 1; $kol_1=0; $kol_2=0; $kol_3=0; $class_name_1=''; $class_name_2=''; $class_name_3=''; $query[0] = "SELECT score, user_id FROM user_relations WHERE ranked_user_id='".$author['author_id']."' "; $result[0] = get_mysql_result(" $query[0]") or die("already"); while ($data_rel=mysql_fetch_row($result[0])) { if ($s_id == $data_rel[1]) { if ($data_rel[0] == 1) $class_name_1 = ' current'; if ($data_rel[0] == 2) $class_name_2 = ' current'; if ($data_rel[0] == 3) $class_name_3 = ' current'; } if ($data_rel[0] == 1) $kol_1++; if ($data_rel[0] == 2) $kol_2++; if ($data_rel[0] == 3) $kol_3++; } if($class_name_1 =='' && $class_name_2 == '' && $class_name_3 == '') { $class_name_2 = ' current'; } //if($class_name_1=='' && $class_name_2=='' && $class_name_3=='') $class_name_2 = ' current'; if($class_name_1=='') $class_name_1=' not_current'; if($class_name_2=='') $class_name_2=' not_current'; if($class_name_3=='') $class_name_3=' not_current'; $args["relation_li.class.class_name_1"] = $class_name_1; $args["relation_li.class.class_name_2"] = $class_name_2; $args["relation_li.class.class_name_3"] = $class_name_3; $args["relation_box.class.ranked_user_id"] = $author['author_id']; $args["relation.onclick.author_id"] = $author["author_id"]; $args["kol_1.body"] = $kol_1; $args["kol_2.body"] = $kol_2; $args["kol_3.body"] = $kol_3; } } $html = t_process("user_menu_include.html", $args, array(), true); $resp->addScript("set_user_menu(".$id.",'".js_mysql_real_escape_string($html)."');"); return $resp; } /////////////////////////////////////////////////// $rewrite = $_GET['rewrite']; $filters = initialize_filters($rewrite); //print_r($filters); if($_SERVER["HTTP_HOST"]==$fun_http_host) { $args['canonical_link'] = "https://".$fun_http_host.modify_url('', '');; $args["fun_block.visible"] = 1; } else { $args['canonical_link'] = "https://".$main_http_host.modify_url('', '');; $args["not_fun_block.visible"] = 1; } /////////////////////////////////////////////////// /*if ($filters['object'] == '') { $location = modify_url('object', 'stories'); httpRedirect($location); }*/ $args["object"] = $filters['object']; if ($_POST['q']) { $object = '/all/'; if($_POST['object']=='images') $object = '/images/'; if($_POST['object']=='videos') $object = '/videos/'; if($_POST['object']=='stories') $object = ''; $filters['order'] = 'search'; $filters['search'] = $_POST['q']; $location = 'https://'.$main_http_host.'/search='.urlencode($_POST['q']).'/?cx=partner-pub-4158902663927975%3A8920970041&cof=FORID%3A10&ie=UTF-8&q='.urlencode($_POST['q']).'&sa=%D0%BD%D0%B0%D0%B9%D1%82%D0%B8&siteurl=news2.ru'; httpRedirect($location); } //$args["search_form.action"] = modify_url('',''); //display_object_menu(); ////////////////////////////////////////////////////// if (sizeof($filters['user_id']) == 1) { $args["openid_head_block.visible"] = 1; } ////////////////////////////////////////////////////// $act = getvar('act'); if ($s_id > 0) { if ($act == 'save_filter' && strlen($name = getvar_ss('filter_name'))) { $token = getvar_ss('token'); if ($token == '' || $token != md5('news2-'.$s_id.'-some')) { die('token error'); } $url = modify_url('', ''); Filter::SaveUserFilter($s_id, $name, $url); } if ($act == 'del_filter' && strlen($filter_name = getvar_ss('filter_name'))) { $token = getvar_ss('token'); if ($token == '' || $token != md5('news2-'.$s_id.'-some')) { die('token error'); } Filter::DeleteUserFilter($s_id, $filter_name); } } /* if(sizeof($filters['category'])==0) //не выбрана категория { $template = "page_title.html"; $args["usual_news_block.visible"] = 1; $news_number_forced = 10; $main_page = true; $filters['view'] = 'main'; $filters['category'][0] = 'news'; include("$path/news_main.php"); // it returns $category_title_rich and $news_text $datasources["news_list1_big_datasrc"] = array(); for ($i = 0; $i < 4; $i++) { $datasources["news_list1_big_datasrc"][] = $news_text[$i]; } $datasources["news_list1_small_datasrc"] = array(); for ($i = 4; $i < sizeof($news_text); $i++) { $datasources["news_list1_small_datasrc"][] = $news_text[$i]; } $filters['category'][0] = 'tech'; include("$path/news_main.php"); // it returns $category_title_rich and $news_text $datasources["news_list2_big_datasrc"] = array(); for ($i = 0; $i < 4; $i++) { $datasources["news_list2_big_datasrc"][] = $news_text[$i]; } $datasources["news_list2_small_datasrc"] = array(); for ($i = 4; $i < sizeof($news_text); $i++) { $datasources["news_list2_small_datasrc"][] = $news_text[$i]; } $filters['category'][0] = 'fun'; include("$path/news_main.php"); // it returns $category_title_rich and $news_text $datasources["news_list3_datasrc"] = array(); for ($i = 0; $i < 4; $i++) { $datasources["news_list3_big_datasrc"][] = $news_text[$i]; } $datasources["news_list3_small_datasrc"] = array(); for ($i = 4; $i < sizeof($news_text); $i++) { $datasources["news_list3_small_datasrc"][] = $news_text[$i]; } } else*/ { $main_page = false; include("$path/news_main.php"); // it returns $category_title_rich and $news_text $html_title = $category_title." / news2.ru"; $args["title_message"] = $html_title; $args["usual_news_block.visible"] = 1; if ($filters['order'] == 'rating' && sizeof($filters['user_name'])==0 //&& sizeof($filters['category'])==0 && sizeof($filters['site'])==0 && sizeof($filters['tag'])==0 && $filters['search']=='') { //print_r($filters); $args["filter_sort_rating.visible"] = 1; // список последних новостей $filters2 = $filters; $filters['order'] = 'new'; $args['last_objects_link.href'] = modify_url('', ''); $news_related = array(); $r = get_mysql_result($query_for_last_news) or die("Внутренняя ошибка сервера5_11"); while($related_story_data = mysql_fetch_array($r)) { if (!in_array($related_story_data['id'], $story_id)) { //подробности новости [SD] $query[1]="SELECT title, description FROM story_detail WHERE story_id=".$related_story_data['id']; $result[1] = get_mysql_result($query[1]) or die("Внутренняя ошибка сервера (story_detail)"); $story_detail=mysql_fetch_array($result[1]); $related_story_data['description'] = $story_detail['description']; $related_story_data['title'] = $story_detail['title']; //наследие $related_story_data['story_id'] = $related_story_data['id']; $related_story_data['image_link'] = $related_story_data['image']; $related_story_data['poll_indicator'] = $related_story_data['poll']; $news_related[] = news_print_adv($related_story_data); if (count($news_related) >= 5) { break; } } } foreach ($news_related as $story_data) { $args["last_news_list.datasrc"][] = $story_data; } if (count($news_related) > 0) { $args['last_news_block.visible'] = 1; $args['news_block_title.visible'] = 1; } $filters = $filters2; } // NEWS OUTPUT $args["news_list_title.body_html"] = $category_title_rich; // Рекомендованные новости, ля-ля-ля... $datasources["news_list_datasrc"] = array(); for ($i = 0; $i < sizeof($news_text); $i++) { $datasources["news_list_datasrc"][] = $news_text[$i]; } $template = "page_main.html"; } /* if ($filters['type'] == "news" //&& $story_data['id']>=371210 && $filters['search'] == '' && $filters['order']=='rating' && $filters['period']=='' && $filters['user_show']=='' && sizeof($filters['user_id'])==0 && sizeof($filters['friend_id'])==0 && sizeof($filters['site'])==0 && sizeof($filters['tag'])==0 && sizeof($filters['region'])==0 && $filters['favorite']=='' && $filters['news_page']==0 ) { if(sizeof($filters['category'])==0) { //эксклюзив $is = 0; $r = get_mysql_result("SELECT * FROM story WHERE id>360000 AND link='nolink' AND txt_count>1000 AND status='good' AND category_id NOT IN (34,35,36,37) AND can_be_ex = 1 ORDER BY id DESC LIMIT 0,6"); while($exclusive = mysql_fetch_array($r)) { $is++; //подробности новости [SD] $query[1]="SELECT title, description FROM story_detail WHERE story_id=".$exclusive['id']; $result[1] = get_mysql_result($query[1]) or die("Внутренняя ошибка сервера (story_detail)"); $story_detail=mysql_fetch_array($result[1]); $exclusive['description'] = $story_detail['description']; $exclusive['title'] = $story_detail['title']; //наследие $exclusive['story_id'] = $exclusive['id']; $exclusive['image_link'] = $exclusive['image']; $exclusive['poll_indicator'] = $exclusive['poll']; //категория $c = array_search($exclusive['category_id'], $category_list['category_id']); if ($c !== false) { $category_data['category_name'] = $category_list['category_name'][$c]; $category_data['category_eng_name'] = $category_list['category_eng_name'][$c]; $category_data['global_category_id'] = $category_list['global_category_id'][$c]; $category_data['global_category_name'] = $category_list['global_category_name'][$c]; $category_data['global_category_eng_name'] = $category_list['global_category_eng_name'][$c]; } $news_exclusive = news_print_exclusive($exclusive,$category_data); $args["exclusive.datasrc"][] = $news_exclusive; $args["exclusive_block.visible"] = 1; } } if($args["exclusive_block.visible"] != 1) $args["non_exclusive_block.visible"] = 1; } else { $args["non_exclusive_block.visible"] = 1; } */ //ШАПКА $c = array_search($story_data['category_id'], $category_list['category_id']); if ($c !== false) { $category_data['category_name'] = $category_list['category_name'][$c]; $category_data['category_eng_name'] = $category_list['category_eng_name'][$c]; $category_data['global_category_id'] = $category_list['global_category_id'][$c]; $category_data['global_category_name'] = $category_list['global_category_name'][$c]; $category_data['global_category_eng_name'] = $category_list['global_category_eng_name'][$c]; } $top_type = "full"; include("$path/top.php"); if($main_page == false) { ////////////////////////////////////////////////////// // ссылка на RSS тоже тут... поэтому блок вынесен ниже, ибо в нём нужен $category_title include ("$path/right_block_main.php"); ////////////////////////////////////////////////////// } /* if ($s_id != '') { $args["who_friend_block.visible"] = 1; include("$path/who_friend.php"); } */ require_once(dirname(__FILE__)."/templater/process_template.php"); ?>