Example #1
0
/**
 * Create a new PFS folder, return new folder ID
 *
 * @param int $ownerid Owners user ID
 * @param string $title Folder title
 * @param string $desc Folder description
 * @param int $parentid Parent folder ID
 * @param boolean $ispublic Public?
 * @param boolean $isgallery Gallery?
 * @return int
 */
function cot_pfs_createfolder($ownerid, $title = '', $desc = '', $parentid = '', $ispublic = '', $isgallery = '')
{
    global $db, $db_pfs_folders, $cfg, $sys, $L, $err_msg;
    if ($title === '') {
        $title = cot_import('ntitle', 'P', 'TXT');
    }
    if ($desc === '') {
        $desc = cot_import('ndesc', 'P', 'TXT');
    }
    if ($parentid === '') {
        $parentid = cot_import('nparentid', 'P', 'INT');
    }
    if ($ispublic === '') {
        $ispublic = cot_import('nispublic', 'P', 'BOL');
    }
    if ($isgallery === '') {
        $isgallery = cot_import('nisgallery', 'P', 'BOL');
    }
    if (empty($title)) {
        $err_msg[] = $L['pfs_foldertitlemissing'];
        return 0;
    }
    $newpath = cot_translit_encode(mb_strtolower($title));
    if ($parentid > 0) {
        $newpath = cot_pfs_folderpath($parentid, TRUE) . $newpath;
        $sql = $db->query("SELECT pff_id FROM {$db_pfs_folders} WHERE pff_userid=" . (int) $ownerid . " AND pff_id=" . (int) $parentid);
        $sql->rowCount() > 0 or cot_die();
    }
    if ($cfg['pfs']['pfsuserfolder']) {
        cot_pfs_mkdir($pfs_dir_user . $newpath) or cot_redirect(cot_url('message', 'msg=500&redirect=' . base64_encode('pfs.php'), '', true));
        cot_pfs_mkdir($thumbs_dir_user . $newpath) or cot_redirect(cot_url('message', 'msg=500&redirect=' . base64_encode('pfs.php'), '', true));
    }
    $db->insert($db_pfs_folders, array('pff_parentid' => (int) $parentid, 'pff_userid' => (int) $ownerid, 'pff_title' => $title, 'pff_date' => (int) $sys['now'], 'pff_updated' => (int) $sys['now'], 'pff_desc' => $desc, 'pff_path' => $newpath, 'pff_ispublic' => (int) $ispublic, 'pff_isgallery' => (int) $isgallery, 'pff_count' => 0));
    return $db->lastInsertId();
}
Example #2
0
$is_user_check = 'IF(o.online_userid > 0,1,0) as is_user';
$limit = $maxuserssperpage ? "LIMIT {$d}, {$maxuserssperpage}" : '';
$sql_users = $db->query("\n\tSELECT DISTINCT u.*, o.*, {$is_user_check}\n\tFROM {$db_online} AS o\n\t{$join_condition} {$where}\n\tORDER BY is_user DESC, online_lastseen DESC {$limit}\n");
$sql_users_count = $db->query("SELECT COUNT(*) as cnt, {$is_user_check} FROM {$db_online} as o {$where} GROUP BY is_user");
$who_guests = 0;
$who_users = 0;
foreach ($sql_users_count as $row) {
    if ($row['is_user']) {
        $who_users = (int) $row['cnt'];
    } else {
        $who_guests = (int) $row['cnt'];
    }
}
$totallines = $who_users + $who_guests;
if (!$cfg['easypagenav'] && $durl > 0 && $maxuserssperpage > 0 && $durl % $maxuserssperpage > 0 || $d > 0 && $d >= $totallines) {
    cot_redirect(cot_url('whosonline'));
}
$pagenav = cot_pagenav('whosonline', array('d' => $durl), $d, $totallines, $maxuserssperpage);
/* === Hooks - Part1 : Set === */
$users_loop_hook = cot_getextplugins('whosonline.users.loop');
$guests_loop_hook = cot_getextplugins('whosonline.guests.loop');
/* ===== */
if ($maxuserssperpage) {
    $fpu = $who_users / $maxuserssperpage;
    if ($durl > ceil($fpu)) {
        $guest_start_num = $maxuserssperpage - $who_users % $maxuserssperpage + ($durl - 1 - ceil($fpu)) * $maxuserssperpage;
    }
}
foreach ($sql_users->fetchAll() as $row) {
    if ($hiddenusers && in_array($row['user_id'], $hiddenusers)) {
        if (cot_auth('plug', 'hiddengroups', '1')) {
Example #3
0
        include $pl;
    }
    /* ===== */
    $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'];
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=users.register.add.validate
 * [END_COT_EXT]
 */
/**
 * plugin User Group Selector for Cotonti Siena
 * 
 * @package usergroupselector
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_langfile('usergroupselector', 'plug');
$usergroup = cot_import('usergroup', 'G', 'ALP');
if (cot_error_found() && !empty($usergroup)) {
    cot_redirect(cot_url('users', 'm=register&usergroup=' . $usergroup, '', true));
}
Example #5
0
    include $pl;
}
/* ===== */
if ($id > 0 || !empty($al)) {
    $where = !empty($al) ? "item_alias='" . $al . "'" : 'item_id=' . $id;
    $sql = $db->query("SELECT f.*, u.* FROM {$db_folio} AS f \n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=f.item_userid WHERE {$where} LIMIT 1");
}
if (!$id && empty($al) || !$sql || $sql->rowCount() == 0) {
    cot_die_message(404, TRUE);
}
$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']));
Example #6
0
                /* === Hook for the plugins === */
                foreach (cot_getextplugins('users.register.validate.rejected') as $pl) {
                    include $pl;
                }
                /* ===== */
                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
/**
 * Создание платежки
 * @param string $area тип услуги, по-умолчанию пополнение счета
 * @param int $summ стоимость
 * @param array $options дополнительные параметры
 */
function cot_payments_create_order($area = 'balance', $summ, $options = array())
{
    global $db_payments, $db_payments_balance, $db, $sys, $cfg, $usr;
    if (empty($summ)) {
        cot_redirect(cot_url('payments', 'm=error&msg=3', '', true));
    }
    $payinfo['pay_userid'] = $usr['id'];
    $payinfo['pay_area'] = $area;
    $payinfo['pay_summ'] = $summ;
    $payinfo['pay_cdate'] = $sys['now'];
    $payinfo['pay_status'] = 'new';
    if (count($options) > 0) {
        foreach ($options as $i => $opt) {
            $payinfo['pay_' . $i] = $opt;
        }
    }
    // Создание платежного поручения для системы
    $db->insert($db_payments, $payinfo);
    $id = $db->lastInsertId();
    cot_redirect(cot_url('payments', 'm=billing&pid=' . $id, '', true));
}
Example #8
0
         $errors ? cot_message('adm_partially_updated', 'warning') : cot_message('Updated');
     } else {
         if (!$errors) {
             cot_message('adm_already_updated');
         }
     }
 } elseif ($a == 'reset' && !empty($v)) {
     cot_config_reset($p, $v, $o, '');
     $optionslist = cot_config_list($o, $p, '');
     /* === Hook  === */
     foreach (cot_getextplugins('admin.config.edit.reset.done') as $pl) {
         include $pl;
     }
     /* ===== */
     $cache && $cache->clear();
     cot_redirect(cot_url('admin', array('m' => 'config', 'n' => 'edit', 'o' => $o, 'p' => $p), '', true));
 }
 if ($o == 'core') {
     $adminpath[] = array(cot_url('admin', 'm=config'), $L['Configuration']);
     $adminpath[] = array(cot_url('admin', 'm=config&n=edit&o=' . $o . '&p=' . $p), $L['core_' . $p]);
 } else {
     $adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
     $plmod = $o == 'module' ? 'mod' : 'pl';
     $ext_info = cot_get_extensionparams($p, $o == 'module');
     $adminpath[] = array(cot_url('admin', "m=extensions&a=details&{$plmod}={$p}"), $ext_info['name']);
     $adminpath[] = array(cot_url('admin', 'm=config&n=edit&o=' . $o . '&p=' . $p), $L['Configuration']);
 }
 /* === Hook  === */
 foreach (cot_getextplugins('admin.config.edit.main') as $pl) {
     include $pl;
 }
Example #9
0
                        if ($stats_enabled) {
                            cot_stat_inc('totalmailpmnot');
                        }
                    }
                }
            }
            /* === Hook === */
            foreach (cot_getextplugins('pm.send.send.done') as $pl) {
                include $pl;
            }
            /* ===== */
            if ($stats_enabled) {
                cot_stat_inc('totalpms');
            }
            cot_shield_update(30, "New private message (" . $totalrecipients . ")");
            cot_redirect(cot_url('pm', 'f=sentbox', '', true));
        }
    }
}
if (!empty($to)) {
    $totalrecipients = 0;
    if (mb_substr(mb_strtolower($to), 0, 1) == 'g' && $usr['maingrp'] == 5) {
        $group = cot_import(mb_substr($to, 1, 8), 'D', 'INT');
        if ($group > 1) {
            $sql_pm_users = $db->query("SELECT user_id, user_name FROM {$db_users} WHERE user_maingrp = {$group} ORDER BY user_name ASC");
        }
    } else {
        $touser_src = explode('-', $to);
        $touser_req = count($touser_src);
        foreach ($touser_src as $k => $i) {
            $userid = cot_import($i, 'D', 'INT');
Example #10
0
        }
        if (!$rtopic['ft_mode']) {
            cot_forums_sectionsetlast($s, "fs_postcount+1", "fs_topiccount+1");
        }
        cot_extrafield_movefiles();
        /* === Hook === */
        foreach (cot_getextplugins('forums.newtopic.newtopic.done') as $pl) {
            include $pl;
        }
        /* ===== */
        if ($cache) {
            $cfg['cache_forums'] && $cache->page->clear('forums');
            $cfg['cache_index'] && $cache->page->clear('index');
        }
        cot_shield_update(45, "New topic");
        cot_redirect(cot_url('forums', "m=posts&q={$q}&n=last", '#bottom', true));
    }
}
$toptitle = cot_breadcrumbs(cot_forums_buildpath($s), $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$sys['sublocation'] = $structure['forums'][$s]['title'];
$out['subtitle'] = $L['forums_newtopic'];
$out['head'] .= $R['code_noindex'];
/* === Hook === */
foreach (cot_getextplugins('forums.newtopic.main') as $pl) {
    include $pl;
}
/* ===== */
require_once cot_incfile('forms');
require_once $cfg['system_dir'] . '/header.php';
$mskin = cot_tplfile(array('forums', 'newtopic', $structure['forums'][$s]['tpl']));
        $variants = cot_import($variantss[$name], 'D', "HTM");
        $default = cot_import($defaults[$name], 'D', "HTM");
        $type = cot_import($types[$name], 'D', "INT");
        cfg_editor::config_edit($c, $name, $order, $title, $desc, $type, $default, $variants);
    }
    cot_message('updated_success');
    $cache && $cache->clear();
    cot_redirect(cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c), '', true));
}
if ($a == 'delete') {
    cot_check_xg();
    $name = cot_import('rname', 'G', "ALP");
    cfg_editor::config_delete($c, $name);
    cot_message('deleted_success');
    $cache && $cache->clear();
    cot_redirect(cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c), '', true));
}
$rows = cfg_editor::config_list($c);
foreach ($rows as $row) {
    $readonly = array();
    if ($row['config_donor'] != 'configeditor') {
        $readonly = array('readonly' => 'readonly', 'disabled' => 'disabled');
    }
    $t->assign(array('FORM_EDIT_NAME' => $row['config_name'], 'FORM_EDIT_TITLE' => cot_inputbox('text', 'rtitle[' . $row['config_name'] . ']', isset($L['cfg_' . $row['config_name']]) ? $L['cfg_' . $row['config_name']] : $row['config_text'], array('maxlength' => '255') + $readonly), 'FORM_EDIT_DESC' => cot_textarea('rdesc[' . $row['config_name'] . ']', isset($L['cfg_' . $row['config_name'] . '_hint']) ? $L['cfg_' . $row['config_name'] . '_hint'] : $row['config_desc'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_ORDER' => cot_inputbox('text', 'rorder[' . $row['config_name'] . ']', $row['config_order'], array('maxlength' => '2') + $readonly), 'FORM_EDIT_VARIANTS' => cot_textarea('rvariants[' . $row['config_name'] . ']', $row['config_variants'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_DEFAULT' => cot_textarea('rdefault[' . $row['config_name'] . ']', $row['config_default'], 2, 60, array('maxlength' => '255') + $readonly), 'FORM_EDIT_TYPE' => cot_selectbox($row['config_type'], 'rtype[' . $row['config_name'] . ']', array_keys($types_array), array_values($types_array), false, $readonly), 'FORM_EDIT_DELETE_URL' => $row['config_donor'] != 'configeditor' ? '' : cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'c' => $c, 'a' => 'delete', 'rname' => $row['config_name'], 'x' => $sys['xk']))));
    $t->parse('MAIN.ROW');
}
if (!count($rows)) {
    $t->parse('MAIN.NOROW');
}
$t->assign(array('FORM_EDIT_URL' => cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'a' => 'update', 'c' => $c)), 'FORM_ADD_URL' => cot_url('admin', array('m' => 'other', 'p' => 'configeditor', 'n' => 'edit', 'a' => 'add', 'c' => $c)), 'FORM_ADD_TITLE' => cot_inputbox('text', 'rtitle', '', array('maxlength' => '255')), 'FORM_ADD_NAME' => cot_inputbox('text', 'rname', '', array('size' => '20', 'maxlength' => '32')), 'FORM_ADD_DESC' => cot_textarea('rdesc', '', 2, 60), 'FORM_ADD_ORDER' => cot_inputbox('text', 'rorder', '', array('maxlength' => '2')), 'FORM_ADD_VARIANTS' => cot_textarea('rvariants', '', 2, 60), 'FORM_ADD_DEFAULT' => cot_textarea('rdefault', '', 2, 60), 'FORM_ADD_TYPE' => cot_selectbox(0, 'rtype', array_keys($types_array), array_values($types_array), false)));
cot_display_messages($t);
Example #12
0
/**
 * Checks URI-redir for xg before redirect
 *
 * @param string $uri Target URI
 */
function cot_uriredir_redirect($uri)
{
    if (mb_strpos($uri, '&x=') !== false || mb_strpos($uri, '?x=') !== false) {
        $uri = cot_url('index');
        // xg, not redirect to form action/GET or to command from GET
    }
    cot_redirect($uri);
}
Example #13
0
            case 0:
                $urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
                $r_url = cot_url('folio', $urlparams, '', true);
                break;
            case 1:
                $r_url = cot_url('folio', 'm=preview&id=' . $id, '', true);
                break;
            case 2:
                $urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
                $r_url = cot_url('folio', $urlparams, '', true);
                break;
        }
        cot_redirect($r_url);
        exit;
    } else {
        cot_redirect(cot_url('folio', 'm=add&c=' . $c, '', true));
    }
}
if (empty($ritem['item_cat']) && !empty($c)) {
    $ritem['item_cat'] = $c;
    $usr['isadmin'] = cot_auth('folio', $ritem['item_cat'], 'A');
}
if (empty($ritem['item_type']) && !empty($type)) {
    $ritem['item_type'] = $type;
}
$out['subtitle'] = $L['folio_add_work_title'];
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['folio'][$c]['title'];
$mskin = cot_tplfile(array('folio', 'add', $structure['folio'][$ritem['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('folio.add.main') as $pl) {
Example #14
0
$catpath_short = $c == 'all' || $c == 'system' || $c == 'unvalidated' || $c == 'saved_drafts' ? '' : cot_breadcrumbs($shortpath, $cfg['homebreadcrumb']);
/* === Hook === */
foreach (cot_getextplugins('page.list.query') as $pl) {
    include $pl;
}
/* ===== */
if (empty($sql_page_string)) {
    $where = array_filter($where);
    $where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
    $sql_page_count = "SELECT COUNT(*) FROM {$db_pages} as p {$join_condition} LEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid {$where}";
    $sql_page_string = "SELECT p.*, u.* {$join_columns}\n\t\tFROM {$db_pages} as p {$join_condition}\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=p.page_ownerid\n\t\t{$where}\n\t\tORDER BY {$orderby} LIMIT {$d}, " . $cfg['page']['maxrowsperpage'];
}
$totallines = $db->query($sql_page_count, $params)->fetchColumn();
$sqllist = $db->query($sql_page_string, $params);
if (!$cfg['easypagenav'] && $durl > 0 && $cfg['page']['maxrowsperpage'] > 0 && $durl % $cfg['page']['maxrowsperpage'] > 0 || $d > 0 && $d >= $totallines) {
    cot_redirect(cot_url('page', $list_url_path + array('dc' => $dcurl)));
}
$pagenav = cot_pagenav('page', $list_url_path + array('dc' => $dcurl), $d, $totallines, $cfg['page']['maxrowsperpage']);
$out['desc'] = htmlspecialchars(strip_tags($cat['desc']));
$out['subtitle'] = $cat['title'];
if (!empty($cfg['page']['cat_' . $c]['keywords'])) {
    $out['keywords'] = $cfg['page']['cat_' . $c]['keywords'];
}
if (!empty($cfg['page']['cat_' . $c]['metadesc'])) {
    $out['desc'] = $cfg['page']['cat_' . $c]['metadesc'];
}
if (!empty($cfg['page']['cat_' . $c]['metatitle'])) {
    $out['subtitle'] = $cfg['page']['cat_' . $c]['metatitle'];
}
// Building the canonical URL
$out['canonical_uri'] = cot_url('page', $pageurl_params);
Example #15
0
        switch ($rpage['page_state']) {
            case 0:
                $urlparams = empty($rpage['page_alias']) ? array('c' => $rpage['page_cat'], 'id' => $id) : array('c' => $rpage['page_cat'], 'al' => $rpage['page_alias']);
                $r_url = cot_url('page', $urlparams, '', true);
                break;
            case 1:
                $r_url = cot_url('message', 'msg=300', '', true);
                break;
            case 2:
                cot_message('page_savedasdraft');
                $r_url = cot_url('page', 'm=edit&id=' . $id, '', true);
                break;
        }
        cot_redirect($r_url);
    } else {
        cot_redirect(cot_url('page', 'm=add&c=' . $c, '', true));
    }
}
// Page cloning support
$clone = cot_import('clone', 'G', 'INT');
if ($clone > 0) {
    $rpage = $db->query("SELECT * FROM {$db_pages} WHERE page_id = ?", $clone)->fetch();
}
if (empty($rpage['page_cat']) && !empty($c)) {
    $rpage['page_cat'] = $c;
    $usr['isadmin'] = cot_auth('page', $rpage['page_cat'], 'A');
}
$out['subtitle'] = $L['page_addsubtitle'];
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['page'][$c]['title'];
$mskin = cot_tplfile(array('page', 'add', $structure['page'][$rpage['page_cat']]['tpl']));
    $rtitles = cot_import('rtitle', 'P', 'ARR');
    $rdefault = cot_import('rdefault', 'P', 'INT');
    foreach ($rtitles as $rid => $rtitle) {
        $rinput = array();
        $rinput['type_title'] = cot_import($rtitle, 'D', 'TXT');
        if (!empty($rinput['type_title'])) {
            $db->update($db_projects_types, $rinput, "type_id=" . (int) $rid);
        } else {
            $db->delete($db_projects_types, "type_id=" . (int) $rid);
        }
    }
    if (!empty($rdefault)) {
        $db->update($db_config, array('config_value' => $rdefault), "config_name = ? \n\t\t\tAND config_cat = ?", array('default_type', 'projects'));
    }
    $cache && $cache->clear();
    cot_redirect(cot_url('admin', 'm=projects&p=types&d=' . $d_url, '#footer', true));
    exit;
}
$totalitems = $db->query("SELECT COUNT(*) FROM {$db_projects_types}")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_projects_types} ORDER by type_title ASC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagenav = cot_pagenav('admin', 'm=projects&p=types', $d, $totalitems, $cfg['maxrowsperpage']);
$t = new XTemplate(cot_tplfile('projects.admin.types', 'module'));
$jj = 0;
while ($item = $sql->fetch()) {
    $jj++;
    $t->assign(array('TYPE_ROW_ID' => cot_inputbox('text', 'rtitle[' . $item['type_id'] . ']', $item['type_title']), 'TYPE_ROW_TITLE' => cot_inputbox('text', 'rtitle[' . $item['type_id'] . ']', $item['type_title']), 'TYPE_ROW_DEFAULT' => cot_radiobox($cfg['projects']['default_type'], 'rdefault', $item['type_id']), 'TYPE_ROW_DEL_URL' => cot_url('admin', 'm=projects&p=types&id=' . $item['type_id'] . '&a=delete'), 'TYPE_ROW_NUM' => $jj, 'TYPE_ROW_ODDEVEN' => cot_build_oddeven($jj)));
    $t->parse("MAIN.ROWS");
}
if ($jj == 0) {
    $t->parse("MAIN.NOROWS");
}
Example #17
0
                }
            }
            break;
        case 5:
            // End credits
            break;
        default:
            // Error
            cot_redirect(cot_url('index'));
            exit;
    }
    $inst_func_name = "cot_install_step" . $step . "_setup";
    function_exists($inst_func_name) && $inst_func_name();
    if (cot_error_found()) {
        // One step back
        cot_redirect('install.php');
    } else {
        // Step++
        $step++;
        $config_contents = file_get_contents($file['config']);
        if ($step == 5) {
            $config_contents = preg_replace("#^\\\$cfg\\['new_install'\\]\\s*=\\s*.*?;#m", "\$cfg['new_install'] = false;", $config_contents);
        } else {
            $config_contents = preg_replace("#^\\\$cfg\\['new_install'\\]\\s*=\\s*.*?;#m", "\$cfg['new_install'] = {$step};", $config_contents);
        }
        function_exists("cot_install_stepplusplus") && cot_install_stepplusplus();
        file_put_contents($file['config'], $config_contents);
    }
}
// Display
switch ($step) {
            $payinfo['pay_adate'] = $sys['now'];
            $payinfo['pay_status'] = 'done';
            $payinfo['pay_desc'] = sprintf($L['payments_balance_transfer_desc'], $usr['name'], $recipient['user_name'], $comment);
            $db->insert($db_payments, $payinfo);
            $pid = $db->lastInsertId();
            // Отправка уведомления админу о переводе между пользователями
            $subject = $L['payments_balance_transfer_admin_subject'];
            $body = sprintf($L['payments_balance_transfer_admin_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment);
            cot_mail($cfg['adminemail'], $subject, $body);
            // Отправка уведомления админу о переводе между пользователями
            $subject = $L['payments_balance_transfer_recipient_subject'];
            $body = sprintf($L['payments_balance_transfer_recipient_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment);
            cot_mail($recipient['user_email'], $subject, $body);
            cot_redirect(cot_url('payments', 'm=balance&n=history', '', true));
        }
        cot_redirect(cot_url('payments', 'm=balance&n=transfer', '', true));
    }
    cot_display_messages($t, 'MAIN.TRANSFERFORM');
    $t->assign(array('TRANSFER_FORM_ACTION_URL' => cot_url('payments', 'm=balance&n=transfer&a=add'), 'TRANSFER_FORM_SUMM' => cot_inputbox('text', 'summ', $summ), 'TRANSFER_FORM_TAX' => $taxsumm, 'TRANSFER_FORM_TOTAL' => !empty($sendersumm) ? $sendersumm : 0, 'TRANSFER_FORM_COMMENT' => $comment, 'TRANSFER_FORM_USERNAME' => $username));
    $t->parse('MAIN.TRANSFERFORM');
}
if ($n == 'history') {
    $pays = $db->query("SELECT * FROM {$db_payments} \n\t\tWHERE pay_userid=" . $usr['id'] . " AND pay_status='done' AND pay_summ>0\n\t\tORDER BY pay_pdate DESC")->fetchAll();
    foreach ($pays as $pay) {
        $t->assign(cot_generate_paytags($pay, 'HIST_ROW_'));
        $t->parse('MAIN.HISTORY.HIST_ROW');
    }
    $t->parse('MAIN.HISTORY');
}
$t->parse('MAIN');
$module_body = $t->text('MAIN');
Example #19
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();
$plugin_body = $t->text('MAIN');
        $rsubject = cot_rc($L['marketorders_addclaim_mail_toseller_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
        $rbody = cot_rc($L['marketorders_addclaim_mail_toseller_body'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
        cot_mail($seller['user_email'], $rsubject, $rbody);
        // Уведопляем админа о том, что подана жалоба по этому заказу
        $rsubject = cot_rc($L['marketorders_addclaim_mail_toadmin_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
        $rbody = cot_rc($L['marketorders_addclaim_mail_toadmin_body'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
        /* === Hook === */
        foreach (cot_getextplugins('marketorders.addclaim.done') as $pl) {
            include $pl;
        }
        /* ===== */
        cot_mail($cfg['adminemail'], $rsubject, $rbody);
        cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
        exit;
    }
    cot_redirect(cot_url('marketorders', 'm=addclaim&id=' . $id, '', true));
    exit;
}
$out['subtitle'] = $L['marketorders_neworder_title'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('marketorders', 'addclaim', $structure['market'][$item['item_cat']]['tpl']), 'plug');
/* === Hook === */
foreach (cot_getextplugins('marketorders.addclaim.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
$catpatharray[] = array(cot_url('market'), $L['market']);
$catpatharray[] = array('', $L['marketorders_addclaim_title']);
$catpath = cot_breadcrumbs($catpatharray, $cfg['homebreadcrumb'], true);
$t->assign(array("BREADCRUMBS" => $catpath));
Example #21
0
            $rbody = cot_rc($L['project_added_post_body'], array('user_name' => $item['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($item['user_email'], $rsubject, $rbody);
        } else {
            $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;
Example #22
0
    }
    // Save configuration at this point
    $cache && $cache->db->store('cot_cfg', $cfg, 'system');
}
unset($cot_cfg);
/* === Hook === */
foreach (cot_getextplugins('input') as $pl) {
    include $pl;
}
/* ======================== */
/* ======== Maintenance mode ======== */
if ($cfg['maintenance'] && !defined('COT_INSTALL')) {
    $sqll = $db->query("SELECT grp_maintenance FROM {$db_groups} WHERE grp_id='" . $usr['maingrp'] . "' ");
    $roow = $sqll->fetch();
    if (!$roow['grp_maintenance'] && !defined('COT_AUTH')) {
        cot_redirect(cot_url('login'));
    }
}
/* ======== Anti-hammering =========*/
if ($cfg['shieldenabled'] && ($usr['id'] == 0 || !cot_auth('admin', 'a', 'A') || $cfg['shield_force'])) {
    $shield_limit = $_SESSION['online_shield'];
    $shield_action = $_SESSION['online_action'];
    $shield_hammer = cot_shield_hammer($_SESSION['online_hammer'], $shield_action, $_SESSION['online_lastseen']);
    $sys['online_hammer'] = $shield_hammer;
    $_SESSION['online_lastseen'] = (int) $sys['now'];
}
/* ======== Zone variables ======== */
$m = cot_import('m', 'G', 'ALP', 24);
$n = cot_import('n', 'G', 'ALP', 24);
$a = cot_import('a', 'G', 'ALP', 24);
$b = cot_import('b', 'G', 'ALP', 24);
Example #23
0
                $urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
                $r_url = cot_url('projects', $urlparams, '', true);
                if (!$usr['isadmin']) {
                    $rbody = cot_rc($L['project_senttovalidation_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
                    cot_mail($usr['profile']['user_email'], $L['project_senttovalidation_mail_subj'], $rbody);
                }
                if ($cfg['projects']['notif_admin_moderate']) {
                    $nbody = cot_rc($L['project_notif_admin_moderate_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
                    cot_mail($cfg['adminemail'], $L['project_notif_admin_moderate_mail_subj'], $nbody);
                }
                break;
        }
        cot_redirect($r_url);
        exit;
    } else {
        cot_redirect(cot_url('projects', 'm=add&c=' . $c . '&type=' . $type, '', true));
    }
}
if (empty($ritem['item_cat']) && !empty($c)) {
    $ritem['item_cat'] = $c;
    $usr['isadmin'] = cot_auth('projects', $ritem['item_cat'], 'A');
}
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) {
Example #24
0
    cot_redirect($r_url);
    exit;
}
if ($a == 'hide') {
    $ritem = array();
    $ritem['item_state'] = 1;
    $db->update($db_folio, $ritem, 'item_id = ?', $id);
    cot_folio_sync($item['item_cat']);
    $urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $id) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
    $r_url = cot_url('folio', $urlparams, '', true);
    /* === Hook === */
    foreach (cot_getextplugins('folio.edit.hide') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_redirect($r_url);
    exit;
}
$out['subtitle'] = $L['folio_edit_product_title'];
$out['head'] .= $R['code_noindex'];
$sys['sublocation'] = $structure['folio'][$item['item_cat']]['title'];
$mskin = cot_tplfile(array('folio', 'edit', $structure['folio'][$item['item_cat']]['tpl']));
/* === Hook === */
foreach (cot_getextplugins('folio.edit.main') as $pl) {
    include $pl;
}
/* ===== */
$t = new XTemplate($mskin);
// Error and message handling
cot_display_messages($t);
$t->assign(array("PRDEDIT_FORM_SEND" => cot_url('folio', "m=edit&a=update&id=" . $item['item_id'] . "&r=" . $r), "PRDEDIT_FORM_ID" => $item['item_id'], "PRDEDIT_FORM_CAT" => cot_selectbox_structure('folio', $item['item_cat'], 'rcat'), "PRDEDIT_FORM_CATTITLE" => $structure['folio'][$item['item_cat']]['title'], "PRDEDIT_FORM_TITLE" => cot_inputbox('text', 'rtitle', $item['item_title'], 'size="56"'), "PRDEDIT_FORM_ALIAS" => cot_inputbox('text', 'ralias', $item['item_alias'], array('size' => '32', 'maxlength' => '255')), "PRDEDIT_FORM_TEXT" => cot_textarea('rtext', $item['item_text'], 10, 60, 'id="formtext"', $folioeditor ? 'input_textarea_' . $folioeditor : ''), "PRDEDIT_FORM_COST" => cot_inputbox('text', 'rcost', $item['item_cost'], 'size="10"'), "PRDEDIT_FORM_STATE" => $item['item_state'], "PRDEDIT_FORM_PARSER" => cot_selectbox($item['item_parser'], 'rparser', cot_get_parsers(), cot_get_parsers(), false), "PRDEDIT_FORM_DELETE" => cot_radiobox(0, 'rdelete', array(1, 0), array($L['Yes'], $L['No']))));
Example #25
0
        /* === 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');
}
cot_display_messages($t);
$areas_val[] = '';
$areas_title[] = '';
foreach ($pt_cfg as $area => $opt) {
    $areas_val[] = $area;
    $areas_title[] = $opt['name'];
}
switch ($pt_cfg[$area]['period']) {
            cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
            exit;
        }
        // Отменяем жалобу
        if ($a == 'cancelclaim') {
            $rorder['order_claim'] = 0;
            $rorder['order_status'] = 'paid';
            if ($db->update($db_market_orders, $rorder, 'order_id=' . $id)) {
                $customer = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $marketorder['order_userid'])->fetch();
                // Уведопляем покупателя об отклонении жалобы
                $rsubject = cot_rc($L['marketorders_cancelclaim_mail_tocustomer_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
                $rbody = cot_rc($L['marketorders_cancelclaim_mail_tocustomer_body'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
                /* === Hook === */
                foreach (cot_getextplugins('marketorders.order.cancelclaim.done') as $pl) {
                    include $pl;
                }
                /* ===== */
                cot_mail($customer['user_email'], $rsubject, $rbody);
            }
            cot_redirect(cot_url('marketorders', 'm=order&id=' . $id, '', true));
            exit;
        }
        $t->parse('MAIN.CLAIM.ADMINCLAIM');
    }
    $t->parse('MAIN.CLAIM');
}
/* === Hook === */
foreach (cot_getextplugins('marketorders.order.tags') as $pl) {
    include $pl;
}
/* ===== */
         foreach ($sql->fetchAll() as $row) {
             $cat = $row['structure_code'];
             $items = $area_sync($cat);
             $db->update($db_structure, array("structure_count" => (int) $items), "structure_code='" . $db->prep($cat) . "' AND structure_area='" . $db->prep($n) . "'");
         }
         $sql->closeCursor();
     }
     /* === Hook === */
     foreach (cot_getextplugins('admin.structure.resync.done') as $pl) {
         include $pl;
     }
     /* ===== */
     $res ? cot_message('Resynced') : cot_message("Error: function {$area_sync} doesn't exist.");
     // TODO i18n
     $cache && $cfg['cache_' . $n] && $cache->page->clear($n);
     cot_redirect(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&d=' . $durl, '', true));
 }
 $ext_info = cot_get_extensionparams($n, true);
 $adminpath[] = array(cot_url('admin', 'm=extensions'), $L['Extensions']);
 $adminpath[] = array($is_module ? cot_url('admin', 'm=' . $n) : cot_url('admin', 'm=extensions&a=details&pl=' . $n), $ext_info['name']);
 $adminpath[] = array(cot_url('admin', 'm=structure&n=' . $n), $L['Structure']);
 if ($id > 0 || !empty($al)) {
     $where = $id > 0 ? 'structure_id=' . (int) $id : "structure_code='" . $db->prep($al) . "'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE {$where} LIMIT 1");
     cot_die($sql->rowCount() == 0);
 } elseif ($mode && ($mode == 'all' || $structure[$n][$mode])) {
     $sqlmask = $mode == 'all' ? "structure_path NOT LIKE '%.%'" : "structure_path LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%' AND structure_path NOT LIKE '" . $db->prep($structure[$n][$mode]['rpath']) . ".%.%'";
     $sql = $db->query("SELECT * FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask} ORDER BY structure_path ASC, structure_code ASC LIMIT {$d}, " . $maxrowsperpage);
     $totalitems = $db->query("SELECT COUNT(*) FROM {$db_structure} WHERE structure_area='" . $db->prep($n) . "' AND {$sqlmask}")->fetchColumn();
     $pagenav = cot_pagenav('admin', 'm=structure&n=' . $n . '&mode=' . $mode, $d, $totalitems, $maxrowsperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
 } else {
Example #28
0
    cot_die($sql->rowCount() == 0);
    $item = $sql->fetch();
    cot_block($usr['isadmin'] || $usr['id'] == $item['item_userid']);
    $delete = cot_import('rdelete', 'P', 'BOL');
    $ritem['item_text'] = cot_import('rtext', 'P', 'TXT');
    $ritem['item_score'] = (int) cot_import('rscore', 'P', 'INT');
    cot_check(empty($ritem['item_text']), 'reviews_error_emptytext');
    cot_check(empty($ritem['item_score']), 'review_error_emptyscore');
    if (!cot_error_found()) {
        $db->update($db_reviews, $ritem, "item_id='" . (int) $itemid . "'");
        /* === Hook === */
        foreach (cot_getextplugins('reviews.edit.update.done') as $pl) {
            include $pl;
        }
        /* ===== */
    }
} elseif ($a == 'delete') {
    $sql = $db->query("SELECT * FROM {$db_reviews} as r\n\t\tLEFT JOIN {$db_users} as u ON u.user_id=r.item_touserid WHERE item_id='{$itemid}' LIMIT 1");
    cot_die($sql->rowCount() == 0);
    $item = $sql->fetch();
    cot_block($usr['id'] == $item['item_userid'] || $usr['isadmin']);
    $db->delete($db_reviews, "item_id='{$itemid}'");
    /* === Hook === */
    foreach (cot_getextplugins('reviews.edit.delete.done') as $pl) {
        include $pl;
    }
    /* ===== */
}
$redirect = empty($redirect) ? base64_decode($sys['uri_redir']) : base64_decode($redirect);
cot_redirect($redirect);
exit;
Example #29
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);
}
Example #30
0
            $rtopic['ft_preview'] = mb_substr(htmlspecialchars($rmsg['fp_text']), 0, 128);
            $db->update($db_forum_topics, $rtopic, "ft_id = {$q}");
        }
        cot_extrafield_movefiles();
    }
    /* === Hook === */
    foreach (cot_getextplugins('forums.editpost.update.done') as $pl) {
        include $pl;
    }
    /* ===== */
    cot_forums_sectionsetlast($rowpost['fp_cat']);
    if ($cache) {
        $cfg['cache_forums'] && $cache->page->clear('forums');
        $cfg['cache_index'] && $cache->page->clear('index');
    }
    cot_redirect(cot_url('forums', "m=posts&q=" . $q . '&d=' . $durl, '#' . $p, true));
}
require_once cot_incfile('forms');
$crumbs = cot_forums_buildpath($s);
$crumbs[] = array(cot_url('forums', "m=posts&p=" . $p, "#" . $p), ($rowt['ft_mode'] == 1 ? '# ' : '') . htmlspecialchars($rowt['ft_title']));
$crumbs[] = array(cot_url('forums', "m=editpost&s={$s}&q=" . $q . "&p=" . $p . "&" . cot_xg()), $L['Edit']);
$toptitle = cot_breadcrumbs($crumbs, $cfg['homebreadcrumb']);
$toptitle .= $usr['isadmin'] ? $R['forums_code_admin_mark'] : '';
$sys['sublocation'] = $structure['forums'][$s]['title'];
$title_params = array('FORUM' => $L['Forums'], 'SECTION' => $structure['forums'][$s]['title'], 'TOPIC' => $rowt['ft_title'], 'EDIT' => $L['Edit']);
$out['subtitle'] = cot_title('{EDIT} - {TOPIC}', $title_params);
$out['head'] .= $R['code_noindex'];
/* === Hook === */
foreach (cot_getextplugins('forums.editpost.main') as $pl) {
    include $pl;
}