Пример #1
0
 public function indexAction()
 {
     global $structure;
     if (!cot_module_active('rss')) {
         cot_die_message(404, TRUE);
     }
     $c = cot_import('c', 'G', 'TXT');
     if (!empty($c)) {
         if (!isset($structure['advboard'][$c])) {
             cot_die_message(404, TRUE);
         }
         list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c);
         cot_block(cot::$usr['auth_read']);
     }
     $rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle'];
     $rss_link = cot::$cfg['mainurl'];
     $rss_description = cot::$cfg['subtitle'];
     $domain = cot::$sys['domain'];
     $condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now']));
     if (!empty($c)) {
         $rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle'];
         $condition[] = array('category', $c);
     }
     $advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc')));
     $t = new XTemplate(cot_tplfile('rss'));
     $now = cot::$sys['now'];
     $now += cot::$usr['timezone'] * 3600;
     $t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now))));
     if (!empty($advertisement)) {
         foreach ($advertisement as $advert) {
             $url = $advert->url;
             if (!cot_url_check($url)) {
                 $url = COT_ABSOLUTE_URL . $url;
             }
             $date = '';
             if (!empty($advert->created)) {
                 $date = strtotime($advert->created);
                 $date += cot::$usr['timezone'] * 3600;
                 $date = date('r', $date);
                 $date = $this->fixPubDate($date);
             }
             $text = $advert->text;
             $textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']);
             if ($textlength > 0 && mb_strlen($text) > $textlength) {
                 $text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']);
             }
             $t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url));
             $t->parse('MAIN.ITEM_ROW');
         }
     }
     $t->parse('MAIN');
     //        ob_clean();
     header('Content-type: text/xml; charset=UTF-8');
     echo $t->text('MAIN');
     exit;
 }
Пример #2
0
function form_structure_editor($id)
{
    global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R;
    $row = $cot_structure->category($id);
    if (empty($row)) {
        return null;
    }
    $ii++;
    $structure_id = $row['structure_id'];
    $structure_code = $row['structure_code'];
    $n = $row['structure_area'];
    $dozvil = $row['structure_count'] > 0 ? false : true;
    $is_module = cot_module_active($n);
    $t = new XTemplate(cot_tplfile('cateditor.admin.edit', 'plug'));
    $t->assign(array('ADMIN_STRUCTURE_HEADER' => $row['structure_title'], 'ADMIN_STRUCTURE_DEL_URL' => $dozvil ? cot_confirm_url(cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=delete&id=' . $row['structure_id'] . '&' . cot_xg()), 'admin') : '', 'ADMIN_STRUCTURE_UPDATE_FORM_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&id=' . $structure_id . '&a=update'), 'ADMIN_STRUCTURE_ID' => $row['structure_id'], 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', $structure_code, 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_PATHFIELDIMG' => mb_strpos($row['structure_path'], '.') == 0 ? $R['admin_icon_join1'] : $R['admin_icon_join2'], 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath', $row['structure_path'], 'size="12" maxlength="255"'), 'ADMIN_STRUCTURE_TPL' => cot_inputbox('text', 'rstructuretpl', $row['structure_tpl'], 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', $row['structure_title'], 'size="32" maxlength="255"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', $row['structure_desc'], 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', $row['structure_icon'], 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox($row['structure_locked'], 'rstructurelocked'), 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($cot_structure->get_parent($id), 'rstructureparent', true, 'disabled="disabled"'), 'ADMIN_STRUCTURE_JUMPTO_URL' => cot_url($n, 'c=' . $structure_code), 'ADMIN_STRUCTURE_RIGHTS_URL' => $is_module ? cot_url('admin', 'm=rightsbyitem&ic=' . $n . '&io=' . $structure_code) : '', 'ADMIN_STRUCTURE_ODDEVEN' => cot_build_oddeven($ii)));
    foreach ($cot_extrafields[$db_structure] as $exfld) {
        $exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, $row['structure_' . $exfld['field_name']]);
        $exfld_title = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $t->assign(array('ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) => $exfld_val, 'ADMIN_STRUCTURE_' . strtoupper($exfld['field_name']) . '_TITLE' => $exfld_title, 'ADMIN_STRUCTURE_EXTRAFLD' => $exfld_val, 'ADMIN_STRUCTURE_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.EXTRAFLD');
    }
    require_once cot_incfile('configuration');
    $optionslist = cot_config_list($is_module ? 'module' : 'plug', $n, $structure_code);
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('admin.config.edit.loop');
    /* ===== */
    foreach ($optionslist as $row_c) {
        list($title, $hint) = cot_config_titles($row_c['config_name'], $row_c['config_text']);
        if ($row_c['config_type'] == COT_CONFIG_TYPE_SEPARATOR) {
            $t->assign('ADMIN_CONFIG_FIELDSET_TITLE', $title);
            $t->parse('MAIN.OPTIONS.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_FIELDSET_BEGIN');
        } else {
            $t->assign(array('ADMIN_CONFIG_ROW_CONFIG' => cot_config_input($row_c['config_name'], $row_c['config_type'], $row_c['config_value'], $row_c['config_variants']), 'ADMIN_CONFIG_ROW_CONFIG_TITLE' => $title, 'ADMIN_CONFIG_ROW_CONFIG_MORE_URL' => cot_url('admin', 'm=structure&n=' . $n . '&d=' . $durl . '&id=' . $structure_id . '&al=' . $structure_code . '&a=reset&v=' . $row_c['config_name'] . '&' . cot_xg()), 'ADMIN_CONFIG_ROW_CONFIG_MORE' => $hint));
            /* === Hook - Part2 : Include === */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW.ADMIN_CONFIG_ROW_OPTION');
        }
        $t->parse('MAIN.CONFIG.ADMIN_CONFIG_ROW');
    }
    /* === Hook  === */
    foreach (cot_getextplugins('admin.config.edit.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->assign('CONFIG_HIDDEN', cot_inputbox('hidden', 'editconfig', $structure_code));
    $t->parse('MAIN.CONFIG');
    $t->parse('MAIN');
    return $t->text('MAIN');
}
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['projects']['prjsearch']) {
    $rs['prjtitle'] = cot_import($rs['prjtitle'], 'D', 'INT');
    $rs['prjtext'] = cot_import($rs['prjtext'], 'D', 'INT');
    $rs['prjsort'] = cot_import($rs['prjsort'], 'D', 'ALP');
    $rs['prjsort'] = empty($rs['prjsort']) ? 'date' : $rs['prjsort'];
    $rs['prjsort2'] = cot_import($rs['prjsort2'], 'D', 'ALP') == 'DESC' ? 'DESC' : 'ASC';
    $rs['projectssub'] = cot_import($rs['projectssub'], 'D', 'ARR');
    $rs['projectssubcat'] = cot_import($rs['projectssubcat'], 'D', 'BOL') ? 1 : 0;
    if ($rs['prjtitle'] < 1 && $rs['prjtext'] < 1) {
        $rs['prjtitle'] = 1;
        $rs['prjtext'] = 1;
    }
    if (($tab == 'projects' || empty($tab)) && cot_module_active('projects')) {
        require_once cot_incfile('projects', 'module');
        // Making the category list
        $projects_cat_list['all'] = $L['plu_allcategories'];
        foreach ($structure['projects'] as $cat => $x) {
            if ($cat != 'all' && $cat != 'system' && cot_auth('projects', $cat, 'R') && $x['group'] == 0) {
                $projects_cat_list[$cat] = $x['tpath'];
                $prj_catauth[] = $db->prep($cat);
            }
        }
        if ($rs['projectssub'][0] == 'all' || !is_array($rs['projectssub'])) {
            $rs['projectssub'] = array();
            $rs['projectssub'][] = 'all';
        }
        /* === Hook === */
        foreach (cot_getextplugins('projects.search.catlist') as $pl) {
Пример #4
0
                $t->parse('LIST.ADMIN_STRUCTURE_EXT');
            }
        }
    } else {
        $t->parse('LIST.ADMIN_STRUCTURE_EMPTY');
    }
    $t->assign(array('ADMIN_STRUCTURE_EXFLDS_URL' => cot_url('admin', 'm=extrafields')));
    $t->parse('LIST');
    $adminmain = $t->text('LIST');
} else {
    $parse = false;
    if (cot_plugin_active($n)) {
        $is_module = false;
        $parse = true;
    }
    if (cot_module_active($n)) {
        $is_module = true;
        $parse = true;
    }
    if (!$parse) {
        cot_redirect(cot_url('admin', 'm=structure', '', true));
    }
    // Edit structure for a module
    if (file_exists(cot_incfile($n, $is_module ? 'module' : 'plug'))) {
        require_once cot_incfile($n, $is_module ? 'module' : 'plug');
    }
    if (empty($adminhelp)) {
        $adminhelp = $L['adm_help_structure'];
    }
    if ($a == 'reset' && !empty($al)) {
        cot_config_reset($n, $v, $is_module, $al);
/**
 * [BEGIN_COT_EXT]
 * Hooks=search.list
 * [END_COT_EXT]
 */
/**
 * projects module
 *
 * @package projects
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['projects']['prjsearch'] && ($tab == 'projects' || empty($tab)) && cot_module_active('projects') && !cot_error_found()) {
    if ($rs['projectssub'][0] != 'all' && count($rs['projectssub']) > 0) {
        if ($rs['projectssubcat']) {
            $tempcat = array();
            foreach ($rs['projectssub'] as $scat) {
                $tempcat = array_merge(cot_structure_children('projects', $scat), $tempcat);
            }
            $tempcat = array_unique($tempcat);
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        } else {
            $tempcat = array();
            foreach ($rs['projectssub'] as $scat) {
                $tempcat[] = $db->prep($scat);
            }
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        }
Пример #6
0
/**
 * Generates page list widget
 * @param  mixed   $categories       Custom parent categories code
 * @param  integer $count            Number of items to show. 0 - all items
 * @param  string  $template         Path for template file
 * @param  string  $order            Sorting order (SQL)
 * @param  string  $condition        Custom selection filter (SQL)
 * @param  mixed   $active_only	     Custom parent category code
 * @param  boolean $use_subcat       Include subcategories TRUE/FALSE
 * @param  boolean $exclude_current  Exclude the current page from the rowset for pages.
 * @param  string  $blacklist        Category black list, semicolon separated
 * @param  string  $pagination       Pagination symbol
 * @param  integer $cache_ttl        Cache lifetime in seconds, 0 disables cache
 * @return string                    Parsed HTML
 */
function cot_page_enum($categories = '', $count = 0, $template = '', $order = '', $condition = '', $active_only = true, $use_subcat = true, $exclude_current = false, $blacklist = '', $pagination = '', $cache_ttl = null)
{
    global $db, $db_pages, $db_users, $structure, $cfg, $sys, $lang, $cache;
    // Compile lists
    if (!is_array($blacklist)) {
        $blacklist = str_replace(' ', '', $blacklist);
        $blacklist = !empty($blacklist) ? explode(',', $blacklist) : array();
    }
    // Get the cats
    if (!empty($categories)) {
        if (!is_array($categories)) {
            $categories = str_replace(' ', '', $categories);
            $categories = explode(',', $categories);
        }
        $categories = array_unique($categories);
        if ($use_subcat) {
            $total_categogies = array();
            foreach ($categories as $cat) {
                $cats = cot_structure_children('page', $cat, $use_subcat);
                $total_categogies = array_merge($total_categogies, $cats);
            }
            $categories = array_unique($total_categogies);
        }
        $categories = count($blacklist) > 0 ? array_diff($categories, $blacklist) : $categories;
        $where['cat'] = "page_cat IN ('" . implode("','", $cats) . "')";
    } elseif (count($blacklist)) {
        $where['cat_black'] = "page_cat NOT IN ('" . implode("','", $blacklist) . "')";
    }
    $where['condition'] = $condition;
    if ($exclude_current && defined('COT_PAGES') && !defined('COT_LIST')) {
        global $id;
        $where['page_id'] = "page_id != {$id}";
    }
    if ($active_only) {
        $where['state'] = "page_state=0";
        $where['date'] = "page_begin <= {$sys['now']} AND (page_expire = 0 OR page_expire > {$sys['now']})";
    }
    // Get pagination number if necessary
    if (!empty($pagination)) {
        list($pg, $d, $durl) = cot_import_pagenav($pagination, $count);
    } else {
        $d = 0;
    }
    // Display the items
    $mskin = file_exists($template) ? $template : cot_tplfile(array('page', 'enum', $template), 'module');
    /* === Hook === */
    foreach (cot_getextplugins('page.enum.query') as $pl) {
        include $pl;
    }
    /* ===== */
    if (cot_plugin_active('comments')) {
        global $db_com;
        require_once cot_incfile('comments', 'plug');
        $cns_join_columns .= ", (SELECT COUNT(*) FROM `{$db_com}` WHERE com_area = 'page' AND com_code = p.page_id) AS com_count";
    }
    $sql_order = empty($order) ? 'ORDER BY page_date DESC' : "ORDER BY {$order}";
    $sql_limit = $count > 0 ? "LIMIT {$d}, {$count}" : '';
    $where = array_filter($where);
    $where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
    $sql_total = "SELECT COUNT(*) FROM {$db_pages} AS p {$cns_join_tables} {$where}";
    $sql_query = "SELECT p.*, u.* {$cns_join_columns} FROM {$db_pages} AS p LEFT JOIN {$db_users} AS u ON p.page_ownerid = u.user_id\n\t\t\t{$cns_join_tables} {$where} {$sql_order} {$sql_limit}";
    $t = new XTemplate($mskin);
    isset($md5hash) || ($md5hash = 'page_enum_' . md5(str_replace($sys['now'], '_time_', $mskin . $lang . $sql_query)));
    if ($cache && (int) $cache_ttl > 0) {
        $page_query_html = $cache->disk->get($md5hash, 'page', (int) $cache_ttl);
        if (!empty($page_query_html)) {
            return $page_query_html;
        }
    }
    $totalitems = $db->query($sql_total)->fetchColumn();
    $sql = $db->query($sql_query);
    $sql_rowset = $sql->fetchAll();
    $jj = 0;
    foreach ($sql_rowset as $pag) {
        $jj++;
        $t->assign(cot_generate_pagetags($pag, 'PAGE_ROW_'));
        $t->assign(array('PAGE_ROW_NUM' => $jj, 'PAGE_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PAGE_ROW_RAW' => $pag));
        $t->assign(cot_generate_usertags($pag, 'PAGE_ROW_OWNER_'));
        /* === Hook === */
        foreach (cot_getextplugins('page.enum.loop') as $pl) {
            include $pl;
        }
        /* ===== */
        if (cot_plugin_active('comments')) {
            $rowe_urlp = empty($pag['page_alias']) ? array('c' => $pag['page_cat'], 'id' => $pag['page_id']) : array('c' => $pag['page_cat'], 'al' => $pag['page_alias']);
            $t->assign(array('PAGE_ROW_COMMENTS' => cot_comments_link('page', $rowe_urlp, 'page', $pag['page_id'], $pag['page_cat'], $pag), 'PAGE_ROW_COMMENTS_COUNT' => cot_comments_count('page', $pag['page_id'], $pag)));
        }
        $t->parse("MAIN.PAGE_ROW");
    }
    // Render pagination
    $url_params = $_GET;
    $url_area = 'index';
    $module_name = cot_import('e', 'G', 'ALP');
    if (cot_module_active($module_name)) {
        $url_area = $url_params['e'];
        unset($url_params['e']);
    }
    if (cot_plugin_active($module_name)) {
        $url_area = 'plug';
    }
    unset($url_params[$pagination]);
    if (!empty($pagination)) {
        $pagenav = cot_pagenav($url_area, $url_params, $d, $totalitems, $count, $pagination);
    }
    $t->assign(array('PAGE_TOP_PAGINATION' => $pagenav['main'], 'PAGE_TOP_PAGEPREV' => $pagenav['prev'], 'PAGE_TOP_PAGENEXT' => $pagenav['next'], 'PAGE_TOP_FIRST' => $pagenav['first'], 'PAGE_TOP_LAST' => $pagenav['last'], 'PAGE_TOP_CURRENTPAGE' => $pagenav['current'], 'PAGE_TOP_TOTALLINES' => $totalitems, 'PAGE_TOP_MAXPERPAGE' => $count, 'PAGE_TOP_TOTALPAGES' => $pagenav['total']));
    /* === Hook === */
    foreach (cot_getextplugins('pagelist.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse("MAIN");
    $page_query_html = $t->text("MAIN");
    if ($cache && (int) $cache_ttl > 0) {
        $cache->disk->store($md5hash, $page_query_html, 'page');
    }
    return $page_query_html;
}
Пример #7
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=header.main
[END_COT_EXT]
==================== */
/**
 * Ads board module for Cotonti Siena
 *
 * @package Advboard
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright (c) 2015 Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL');
if (!defined('COT_ADMIN') && cot::$cfg['advboard']['rssToHeader'] == 1 && cot_module_active('rss')) {
    require_once cot_incfile('advboard', 'module');
    // Получить все категории
    if (!empty($structure['advboard'])) {
        foreach ($structure['advboard'] as $adv_rssCode => $adv_rssCat) {
            if ($adv_rssCat['count'] == 0 || !cot_auth('advboard', $adv_rssCode, 'R')) {
                continue;
            }
            $advCatTitle = htmlspecialchars($adv_rssCat['title']);
            $adv_rssUrl = cot_url('advboard', array('m' => 'rss', 'c' => $adv_rssCode));
            if (!cot_url_check($adv_rssUrl)) {
                $adv_rssUrl = COT_ABSOLUTE_URL . $adv_rssUrl;
            }
            cot::$out['head_head'] .= "\n" . '<link rel="alternate" type="application/rss+xml" title="' . cot::$L['advboard_rss_feed'] . $advCatTitle . '" href="' . $adv_rssUrl . '" />';
        }
    }
Пример #8
0
         $t->assign(cot_generate_pagetags($row, 'PLUGIN_PR_'));
         $t->assign(array('PLUGIN_PR_CATEGORY' => cot_rc_link($url_cat, $structure['page'][$row['page_cat']]['tpath']), 'PLUGIN_PR_CATEGORY_URL' => $url_cat, 'PLUGIN_PR_TITLE' => cot_rc_link($url_page, htmlspecialchars($row['page_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['page_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['page_date']), 'PLUGIN_PR_TIMESTAMP' => $row['page_date'], 'PLUGIN_PR_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PR_NUM' => $jj));
         /* === Hook - Part 2 === */
         foreach ($extp as $pl) {
             include $pl;
         }
         /* ===== */
         $t->parse('MAIN.RESULTS.PAGES.ITEM');
         $jj++;
     }
     if ($jj > 0) {
         $t->parse('MAIN.RESULTS.PAGES');
     }
     unset($where_and, $where_or, $where);
 }
 if (($tab == 'frm' || empty($tab)) && cot_module_active('forums') && $cfg['plugin']['search']['forumsearch'] && !cot_error_found()) {
     if ($rs['frmsub'][0] != 'all' && count($rs['frmsub']) > 0) {
         if ($rs['frmsubcat']) {
             $tempcat = array();
             foreach ($rs['frmsub'] as $scat) {
                 $tempcat = array_merge(cot_structure_children('forums', $scat), $tempcat);
             }
             $tempcat = array_unique($tempcat);
             $where_and['cat'] = "t.ft_cat IN ('" . implode("','", $tempcat) . "')";
         } else {
             $tempcat = array();
             foreach ($rs['frmsub'] as $scat) {
                 $tempcat[] = $db->prep($scat);
             }
             $where_and['cat'] = "t.ft_cat IN ('" . implode("','", $tempcat) . "')";
         }
Пример #9
0
$admin_comments_join_tables = '';
$admin_comments_join_where = '';
/* === Hook  === */
foreach (cot_getextplugins('admin.comments.first') as $pl) {
    include $pl;
}
/* ===== */
if ($a == 'delete') {
    cot_check_xg();
    $db->delete($db_com, "com_id={$id}");
    $adminwarnings = $sql ? $L['adm_comm_already_del'] : $L['Error'];
}
$is_adminwarnings = isset($adminwarnings);
$totalitems = $db->countRows($db_com);
$pagenav = cot_pagenav('admin', 'm=other&p=comments', $d, $totalitems, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
if (cot_module_active('page')) {
    require_once cot_incfile('page', 'module');
    $admin_comments_join_fields = ", p.*";
    $admin_comments_join_tables = " LEFT JOIN {$db_pages} AS p\n\t\tON c.com_area = 'page' AND c.com_code = p.page_id";
}
$sql = $db->query("SELECT c.* {$admin_comments_join_fields}\n\tFROM {$db_com} AS c {$admin_comments_join_tables}\n\tWHERE 1 {$admin_comments_join_where}\n\tORDER BY com_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.comments.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    $row['com_text'] = htmlspecialchars(cot_cutstring(strip_tags($row['com_text']), 40));
    $row['com_type'] = mb_substr($row['com_code'], 0, 1);
    $row['com_value'] = $row['com_code'];
    switch ($row['com_area']) {
        case 'page':
Пример #10
0
/**
 * Форма просмара отзывов /добавление отзыва
 *
 * @param int $userid id пользователя
 * @param string $area модуль/плагин
 * @param string $code код
 * @param string $name URL Module or script name
 * @param mixed $params URL parameters as array or parameter string
 * @param string $tail URL postfix, e.g. anchor
 * @param bool $showall show all reviews
 * @return string
 */
function cot_reviews_list($userid, $area, $code = '', $name = '', $params = '', $tail = '', $showall = false)
{
    global $db_reviews, $db_users, $db, $L, $usr, $cfg;
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'reviews', 'RWA');
    if ($usr['auth_read']) {
        $t1 = new XTemplate(cot_tplfile(array('reviews', $area), 'plug'));
        require_once cot_langfile('reviews', 'plug');
        if (!$showall) {
            $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
            $sqlarea = " AND item_area='" . $db->prep($area) . "'";
        }
        $sql = $db->query("SELECT * FROM {$db_reviews} as r LEFT JOIN {$db_users} as u ON u.user_id=r.item_userid \n\t\t\tWHERE item_touserid=" . (int) $userid . $sqlarea . $sqlcode . " ORDER BY item_date ASC");
        if (is_array($params)) {
            $params2 = array();
            foreach ($array as $key => $value) {
                $params2[$key] = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $value);
            }
            $params = $params2;
        } else {
            $params = str_replace(array('$userid', '$area', '$code'), array('$userid', $area, $code), $params);
        }
        $redirect = cot_url($name, $params, $tail, true);
        $redirect = base64_encode($redirect);
        while ($item = $sql->fetch()) {
            if ($usr['id'] == $item['item_userid'] || $usr['isadmin']) {
                $t1->assign(array('REVIEW_FORM_ID' => $item['item_id'], 'REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=update&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id']), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $item['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($item['item_score'], 'rscore', $L['review_score_values'], $L['review_score_titles']), 'REVIEW_FORM_USERID' => $item['item_userid'], 'REVIEW_FORM_DELETE_URL' => cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&touser='******'&redirect=' . $redirect . '&itemid=' . $item['item_id'])));
                $t1->parse('MAIN.REVIEWS_ROWS.EDITFORM');
            }
            $t1->assign(cot_generate_usertags($item, 'REVIEW_ROW_'));
            $t1->assign(array('REVIEW_ROW_ID' => $item['item_id'], 'REVIEW_ROW_TEXT' => $item['item_text'], 'REVIEW_ROW_TOUSER' => $item['item_touser'], 'REVIEW_ROW_OWNERID' => $item['item_userid'], 'REVIEW_ROW_OWNER' => cot_build_user($item['item_userid'], htmlspecialchars($item['user_name'])), 'REVIEW_ROW_SCORE' => $item['item_score'] > 0 ? '+' . $item['item_score'] : $item['item_score'], 'REVIEW_ROW_AREA' => $item['item_area'], 'REVIEW_ROW_CODE' => $item['item_code'], 'REVIEW_ROW_DATE' => $item['item_date'], 'REVIEW_ROW_DELETE_URL' => $usr['id'] == $item['item_userid'] || $usr['isadmin'] ? cot_url('plug', 'r=reviews&a=delete&area=' . $area . '&code=' . $code . '&itemid=' . $item['item_id'] . '&redirect=' . $redirect) : ''));
            if ($item['item_area'] == 'projects' && !empty($item['item_code'])) {
                require_once cot_incfile('projects', 'module');
                global $db_projects;
                $prj = $db->query("SELECT * FROM {$db_projects} WHERE item_id=" . $item['item_code'])->fetch();
                $t1->assign(cot_generate_projecttags($prj, 'REVIEW_ROW_PRJ_'));
            }
            $t1->parse('MAIN.REVIEWS_ROWS');
        }
        if ($cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $usr['id'] > 0 && $usr['auth_write'] && $usr['id'] != $userid) {
            require_once cot_incfile('projects', 'module');
            global $db_projects_offers, $db_projects;
            $prj_reviews_sql = $db->query("SELECT item_code FROM {$db_reviews} WHERE item_area='projects' AND item_userid=" . $usr['id']);
            while ($row = $prj_reviews_sql->fetch()) {
                $prjreviews[] = $row['item_code'];
            }
            $prjreviews_string = count($prjreviews) > 0 ? "AND o.offer_pid NOT IN (" . implode(",", $prjreviews) . ")" : '';
            $bothprj_count = $db->query("SELECT COUNT(*) FROM  {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t")->fetchColumn();
            if ($bothprj_count > 0) {
                $bothprj_sql = $db->query("SELECT * FROM  {$db_projects_offers} AS o\n\t\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\t\tWHERE ((p.item_userid = '" . $userid . "' AND o.offer_userid='" . $usr['id'] . "')\n\t\t\t\t\tOR (p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $userid . "')) \n\t\t\t\t\tAND o.offer_choise='performer' \n\t\t\t\t\t{$prjreviews_string}\n\t\t\t\t\t");
                while ($bprj = $bothprj_sql->fetch()) {
                    $prj_ids[] = $bprj['offer_pid'];
                    $prj_titles[] = $bprj['item_title'];
                }
            }
            $area = 'projects';
            $usr['auth_write'] = (int) $bothprj_count == 0 ? false : $usr['auth_write'];
        } else {
            $sqlcode = !empty($code) ? " AND item_code='" . $db->prep($code) . "'" : '';
            $sqlarea = " AND item_area='" . $db->prep($area) . "'";
            $reviews_count = $db->query("SELECT COUNT(*) FROM {$db_reviews} \n\t\t\t\tWHERE item_userid=" . (int) $usr['id'] . "\n\t\t\t\t\tAND item_touserid=" . (int) $userid . $sqlarea . $sqlcode)->fetchColumn();
            $usr['auth_write'] = $reviews_count > 0 ? false : $usr['auth_write'];
        }
        if ($usr['auth_write'] && $usr['id'] != $userid) {
            cot_display_messages($t1);
            $t1->assign(array('REVIEW_FORM_SEND' => cot_url('plug', 'r=reviews&a=add&area=' . $area . '&touser='******'&redirect=' . $redirect), 'REVIEW_FORM_TEXT' => cot_textarea('rtext', $ritem['item_text'], 5, 50), 'REVIEW_FORM_SCORE' => cot_radiobox($ritem['item_score'], 'rscore', $L['reviews_score_values'], $L['reviews_score_titles']), 'REVIEW_FORM_PROJECTS' => $cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects') && $bothprj_count > 0 ? cot_selectbox($pid, 'code', $prj_ids, $prj_titles, false) : '', 'REVIEW_FORM_ACTION' => 'ADD'));
            $t1->parse('MAIN.FORM');
        }
        $t1->parse('MAIN');
        return $t1->text('MAIN');
    }
    return '';
}
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['market']['marketsearch']) {
    $rs['markettitle'] = cot_import($rs['markettitle'], 'D', 'INT');
    $rs['markettext'] = cot_import($rs['markettext'], 'D', 'INT');
    $rs['marketsort'] = cot_import($rs['marketsort'], 'D', 'ALP');
    $rs['marketsort'] = empty($rs['marketsort']) ? 'date' : $rs['marketsort'];
    $rs['marketsort2'] = cot_import($rs['marketsort2'], 'D', 'ALP') == 'DESC' ? 'DESC' : 'ASC';
    $rs['marketsub'] = cot_import($rs['marketsub'], 'D', 'ARR');
    $rs['marketsubcat'] = cot_import($rs['marketsubcat'], 'D', 'BOL') ? 1 : 0;
    if ($rs['markettitle'] < 1 && $rs['markettext'] < 1) {
        $rs['markettitle'] = 1;
        $rs['markettext'] = 1;
    }
    if (($tab == 'market' || empty($tab)) && cot_module_active('market')) {
        require_once cot_incfile('market', 'module');
        // Making the category list
        $market_cat_list['all'] = $L['plu_allcategories'];
        foreach ($structure['market'] as $cat => $x) {
            if ($cat != 'all' && $cat != 'system' && cot_auth('market', $cat, 'R') && $x['group'] == 0) {
                $market_cat_list[$cat] = $x['tpath'];
                $market_catauth[] = $db->prep($cat);
            }
        }
        if ($rs['marketsub'][0] == 'all' || !is_array($rs['marketsub'])) {
            $rs['marketsub'] = array();
            $rs['marketsub'][] = 'all';
        }
        /* === Hook === */
        foreach (cot_getextplugins('market.search.catlist') as $pl) {
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('tagslance', 'plug');
if ($a == 'folio' && cot_module_active('folio')) {
    if (empty($qs)) {
        // Form and cloud
        cot_tag_search_form('folio');
    } else {
        // Search results
        cot_tag_search_folio($qs);
    }
}
if ($a == 'market' && cot_module_active('market')) {
    if (empty($qs)) {
        // Form and cloud
        cot_tag_search_form('market');
    } else {
        // Search results
        cot_tag_search_market($qs);
    }
}
if ($a == 'projects' && cot_module_active('projects')) {
    if (empty($qs)) {
        // Form and cloud
        cot_tag_search_form('projects');
    } else {
        // Search results
        cot_tag_search_projects($qs);
    }
}
Пример #13
0
 public function build_tree($parent = null, $depth = 0, $tpl = 'cateditor.tree', $selectedid = null)
 {
     $array = array();
     $array = empty($parent) ? $this->childs_null : $this->childs[$parent];
     $is_module = cot_module_active($this->area);
     if (!empty($parent)) {
         //		cot_print($parent, );
     }
     if (empty($array)) {
         return false;
     } else {
         $t = new XTemplate(cot_tplfile($tpl, 'plug'));
         foreach ($array as $id) {
             $row = $this->data[$id];
             $t->assign(array('ADMIN_STRUCTURE_EDIT_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $this->area . '&id=' . $row['structure_id']), 'ADMIN_STRUCTURE_AJAX_EDIT_URL' => cot_url('index', 'r=cateditor&n=' . $this->area . '&id=' . $row['structure_id']), 'ADMIN_STRUCTURE_RIGHTS_URL' => $is_module ? cot_url('admin', 'm=rightsbyitem&ic=' . $this->area . '&io=' . $row['structure_code']) : '', 'ADMIN_STRUCTURE_OPEN_URL' => cot_url($n, 'c=' . $row['structure_code']), 'ADMIN_STRUCTURE_ID' => $row['structure_id'], 'ADMIN_STRUCTURE_CODE' => $row['structure_code'], 'ADMIN_STRUCTURE_TITLE' => $row['structure_title'], 'ADMIN_STRUCTURE_DESC' => $row['structure_desc'], 'ADMIN_STRUCTURE_SELECTED' => $row['structure_id'] == $selectedid ? 1 : 0, 'ADMIN_STRUCTURE_ICON' => $row['structure_icon'], 'ADMIN_STRUCTURE_CHILDREN' => $this->build_tree($row['structure_id'], $depth + 1, $tpl), 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], 'ADMIN_STRUCTURE_DEPTH' => $depth));
             $t->parse("MAIN.CATS.ROW");
         }
         $t->parse("MAIN.CATS");
         if (empty($parent)) {
             $t->parse("MAIN");
             return $t->text("MAIN");
         }
         return $t->text("MAIN.CATS");
     }
 }
Пример #14
0
     require_once cot_incfile('page', 'module');
     // Try to load from cache for guests
     if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
         $ri_cache_id = "{$theme}.{$lang}.pages";
         $ri_html = $cache->disk->get($ri_cache_id, 'recentitems', (int) $cfg['plugin']['recentitems']['cache_ttl']);
     }
     if (empty($ri_html)) {
         $ri_html = cot_build_recentpages('recentitems.pages.index', 'recent', $cfg['plugin']['recentitems']['maxpages'], 0, $cfg['plugin']['recentitems']['recentpagestitle'], $cfg['plugin']['recentitems']['recentpagestext'], $cfg['plugin']['recentitems']['rightscan']);
         if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
             $cache->disk->store($ri_cache_id, $ri_html, 'recentitems');
         }
     }
     $t->assign('RECENT_PAGES', $ri_html);
     unset($ri_html);
 }
 if ($enforums && $cfg['plugin']['recentitems']['recentforums'] && cot_module_active('forums')) {
     require_once cot_incfile('forums', 'module');
     // Try to load from cache for guests
     if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
         $ri_cache_id = "{$theme}.{$lang}.forums";
         $ri_html = $cache->disk->get($ri_cache_id, 'recentitems', (int) $cfg['plugin']['recentitems']['cache_ttl']);
     }
     if (empty($ri_html)) {
         $ri_html = cot_build_recentforums('recentitems.forums.index', 'recent', $cfg['plugin']['recentitems']['maxtopics'], 0, $cfg['plugin']['recentitems']['recentforumstitle'], $cfg['plugin']['recentitems']['rightscan']);
         if ($usr['id'] == 0 && $cache && (int) $cfg['plugin']['recentitems']['cache_ttl'] > 0) {
             $cache->disk->store($ri_cache_id, $ri_html, 'recentitems');
         }
     }
     $t->assign('RECENT_FORUMS', $ri_html);
     unset($ri_html);
 }
Пример #15
0
/**
 * Adv edit template
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright Portal30 Studio http://portal30.ru
 *
 * @note Поля формы можно выводить и "поштучно". Но мне в цикле оказалось гораздо удобнее
 */
//var_dump_($this->category);
/** @var advboard_model_Advert $advert */
$advert = $this->advert;
$labelClass = 'col-xs-12 col-md-3';
$elementClass = 'col-xs-12 col-md-9';
$formElements = $this->formElements;
unset($this->formElements);
// Добавим виджет файлов, если необходимо
if (cot::$usr['auth_upload'] && cot_module_active('files') && cot_auth('files', 'a', 'W')) {
    array_insert($formElements, 'text', array('files' => array('element' => cot_files_filebox('advboard', intval($advert->id), '', 'all'), 'label' => cot::$L['files_attachments'])));
}
echo $this->breadcrumbs;
?>
<div class="row">
    <div class="<?php 
echo $labelClass;
?>
 hidden-xs"></div>

    <div class="<?php 
echo $elementClass;
?>
">
        <h2 class="page" style="margin-top: 0;"><?php 
Пример #16
0
<?php

/**
 * Ads board module for Cotonti Siena
 *     Uninstallation handler
 *
 * @package Advboard
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright (c) Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL');
global $db_com;
// Удалить все файлы и изображения
if (cot_module_active('files')) {
    $files = files_model_File::find(array(array('file_source', 'advboard')));
    if (!empty($files)) {
        foreach ($files as $fileRow) {
            $fileRow->delete();
        }
    }
}
// Удалить все комментарии к этому отзыву
if (cot_plugin_active('comments')) {
    if (empty($db_com)) {
        require_once cot_incfile('comments', 'plug');
    }
    cot::$db->delete($db_com, "com_area='advboard'");
}
function cot_tag_search_projects($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_projects, $o, $row, $sys;
    if (!cot_module_active('projects')) {
        return;
    }
    $query = cot_tag_parse_query($query, 'p.item_id');
    if (empty($query)) {
        return;
    }
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_state = 0")->fetchColumn();
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `item_title`';
            break;
        case 'date':
            $order = 'ORDER BY `item_date` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `item_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.projects.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $sql = $db->query("SELECT DISTINCT p.* {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_projects} AS p\n\t\t\tON r.tag_item = p.item_id {$join_tables}\n\t\tWHERE r.tag_area = 'projects' AND ({$query}) AND p.item_id IS NOT NULL AND p.item_state = 0 {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$cfg['maxrowsperpage']}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_projects']);
    $pcount = $sql->rowCount();
    /* == Hook : Part 1 == */
    $extp = cot_getextplugins('tags.search.projects.loop');
    /* ===== */
    if ($pcount > 0) {
        foreach ($sql->fetchAll() as $row) {
            $tags = cot_tag_list($row['item_id'], 'projects');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'projects', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $t->assign(cot_generate_projecttags($row, 'TAGS_RESULT_ROW_'));
            $t->assign(array('TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['item_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_structure_buildpath('projects', $row['item_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            /* == Hook : Part 2 == */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'projects', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $cfg['maxrowsperpage']);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
        /* == Hook == */
        foreach (cot_getextplugins('tags.search.projects.tags') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    if ($pcount == 0) {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=forums.editpost.tags
Tags=
[END_COT_EXT]
==================== */
/**
 * Polls
 *
 * @package Polls
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($is_first_post && $usr['isadmin'] && cot_module_active('polls') && cot_poll_edit_form($q, $t, 'MAIN.POLL', 'forum')) {
    $t->parse('MAIN.POLL');
}
Пример #19
0
    } else {
        $days = 1;
    }
}
if ($days > 0) {
    $timeminus = $days * 86400;
    $timeback = $sys['now'] - $timeminus;
}
require_once cot_incfile('recentitems', 'plug');
$totalrecent[] = 0;
if ($cfg['plugin']['recentitems']['newpages'] && cot_module_active('page') && (empty($mode) || $mode == 'pages')) {
    require_once cot_incfile('page', 'module');
    $res = cot_build_recentpages('recentitems.pages', $timeback, $cfg['plugin']['recentitems']['itemsperpage'], $d, $pagetitlelimit, $cfg['plugin']['recentitems']['newpagestext'], $cfg['plugin']['recentitems']['rightscan']);
    $t->assign('RECENT_PAGES', $res);
}
if ($cfg['plugin']['recentitems']['newforums'] && cot_module_active('forums') && (empty($mode) || $mode == 'forums')) {
    require_once cot_incfile('forums', 'module');
    $res = cot_build_recentforums('recentitems.forums', $timeback, $cfg['plugin']['recentitems']['itemsperpage'], $d, $forumtitlelimit, $cfg['plugin']['recentitems']['rightscan']);
    $t->assign('RECENT_FORUMS', $res);
}
if ($mode != 'pages' || $mode != 'forums') {
    /* === Hook === */
    foreach (cot_getextplugins('recentitems.tags') as $pl) {
        include $pl;
    }
    /* ===== */
}
$out['subtitle'] = $L['recentitems_title'];
$totalpages = max($totalrecent);
$days = $days > 0 ? "&days=" . $days : "";
$mode = !empty($mode) ? "&mode=" . $mode : "";
Пример #20
0
$urr = $sql->fetch();
$title_params = array('EDIT' => $L['Edit'], 'NAME' => $urr['user_name']);
$out['subtitle'] = cot_title('{EDIT} - {NAME}', $title_params);
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'edit', $usr['maingrp']), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.edit.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$protected = $sys['protecttopadmin'] ? array('disabled' => 'disabled') : array();
$editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : '';
$delete_pfs = cot_module_active('pfs') ? cot_checkbox(false, 'ruserdelpfs', $L['PFS']) : '';
$t->assign(array('USERS_EDIT_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name']), array(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit'])), $cfg['homebreadcrumb']), 'USERS_EDIT_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_EDIT_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_EDIT_SUBTITLE' => $L['useed_subtitle'], 'USERS_EDIT_SEND' => cot_url('users', 'm=edit&a=update&' . cot_xg() . '&id=' . $urr['user_id']), 'USERS_EDIT_ID' => $urr['user_id'], 'USERS_EDIT_NAME' => cot_inputbox('text', 'rusername', $urr['user_name'], array('size' => 32, 'maxlength' => 100) + $protected), 'USERS_EDIT_ACTIVE' => $user_form_active, 'USERS_EDIT_BANNED' => $user_form_banned, 'USERS_EDIT_THEME' => cot_inputbox('text', 'rusertheme', $urr['user_theme'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_LANG' => cot_inputbox('text', 'ruserlang', $urr['user_lang'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_NEWPASS' => cot_inputbox('password', 'rusernewpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off') + $protected), 'USERS_EDIT_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_EDIT_GROUPS' => cot_build_groupsms($urr['user_id'], $usr['isadmin'], $urr['user_maingrp']), 'USERS_EDIT_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_EDIT_EMAIL' => cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64)), 'USERS_EDIT_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_EDIT_TEXT' => cot_textarea('rusertext', $urr['user_text'], 4, 56, array('class' => $editor_class)), 'USERS_EDIT_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_EDIT_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_EDIT_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_EDIT_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_EDIT_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_EDIT_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_EDIT_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_EDIT_LOGCOUNT' => $urr['user_logcount'], 'USERS_EDIT_LASTIP' => cot_build_ipsearch($urr['user_lastip']), 'USERS_EDIT_DELETE' => $sys['user_istopadmin'] ? cot_radiobox(0, 'ruserdelete', array(1, 0), array($L['Yes'], $L['No'])) . $delete_pfs : $L['na']));
// Extra fields
foreach ($cot_extrafields[$db_users] as $exfld) {
    $tag = strtoupper($exfld['field_name']);
    $t->assign(array('USERS_EDIT_' . $tag => cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]), 'USERS_EDIT_' . $tag . '_TITLE' => isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description']));
}
// Error and message reporting
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('users.edit.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
Пример #21
0
    echo $this->moderatorFilters['reset'];
    ?>
" class="btn btn-default"><span class="glyphicon glyphicon-remove"></span></a>
                </form>
            </div>
        <?php 
}
// Список объявлений
if (!empty($advertisement)) {
    foreach ($advertisement as $advRow) {
        //$created =
        ?>
                <article class="list-row row">
                    <div class="col-xs-12">
                        <?php 
        if (cot_module_active('files') && cot_files_count('advboard', $advRow->id, '', 'images') > 0) {
            $file = cot_files_get('advboard', $advRow->id, '');
            $thumb = cot_files_thumb($file, 195, 130, 'crop');
            ?>
                        <div class="pull-left marginright10 marginbottom10">
                            <a href="<?php 
            echo $advRow->url;
            ?>
" title="<?php 
            echo htmlspecialchars($advRow->title);
            ?>
" rel="bookmark"
                               class="thumbnail"><img alt="<?php 
            echo htmlspecialchars($advRow->title);
            ?>
" src="<?php 
Пример #22
0
    $tt->parse('MAIN.STAT');
}
//Show activity stats
if (!$cfg['plugin']['hits']['disableactivitystats'] && cot_module_active('page')) {
    $timeback = $sys['now'] - 7 * 86400;
    // 7 days
    require_once cot_incfile('page', 'module');
    $sql = $db->query("SELECT COUNT(*) FROM {$db_users} WHERE user_regdate > {$timeback}");
    $newusers = $sql->fetchColumn();
    $sql = $db->query("SELECT COUNT(*) FROM {$db_pages} WHERE page_date > {$timeback}");
    $newpages = $sql->fetchColumn();
    if (cot_module_active('forums')) {
        require_once cot_incfile('forums', 'module');
        $sql = $db->query("SELECT COUNT(*) FROM {$db_forum_topics} WHERE ft_creationdate > {$timeback}");
        $newtopics = $sql->fetchColumn();
        $sql = $db->query("SELECT COUNT(*) FROM {$db_forum_posts} WHERE fp_updated > {$timeback}");
        $newposts = $sql->fetchColumn();
    }
    if (function_exists('cot_get_newcomments')) {
        $newcomments = cot_get_newcomments($timeback);
    }
    if (cot_module_active('pm')) {
        require_once cot_incfile('pm', 'module');
        $sql = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE pm_date > {$timeback}");
        $newpms = $sql->fetchColumn();
    }
    $tt->assign(array('ADMIN_HOME_NEWUSERS_URL' => cot_url('users', 'f=all&s=regdate&w=desc'), 'ADMIN_HOME_NEWUSERS' => $newusers, 'ADMIN_HOME_NEWPAGES_URL' => cot_url('admin', 'm=page'), 'ADMIN_HOME_NEWPAGES' => $newpages, 'ADMIN_HOME_NEWTOPICS_URL' => cot_url('forums'), 'ADMIN_HOME_NEWTOPICS' => $newtopics, 'ADMIN_HOME_NEWPOSTS_URL' => cot_url('forums'), 'ADMIN_HOME_NEWPOSTS' => $newposts, 'ADMIN_HOME_NEWCOMMENTS_URL' => cot_url('admin', 'm=comments'), 'ADMIN_HOME_NEWCOMMENTS' => $newcomments, 'ADMIN_HOME_NEWPMS' => $newpms));
    $tt->parse('MAIN.ACTIVITY');
}
$tt->parse('MAIN');
$line = $tt->text('MAIN');
Пример #23
0
 $ritem['item_userid'] = (int) $usr['id'];
 $ritem['item_date'] = (int) $sys['now'];
 $ritem['item_area'] = $area;
 $ritem['item_code'] = !empty($code) ? $code : cot_import('code', 'P', 'TXT');
 $ritem['item_code'] = $db->prep($ritem['item_code']);
 /* === Hook === */
 foreach (cot_getextplugins('reviews.add.import') as $pl) {
     include $pl;
 }
 /* ===== */
 $uinfo = $db->query("SELECT * FROM {$db_users} WHERE user_id='" . $touser . "'")->fetch();
 cot_block(!empty($uinfo['user_name']));
 // Самому себе отзыв оставлять нельзя
 cot_check($touser == $usr['id'], 'reviews_error_toyourself');
 // Включена настройка "Добавление отзывов только при наличии совместных проектов"
 if ($cfg['plugin']['reviews']['checkprojects'] && cot_module_active('projects')) {
     // Проверяем проект, действительно ли он совместный для пользователей.
     $project_exists = (bool) $db->query("SELECT COUNT(*) FROM  {$db_projects_offers} AS o\n\t\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.offer_pid\n\t\t\tWHERE p.item_id='" . $ritem['item_code'] . "' \n\t\t\t\tAND (p.item_userid = '" . $touser . "' AND o.offer_userid='" . $usr['id'] . "' OR p.item_userid = '" . $usr['id'] . "' AND o.offer_userid='" . $touser . "') \n\t\t\t\tAND o.offer_choise='performer'")->fetchColumn();
     cot_check(!$project_exists, 'reviews_error_projectsonly');
 }
 $review_exists = (bool) $db->query("SELECT COUNT(*) FROM {$db_reviews} \n\t\tWHERE item_touserid='{$touser}' AND item_area = '" . $db->prep($area) . "' AND item_code = '" . $db->prep($code) . "' AND item_userid=" . $usr['id'])->fetchColumn();
 cot_check($review_exists, 'reviews_error_exists');
 cot_check(empty($ritem['item_text']), 'reviews_error_emptytext');
 cot_check(empty($ritem['item_score']), 'reviews_error_emptyscore');
 if (!cot_error_found() && $ritem['item_touserid'] != $urr['user_id']) {
     $db->insert($db_reviews, $ritem);
     $itemid = $db->lastInsertId();
     /* === Hook === */
     foreach (cot_getextplugins('reviews.add.add.done') as $pl) {
         include $pl;
     }
Пример #24
0
 *
 * @package reviews
 * @version 2.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'reviews', 'RWA');
$touser = cot_import('touser', 'G', 'INT');
$itemid = cot_import('itemid', 'G', 'INT');
$area = cot_import('area', 'G', 'TXT');
$code = cot_import('code', 'G', 'TXT');
$redirect = cot_import('redirect', 'G', 'TXT');
$area = empty($area) ? 'users' : $area;
if ($cfg['pligin']['reviews']['checkprojects'] && cot_module_active('projects') && $usr['id'] > 0 && $usr['auth_write'] && $usr['id'] != $userid) {
    require_once cot_incfile('projects', 'module');
    global $db_projects_offers, $db_projects;
    $bothprj = $db->query("SELECT COUNT(*) FROM  {$db_projects_offers} AS o\n\t\tLEFT JOIN {$db_projects} AS p ON p.item_id=o.item_pid\n\t\tWHERE p.item_userid = '" . $touser . "' AND o.item_userid='" . $usr['id'] . "' AND o.item_choise='performer'")->fetchColumn();
    $usr['auth_write'] = (int) $bothprj == 0 ? false : $usr['auth_write'];
}
cot_block($usr['auth_write']);
if ($a == 'add') {
    cot_shield_protect();
    //	cot_print('step');
    $uinfo = $db->query("SELECT * FROM {$db_users} WHERE user_id='" . $touser . "'")->fetch();
    cot_block(!empty($uinfo['user_name']));
    $item = $db->query("SELECT * FROM {$db_reviews} WHERE item_touserid='{$touser}' AND item_area = '" . $db->prep($area) . "' AND item_code = '" . $db->prep($code) . "' AND item_userid=" . $usr['id'] . " LIMIT 1")->fetch();
    cot_block(empty($item));
    $ritem['item_touserid'] = $touser;
    $ritem['item_text'] = cot_import('rtext', 'P', 'TXT');
Пример #25
0
/**
 * Search by tag in forums
 *
 * @param string $query User-entered query string
 * @global CotDB $db
 */
function cot_tag_search_forums($query)
{
    global $db, $t, $L, $lang, $cfg, $usr, $qs, $d, $db_tag_references, $db_forum_topics, $o, $row;
    if (!cot_module_active('forums')) {
        return;
    }
    $query = cot_tag_parse_query($query, 't.ft_id');
    if (empty($query)) {
        return;
    }
    $maxperpage = cot::$cfg['maxrowsperpage'] && is_numeric(cot::$cfg['maxrowsperpage']) && cot::$cfg['maxrowsperpage'] > 0 ? cot::$cfg['maxrowsperpage'] : 15;
    $join_columns = '';
    $join_tables = '';
    $join_where = '';
    switch ($o) {
        case 'title':
            $order = 'ORDER BY `ft_title`';
            break;
        case 'date':
            $order = 'ORDER BY `ft_updated` DESC';
            break;
        case 'category':
            $order = 'ORDER BY `ft_cat`';
            break;
        default:
            $order = '';
    }
    /* == Hook == */
    foreach (cot_getextplugins('tags.search.forums.query') as $pl) {
        include $pl;
    }
    /* ===== */
    $totalitems = $db->query("SELECT DISTINCT COUNT(*)\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) {$join_where}")->fetchColumn();
    $sql = $db->query("SELECT DISTINCT t.ft_id, t.ft_cat, t.ft_title {$join_columns}\n\t\tFROM {$db_tag_references} AS r LEFT JOIN {$db_forum_topics} AS t\n\t\t\tON r.tag_item = t.ft_id {$join_tables}\n\t\tWHERE r.tag_area = 'forums' AND ({$query}) AND t.ft_id IS NOT NULL {$join_where}\n\t\t{$order}\n\t\tLIMIT {$d}, {$maxperpage}");
    $t->assign('TAGS_RESULT_TITLE', $L['tags_Found_in_forums']);
    if ($sql->rowCount() > 0) {
        while ($row = $sql->fetch()) {
            $tags = cot_tag_list($row['ft_id'], 'forums');
            $tag_list = '';
            $tag_i = 0;
            foreach ($tags as $tag) {
                $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
                $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
                $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
                if ($tag_i > 0) {
                    $tag_list .= ', ';
                }
                $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'forums', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t));
                $tag_i++;
            }
            $master = $row['fs_masterid'] > 0 ? array($row['fs_masterid'], $row['fs_mastername']) : false;
            $t->assign(array('TAGS_RESULT_ROW_URL' => cot_url('forums', 'm=posts&q=' . $row['ft_id']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ft_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_forums_buildpath($row['ft_cat']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
            $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_ROW');
        }
        $sql->closeCursor();
        $qs_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($qs) : $qs;
        $tl = $lang != 'en' && $qs_u != $qs ? 1 : null;
        $pagenav = cot_pagenav('plug', array('e' => 'tags', 'a' => 'forums', 't' => $qs_u, 'tl' => $tl), $d, $totalitems, $maxperpage);
        $t->assign(array('TAGS_PAGEPREV' => $pagenav['prev'], 'TAGS_PAGENEXT' => $pagenav['next'], 'TAGS_PAGNAV' => $pagenav['main']));
    } else {
        $t->parse('MAIN.TAGS_RESULT.TAGS_RESULT_NONE');
    }
    $t->parse('MAIN.TAGS_RESULT');
}
Пример #26
0
             continue;
         }
         $q = $row['ft_id'];
         // Pagination support
         $count = $row['ft_postcount'];
         $subs = floor($count / $maxrowsperpage) + 1;
         // Pages starting from second
         foreach (range(1, $subs) as $pg) {
             $d = $cfg['easypagenav'] ? $pg : ($pg - 1) * $maxrowsperpage;
             $urlp = $pg > 1 ? "m=posts&q={$q}&d={$d}" : "m=posts&q={$q}";
             sitemap_parse($t, $items, array('url' => cot_url('forums', $urlp), 'date' => $row['ft_updated'], 'freq' => $cfg['plugin']['sitemap']['forums_freq'], 'prio' => $cfg['plugin']['sitemap']['forums_prio']));
         }
     }
     unset($cat_top);
 }
 if ($cfg['plugin']['sitemap']['users'] && cot_module_active('users') && cot_auth('users', 'a', 'R')) {
     // Sitemap for users module
     require_once cot_incfile('users', 'module');
     // User profiles
     $sitemap_join_columns = '';
     $sitemap_join_tables = '';
     $sitemap_where = array();
     /* === Hook === */
     foreach (cot_getextplugins('sitemap.users.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $sitemap_where = count($sitemap_where) > 0 ? 'WHERE ' . join(' AND ', $sitemap_where) : '';
     $res = $db->query("SELECT u.user_id, u.user_name {$sitemap_join_columns}\n\t\t\tFROM {$db_users} AS u {$sitemap_join_tables}\n\t\t\t{$sitemap_where}\n\t\t\tORDER BY user_id");
     foreach ($res->fetchAll() as $row) {
         sitemap_parse($t, $items, array('url' => cot_url('users', array('m' => 'details', 'id' => $row['user_id'], 'u' => $row['user_name'])), 'date' => '', 'freq' => $cfg['plugin']['sitemap']['users_freq'], 'prio' => $cfg['plugin']['sitemap']['users_prio']));
Пример #27
0
/**
 * pagecattree Plugin for Cotonti CMF
 *
 * @version 2.0.0
 * @author esclkm, http://www.littledev.ru
 * @copyright (c) 2008-2011 esclkm, http://www.littledev.ru
 */
defined('COT_CODE') or die('Wrong URL.');
$adminpath[] = array(cot_url('admin', 'm=structure'), $L['Structure']);
// Show available module list
if (is_array($extension_structure) && count($extension_structure) > 0) {
    foreach ($extension_structure as $code) {
        $parse = false;
        if (cot_plugin_active($code)) {
            $is_module = false;
            $parse = true;
        }
        if (cot_module_active($code)) {
            $is_module = true;
            $parse = true;
        }
        if ($parse) {
            $ext_info = cot_get_extensionparams($code, $is_module);
            $t->assign(array('ADMIN_STRUCTURE_EXT_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $code), 'ADMIN_STRUCTURE_EXT_ICO' => $ext_info['icon'], 'ADMIN_STRUCTURE_EXT_NAME' => $ext_info['name']));
            $t->parse('MAIN.ADMIN_STRUCTURE_EXT');
        }
    }
} else {
    $t->parse('MAIN.ADMIN_STRUCTURE_EMPTY');
}
$t->assign(array('ADMIN_STRUCTURE_EXFLDS_URL' => cot_url('admin', 'm=extrafields')));
/**
 * [BEGIN_COT_EXT]
 * Hooks=search.list
 * [END_COT_EXT]
 */
/**
 * market module
 *
 * @package market
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['market']['marketsearch'] && ($tab == 'market' || empty($tab)) && cot_module_active('market') && !cot_error_found()) {
    if ($rs['marketsub'][0] != 'all' && count($rs['marketsub']) > 0) {
        if ($rs['marketsubcat']) {
            $tempcat = array();
            foreach ($rs['marketsub'] as $scat) {
                $tempcat = array_merge(cot_structure_children('market', $scat), $tempcat);
            }
            $tempcat = array_unique($tempcat);
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        } else {
            $tempcat = array();
            foreach ($rs['marketsub'] as $scat) {
                $tempcat[] = $db->prep($scat);
            }
            $where_and['cat'] = "item_cat IN ('" . implode("','", $tempcat) . "')";
        }
Пример #29
0
         $enabled = cot_plugin_active('comments') ? 1 : 0;
         break;
     case 'forumpost':
         $icon = $R['admin_icon_forums_posts'];
         $typestr = $L['Post'];
         $enabled = cot_module_active('forums') ? 1 : 0;
         break;
     case 'forumtopic':
         $icon = $R['admin_icon_forums_topics'];
         $typestr = $L['Topic'];
         $enabled = cot_module_active('forums') ? 1 : 0;
         break;
     case 'page':
         $icon = $R['admin_icon_page'];
         $typestr = $L['Page'];
         $enabled = cot_module_active('page') ? 1 : 0;
         break;
     case 'user':
         $icon = $R['admin_icon_user'];
         $typestr = $L['User'];
         $enabled = 1;
         break;
     default:
         $icon = $R['admin_icon_tools'];
         $typestr = $row['tr_type'];
         $enabled = 1;
         break;
 }
 $tr_t->assign(array('ADMIN_TRASHCAN_DATE' => cot_date('datetime_medium', $row['tr_date']), 'ADMIN_TRASHCAN_DATE_STAMP' => $row['tr_date'], 'ADMIN_TRASHCAN_TYPESTR_ICON' => $icon, 'ADMIN_TRASHCAN_TYPESTR' => $typestr, 'ADMIN_TRASHCAN_TITLE' => htmlspecialchars($row['tr_title']), 'ADMIN_TRASHCAN_TRASHEDBY' => $row['tr_trashedby'] == 0 ? $L['System'] : cot_build_user($row['tr_trashedby'], htmlspecialchars($row['user_name'])), 'ADMIN_TRASHCAN_ROW_WIPE_URL' => cot_url('admin', 'm=other&p=trashcan&a=wipe&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_RESTORE_URL' => cot_url('admin', 'm=other&p=trashcan&a=restore&id=' . $row['tr_id'] . '&d=' . $durl . '&' . cot_xg()), 'ADMIN_TRASHCAN_ROW_INFO_URL' => cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $row['tr_id']), 'ADMIN_TRASHCAN_ROW_RESTORE_ENABLED' => $enabled));
 /* === Hook - Part2 : Include === */
 foreach ($extp as $pl) {
Пример #30
0
/**
 * Удаляем количество постов в константе при удалении страниц и т.д.
 * @param num  $user_id - ID пользователя.
 */
function karma_delete_posts($user_id)
{
    global $db_users, $db;
    if (empty($user_id) || $user_id == 0) {
        return;
    }
    if (cot_module_active('users')) {
        cot::$db->registerTable('users');
        $karma_auth = $db->query("SELECT user_karma_auth FROM {$db_users}  WHERE user_id= {$user_id} ")->fetch();
        $klast = explode(":", $karma_auth['user_karma_auth']);
        $karmasave = $klast[0] . ":" . $klast[1] . ":" . $klast[2] . ":" . ($klast[3] - 1);
        $db->query("UPDATE {$db_users} SET user_karma_auth = '" . $karmasave . "'   WHERE user_id= {$user_id} ");
    }
}