Ejemplo n.º 1
0
function cot_load_structure_custom()
{
    global $db, $db_structure, $cfg, $cot_extrafields, $structure;
    $structure = array();
    if (defined('COT_UPGRADE')) {
        $sql = $db->query("SELECT * FROM {$db_structure} ORDER BY structure_path ASC");
        $row['structure_area'] = 'page';
    } else {
        $sql = $db->query("SELECT * FROM {$db_structure} ORDER BY structure_area ASC, structure_path ASC");
    }
    /* == Hook: Part 1 ==*/
    $extp = cot_getextplugins('structure');
    /* ================= */
    $path = array();
    // code path tree
    $tpath = array();
    // title path tree
    $tpls = array();
    // tpl codes tree
    foreach ($sql->fetchAll() as $row) {
        $last_dot = mb_strrpos($row['structure_path'], '.');
        $row['structure_tpl'] = empty($row['structure_tpl']) ? $row['structure_code'] : $row['structure_tpl'];
        if ($last_dot > 0) {
            $path1 = mb_substr($row['structure_path'], 0, $last_dot);
            $path[$row['structure_path']] = $path[$path1] . '.' . $row['structure_code'];
            $separaror = $cfg['separator'] == strip_tags($cfg['separator']) ? ' ' . $cfg['separator'] . ' ' : ' \\ ';
            $tpath[$row['structure_path']] = $tpath[$path1] . $separaror . $row['structure_title'];
            $parent_dot = mb_strrpos($path[$path1], '.');
            $parent = $parent_dot > 0 ? mb_substr($path[$path1], $parent_dot + 1) : $path[$path1];
            $subcats[$row['structure_area']][$parent][] = $row['structure_code'];
        } else {
            $path[$row['structure_path']] = $row['structure_code'];
            $tpath[$row['structure_path']] = $row['structure_title'];
            $parent = $row['structure_code'];
            // self
        }
        if ($row['structure_tpl'] == 'same_as_parent') {
            $row['structure_tpl'] = $tpls[$parent];
        }
        $tpls[$row['structure_code']] = $row['structure_tpl'];
        $structure[$row['structure_area']][$row['structure_code']] = array('path' => $path[$row['structure_path']], 'tpath' => $tpath[$row['structure_path']], 'rpath' => $row['structure_path'], 'id' => $row['structure_id'], 'tpl' => $row['structure_tpl'], 'title' => $row['structure_title'], 'desc' => $row['structure_desc'], 'icon' => $row['structure_icon'], 'locked' => $row['structure_locked'], 'count' => $row['structure_count']);
        if (is_array($cot_extrafields[$db_structure])) {
            foreach ($cot_extrafields[$db_structure] as $exfld) {
                $structure[$row['structure_area']][$row['structure_code']][$exfld['field_name']] = $row['structure_' . $exfld['field_name']];
            }
        }
        /* == Hook: Part 2 ==*/
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ================= */
    }
    foreach ($structure as $area => $area_structure) {
        foreach ($area_structure as $i => $x) {
            $structure[$area][$i]['subcats'] = $subcats[$area][$i];
        }
    }
}
Ejemplo n.º 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');
}
Ejemplo n.º 3
0
/**
 * A HTM filter callback using HTML Purifier
 *
 * @param string $value Unfiltered HTML value
 * @param string $name Input name
 * @return string Purified HTML
 */
function htmlpurifier_filter($value, $name)
{
    global $cfg, $sys, $usr;
    if ($sys['parser'] == 'html') {
        static $purifier = null;
        // Lazy loading to save performance
        if (is_null($purifier)) {
            define('HTMLPURIFIER_PREFIX', $cfg['plugins_dir'] . '/htmlpurifier/lib/standalone');
            require_once $cfg['plugins_dir'] . '/htmlpurifier/lib/HTMLPurifier.standalone.php';
            $cacheDir = $cfg['cache_dir'] . DIRECTORY_SEPARATOR . 'htmlpurifier';
            if (!file_exists($cacheDir)) {
                mkdir($cacheDir, 0775, true);
            }
            $cacheDir = realpath($cacheDir);
            $config = HTMLPurifier_Config::createDefault();
            $config->set('HTML.Doctype', $cfg['plugin']['htmlpurifier']['doctype']);
            $config->set('HTML.TidyLevel', $cfg['plugin']['htmlpurifier']['tidylevel']);
            $config->set('URI.Base', COT_ABSOLUTE_URL);
            $config->set('URI.Host', $sys['domain']);
            if ($cfg['plugin']['htmlpurifier']['rel2abs']) {
                $config->set('URI.MakeAbsolute', true);
            }
            $config->set('Cache.SerializerPath', $cacheDir);
            // Load preset
            if ($usr['id'] > 0) {
                $preset_name = 'group_' . $usr['maingrp'];
                if (!file_exists($cfg['plugins_dir'] . "/htmlpurifier/presets/htmlpurifier.{$preset_name}.preset.php")) {
                    $preset_name = 'default';
                }
            } else {
                $preset_name = 'group_1';
            }
            require_once $cfg['plugins_dir'] . "/htmlpurifier/presets/htmlpurifier.{$preset_name}.preset.php";
            /* config extension */
            foreach (cot_getextplugins('htmlpurifier.config') as $pl) {
                include $pl;
            }
            foreach ($htmlpurifier_preset as $key => $val) {
                $config->set($key, $val);
            }
            $purifier = new HTMLPurifier($config);
        }
        return $purifier->purify($value);
    } else {
        return $value;
    }
}
Ejemplo n.º 4
0
 /**
  * Returns client tags for coTemplate
  *
  * @param brs_model_Client|int $client
  * @param string $tagPrefix Prefix for tags
  * @param bool $cacheitem Cache tags
  * @return array|void
  *
  * @deprecated
  */
 public static function generateTags($client, $tagPrefix = '', $cacheitem = true)
 {
     global $cfg, $L, $usr;
     static $extp_first = null, $extp_main = null;
     static $cache = array();
     if (is_null($extp_first)) {
         $extp_first = cot_getextplugins('banners.client.tags.first');
         $extp_main = cot_getextplugins('banners.client.tags.main');
     }
     /* === Hook === */
     foreach ($extp_first as $pl) {
         include $pl;
     }
     /* ===== */
     if (is_object($client) && is_array($cache[$client->bac_id])) {
         $temp_array = $cache[$client->bac_id];
     } elseif (is_int($client) && is_array($cache[$client])) {
         $temp_array = $cache[$client];
     } else {
         if (is_int($client) && $client > 0) {
             $client = self::getById($client);
         }
         $purchase = array(BaClient::PURCHASE_DEFAULT => $L['Default'], BaClient::PURCHASE_UNLIMITED => $L['ba_unlimited'], BaClient::PURCHASE_YEARLY => $L['ba_pt_yearly'], BaClient::PURCHASE_MONTHLY => $L['ba_pt_monthly'], BaClient::PURCHASE_WEEKLY => $L['ba_pt_weekly'], BaClient::PURCHASE_DAILY => $L['ba_pt_daily']);
         $temp_array = array();
         if ($client->bac_id > 0) {
             $item_link = cot_url('admin', array('m' => 'other', 'p' => 'banners', 'n' => 'clients', 'a' => 'edit', 'id' => $client->bac_id));
             $temp_array = array('URL' => $item_link, 'ID' => $client->bac_id, 'TITLE' => htmlspecialchars($client->bac_title), 'PUBLISHED' => $client->bac_published ? $L['Yes'] : $L['No'], 'PURCHASE' => $client->bac_purchase_type, 'PURCHASE_TEXT' => $purchase[$client->bac_purchase_type]);
             /* === Hook === */
             foreach ($extp_main as $pl) {
                 include $pl;
             }
             /* ===== */
             $cacheitem && ($cache[$client->bac_id] = $temp_array);
         } else {
             // Клиента не существует
         }
     }
     $return_array = array();
     foreach ($temp_array as $key => $val) {
         $return_array[$tagPrefix . $key] = $val;
     }
     return $return_array;
 }
Ejemplo n.º 5
0
/**
 * Deletes outdated topics
 *
 * @param string $mode Selection criteria
 * @param string $section Section
 * @param int $param Selection parameter value
 * @return int
 * @global CotDB $db
 */
function cot_forums_prunetopics($mode, $section, $param)
{
    global $db, $cfg, $sys, $db_forum_topics, $db_forum_posts, $db_forum_stats, $db_users, $L;
    $num = 0;
    $num1 = 0;
    if (!is_int($param)) {
        $param = (int) $param;
    }
    switch ($mode) {
        case 'updated':
            $limit = $sys['now'] - $param * 86400;
            $sql1 = $db->query("SELECT * FROM {$db_forum_topics} WHERE ft_cat=" . $db->quote($section) . " AND ft_updated < {$limit} AND ft_sticky='0'");
            break;
        case 'single':
            $sql1 = $db->query("SELECT * FROM {$db_forum_topics} WHERE ft_cat=" . $db->quote($section) . " AND ft_id={$param}");
            break;
    }
    if ($sql1->rowCount() > 0) {
        foreach ($sql1->fetchAll() as $row1) {
            $q = $row1['ft_id'];
            /* === Hook === */
            foreach (cot_getextplugins('forums.functions.prunetopics') as $pl) {
                include $pl;
            }
            /* ===== */
            // Decrease postcount for users
            foreach ($db->query("SELECT COUNT(*) AS cnt, fp_posterid FROM {$db_forum_posts}  WHERE fp_topicid={$q} GROUP BY fp_posterid")->fetchAll() as $row2) {
                $db->query("UPDATE {$db_users} SET user_postcount = user_postcount - ? WHERE user_id = ?", array((int) $row2['cnt'], (int) $row2['fp_posterid']));
            }
            $num += $db->delete($db_forum_posts, "fp_topicid={$q}");
            $num1 += $db->delete($db_forum_topics, "ft_id={$q}");
        }
        $sql = $db->delete($db_forum_topics, "ft_movedto={$q}");
        $sql = $db->query("UPDATE {$db_forum_stats} SET fs_topiccount=fs_topiccount-{$num1}, fs_postcount=fs_postcount-{$num} WHERE fs_cat=" . $db->quote($section));
    }
    $num1 = $num1 == '' ? '0' : $num1;
    return $num1;
}
Ejemplo n.º 6
0
/**
 * Administration panel - PHP Infos
 *
 * @package Cotonti
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('admin', 'a');
cot_block($usr['auth_read']);
$t = new XTemplate(cot_tplfile('admin.infos', 'core'));
$adminpath[] = array(cot_url('admin', 'm=other'), $L['Other']);
$adminpath[] = array(cot_url('admin', 'm=infos'), $L['adm_infos']);
$adminhelp = $L['adm_help_versions'];
$adminsubtitle = $L['adm_infos'];
/* === Hook === */
foreach (cot_getextplugins('admin.infos.first') as $pl) {
    include $pl;
}
/* ===== */
@error_reporting(0);
$t->assign(array('ADMIN_INFOS_PHPVER' => function_exists('phpversion') ? phpversion() : $L['adm_help_config'], 'ADMIN_INFOS_ZENDVER' => function_exists('zend_version') ? zend_version() : $L['adm_help_config'], 'ADMIN_INFOS_INTERFACE' => function_exists('php_sapi_name') ? php_sapi_name() : $L['adm_help_config'], 'ADMIN_INFOS_CACHEDRIVERS' => is_array($cot_cache_drivers) ? implode(', ', $cot_cache_drivers) : '', 'ADMIN_INFOS_OS' => function_exists('php_uname') ? php_uname() : $L['adm_help_config'], 'ADMIN_INFOS_DATE' => cot_date('datetime_medium', $sys['now'], false), 'ADMIN_INFOS_GMDATE' => gmdate('Y-m-d H:i'), 'ADMIN_INFOS_GMTTIME' => $usr['gmttime'], 'ADMIN_INFOS_USRTIME' => $usr['localtime'], 'ADMIN_INFOS_TIMETEXT' => $usr['timetext']));
/* === Hook === */
foreach (cot_getextplugins('admin.infos.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$adminmain = $t->text('MAIN');
@error_reporting(7);
Ejemplo n.º 7
0
    include $pl;
}
/* ===== */
$out['head'] .= $R['code_noindex'];
$out['subtitle'] = $title;
require_once $cfg['system_dir'] . '/header.php';
$tpl_type = defined('COT_ADMIN') ? 'core' : 'module';
$t = new XTemplate(cot_tplfile('message', $tpl_type));
if (COT_AJAX) {
    $t->assign('AJAX_MODE', true);
}
$errmsg = $title;
$title .= $usr['isadmin'] ? ' (#' . $msg . ')' : '';
$t->assign('MESSAGE_TITLE', $title);
$t->assign('MESSAGE_BODY', $body);
if ($msg == '920') {
    $confirm_no_url = preg_match("/^.+" . preg_quote($sys['domain'] . "/"), $_SERVER['HTTP_REFERER']) ? str_replace('&', '&amp;', $_SERVER['HTTP_REFERER']) : cot_url('index');
    if (preg_match('#[ "\':]#', base64_decode($redirect))) {
        $redirect = '';
    }
    $t->assign(array('MESSAGE_CONFIRM_YES' => base64_decode($redirect), 'MESSAGE_CONFIRM_NO' => $confirm_no_url));
    $t->parse('MAIN.MESSAGE_CONFIRM');
}
/* === Hook === */
foreach (cot_getextplugins('message.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Ejemplo n.º 8
0
        }
        $t->parse($id || !empty($al) ? 'MAIN.OPTIONS' : 'MAIN.DEFAULT.ROW');
    }
    if (!$id && empty($al)) {
        $t->assign(array('ADMIN_STRUCTURE_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_STRUCTURE_PAGNAV' => $pagenav['main'], 'ADMIN_STRUCTURE_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_STRUCTURE_TOTALITEMS' => $totalitems, 'ADMIN_STRUCTURE_COUNTER_ROW' => $ii));
        $t->parse('MAIN.DEFAULT');
        // flush post buffer if it contains Update Table data
        $uri = str_replace('&_ajax=1', '', $_SERVER['REQUEST_URI']);
        $hash = md5($uri);
        if (is_array($_SESSION['cot_buffer'][$hash]['rstructurecode'])) {
            unset($_SESSION['cot_buffer'][$hash]);
        }
        $t->assign(array('ADMIN_STRUCTURE_URL_FORM_ADD' => cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&a=add&d=' . $durl), 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', null, 'size="16"'), 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath', null, 'size="16" maxlength="16"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle', null, 'size="64" maxlength="100"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc', null, 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon', null, 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox(null, 'rstructurelocked'), 'ADMIN_STRUCTURE_TPLMODE' => cot_radiobox(null, 'rtplmode', array('1', '2', '3'), array($L['adm_tpl_empty'], $L['adm_tpl_parent'], $L['adm_tpl_forced']), '', '<br />')));
        // Extra fields
        foreach ($cot_extrafields[$db_structure] as $exfld) {
            $exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'], $exfld, null);
            $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.NEWCAT.EXTRAFLD');
        }
        $t->parse('MAIN.NEWCAT');
    }
    cot_display_messages($t);
    /* === Hook  === */
    foreach (cot_getextplugins('admin.structure.tags') as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN');
    $adminmain = $t->text('MAIN');
}
Ejemplo n.º 9
0
foreach (cot_getextplugins('market.list.search.tags') as $pl) {
    include $pl;
}
/* ===== */
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
    $sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('market.list.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $jj++;
    $t->assign(cot_generate_usertags($item, 'PRD_ROW_OWNER_'));
    $t->assign(cot_generate_markettags($item, 'PRD_ROW_', $cfg['market']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    $t->assign(array("PRD_ROW_ODDEVEN" => cot_build_oddeven($jj)));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse("MAIN.PRD_ROWS");
}
/* === Hook === */
foreach (cot_getextplugins('market.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$module_body = $t->text('MAIN');
Ejemplo n.º 10
0
if ($usr['id'] != $item['item_userid'] && (!$usr['isadmin'] || $cfg['folio']['count_admin'])) {
    $item['item_count']++;
    $db->update($db_folio, array('item_count' => $item['item_count']), "item_id=" . (int) $item['item_id']);
}
$title_params = array('TITLE' => empty($item['item_metatitle']) ? $item['item_title'] : $item['item_metatitle'], 'CATEGORY' => $structure['folio'][$item['item_cat']]['title']);
$out['subtitle'] = cot_title($cfg['folio']['title_folio'], $title_params);
$out['desc'] = !empty($item['item_metadesc']) ? $item['item_metadesc'] : cot_cutstring(strip_tags(cot_parse($item['item_text'], $cfg['folio']['markup'], $item['item_parser'])), 160);
$out['meta_keywords'] = !empty($item['item_keywords']) ? $item['item_keywords'] : $structure['folio'][$item['item_cat']]['keywords'];
// Building the canonical URL
$pageurl_params = array('c' => $item['item_cat']);
empty($al) ? $pageurl_params['id'] = $id : ($pageurl_params['al'] = $al);
$out['canonical_uri'] = cot_url('folio', $pageurl_params);
$mskin = cot_tplfile(array('folio', $structure['folio'][$item['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('folio.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$t->assign(cot_generate_usertags($item, 'PRD_OWNER_'));
$t->assign(cot_generate_foliotags($item, 'PRD_', $cfg['folio']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
/* === Hook === */
foreach (cot_getextplugins('folio.tags') as $pl) {
    include $pl;
}
/* ===== */
if ($usr['isadmin']) {
    $t->parse('MAIN.PRD_ADMIN');
}
$t->parse('MAIN');
$module_body = $t->text('MAIN');
Ejemplo n.º 11
0
/**
 * Delete Poll
 *
 * @param int $id Poll ID or Poll Code if $type is not epmty
 * @param string $type Poll type
 * @return bool
 * @global CotDB $db
 */
function cot_poll_delete($id, $type = '')
{
    global $db, $db_polls, $db_polls_options, $db_polls_voters;
    if ($type) {
        $sql = $db->query("SELECT poll_id FROM {$db_polls} WHERE poll_type = '" . $db->prep($type) . "' AND poll_code = '{$id}' LIMIT 1");
        $id = ($row = $sql->fetch()) ? $row['poll_id'] : 0;
    }
    if ((int) $id > 0) {
        $db->delete($db_polls, "poll_id = " . $id);
        $db->delete($db_polls_options, "po_pollid = " . $id);
        $db->delete($db_polls_voters, "pv_pollid = " . $id);
        /* === Hook === */
        foreach (cot_getextplugins('polls.functions.delete') as $pl) {
            include $pl;
        }
        /* ===== */
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 12
0
    $adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
    $adminpath[] = array(cot_url('admin', 'm=extensions&a=details&mod=' . $m), $cot_modules[$m]['title']);
    $adminpath[] = array(cot_url('admin', 'm=' . $m), $L['Administration']);
    $adminhelp = $L['adm_help_pfs'];
    $adminsubtitle = $L['pfs_title'];
    /* === Hook === */
    foreach (cot_getextplugins('pfs.admin.first') as $pl) {
        include $pl;
    }
    /* ===== */
    if (!function_exists('gd_info')) {
        $is_adminwarnings = true;
    } else {
        $gd_datas = gd_info();
        foreach ($gd_datas as $k => $i) {
            if (mb_strlen($i) < 2) {
                $i = $cot_yesno[$i];
            }
            $t->assign(array('ADMIN_PFS_DATAS_NAME' => $k, 'ADMIN_PFS_DATAS_ENABLE_OR_DISABLE' => $i));
            $t->parse('MAIN.PFS_ROW');
        }
    }
    $t->assign(array('ADMIN_PFS_URL_CONFIG' => cot_url('admin', 'm=config&n=edit&o=module&p=pfs'), 'ADMIN_PFS_URL_ALLPFS' => cot_url('admin', 'm=pfs&s=allpfs'), 'ADMIN_PFS_URL_SFS' => cot_url('pfs', 'userid=0')));
    /* === Hook  === */
    foreach (cot_getextplugins('pfs.admin.tags') as $pl) {
        include $pl;
    }
    /* ===== */
}
$t->parse('MAIN');
$adminmain = $t->text('MAIN');
Ejemplo n.º 13
0
$t = new XTemplate($mskin);
cot_display_messages($t);
if ($db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = {$q} ORDER BY fp_id ASC LIMIT 1")->fetchColumn() == $p) {
    $t->assign(array('FORUMS_EDITPOST_TOPICTITTLE' => cot_inputbox('text', 'rtopictitle', $rowt['ft_title'], array('size' => 56, 'maxlength' => 255)), 'FORUMS_EDITPOST_TOPICDESCRIPTION' => cot_inputbox('text', 'rtopicdesc', $rowt['ft_desc'], array('size' => 56, 'maxlength' => 255))));
    // Extra fields
    foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('rtopic' . $exfld['field_name'], $exfld, $rowt['ft_' . $exfld['field_name']]);
        $exfld_title = isset($L['forums_topics_' . $exfld['field_name'] . '_title']) ? $L['forums_topics_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $t->assign(array('FORUMS_EDITPOST_TOPIC_' . $uname => $exfld_val, 'FORUMS_EDITPOST_TOPIC_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_TOPIC_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST.TOPIC_EXTRAFLD');
    }
    $t->parse('MAIN.FORUMS_EDITPOST_FIRSTPOST');
}
$t->assign(array('FORUMS_EDITPOST_PAGETITLE' => $toptitle, 'FORUMS_EDITPOST_SUBTITLE' => $L['forums_postedby'] . ": <a href=\"users.php?m=details&id=" . $rowpost['fp_posterid'] . "\">" . $rowpost['fp_postername'] . "</a> @ " . cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED' => cot_date('datetime_medium', $rowpost['fp_updated']), 'FORUMS_EDITPOST_UPDATED_STAMP' => $rowpost['fp_updated'], 'FORUMS_EDITPOST_SEND' => cot_url('forums', "m=editpost&a=update&s=" . $s . "&q=" . $q . "&p=" . $p . '&d=' . $durl . "&" . cot_xg()), 'FORUMS_EDITPOST_TEXT' => cot_textarea('rmsgtext', $rowpost['fp_text'], 20, 56, '', 'input_textarea_' . $minimaxieditor), 'FORUMS_EDITPOST_EDITTIMEOUT' => cot_build_timegap(0, $cfg['forums']['edittimeout'] * 3600)));
// Extra fields
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('rmsg' . $exfld['field_name'], $exfld, $rowpost['fp_' . $exfld['field_name']]);
    $exfld_title = isset($L['forums_posts_' . $exfld['field_name'] . '_title']) ? $L['forums_posts_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('FORUMS_EDITPOST_' . $uname => $exfld_val, 'FORUMS_EDITPOST_' . $uname . '_TITLE' => $exfld_title, 'FORUMS_EDITPOST_EXTRAFLD' => $exfld_val, 'FORUMS_EDITPOST_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.EXTRAFLD');
}
/* === Hook === */
foreach (cot_getextplugins('forums.editpost.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Ejemplo n.º 14
0
/**
 * Applies Handly URLs rewrite to current script parameters
 * @global array $cfg
 */
function cot_apply_rwr()
{
    global $cfg, $structure;
    if (function_exists('cot_apply_rwr_custom')) {
        return cot_apply_rwr_custom();
    }
    $rwr = cot_import('rwr', 'G', 'TXT');
    if (isset($rwr) && !empty($rwr)) {
        // Ignore ending slash and split the path into parts
        $path = explode('/', mb_strrpos($rwr, '/') === mb_strlen($rwr) - 1 ? mb_substr($rwr, 0, -1) : $rwr);
        $count = count($path);
        $rwr_continue = true;
        /* === Hook === */
        foreach (cot_getextplugins('urleditor.rewrite.first') as $pl) {
            include $pl;
        }
        /* ===== */
        if (!$rwr_continue) {
            return;
        }
        $filtered = cot_import($path[0], 'D', 'ALP');
        if ($count == 1) {
            if (isset($structure['page'][$filtered]) || $filtered == 'unvalidated' || $filtered == 'saved_drafts') {
                // Is a category
                $_GET['e'] = 'page';
                $_GET['c'] = $filtered;
            } elseif (file_exists($cfg['modules_dir'] . '/' . $filtered) || file_exists($cfg['plugins_dir'] . '/' . $filtered)) {
                // Is an extension
                $_GET['e'] = $filtered;
            } elseif (in_array($filtered, array('register', 'profile', 'passrecover'))) {
                // Special users shortcuts
                $_GET['e'] = 'users';
                $_GET['m'] = $filtered;
            } else {
                // Maybe it is a system page, if not 404 will be given
                $_GET['e'] = 'page';
                $_GET['c'] = 'system';
                $id = cot_import($path[0], 'D', 'INT');
                if ($id) {
                    $_GET['id'] = $id;
                } else {
                    $alias = preg_replace('`[+/?%#&]`', '', cot_import($path[0], 'D', 'TXT'));
                    $_GET['al'] = $alias;
                }
            }
        } else {
            // Special shortcuts
            if ($filtered == 'users' && $count == 2 && !isset($_GET['m'])) {
                // User profiles
                $_GET['e'] = 'users';
                $_GET['m'] = 'details';
                $_GET['u'] = $path[1];
                return;
            } elseif ($filtered == 'tags') {
                // Tags
                $_GET['e'] = 'tags';
                if ($count == 3) {
                    $_GET['a'] = $path[1];
                    $_GET['t'] = $path[2];
                } else {
                    $_GET['a'] = 'pages';
                    $_GET['t'] = $path[1];
                }
                return;
            } elseif ($filtered == 'rss') {
                // RSS
                $_GET['e'] = 'rss';
                $_GET['m'] = $path[1];
                if ($count == 3) {
                    is_numeric($path[2]) ? $_GET['id'] = $path[2] : ($_GET['c'] = $path[2]);
                } else {
                    $_GET['c'] = $path[1];
                }
                return;
            }
            $last = $count - 1;
            $ext = isset($structure['page'][$filtered]) ? 'page' : $filtered;
            $_GET['e'] = $ext;
            $cat_chain = array_slice($path, 0, -1);
            if (isset($structure[$ext][$path[$last]]) && !in_array($path[$last], $cat_chain)) {
                // Is a category
                $_GET['c'] = $path[$last];
            } else {
                // Is a page/item
                if ($ext == 'page' || $count > 2) {
                    $_GET['c'] = $path[$last - 1];
                }
                if (is_numeric($path[$last])) {
                    $_GET['id'] = $path[$last];
                } else {
                    // Can be a cat or al, let the module decide
                    if ($count == 2 && !isset($structure[$ext][$_GET['c']])) {
                        $_GET['c'] = $path[$last];
                    }
                    $_GET['al'] = $path[$last];
                }
            }
        }
    }
}
Ejemplo n.º 15
0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('forms');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'sbr');
/* === Hook === */
foreach (cot_getextplugins('sbr.stage.first') as $pl) {
    include $pl;
}
/* ===== */
if (!empty($num)) {
    $sql = $db->query("SELECT * FROM {$db_sbr_stages} WHERE stage_sid=" . $id . " AND stage_num=" . $num . " LIMIT 1");
    $stage = $sql->fetch();
}
$t->assign(array('STAGE_NUM' => $stage['stage_num'], 'STAGE_ID' => $stage['stage_id'], 'STAGE_TITLE' => $stage['stage_title'], 'STAGE_TEXT' => $stage['stage_text'], 'STAGE_COST' => $stage['stage_cost'], 'STAGE_DAYS' => $stage['stage_days'], 'STAGE_STATUS' => $stage['stage_status'], 'STAGE_BEGIN' => $stage['stage_begin'], 'STAGE_DONE' => $stage['stage_done'], 'STAGE_EXPIRE' => $stage['stage_expire'], 'STAGE_EXPIREDATE' => $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60, 'STAGE_EXPIREDAYS' => cot_build_timegap($sys['now'], $stage['stage_begin'] + $stage['stage_days'] * 24 * 60 * 60), 'STAGE_DONE_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=done'), 'STAGE_CLAIM_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=claim'), 'STAGE_DECISION_URL' => cot_url('sbr', 'id=' . $id . '&num=' . $stage['stage_num'] . '&action=decision')));
$stagefiles = $db->query("SELECT * FROM {$db_sbr_files} WHERE file_sid=" . $id . " AND file_area='stage' AND file_code='" . $stage['stage_num'] . "' ORDER BY file_id ASC")->fetchAll();
if (count($stagefiles) > 0) {
    foreach ($stagefiles as $file) {
        $t->assign(array('FILE_ROW_ID' => $file['file_id'], 'FILE_ROW_URL' => $file['file_url'], 'FILE_ROW_TITLE' => $file['file_title'], 'FILE_ROW_EXT' => $file['file_ext'], 'FILE_ROW_SIZE' => $file['file_size']));
        $t->parse('MAIN.SBR.STAGE.FILES.FILE_ROW');
    }
    $t->parse('MAIN.SBR.STAGE.FILES');
}
/* === Hook === */
foreach (cot_getextplugins('sbr.stage.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN.SBR.STAGE');
Ejemplo n.º 16
0
if (empty($ritem['item_type']) && !empty($type)) {
    $ritem['item_type'] = $type;
}
$out['subtitle'] = $L['projects_add_project_title'];
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['projects'][$c]['title'];
$mskin = cot_tplfile(array('projects', 'add', $structure['projects'][$ritem['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('projects.add.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
// Error and message handling
cot_display_messages($t);
$t->assign(array("PRJADD_FORM_SEND" => cot_url('projects', 'm=add&c=' . $c . '&type=' . $type . '&a=add'), "PRJADD_FORM_CAT" => cot_selectbox_structure('projects', $ritem['item_cat'], 'rcat'), "PRJADD_FORM_CATTITLE" => !empty($c) ? $structure['projects'][$c]['title'] : '', "PRJADD_FORM_TYPE" => is_array($projects_types) ? cot_selectbox($ritem['item_type'] ? $ritem['item_type'] : $cfg['projects']['default_type'], 'rtype', array_keys($projects_types), array_values($projects_types)) : 'empty', "PRJADD_FORM_TYPETITLE" => is_array($projects_types) && !empty($type) ? $projects_types[$type] : '', "PRJADD_FORM_TITLE" => cot_inputbox('text', 'rtitle', $ritem['item_title'], 'size="56"'), "PRJADD_FORM_ALIAS" => cot_inputbox('text', 'ralias', $ritem['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRJADD_FORM_TEXT" => cot_textarea('rtext', $ritem['item_text'], 10, 60, 'id="formtext"', $prjeditor ? 'input_textarea_' . $prjeditor : ''), "PRJADD_FORM_COST" => cot_inputbox('text', 'rcost', $ritem['item_cost'], 'size="10"'), "PRJADD_FORM_PARSER" => cot_selectbox($cfg['projects']['parser'], 'rparser', $parser_list, $parser_list, false)));
// Extra fields
foreach ($cot_extrafields[$db_projects] as $exfld) {
    $uname = strtoupper($exfld['field_name']);
    $exfld_val = cot_build_extrafields('ritem' . $exfld['field_name'], $exfld, $ritem['item_' . $exfld['field_name']]);
    $exfld_title = isset($L['projects_' . $exfld['field_name'] . '_title']) ? $L['projects_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
    $t->assign(array('PRJADD_FORM_' . $uname => $exfld_val, 'PRJADD_FORM_' . $uname . '_TITLE' => $exfld_title, 'PRJADD_FORM_EXTRAFLD' => $exfld_val, 'PRJADD_FORM_EXTRAFLD_TITLE' => $exfld_title));
    $t->parse('MAIN.EXTRAFLD');
}
/* === Hook === */
foreach (cot_getextplugins('projects.add.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$module_body = $t->text('MAIN');
 }
 /* ===== */
 if (!$db->fieldExists($db_projects, 'item_' . $rs['prjsort'])) {
     $rs['prjsort'] = 'date';
 }
 $sqllist = $db->query("SELECT SQL_CALC_FOUND_ROWS p.* {$search_join_columns}\n\t\tFROM {$db_projects} AS p {$search_join_condition}\n\t\tWHERE {$where}\n\t\tORDER BY item_" . $rs['prjsort'] . " " . $rs['prjsort2'] . "\n\t\tLIMIT {$d}, " . $cfg_maxitems . $search_union_query);
 $items = $sql->rowCount();
 $totalitems[] = $db->query('SELECT FOUND_ROWS()')->fetchColumn();
 $jj = 0;
 $sqllist_rowset = $sqllist->fetchAll();
 $sqllist_idset = array();
 foreach ($sqllist_rowset as $item) {
     $sqllist_idset[$item['item_id']] = $item['item_alias'];
 }
 /* === Hook - Part 1 === */
 $extp = cot_getextplugins('projects.search.loop');
 /* ===== */
 foreach ($sqllist_rowset as $row) {
     $url_cat = cot_url('projects', 'c=' . $row['item_cat']);
     $url_prj = empty($row['item_alias']) ? cot_url('projects', 'c=' . $row['item_cat'] . '&id=' . $row['item_id'] . '&highlight=' . $hl) : cot_url('projects', 'c=' . $row['item_cat'] . '&al=' . $row['item_alias'] . '&highlight=' . $hl);
     $t->assign(cot_generate_projecttags($row, 'PLUGIN_PROJECTSRES_'));
     $t->assign(array('PLUGIN_PROJECTSRES_CATEGORY' => cot_rc_link($url_cat, $structure['projects'][$row['item_cat']]['tpath']), 'PLUGIN_PROJECTSRES_CATEGORY_URL' => $url_cat, 'PLUGIN_PROJECTSRES_TITLE' => cot_rc_link($url_prj, htmlspecialchars($row['item_title'])), 'PLUGIN_PROJECTSRES_TEXT' => cot_clear_mark($row['item_text'], $words), 'PLUGIN_PROJECTSRES_TIME' => cot_date('datetime_medium', $row['item_date']), 'PLUGIN_PROJECTSRES_TIMESTAMP' => $row['item_date'], 'PLUGIN_PROJECTSRES_ODDEVEN' => cot_build_oddeven($jj), 'PLUGIN_PROJECTSRES_NUM' => $jj));
     /* === Hook - Part 2 === */
     foreach ($extp as $pl) {
         include $pl;
     }
     /* ===== */
     $t->parse('MAIN.RESULTS.PROJECTS.ITEM');
     $jj++;
 }
 if ($jj > 0) {
Ejemplo n.º 18
0
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Modules']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        $sql = $db->query("\n\t\t\tSELECT DISTINCT(c.config_cat), r.ct_title FROM {$db_config} AS c\n\t\t\t\tLEFT JOIN {$db_core} AS r ON c.config_cat = r.ct_code\n\t\t\tWHERE config_owner = 'plug'\n\t\t\tAND config_type != '" . COT_CONFIG_TYPE_HIDDEN . "'\n\t\t\tORDER BY config_cat ASC\n\t\t");
        $jj = 0;
        while ($row = $sql->fetch()) {
            $jj++;
            $ext_info = cot_get_extensionparams($row['config_cat'], false);
            $t->assign(array('ADMIN_CONFIG_ROW_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=' . $row['config_cat']), 'ADMIN_CONFIG_ROW_ICO' => $ext_info['icon'], 'ADMIN_CONFIG_ROW_NAME' => $ext_info['name'], 'ADMIN_CONFIG_ROW_DESC' => $ext_info['desc'], 'ADMIN_CONFIG_ROW_NUM' => $jj, 'ADMIN_CONFIG_ROW_ODDEVEN' => cot_build_oddeven($jj)));
            $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL.ADMIN_CONFIG_ROW');
        }
        $sql->closeCursor();
        $t->assign('ADMIN_CONFIG_COL_CAPTION', $L['Plugins']);
        $t->parse('MAIN.DEFAULT.ADMIN_CONFIG_COL');
        /* === Hook  === */
        foreach (cot_getextplugins('admin.config.default.tags') as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.DEFAULT');
        break;
}
cot_display_messages($t);
/* === Hook  === */
foreach (cot_getextplugins('admin.config.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$adminmain = $t->text('MAIN');
Ejemplo n.º 19
0
    foreach (cot_getextplugins('projects.preview.save.done') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_redirect($r_url);
    exit;
}
$out['subtitle'] = $L['projects'];
$mskin = cot_tplfile(array('projects', 'preview', $structure['projects'][$item['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('projects.preview.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
if ($item['item_state'] != 0 && !$usr['isadmin'] && $usr['id'] != $item['item_userid']) {
    cot_log("Attempt to directly access an un-validated", 'sec');
    cot_redirect(cot_url('message', "msg=930", '', true));
    exit;
}
$r_url = empty($item['item_alias']) ? cot_url('projects', 'c=' . $item['item_cat'] . '&id=' . $id) : cot_url('projects', 'c=' . $item['item_cat'] . '&al=' . $item['item_alias']);
$t->assign(cot_generate_usertags($item, 'PRJ_OWNER_'));
$t->assign(cot_generate_projecttags($item, 'PRJ_', $cfg['projects']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
$t->assign(array("PRJ_SHOW_URL" => $cfg['mainurl'] . '/' . $r_url, "PRJ_SAVE_URL" => cot_url('projects', 'm=preview&a=save&id=' . $item['item_id'] . '&' . cot_xg()), "PRJ_EDIT_URL" => cot_url('projects', 'm=edit&id=' . $item['item_id'])));
/* === Hook === */
foreach (cot_getextplugins('projects.preview.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$module_body = $t->text('MAIN');
Ejemplo n.º 20
0
/**
 * Updates a product in the CMS.
 * @param  integer $id    Product ID
 * @param  array   $ritem Product data
 * @param  array   $auth  Permissions array
 * @return boolean        TRUE on success, FALSE on error
 */
function cot_market_update($id, &$ritem, $auth = array())
{
    global $cache, $cfg, $db, $db_market, $db_structure, $structure, $L;
    if (cot_error_found()) {
        return false;
    }
    if (count($auth) == 0) {
        $auth = cot_market_auth($ritem['item_cat']);
    }
    if (!empty($ritem['item_alias'])) {
        $prd_count = $db->query("SELECT COUNT(*) FROM {$db_market} WHERE item_alias = ? AND item_id != ?", array($ritem['item_alias'], $id))->fetchColumn();
        if ($prd_count > 0) {
            $ritem['item_alias'] = $ritem['item_alias'] . rand(1000, 9999);
        }
    }
    $item = $db->query("SELECT * FROM {$db_market} WHERE item_id = ?", $id)->fetch();
    if (!$cfg['market']['preview']) {
        $ritem['item_state'] = !$cfg['market']['prevalidate'] || $auth['isadmin'] ? 0 : 2;
    } else {
        $ritem['item_state'] = 1;
    }
    if (!$db->update($db_market, $ritem, 'item_id = ?', $id)) {
        return false;
    }
    cot_market_sync($item['item_cat']);
    cot_market_sync($ritem['item_cat']);
    cot_extrafield_movefiles();
    /* === Hook === */
    foreach (cot_getextplugins('market.edit.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    return true;
}
Ejemplo n.º 21
0
    $area = cot_import('area', 'P', 'ALP');
    $times = cot_import('times', 'P', 'INT');
    $urr_id = $db->query("SELECT user_id FROM {$db_users} WHERE user_name='" . $username . "'")->fetchColumn();
    cot_check(empty($username), 'paytop_error_username');
    cot_check(empty($urr_id), 'paytop_error_userempty');
    cot_check(empty($times), 'paytop_error_timesempty');
    cot_check(empty($area), 'paytop_error_areaempty');
    if (!cot_error_found()) {
        cot_payments_userservice('paytop.' . $area, $urr_id, $times * $pt_cfg[$area]['period']);
        /* === Hook === */
        foreach (cot_getextplugins('paytop.done') as $pl) {
            include $pl;
        }
        /* ===== */
        /* === Hook === */
        foreach (cot_getextplugins('paytop.' . $area . '.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    cot_redirect(cot_url('admin', 'm=other&p=paytop', '', true));
}
if ($a == 'delete') {
    $db->delete($db_payments_services, "service_id=?", array($id));
    cot_redirect(cot_url('admin', 'm=other&p=paytop', '', true));
}
$paytops = $db->query("SELECT * FROM {$db_payments_services} as s\n\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\tWHERE s.service_area LIKE 'paytop.%' ORDER BY s.service_id DESC")->fetchAll();
foreach ($paytops as $urr) {
    $t->assign(cot_generate_usertags($urr, 'TOP_ROW_USER_'));
    $t->assign(array('TOP_ROW_AREA' => $urr['service_area'], 'TOP_ROW_EXPIRE' => $urr['service_expire'], 'TOP_ROW_SERVICE_ID' => $urr['service_id']));
    $t->parse('MAIN.TOP_ROW');
Ejemplo n.º 22
0
if ($category) {
    $market_count = $page_nav[$category];
    $opt_array['cat'] = $category;
}
$pagenav = cot_pagenav('users', $opt_array, $d, $market_count, $cfg['market']['cat___default']['maxrowsperpage'], 'dmarket');
$t1->assign(array("PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next'], "PAGENAV_COUNT" => $market_count));
$sqllist_rowset = $sqllist->fetchAll();
$sqllist_idset = array();
foreach ($sqllist_rowset as $item) {
    $sqllist_idset[$item['item_id']] = $item['item_alias'];
}
/* === Hook === */
$extp = cot_getextplugins('market.userdetails.loop');
/* ===== */
foreach ($sqllist_rowset as $item) {
    $t1->assign(cot_generate_markettags($item, 'PRD_ROW_', $cfg['market']['shorttextlen'], $usr['isadmin'], $cfg['homebreadcrumb']));
    /* === Hook === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t1->parse("MAIN.PRD_ROWS");
}
/* === Hook === */
foreach (cot_getextplugins('market.userdetails.tags') as $pl) {
    include $pl;
}
/* ===== */
$t1->parse("MAIN");
$t->assign(array("USERS_DETAILS_MARKET_COUNT" => $market_count_all, "USERS_DETAILS_MARKET_URL" => cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name'] . '&tab=market')));
$t->assign('MARKET', $t1->text("MAIN"));
Ejemplo n.º 23
0
function cot_sbr_sendpost($id, $text, $to, $from = 0, $type = '', $mail = false, $rfiles = array())
{
    global $db, $db_sbr_posts, $db_sbr, $db_sbr_files, $db_users, $sys, $cfg, $L, $R;
    $rpost['post_sid'] = $id;
    $rpost['post_text'] = $text;
    $rpost['post_date'] = $sys['now'];
    $rpost['post_from'] = $from;
    $rpost['post_to'] = $to;
    $rpost['post_type'] = $type;
    /* === Hook === */
    foreach (cot_getextplugins('sbr.post.add.query') as $pl) {
        include $pl;
    }
    /* ===== */
    if ($db->insert($db_sbr_posts, $rpost)) {
        $postid = $db->lastInsertId();
        $sbr_path = $cfg['plugin']['sbr']['filepath'] . '/' . $id . '/';
        if (!file_exists($sbr_path)) {
            mkdir($sbr_path);
            @chmod($sbr_path, $cfg['dir_perms']);
        }
        for ($j = 0; $j < 10; $j++) {
            if ($rfiles['size'][$j] > 0 && $rfiles['error'][$j] == 0) {
                $u_tmp_name_file = $rfiles['tmp_name'][$j];
                $u_type_file = $rfiles['type'][$j];
                $u_name_file = $rfiles['name'][$j];
                $u_size_file = $rfiles['size'][$j];
                $u_name_file = str_replace("\\'", '', $u_name_file);
                $u_name_file = trim(str_replace("\"", '', $u_name_file));
                $dotpos = strrpos($u_name_file, ".") + 1;
                $f_extension = substr($u_name_file, $dotpos, 5);
                if (!empty($u_tmp_name_file)) {
                    $fcheck = cot_file_check($u_tmp_name_file, $u_name_file, $f_extension);
                    if ($fcheck == 1) {
                        if (in_array($f_extension, explode(',', $cfg['plugin']['sbr']['extensions']))) {
                            $u_newname_file = $postid . "_" . md5(uniqid(rand(), true)) . "." . $f_extension;
                            $file = $sbr_path . $u_newname_file;
                            move_uploaded_file($u_tmp_name_file, $file);
                            @chmod($file, 0766);
                            $rfile['file_sid'] = $id;
                            $rfile['file_url'] = $file;
                            $rfile['file_title'] = $u_name_file;
                            $rfile['file_area'] = 'post';
                            $rfile['file_code'] = $postid;
                            $rfile['file_ext'] = $f_extension;
                            $rfile['file_size'] = floor($u_size_file / 1024);
                            $db->insert($db_sbr_files, $rfile);
                        }
                    }
                }
            }
        }
        // Отправка сообщения на почту!
        if ($mail) {
            $sbr = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id=" . $id)->fetch();
            if (!empty($to)) {
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $to)->fetch();
            } else {
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_performer'])->fetch();
                $recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_employer'])->fetch();
            }
            if (!empty($from)) {
                $sender = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $from)->fetch();
            }
            foreach ($recipients as $recipient) {
                if (!empty($from)) {
                    $rsubject = cot_rc($L['sbr_mail_posts_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
                    $rbody = cot_rc($L['sbr_mail_posts_body'], array('user_name' => $recipient['user_name'], 'sender_name' => $sender['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
                } else {
                    $rsubject = cot_rc($L['sbr_mail_notification_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
                    $rbody = cot_rc($L['sbr_mail_notification_body'], array('user_name' => $recipient['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
                }
                cot_mail($recipient['user_email'], $rsubject, $rbody, '', false, null, true);
            }
        }
        /* === Hook === */
        foreach (cot_getextplugins('sbr.post.add.done') as $pl) {
            include $pl;
        }
        /* ===== */
        return $db->lastInsertId();
    }
    return false;
}
Ejemplo n.º 24
0
    $t->assign(array('PM_ROW_ID' => $row['pm_id'], 'PM_ROW_STATE' => $row['pm_tostate'], 'PM_ROW_STAR' => cot_rc($star_class ? 'pm_icon_unstar' : 'pm_icon_star', array('link' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl))), 'PM_ROW_STAR_URL' => cot_url('pm', 'f=' . $f . '&filter=' . $filter . '&a=star&id=' . $row['pm_id'] . '&d=' . $durl), 'PM_ROW_DATE' => cot_date('datetime_medium', $row['pm_date']), 'PM_ROW_DATE_STAMP' => $row['pm_date'], 'PM_ROW_TITLE' => cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), htmlspecialchars($row['pm_title']), array('class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_URL' => cot_url('pm', 'm=message&id=' . $row['pm_id']), 'PM_ROW_TEXT' => $pm_data, 'PM_ROW_ICON_STATUS' => $row['pm_icon_readstatus'], 'PM_ROW_ICON_STARRED' => $row['pm_icon_starred'], 'PM_ROW_ICON_DELETE' => cot_rc_link($url_delete, $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_ICON_DELETE_CONFIRM' => cot_rc_link(cot_confirm_url($url_delete), $R['pm_icon_trashcan'], array('title' => $L['Delete'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')), 'PM_ROW_DELETE_URL' => $url_delete, 'PM_ROW_DELETE_CONFIRM_URL' => cot_confirm_url($url_delete), 'PM_ROW_ICON_EDIT' => $row['pm_tostate'] == 0 ? cot_rc_link($url_edit, $R['pm_icon_edit'], array('title' => $L['Edit'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : '', 'PM_ROW_EDIT_URL' => $row['pm_tostate'] == 0 ? $url_edit : '', 'PM_ROW_DESC' => $pm_desc, 'PM_ROW_ODDEVEN' => cot_build_oddeven($jj), 'PM_ROW_NUM' => $jj));
    $t->assign(cot_generate_usertags($row, 'PM_ROW_USER_'));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.PM_ROW');
}
if ($jj == 0) {
    $t->parse('MAIN.PM_ROW_EMPTY');
}
if (!COT_AJAX) {
    $t->parse('MAIN.BEFORE_AJAX');
    $t->parse('MAIN.AFTER_AJAX');
}
$url_newpm = cot_url('pm', 'm=send');
$url_inbox = cot_url('pm');
$url_sentbox = cot_url('pm', 'f=sentbox');
$url_all = cot_url('pm', 'f=' . $f);
$url_unread = cot_url('pm', 'f=' . $f . '&filter=unread');
$url_starred = cot_url('pm', 'f=' . $f . '&filter=starred');
$t->assign(array('PM_PAGETITLE' => cot_breadcrumbs($title, $cfg['homebreadcrumb']), 'PM_SUBTITLE' => $subtitle, 'PM_FORM_UPDATE' => cot_url('pm', cot_xg() . '&f=' . $f . '&filter=' . $filter . '&d=' . $durl), 'PM_SENDNEWPM' => $usr['auth_write'] ? cot_rc_link($url_newpm, $L['pm_sendnew'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : '') : '', 'PM_SENDNEWPM_URL' => $usr['auth_write'] ? $url_newpm : '', 'PM_INBOX' => cot_rc_link($url_inbox, $L['pm_inbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_INBOX_URL' => $url_inbox, 'PM_INBOX_COUNT' => $totalinbox, 'PM_SENTBOX' => cot_rc_link($url_sentbox, $L['pm_sentbox'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_SENTBOX_URL' => $url_sentbox, 'PM_SENTBOX_COUNT' => $totalsentbox, 'PM_FILTER_ALL' => cot_rc_link($url_all, $L['pm_all'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_ALL_URL' => $url_all, 'PM_FILTER_UNREAD' => cot_rc_link($url_unread, $L['pm_unread'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_UNREAD_URL' => $url_unread, 'PM_FILTER_STARRED' => cot_rc_link($url_starred, $L['pm_starred'], $cfg['pm']['turnajax'] ? array('class' => 'ajax') : ''), 'PM_FILTER_STARRED_URL' => $url_starred, 'PM_PAGEPREV' => $pagenav['prev'], 'PM_PAGENEXT' => $pagenav['next'], 'PM_PAGES' => $pagenav['main'], 'PM_CURRENTPAGE' => $pagenav['current'], 'PM_TOTALPAGES' => $pagenav['total'], 'PM_SENT_TYPE' => $f == 'sentbox' ? $L['Recipient'] : $L['Sender']));
/* === Hook === */
foreach (cot_getextplugins('pm.list.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Ejemplo n.º 25
0
            $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) {
        include $pl;
    }
    /* ===== */
    if ($info) {
        $adminpath[] = array(cot_url('admin', 'm=other&p=trashcan&a=info&id=' . $id), $row['tr_title']);
        $data = unserialize($row['tr_datas']);
        foreach ($data as $key => $val) {
            $tr_t->assign(array('ADMIN_TRASHCAN_INFO_ROW' => htmlspecialchars($key), 'ADMIN_TRASHCAN_INFO_VALUE' => $val));
            $tr_t->parse('MAIN.TRASHCAN_ROW.TRASHCAN_INFOROW');
        }
    }
    $tr_t->parse('MAIN.TRASHCAN_ROW');
}
if ($ii == 0) {
    $tr_t->parse('MAIN.TRASHCAN_EMPTY');
}
$tr_t->assign(array('ADMIN_TRASHCAN_CONF_URL' => cot_url('admin', 'm=config&n=edit&o=plug&p=trashcan'), 'ADMIN_TRASHCAN_WIPEALL_URL' => cot_url('admin', 'm=other&p=trashcan&a=wipeall&' . cot_xg()), 'ADMIN_TRASHCAN_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_TRASHCAN_PAGNAV' => $pagenav['main'], 'ADMIN_TRASHCAN_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_TRASHCAN_TOTALITEMS' => $totalitems, 'ADMIN_TRASHCAN_COUNTER_ROW' => $ii, 'ADMIN_TRASHCAN_PAGESQUEUED' => $pagesqueued));
cot_display_messages($tr_t);
/* === Hook  === */
foreach (cot_getextplugins('trashcan.admin.tags') as $pl) {
    include $pl;
}
/* ===== */
$tr_t->parse('MAIN');
$plugin_body = $tr_t->text('MAIN');
Ejemplo n.º 26
0
function cot_generate_paytags($item_data, $tag_prefix = '')
{
    global $db, $cfg, $L, $Ls, $R, $db_payments, $usr, $sys;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('paytags.first');
        $extp_main = cot_getextplugins('paytags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    if (!is_array($item_data)) {
        $sql = $db->query("SELECT * FROM {$db_payments} WHERE pay_id = '" . (int) $item_data . "' LIMIT 1");
        $item_data = $sql->fetch();
    }
    if ($item_data['pay_id'] > 0 && !empty($item_data['pay_area'])) {
        $temp_array = array('ID' => $item_data['pay_id'], 'USERID' => $item_data['pay_userid'], 'CDATE' => $item_data['pay_cdate'], 'PDATE' => $item_data['pay_pdate'], 'ADATE' => $item_data['pay_adate'], 'AREA' => $item_data['pay_area'], 'CODE' => $item_data['pay_code'], 'DESC' => $item_data['pay_desc'], 'SUMM' => $item_data['pay_summ'], 'TIME' => $item_data['pay_time'], 'STATUS' => $item_data['pay_status']);
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
    }
    $return_array = array();
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Ejemplo n.º 27
0
            cot_redirect(cot_url('page', $page_urlp, '', true, false, true));
        }
        $out['subtitle'] = $L['i18n_editing'];
        $t = new XTemplate(cot_tplfile('i18n.page', 'plug'));
        $t->assign(array('I18N_ACTION' => cot_url('plug', "e=i18n&m=page&a=edit&id={$id}&l={$i18n_locale}"), 'I18N_TITLE' => $L['i18n_editing'], 'I18N_ORIGINAL_LANG' => $i18n_locales[$cfg['defaultlang']], 'I18N_LOCALIZED_LANG' => $i18n_locales[$i18n_locale], 'I18N_PAGE_TITLE' => htmlspecialchars($pag['page_title']), 'I18N_PAGE_DESC' => htmlspecialchars($pag['page_desc']), 'I18N_PAGE_TEXT' => cot_parse($pag['page_text'], $cfg['page']['markup']), 'I18N_IPAGE_TITLE' => htmlspecialchars($pag_i18n['ipage_title']), 'I18N_IPAGE_DESC' => htmlspecialchars($pag_i18n['ipage_desc']), 'I18N_IPAGE_TEXT' => cot_textarea('translate_text', $pag_i18n['ipage_text'], 32, 80, '', 'input_textarea_editor')));
        cot_display_messages($t);
        /* === Hook === */
        foreach (cot_getextplugins('i18n.page.edit.tags') as $pl) {
            include $pl;
        }
        /* =============*/
    } elseif ($a == 'delete' && ($i18n_admin || $usr['id'] == $pag['ipage_translatorid'])) {
        // Send to trashcan if available
        if ($cfg['plugin']['trashcan']['trash_page']) {
            require_once cot_incfile('trashcan', 'plug');
            $row = $db->query("SELECT * FROM {$db_i18n_pages}\n\t\t\t\tWHERE ipage_id = {$id} AND ipage_locale = '{$i18n_locale}'")->fetch();
            cot_trash_put('i18n_page', $L['i18n_translation'] . " #{$id} ({$i18n_locale}) " . $row['ipage_title'], $id, $row);
        }
        $db->delete($db_i18n_pages, "ipage_id = {$id} AND ipage_locale = '{$i18n_locale}'");
        /* === Hook === */
        foreach (cot_getextplugins('i18n.page.delete.done') as $pl) {
            include $pl;
        }
        /* =============*/
        cot_message('Deleted');
        $page_urlp = empty($pag['page_alias']) ? 'c=' . $pag['page_cat'] . "id={$id}" : 'c=' . $pag['page_cat'] . 'al=' . $pag['page_alias'];
        cot_redirect(cot_url('page', $page_urlp, '', true));
    }
} else {
    cot_die(true, true);
}
Ejemplo n.º 28
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');
}
Ejemplo n.º 29
0
        case 'page':
            require_once cot_incfile('page', 'module');
            $pag = $db->query("SELECT * FROM {$db_pages} WHERE page_id=" . $score['ukarma_code'])->fetch();
            $page_url = cot_url('page', 'c=' . $pag['page_cat'] . '&id=' . $score['ukarma_code']);
            $page_title = $pag['page_title'];
            break;
        case 'com':
            require_once cot_incfile('comments', 'plug');
            require_once cot_incfile('page', 'module');
            $pag = $db->query("SELECT c.*, p.* FROM {$db_com} AS c LEFT JOIN {$db_pages} AS p ON c.com_code = p.page_id WHERE c.com_id=" . $score['ukarma_code'] . " AND c.com_area='page'")->fetch();
            $page_url = !empty($pag['page_alias']) ? cot_url('page', 'c=' . $pag['page_cat'] . '&al=' . $pag['page_alias']) . "#c" . $score['ukarma_code'] : cot_url('page', 'c=' . $pag['page_cat'] . '&id=' . $pag['page_id']) . "#c" . $score['ukarma_code'];
            $page_title = $pag['page_title'];
            break;
        default:
            $page_url = cot_url('users', 'm=details&id=' . $score['user_id'] . '&u=' . $score['user_name']);
            $page_title = $score['user_name'];
            break;
    }
    $t->assign(array('UKARMA_ROW_URL' => $page_url, 'UKARMA_ROW_TITLE' => $page_title));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse("MAIN.UKARMA_ROW");
}
/* === Hook === */
foreach (cot_getextplugins('ukarma.statistics.tags') as $pl) {
    include $pl;
}
/* ===== */
Ejemplo n.º 30
0
/* === Hook === */
foreach (cot_getextplugins('users.register.main') as $pl) {
    include $pl;
}
/* ===== */
$out['subtitle'] = $L['aut_registertitle'];
$out['head'] .= $R['code_noindex'];
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$t->assign(array('USERS_REGISTER_TITLE' => $L['aut_registertitle'], 'USERS_REGISTER_SUBTITLE' => $L['aut_registersubtitle'], 'USERS_REGISTER_ADMINEMAIL' => $cot_adminemail, 'USERS_REGISTER_SEND' => cot_url('users', 'm=register&a=add'), 'USERS_REGISTER_USER' => cot_inputbox('text', 'rusername', $ruser['user_name'], array('size' => 24, 'maxlength' => 100)), 'USERS_REGISTER_EMAIL' => cot_inputbox('text', 'ruseremail', $ruser['user_email'], array('size' => 24, 'maxlength' => 64)), 'USERS_REGISTER_PASSWORD' => cot_inputbox('password', 'rpassword1', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_PASSWORDREPEAT' => cot_inputbox('password', 'rpassword2', '', array('size' => 12, 'maxlength' => 32)), 'USERS_REGISTER_COUNTRY' => cot_selectbox_countries($ruser['user_country'], 'rcountry'), 'USERS_REGISTER_TIMEZONE' => cot_selectbox_timezone($ruser['user_timezone'], 'rusertimezone'), 'USERS_REGISTER_GENDER' => cot_selectbox_gender($ruser['user_gender'], 'rusergender'), 'USERS_REGISTER_BIRTHDATE' => cot_selectbox_date(0, 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false)));
// Extra fields
if (!empty(cot::$extrafields[cot::$db->users])) {
    foreach (cot::$extrafields[cot::$db->users] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $ruser['user_' . $exfld['field_name']]);
        $exfld_title = cot_extrafield_title($exfld, 'user_');
        $t->assign(array('USERS_REGISTER_' . $uname => $exfld_val, 'USERS_REGISTER_' . $uname . '_TITLE' => $exfld_title, 'USERS_REGISTER_EXTRAFLD' => $exfld_val, 'USERS_REGISTER_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.EXTRAFLD');
    }
}
/* === Hook === */
foreach (cot_getextplugins('users.register.tags') as $pl) {
    include $pl;
}
/* ===== */
// Error and message handling
cot_display_messages($t);
$t->parse('MAIN');
$t->out('MAIN');
require_once cot::$cfg['system_dir'] . '/footer.php';