コード例 #1
0
function cot_ukarma($userid, $area = 'users', $code = '', $onlyscore = false)
{
    global $db, $cfg, $db_ukarma, $db_users;
    if ($area == 'users' && $db->fieldExists($db_users, "user_ukarma")) {
        $score = $db->query("SELECT user_ukarma FROM {$db_users} WHERE user_id=" . $userid)->fetchColumn();
    } else {
        $where['ukarma_userid'] = "ukarma_userid=" . $userid;
        if (!empty($area) && $area != 'users') {
            $where['ukarma_area'] = "ukarma_area='" . $area . "'";
        }
        if (!empty($code)) {
            $where['ukarma_code'] = "ukarma_code='" . $code . "'";
        }
        $where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
        $score = $db->query("SELECT SUM(ukarma_value) FROM {$db_ukarma} {$where}")->fetchColumn();
    }
    if ($onlyscore) {
        return !empty($score) ? $score : 0;
    }
    if ($score > 0) {
        $sign = '+';
    } elseif ($score < 0) {
        $sign = '-';
    }
    $t = new XTemplate(cot_tplfile(array('ukarma', $area), 'plug'));
    $t->assign(cot_generate_usertags($userid, 'UKARMA_USER_'));
    $t->assign(array('UKARMA_AREA' => $area, 'UKARMA_CODE' => $code, 'UKARMA_SELECTOR' => 'ukarma_' . $userid . $area . $code, 'UKARMA_SCOREENABLED' => cot_ukarma_checkenablescore($userid, $area, $code), 'UKARMA_SCORE' => !empty($score) ? $score : 0, 'UKARMA_SCORE_ABS' => !empty($score) ? abs($score) : 0, 'UKARMA_SIGN' => $sign));
    $t->parse('MAIN');
    return $t->text('MAIN');
}
コード例 #2
0
ファイル: Rss.php プロジェクト: ASDAFF/advboard
 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;
 }
コード例 #3
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');
}
コード例 #4
0
ファイル: share.functions.php プロジェクト: Roffun/share
function share()
{
    global $cfg;
    if ($cfg['jquery']) {
        $t = new XTemplate(cot_tplfile('share', 'plug'));
        if ($cfg['plugin']['share']['sh_counter']) {
            $t->assign(array('SHARE_GP_COUNTER' => '<q data-counter="gp"></q>', 'SHARE_VK_COUNTER' => '<q data-counter="vk"></q>', 'SHARE_FB_COUNTER' => '<q data-counter="fb"></q>', 'SHARE_MR_COUNTER' => '<q data-counter="mr"></q>', 'SHARE_LI_COUNTER' => '<q data-counter="li"></q>', 'SHARE_OK_COUNTER' => '<q data-counter="ok"></q>', 'SHARE_TM_COUNTER' => '<q data-counter="tm"></q>', 'SHARE_PT_COUNTER' => '<q data-counter="pt"></q>', 'SHARE_RD_COUNTER' => '<q data-counter="rd"></q>', 'SHARE_SU_COUNTER' => '<q data-counter="su"></q>', 'SHARE_PO_COUNTER' => '<q data-counter="po"></q>', 'SHARE_BF_COUNTER' => '<q data-counter="bf"></q>', 'SHARE_XI_COUNTER' => '<q data-counter="xi"></q>'));
        }
        $t->assign(array('SHARE_MESSAGERS' => $cfg['plugin']['share']['sh_messagers'], 'SHARE_SIZE' => 'sh-' . $cfg['plugin']['share']['sh_size']));
        $t->parse('MAIN');
        return $t->text('MAIN');
    }
}
コード例 #5
0
function cot_get_topusers($maingrp, $count, $sqlsearch = '', $tpl = 'index')
{
    global $L, $cfg, $db, $db_users;
    $t1 = new XTemplate(cot_tplfile(array('userpoints', $tpl), 'plug'));
    $sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : '';
    $topusers = $db->query("SELECT * FROM {$db_users}\n\t\tWHERE user_userpoints>0 AND user_maingrp=" . $maingrp . " {$sqlsearch} ORDER BY user_userpoints DESC LIMIT " . $count)->fetchAll();
    foreach ($topusers as $tur) {
        $t1->assign(cot_generate_usertags($tur, 'TOP_ROW_'));
        $t1->parse('MAIN.TOP_ROW');
    }
    $t1->parse('MAIN');
    return $t1->text('MAIN');
}
コード例 #6
0
function karma_gadget($user_id, $user_karma, $location, $location_id, $module = false)
{
    global $usr, $cfg, $karma_cache, $color;
    $color = explode(",", $cfg['plugin']['karma']['karma_color']);
    if (!$karma_cache[$user_id]) {
        $negative = !$cfg['plugin']['karma']['neg_rec'] && $usr['profile']['user_karma'] < 0 ? false : true;
        $k_add = cot_auth('plug', 'karma', 'W') && $usr['id'] > 0 && $location != 'self' ? true : "";
        $karmat = new XTemplate(cot_tplfile(array('karma', 'gadget'), true));
        $module = urlencode($module);
        $karmat->assign(array("PAGE_KARMA_D" => number_format($user_karma, '1', '.', ' '), "PAGE_KARMA_ADD" => $user_id != $usr['id'] && $k_add ? cot_url('plug', 'r=karma&act=change&lct=' . $location . '&value=add&fp=' . $location_id . '&mod=' . $module) : false, "PAGE_KARMA_DEL" => $user_id != $usr['id'] && $negative && $k_add ? cot_url('plug', 'r=karma&act=change&lct=' . $location . '&value=del&fp=' . $location_id . '&mod=' . $module) : false, "PAGE_KARMA_URL" => $k_add || $location == 'self' ? cot_url('plug', 'r=karma&act=show&fp=' . $user_id) : false, "PAGE_KARMA_MINI" => $cfg['plugin']['karma']['karma_com'] ? '' : 'karma_mini'));
        $karmat->parse('MAIN');
        $karma_cache[$user_id] = $karmat->text('MAIN');
    }
    return $karma_cache[$user_id];
}
コード例 #7
0
function form_structure_new($parentid = '')
{
    global $cot_structure, $cot_extrafields, $db_structure, $structure, $L, $R;
    $t = new XTemplate(cot_tplfile('cateditor.admin.new', 'plug'));
    $t->assign(array('ADMIN_STRUCTURE_URL_FORM_ADD' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=add'), 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode', null, 'size="16"'), 'ADMIN_STRUCTURE_PARENT' => $cot_structure->select($parentid, 'rstructureparent'), '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_TPL' => cot_inputbox('text', 'rstructuretpl', null, 'size="10" maxlength="255"')));
    // 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.EXTRAFLD');
    }
    $t->parse('MAIN');
    return $t->text('MAIN');
}
コード例 #8
0
function cot_get_paytop($area = '', $count = 0, $order = "s.service_id DESC")
{
    global $db, $cfg, $sys, $db_payments_services, $db_users;
    $pt_cfg = cot_cfg_paytop();
    if ($count == 0) {
        $count = $pt_cfg[$area]['count'];
    }
    if (empty($area) && !isset($pt_cfg[$area]['cost'])) {
        return false;
    }
    $t1 = new XTemplate(cot_tplfile(array('paytop', 'list', $area), 'plug'));
    $paytopcount = $db->query("SELECT COUNT(*) FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'])->fetchColumn();
    $paytops = $db->query("SELECT * FROM {$db_payments_services} as s\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=s.service_userid\n\t\tWHERE u.user_id>0 AND s.service_area='paytop." . $db->prep($area) . "' AND service_expire > " . $sys['now'] . " ORDER BY {$order} LIMIT " . $count)->fetchAll();
    $jj = 0;
    foreach ($paytops as $tur) {
        $jj++;
        $t1->assign(cot_generate_usertags($tur, 'TOP_ROW_'));
        $t1->assign(array('TOP_ROW_JJ' => $jj, 'TOP_ROW_EXPIRE' => $tur['service_expire']));
        $t1->parse('MAIN.TOP_ROW');
    }
    $t1->assign(array('PAYTOP_BUY_URL' => cot_url('plug', 'e=paytop&area=' . $area), 'PAYTOP_COUNT' => $paytopcount));
    $t1->parse('MAIN');
    return $t1->text('MAIN');
}
コード例 #9
0
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=tools
 * [END_COT_EXT]
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('paytop', 'plug');
$pt_cfg = cot_cfg_paytop();
$t = new XTemplate(cot_tplfile('paytop.admin', 'plug', true));
$id = cot_import('id', 'G', 'INT');
if ($a == 'add') {
    $username = cot_import('username', 'P', 'TXT', 100, TRUE);
    $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;
コード例 #10
0
            $rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', 'id=' . $id, '', true)));
            cot_mail($item['user_email'], $L['project_added_mail_subj'], $rbody);
        }
    }
    $db->update($db_projects, $prj, "item_id=" . (int) $id);
    cot_projects_sync($item['item_cat']);
    /* === Hook === */
    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'])));
コード例 #11
0
ファイル: folio.main.php プロジェクト: ASDAFF/cot-freelance
    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 === */
foreach (cot_getextplugins('folio.tags') as $pl) {
    include $pl;
}
/* ===== */
if ($usr['isadmin']) {
    $t->parse('MAIN.PRD_ADMIN');
コード例 #12
0
ファイル: users.register.php プロジェクト: Roffun/Cotonti
                }
                /* ===== */
                cot_redirect(cot_url('message', 'msg=109', '', true));
            }
        } elseif ($row['user_maingrp'] == -1) {
            $sql = $db->update($db_users, array('user_maingrp' => $row['user_sid']), "user_id='" . $row['user_id'] . "' AND user_lostpass='******'");
            cot_redirect(cot_url('message', 'msg=106', '', true));
        }
    } else {
        $env['status'] = '403 Forbidden';
        cot_shield_update(7, "Account validation");
        cot_log("Wrong validation URL", 'sec');
        cot_redirect(cot_url('message', 'msg=157', '', true));
    }
}
$mskin = cot_tplfile('users.register', 'module');
/* === 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']);
コード例 #13
0
/**
 * Generates Poll form
 *
 * @param int $id Poll ID or Poll Code if $type is not epmty
 * @param string $formlink Poll form url
 * @param string $theme Poll template name
 * @param string $type Poll type
 * @return array
 * @global CotDB $db
 */
function cot_poll_form($id, $formlink = '', $theme = '', $type = '')
{
    global $db, $cfg, $db_polls, $db_polls_options, $db_polls_voters, $usr;
    $canvote = false;
    if (!is_array($id)) {
        $id = (int) $id;
        $where = !$type ? "poll_id = {$id}" : "poll_type = '" . $db->prep($type) . "' AND poll_code = '{$id}'";
        $sql = $db->query("SELECT * FROM {$db_polls} WHERE {$where} LIMIT 1");
        if (!($row = $sql->fetch())) {
            return false;
        }
    } else {
        $row = $id;
    }
    $id = $row['poll_id'];
    $alreadyvoted = 0;
    if ($cfg['polls']['ip_id_polls'] == 'id' && $usr['id'] > 0) {
        $where = "pv_userid = '" . $usr['id'] . "'";
        $canvote = true;
    } else {
        $where = $usr['id'] > 0 ? "(pv_userid = '" . $usr['id'] . "' OR pv_userip = '" . $usr['ip'] . "')" : "pv_userip = '" . $usr['ip'] . "'";
        $canvote = true;
    }
    $sql2 = $db->query("SELECT pv_id FROM {$db_polls_voters} WHERE pv_pollid = {$id} AND {$where} LIMIT 1");
    $alreadyvoted = $sql2->rowCount() == 1 ? 1 : 0;
    $themefile = cot_tplfile(array('polls', $theme), 'module');
    $t = new XTemplate($themefile);
    if ($alreadyvoted) {
        $poll_block = 'POLL_VIEW_VOTED';
    } elseif (!$canvote) {
        $poll_block = 'POLL_VIEW_DISABLED';
    } elseif ($row['poll_state']) {
        $poll_block = 'POLL_VIEW_LOCKED';
    } else {
        $poll_block = 'POLL_VIEW';
    }
    $sql2 = $db->query("SELECT SUM(po_count) FROM {$db_polls_options} WHERE po_pollid = {$id}");
    $totalvotes = $sql2->fetchColumn();
    $sql1 = $db->query("SELECT po_id, po_text, po_count FROM {$db_polls_options} WHERE po_pollid = {$id} ORDER by po_id ASC");
    while ($row1 = $sql1->fetch()) {
        $po_id = $row1['po_id'];
        $po_count = $row1['po_count'];
        $percent = @round(100 * ($po_count / $totalvotes), 1);
        $input_type = $row['poll_multiple'] ? 'checkbox' : 'radio';
        $polloptions_input = $alreadyvoted || !$canvote ? "" : '<input type="' . $input_type . '" name="vote[]" value="' . $po_id . '" />&nbsp;';
        // TODO - to resorses
        $polloptions = cot_parse($row1['po_text'], $cfg['polls']['markup']);
        $t->assign(array('POLL_OPTIONS' => $polloptions, 'POLL_PER' => $percent, 'POLL_COUNT' => $po_count, 'POLL_INPUT' => $polloptions_input));
        $t->parse($poll_block . ".POLLTABLE");
    }
    $sql1->closeCursor();
    $t->assign(array('POLL_VOTERS' => $totalvotes, 'POLL_SINCE' => cot_date('datetime_medium', $row['poll_creationdate']), 'POLL_SINCE_STAMP' => $row['poll_creationdate'], 'POLL_SINCE_SHORT' => cot_date('date_short', $row['poll_creationdate']), 'POLL_TITLE' => cot_parse($row['poll_text'], $cfg['polls']['markup']), 'POLL_ID' => $id, 'POLL_FORM_URL' => empty($formlink) ? cot_url('polls', 'id=' . $id) : $formlink, 'POLL_FORM_BUTTON' => $pollbutton));
    $t->parse($poll_block);
    $row['poll_alreadyvoted'] = $alreadyvoted;
    $row['poll_count'] = $totalvotes;
    $row['poll_block'] = $t->text($poll_block);
    return $row;
}
コード例 #14
0
ファイル: news.admin.php プロジェクト: Andreyjktl/Cotonti
/* ====================
[BEGIN_COT_EXT]
Hooks=admin.config.edit.loop
[END_COT_EXT]
==================== */
/**
 * news admin usability modification
 *
 * @package News
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('page', 'module');
if ($p == 'news' && $row['config_name'] == 'category' && $cfg['jquery']) {
    $sskin = cot_tplfile('news.admin', 'plug', true);
    $tt = new XTemplate($sskin);
    $categories = explode(',', $row['config_value']);
    $jj = 0;
    foreach ($categories as $k => $v) {
        $v = explode('|', trim($v));
        if (isset($structure['page'][$v[0]])) {
            $jj++;
            $tt->assign(array('ADDNUM' => $jj, 'ADDCATEGORY' => $v[0], 'ADDCOUNT' => (int) $v[1] > 0 ? $v[1] : $cfg['plugin']['news']['maxpages'], 'ADDCUT' => (int) $v[2] > 0 ? $v[2] : ''));
            $tt->parse('MAIN.ADDITIONAL');
        }
    }
    if ($jj == 0) {
        $tt->assign(array('ADDNUM' => 1, 'ADDCATEGORY' => '', 'ADDCOUNT' => $cfg['plugin']['news']['maxpages'], 'ADDCUT' => ''));
        $tt->parse('MAIN.ADDITIONAL');
    }
コード例 #15
0
            $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
            $rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
            cot_mail($offer['user_email'], $rsubject, $rbody);
        }
        cot_message($L['offers_add_post'], 'ok');
        /* === Hook === */
        foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
    cot_redirect(cot_url('projects', 'id=' . $id, '', true));
    exit;
}
$t_o = new XTemplate(cot_tplfile(array('projects', 'offers', $structure['projects'][$item['item_cat']]['tpl'])));
// Вычисление выбранного исполнителя по проекту
if ($item['item_performer']) {
    $t_o->assign(cot_generate_usertags($item['item_performer'], 'PRJ_PERFORMER_'));
}
$where = array();
$order = array();
// Показать не автору только видимые проедложения:
if ($usr['id'] != $item['item_userid'] && !$usr['isadmin']) {
    $where['forshow'] = "(o.offer_hidden!=1 OR o.offer_userid=" . $usr['id'] . ")";
}
// ==================================================
$where['pid'] = "o.offer_pid=" . $id;
$order['date'] = "o.offer_date DESC";
$query_limit = $cfg['projects']['offersperpage'] > 0 ? "LIMIT {$d}, " . $cfg['projects']['offersperpage'] : '';
/* === Hook === */
コード例 #16
0
ファイル: message.php プロジェクト: Andreyjktl/Cotonti
    if (mb_strpos($ru, '://') === false) {
        $ru = COT_ABSOLUTE_URL . ltrim($ru, '/');
    }
    $out['head'] .= cot_rc('msg_code_redir_head', array('delay' => $rd, 'url' => $ru));
    $body .= $R['code_error_separator'] . $L['msgredir'];
}
/* === Hook === */
foreach (cot_getextplugins('message.main') as $pl) {
    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');
}
コード例 #17
0
ファイル: admin.infos.php プロジェクト: Andreyjktl/Cotonti
<?php

/**
 * 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');
コード例 #18
0
 * @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['isadmin']);
require_once cot_incfile('extrafields');
require_once cot_incfile('structure');
$id = cot_import('id', 'G', 'INT');
$al = cot_import('al', 'G', 'ALP');
$c = cot_import('c', 'G', 'TXT');
$v = cot_import('v', 'G', 'TXT');
$maxrowsperpage = is_int($cfg['maxrowsperpage']) && $cfg['maxrowsperpage'] > 0 || ctype_digit($cfg['maxrowsperpage']) ? $cfg['maxrowsperpage'] : 15;
list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
$mode = cot_import('mode', 'G', 'ALP');
$t = new XTemplate(cot_tplfile(array('admin', 'structure', $n), 'core'));
$adminsubtitle = $L['Structure'];
$modules_structure =& $extension_structure;
// for compatibility
/* === Hook === */
foreach (cot_getextplugins('admin.structure.first') as $pl) {
    include $pl;
}
/* ===== */
if (empty($n)) {
    $adminpath[] = array(cot_url('admin', 'm=structure'), $L['Structure']);
    // Show available module list
    if (is_array($extension_structure) && count($extension_structure) == 1 && (cot_plugin_active($extension_structure[0]) || cot_module_active($extension_structure[0]))) {
        cot_redirect(cot_url('admin', 'm=structure&n=' . $extension_structure[0], '', true));
    }
    if (is_array($extension_structure) && count($extension_structure) > 0) {
コード例 #19
0
ファイル: contact.tools.php プロジェクト: Roffun/Cotonti
        cot_message('Deleted');
    }
} elseif ($a == 'val') {
    $db->update($db_contact, array('contact_val' => 1), "contact_id = {$id}");
    cot_message('Updated');
} elseif ($a == 'unval') {
    $db->update($db_contact, array('contact_val' => 0), "contact_id = {$id}");
    cot_message('Updated');
} elseif ($a == 'send' && $rtext != '') {
    $row = $db->query("SELECT contact_email FROM {$db_contact} WHERE contact_id = {$id}")->fetch();
    cot_mail($row['contact_email'], $cfg['mainurl'], $rtext);
    $db->update($db_contact, array('contact_reply' => $rtext), "contact_id = {$id}");
    cot_message('Done');
}
$adminsubtitle = $L['contact_title'];
$tuman = new XTemplate(cot_tplfile('contact.tools', 'plug', true));
$totallines = $db->query("SELECT COUNT(*) FROM {$db_contact}")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_contact} ORDER BY contact_val ASC, contact_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagnav = cot_pagenav('admin', 'm=other&p=contact', $d, $totallines, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$i = 0;
foreach ($sql->fetchAll() as $row) {
    $i++;
    $shorttext = $row['contact_text'];
    $shorttext = cot_string_truncate($shorttext, 150);
    $shorttext .= '...';
    $val = $row['contact_val'] == 1 ? 'unval' : 'val';
    $urlParams = array('m' => 'other', 'p' => 'contact');
    $tmp = $urlParams;
    $tmp['id'] = $row['contact_id'];
    if ($durl > 0) {
        $tmp['d'] = $durl;
コード例 #20
0
function cot_getmarketlist($template = 'index', $count = 5, $sqlsearch = '', $order = "item_date DESC")
{
    global $db, $db_market, $cfg, $db_users;
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('market', 'any', 'RWA');
    $t = new XTemplate(cot_tplfile(array('market', $template), 'module'));
    $sqlsearch = !empty($sqlsearch) ? " AND " . $sqlsearch : '';
    $sqllist = $db->query("SELECT * FROM {$db_market} AS p LEFT JOIN {$db_users} AS u ON u.user_id=p.item_userid\n\tWHERE item_state=0 {$sqlsearch} ORDER BY {$order} LIMIT " . (int) $count);
    $sqllist_rowset = $sqllist->fetchAll();
    $sqllist_idset = array();
    foreach ($sqllist_rowset as $item) {
        $sqllist_idset[$item['item_id']] = $item['item_alias'];
    }
    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)));
        $t->parse("MARKET.PRD_ROWS");
    }
    $t->parse("MARKET");
    return $t->text("MARKET");
}
コード例 #21
0
<?php

/**
 * Administration panel - Configuration
 *
 * @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['isadmin']);
require_once cot_incfile('configuration');
$adminsubtitle = $L['Configuration'];
$t = new XTemplate(cot_tplfile('admin.config', 'core'));
/* === Hook === */
foreach (cot_getextplugins('admin.config.first') as $pl) {
    include $pl;
}
/* ===== */
switch ($n) {
    case 'edit':
        $o = cot_import('o', 'G', 'ALP');
        $p = cot_import('p', 'G', 'ALP');
        $v = cot_import('v', 'G', 'ALP');
        $o = empty($o) ? 'core' : $o;
        $p = empty($p) ? 'global' : $p;
        $optionslist = cot_config_list($o, $p, '');
        cot_die(!sizeof($optionslist), true);
        if ($o != 'core' && file_exists(cot_langfile($p, $o))) {
            require cot_langfile($p, $o);
コード例 #22
0
ファイル: install.install.php プロジェクト: Newman101/Cotonti
<?php

/**
 * @package Install
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
// Modules and plugins checked by default
$default_modules = array('index', 'page', 'users', 'rss');
$default_plugins = array('ckeditor', 'cleaner', 'html', 'htmlpurifier', 'ipsearch', 'mcaptcha', 'news', 'search');
$step = empty($_SESSION['cot_inst_lang']) ? 0 : (int) $cfg['new_install'];
$mskin = cot_tplfile('install.install');
if (!empty($_SESSION['cot_inst_script']) && file_exists($_SESSION['cot_inst_script'])) {
    require_once $_SESSION['cot_inst_script'];
}
cot_sendheaders();
$t = new XTemplate($mskin);
$site_url = (strpos($_SERVER['SERVER_PROTOCOL'], 'HTTPS') === false && $_SERVER['HTTPS'] != 'on' && $_SERVER['SERVER_PORT'] != 443 && $_SERVER['HTTP_X_FORWARDED_PORT'] !== 443 ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
$site_url = str_replace('\\', '/', $site_url);
$site_url = preg_replace('#/$#', '', $site_url);
$sys['abs_url'] = $site_url . '/';
define('COT_ABSOLUTE_URL', $site_url . '/');
if ($step > 2) {
    $dbc_port = empty($cfg['mysqlport']) ? '' : ';port=' . $cfg['mysqlport'];
    $db = new CotDB('mysql:host=' . $cfg['mysqlhost'] . $dbc_port . ';dbname=' . $cfg['mysqldb'], $cfg['mysqluser'], $cfg['mysqlpassword']);
    cot::init();
}
// Import section
switch ($step) {
    case 2:
コード例 #23
0
}
switch ($sort) {
    case 'costasc':
        $order['cost'] = 'item_cost ASC';
        break;
    case 'costdesc':
        $order['cost'] = 'item_cost DESC';
        break;
    default:
        $order['date'] = 'item_date DESC';
        break;
}
$list_url_path = array('c' => $c, 'sort' => $sort, 'sq' => $sq);
// Building the canonical URL
$out['canonical_uri'] = cot_url('market', $list_url_path);
$mskin = cot_tplfile(array('market', 'list', $structure['market'][$c]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('market.list.query') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_market} AS m {$join_condition} \n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid\n\t" . $where . "")->fetchColumn();
$sqllist = $db->query("SELECT m.*, u.* {$join_columns} \n\tFROM {$db_market} AS m {$join_condition}\n\tLEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid \n\t" . $where . "\n\t" . $order . "\n\tLIMIT {$d}, " . $maxrowsperpage);
$pagenav = cot_pagenav('market', $list_url_path, $d, $totalitems, $maxrowsperpage);
$catpatharray[] = array(cot_url('market'), $L['market']);
if (!empty($c)) {
    $catpatharray = array_merge($catpatharray, cot_structure_buildpath('market', $c));
}
コード例 #24
0
/* ====================
[BEGIN_COT_EXT]
Hooks=tools
[END_COT_EXT]
==================== */
/**
 * Creates aliases in existing pages with empty alias
 *
 * @package AutoAlias
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('autoalias2', 'plug');
require_once cot_langfile('autoalias2', 'plug');
$t = new XTemplate(cot_tplfile('autoalias2.admin', 'plug', true));
$adminsubtitle = $L['AutoAlias'];
if ($a == 'create') {
    $count = 0;
    $res = $db->query("SELECT page_id, page_title FROM {$db_pages} WHERE page_alias = ''");
    foreach ($res->fetchAll() as $row) {
        autoalias2_update($row['page_title'], $row['page_id']);
        $count++;
    }
    $res->closeCursor();
    cot_message(cot_rc('aliases_written', $count));
    cot_redirect(cot_url('admin', 'm=other&p=autoalias2', '', true));
}
$t->assign('AUTOALIAS_CREATE', cot_url('admin', 'm=other&p=autoalias2&a=create'));
cot_display_messages($t);
$t->parse();
コード例 #25
0
ファイル: trashcan.admin.php プロジェクト: Andreyjktl/Cotonti
    /* ===== */
    $sql = $db->query("TRUNCATE {$db_trash}");
    cot_message('adm_trashcan_prune');
    cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
} elseif ($a == 'restore') {
    cot_check_xg();
    /* === Hook === */
    foreach (cot_getextplugins('trashcan.admin.restore') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_trash_restore($id);
    cot_message('adm_trashcan_restored');
    cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
}
$tr_t = new XTemplate(cot_tplfile($info ? 'trashcan.info.admin' : 'trashcan.admin', 'plug', true));
$totalitems = (int) $db->query("SELECT COUNT(*) FROM {$db_trash} WHERE tr_parentid=0")->fetchColumn();
$pagenav = cot_pagenav('admin', 'm=other&p=trashcan', $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_query = $info ? "AND tr_id={$id} LIMIT 1" : "ORDER by tr_id DESC LIMIT {$d}, " . $maxperpage;
$sql = $db->query("SELECT t.*, u.user_name FROM {$db_trash} AS t\n\tLEFT JOIN {$db_users} AS u ON t.tr_trashedby=u.user_id\n\tWHERE tr_parentid=0 {$sql_query}");
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('trashcan.admin.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
    $ii++;
    switch ($row['tr_type']) {
        case 'comment':
            $icon = $R['admin_icon_comments'];
            $typestr = $L['Comment'];
            $enabled = cot_plugin_active('comments') ? 1 : 0;
コード例 #26
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=admin.config.edit.loop
[END_COT_EXT]
==================== */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('usercategories', 'plug');
$adminhelp = $L['usercategories_help'];
if ($p == 'usercategories' && $row['config_name'] == 'catslimit' && $cfg['jquery']) {
    $sskin = cot_tplfile('usercategories.admin.config', 'plug', true);
    $tt = new XTemplate($sskin);
    $tpaset = str_replace("\r\n", "\n", $row['config_value']);
    $tpaset = explode("\n", $tpaset);
    $jj = 0;
    foreach ($tpaset as $lineset) {
        $lines = explode("|", $lineset);
        $lines[0] = (int) trim($lines[0]);
        $lines[1] = (int) trim($lines[1]);
        $lines[2] = (int) trim($lines[2]);
        if ($lines[0] > 0) {
            $tt->assign(array('ADDNUM' => $jj, 'ADDGROUP' => cot_selectbox_groups($lines[0], 'groupid' . $jj, array(1, 2, 3, 5, 6), 'class="area_groupid"'), 'ADDLIMIT1' => cot_inputbox('text', 'limit1', $lines[1], 'class="area_limit1"'), 'ADDLIMIT2' => cot_inputbox('text', 'limit2', $lines[2], 'class="area_limit2"')));
            $tt->parse('MAIN.ADDITIONAL');
            $jj++;
        }
    }
    if ($jj == 0) {
        $tt->assign(array('ADDNUM' => $jj, 'ADDGROUP' => cot_selectbox_groups('', 'groupid' . $jj, array(1, 2, 3, 5, 6), 'class="area_groupid"'), 'ADDLIMIT1' => cot_inputbox('text', 'limit1', 0, 'class="area_limit1"'), 'ADDLIMIT2' => cot_inputbox('text', 'limit2', 0, 'class="area_limit2"')));
        $tt->parse('MAIN.ADDITIONAL');
    }
コード例 #27
0
ファイル: i18n.page.php プロジェクト: Andreyjktl/Cotonti
         if (cot_error_found()) {
             cot_redirect(cot_url('plug', "e=i18n&m=page&a=edit&id={$id}&l={$i18n_locale}", '', true));
             exit;
         }
         $db->update($db_i18n_pages, $pag_i18n, "ipage_id = ? AND ipage_locale = ?", array($id, $i18n_locale));
         /* === Hook === */
         foreach (cot_getextplugins('i18n.page.edit.update') as $pl) {
             include $pl;
         }
         /* =============*/
         cot_message('Updated');
         $page_urlp = empty($pag['page_alias']) ? 'c=' . $pag['page_cat'] . "&id={$id}&l={$i18n_locale}" : 'c=' . $pag['page_cat'] . '&al=' . $pag['page_alias'] . '&l=' . $i18n_locale;
         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}'");
コード例 #28
0
 * 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');
require_once cot_incfile('market', 'module');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('market', 'any', 'RWA');
$tab = cot_import('tab', 'G', 'ALP');
$category = $tab == 'market' ? cot_import('cat', 'G', 'TXT') : '';
list($pg, $d, $durl) = cot_import_pagenav('dmarket', $cfg['market']['cat___default']['maxrowsperpage']);
//маркет вкладка
$t1 = new XTemplate(cot_tplfile(array('market', 'userdetails'), 'module'));
$t1->assign(array("ADDPRD_URL" => cot_url('market', 'm=add'), "PRD_ADDPRD_URL" => cot_url('market', 'm=add'), "ADDPRD_SHOWBUTTON" => $usr['auth_write'] ? true : false, "RPD_ADDPRD_SHOWBUTTON" => $usr['auth_write'] ? true : false));
$where = array();
$order = array();
if ($usr['id'] == 0 || $usr['id'] != $urr['user_id'] && !$usr['isadmin']) {
    $where['state'] = "item_state=0";
}
if ($category) {
    $where['cat'] = 'item_cat=' . $db->quote($category);
}
$where['owner'] = "item_userid=" . $urr['user_id'];
$order['date'] = "item_date DESC";
$wherecount = $where;
if ($wherecount['cat']) {
    unset($wherecount['cat']);
}
コード例 #29
0
ファイル: ukarma.php プロジェクト: CrazyFreeMan/cot-ukarma
Hooks=standalone
[END_COT_EXT]
==================== */
/**
 * ukarma plugin
 *
 * @package ukarma
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
list($pn, $d, $d_url) = cot_import_pagenav('d', $cfg['maxrowsperpage']);
$out['subtitle'] = $L['ukarma_title'];
$t = new XTemplate(cot_tplfile(array('ukarma', 'statistics'), 'plug'));
$where = array();
$order = array();
$where['userid'] = "ukarma_userid=" . $usr['id'];
$order['date'] = "ukarma_date DESC";
/* === Hook === */
foreach (cot_getextplugins('ukarma.statistics.query') as $pl) {
    include $pl;
}
/* ===== */
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$order = $order ? 'ORDER BY ' . implode(', ', $order) : '';
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_ukarma}  \n\t" . $where . "")->fetchColumn();
$sqllist_rowset = $db->query("SELECT * FROM {$db_ukarma} AS k\n\tLEFT JOIN {$db_users} AS u ON u.user_id=k.ukarma_ownerid\n\t" . $where . " \n\t" . $order . "\n\tLIMIT {$d}, " . $cfg['maxrowsperpage'])->fetchAll();
$pagenav = cot_pagenav('ukarma', '', $d, $totalitems, $cfg['maxrowsperpage']);
$t->assign(array("PAGENAV_COUNT" => $totalitems, "PAGENAV_PAGES" => $pagenav['main'], "PAGENAV_PREV" => $pagenav['prev'], "PAGENAV_NEXT" => $pagenav['next']));
コード例 #30
0
ファイル: pm.list.php プロジェクト: Andreyjktl/Cotonti
foreach (cot_getextplugins('pm.list.main') as $pl) {
    include $pl;
}
/* ===== */
/* === Title === */
$title_params = array('PM' => $L['Private_Messages'], 'COUNT' => $totalcount, 'BOX' => $subtitle);
$out['subtitle'] = cot_title('{BOX} ({COUNT}) - {PM}', $title_params);
$out['head'] .= $R['code_noindex'];
Resources::linkFileFooter(cot::$cfg['modules_dir'] . '/pm/js/pm.js');
/* === Title === */
$totallines = $db->query("SELECT COUNT(*) FROM {$db_pm} WHERE {$sqlfilter}")->fetchColumn();
$elem = $f == 'sentbox' ? 'pm_touserid' : 'pm_fromuserid';
$pm_sql = $db->query("SELECT p.*, u.* FROM {$db_pm} AS p\n\t\tLEFT JOIN {$db_users} AS u\n\t\tON u.user_id = p.{$elem}\n\t\tWHERE {$sqlfilter}\n\t\tORDER BY pm_date DESC LIMIT  {$d}," . $cfg['pm']['maxpmperpage']);
$pagenav = cot_pagenav('pm', 'f=' . $f . '&filter=' . $filter, $d, $totallines, $cfg['pm']['maxpmperpage'], 'd', '', $cfg['pm']['turnajax']);
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate(cot_tplfile(array('pm', 'list', $pmalttpl)));
$jj = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('pm.list.loop');
/* ===== */
foreach ($pm_sql->fetchAll() as $row) {
    $jj++;
    $row['pm_icon_readstatus'] = $row['pm_tostate'] == '0' ? cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon_new'], array('title' => $L['pm_unread'], 'class' => $cfg['pm']['turnajax'] ? 'ajax' : '')) : cot_rc_link(cot_url('pm', 'm=message&id=' . $row['pm_id']), $R['pm_icon'], array('title' => $L['pm_read'], 'class' => 'ajax'));
    $pm_data = cot_parse($row['pm_text'], $cfg['pm']['markup']);
    $pm_desc = cot_string_truncate($pm_data, 100, true, false, '...');
    if ($f == 'sentbox') {
        $star_class = $row['pm_fromstate'] == 2 ? 1 : 0;
    } else {
        $star_class = $row['pm_tostate'] == 2 ? 1 : 0;
    }
    $url_edit = cot_url('pm', 'm=send&id=' . $row['pm_id']);