Beispiel #1
0
    function get_head()
    {
        global $page;
        global $key;
        global $desc;
        $_TITLE = get_title();
        if (isset($_REQUEST['id'])) {
            $desc = print_article("meta_description");
            $key = print_article("meta_key_words");
        } elseif ($page == 'static') {
            $desc = print_static("meta_description");
            $key = print_static("meta_key_words");
        }
        if ($page == 'crt_artcl' || $page == 'game_redactor' || $page == 'admin') {
            $ckeditor = '<script type="text/javascript" src="' . ENGINE_URL . '/lib/ckeditor/ckeditor.js"></script>';
        } else {
            $ckeditor = '';
        }
        $_TITLE = array_reverse($_TITLE);
        $title = implode(' | ', $_TITLE);
        $r = '
                            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                            <meta name="description" content="' . $desc . '" />
                            <meta name="keywords" content="' . $key . '" />
                            <meta name="generator" content="Tractor Engine">
                            <meta name="htotutunas" content="' . ENGINE_URL . '">
                            <title>' . $title . '</title>
                            <link href="' . ENGINE_URL . '/lib/geshi/code_style.css" rel="stylesheet" type="text/css" media="all" />
                            <link title="' . my_lang('feed_desc') . '" href="' . SITE_RSS . '" type=application/rss+xml rel=alternate>
                            <link rel="icon" href="' . SITE_URL . '/favicon.png" type="image/x-icon" /> 

            ' . $ckeditor;
        return $r;
    }
/**
 * Copyright 2012, Eugene Poberezkin. All rights reserved.
 * http://WhoYouMeet.com - a missing link for business dating
 *
 *---------------------------------------------------------------
 * File /application/helpers/MY_language_helper.php
 *
 * Extends language helper
 *---------------------------------------------------------------
 *
 */
function my_page_title($page, $add_str = '')
{
    $title = lang('page_title_prefix');
    //$title .= ($add_before ? $add_str . lang($page) : lang($page) . $add_str);
    $title .= my_lang($page, $add_str);
    $title .= lang('page_title_postfix');
    return $title;
}
Beispiel #3
0
 function registration($login, $pass, $email, $name, $flag_email_approve)
 {
     $login = mysql_escape_string(killMagic($login));
     $pass = mysql_escape_string(killMagic($pass));
     $email = mysql_escape_string(killMagic($email));
     $name = mysql_escape_string(killMagic($name));
     $stor = new Storage();
     $stor = $stor->storType(TE_STORTYPE);
     $hamster = $stor->make('hamster');
     $hamster->setProperty('login', $login);
     $data = $hamster->getList();
     $hamster = $stor->make('hamster');
     $hamster->setProperty('email', $email);
     $e_data = $hamster->getList();
     if ($name == "") {
         $name = $login;
     }
     if (count($data) > 0) {
         $regmes = my_lang('regist_t1');
     } elseif (count($e_data) > 0) {
         $regmes = my_lang('regist_t2');
     } else {
         // подтвердить email
         if ($flag_email_approve !== true) {
             $eapp = 0;
         } else {
             $eapp = 1;
             sub_add($email);
             // lib.php
         }
         $user = array('status' => 'user', 'login' => $login, 'name' => $name, 'email' => $email, 'password' => $pass, 'approve' => $eapp);
         $hamster->setProps($user);
         $hamster->add();
         $_SESSION['login'] = $login;
         $_SESSION['pass'] = $pass;
         $_SESSION['name'] = $name;
         $hamster->setProperty('login', $login);
         $hamster->get();
         $data = array();
         $data = $hamster->getProps();
         $_SESSION['author_id'] = $data['id'];
         $_SESSION['status'] = $data['status'];
         $_SESSION['tz'] = $data['tz'];
         if ($flag_email_approve !== true) {
             include_once 'lib/mail_lib.php';
             send_email_req($data);
         }
         $regmes = true;
     }
     return $regmes;
 }
Beispiel #4
0
/** 
* Tractor Engine
* [микро]библиотека для загрузки файлов на сервер
* $max_size = (3*(2^(20))) = 3 Мб по умолчанию
* Перед использованием: создать папку user в корне сайта (chmod 777)
**/
function upload_file($max_size = 3145728, $dir = '', $cerber = true)
{
    if ($_FILES) {
        if ($dir != '') {
            $dir = '/' . $dir;
        }
        switch ($_FILES['filename']['type']) {
            case 'image/jpeg':
                $ext = 'jpg';
                break;
            case 'image/jpeg':
                $ext = 'jpeg';
                break;
            case 'image/pjpeg':
                $ext = 'jpg';
                break;
            case 'image/png':
                $ext = 'png';
                break;
            default:
                $ext = '';
        }
        if ($cerber == true) {
            if ($ext == true && $_FILES['filename']['size'] < intval($max_size)) {
                $file = time() . '.' . $ext;
            }
            /* 			else $mes=my_lang('lib_upload_t3');//тип не поддерживается */
        } else {
            $file = $_FILES['filename']['name'];
            if (is_file(INDEX_DIR . '/user' . strval($dir) . '/' . $_FILES['filename']['name'])) {
                $file = time() . '_' . $_FILES['filename']['name'];
            }
        }
        $m = move_uploaded_file($_FILES['filename']['tmp_name'], INDEX_DIR . '/user' . strval($dir) . '/' . $file);
        if ($m) {
            $mes = my_lang('lib_upload_t1') . '<br/>' . SITE_URL . '/user' . strval($dir) . '/' . $file;
        } else {
            sleep(2);
            if ($m) {
                $mes = my_lang('lib_upload_t1') . '<br/>' . SITE_URL . '/user' . strval($dir) . '/' . $file;
            } else {
                $mes = my_lang('lib_upload_t4');
            }
        }
    }
    return $mes;
}
Beispiel #5
0
function upd_static()
{
    $prs = array();
    $prs = updPageFormHlr();
    // обработчик формы, готовит данные
    $stor = new Storage();
    $stor = $stor->storType(TE_STORTYPE);
    $page = $stor->make('page');
    $page->setProps($prs);
    //устанавливаем свойства объекта
    // обновляем запись
    $res = $page->upd($prs);
    if ($res) {
        $mes = '<i>' . my_lang('crt_artcl_t9') . '</i>';
    } else {
        $mes = '<i>' . my_lang('error') . '</i>';
    }
}
Beispiel #6
0
 function print_static($c, $id = "")
 {
     global $_URL;
     if ($id == "") {
         $id = $_REQUEST['s'];
     }
     $stor = new Storage();
     $stor = $stor->storType(TE_STORTYPE);
     $h = $stor->make('page');
     //Если задан идентификатор записи
     if (isset($_REQUEST['s'])) {
         $h->setProperty('id', $id);
     } else {
         $h->setProperty('sef', strtolower($_URL[0]));
     }
     if ($h->get()) {
         $static = $h->getProps();
     }
     $_REQUEST['s'] = $static['id'];
     if (isset($static['id'])) {
         if ($c == "title") {
             return $static['title'];
         }
         if ($c == "sef") {
             return $static['sef'];
         }
         if ($c == "content") {
             return $static['content'];
         }
         if ($c == "meta_key_words") {
             return $static['meta_key_words'];
         }
         if ($c == "meta_description") {
             return $static['meta_description'];
         }
     } else {
         return my_lang('error');
     }
 }
Beispiel #7
0
function profile($pass, $email, $name, $tz, $resp = '')
{
    $pstl = strlen($pass);
    $pro_data = get_profile(intval($_SESSION['author_id']));
    $stor = new Storage();
    $stor = $stor->storType(TE_STORTYPE);
    $user = $stor->make('hamster');
    $user->setProperty('email', $email);
    $res = $user->get();
    if ($res !== false) {
        $e_data = $user->getProps();
    } else {
        $e_data = false;
    }
    $name_user = $stor->make('hamster');
    $name_user->setProperty('name', $name);
    $res = $name_user->get();
    if ($res !== false) {
        $n_data = $name_user->getProps();
    } else {
        $n_data = false;
    }
    if ($name == "") {
        $name = $_SESSION['login'];
    }
    // чужой email
    if ($e_data !== false && $e_data['email'] == $email && $e_data['id'] != $_SESSION['author_id']) {
        $regmes = my_lang('profile_t1');
    } elseif ($n_data !== false && $n_data['id'] != $_SESSION['author_id']) {
        $regmes = my_lang('profile_t8');
    } elseif ($pass !== '' && ($pstl < 3 or $pstl > 45)) {
        $regmes = my_lang('profile_t2');
    } elseif (filter_var($email, FILTER_VALIDATE_EMAIL) == false) {
        $regmes = my_lang('feedback_t1');
    } elseif (intval($tz) < -12 || intval($tz) > 12) {
        exit;
    } else {
        $name = mysql_escape_string(killMagic($name));
        $pass = mysql_escape_string(killMagic($pass));
        $email = mysql_escape_string(killMagic($email));
        $tz = intval($tz);
        if (!isset($_REQUEST['new_resp'])) {
            $resp = $pro_data['respect'];
        } else {
            $resp = htmlspecialchars(killMagic($resp));
        }
        if ($pro_data['email'] !== $email) {
            include_once 'lib/mail_lib.php';
            loot_add($email);
            $reg = Registry::instance();
            $hamster = $reg->get('hamster_info');
            $hamster['email'] = $email;
            send_email_req($hamster);
            $regmes .= my_lang('profile_t5') . '<br/>';
        }
        $props = array('name' => $name, 'tz' => $tz, 'id' => $_SESSION['author_id'], 'respect' => $resp);
        if ($pass !== '') {
            $props['password'] = sha1($pass);
        }
        $user = $stor->make('hamster');
        $user->setProperty('id', $_SESSION['author_id']);
        $sql_upd = $user->upd($props);
        if ($sql_upd == true) {
            $regmes .= my_lang('profile_t3');
        } else {
            $regmes .= my_lang('error');
        }
        $pro_data = get_profile(intval($_SESSION['author_id']));
        $_SESSION['pass'] = $pro_data['password'];
        $_SESSION['name'] = $pro_data['name'];
        $_SESSION['tz'] = $pro_data['tz'];
    }
    return $regmes;
}
 /**
  * 4. Sends verification email to user
  */
 function send_verification_email($user, $key)
 {
     $this->load->language('emails');
     $this->load->library('email', array('mailtype' => 'html'));
     $this->email->from('*****@*****.**', my_lang('email_from_WYM'));
     $this->email->to($user->email);
     $this->email->subject(my_lang('email_send_verification_subject'));
     $message = my_lang('email_hi_user', $user->fullname);
     $message .= $message .= my_lang('email_send_verification_thanks');
     $message .= my_lang('email_send_verification_link', base_url() . 'signup/verify_email/' . $key);
     $message .= my_lang('email_WYM_signature');
     $this->email->message($message);
     return $this->email->send();
 }
Beispiel #9
0
 $cat = get_dir_list();
 //нажата кнопка
 if (isset($_REQUEST['doupload'])) {
     if (is_sid()) {
         //если имеем дело с человеком, вкл. библиотеку
         $d = strval($_REQUEST['dir']);
         if (!isset($cat[$d]) || $d == '') {
             $d = '';
         } else {
             $d = $cat[$d];
         }
         require_once TE_DIR . '/lib/upload.php';
         $uns = upload_file($max_size = 10145728, $dir = $d, $cerber = false);
         //вернет сообщение об успешности загрузки
     } else {
         $uns = my_lang('feedback_t3');
     }
     //Бот
 } else {
     $uns = '';
 }
 echo '<h2>Загрузка</h2><hr noshade size="1"><br/>';
 // ответ
 echo '<p><span class="mes">' . $uns . '</span></p>';
 // форма
 echo '
 <form 
         method="post" 
         action="' . SITE_URL . '/window/upload" 
         enctype="multipart/form-data">
     <input type="hidden" name="sid" value="' . get_sid() . '">
Beispiel #10
0
        if ($valid == 1) {
            // подключаем библиотеку
            require_once TE_DIR . '/lib/mail_lib.php';
            // получаем список админов
            $stor = new Storage();
            $stor = $stor->storType(TE_STORTYPE);
            $h = $stor->make('hamster');
            $h->setProperty('status', 'admin');
            $db = $h->getList();
            // отправляем
            if (count($db > 0)) {
                foreach ($db as $data) {
                    if ($data['email'] !== '') {
                        // отправляем
                        mail_connect($data['email'], $_REQUEST['from'], $_REQUEST['replay'], $_REQUEST['text']);
                    } else {
                        $fail = true;
                    }
                }
            }
            if ($fail == true) {
                $mes = my_lang('feedback_t5');
            } else {
                $mes = my_lang('feedback_t4');
            }
            // успех
        }
    }
    $reg = Registry::instance();
    $reg->set('feedback_msg', $mes);
}
Beispiel #11
0
        $sub->setProperty('email', mysql_escape_string(killMagic($_REQUEST['email'])));
        $sub_data = $sub->getList();
        if (!empty($sub_data)) {
            $c_mes = my_lang('subscribtion_t4');
        } else {
            $sub->setProperty('email', mysql_escape_string(killMagic($_REQUEST['email'])));
            if ($sub->add()) {
                $c_mes = my_lang('subscribtion_t5');
                //получаем id
                $sub->get();
                $data = $sub->getProps();
                //отправляем извещение по почте
                include TE_DIR . "/lib/mail_lib.php";
                $text = my_lang('subscribtion_t6');
                //получатель
                $to = $_REQUEST['email'];
                //код, по которому можно будет отписаться - уникальный id подписчика
                $code = $data['id'];
                //отправляем
                onemail($to, $text, $code);
            } else {
                $c_mes = my_lang('error');
            }
        }
    }
}
$reg = Registry::instance();
$reg->set('subscription_msg', $c_mes);
//Необязательно, используется модулем headers.
$desc = 'Рассылки Tractor Engine';
$key = 'рассылка, tractor+engine';
Beispiel #12
0
    function print_comments_form()
    {
        global $sid;
        global $_URL;
        $string .= '
            <a name="comment_form">
            <form method="post" action="' . get_link('article') . '#comment_form" name="upd_comm">
                    <input type="hidden" name="comment_sid" value="' . $sid . '">';
        //Обязательное поле. Антиспам. $sid генерируется модулем comments, там же проверяется.
        if (!isset($_SESSION['login'])) {
            $string .= '
                    <table style="text-align: left; margin-right: 10px; border: 0px;">
                            <tr style="border: 0px;">
                                    <td style="border: 0px; padding: 1px; width: 70px;">' . my_lang('name') . ':</td>				
                                    <td style="border: 0px; padding: 1px; text-align: left;"><input class="comment" name="comment_name"></td>
                            </tr><tr>
                                    <td style="border: 0px; padding: 1px;">' . my_lang('email') . ':</td> 
                                    <td style="border: 0px; padding: 1px;"><input class="comment" name="comment_email"></td>
                            </tr><!--<tr>
                                    <td style="border: 0px; padding: 1px;"><img class="captcha" src="' . ENGINE_URL . '/lib/captcha.php?id=' . $_REQUEST['id'] . '"></td>
                                    <td style="border: 0px; padding: 1px;"><input class="comment" name="captcha"></td>
                            </tr>-->
                    </table>';
        }
        $string .= '<textarea name="comment_text" cols="45" rows="4" >' . $_REQUEST['comment_text'] . '</textarea><br/>
                    <input class="unit_button" name="new_comment" value="Отправить" type="submit">		

            </form><br/>';
        return $string;
    }
Beispiel #13
0
function send_email_req($hamster)
{
    // шаблон
    $reg = Registry::instance();
    $stor = new Storage();
    $stor = $stor->storType(TE_STORTYPE);
    $t = $stor->make('loot');
    $t->setProperty('suptitle', 'notice_tmpl');
    $t->get();
    $tmpl_data = $t->getProps();
    $tpl = $tmpl_data['suptext'];
    $mail = $tpl;
    // текст
    $text = my_lang('regist_req') . '   
        ' . SITE_URL . '/window/profile?approve_id=' . $hamster['id'] . '&hash=' . $hamster['hash'];
    $mail = strtr($mail, array("{TO}" => trim($hamster['email']), "{TEXT}" => $text));
    // отправляем
    $mail = mailenc($mail);
    $res = mailx($mail);
    if ($res) {
        return true;
    }
    return false;
}
Beispiel #14
0
            if ($k == $_SESSION['tz']) {
                $option_flag = "SELECTED";
            } else {
                $option_flag = "";
            }
            echo '<OPTION  VALUE="' . $k . '" ' . $option_flag . '>';
            echo $v;
        }
        echo '</SELECT><br/><br/>
            <input class="unit_button" name="edit_user" value="Обновить" type="submit"><br/><br/>

         </form><tt>';
    } else {
        $pro_data = get_profile($_REQUEST['author_id']);
        if ($pro_data['approve'] != 1) {
            $appr = '<b>(' . my_lang('profile_t7') . ')</b>';
        }
        $gra = get_gravatar($pro_data['email'], 50);
        echo '<h2>Профиль</h2>
        <hr>
        <br>';
        echo $gra['img'] . '
            <div style="padding: 0px; margin-left: 60px; margin-bottom: 30px; border: 0px;
            font-family:monospace; font-size: 12px;">
                    Имя/псевдоним: ' . $pro_data['name'] . '<br />
                    E-Mail: ' . str_replace('@', '[гав]', $pro_data['email']) . '  ' . $appr . '
            </div>';
        if ($pro_data['respect'] !== '' && !empty($pro_data['respect'])) {
            echo '<p><pre style="white-space: pre;           /* CSS 2.0 */
                                    white-space: pre-wrap;      /* CSS 2.1 */
                                    white-space: pre-line;      /* CSS 3.0 */
Beispiel #15
0
 function print_article($cont)
 {
     global $article;
     $_REQUEST['category_id'] = $article['category_id'];
     if ($article != false) {
         switch ($cont) {
             case "id":
                 return $article['id'];
                 break;
             case "sef":
                 return $article['sef'];
                 break;
             case "title":
                 return $article['title'];
                 break;
             case "content":
                 return $article['content'];
                 break;
             case "meta_key_words":
                 return $article['meta_key_words'];
                 break;
             case "meta_description":
                 return $article['meta_description'];
                 break;
             case "category_id":
                 return $article['category_id'];
                 break;
             case "author_id":
                 return $article['author_id'];
                 break;
             case "author":
                 return $article['author'];
                 break;
             case "stamp":
                 return $article['stamp'];
                 break;
             case "date":
                 return $article['date'];
                 break;
         }
     } else {
         return my_lang('error');
     }
 }
Beispiel #16
0
 }
 //Новая статья.
 if (@$_REQUEST['action'] == "new") {
     //Если нажата кнопка, создаем запись
     if (isset($_REQUEST['sub'])) {
         $prs = array();
         $prs = newArtlFormHlr();
         $prs['approve'] = 1;
         $stor = new Storage();
         $stor = $stor->storType(TE_STORTYPE);
         $artcl = $stor->make('article');
         $artcl->setProps($prs);
         if ($artcl->add()) {
             $mes = '<i>' . my_lang('crt_artcl_t8') . '</i>';
         } else {
             $mes = '<i>' . my_lang('error') . '</i>';
         }
     }
     //значения для формы
     $db_title = '';
     $db_description = '';
     $db_content = '';
     $db_meta_key_words = '';
     $db_meta_description = '';
     $db_sef = '';
     $userloc = gm2local(local2gm(time(), TZ), TZ);
     $db_d = date("d", $userloc);
     $db_m = date("m", $userloc);
     $db_y = date("Y", $userloc);
     $db_h = date("H", $userloc);
     $db_i = date("i", $userloc);
Beispiel #17
0
    function sp_get_macros()
    {
        global $page, $mod_comments, $_CATEGORIES, $ver, $categories, $my_lang_profile, $ENGINE_URL, $SITE_URL;
        $tmpl_list = array();
        // staff
        $tmpl_list['index']['site_name'] = SITE_NAME;
        $tmpl_list['index']['main'] = my_lang('main');
        $tmpl_list['index']['url'] = SITE_URL;
        $tmpl_list['index']['crumbs'] = get_crumbs();
        $tmpl_list['index']['header'] = get_head();
        //Заголовки [модуль headers]
        $tmpl_list['index']['path'] = ENGINE_URL . '/themes/' . THEME;
        $tmpl_list['index']['site_description'] = SITE_DESC;
        //подзаголовок
        $tmpl_list['index']['Y'] = date("Y");
        $tmpl_list['index']['te_version'] = $ver;
        $tmpl_list['index']['rss'] = SITE_RSS;
        $tmpl_list['index']['auth_menu'] = bc_auth_menu();
        //<li> меню авторизации
        if (isset($_SESSION['name'])) {
            $tmpl_list['index']['user'] = $_SESSION['name'];
            /* $tmpl_list['index']['profile_link'] = <<<_MPF
                                                <a href="$SITE_URL/lib/window/profile.php" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=500,top=10'); return false;">$my_lang_profile</a>
            _MPF; */
        }
        //рубрики <li>
        foreach ($categories as $cat) {
            if ($cat['cat_count'] !== "0") {
                $tmpl_list['index']['cat_list'] .= '
                <li><a href="' . get_link('category', $cat['category_id']) . '">' . $cat['name'] . ' 
                <small>(' . $cat['cat_count'] . ')</small></a></li>
                ';
            }
        }
        //список страниц <li>
        $menu = get_static_list_rank();
        foreach ($menu as $link) {
            $tmpl_list['index']['menu'] .= '<li><a href="' . SITE_URL . '/' . $link['sef'] . '">' . $link['title'] . '</a></li>';
        }
        ## Cтраница
        if ($page == 'static' || isset($_REQUEST['s'])) {
            $tmpl_list['static']['title'] = print_static("title");
            $tmpl_list['static']['static'] = print_static("content");
            $f = TE_DIR . '/themes/' . THEME . '/static.html';
            if (is_file($f)) {
                $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['static']);
            }
        } elseif (($page == 'article' || $page == 'main') && !isset($_REQUEST['id'])) {
            //список записей
            $DB = get_article_list();
            if (!empty($DB)) {
                if (isset($_REQUEST['category_id'])) {
                    $tmpl_list['index']['title'] = $_CATEGORIES[$_REQUEST['category_id']]['name'];
                }
                foreach ($DB as $p) {
                    if ($p['approve'] == 1) {
                        //формируем ссылку
                        if (!USE_SEF) {
                            $link = SITE_URL . '/?id=' . $p['id'];
                        } elseif (SEF_TYPE == 1) {
                            $link = SITE_URL . '/article/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef'];
                        } elseif (SEF_TYPE == 2) {
                            $link = SITE_URL . '/' . $_CATEGORIES[$p['category_id']]['sef'] . '/' . $p['sef'];
                        }
                    }
                    if (@$_SESSION['status'] == 'admin') {
                        $tmpl_list['post_list']['post_edit_link'] = <<<_le
                    <a href="{$SITE_URL}/window/ca/?id={$p['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a>
_le;
                        $tmpl_list['post_list']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$p['id']}&action=edit";
                    }
                    $tmpl_list['post_list']['title'] = $p['title'];
                    if ($p['description'] !== '') {
                        $tmpl_list['post_list']['post'] = $p['description'] . ' <a href="' . $link . '">' . my_lang("article_more") . '</a>';
                    } else {
                        $tmpl_list['post_list']['post'] = $p['content'];
                    }
                    $tmpl_list['post_list']['post_url'] = $link;
                    $tmpl_list['post_list']['post_date'] = date(DATE_FORMAT, gm2local($p['stamp'], TZ));
                    $tmpl_list['post_list']['post_category_url'] = get_link('category', $p['category_id']);
                    $tmpl_list['post_list']['post_category'] = $_CATEGORIES[$p['category_id']]['name'];
                    $tmpl_list['post_list']['post_author'] = $p['author'];
                    $f = TE_DIR . '/themes/' . THEME . '/post_list.html';
                    if (is_file($f)) {
                        $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post_list']);
                    }
                }
                $tmpl_list['index']['navi'] = get_navi(get_artcl_sum(), ARTCLS_PER_PAGE);
            }
        } elseif (isset($_REQUEST['id'])) {
            //$tmpl_post = array_merge($tmpl_list, $tmpl_post);
            $profile = get_profile(print_article('author_id'));
            ## тело записи
            $tmpl_list['post']['title'] = print_article("title");
            $tmpl_list['post']['post'] = print_article("content");
            $tmpl_list['post']['post_category_url'] = get_link('category');
            $tmpl_list['post']['post_author'] = $profile['name'];
            $a_id = print_article("author_id");
            $tmpl_list['post']['post_author_link'] = <<<_APF
                                    <a href="{$SITE_URL}/window/profile/?author_id={$a_id}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile["name"]}</a>
_APF;
            if (@$_SESSION['status'] == 'admin') {
                $tmpl_list['post']['post_edit_link'] = <<<_APE
                                    <a href="{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=850,left=150,height=640,top=10'); return false;">Редактор</a>
_APE;
                $tmpl_list['post']['post_edit_url'] = "{$SITE_URL}/window/ca/?id={$_REQUEST['id']}&action=edit";
            }
            $tmpl_list['post']['post_date'] = date(DATE_FORMAT, gm2local(print_article('stamp'), TZ));
            $tmpl_list['post']['post_category'] = $_CATEGORIES[$_REQUEST['category_id']]['name'];
            $f = TE_DIR . '/themes/' . THEME . '/post.html';
            $tmpl_list['index']['content'] .= sp_get_skin($f, $tmpl_list['post']);
            ## комментарии
            if ($mod_comments) {
                //если модуль "вкл"
                function del_link($id)
                {
                    if ($_SESSION['status'] == 'admin') {
                        return '  <a href="' . SITE_URL . '/?id=' . $_REQUEST['id'] . '&cid=' . $id . '&com_act=del">X</a>';
                    } else {
                        return '';
                    }
                }
                $comm_data = get_comments();
                //получаем список комментов и начинаем обходить шаблон комментария
                if (isset($comm_data[0])) {
                    foreach ($comm_data as $p) {
                        $profile = get_profile($p['author_id']);
                        //комментатор не зарег-н
                        if (empty($p['author_id'])) {
                            $tmpl_list['comment']['name'] = $p['author'];
                            //if (!empty($p['email'])) {
                            $gra = get_gravatar($p['email'], $size = 35);
                            //}
                        } else {
                            $gra = get_gravatar($profile['email'], $size = 35);
                            $tmpl_list['comment']['name'] = <<<_PF
                        <a href="{$SITE_URL}/window/profile?author_id={$p["author_id"]}" onclick="window.open(this.href, '', 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=500,left=150,height=250,top=10'); return false;">{$profile['name']}</a>
_PF;
                        }
                        $tmpl_list['comment']['name'] .= del_link($p['id']);
                        $tmpl_list['comment']['gravatar'] = $gra['img'];
                        $tmpl_list['comment']['gravatar_url'] = $gra['url'];
                        $tmpl_list['comment']['date'] = date(DATE_FORMAT, gm2local($p['date'], TZ));
                        //[lib.php, date = stamp]
                        $tmpl_list['comment']['comment'] = $p['content'];
                        $f = TE_DIR . '/themes/' . THEME . '/comment.html';
                        $tmpl_list['comment_list']['comments'] .= sp_get_skin($f, $tmpl_list['comment']);
                    }
                }
                $tmpl_list['comment_list']['comments_form'] = print_comments_form();
                //и вставляем полученный список комментариев в шаблон списка комментариев (вот неожиданность:)
                if (is_file(TE_DIR . '/themes/' . THEME . '/comment_list.html')) {
                    $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/comment_list.html', $tmpl_list['comment_list']);
                }
            }
        } elseif ($page == "album") {
            if (is_file(TE_DIR . '/themes/' . THEME . '/album.html')) {
                $album = get_album();
                if (!empty($album)) {
                    foreach ($album as $img) {
                        $tmpl_list['album']['album'] .= '<a target="_blank" href="' . $img['url'] . '"> 
                <img src="' . $img['url'] . '" HSPACE="0" VSPACE="0" border="0"
                title="Добавлена ' . date("d.m.Y H:i:s", $img['time']) . '" style="max-height: 70px;">
                </a>';
                    }
                } else {
                    $tmpl_list['album']['album'] .= my_lang('album_empty');
                }
                $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/album.html', $tmpl_list['album']);
            } else {
                $tmpl_list['index']['content'] .= 'Не обнаружено файла-шаблона для альбома(';
            }
        } elseif ($page == "feedback") {
            if (is_file(TE_DIR . '/themes/' . THEME . '/feedback.html')) {
                $tmpl_list['feedback']['sid'] = get_sid();
                $reg = Registry::instance();
                $tmpl_list['feedback']['feedback_msg'] = $reg->get('feedback_msg');
                $tmpl_list['index']['content'] .= sp_get_skin(TE_DIR . '/themes/' . THEME . '/feedback.html', $tmpl_list['feedback']);
            }
        }
        //список последних записей <li><a>link</a></li>
        $tmpl_list['index']['post_list'] = bc_postlist(7);
        $tmpl_list['index']['theme_list'] = bc_theme_list();
        $tmpl_list['index']['time'] = microtime(true) - ST;
        return $tmpl_list;
    }
    echo $user->reason ? show_line_breaks(my_auto_link($user->reason)) : '<em>Not specified.</em>';
    ?>
</p>

		<br />
		<?php 
}
?>

		<p>
		<?php 
if ($user->email && $meet_me) {
    ?>
		
			<a class ="btn" href="mailto:<?php 
    echo $user->email . '?subject=' . rawurldecode(my_lang('view_user_email_subject')) . '&body=' . str_replace('_', '%0D%0A', rawurldecode(my_lang('view_user_button_email_body', $user->fullname))) . $current_user_name;
    ?>
">
				Send email message
			</a>&nbsp;&nbsp;
		<?php 
}
?>

		<?php 
if (!$user->connected_person_id) {
    ?>
			<a href="#meetUser" data-toggle="modal" class="btn btn-info"><i class="icon-plus icon-white"></i><i class="icon-user icon-white"></i> Add to my list</a>
		<?php 
} else {
    ?>
<span style="float: left; margin-right: 5px;">
	<a class="btn btn-mini"
	   href="mailto:?subject=<?php 
echo rawurldecode(my_lang('share_button_email_subject'));
?>
&body=<?php 
echo str_replace('_', '%0D%0A', rawurldecode(my_lang('share_button_email_body'))) . ($this->session->userdata('logged_in') ? '%0D%0A%0D%0A' . $this->session->userdata('fullname') : '');
?>
">
		 <i class="icon-envelope vert-sub"></i> Email
	</a>
</span>

<span style="float: left; margin-right: 5px">
	<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://WhoYouMeet.com" data-text="<?php 
echo rawurldecode(my_lang('share_button_tweet_text'));
?>
" data-via="WhoYouMeet" data-count="none" data-dnt="true">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</span>

<span style="float: left; margin-right: 5px">
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<span id="LinkeinIn_button"><script type="IN/Share" data-url="http://WhoYouMeet.com"></script></span>
</span>

<div id="Facebook_buttons">
<div class="fb-like" data-href="https://www.facebook.com/pages/Who-You-Meet-Community/495531867144160" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false" data-font="verdana"></div>
</div>

<!-- Facebook plugin for like button -->
<div style="height: 10px"></div><?php 
}
?>

	<?php 
if ($person->email && ($meet_me || !$show_user) || $current_user) {
    ?>
		<p>
			<img src="<?php 
    echo base_url();
    ?>
img/icon-envelope.png" class="contact-icon-page" />
			<span style="vertical-align: sub;">
				Email: 
				<a href="mailto:<?php 
    echo $current_user ? $person->email : $person->email . '?subject=' . rawurldecode(my_lang('view_user_email_subject')) . '&body=' . str_replace('_', '%0D%0A', rawurldecode(my_lang('view_user_link_email_body', $person->fullname))) . $this->session->userdata('fullname');
    ?>
"><?php 
    echo $person->email;
    ?>
</a>
			</span>
			<?php 
    if ($meet_me && $show_user) {
        ?>
				<?php 
        if ($person->verified) {
            ?>
					<span class="label label-success">verified</span>
				<?php 
        } else {
 /**
  * 10. Change password during password recovery
  */
 public function recover_password($action = '')
 {
     if ($this->session->userdata('password_recovery') && !$this->session->userdata('logged_in')) {
         $user_id = $this->session->userdata('recover_user_id');
         switch ($action) {
             case '':
                 $this->load->view('includes/view_template', array('content' => 'recover_password', 'title' => my_page_title('page_recover_password_title'), 'user_id' => $user_id));
                 break;
             case 'validate':
                 /********* recently added ************/
                 $this->form_validation->set_rules('password', my_lang('form_password_password_field'), 'required|matches[c_password]|trim|xss_clean');
                 $this->form_validation->set_rules('c_password', my_lang('form_password_c_password_field'), 'required|trim|xss_clean');
                 if ($this->form_validation->run()) {
                     $password = $this->input->post('password');
                     $this->load->model('model_users');
                     $ok = $this->model_users->update_user_password($user_id, $password);
                     if ($ok) {
                         // logging user in
                         $user = $this->model_users->get_user($user_id);
                         if ($user) {
                             $this->session->set_userdata($user);
                             $this->session->set_userdata('logged_in', true);
                             $this->session->set_userdata('has_account', true);
                             $this->session->set_flashdata('success', my_lang('msg_success_new_passwd_set'));
                             redirect('/');
                         } else {
                             $this->session->set_flashdata('error', my_lang('msg_error_passwd_set_cant_login'));
                             redirect('/Login');
                         }
                     } else {
                         // echo "can't update password";
                         $this->session->set_flashdata('error', my_lang('msg_error_cant_set_passwd'));
                         redirect('/login/recover_password/');
                     }
                 } else {
                     // validation errors will be shown
                     $this->recover_password();
                 }
                 /********* recently added ************/
                 break;
             default:
                 redirect('/');
         }
     } else {
         if ($this->session->userdata('logged_in')) {
             redirect('/');
         } else {
             redirect('/login');
         }
     }
 }