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');
}
Example #2
0
}
/* ===== */
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);
        }
        if ($o != 'core' && file_exists(cot_incfile($p, $o))) {
            require_once cot_incfile($p, $o);
        }
        /* === Hook  === */
        foreach (cot_getextplugins('admin.config.edit.first') as $pl) {
            include $pl;
        }
        /* ===== */
        if ($a == 'update' && !empty($_POST)) {
            $updated = cot_config_update_options($p, $optionslist, $o);
            $errors = cot_get_messages('', 'error');
            if ($o == 'module' || $o == 'plug') {
                $dir = $o == 'module' ? $cfg['modules_dir'] : $cfg['plugins_dir'];
                // Run configure extension part if present
                if (file_exists($dir . "/" . $p . "/setup/" . $p . ".configure.php")) {
                    include $dir . "/" . $p . "/setup/" . $p . ".configure.php";
                }
Example #3
0
 switch ($score['ukarma_area']) {
     case 'forums':
         require_once cot_incfile('forums', 'module');
         $frm = $db->query("SELECT * FROM {$db_forum_posts} AS fp \n\t\t\t\tLEFT JOIN {$db_forum_topics} AS ft ON fp.fp_topicid=ft.ft_id \n\t\t\t\tWHERE fp.fp_id=" . $score['ukarma_code'])->fetch();
         $page_url = cot_url('forums', 'm=posts&id=' . $score['ukarma_code']);
         $page_title = $frm['ft_title'];
         break;
     case 'page':
         require_once cot_incfile('page', 'module');
         $pag = $db->query("SELECT * FROM {$db_pages} WHERE page_id=" . $score['ukarma_code'])->fetch();
         $page_url = cot_url('page', 'c=' . $pag['page_cat'] . '&id=' . $score['ukarma_code']);
         $page_title = $pag['page_title'];
         break;
     case 'com':
         require_once cot_incfile('comments', 'plug');
         require_once cot_incfile('page', 'module');
         $pag = $db->query("SELECT c.*, p.* FROM {$db_com} AS c LEFT JOIN {$db_pages} AS p ON c.com_code = p.page_id WHERE c.com_id=" . $score['ukarma_code'] . " AND c.com_area='page'")->fetch();
         $page_url = !empty($pag['page_alias']) ? cot_url('page', 'c=' . $pag['page_cat'] . '&al=' . $pag['page_alias']) . "#c" . $score['ukarma_code'] : cot_url('page', 'c=' . $pag['page_cat'] . '&id=' . $pag['page_id']) . "#c" . $score['ukarma_code'];
         $page_title = $pag['page_title'];
         break;
     default:
         $page_url = cot_url('users', 'm=details&id=' . $score['user_id'] . '&u=' . $score['user_name']);
         $page_title = $score['user_name'];
         break;
 }
 $t->assign(array('UKARMA_ROW_URL' => $page_url, 'UKARMA_ROW_TITLE' => $page_title));
 /* === Hook - Part2 : Include === */
 foreach ($extp as $pl) {
     include $pl;
 }
 /* ===== */
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=recentitems.recentpages.first
[END_COT_EXT]
==================== */
/**
 * Joins into the main recentitems query
 *
 * @package Comments
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
global $db_com;
require_once cot_incfile('comments', 'plug');
$join_columns .= ", (SELECT COUNT(*) FROM `{$db_com}` WHERE com_area = 'page' AND com_code = p.page_id) AS com_count";
Example #5
0
define('COT_CODE', TRUE);
define('COT_MESSAGE', TRUE);
define('COT_CORE', TRUE);
require_once './datas/config.php';
require_once $cfg['system_dir'] . '/functions.php';
$env['location'] = 'messages';
$env['ext'] = 'message';
require_once $cfg['system_dir'] . '/cotemplate.php';
require_once $cfg['system_dir'] . '/common.php';
// This trick allows message strings to be overriden in theme langfiles
$temp_L = $L;
require_once cot_langfile('message', 'core');
$L = array_merge($L, $temp_L);
unset($temp_L);
if (defined('COT_ADMIN')) {
    require_once cot_incfile('admin', 'module');
}
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('message', 'a');
//cot_block($usr['auth_read']);
$msg = cot_import('msg', 'G', 'INT');
$num = cot_import('num', 'G', 'INT');
$rc = cot_import('rc', 'G', 'INT');
unset($r, $rd, $ru);
$title = $L['msg' . $msg . '_title'];
$body = $L['msg' . $msg . '_body'];
/* === Hook === */
foreach (cot_getextplugins('message.first') as $pl) {
    include $pl;
}
/* ===== */
switch ($msg) {
<?php

/* ====================
  [BEGIN_COT_EXT]
  Hooks=ajax
  [END_COT_EXT]
  ==================== */
/**
 * news admin usability modification
 *
 * @package news
 * @version 0.7.0
 * @author Cotonti Team
 * @copyright Copyright (c) Cotonti Team 2008-2012
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
$m = cot_import('m', 'G', 'TXT');
// Mode choice
if (!in_array($m, array('thumb'))) {
    $m = 'upload';
}
require_once cot_incfile('mavatars', 'plug', $m);
Example #7
0
<?php

/**
 * Sbr plugin
 *
 * @package sbr
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_langfile('sbr', 'plug');
require_once cot_incfile('sbr', 'plug', 'resources');
// Global variables
global $db_sbr, $db_sbr_stages, $db_sbr_claims, $db_x;
$db_sbr = isset($db_sbr) ? $db_sbr : $db_x . 'sbr';
$db_sbr_stages = isset($db_sbr_stages) ? $db_sbr_stages : $db_x . 'sbr_stages';
$db_sbr_posts = isset($db_sbr_posts) ? $db_sbr_posts : $db_x . 'sbr_posts';
$db_sbr_claims = isset($db_sbr_claims) ? $db_sbr_claims : $db_x . 'sbr_claims';
$db_sbr_files = isset($db_sbr_files) ? $db_sbr_files : $db_x . 'sbr_files';
$cot_extrafields[$db_sbr] = !empty($cot_extrafields[$db_sbr]) ? $cot_extrafields[$db_sbr] : array();
function cot_generate_sbrtags($item_data, $tag_prefix = '', $admin_rights = null, $pagepath_home = false)
{
    global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_sbr, $db_sbr_stages, $sys;
    static $extp_first = null, $extp_main = null;
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('sbrtags.first');
        $extp_main = cot_getextplugins('sbrtags.main');
    }
    /* === Hook === */
Example #8
0
<?php

/**
 * Content Internationalization API
 *
 * @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_langfile('i18n', 'plug');
require_once cot_incfile('i18n', 'plug', 'resources');
cot::$db->registerTable('i18n_locales');
cot::$db->registerTable('i18n_pages');
cot::$db->registerTable('i18n_structure');
/**
 * Builds internationalized category path
 *
 * @param string $area Area code
 * @param string $cat Category code
 * @param string $locale Locale code
 * @return string
 */
function cot_i18n_build_catpath($area, $cat, $locale)
{
    global $structure, $cfg, $i18n_structure;
    $tmp = array();
    $pathcodes = explode('.', $structure[$area][$cat]['path']);
    foreach ($pathcodes as $k => $x) {
        if ($x != 'system') {
            if (empty($i18n_structure[$x][$locale]['title'])) {
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=admin.extrafields.first
[END_COT_EXT]
==================== */
/**
 * Ads board module for Cotonti Siena
 *
 * @package Advert
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright (c) Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('subscribe', 'module');
$extra_whitelist[cot::$db->subscribe] = array('name' => cot::$db->subscribe, 'caption' => cot::$L['Module'] . ' ' . cot::$L['subscribe_subscribe_title'], 'type' => 'module', 'code' => 'subscribe', 'tags' => array());
$extra_whitelist[cot::$db->subscriber] = array('name' => cot::$db->subscriber, 'caption' => cot::$L['Module'] . ' ' . cot::$L['subscribe_subscribe_title'] . ' - ' . cot::$L['subscribe_subscribers'], 'type' => 'module', 'code' => 'subscribe', 'tags' => array());
Example #10
0
 * @license Distributed under BSD license.
 */
defined('COT_CODE') or die('Wrong URL');
global $env;
// pages
if ($env['ext'] == 'page' && $user_data['page_id'] > 0 && $cfg['plugin']['karma']['karma_page_on'] || $user_data['page_id'] > 0 && $user_data['page_state'] == 0) {
    $motive['loc'] = 'pg';
    $motive['id'] = $user_data['page_id'];
}
// forums
if ($env['ext'] == 'forums' && $cfg['plugin']['karma']['karma_frm_on']) {
    global $forum_karma;
    var_dump($forum_karma);
    $motive['loc'] = $forum_karma ? 'frm' : false;
    $motive['id'] = $user_data['fp_id'];
}
// user
if ($env['ext'] == 'users' && $user_data['user_id'] > 0) {
    $motive['loc'] = 'ud';
    $motive['id'] = $user_data['user_id'];
}
// comments
if ($user_data['com_area'] && $user_data['com_id'] > 0 && $cfg['plugin']['karma']['karma_com_on']) {
    $motive['loc'] = $user_data['com_code'] > 0 ? 'com' : false;
    $motive['id'] = $user_data['com_id'];
    $motive['module'] = $user_data['com_area'] . ':id=' . $user_data['com_code'];
}
if (!empty($motive['loc']) && !empty($motive['id'])) {
    require_once cot_incfile('karma', 'plug');
    $temp_array['KARMA'] = karma_gadget($user_data['user_id'], $user_data['user_karma'], $motive['loc'], $motive['id'], $motive['module']);
}
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=comments.send.new
[END_COT_EXT]
==================== */
/**
 * Ads board module for Cotonti Siena
 *
 * @package Advboard
 * @author Kalnov Alexey    <*****@*****.**>
 * @copyright (c) 2015 Portal30 Studio http://portal30.ru
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('advboard', 'module');
$adv_cat = '';
if ($comarray['com_area'] == 'advboard' && cot::$cfg['advboard']['notifyUserNewComment'] == 1 && $comarray['com_code'] > 0) {
    $advert = advboard_model_Advert::getById($comarray['com_code']);
    if ($advert && $advert->issetEmail(true)) {
        // Очистить кеш
        // todo очистка кеша в одном файле с мультихуком
        //        if (ab_inBoardCat($adv_cat) && $cache && $cfg['plugin']['advboard']['recentAdvCacheTime'] > 0) {
        //            /** @var Memcache_driver $ab_CacheDrv  */
        //            $ab_CacheDrv = ab_getCacheDrv();
        //            $cache_key = 'RECENT_ADVS';
        //            $advRealm = COT_DEFAULT_REALM;
        //            $ab_CacheDrv->remove($cache_key, $advRealm);
        //        }
        //Очистить кеш
        $advertUrl = $advert->getUrl();
/**
 * [BEGIN_COT_EXT]
 * Hooks=users.details.tags
 * [END_COT_EXT]
 */
/**
 * 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);
}
<?php

/**
 * pagecattree Plugin for Cotonti CMF
 *
 * @version 2.0.0
 * @author esclkm, http://www.littledev.ru
 * @copyright (c) 2008-2011 esclkm, http://www.littledev.ru
 */
defined('COT_CODE') or die('Wrong URL.');
$tree = $cot_structure->build_tree();
// max
//str_pad
if ($id > 0) {
    require_once cot_incfile('cateditor', 'plug', 'admin.edit');
    $editor = form_structure_editor($id);
} else {
    $parentid = cot_import('parentid', 'G', 'INT');
    require_once cot_incfile('cateditor', 'plug', 'admin.new');
    $editor = form_structure_new($parentid);
}
$t->assign(array('NEWCATEGORY_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&parentid=' . $id), 'RESYNC_URL' => cot_url('admin', 'm=other&p=cateditor&n=' . $n . '&a=resyncall&' . cot_xg()), 'TREE' => $tree, 'EDITOR' => $editor));
Example #14
0
    $prev_branch = 'genoa';
    require_once $cfg['system_dir'] . '/database.php';
    $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();
    $sql_install = @$db->query("SHOW TABLES LIKE '{$db_updates}'");
    if ($sql_install->rowCount() != 1) {
        define('COT_UPGRADE', true);
        $cfg['defaulttheme'] = 'nemesis';
        $cfg['defaultscheme'] = 'default';
    }
    require_once $cfg['system_dir'] . '/common.php';
}
require_once cot_incfile('forms');
require_once cot_incfile('extensions');
require_once cot_langfile('install', 'module');
require_once cot_langfile('users', 'core');
require_once cot_langfile('admin', 'core');
require_once cot_incfile('install', 'module', 'resources');
// Various Generic Vars needed to operate as Normal
$theme = $cfg['defaulttheme'];
$scheme = $cfg['defaultscheme'];
$out['meta_lastmod'] = gmdate('D, d M Y H:i:s');
$file['config'] = './datas/config.php';
$file['config_sample'] = './datas/config-sample.php';
$file['sql'] = './setup/install.sql';
if (!$cfg['new_install']) {
    include cot_incfile('install', 'module', 'update');
} else {
    include cot_incfile('install', 'module', 'install');
}
Example #15
0
/**
 * market module
 *
 * @package market
 * @version 2.5.7
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('market', 'any', 'RWA');
// Requirements
require_once cot_langfile('market', 'module');
require_once cot_incfile('forms');
require_once cot_incfile('extrafields');
// Tables and extras
cot::$db->registerTable('market');
cot_extrafields_register_table('market');
$structure['market'] = is_array($structure['market']) ? $structure['market'] : array();
/**
 * Update market categories counters
 *
 * @param string $cat Cat code
 * @return int
 * @global CotDB $db
 */
function cot_market_sync($cat)
{
    global $db, $db_structure, $db_market, $cache;
    $parent = cot_structure_parents('market', $cat, 'first');
<?php

/**
 * Uninstallation handler
 *
 * @package payprjtop
 * @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_incfile('projects', 'module');
global $db_projects;
// Remove column from table
if ($db->fieldExists($db_projects, "item_top")) {
    $db->query("ALTER TABLE `{$db_projects}` DROP COLUMN `item_top`");
}
Example #17
0
<?php

defined('COT_CODE') or die('Wrong URL');
require_once cot_incfile('userimages', 'plug');
cot_userimages_config_add('avatar', 100, 100, 'fit', true);
cot_userimages_config_add('photo', 200, 300, 'fit', true);
<?php

defined('COT_CODE') or die('Wrong URL');
/* ====================
[BEGIN_COT_EXT]
Hooks=global
[END_COT_EXT]
==================== */
require_once cot_langfile('genderavatar', 'plug');
require_once cot_incfile('genderavatar', 'plug', 'resources');
Example #19
0
<?php

/* ====================
  [BEGIN_COT_EXT]
  Hooks=tools
  [END_COT_EXT]
  ==================== */
/**
 * Admin interface for Contact plugin
 *
 * @package Contact
 * @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('contact', 'plug');
$a = cot_import('a', 'G', 'TXT');
$id = (int) cot_import('id', 'G', 'INT');
list($pg, $d, $durl) = cot_import_pagenav('d', $cfg['maxrowsperpage']);
$rtext = cot_import('rtext', 'P', 'TXT');
if ($a == 'del') {
    $sql_contact_delete = $db->query("SELECT * FROM {$db_contact} WHERE contact_id={$id} LIMIT 1");
    if ($row_contact_delete = $sql_contact_delete->fetch()) {
        $db->delete($db_contact, "contact_id = {$id}");
        foreach ($cot_extrafields[$db_contact] as $exfld) {
            cot_extrafield_unlinkfiles($row_contact_delete['contact_' . $exfld['field_name']], $exfld);
        }
        cot_message('Deleted');
    }
} elseif ($a == 'val') {
    $db->update($db_contact, array('contact_val' => 1), "contact_id = {$id}");
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=standalone
 * [END_COT_EXT]
 */
/**
 * marketorders plugin
 *
 * @package marketorders
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('marketorders', 'plug');
require_once cot_incfile('market', 'module');
require_once cot_incfile('payments', 'module');
require_once cot_incfile('extrafields');
// Mode choice
if (!in_array($m, array('sales', 'purchases', 'addclaim'))) {
    if (isset($_GET['id'])) {
        $m = 'order';
    } else {
        $m = 'neworder';
    }
}
require_once cot_incfile('marketorders', 'plug', $m);
 }
 $cat_selectbox = cot_selectbox($row['structure_tpl'], 'rstructuretplforced[' . $structure_id . ']', array_keys($cat_path), array_values($cat_path), false);
 $t->assign(array('ADMIN_STRUCTURE_UPDATE_DEL_URL' => cot_confirm_url(cot_url('admin', 'm=structure&n=' . $n . '&mode=' . $mode . '&a=delete&id=' . $structure_id . '&c=' . $row['structure_code'] . '&d=' . $durl . '&' . cot_xg()), 'admin'), 'ADMIN_STRUCTURE_ID' => $structure_id, 'ADMIN_STRUCTURE_CODE' => cot_inputbox('text', 'rstructurecode[' . $structure_id . ']', $structure_code, 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_SPACEIMG' => $pathspaceimg, 'ADMIN_STRUCTURE_LEVEL' => $pathfielddep > 0 ? $pathfielddep - 1 : 0, 'ADMIN_STRUCTURE_PATHFIELDIMG' => mb_strpos($row['structure_path'], '.') == 0 ? $R['admin_icon_join1'] : $R['admin_icon_join2'], 'ADMIN_STRUCTURE_PATH' => cot_inputbox('text', 'rstructurepath[' . $structure_id . ']', $row['structure_path'], 'size="12" maxlength="255"'), 'ADMIN_STRUCTURE_TPL_SYM' => $structure_tpl_sym, 'ADMIN_STRUCTURE_TPLMODE' => cot_radiobox($check_tpl, 'rstructuretplmode[' . $structure_id . ']', array('1', '2', '3'), array($L['adm_tpl_empty'], $L['adm_tpl_parent'], $L['adm_tpl_forced']), '', '<br />'), 'ADMIN_STRUCTURE_TPLQUICK' => cot_inputbox('text', 'rstructuretplquick[' . $structure_id . ']', $id > 0 && array_key_exists($row['structure_tpl'], $cat_path) ? '' : $row['structure_tpl'], 'size="10" maxlength="255"'), 'ADMIN_STRUCTURE_TITLE' => cot_inputbox('text', 'rstructuretitle[' . $structure_id . ']', $row['structure_title'], 'size="32" maxlength="255"'), 'ADMIN_STRUCTURE_DESC' => cot_inputbox('text', 'rstructuredesc[' . $structure_id . ']', $row['structure_desc'], 'size="64" maxlength="255"'), 'ADMIN_STRUCTURE_ICON' => cot_inputbox('text', 'rstructureicon[' . $structure_id . ']', $row['structure_icon'], 'size="64" maxlength="128"'), 'ADMIN_STRUCTURE_LOCKED' => cot_checkbox($row['structure_locked'], 'rstructurelocked[' . $structure_id . ']'), 'ADMIN_STRUCTURE_SELECT' => $cat_selectbox, 'ADMIN_STRUCTURE_COUNT' => $row['structure_count'], '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_OPTIONS_URL' => cot_url('admin', 'm=structure&n=' . $n . '&d=' . $durl . '&id=' . $structure_id . '&' . cot_xg()), 'ADMIN_STRUCTURE_ODDEVEN' => cot_build_oddeven($ii)));
 foreach ($cot_extrafields[$db_structure] as $exfld) {
     $exfld_val = cot_build_extrafields('rstructure' . $exfld['field_name'] . '_' . $structure_id, $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($id || !empty($al) ? 'MAIN.OPTIONS.EXTRAFLD' : 'MAIN.DEFAULT.ROW.EXTRAFLD');
 }
 /* === Hook - Part2 : Include === */
 foreach ($extp as $pl) {
     include $pl;
 }
 /* ===== */
 if ($id || !empty($al)) {
     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;
             }
Example #22
0
    $qs = strtr($qs, $cot_translitb);
}
// Results per page
$maxperpage = $cfg['maxrowsperpage'] && is_numeric($cfg['maxrowsperpage']) && $cfg['maxrowsperpage'] > 0 ? $cfg['maxrowsperpage'] : 15;
list($pg, $d, $durl) = cot_import_pagenav('d', $maxperpage);
$dt = (int) cot_import('dt', 'G', 'INT');
// Tags displayed per page in standalone cloud
$perpage = $cfg['plugin']['tags']['perpage'];
// Array to register areas with tag functions provided
$tag_areas = array();
if (cot_module_active('page')) {
    require_once cot_incfile('page', 'module');
    $tag_areas[] = 'pages';
}
if (cot_module_active('forums')) {
    require_once cot_incfile('forums', 'module');
    $tag_areas[] = 'forums';
}
// Sorting order
$o = cot_import('order', 'P', 'ALP');
if (empty($o)) {
    $o = mb_strtolower($cfg['plugin']['tags']['sort']);
}
$tag_order = '';
$tag_orders = array('Title', 'Date', 'Category');
foreach ($tag_orders as $order) {
    $ord = mb_strtolower($order);
    $selected = $ord == $o ? 'selected="selected"' : '';
    $tag_order .= cot_rc('input_option', array('value' => $ord, 'selected' => $selected, 'title' => $L[$order]));
}
/* == Hook for the plugins == */
Example #23
0
 * [BEGIN_COT_EXT]
 * Hooks=standalone
 * [END_COT_EXT]
 */
/**
 * Robox billing Plugin
 *
 * @package roboxbilling
 * @version 1.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('roboxbilling', 'plug');
require_once cot_incfile('payments', 'module');
$m = cot_import('m', 'G', 'ALP');
$pid = cot_import('pid', 'G', 'INT');
if (empty($m)) {
    // Получаем информацию о заказе
    if (!empty($pid) && ($pinfo = cot_payments_payinfo($pid))) {
        cot_block($pinfo['pay_status'] == 'new' || $pinfo['pay_status'] == 'process');
        $url = $cfg['plugin']['roboxbilling']['testmode'] ? 'http://test.robokassa.ru/Index.aspx' : 'https://merchant.roboxchange.com/Index.aspx';
        $mrh_login = $cfg['plugin']['roboxbilling']['mrh_login'];
        $mrh_pass1 = $cfg['plugin']['roboxbilling']['mrh_pass1'];
        $inv_id = $pid;
        $shp_item = !empty($pinfo['pay_code']) ? $pinfo['pay_area'] . '_' . $pinfo['pay_code'] : $pinfo['pay_area'];
        $inv_desc = $pinfo['pay_desc'];
        $in_curr = '';
        $culture = "ru";
        $out_summ = $pinfo['pay_summ'] * $cfg['plugin']['roboxbilling']['rate'];
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=index.tags
 * [END_COT_EXT]
 */
/**
 * User Categories plugin
 *
 * @package usercategories
 * @version 2.5.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('usercategories', 'plug');
$t->assign(array('USERCATEGORIES_CATALOG' => cot_usercategories_tree()));
 * [BEGIN_COT_EXT]
 * Hooks=projects.index.loop
 * [END_COT_EXT]
 */
/**
 * plugin tagslance for Cotonti Siena
 * 
 * @package tagslance
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 *  */
defined('COT_CODE') or die('Wrong URL.');
if ($cfg['plugin']['tagslance']['projects']) {
    require_once cot_incfile('tags', 'plug');
    if (cot_plugin_active('i18n') && $i18n_enabled && $i18n_notmain) {
        $tags_extra = array('tag_locale' => $i18n_locale);
    } else {
        $tags_extra = null;
    }
    $item_id = $item['item_id'];
    if (!isset($tags_rowset_list)) {
        $tags_rowset_list = cot_tag_list(array_keys($sqllist_idset), 'projects', $tags_extra);
    }
    $tags = isset($tags_rowset_list[$item_id]) ? $tags_rowset_list[$item_id] : array();
    if (count($tags) > 0) {
        $tag_i = 0;
        foreach ($tags as $tag) {
            $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
            $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
Example #26
0
/**
 * [BEGIN_COT_EXT]
 * Hooks=standalone
 * [END_COT_EXT]
 */
/**
 * Sbr plugin
 *
 * @package sbr
 * @version 1.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru
 * @license BSD
 */
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
require_once cot_incfile('sbr', 'plug');
require_once cot_incfile('projects', 'module');
require_once cot_incfile('payments', 'module');
require_once cot_incfile('extrafields');
require_once cot_incfile('uploads');
require_once cot_incfile('forms');
// Mode choice
if (!in_array($m, array('add', 'edit'))) {
    if (isset($_GET['id'])) {
        $m = 'main';
    } else {
        $m = 'list';
    }
}
require_once cot_incfile('sbr', 'plug', $m);
Example #27
0
            $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}'");
        /* === 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);
<?php

/**
 * Polls functions
 *
 * @package Polls
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
// Requirements
require_once cot_incfile('forms');
require_once cot_langfile('polls', 'module');
cot::$db->registerTable('polls');
cot::$db->registerTable('polls_options');
cot::$db->registerTable('polls_voters');
/**
 * Adds form for create/edit Poll
 *
 * @param int $id Poll ID or Poll Code if $type is not epmty or new for new Poll
 * @param XTemplate $t Template
 * @param string $block Poll block in Template
 * @param string $type Poll type
 * @return bool
 * @global CotDB $db
 */
function cot_poll_edit_form($id, $t = '', $block = 'MAIN', $type = '')
{
    $id = (int) $id;
    global $db, $cfg, $db_polls, $db_polls_options, $poll_id, $R, $L, $poll_options, $poll_multiple, $poll_state, $poll_text;
    if (gettype($t) != 'object') {
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=projects.add.add.done,projects.edit.update.done
[END_COT_EXT]
==================== */
/**
 * Creates alias when adding or updating a projects
 *
 * @package AutoAlias2lance
 * @copyright CrazyFreeMan (simple-website.in.ua), CMSworks.ru
 */
defined('COT_CODE') or die('Wrong URL');
if ($cfg['plugin']['autoalias2lance']['fl_projects_alias']) {
    if (empty($ritem['item_alias'])) {
        require_once cot_incfile('autoalias2lance', 'plug');
        $ritem['item_alias'] = autoalias2lance_update($ritem['item_title'], $id, 'projects');
    }
}
<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=paytop.done
 * [END_COT_EXT]
 */
/**
 * UserPoints plugin
 *
 * @package userpoints
 * @version 2.0.0
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */
defined('COT_CODE') or die('Wrong URL.');
require_once cot_incfile('userpoints', 'plug');
cot_setuserpoints($cfg['plugin']['userpoints']['top'], 'top', $pay['pay_userid']);