function IndexForumMarkRead()
{
    $mark_forums = array();
    // Форумы на которых устанавливать метки
    $forums_tree = ForumTree::Instance();
    if (isset($_GET['forum'])) {
        // Только внутри определённого форума
        $forum = SafeDB($_GET['forum'], 11, int);
        $mark_forums = $forums_tree->GetAllAccessForumId($forum);
    } else {
        // На всех форумах
        $mark_forums = $forums_tree->GetAllAccessForumId();
    }
    $user_id = System::user()->Get('u_id');
    if (System::user()->Auth) {
        // Загружаем данные о прочтении тем пользователем
        $read_data = Forum_Marker_GetReadData();
        // Загружаем топики (агрегированы по forum_id)
        $topics = ForumCacheGetTopics();
        $del_where = '';
        $insert_values = array();
        $time = time();
        foreach ($mark_forums as $forum_id) {
            if (!isset($topics[$forum_id])) {
                continue;
            }
            foreach ($topics[$forum_id] as $topic) {
                $tid = SafeEnv($topic['id'], 11, int);
                // Не прочитана или метка устарела
                if (!isset($read_data[$topic['id']])) {
                    $insert_values[] = "'{$user_id}','{$tid}','{$time}'";
                    // Добавить новую метку
                } elseif ($read_data[$topic['id']]['date'] < $topic['last_post']) {
                    $del_where .= "(`tid`='{$tid}' and `mid`= '{$user_id}') or ";
                    // Удалить текущую метку
                    $insert_values[] = "'{$user_id}','{$tid}','{$time}'";
                    // Добавить новую метку
                }
            }
        }
        // Удаляем устаревшие метки
        if ($del_where != '') {
            $del_where = substr($del_where, 0, -4);
            // Удаляем .or.
            System::database()->Delete('forum_topics_read', $del_where);
        }
        // Добавляем новые метки
        // TODO: В будущем нужно перейти на InnoDB и использовать транзакции как в MySQL так и в FilesDB.
        if (count($insert_values) > 0) {
            foreach ($insert_values as $vals) {
                System::database()->Insert('forum_topics_read', $vals);
            }
        }
    }
    GO(GetSiteUrl() . Ufu('index.php?name=forum' . (isset($forum) ? '&op=showforum&forum=' . $forum : ''), 'forum/' . (isset($forum) ? '{forum}/' : '')));
}
Example #2
0
 function sites()
 {
     $links = $this->links();
     $sites = array();
     foreach ($links as $value) {
         $sites[] = GetSiteUrl($value);
     }
     $sites = distinct_array($sites);
     return $sites;
 }
/**
 * Безопасная функция для вывода ЧПУ ссылок.
 * @param               $Url
 * @param string        $Ufu
 * @param string|bool   $NavLink
 * @param string        $NavParam
 * @param int           $MinOrder
 * @return string
 * @examples
 *           Ufu('index.php?name=news&topic=5', 'news/{topic}/');
 *           Ufu('index.php?name=news&topic=5', 'news:show-topics');
 */
function Ufu($Url, $Ufu = '', $NavLink = null, $NavParam = null, $MinOrder = 10000)
{
    if (System::config('general/ufu')) {
        if ($Url == 'index.php') {
            return GetSiteUrl() . 'index.html';
        }
        // Вытаскиваем параметры ссылки
        $p = strpos($Url, '?');
        if ($p !== false) {
            $Url = substr($Url, $p + 1);
        }
        $p = strrpos($Url, '#');
        if ($p !== false) {
            $anchor = substr($Url, $p);
            $Url = substr($Url, 0, $p);
        } else {
            $anchor = '';
        }
        parse_str($Url, $params);
        // NavLink
        if (isset($NavLink) && !is_string($NavLink)) {
            if ($NavLink === true) {
                if (isset($NavParam)) {
                    $NavLink = $NavParam;
                } else {
                    $NavLink = 'page';
                }
            } else {
                $NavLink = null;
            }
        }
        // Параметры для замены ключей в ufu шаблоне
        $replace = array();
        foreach ($params as $key => $val) {
            $replace['{' . $key . '}'] = rawurlencode(Cp1251ToUtf8($val));
        }
        // Получаем правило
        $rule = UfuGetRules($Ufu);
        if (!isset($rule)) {
            if (isset($NavLink)) {
                $params[$NavLink] = '1';
            }
            $rule = UfuAddRewriteRule($Ufu, $params, $MinOrder);
        }
        // Парсим шаблон ссылки заменяя ключи
        return strtr($rule['ufu'], $replace) . $anchor;
    } else {
        if ($Url == 'index.php') {
            return GetSiteUrl() . $Url;
        } else {
            $Url = new Url($Url);
            return $Url->ToString();
        }
    }
}
function IndexForumShowTopic($one_post = false)
{
    global $forum_lang;
    $forums_tree = ForumTree::Instance();
    // Вспомогательные переменные
    $user_auth = System::user()->Auth;
    $user_id = System::user()->Get('u_id');
    $user_admin = System::user()->isAdmin();
    $time = time();
    $max_word_length = System::config('forum/max_word_length');
    if (isset($_GET['topic'])) {
        $topic_id = SafeEnv($_GET['topic'], 11, int);
    } else {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_no_topic']);
        return;
    }
    // Берём тему и проверяем на доступ
    System::database()->Select('forum_topics', "`id`='" . $topic_id . "'");
    if (System::database()->NumRows() == 0) {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_no_topic']);
        return;
    }
    $topic = System::database()->FetchRow();
    if (!$user_admin && $topic['starter_id'] == $user_id && $topic['delete'] == '1') {
        // Тема удалена в корзину (только админы видят корзину и автор темы)
        System::site()->AddTextBox($forum_lang['topic_basket_current_post'], '<p align="center">' . $forum_lang['topic_basket_post'] . '.<br><input type="button" value="' . $forum_lang['back'] . '"onclick="history.back();"></p>');
        return;
    }
    // Проверяем доступ к форуму
    $forum_id = SafeEnv($topic['forum_id'], 11, int);
    $forum_config = $forums_tree->GetForumConfigRecursive($forum_id);
    // Параметры доступа на форум
    if (!$forum_config['access']) {
        System::site()->AddTextBox($forum_lang['error'], $forum_config['access_reason']);
        // Нет доступа в этот форум
        return;
    }
    // $forum_config['add_post'] - право добавлять сообщения
    // $forum_config['add_post_reason'] - причина запрета добавления сообщений
    // $forum_config['no_link_guest'] - скрывать ссылки от гостей
    // $forum_config['new_message_email'] - разрешить подписку на новые сообщения
    // Определяем следующую и предыдущую темы
    $topics_data = ForumCacheGetTopics();
    $topics_data = $topics_data[$forum_id];
    $prev_topic = null;
    $next_topic = null;
    $find = false;
    foreach ($topics_data as $topic_row) {
        if ($topic_row['id'] == $topic_id) {
            $find = true;
            continue;
        }
        if ($find) {
            $next_topic = $topic_row;
            break;
        }
        $prev_topic = $topic_row;
    }
    // Параметры постраничной навигации
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 1;
    }
    if (isset($_GET['view']) && $_GET['view'] == 'lastpost') {
        $lastpost = true;
    } else {
        $lastpost = false;
    }
    $posts_on_page = System::config('forum/posts_on_page');
    // Обновляем метку о прочтении темы, если пользователь авторизован
    if ($user_auth) {
        System::database()->Delete('forum_topics_read', "`tid`='{$topic_id}' and `mid`='{$user_id}'");
        System::database()->Insert('forum_topics_read', "'{$user_id}','{$topic_id}','{$time}'");
    }
    // Объект онлайн
    $online = ForumOnline::Instance($forum_id, $topic_id);
    // Устанавливаем заголовок страницы
    $topic_title = SafeDB($topic['title'], 255, str);
    System::site()->SetTitle($topic_title . ($page > 1 ? ' - Страница ' . $page : ''));
    // Хлебные крошки
    $forums_tree->BreadCrumbsF($forum_id);
    System::site()->BreadCrumbAdd(SafeDB($topic['title'], 255, str));
    // Добавляем корзину (если тема удалена в корзину)
    if ($topic['delete'] == '1') {
        $basket_topics = ForumBasketGetData('forum_basket_topics');
        if (isset($basket_topics[$topic['id']])) {
            System::site()->AddTextBox($forum_lang['topic_basket_red'], ForumBasketRender($topic['id'], $topic['title'], $basket_topics, true));
        }
    }
    // Увеличиваем счётчик просмотров
    System::database()->Update('forum_topics', "`hits`='" . (SafeDB($topic['hits'], 11, int) + 1) . "'", "`id`='" . $topic_id . "'");
    // Инициализируем постраничную навигацию
    $navigation = new Navigation($page);
    $navigation->FrendlyUrl = System::config('general/ufu');
    // Загружаем сообщения из базы данных
    $basket_where = '';
    // Администратор (подготавливаем запрос выборки т.к. нужно знать сколько всего сообщений для постр. навигации)
    if ($user_auth) {
        if (!$user_admin) {
            $basket_where = " and (`delete`='0' or `user_id`='{$user_id}')";
            // Пользователь
        }
    } else {
        $basket_where = " and `delete`='0'";
        // Гость
    }
    $posts = System::database()->Select('forum_posts', ($one_post !== false ? "`id`='{$one_post}'" : "`object`='{$topic_id}'") . $basket_where);
    SortArray($posts, 'public', false);
    //Сортируем по дате
    // Вывод постраничной навигации
    if (count($posts) > $posts_on_page) {
        if ($lastpost) {
            $page = ceil(count($posts) / $posts_on_page);
        }
        $navigation->GenNavigationMenu($posts, $posts_on_page, Ufu('index.php?name=forum&op=showtopic&topic=' . $topic_id, 'forum/topic' . $topic_id . '-{page}.html', true), $page);
    } else {
        $navigation->DisableNavigation();
    }
    // Загружаем корзину для сообщений
    $basket = ForumBasketGetData('forum_basket_post');
    // Блок с информацией о теме
    System::site()->AddBlock('topic', true, false);
    System::site()->SetVars('topic', ForumTopicFilterData($topic));
    // Блок шаблонизатора для вывода сообщений
    System::site()->AddBlock('forum_posts', true, true, 'post');
    $is_forum_member = AccessIsResolved(2);
    // Для определения первого и последнего сообщения
    $i = 1;
    // Выводим сообщения в шаблонизатор
    foreach ($posts as $post) {
        $post_user_id = SafeDB($post['user_id'], 11, int);
        if ($post_user_id == 0) {
            continue;
        }
        $vars = array();
        // Обрабатываем текст сообщения
        if ($post['delete'] == '1') {
            // Сообщение удалено в корзину
            $vars['text'] = ForumBasketRender($post['id'], $post['message'], $basket);
        } else {
            $vars['text'] = HtmlChars($post['message']);
            if ($forum_config['no_link_guest']) {
                // Скрываем ссылки от гостей
                $replace = '<p class="notice">' . $forum_lang['hide_links_for_guests'] . '</p>';
                $vars['text'] = preg_replace('/\\<a[^\\>]*?(http|https|ftp|www)(.*?)\\<\\/a\\>/is', $replace, $vars['text']);
                $vars['text'] = preg_replace('/(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|www\\.)?([a-zA-Z0-9]+)\\.(ru|su|com|org|net|info|name|ws|cc|tv|tel|kz|biz|mobi|asia|me|tw|ua)+([а-яА-Яa-zA-Z0-9\'~;,@#%&_\\!\\$\\^\\*\\(\\)\\-\\=\\+\\?\\.\\:\\/\\\\]*)?/is', $replace, $vars['text']);
            }
            SmiliesReplace($vars['text']);
            $vars['text'] = nl2br($vars['text']);
            $vars['text'] = BbCodePrepare($vars['text']);
            if ($max_word_length > 0) {
                $vars['text'] = word_wrapped_string($vars['text'], $max_word_length);
            }
        }
        // Обрабатываем данные сообщения
        // Пользователь
        $user_info = GetUserInfo($post_user_id);
        $vars['usertopics'] = '<a href="' . Ufu('index.php?name=forum&op=usertopics&user='******'forum/usertopics/{user}/') . '">' . $forum_lang['allusertopics'] . '</a>';
        if ($user_info['rank_name'] != '') {
            $vars['author'] = '<a href="' . Ufu('index.php?name=user&op=userinfo&user='******'user/{user}/info/') . '">' . $user_info['name'] . '</a>';
            $vars['author_name'] = $user_info['name'];
        } else {
            $vars['author'] = $post['name'];
            $vars['author_name'] = $post['name'];
        }
        if ($user_info['hideemail'] == '0') {
            $vars['email'] = AntispamEmail($user_info['email']);
        } else {
            $vars['email'] = '&nbsp;';
        }
        if ($user_info['url'] != '') {
            $vars['homepage'] = '<a href="http://' . $user_info['url'] . '" target="_blank">' . $user_info['url'] . '</a>';
        } else {
            $vars['homepage'] = '&nbsp;';
        }
        $vars['icq'] = $user_info['icq'];
        if ($user_info['online']) {
            $vars['status'] = $forum_lang['user_online'];
        } else {
            $vars['status'] = '';
        }
        $vars['rank_image'] = $user_info['rank_image'] != '' ? $user_info['rank_image'] : '';
        $vars['rank_name'] = $user_info['rank_name'] != '' ? $user_info['rank_name'] : '';
        $vars['avatar'] = $user_info['avatar_file'] != '' ? $user_info['avatar_file'] : GetPersonalAvatar(0);
        $vars['regdate'] = TimeRender($user_info['regdate'], false, true);
        if (isset($user_info['data']['forum_counters'])) {
            $vars['user_posts_count'] = $user_info['data']['forum_counters']['posts'];
            $vars['user_topics_count'] = $user_info['data']['forum_counters']['topics'];
        } else {
            $vars['user_posts_count'] = '0';
            $vars['user_topics_count'] = '0';
        }
        // Сообщение
        $vars['public'] = $forum_lang['added'] . TimeRender($post['public']);
        $vars['public_date'] = TimeRender($post['public']);
        $vars['ip'] = SafeDB($post['user_ip'], 19, str);
        $vars['topic_id'] = $topic_id;
        $vars['id'] = SafeDB($post['id'], 11, int);
        $vars['nodelete'] = SafeDB($post['delete'], 1, int) == 1 ? false : true;
        $vars['is_admin_and_nodelete'] = $vars['nodelete'] && $user_admin;
        $vars['page'] = $page;
        // is_current_user Пользователь является владельцем сообщения (кнопки редактировать и удалить)
        if ($post['delete'] == '0') {
            $vars['is_current_user'] = $user_id == $post['user_id'] && $topic['close_topics'] == '0' || $user_admin;
        } else {
            $vars['is_current_user'] = false;
        }
        if ($one_post === false) {
            $vars['num'] = $page > 1 ? $page * $posts_on_page - $posts_on_page + $i : $i;
            $vars['url'] = "javascript:link_post('" . GetSiteUrl() . Ufu("index.php?name=forum&op=post&topic=" . $topic_id . "&post=" . $post['id'], 'forum/t{topic}/post{post}.html') . "')";
        } else {
            $vars['num'] = '';
            $vars['url'] = 'javascript:history.go(-1)';
        }
        $vars['is_forum_member'] = $is_forum_member;
        System::site()->AddSubBlock('forum_posts', true, $vars, array(), 'module/forum_post.html');
        $i++;
    }
    // Форма добавления сообщений
    System::site()->AddBlock('post_form', $forum_config['add_post'], false);
    ForumRenderPostForm(false, $forum_id, $topic_id, 0, '', '', $is_forum_member);
    // Подписка на тему
    System::site()->AddBlock('subscription', $forum_config['new_message_email'], false, 'subs');
    $vars_subs = array();
    $vars_subs['topic'] = $topic_id;
    $vars_subs['sub_status'] = Forum_Subscription_Status($topic_id);
    $vars_subs['status'] = $vars_subs['sub_status'] ? 'Отписаться от этой темы' : 'Подписаться на эту тему';
    System::site()->SetVars('subscription', $vars_subs);
    System::site()->AddBlock('is_forum_member', $is_forum_member, false, 'marker');
    System::site()->SetVars('is_forum_member', array('id' => $topic_id));
    // Подключаем шаблон
    System::site()->AddTemplatedBox('', 'module/forum_showtopic.html');
    // Выводим блок онлайн
    $online->Render($forum_id, $topic_id, $forum_lang['current_online'], 'forum_online');
    // Предыдущая и следующая тема
    System::site()->AddBlock('forum_prev_topic', isset($prev_topic), false, 'topic');
    if (isset($prev_topic)) {
        System::site()->SetVars('forum_prev_topic', array('url' => Ufu('index.php?name=forum&op=showtopic&topic=' . SafeDB($prev_topic['id'], 11, int), 'forum/topic{topic}.html'), 'title' => SafeDB($prev_topic['title'], 255, str), 'lang_prev_topic' => $forum_lang['prev_topic']));
    }
    System::site()->AddBlock('forum_next_topic', isset($next_topic), false, 'topic');
    if (isset($next_topic)) {
        System::site()->SetVars('forum_next_topic', array('url' => Ufu('index.php?name=forum&op=showtopic&topic=' . SafeDB($next_topic['id'], 11, int), 'forum/topic{topic}.html'), 'title' => SafeDB($next_topic['title'], 255, str), 'lang_next_topic' => $forum_lang['next_topic']));
    }
    // Быстрый переход по форумам
    ForumQuickTransitionBox($forum_id, $forum_lang['quick_transition']);
}
Example #5
0
function Update_link($url)
{
    global $db, $bug_url;
    $is_success = FALSE;
    $is_shoulu = FALSE;
    $spider = new spider();
    $spider->url($url);
    $title = $spider->title;
    $fulltxt = $spider->fulltxt(800);
    $pagesize = $spider->pagesize;
    $keywords = $spider->keywords;
    $htmlcode = $spider->htmlcode;
    $description = $spider->description;
    $site_url = GetSiteUrl($url);
    $site = $db->get_one("select * from ve123_sites where url='" . $site_url . "'");
    $site_id = $site["site_id"];
    echo $title;
    $array = array('title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'site_id' => $site_id);
    $db->query("update ve123_links set updatetime='" . time() . "' where url='" . $url . "'");
    if (!empty($title)) {
        $s = array();
        $s = explode("?", $title);
        if ($pagesize > 1 && count($s) < 2) {
            $domain = GetSiteUrl($url);
            $site = $db->get_one("select * from ve123_sites where url='" . $domain . "'");
            if (!empty($site)) {
                if (!empty($site["include_word"])) {
                    foreach (explode(",", $site["include_word"]) as $value) {
                        if (stristr($htmlcode, $value)) {
                            $include_num += 1;
                        }
                    }
                    if ($include_num <= 0) {
                        $is_shoulu = FALSE;
                    }
                } else {
                    $is_shoulu = TRUE;
                }
                if (!empty($site["not_include_word"])) {
                    foreach (explode(",", $site["not_include_word"]) as $value) {
                        if (stristr($htmlcode, $value)) {
                            $not_include_num += 1;
                        }
                    }
                    if ($not_include_num > 0) {
                        $is_shoulu = FALSE;
                    }
                }
            } else {
                $is_shoulu = TRUE;
            }
            if ($is_shoulu) {
                $db->update("ve123_links", $array, "url='" . $url . "'");
                //file_put_contents(PATH."k/www/".str_replace("http://","",$url.".html"),$htmlcode);
                $is_success = TRUE;
            }
        }
    }
    if (empty($bug_url)) {
        exit;
    }
    return $is_success;
}
Example #6
0
<?php

/*
	[kuaso!] (C)209-2010 Kuaso Inc.
	
	This is NOT a freeware, use is subject to license terms

	$Id: shoulu.php 2010-01-24 16:17:18Z anjel $
*/
require "../global.php";
$url = HtmlReplace($_GET["ref"]);
if ($url != $config["url"] && stristr($url, "http://")) {
    $url = GetSiteUrl($url);
    $site = $db->get_one("select * from kuaso_sites where url='{$url}'");
    if (empty($site)) {
        $array = array('url' => $url, 'spider_depth' => $config["spider_depth"], 'indexdate' => time(), 'addtime' => time());
        $db->insert("kuaso_sites", $array);
    }
    $site = $db->get_one("select * from kuaso_sites where url='{$url}'");
    if (!empty($site)) {
        $ip = ip();
        //$referer=$_SERVER['HTTP_REFERER'];
        $v = $db->get_one("select * from kuaso_stat_visitor where v_ip='" . $ip . "' and v_time>='" . (time() - 86400 * 1) . "'");
        if (empty($v)) {
            $array = array('v_time' => time(), 'v_ip' => $ip);
            $db->insert("kuaso_stat_visitor", $array);
            $db->query("update kuaso_sites set com_time='" . time() . "',com_count_ip=com_count_ip+1 where url='" . $url . "'");
        }
    }
    $site = $db->get_one("select * from kuaso_sites where url='{$url}'");
    if (!empty($site)) {
Example #7
0
function add_links($url, $is_index_page = true, $num = '')
{
    global $db;
    $new_links = array();
    $j = 1;
    $url_htmlcode = get_url_content($url);
    $url_htmlcode = get_encoding($url_htmlcode, "GB2312");
    $links = get_links($url_htmlcode, $url, 1, $url);
    echo "<br><b>url=";
    print_r($url);
    echo "<br></b>";
    if ($is_index_page) {
        foreach ($links as $value) {
            $new_links[] = GetSiteUrl($value);
        }
    } else {
        $new_links = $links;
    }
    $new_links = distinct_array($new_links);
    foreach ($new_links as $value) {
        //echo $value."<br>";
        //ob_flush();
        //flush();
        $query = $db->query("select * from ve123_links where url='{$value}'");
        $num = $db->num_rows($query);
        if ($num == 0) {
            echo "<font color=#C60A00><b>抓取到:</b></font>" . $value . "<br>";
            if (!add_update_link($value, "", "", "add")) {
                continue;
            }
            $j++;
            if (!empty($num)) {
                if ($j >= $num) {
                    exit;
                }
            }
        } else {
            echo "<b>已存在了:</b>";
            echo "<a href=" . $value . " target=_blank>" . $value . "</a>";
            echo "<br>";
        }
        ob_flush();
        flush();
    }
}
function IndexForumAddTopic()
{
    global $forum_lang;
    $forums_tree = ForumTree::Instance();
    // Проверки на доступ
    if (CheckGet('forum') && CheckPost('topic_title', 'text') && isset($forums_tree->IdCats[$_GET['forum']])) {
        $forum_id = SafeEnv($_GET['forum'], 11, int);
        $forum = $forums_tree->IdCats[$forum_id];
        $forum_config = $forums_tree->GetForumConfigRecursive($forum_id);
        if (!$forum_config['access']) {
            // Доступ
            System::site()->AddTextBox($forum_lang['error'], $forum_config['access_reason']);
            return;
        } elseif (!$forum_config['add_topic']) {
            // Разрешено ли добавлять новые темы
            System::site()->AddTextBox($forum_lang['error'], $forum_config['add_topic_reason']);
            return;
        }
    } else {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['error_data']);
        return;
    }
    if (!CheckPost('text') || strlen($_POST['text']) == 0) {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['no_data']);
        return;
    }
    $user_id = System::user()->Get('u_id');
    $user_name = System::user()->Get('u_name');
    $time = time();
    // Добавляем топик
    // TODO: Зачем здесь пустое поле?
    $uniq_code = '';
    //GenRandomString(12, '1234567890');
    $topic_title = SafeEnv($_POST['topic_title'], 255, str);
    if (strlen($topic_title) == 0) {
        System::site()->AddTextBox($forum_lang['error'], $forum_lang['no_title_topic']);
        return;
    }
    $topic_values = Values('', $forum_id, $topic_title, '1', '0', '0', $time, $user_id, $user_name, $time, '0', '', $uniq_code, 0, 0, 0);
    System::database()->Insert('forum_topics', $topic_values);
    $topic_id = System::database()->GetLastId();
    $topic = System::database()->Select('forum_topics', "`id`='{$topic_id}'");
    $topic = $topic[0];
    // Добавляем сообщение
    $email = System::user()->Get('u_email');
    $hideemail = System::user()->Get('u_hideemail');
    $site = System::user()->Get('u_homepage');
    $icq = System::user()->Get('u_icq');
    $text = SafeEnv($_POST['text'], 0, str);
    System::database()->Insert('forum_posts', Values('', $topic_id, $user_id, time(), $user_name, $site, $email, $hideemail, $icq, $text, getip(), 0));
    // Добавляем очков пользователю
    System::user()->ChargePoints(System::config('points/forum_post'));
    // Увеличиваем счётчик сообщений и тем пользователя
    ForumCalcUserCounters(1, 1);
    $forum['topics'] = SafeDB($forum['topics'], 11, int) + 1;
    IndexForumSetLastPostInfo($forum, $topic);
    // Добавляем метку о прочтении темы автором топика
    System::database()->Insert('forum_topics_read', Values($user_id, $topic_id, $time));
    // Очищаем кэш
    ForumCacheClear();
    GO(Ufu('index.php?name=forum&op=showforum&forum=' . $forum_id, GetSiteUrl() . 'forum/{forum}/'));
}
function IndexGalleryView()
{
    if (isset($_GET['img'])) {
        $id = SafeEnv($_GET['img'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    /*
     * Загружаем все изображения из категории и делаем массив соответствий index -> id, для определения следующего и
     * предыдущего изображения.
     */
    $cat = SafeEnv($_GET['cat'], 11, int);
    $db_images = System::database()->Select('gallery', GetWhereByAccess('view', "`cat_id`='{$cat}' and `show`='1'"), null, 'order');
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    $images = array();
    foreach ($db_images as $k => $img) {
        $images[$k] = $img['id'];
    }
    /*
     * Текущее изображение.
     */
    $index = array_search($id, $images);
    if ($index !== false) {
        $img = $db_images[$index];
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=gallery', '{name}/'));
    }
    /*
     * Добавляем блок изображения в шаблонизатор, блок будет содержать ссылки на следующее и предыдущее изображение.
     */
    $vars = IndexGalleryFilterImageData($img, $index + 1, count($db_images));
    $vars['next'] = isset($db_images[$index + 1]);
    if ($vars['next']) {
        $nimg = $db_images[$index + 1];
        $vars['next_url'] = Ufu('index.php?name=gallery&op=view&img=' . SafeDB($nimg['id'], 11, int) . '&cat=' . SafeDB($nimg['cat_id'], 11, int), 'gallery/{cat}/{img}/');
        $vars['next_title'] = SafeDB($nimg['title'], 255, str);
    }
    $vars['prev'] = isset($db_images[$index - 1]);
    if ($vars['prev']) {
        $nimg = $db_images[$index - 1];
        $vars['prev_url'] = Ufu('index.php?name=gallery&op=view&img=' . SafeDB($nimg['id'], 11, int) . '&cat=' . SafeDB($nimg['cat_id'], 11, int), 'gallery/{cat}/{img}/');
        $vars['prev_title'] = SafeDB($nimg['title'], 255, str);
    }
    if ($vars['title'] == '') {
        $vars['title'] = 'Изображение ' . strval($index + 1);
    }
    $GalleryImageBlock = System::site()->NewBlock('gallery_image', true, false, 'img')->SetVars($vars);
    /*
     * Выводим изображения в категории.
     */
    IndexGalleryShow($cat, $db_images, true, $GalleryImageBlock, $index);
    /*
     * Хлебные крошки, заголовок окна, подключение шаблона.
     */
    IndexGalleryGetTree()->BreadCrumbs($cat);
    System::site()->BreadCrumbAdd($vars['title']);
    System::site()->SetTitle($vars['title']);
    System::site()->AddTemplatedBox('', 'module/gallery_view.html');
    /*
     * Увеличиваем счётчик просмотров.
     */
    System::database()->Update('gallery', "`hits`='" . ($img['hits'] + 1) . "'", "`id`='{$id}'");
    /*
     * Выводим комментарии.
     */
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    $posts = new Posts('gallery_comments', $img['allow_comments'] == '1');
    $posts->EditPageUrl = 'index.php?name=gallery&op=editpost&img=' . $id;
    $posts->DeletePageUrl = 'index.php?name=gallery&op=deletepost&img=' . $id;
    $posts->PostFormAction = "index.php?name=gallery&op=addpost&img={$id}&cat={$cat}&page={$page}";
    $posts->NavigationUrl = Ufu("index.php?name=gallery&op=view&img={$id}&cat={$cat}", 'gallery/{cat}/{img}/page{page}/', true);
    $posts->RenderPosts($id, 'gallery_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'gallery_comments_form');
}
<?php

/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
if (!defined('VALID_RUN')) {
    header("HTTP/1.1 404 Not Found");
    exit;
}
define('FORMS_UFU', GetSiteUrl() . Ufu('index.php?name=forms', 'system:mod'));
System::site()->SetTitle('Web-формы');
include_once System::config('inc_dir') . 'forms.inc.php';
if (!isset($_GET['op'])) {
    $op = 'main';
} else {
    $op = $_GET['op'];
}
if (isset($_GET['form'])) {
    $id = SafeEnv($_GET['form'], 11, int);
    $form = System::database()->SelectOne('forms', "`id`='{$id}' && `active`='1'");
    if ($form === false) {
        GO(FORMS_UFU);
    }
} elseif (isset($_GET['formlink'])) {
    $link = SafeEnv(Utf8ToCp1251(rawurldecode($_GET['formlink'])), 255, str);
    $form = System::database()->SelectOne('forms', "`link`='{$link}' && `active`='1'");
    if ($form === false) {
        GO(FORMS_UFU);
    }
}
function IndexGBAddMsgSave()
{
    $r = array();
    $er = array();
    if (!isset($_GET['name']) || !isset($_POST['email']) || !isset($_POST['site']) || !isset($_POST['icq']) || !isset($_POST['text'])) {
        $er[] = 'Данные не инициализированы.';
    }
    if (GBCheckFlood()) {
        $er[] = 'Флуд защита, подождите немного.';
    }
    if (strlen($_POST['name']) == 0) {
        $er[] = 'Вы не ввели имя.';
    }
    if (strlen($_POST['email']) == 0) {
        $er[] = 'Вы не ввели свой e-mail.';
    } elseif (!CheckEmail($_POST['email'])) {
        $er[] = 'Вы совершили ошибку при вводе e-mail.';
    }
    if (strlen($_POST['text']) == 0) {
        $er[] = 'Вы не ввели текст сообщения, либо сообщение слишком короткое.';
    }
    if ($_POST['icq'] != '') {
        if (!is_numeric($_POST['icq'])) {
            $er[] = 'Ваш номер ICQ должен состоять только из чисел.';
        }
    }
    // Проверяем капчу
    if (!System::user()->Auth || !System::user()->isAdmin() && System::config('gb/show_captcha')) {
        if (!System::user()->isDef('captcha_keystring') || System::user()->Get('captcha_keystring') != $_POST['keystr']) {
            $er[] = 'Вы ошиблись при вводе кода с картинки.';
        }
    }
    if (count($er) == 0) {
        if (isset($_POST['hideemail'])) {
            $hideemail = '1';
        } else {
            $hideemail = '0';
        }
        if (System::user()->isAdmin() || !System::config('gb/moderation')) {
            $moderated = 1;
        } else {
            $moderated = 0;
        }
        $name = SafeEnv($_POST['name'], 50, str, true);
        $email = SafeEnv($_POST['email'], 50, str, true);
        $_site = SafeEnv(Url($_POST['site']), 250, str, true);
        $icq = SafeEnv($_POST['icq'], 15, str, true);
        $text = SafeEnv($_POST['text'], System::config('gb/msgmaxlen'), str, true);
        $vals = Values('', $name, $email, $hideemail, $_site, $icq, $text, '', time(), getip(), $moderated);
        System::database()->Insert('guestbook', $vals);
        System::user()->ChargePoints(System::config('points/gb_public'));
        if (System::user()->isAdmin() || !System::config('gb/moderation')) {
            GO(GetSiteUrl() . Ufu('index.php?name=guestbook', '{name}/'));
        } else {
            $text = '<p align="center"><br>Спасибо! Ваше сообщение будет добавлено после модерации.<br><br>';
            $text .= '<input type="button" value="Назад" onclick="history.back();"><br></p>';
            System::site()->AddTextBox('', $text);
        }
    } else {
        $text = 'Ваше сообщение не добавлено по следующим причинам:<br><ul>';
        foreach ($er as $error) {
            $text .= '<li>' . $error;
        }
        $text .= '</ul><p align="center"><input type="button" value="Назад" onclick="history.back();"></p>';
        System::site()->AddTextBox('', $text);
    }
}
function IndexArticlesRead()
{
    if (isset($_GET['art'])) {
        $id = SafeEnv($_GET['art'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=articles', '{name}/'));
    }
    $where = "`id`='{$id}' and `active`='1'";
    System::database()->Select('articles', GetWhereByAccess('view', $where));
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=articles', '{name}/'));
    }
    $art = System::database()->FetchRow();
    System::database()->Update('articles', "hits='" . (SafeEnv($art['hits'], 11, int) + 1) . "'", $where);
    $cat = SafeDB($art['cat_id'], 11, int);
    // Показываем путь
    if (System::config('articles/show_catnav') == '1') {
        IndexArticlesGetTree()->BreadCrumbs($art['cat_id']);
    }
    System::site()->BreadCrumbAdd(SafeDB($art['title'], 255, str));
    System::site()->AddTemplatedBox('', 'module/article_read.html');
    System::site()->SetTitle(SafeDB($art['title'], 255, str));
    System::site()->SeoTitle = SafeDB($art['seo_title'], 255, str);
    System::site()->SeoKeyWords = SafeDB($art['seo_keywords'], 255, str);
    System::site()->SeoDescription = SafeDB($art['seo_description'], 255, str);
    RenderReadArticle($art);
    // Выводим комментарии
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    $posts = new Posts('articles_comments', $art['allow_comments'] == '1');
    $posts->EditPageUrl = "index.php?name=articles&op=editpost&art={$id}";
    // Форма редактирования поста
    $posts->DeletePageUrl = "index.php?name=articles&op=deletepost&art={$id}";
    // Удаление поста
    $posts->PostFormAction = "index.php?name=articles&op=addpost&art={$id}&cat={$cat}";
    // Добавление поста (сохранение)
    $posts->NavigationUrl = Ufu("index.php?name=articles&op=read&art={$id}&cat={$cat}", 'articles/{cat}/{art}/page{page}/', true);
    $posts->NavigationAnchor = '#comments';
    $posts->RenderPosts($id, 'article_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'article_comments_form');
}
Example #13
0
<link rel="stylesheet" href="xp.css" type="text/css">
<?php 
set_time_limit(0);
//error_reporting(0);
require "global.php";
echo "正在检查网址中...<br>";
print str_repeat(" ", 4096);
ob_flush();
flush();
sleep(1);
$url = $_GET["url"];
if (empty($url)) {
    echo tips("网址不能为空!");
    die;
}
insert_links($url);
GetUrl_AllSite(GetSiteUrl($url));
$db->close();
function IndexDownloadsFull()
{
    if (isset($_GET['file'])) {
        $id = SafeEnv($_GET['file'], 11, int);
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=downloads', '{name}/'));
    }
    System::database()->Select('downloads', GetWhereByAccess('view', "`id`='{$id}' and `active`='1'"));
    if (System::database()->NumRows() == 0) {
        GO(GetSiteUrl() . Ufu('index.php?name=downloads', '{name}/'));
    }
    $file = System::database()->FetchRow();
    $cat = SafeDB($file['category'], 11, int);
    IndexDownloadsGetTree()->BreadCrumbs($cat);
    System::site()->BreadCrumbAdd(SafeDB($file['title'], 255, str));
    System::site()->SetTitle('Скачать ' . SafeDB($file['title'], 255, str));
    System::site()->AddTemplatedBox('', 'module/download_full.html');
    AddDetailDownload($file);
    // Выводим комментарии
    if (isset($_GET['page'])) {
        $page = SafeEnv($_GET['page'], 11, int);
    } else {
        $page = 0;
    }
    include_once System::config('inc_dir') . 'posts.class.php';
    $posts = new Posts('downloads_comments', $file['allow_comments'] == '1');
    $posts->EditPageUrl = "index.php?name=downloads&op=editpost&file={$id}";
    // Форма редактирования поста
    $posts->DeletePageUrl = "index.php?name=downloads&op=deletepost&file={$id}";
    // Удаление поста
    $posts->PostFormAction = "index.php?name=downloads&op=addpost&file={$id}&cat={$cat}&page={$page}";
    // Добавление поста (сохранение)
    $posts->NavigationUrl = Ufu("index.php?name=downloads&op=full&file={$id}&cat={$cat}", 'downloads/{cat}/{file}/page{page}/', true);
    $posts->NavigationAnchor = '#comments';
    $posts->RenderPosts($id, 'download_comments', 'comments_navigation', false, $page);
    $posts->RenderForm(false, 'download_comments_form');
}
 /**
  * Устанавливает переменные страницы
  * @return void
  */
 protected function SetPage()
 {
     $this->AddVars('head', array('doctype' => $this->Doctype, 'title' => HtmlChars($this->GenerateTitle()), 'meta' => $this->GenerateMetaTags(), 'text' => $this->GenerateHead(), 'body_params' => $this->BodyParams, 'base' => GetSiteUrl()));
 }
function IndexUserRegistrationOk()
{
    System::site()->SetTitle('Регистрация на сайте');
    if (isset($_POST['usersave']) && $_POST['usersave'] == 'update') {
        $edit = true;
        $user_id = System::user()->Get('u_id');
        System::database()->Select('users', "`id`='" . $user_id . "'");
        $user = System::database()->FetchRow();
    } else {
        $edit = false;
    }
    if (!$edit) {
        System::user()->UnLogin(false);
    } else {
        if (!System::user()->Auth) {
            GO(Ufu('index.php'));
        }
    }
    if (System::config('user/registration') == 'off' && !$edit) {
        System::site()->AddTextBox('Ошибка', '<p align="center">Извините, регистрация временно приостановлена.</p>');
        return;
    }
    //Обрабатываем данные
    $errors = array();
    // Логин
    $login = '';
    $sendlogin = '';
    if (isset($_POST['login']) && CheckLogin(SafeEnv($_POST['login'], 30, str), $errors, true, $edit ? $user_id : 0)) {
        $login = SafeEnv($_POST['login'], 30, str);
        $sendlogin = $_POST['login'];
    }
    // Пароль
    $pass = '';
    $sendpass = '';
    $pass_generate_message = '';
    if (!System::user()->isAdmin() && $_POST['pass'] != '') {
        $pass = SafeEnv($_POST['pass'], 255, str);
        $rpass = SafeEnv($_POST['rpass'], 255, str);
        $sendpass = $_POST['pass'];
        if ($edit) {
            if ($rpass != '') {
                if (!CheckPass(SafeEnv($_POST['pass'], 255, str), $errors)) {
                    $pass = '';
                } elseif ($rpass != $pass) {
                    $errors[] = 'Пароли не совпадают.';
                    $pass = '';
                }
            } else {
                $pass = '';
            }
        } else {
            if ($_POST['pass'] == '') {
                srand(time());
                $pass = GenBPass(rand(System::config('user/pass_min_length'), 15));
                $sendpass = $pass;
                $pass_generate_message = '<br>Так как Вы не указали пароль, он был сгенерирован автоматически и выслан Вам на E-mail.';
            } else {
                if (CheckPass(SafeEnv($_POST['pass'], 255, str), $errors)) {
                    if ($rpass != $pass) {
                        $errors[] = 'Пароли не совпадают.';
                    }
                }
            }
        }
        $pass2 = md5($pass);
    }
    // E-mail
    if (!System::user()->isAdmin() && isset($_POST['email']) && CheckUserEmail(SafeEnv($_POST['email'], 50, str, true), $errors, true, $edit ? $user_id : 0)) {
        $email = SafeEnv($_POST['email'], 50, str, true);
    } else {
        $email = '';
    }
    // Скрыть E-mail
    if (isset($_POST['hideemail'])) {
        $hide_email = '1';
    } else {
        $hide_email = '0';
    }
    // Имя пользователя
    if (isset($_POST['nikname']) && CheckNikname(SafeEnv($_POST['nikname'], 50, str, true), $errors, true, $edit ? $user_id : 0)) {
        $nik_name = SafeEnv($_POST['nikname'], 50, str, true);
    } else {
        $nik_name = '';
    }
    // Настоящее имя
    if (isset($_POST['realname'])) {
        $real_name = SafeEnv($_POST['realname'], 250, str, true);
    } else {
        $real_name = '';
    }
    // Возраст лет
    if (isset($_POST['age'])) {
        if ($_POST['age'] == '' || is_numeric($_POST['age'])) {
            $age = SafeEnv($_POST['age'], 3, int);
        } else {
            $errors[] = 'Ваш возраст должен быть числом!';
        }
    } else {
        $age = '';
    }
    // Адрес домашней страницы
    if (isset($_POST['homepage'])) {
        $homepage = SafeEnv(Url($_POST['homepage']), 250, str, true);
    } else {
        $homepage = '';
    }
    // Номер ICQ
    if (isset($_POST['icq'])) {
        if ($_POST['icq'] == '' || is_numeric($_POST['icq'])) {
            $icq = SafeEnv($_POST['icq'], 15, str, true);
        } else {
            $errors[] = 'Номер ICQ должен содержать только числа!';
        }
    } else {
        $icq = '';
    }
    // Город
    if (isset($_POST['city'])) {
        $city = SafeEnv($_POST['city'], 100, str, true);
    } else {
        $city = '';
    }
    // Часовой пояс
    if (isset($_POST['gmt'])) {
        $gmt = SafeEnv($_POST['gmt'], 255, str);
    } else {
        $gmt = System::config('general/default_timezone');
    }
    // О себе
    if (isset($_POST['about'])) {
        $about = SafeEnv($_POST['about'], System::config('user/about_max_length'), str, true);
    } else {
        $about = '';
    }
    // Подписка на рассылку
    if (isset($_POST['snews'])) {
        $server_news = '1';
    } else {
        $server_news = '0';
    }
    if (!$edit && (!System::user()->Auth && !System::user()->isDef('captcha_keystring') || System::user()->Get('captcha_keystring') != $_POST['keystr'])) {
        $errors[] = 'Вы ошиблись при вводе кода с картинки.';
    }
    // Аватар
    $updateAvatar = true;
    if (isset($_POST['avatar'])) {
        if (System::config('user/avatar_transfer') == '1' && isset($_FILES['upavatar']) && file_exists($_FILES['upavatar']['tmp_name'])) {
            UserLoadAvatar($errors, $avatar, $a_personal, $user['avatar'], $user['a_personal'] == '1', $edit);
        } elseif ($_POST['avatar'] == '') {
            $updateAvatar = false;
        } elseif (file_exists(RealPath2(System::config('general/avatars_dir') . $_POST['avatar']))) {
            if ($edit) {
                if ($user['a_personal'] == '1') {
                    UnlinkUserAvatarFiles($user['avatar']);
                }
            }
            $a_personal = '0';
            $avatar = $_POST['avatar'];
        } else {
            $avatar = 'noavatar.gif';
            $a_personal = '0';
        }
    } else {
        $avatar = 'noavatar.gif';
        $a_personal = '0';
    }
    // Активация аккаунта
    $active = '1';
    $code = '';
    $SendActivation = false;
    $activate = '';
    if (!$edit) {
        $activate = System::config('user/activate_type');
        switch ($activate) {
            case 'manual':
                $active = '0';
                $code = '';
                $SendActivation = false;
                break;
            case 'auto':
                $active = '1';
                $code = '';
                $SendActivation = false;
                break;
            case 'mail':
                $active = '0';
                $code = GenRandomString(32);
                $SendActivation = true;
                break;
        }
    }
    $status = 2;
    $access = -1;
    $reg_date = time();
    $last_visit = time();
    $ip = getip();
    $points = 0;
    $visits = 0;
    // Сохранение
    if (count($errors) == 0) {
        if ($SendActivation) {
            UserSendActivationMail($nik_name, $email, $sendlogin, $sendpass, $code, $reg_date);
            $finish_message = Indent('
				<br>
				На указанный Вами E-Mail отправлено письмо,
				содержащее ссылку для подтверждения регистрации.
				Для активации Вашего аккаунта перейдите по данной ссылке
				и подтвердите регистрацию!
			');
        } elseif (!$edit) {
            UserSendEndRegMail($email, $nik_name, $sendlogin, $sendpass, $reg_date);
            $finish_message = '<br>На ваш E-mail отправлено письмо с данными о регистрации.';
        }
        if (!$edit) {
            // Добавление нового пользователя
            $values = Values('', $login, $pass2, $nik_name, $real_name, $age, $email, $hide_email, $city, $icq, $homepage, $gmt, $avatar, $about, $server_news, $reg_date, $last_visit, $ip, $points, $visits, $active, $code, $status, $access, $a_personal, serialize(array()));
            System::database()->Insert('users', $values);
            // Очищаем кэш пользователей
            System::cache()->Delete(system_cache, 'users');
            // Автоматический вход
            if ($activate == 'auto') {
                System::user()->Login($login, $pass, true, false);
                System::site()->InitVars();
            } elseif ($activate == 'mail') {
                System::user()->Def('activate_ps', base64_encode($pass));
            }
            System::site()->AddTextBox('Регистрация', '<p align="center">Поздравляем! Вы успешно зарегистрированы на сайте.' . $pass_generate_message . $finish_message . '<br>С уважением, администрация сайта <strong>' . System::config('general/site_name') . '.</strong></p>');
        } else {
            // Сохранение изменений
            $set = "`login`='{$login}',`hideemail`='{$hide_email}',`name`='{$nik_name}'," . "`truename`='{$real_name}',`age`='{$age}',`url`='{$homepage}',`icq`='{$icq}',`city`='{$city}',`timezone`='{$gmt}'" . ($updateAvatar == true ? ",`avatar`='{$avatar}',`a_personal`='{$a_personal}'" : '') . ",`about`='{$about}'," . "`servernews`='{$server_news}'" . ($pass != '' ? ",`pass`='{$pass2}'" : '') . ($email != '' ? ",`email`='{$email}'" : '');
            System::database()->Update('users', $set, "`id`='" . System::user()->Get('u_id') . "'");
            System::user()->UpdateMemberSession();
            UpdateUserComments(System::user()->Get('u_id'), System::user()->Get('u_id'), $nik_name, $email, $hide_email, $homepage, getip());
            // Очищаем кэш пользователей
            System::cache()->Delete(system_cache, 'users');
            GO(GetSiteUrl() . Ufu('index.php?name=user&op=userinfo', 'user/{op}/'));
        }
    } else {
        // Ошибка
        $text = 'Ваш аккаунт не ' . ($edit ? 'сохранен' : 'добавлен') . ', произошли следующие ошибки:<br><ul>';
        foreach ($errors as $error) {
            $text .= '<li>' . $error;
        }
        $text .= '</ul>';
        // Удаляем аватар
        if ($a_personal == '1' && !$edit) {
            unlink(System::config('general/personal_avatars_dir') . $avatar);
        }
        System::site()->AddTextBox('Ошибка', $text);
        IndexUserRegistration(true, $edit);
    }
}
Example #17
0
?>
">给<?php 
echo $config["name"];
?>
留言</a>&nbsp;&nbsp;<!--联系站长QQ:22568190-->
</td></tr></table>
</td>
<td></td>
</tr></form></table>
<?php 
//print_r($wd_split);
$pos = strstr(strtolower($wd), "site:");
//echo $pos;
if (strlen($pos) > 5) {
    $is_site = true;
    $domain = GetSiteUrl($wd);
    $domain = str_replace("site:", "", $domain);
    $sql = "select * from ve123_links where title<>'' and url like '%" . str_replace("site:", "", $domain) . "%'";
    $sql_count = "select link_id from ve123_links where title<>'' and url like '%" . str_replace("site:", "", $domain) . "%'";
} else {
    $domain = "";
}
$search = new search();
$data = $search->q($wd, $domain);
$total = $search->total;
$wd_split = $search->wd_split;
$wd_array = $search->wd_array;
$wd_count = $search->wd_count;
$totalpage = $search->totalpage;
//$tg=$search->GetTg();
//print_r($data);
Example #18
0
function insert_links($url)
{
    global $db, $config;
    $spider = new spider();
    $spider->url($url);
    $links = $spider->links();
    $sites = $spider->sites();
    foreach ($sites as $value) {
        $site_url = GetSiteUrl($link);
        $site = $db->get_one("select * from ve123_sites where url='" . $site_url . "'");
        $site_id = $site["site_id"];
        $row = $db->get_one("select * from ve123_links where url='" . $value . "'");
        if (empty($row) && is_url($value)) {
            echo $value . "<br>";
            $array = array('url' => $value, 'site_id' => $site_id, 'level' => '0');
            $db->insert("ve123_links", $array);
        } else {
            echo "已存在:" . $value . "<br>";
        }
        ob_flush();
        flush();
        //sleep(1);
        $row = $db->get_one("select * from ve123_sites where url='" . $value . "'");
        if (empty($row) && is_url($value)) {
            $array = array('url' => $value, 'spider_depth' => $config["spider_depth"], 'addtime' => time());
            $db->insert("ve123_sites", $array);
        }
    }
    //sleep(1);
    foreach ($links as $value) {
        $row = $db->get_one("select * from ve123_links_temp where url='" . $value . "'");
        if (empty($row) && is_url($value)) {
            $array = array('url' => $value);
            $db->insert("ve123_links_temp", $array);
        }
    }
}
/**
 * Отправка письма с новым паролем
 * @param $user_mail
 * @param $name
 * @param $login
 * @param $pass
 * @return void
 */
function UserSendForgotPassword($user_mail, $name, $login, $pass)
{
    $ip = getip();
    $text = Indent('
		Здравствуйте, [' . $name . ']!

		На сайте ' . GetSiteDomain() . '
		было запрошено напоминание пароля.

		Имя: ' . $name . '

		Ваш логин и новый пароль:
		логин: ' . $login . '
		пароль: ' . $pass . '

		Изменить данные аккаунта вы можете по адресу:
		' . GetSiteUrl() . Ufu('index.php?name=user&op=editprofile', 'user/{op}/') . '

		IP-адрес, с которого был запрошен пароль: ' . $ip . '

		С уважением, администрация сайта ' . GetSiteDomain() . '.
	');
    SendMail($name, $user_mail, '[' . GetSiteDomain() . '] Напоминание пароля', $text);
}
function CommentsAddPost($ObjectId, $CommentsTable, $ObjectsTable, $CounterField, $AlloyField, $BackUrl, $BackUrlUfu, $PageParam = 'page', $PageParamUfu = null, $BackUrlUfuSuffix = '')
{
    $parent_id = explode('_', $_POST['parent_id'], 2);
    if ($parent_id[1] == 0) {
        $sp = false;
    } else {
        $sp = true;
    }
    if (!isset($PageParamUfu)) {
        $PageParamUfu = $PageParam;
    }
    $back_url = GetSiteUrl() . Ufu($BackUrl . ($sp ? "&{$PageParam}=" . $_GET[$PageParam] : ''), $BackUrlUfu . ($sp ? $PageParamUfu . '{' . $PageParam . '}' : '') . $BackUrlUfuSuffix);
    // -----------------------------------------------------
    System::database()->Select($ObjectsTable, "`id`='{$ObjectId}'");
    $obj = System::database()->FetchRow();
    $alloy_comments = $obj[$AlloyField] == '1';
    $posts = new Posts($CommentsTable, $alloy_comments);
    if ($posts->SavePost($ObjectId, false)) {
        $post_id = System::database()->GetLastId();
        $counter = $obj[$CounterField] + 1;
        System::database()->Update($ObjectsTable, "`{$CounterField}`='{$counter}'", "`id`='{$ObjectId}'");
        $parent_id = explode('_', $_POST['parent_id'], 2);
        $parent_id = SafeDB($parent_id[1], 11, int);
        $post_anchor = $parent_id != 0 ? "#post_{$parent_id}" : '#post_' . $post_id;
        GO($back_url . $post_anchor);
    } else {
        System::site()->AddTextBox('Ошибка', $posts->PrintErrors());
    }
}
Example #21
0
function add_links($url, $is_index_page = true, $num = '')
{
    global $db;
    $new_links = array();
    $j = 1;
    $url_htmlcode = get_url_content($url);
    $url_htmlcode = get_encoding($url_htmlcode, "GB2312");
    $links = get_links($url_htmlcode, $url, 1, $url);
    if ($is_index_page) {
        foreach ($links as $value) {
            $new_links[] = GetSiteUrl($value);
        }
    } else {
        $new_links = $links;
    }
    $new_links = distinct_array($new_links);
    foreach ($new_links as $value) {
        echo $value . "<br>";
        flush();
        $query = $db->query("select * from ve123_links where url='{$value}'");
        $num = $db->num_rows($query);
        if ($num == 0) {
            if (!add_update_link($value, "", "", "add")) {
                continue;
            }
            $j++;
            if (!empty($num)) {
                if ($j >= $num) {
                    exit;
                }
            }
        }
    }
}
        } elseif (!CheckEmail($admin_email)) {
            $errors[] = 'Формат E-mail не правильный. Он должен быть вида: <b>domain@host.ru</b> .';
        }
        if (count($errors) > 0) {
            $this->SetTitle("Создание учетной записи Главного администратора");
            $text = 'Ошибки:<br /><ul>';
            foreach ($errors as $error) {
                $text .= '<li>' . $error;
            }
            $text .= '</ul>';
            $this->SetContent($text);
            $this->AddButton('Назад', 'admin&p=1');
        } else {
            // Изменяем главного администратора
            $login = SafeEnv($admin_login, 255, str);
            $pass2 = md5($admin_pass);
            $email = SafeEnv($admin_email, 255, str);
            System::database()->Update('users', "`login`='{$login}',`pass`='{$pass2}',`email`='{$email}'", "`id`='1'");
            // Автоматически определяем и устанавливаем URL сайта в настройках.
            ConfigSetValue('general', 'site_url', GetSiteUrl());
            // Устанавливаем Email сайта - такой-же как и у администратора
            ConfigSetValue('general', 'site_email', $email);
            // Изменяем email Департамента обратной связи
            System::database()->Update('feedback', "`email`='{$email}'", "`id`='1'");
            // Создаём бекап базы данных
            $backupfilename = System::config('backup_dir') . date("Y.m.d_H.i.s_") . GenRandomString(8, 'abcdefghijklmnopqrstuvwxyz0123456789') . '.' . System::database()->Name . '.zip';
            System::database()->CreateBackupFile($backupfilename);
            GO('setup.php?mod=finish');
        }
        break;
}
/*
 * LinkorCMS 1.4
 * © 2012 LinkorCMS Development Group
 */
define('RSS_SCRIPT', true);
define('VALID_RUN', true);
require 'config/init.php';
// Конфигурация и инициализация
@header("Content-Type: text/xml");
@header("Cache-Control: no-cache");
@header("Pragma: no-cache");
$rss_title = 'Новости на ' . System::config('general/site_url');
$rss_link = System::config('general/site_url');
$rss_description = 'RSS канал сайта ' . System::config('general/site_url') . '.';
$rss = new RssChannel($rss_title, $rss_link, $rss_description);
$rss->pubDate = gmdate('D, d M Y H:i:s') . ' GMT';
$rss->generator = CMS_NAME . ' ' . CMS_VERSION;
$rss->managingEditor = '*****@*****.**';
$rss->webMaster = System::config('general/site_email');
$num = 10;
// Пока максимум 10 заголовков по умолчанию
$news = System::database()->Select('news', "`enabled`='1'", $num, 'date', true);
foreach ($news as $s) {
    $title = SafeDB($s['title'], 255, str);
    $description = SafeDB($s['start_text'], 4048, str);
    $link = HtmlChars(GetSiteUrl() . Ufu('index.php?name=news&op=readfull&news=' . $s['id'] . '&topic=' . $s['topic_id'], 'news/{topic}/{news}/'));
    $pubDate = gmdate('D, d M Y H:i:s', $s['date']) . ' GMT';
    $rss->AddItem($title, $description, $link, $pubDate, $link);
}
echo $rss->Generate();
function IndexMailSubscribe()
{
    global $mail_selected;
    if (isset($_POST['topic_id'])) {
        $topic_id = SafeEnv($_POST['topic_id'], 11, int);
        if (!isset($_POST['mail_block_form'])) {
            GO(GetSiteUrl() . Ufu('index.php?name=mail&op=topics', 'mail/{op}/'));
        }
        $html = SafeEnv($_POST['html'], 1, int);
    } elseif (isset($_GET['topic_id'])) {
        $topic_id = SafeEnv($_GET['topic_id'], 11, int);
        $html = 1;
    } else {
        GO(GetSiteUrl() . Ufu('index.php?name=mail&op=topics', 'mail/{op}/'));
    }
    System::database()->Delete('mail_list', "`email`='{$mail_selected}' and `topic_id`='{$topic_id}'");
    if (System::user()->Auth) {
        $user_id = System::user()->Get('u_id');
    } else {
        $user_id = 0;
    }
    System::database()->Select('mail_topics', "`id`='{$topic_id}'");
    $topic = System::database()->FetchRow();
    $count = SafeDB($topic['count'], 11, int) + 1;
    System::database()->Update('mail_topics', "count='{$count}'", "`id`='{$topic_id}'");
    $vals = Values($user_id, $topic_id, $mail_selected, $html);
    System::database()->Insert('mail_list', $vals);
    $back = Ufu('index.php?name=mail&op=topics', 'mail/{op}/');
    System::site()->AddTextBox('Рассылки', '<p align="center"><br>Спасибо, что Вы подписались на нашу рассылку.<br>Список других рассылок сайта можете посмотреть <a href="' . $back . '">Здесь</a>.<br><br><a href="javascript:history.go(-1)">Вернуться назад</a>.<br><br></p>');
}
Example #25
0
			// prevent aliases mixing
			if( $cUserNameField != $cEmailField )
				$strSQL.= ",".GetFullFieldName($cEmailField,"webreport_users",false)." as ".AddFieldWrappers($cEmailField);

				
			$strSQL = $selectClause." from ".AddTableWrappers("webreport_users")." where ".$sWhere;
			
			$rs = db_query($strSQL, $conn);
			$data = $cipherer->DecryptFetchedArray($rs);
			if($data)
			{
				$password=$data[$cPasswordField];
				$strUsername = $data[$cUserNameField];
		
	
				$url = GetSiteUrl();
				$url.= $_SERVER["SCRIPT_NAME"];
				$url2 = str_replace("remind.","login.",$url)."?username="******"";
							


$layout = new TLayout("remind_success2", "BoldOrange", "MobileOrange");
$layout->version = 2;
$layout->blocks["top"] = array();
$layout->containers["remindsuccess"] = array();
$layout->containers["remindsuccess"][] = array("name"=>"remindheader", 
	"block"=>"remindheader", "substyle"=>2  );

$layout->containers["remindsuccess"][] = array("name"=>"wrapper", 
	"block"=>"", "substyle"=>1 , "container"=>"fields" );
<?php

// LinkorCMS Проверка пользователя
if (!($GLOBALS['userAuth'] === 1 && $GLOBALS['userAccess'] === 1 && System::user()->AllowCookie(System::user()->AdminCookieName, true))) {
    exit('Access Denied!');
}
//////////////////////////////////
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderConnector.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinder.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderVolumeDriver.class.php';
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'elFinderVolumeLocalFileSystem.class.php';
$opts = array('debug' => false, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => 'uploads/', 'URL' => GetSiteUrl() . 'uploads/', 'tmbSize' => 80, 'tmbCrop' => false, 'uploadAllow' => array('application/x-executable', 'application/vnd.ms-word', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint', 'application/vnd.ms-powerpoint', 'application/pdf', 'application/xml', 'application/vnd.oasis.opendocument.text', 'application/x-shockwave-flash', 'application/x-bittorrent', 'application/x-jar', 'application/x-gzip', 'application/x-gzip', 'application/x-bzip2', 'application/x-bzip2', 'application/x-bzip2', 'application/zip', 'application/x-rar', 'application/x-tar', 'application/x-7z-compressed', 'text/plain', 'text/html', 'text/html', 'text/javascript', 'text/css', 'text/rtf', 'text/rtfd', 'text/xml', 'text/x-sql', 'text/plain', 'text/x-comma-separated-values', 'image/x-ms-bmp', 'image/jpeg', 'image/jpeg', 'image/gif', 'image/png', 'image/tiff', 'image/tiff', 'image/x-targa', 'image/vnd.adobe.photoshop', 'image/vnd.adobe.photoshop', 'image/xbm', 'image/pxm', 'audio/mpeg', 'audio/midi', 'audio/ogg', 'audio/ogg', 'audio/x-m4a', 'audio/wav', 'audio/x-ms-wma', 'video/x-msvideo', 'video/x-dv', 'video/mp4', 'video/mpeg', 'video/mpeg', 'video/quicktime', 'video/x-ms-wmv', 'video/x-flv', 'video/x-matroska', 'video/webm', 'video/ogg', 'video/ogg'), 'accessControl' => 'ElFinderAccess')));
function ElFinderAccess($attr, $path, $data, $volume)
{
    return strpos(basename($path), '.') === 0 ? !($attr == 'read' || $attr == 'write') : null;
    // else elFinder decide it itself
}
// run elFinder
$connector = new elFinderConnector(new elFinder($opts));
$connector->run();