Beispiel #1
0
}
$item = $sql->fetch();
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('folio', $item['item_cat'], 'RWA');
cot_block($usr['auth_read']);
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;
}
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 === */
Beispiel #2
0
$sql = $db->query("SELECT * FROM {$db_referers} ORDER BY ref_count DESC LIMIT {$d}, " . $maxperpage);
if ($sql->rowCount() > 0) {
    while ($row = $sql->fetch()) {
        preg_match("#//([^/]+)/#", $row['ref_url'], $a);
        $host = preg_replace('#^www\\.#i', '', $a[1]);
        $referers[$host][$row['ref_url']] = $row['ref_count'];
    }
    $sql->closeCursor();
    $ii = 0;
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('referers.admin.loop');
    /* ===== */
    foreach ($referers as $referer => $url) {
        $tt->assign('ADMIN_REFERERS_REFERER', htmlspecialchars($referer));
        foreach ($url as $uri => $count) {
            $tt->assign(array('ADMIN_REFERERS_URI' => htmlspecialchars(cot_cutstring($uri, 128)), 'ADMIN_REFERERS_COUNT' => $count, 'ADMIN_REFERERS_ODDEVEN' => cot_build_oddeven($ii)));
            /* === Hook - Part2 : Include === */
            foreach ($extp as $pl) {
                include $pl;
            }
            /* ===== */
            $tt->parse('MAIN.REFERERS_ROW.REFERERS_URI');
        }
        $tt->parse('MAIN.REFERERS_ROW');
        $ii++;
    }
    $is_ref_empty = true;
} else {
    $is_ref_empty = false;
}
$tt->assign(array('ADMIN_REFERERS_URL_PRUNE' => cot_url('admin', 'm=other&p=referers&a=prune&' . cot_xg()), 'ADMIN_REFERERS_URL_PRUNELOWHITS' => cot_url('admin', 'm=other&p=referers&a=prunelowhits&' . cot_xg()), 'ADMIN_REFERERS_PAGINATION_PREV' => $pagenav['prev'], 'ADMIN_REFERERS_PAGNAV' => $pagenav['main'], 'ADMIN_REFERERS_PAGINATION_NEXT' => $pagenav['next'], 'ADMIN_REFERERS_TOTALITEMS' => $totalitems, 'ADMIN_REFERERS_ON_PAGE' => $ii));
Beispiel #3
0
/**
 * Imports data for config values from outer world
 *
 * @param string|array $name Name of value or array of names for list of values
 * @param string $source Source type
 * @param string $filter Filter type
 * @param string $defvalue Default value for filtered data
 * @see cot_import()
 * @return mixed Filtered value of array of values
 */
function cot_config_import($name, $source = 'POST', $filter = 'NOC', $defvalue = null)
{
    global $cot_import_filters;
    if (!$name) {
        return null;
    }
    if (!is_array($name)) {
        $name = array($name);
        $single_value = true;
    }
    $res = array();
    foreach ($name as $idx => $var_name) {
        $filter_type = is_array($filter) ? $filter[$var_name] ? $filter[$var_name] : ($filter[$idx] ? $filter[$idx] : 'NOC') : $filter;
        $not_filtered = cot_import($var_name, $source, 'NOC');
        $value = cot_import($var_name, $source, $filter_type);
        // addition filtering by varname
        if (sizeof($cot_import_filters[$var_name])) {
            $value = cot_import($value, 'DIRECT', $var_name);
        }
        // if invalid value is used
        if (is_null($value)) {
            $value_to_show = in_array($filter_type, array('INT', 'NUM', 'TXT', 'ALP')) ? htmlspecialchars(cot_cutstring(strip_tags($not_filtered), 15)) : '';
            list($field_title) = cot_config_titles($var_name);
            $error_msg = cot_rc('adm_invalid_input', array('value' => $value_to_show, 'field_name' => $field_title));
            if (!is_null($defvalue)) {
                $value = !is_array($defvalue) ? $defvalue : (isset($defvalue[$var_name]) ? $defvalue[$var_name] : (isset($defvalue[$idx]) ? $defvalue[$idx] : null));
                $error_msg .= $value_to_show ? '. ' . cot_rc('adm_set_default', htmlspecialchars(strip_tags($value))) : '';
            }
            cot_message($error_msg, 'error', $var_name);
        }
        $res[$var_name] = $value;
    }
    return $single_value ? $value : $res;
}
Beispiel #4
0
        $info['available'] = '?';
    }
    $t->assign(array('ADMIN_CACHE_MEMORY_DRIVER' => str_replace('_driver', '', $cache->mem_driver), 'ADMIN_CACHE_MEMORY_PERCENTBAR' => ceil($info['occupied'] / $info['max'] * 100), 'ADMIN_CACHE_MEMORY_AVAILABLE' => $info['available'], 'ADMIN_CACHE_MEMORY_MAX' => $info['max']));
    $t->parse('MAIN.ADMIN_CACHE_MEMORY');
}
$sql = $db->query("SELECT * FROM {$db_cache} WHERE 1 ORDER by c_name ASC");
$cachesize = 0;
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.cache.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    $row['c_value'] = htmlspecialchars($row['c_value']);
    $row['size'] = mb_strlen($row['c_value']);
    $cachesize += $row['size'];
    $t->assign(array('ADMIN_CACHE_ITEM_DEL_URL' => cot_url('admin', 'm=cache&a=delete&name=' . $row['c_name'] . '&' . cot_xg()), 'ADMIN_CACHE_ITEM_NAME' => $row['c_name'], 'ADMIN_CACHE_EXPIRE' => $row['c_expire'] > 0 ? cot_date('datetime_short', $row['c_expire']) : '-', 'ADMIN_CACHE_SIZE' => $row['size'], 'ADMIN_CACHE_VALUE' => $a == 'showall' ? $row['c_value'] : cot_cutstring($row['c_value'], 80), 'ADMIN_CACHE_ROW_ODDEVEN' => cot_build_oddeven($ii)));
    /* === Hook - Part2 : Include === */
    foreach ($extp as $pl) {
        include $pl;
    }
    /* ===== */
    $t->parse('MAIN.ADMIN_CACHE_ROW');
    $ii++;
}
$t->assign(array('ADMIN_CACHE_URL_REFRESH' => cot_url('admin', 'm=cache'), 'ADMIN_CACHE_URL_PURGE' => cot_url('admin', 'm=cache&a=purge&' . cot_xg()), 'ADMIN_CACHE_URL_SHOWALL' => cot_url('admin', 'm=cache&a=showall'), 'ADMIN_CACHE_CACHESIZE' => $cachesize));
cot_display_messages($t);
/* === Hook  === */
foreach (cot_getextplugins('admin.cache.tags') as $pl) {
    include $pl;
}
/* ===== */
Beispiel #5
0
/**
 * Returns link for URL
 *
 * @param string $text URL
 * @param int $maxlen Max. allowed length
 * @return unknown
 */
function cot_build_url($text, $maxlen = 64)
{
    if (!empty($text)) {
        if (mb_strpos($text, 'http://') !== 0) {
            $text = 'http://' . $text;
        }
        $text = htmlspecialchars($text);
        $text = cot_rc_link($text, cot_cutstring($text, $maxlen));
    }
    return $text;
}
Beispiel #6
0
}
$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':
            $row['com_url'] = cot_url('page', "c=" . $row['page_cat'] . "&id=" . $row['com_code'], "#c" . $row['com_id']);
            break;
        case 'weblogs':
            $row['com_url'] = cot_url('plug', 'e=weblogs&m=page&id=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        case 'gal':
            $row['com_url'] = cot_url('plug', 'e=gal&pic=' . $row['com_value'], '#c' . $row['com_id']);
            break;
        case 'users':
            $row['com_url'] = cot_url('users', 'm=details&id=' . $row['com_value'], '#c' . $row['com_id']);
            break;
Beispiel #7
0
    /* === Hook - Part1 : Set === */
    $extp = cot_getextplugins('pfs.rowcat.loop');
    /* ===== */
    $sql_pfs_folders = $db->query("SELECT * FROM {$db_pfs_folders} WHERE pff_userid={$userid} ORDER BY pff_isgallery ASC, pff_title ASC LIMIT {$df}, " . $cfg['pfs']['maxpfsperpage']);
    foreach ($sql_pfs_folders->fetchAll() as $row_pff) {
        $pff_id = $row_pff['pff_id'];
        $pff_title = $row_pff['pff_title'];
        $pff_updated = $row_pff['pff_updated'];
        $pff_desc = $row_pff['pff_desc'];
        $pff_ispublic = $row_pff['pff_ispublic'];
        $pff_isgallery = $row_pff['pff_isgallery'];
        $pff_count = $row_pff['pff_count'];
        $pff_fcount = (int) $pff_filescount[$pff_id];
        $pff_fsize = (int) $pff_filessize[$pff_id];
        $icon_f = $pff_isgallery ? $R['pfs_icon_gallery'] : $R['pfs_icon_folder'];
        $t->assign(array('PFF_ROW_ID' => $pff_id, 'PFF_ROW_TITLE' => $pff_title, 'PFF_ROW_COUNT' => $pff_count, 'PFF_ROW_FCOUNT' => $pff_fcount, 'PFF_ROW_FSIZE' => cot_build_filesize($pff_fsize, 1), 'PFF_ROW_FSIZE_BYTES' => $pff_fsize, 'PFF_ROW_DELETE_URL' => cot_confirm_url(cot_url('pfs', 'a=deletefolder&' . cot_xg() . '&id=' . $pff_id . '&' . $more), 'pfs', 'pfs_confirm_delete_folder'), 'PFF_ROW_EDIT_URL' => cot_url('pfs', "m=editfolder&f=" . $pff_id . '&' . $more), 'PFF_ROW_URL' => cot_url('pfs', 'f=' . $pff_id . '&' . $more), 'PFF_ROW_ICON' => $icon_f, 'PFF_ROW_UPDATED' => cot_date('datetime_medium', $row_pff['pff_updated']), 'PFF_ROW_UPDATED_STAMP' => $row_pff['pff_updated'], 'PFF_ROW_ISPUBLIC' => $cot_yesno[$pff_ispublic], 'PFF_ROW_DESC' => cot_cutstring($pff_desc, 32)));
        /* === Hook - Part2 : Include === */
        foreach ($extp as $pl) {
            include $pl;
        }
        /* ===== */
        $t->parse('MAIN.PFF_ROW');
        $iki++;
        $subfiles_count_on_page += $pff_fcount;
    }
    $sql_pfs_folders->closeCursor();
}
/* === Hook === */
foreach (cot_getextplugins('pfs.list.query') as $pl) {
    include $pl;
}
/**
 * Returns all section tags for coTemplate
 *
 * @param string $cat Forums structure cat code
 * @param string $tag_prefix Prefix for tags
 * @param array $stat Category statistics
 *
 * @return array
 */
function cot_generate_sectiontags($cat, $tag_prefix = '', $stat = NULL)
{
    global $cfg, $structure, $cot_extrafields, $usr, $sys, $L, $db_structure;
    $stat['fs_lt_date'] = !empty($stat['fs_lt_date']) ? $stat['fs_lt_date'] : 0;
    $stat['fs_lt_posterid'] = !empty($stat['fs_lt_posterid']) ? $stat['fs_lt_posterid'] : 0;
    $usr['lastvisit'] = !empty($usr['lastvisit']) ? $usr['lastvisit'] : 0;
    $new_elems = $usr['id'] > 0 && $stat['fs_lt_date'] > $usr['lastvisit'] && $stat['fs_lt_posterid'] != $usr['id'];
    $sections = array($tag_prefix . 'CAT' => $cat, $tag_prefix . 'LOCKED' => $structure['forums'][$cat]['locked'], $tag_prefix . 'TITLE' => $structure['forums'][$cat]['title'], $tag_prefix . 'DESC' => cot_parse_autourls($structure['forums'][$cat]['desc']) . ($structure['forums'][$cat]['locked'] ? ' ' . $L['Locked'] : ''), $tag_prefix . 'ICON' => empty($structure['forums'][$cat]['icon']) ? '' : cot_rc('img_structure_cat', array('icon' => $structure['forums'][$cat]['icon'], 'title' => htmlspecialchars($structure['forums'][$cat]['title']), 'desc' => htmlspecialchars($structure['forums'][$cat]['desc']))), $tag_prefix . 'URL' => cot_url('forums', 'm=topics&s=' . $cat), $tag_prefix . 'SECTIONSURL' => cot_url('forums', 'c=' . $cat), $tag_prefix . 'NEWPOSTS' => $new_elems, $tag_prefix . 'CAT_DEFSTATE' => htmlspecialchars($cfg['forums']['cat_' . $cat]['defstate']));
    if (is_array($stat)) {
        if ($stat['fs_lt_date'] > 0) {
            $sections += array($tag_prefix . 'LASTPOSTDATE' => cot_date('datetime_short', $stat['fs_lt_date']), $tag_prefix . 'LASTPOSTER' => cot_build_user($stat['fs_lt_posterid'], htmlspecialchars($stat['fs_lt_postername'])), $tag_prefix . 'LASTPOST' => cot_rc_link($new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), cot_cutstring($stat['fs_lt_title'], 32)), $tag_prefix . 'LASTPOST_URL' => $new_elems ? cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=unread', '#unread') : cot_url('forums', 'm=posts&q=' . $stat['fs_lt_id'] . '&n=last', '#bottom'), $tag_prefix . 'TIMEAGO' => cot_build_timegap($stat['fs_lt_date'], $sys['now']));
        }
        $sections += array($tag_prefix . 'TOPICCOUNT' => $stat['topiccount'], $tag_prefix . 'LASTPOSTDATE_STAMP' => $stat['fs_lt_date'], $tag_prefix . 'POSTCOUNT' => $stat['postcount'], $tag_prefix . 'VIEWCOUNT' => $stat['viewcount'], $tag_prefix . 'VIEWCOUNT_SHORT' => $stat['viewcount'] > 9999 ? floor($stat['viewcount'] / 1000) . 'k' : $stat['viewcount']);
    }
    if (!is_array($stat) || !$stat['fs_lt_date']) {
        $sections[$tag_prefix . 'LASTPOSTDATE'] = '';
        $sections[$tag_prefix . 'LASTPOSTER'] = '';
        $sections[$tag_prefix . 'LASTPOST'] = '';
        $sections[$tag_prefix . 'TIMEAGO'] = '';
        $sections[$tag_prefix . 'TOPICCOUNT'] = 0;
        $sections[$tag_prefix . 'POSTCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT'] = 0;
        $sections[$tag_prefix . 'VIEWCOUNT_SHORT'] = 0;
    }
    foreach ($cot_extrafields[$db_structure] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $sections[$tag_prefix . $uname . '_TITLE'] = isset($L['structure_' . $exfld['field_name'] . '_title']) ? $L['structure_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
        $sections[$tag_prefix . $uname] = cot_build_extrafields_data('structure', $exfld, $structure['forums'][$cat][$exfld['field_name']]);
        $sections[$tag_prefix . $uname . '_VALUE'] = $structure['forums'][$cat][$exfld['field_name']];
    }
    return $sections;
}
Beispiel #9
0
/* === Hook === */
foreach (cot_getextplugins('users.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($localskin);
require_once cot_incfile('forms');
$countryfilters_titles = array();
$countryfilters_values = array();
$countryfilters_titles[] = $R['users_sel_def_l'] . $L['Country'] . $R['users_sel_def_r'];
$countryfilters_values[] = cot_url('users');
$countryfilters_titles[] = $L['Not_indicated'];
$countryfilters_values[] = cot_url('users', 'f=country_00');
foreach ($cot_countries as $i => $x) {
    $countryfilters_titles[] = cot_cutstring($x, 23);
    $countryfilters_values[] = cot_url('users', 'f=country_' . $i);
}
$countryfilters = cot_selectbox(cot_url('users', 'f=' . $f), 'bycountry', $countryfilters_values, $countryfilters_titles, false, array('onchange' => 'redirect(this)'), '', true);
$grpfilters_titles = array($R['users_sel_def_l'] . $L['Maingroup'] . $R['users_sel_def_r']);
$grpfilters_group_values = array(cot_url('users'));
$grpfilters_maingrp_values = array(cot_url('users'));
foreach ($cot_groups as $k => $i) {
    if ($cot_groups[$k]['id'] != COT_GROUP_GUESTS) {
        $grpfilters_titles[] = $cot_groups[$k]['name'];
        $grpfilters_maingrp_values[] = cot_url('users', 'g=' . $k, '', true);
        $grpfilters_group_values[] = cot_url('users', 'gm=' . $k, '', true);
    }
}
$maingrpfilters = cot_selectbox(cot_url('users', 'g=' . $g, '', true), 'bymaingroup', $grpfilters_maingrp_values, $grpfilters_titles, false, array('onchange' => 'redirect(this)'), '', true);
$grpfilters_titles[0] = $R['users_sel_def_l'] . $L['Group'] . $R['users_sel_def_r'];
Beispiel #10
0
         break;
     }
     if ($usr['id'] == $row['user_id']) {
         $popup_body .= karma_error('karma_ms_error', $L['no_self']);
         break;
     }
     if ($lct == "frm") {
         $post_text = cot_parse($row['fp_text']);
     }
     if ($lct == "pg") {
         $post_text = $row['page_title'];
     }
     if ($lct == "com") {
         $post_text = cot_parse($row['com_text']);
     }
     $kr->assign(array("KARMA_BAL" => cot_declension($ex_value, $L['bal_karma']), "KARMA_ACT" => $do, "KARMA_USER" => "<a href=\"" . cot_url('users', 'm=details&amp;id=' . $row['user_id']) . "\" target=\"_blank\" >" . $row['user_name'] . "</a>", "KARMA_LCT" => $lct == "ud" ? false : true, "KARMA_POST" => cot_cutstring($post_text, 200), "KARMA_POST_LCT" => $L['do_' . $lct], "KARMA_FORM_URL" => cot_url('plug', 'r=karma&act=dochange&fp=' . $fp), "KARMA_FORM_URL_AJAX" => "id='karma_box_form' onSubmit=\"return  ajaxSend({ method: 'POST', formId: 'karma_box_form', url: '" . cot_url('plug', 'r=karma&act=dochange&fp=' . $fp) . "', divId: 'karma_mess', errMsg: '" . $L['ajaxSenderror'] . "' });\"", "KARMA_VAL" => $value, "KARMA_U_ID" => $row['user_id'], "KARMA_LOCATION" => $lct, "KARMA_MOD" => $mod));
     if ($cfg['plugin']['karma']['karma_profile']) {
         $kr->assign(cot_generate_usertags($row, "KARMA_USER_PROFILE_"));
     }
     $kr->parse("MAIN.CHANGE");
     $kr->parse("MAIN");
     $popup_body .= $kr->text("MAIN");
     break;
 case 'dochange':
     $reason = cot_import('reason', 'P', 'TXT');
     $recipient = cot_import('recipient', 'P', 'INT') ? cot_import('recipient', 'P', 'INT') : cot_diefatal($L['no_recipient']);
     if ($value == "add") {
         $value = $ex_value;
     } elseif ($value == "del") {
         $value = $ex_value * -1;
     } else {