Exemplo n.º 1
0
 public function indexAction()
 {
     global $structure;
     if (!cot_module_active('rss')) {
         cot_die_message(404, TRUE);
     }
     $c = cot_import('c', 'G', 'TXT');
     if (!empty($c)) {
         if (!isset($structure['advboard'][$c])) {
             cot_die_message(404, TRUE);
         }
         list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c);
         cot_block(cot::$usr['auth_read']);
     }
     $rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle'];
     $rss_link = cot::$cfg['mainurl'];
     $rss_description = cot::$cfg['subtitle'];
     $domain = cot::$sys['domain'];
     $condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now']));
     if (!empty($c)) {
         $rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle'];
         $condition[] = array('category', $c);
     }
     $advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc')));
     $t = new XTemplate(cot_tplfile('rss'));
     $now = cot::$sys['now'];
     $now += cot::$usr['timezone'] * 3600;
     $t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now))));
     if (!empty($advertisement)) {
         foreach ($advertisement as $advert) {
             $url = $advert->url;
             if (!cot_url_check($url)) {
                 $url = COT_ABSOLUTE_URL . $url;
             }
             $date = '';
             if (!empty($advert->created)) {
                 $date = strtotime($advert->created);
                 $date += cot::$usr['timezone'] * 3600;
                 $date = date('r', $date);
                 $date = $this->fixPubDate($date);
             }
             $text = $advert->text;
             $textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']);
             if ($textlength > 0 && mb_strlen($text) > $textlength) {
                 $text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']);
             }
             $t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url));
             $t->parse('MAIN.ITEM_ROW');
         }
     }
     $t->parse('MAIN');
     //        ob_clean();
     header('Content-type: text/xml; charset=UTF-8');
     echo $t->text('MAIN');
     exit;
 }
Exemplo n.º 2
0
Arquivo: Main.php Projeto: Alex300/brs
 public function clickAction()
 {
     $id = cot_import('id', 'G', 'INT');
     if (!$id) {
         cot_die_message(404);
     }
     $banner = brs_model_Banner::getById($id);
     if (!$banner) {
         cot_die_message(404);
     }
     $banner->click();
     if (!empty($banner->clickurl)) {
         header('Location: ' . $banner->clickurl);
     }
     exit;
 }
Exemplo n.º 3
0
/**
 * User Registration Script
 *
 * @package Users
 * @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('auth');
$v = cot_import('v', 'G', 'ALP');
$y = cot_import('y', 'G', 'INT');
$token = cot_import('token', 'G', 'ALP');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('users', 'a');
if ($cfg['users']['disablereg'] && !$usr['isadmin']) {
    cot_die_message(117, TRUE);
}
/* === Hook === */
foreach (cot_getextplugins('users.register.first') as $pl) {
    include $pl;
}
/* ===== */
cot_block($usr['id'] == 0 || $usr['isadmin']);
if ($a == 'add') {
    cot_shield_protect();
    $ruser = array();
    /* === Hook for the plugins === */
    foreach (cot_getextplugins('users.register.add.first') as $pl) {
        include $pl;
    }
    /* ===== */
Exemplo n.º 4
0
        include $pl;
    }
    /* ===== */
    if (!$usr['isadmin'] && ($rowpost['fp_posterid'] != $usr['id'] || $cfg['forums']['edittimeout'] != '0' && $sys['now'] - $rowpost['fp_creation'] > $cfg['forums']['edittimeout'] * 3600)) {
        cot_log('Attempt to edit a post without rights', 'sec');
        cot_die();
    }
    cot_block($usr['auth_read']);
} else {
    cot_die();
}
$is_first_post = $p == $db->query("SELECT fp_id FROM {$db_forum_posts} WHERE fp_topicid = ? ORDER BY fp_id ASC LIMIT 1", array($q))->fetchColumn();
$sql_forums = $db->query("SELECT ft_state, ft_mode, ft_title, ft_desc FROM {$db_forum_topics} WHERE ft_id = {$q} LIMIT 1");
if ($rowt = $sql_forums->fetch()) {
    if ($rowt['ft_state'] && !$usr['isadmin']) {
        cot_die_message(603, true);
    }
} else {
    cot_die(true, true);
}
if ($a == 'update') {
    /* === Hook === */
    foreach (cot_getextplugins('forums.editpost.update.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $rtopic['ft_title'] = cot_import('rtopictitle', 'P', 'TXT', 255);
    $rtopic['ft_desc'] = cot_import('rtopicdesc', 'P', 'TXT', 255);
    $rmsg = array();
    $rmsg['fp_text'] = cot_import('rmsgtext', 'P', 'HTM');
    $rmsg['fp_updater'] = $rowpost['fp_posterid'] == $usr['id'] && $sys['now'] < $rowpost['fp_updated'] + 300 && empty($rowpost['fp_updater']) ? '' : $usr['name'];
Exemplo n.º 5
0
$out['copyright'] = "<a href=\"http://www.cotonti.com\">" . $L['foo_poweredby'] . " Cotonti</a>";
/* ======== Various ======== */
$cot_yesno[0] = $L['No'];
$cot_yesno[1] = $L['Yes'];
/* ======== Local/GMT time ======== */
$usr['timetext'] = cot_build_timezone($usr['timezone']);
$usr['gmttime'] = cot_date('datetime_medium', $sys['now'], false) . ' GMT';
$usr['localtime'] = cot_date('datetime_medium', $sys['now']);
/* ======== Anti-XSS protection ======== */
$x = cot_import('x', 'P', 'ALP');
if (empty($x) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $x = cot_import('x', 'G', 'ALP');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !defined('COT_NO_ANTIXSS') && (!defined('COT_AUTH') && $x != $sys['xk'] && (empty($sys['xk_prev']) || $x != $sys['xk_prev']) || $cfg['referercheck'] && !preg_match('`https?://([^/]+\\.)?' . preg_quote($sys['domain']) . '(/|:|$)`i', $_SERVER['HTTP_REFERER']))) {
    $cot_error = true;
    cot_die_message(950, TRUE, '', '', $_SERVER['HTTP_REFERER']);
}
/* ============ Head Resources ===========*/
if (!COT_AJAX) {
    // May Be move it to header.php?
    if (!isset($cot_rc_html[$theme]) || !$cache || !$cfg['headrc_consolidate'] || defined('COT_ADMIN')) {
        // Load standard resources
        cot_rc_add_standard();
        // Invoke rc handlers
        foreach (cot_getextplugins('rc') as $pl) {
            include $pl;
        }
    }
    if (!defined('COT_ADMIN')) {
        if (file_exists("{$cfg['themes_dir']}/{$usr['theme']}/{$usr['theme']}.rc.php")) {
            include "{$cfg['themes_dir']}/{$usr['theme']}/{$usr['theme']}.rc.php";
Exemplo n.º 6
0
cot_die(empty($s));
/* === Hook === */
foreach (cot_getextplugins('forums.newtopic.first') as $pl) {
    include $pl;
}
/* ===== */
isset($structure['forums'][$s]) || cot_die();
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('forums', $s);
/* === Hook === */
foreach (cot_getextplugins('forums.newtopic.rights') as $pl) {
    include $pl;
}
/* ===== */
cot_block($usr['auth_write']);
if ($structure['forums'][$s]['locked']) {
    cot_die_message(602, true);
}
if ($a == 'newtopic') {
    cot_shield_protect();
    /* === Hook === */
    foreach (cot_getextplugins('forums.newtopic.newtopic.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $rmsg['fp_text'] = cot_import('rmsgtext', 'P', 'HTM');
    $rtopic['ft_title'] = cot_import('rtopictitle', 'P', 'TXT', 255);
    $rtopic['ft_desc'] = cot_import('rtopicdesc', 'P', 'TXT', 255);
    $rtopic['ft_mode'] = (int) (cot_import('rtopicmode', 'P', 'BOL') && $cfg['forums']['cat_' . $s]['allowprvtopics']) ? 1 : 0;
    $rtopic['ft_preview'] = cot_string_truncate($rmsg['fp_text'], 120);
    if (mb_strlen($rtopic['ft_title']) < $cfg['forums']['mintitlelength']) {
        cot_error('forums_titletooshort', 'rtopictitle');
Exemplo n.º 7
0
/**
 * Warn user of shield protection
 *
 */
function cot_shield_protect()
{
    global $sys, $shield_limit, $shield_action, $L;
    if ($shield_limit > $sys['now']) {
        cot_die_message(403, true, $L['shield_title'], cot_rc('shield_protect', array('sec' => $shield_limit - $sys['now'], 'action' => $shield_action)));
    }
}
Exemplo n.º 8
0
$pltitle = array();
if (!empty($path_skin)) {
    $t = new XTemplate($path_skin);
}
$empty = true;
if (is_array($cot_plugins[$exthook])) {
    foreach ($cot_plugins[$exthook] as $k) {
        if ($k['pl_code'] == $extname) {
            $out['plu_title'] = $k['pl_title'];
            include $cfg['plugins_dir'] . '/' . $k['pl_file'];
            $empty = false;
        }
    }
}
if ($empty) {
    cot_die_message(907, TRUE);
}
if (empty($out['subtitle'])) {
    if (empty($L['plu_title'])) {
        $L['plu_title'] = $L[$extname . '_title'];
    }
    $out['subtitle'] = empty($L['plu_title']) ? $out['plu_title'] : $L['plu_title'];
}
$sys['sublocation'] = $out['subtitle'];
if ($ext_display_header) {
    $t_plug = $t;
    require_once $cfg['system_dir'] . '/header.php';
    $t = $t_plug;
}
if ($autoassigntags) {
    array_unshift($pltitle, array(cot_url('plug', "e={$e}"), $out['subtitle']));
Exemplo n.º 9
0
 public function indexAction()
 {
     global $structure;
     $uid = cot_import('uid', 'G', 'INT');
     if (empty($uid)) {
         $uid = cot::$usr['id'];
     }
     // Незарегов, если они не смотрят объявления другого пользователя перенаправляем
     if (!$uid) {
         cot_redirect(cot_url('advboard', '', '', true));
     }
     // Проверить существование пользователя
     $user = cot_user_data($uid);
     if (!$user) {
         cot_die_message(404, TRUE);
     }
     $maxrowsperpage = cot::$cfg['advboard']['cat___default']['maxrowsperpage'];
     if ($maxrowsperpage < 1) {
         $maxrowsperpage = 1;
     }
     list($pg, $d, $durl) = cot_import_pagenav('d', $maxrowsperpage);
     //page number for pages list
     $condition = array(array('user', $uid));
     if (!cot::$usr['isadmin'] && $uid != cot::$usr['id']) {
         $condition[] = array('state', advboard_model_Advert::PUBLISHED);
         $condition[] = array('begin', cot::$sys['now'], '<=');
         $condition[] = array('SQL', "expire = 0 OR expire > " . cot::$sys['now']);
     }
     $order = array(array('state', 'ASC'), array('sort', 'DESC'));
     cot::$out['canonical_uri'] = cot_url('advboard', array('m' => 'user', 'uid' => $uid));
     $urlParams = array('m' => 'user');
     if ($uid != cot::$usr['id']) {
         $urlParams['uid'] = $uid;
     }
     $title = '';
     $crumbs = array();
     if ($uid != cot::$usr['id']) {
         cot::$out['subtitle'] = $title = cot::$L['advboard_user_ads'] . ': ' . cot_user_full_name($user);
         $crumbs[] = array(cot_url("users"), cot::$L['Users']);
         $crumbs[] = array(cot_url("users", "m=details&id=" . $user["user_id"] . "&u=" . $user["user_name"]), cot_user_full_name($user));
         $crumbs[] = cot::$L['advboard_user_ads'];
         //            $advUrlParams['uid']  = $user['user_id'];
         $urlParams['uid'] = $user['user_id'];
     } else {
         cot::$out['subtitle'] = $title = cot::$L['advboard_my_ads'];
         $crumbs[] = array(cot_url('users', array('m' => 'details')), cot::$L['advboard_my_page']);
         $crumbs[] = cot::$L['advboard_my_ads'];
     }
     /* === Hook === */
     foreach (cot_getextplugins('advboard.user.list.query') as $pl) {
         include $pl;
     }
     /* ===== */
     $totallines = advboard_model_Advert::count($condition);
     $advertisement = advboard_model_Advert::find($condition, $maxrowsperpage, $d, $order);
     $addNewUrl = '';
     if ((cot::$usr['auth_write'] || cot::$usr['isadmin']) && !empty($structure['advboard'])) {
         // Ищем категорию куда пользователь может подать оьбъявление
         foreach ($structure['advboard'] as $catCode => $catRow) {
             $auth_write = cot_auth('advboard', $catCode, 'W');
             if ($auth_write) {
                 $addNewUrl = cot_url('advboard', array('a' => 'edit', 'c' => $catCode));
                 break;
             }
         }
     }
     $pagenav = cot_pagenav('advboard', $urlParams, $d, $totallines, $maxrowsperpage);
     if (empty($pagenav['current'])) {
         $pagenav['current'] = 1;
     }
     $breadcrumbs = '';
     if (!empty($crumbs)) {
         $breadcrumbs = cot_breadcrumbs($crumbs, cot::$cfg['homebreadcrumb'], true);
     }
     $template = array('advboard', 'list', 'user');
     $pageUrlParams = $urlParams;
     if ($durl > 1) {
         $pageUrlParams['d'] = $durl;
     }
     $view = new View();
     $view->breadcrumbs = $breadcrumbs;
     $view->page_title = htmlspecialchars($title);
     $view->advertisement = $advertisement;
     $view->allowComments = true;
     $view->totalitems = $totallines;
     $view->pagenav = $pagenav;
     $view->addNewUrl = $addNewUrl;
     $view->urlParams = $urlParams;
     $view->pageUrlParams = $pageUrlParams;
     /* === Hook === */
     foreach (cot_getextplugins('advboard.user.list.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }
Exemplo n.º 10
0
require_once cot_langfile('users', 'module');
/* === Hook === */
foreach (cot_getextplugins('users.edit.first') as $pl) {
    include $pl;
}
/* ===== */
cot_die(empty($id), true);
$sql = $db->query("SELECT * FROM {$db_users} WHERE user_id = ?", $id);
cot_die($sql->rowCount() == 0, true);
$urr = $sql->fetch();
$sql1 = $db->query("SELECT gru_groupid FROM {$db_groups_users} WHERE gru_userid={$id} and gru_groupid=" . COT_GROUP_SUPERADMINS);
$sys['edited_istopadmin'] = $sql1->rowCount() > 0 ? TRUE : FALSE;
$sys['user_istopadmin'] = cot_auth('admin', 'a', 'A');
$sys['protecttopadmin'] = $sys['edited_istopadmin'] && !$sys['user_istopadmin'];
if ($sys['protecttopadmin']) {
    cot_die_message(930, TRUE);
}
if ($a == 'update') {
    cot_check_xg();
    /* === Hook === */
    foreach (cot_getextplugins('users.edit.update.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $ruserdelete = cot_import('ruserdelete', 'P', 'BOL');
    if ($ruserdelete) {
        $sql = $db->delete($db_users, "user_id={$id}");
        $sql = $db->delete($db_groups_users, "gru_userid={$id}");
        foreach ($cot_extrafields[$db_users] as $exfld) {
            cot_extrafield_unlinkfiles($urr['user_' . $exfld['field_name']], $exfld);
        }
Exemplo n.º 11
0
 } else {
     $item_has_rating = false;
     $rating_average = 0;
     $rating_cntround = 0;
 }
 // Check if this user has already voted
 $already_rated = $db->query("SELECT COUNT(*) FROM {$db_rated}\n\t\tWHERE rated_userid = ? AND rated_area = ? AND rated_code = ?", array($usr['id'], $area, $code))->fetchColumn();
 /* == Hook for the plugins == */
 foreach (cot_getextplugins('ratings.send.first') as $pl) {
     include $pl;
 }
 /* ===== */
 if (!$cfg['plugin']['ratings']['ratings_allowchange'] && $already_rated) {
     // Can't vote twice
     if (!COT_AJAX) {
         cot_die_message(403, TRUE);
     }
     exit;
 }
 // Delete previous votes if any
 if ($already_rated) {
     $db->delete($db_rated, 'rated_userid = ? AND rated_area = ? AND rated_code = ?', array($usr['id'], $area, $code));
 }
 // Insert new rating for the item if none is present
 if (!$item_has_rating) {
     $db->insert($db_ratings, array('rating_code' => $code, 'rating_area' => $area, 'rating_state' => 0, 'rating_average' => (int) $newrate, 'rating_creationdate' => (int) $sys['now'], 'rating_text' => ''));
 }
 if ($newrate > 0) {
     // Insert new vote and recalculate average value
     $db->insert($db_rated, array('rated_code' => $code, 'rated_area' => $area, 'rated_userid' => $usr['id'], 'rated_value' => (int) $newrate, 'rated_date' => $sys['now']));
 }
Exemplo n.º 12
0
 public function deleteAction()
 {
     $id = cot_import('id', 'G', 'INT');
     // id Объявления
     $b = cot_import('b', 'G', 'HTM');
     // Куда вернуться
     /* === Hook === */
     foreach (cot_getextplugins('advboard.delete.first') as $pl) {
         include $pl;
     }
     /* ===== */
     // Права на любую категорию доски объявлений
     list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', 'any');
     cot_block(cot::$usr['auth_write']);
     $advert = advboard_model_Advert::getById($id);
     if (!$advert) {
         cot_die_message(404, TRUE);
     }
     if (!cot::$usr['isadmin']) {
         if ($advert->user != cot::$usr['id']) {
             cot_die_message(404, TRUE);
         }
     }
     $title = $advert->title;
     $userId = $advert->user;
     $advert->delete();
     /* === Hook === */
     foreach (cot_getextplugins('advboard.delete.done') as $pl) {
         include $pl;
     }
     /* ===== */
     if (!empty($b)) {
         $b = unserialize(base64_decode($b));
     } elseif (!empty($_SESSION['cot_com_back']) && !empty($_SESSION['cot_com_back']['advboard'])) {
         $b = $_SESSION['cot_com_back']['advboard'];
         unset($_SESSION['cot_com_back']['advboard']);
     }
     if (empty($b)) {
         $b = array('m' => 'user');
         if ($userId != cot::$usr['id']) {
             $b['uid'] = $userId;
         }
     }
     cot_message(sprintf(cot::$L['advboard_deleted'], $title));
     cot_redirect(cot_url('advboard', $b, '', true));
 }
Exemplo n.º 13
0
cot::$db->registerTable('banlist');
$userip = explode('.', $usr['ip']);
$ipmasks = "('" . $userip[0] . '.' . $userip[1] . '.' . $userip[2] . '.' . $userip[3] . "','" . $userip[0] . '.' . $userip[1] . '.' . $userip[2] . ".*','" . $userip[0] . '.' . $userip[1] . ".*.*','" . $userip[0] . ".*.*.*')";
$user_email = $usr['profile']['user_email'];
if ($user_email) {
    $user_email_mask = mb_strstr($user_email, '@');
    $user_email_mask_multi = explode('.', $user_email_mask);
} else {
    $user_email = $user_email_mask = $user_email_mask_multi = '-';
}
$sql = $db->query("SELECT banlist_id, banlist_ip, banlist_reason, banlist_expire, banlist_email\n\tFROM {$db_banlist} WHERE banlist_ip IN " . $ipmasks . " OR banlist_email='" . $db->prep($user_email_mask) . "' OR banlist_email='" . $db->prep($user_email_mask_multi[0]) . "' OR banlist_email='" . $db->prep($user_email) . ($usr['name'] ? "' OR banlist_email='" . $db->prep($usr['name']) : '') . "' LIMIT 1");
if ($sql->rowCount() > 0) {
    $row = $sql->fetch();
    $sql->closeCursor();
    if ($sys['now'] > $row['banlist_expire'] && $row['banlist_expire'] > 0) {
        $sql = $db->delete($db_banlist, "banlist_id='" . $row['banlist_id'] . "' LIMIT 1");
    } else {
        require_once cot_langfile('banlist', 'plug');
        $banlist_email_mask = mb_strpos($row['banlist_email'], '.') ? $row['banlist_email'] : $row['banlist_email'] . '.';
        if ($usr['name'] && $row['banlist_email'] == $usr['name']) {
            $reason = $L['banlist_blocked_login'];
        } elseif ($row['banlist_email']) {
            $reason = $L['banlist_blocked_email'];
        } else {
            $reason = $L['banlist_blocked_ip'];
        }
        $expiretime = $row['banlist_expire'] > 0 ? cot_date('datetime_medium', $row['banlist_expire']) : $L['banlist_foreverbanned'];
        $disp = cot_rc('banlist_banned', array($reason, $row['banlist_reason'], $expiretime));
        cot_die_message(403, true, '', $disp);
    }
}
Exemplo n.º 14
0
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('folio', 'any', 'RWA');
cot_block($usr['auth_read']);
$id = cot_import('id', 'G', 'INT');
$al = $db->prep(cot_import('al', 'G', 'TXT'));
$c = cot_import('c', 'G', 'TXT');
/* === Hook === */
foreach (cot_getextplugins('folio.first') as $pl) {
    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);
Exemplo n.º 15
0
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('forms');
$id = cot_import('id', 'G', 'INT');
$c = cot_import('c', 'G', 'TXT');
if (!empty($c) && !isset($structure['page'][$c])) {
    $c = '';
}
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('page', 'any');
/* === Hook === */
foreach (cot_getextplugins('page.add.first') as $pl) {
    include $pl;
}
/* ===== */
cot_block($usr['auth_write']);
if ($structure['page'][$c]['locked']) {
    cot_die_message(602, TRUE);
}
$sys['parser'] = $cfg['page']['parser'];
$parser_list = cot_get_parsers();
if ($a == 'add') {
    cot_shield_protect();
    /* === Hook === */
    foreach (cot_getextplugins('page.add.add.first') as $pl) {
        include $pl;
    }
    /* ===== */
    $rpage = cot_page_import('POST', array(), $usr);
    list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('page', $rpage['page_cat']);
    cot_block($usr['auth_write']);
    /* === Hook === */
    foreach (cot_getextplugins('page.add.add.import') as $pl) {
Exemplo n.º 16
0
<?php

/**
 * Page translation tool
 *
 * @package I18n
 * @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');
require_once cot_incfile('forms');
$id = cot_import('id', 'G', 'INT');
$l = cot_import('l', 'G', 'ALP');
if (!$id || $id < 1) {
    cot_die_message(404);
}
/* === Hook === */
foreach (cot_getextplugins('i18n.page.first') as $pl) {
    include $pl;
}
/* =============*/
$stmt = $db->query("SELECT * FROM {$db_pages} WHERE page_id = {$id}");
if ($id > 0 && $stmt->rowCount() == 1) {
    $pag = $stmt->fetch();
    $stmt->closeCursor();
    $stmt = $db->query("SELECT * FROM {$db_i18n_pages} WHERE ipage_id = ? AND ipage_locale = ?", array($id, $i18n_locale));
    $pag_i18n = $stmt->rowCount() == 1 ? $stmt->fetch() : false;
    $stmt->closeCursor();
    if ($a == 'add' && !$pag_i18n) {
        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
Exemplo n.º 17
0
 /**
  * Отписаться от рассылки
  */
 public function unsubscribeAction()
 {
     $code = cot_import('code', 'G', 'TXT');
     if (!$code) {
         cot_die_message('404');
     }
     $title = cot::$L['subscribe_unsubscribe'];
     $subscriber = subscribe_model_Subscriber::fetchOne(array(array('unsubscr_code', $code)));
     if (!$subscriber) {
         cot_error(cot::$L['subscribe_err_wrong_unsubscribe_code']);
     }
     cot::$sys['sublocation'] = $title;
     cot::$out['subtitle'] = $title;
     if ($subscriber) {
         $title .= ': ' . $subscriber->subscribe->title;
         cot::$sys['sublocation'] = $title;
         cot::$out['subtitle'] = $title;
         $subscriber->active = 0;
         $subscriber->save();
         cot_message(sprintf(cot::$L['subscribe_msg_you_unsubscribed'], $subscriber->subscribe->title));
     }
     $template = array('subscribe', 'unsubscribe');
     $view = new View();
     $view->page_title = $title;
     $view->subscriber = $subscriber;
     /* === Hook === */
     foreach (cot_getextplugins('subscribe.unsubscribe.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }