Пример #1
0
/**
 * Page API
 *
 * @package Page
 * @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_langfile('page', 'module');
require_once cot_incfile('page', 'module', 'resources');
require_once cot_incfile('forms');
require_once cot_incfile('extrafields');
// Tables and extras
cot::$db->registerTable('pages');
cot_extrafields_register_table('pages');
is_array(cot::$structure['page']) or cot::$structure['page'] = array();
/**
 * Cuts the page after 'more' tag or after the first page (if multipage)
 *
 * @param string $html Page body
 * @return string
 */
function cot_cut_more($html)
{
    $mpos = mb_strpos($html, '<!--more-->');
    if ($mpos === false) {
        $mpos = mb_strpos($html, '[more]');
    }
    if ($mpos === false) {
        $mpos = mb_strpos($html, '<hr class="more" />');
Пример #2
0
 *
 * @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');
    $cats = cot_structure_children('market', $parent, true, true);
    foreach ($cats as $c) {
        $subcats = cot_structure_children('market', $c, true, true);
Пример #3
0
<?php

defined('COT_CODE') or die('Wrong URL.');
if (empty($GLOBALS['db_subscriber'])) {
    cot::$db->registerTable('subscriber');
    cot_extrafields_register_table('subscriber');
}
/**
 * Модель subscribe_model_Subscriber
 *
 * Модель подписчика
 *
 * @method static subscribe_model_Subscriber getById($pk);
 * @method static subscribe_model_Subscriber fetchOne($conditions = array(), $order = '')
 * @method static subscribe_model_Subscriber[] find($conditions = array(), $limit = 0, $offset = 0, $order = '');
 *
 * @property int     $id             id
 * @property subscribe_model_Subscribe   $subscribe Рассылка
 * @property int     $user          id пользователя
 * @property int     $user_group    Группа пользователей (для рассылки всей группе)
 * @property string  $email
 * @property string  $name          Имя получателя
 * @property string  $last_executed Время последней отправки письма по данной подписке.
 * @property string  $last_error    Последняя ошибка при выполнении рассылки
 * @property bool    $active        Включено?
 * @property string  $params        Разное служебное инфо
 * @property string  $ip            ip адрес на момент подписки
 * @property string  $unsubscr_code Код для отписки от рассылки, если подписчик проходит по ссылке "отписаться"
 * @property bool    $email_valid   Email подтвержден?
 * @property string  $email_valid_date Дата подтверждения email'а
 * @property string  $created       Дата создания
Пример #4
0
<?php

/**
 * mavatars for Cotonti CMF
 *
 * @version 1.00
 * @author	esclkm
 * @copyright (c) 2013 esclkm
 */
defined('COT_CODE') or die('Wrong URL');
/* @var $db CotDB */
/* @var $cache Cache */
/* @var $t Xtemplate */
global $db_mavatars, $db_x, $cfg, $R;
cot::$db->registerTable('mavatars');
cot_extrafields_register_table('mavatars');
require_once cot_langfile('mavatars');
require_once cot_incfile('uploads');
require_once cot_incfile('forms');
class mavatar
{
    /**
     * @var array Total mavatar config
     */
    public $config = array();
    /**
     * @var string Extension
     */
    public $extension = '__default';
    /**
     * @var string category
Пример #5
0
<?php

/**
 * Contact Plugin API
 *
 * @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_langfile('contact', 'plug');
require_once cot_incfile('extrafields');
require_once cot_incfile('forms');
cot::$db->registerTable('contact');
cot_extrafields_register_table('contact');
$R['contact_message'] = <<<TXT
{\$sitetitle} - {\$siteurl}

{$L['Sender']}: {\$author} ({\$email})
{$L['Topic']}: {\$subject}
{$L['Message']}:

{\$text}

{\$extra}
TXT
;
Пример #6
0
 * Comments system for Cotonti
 *
 * @package Comments
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
// Requirements
global $R, $L;
require_once cot_incfile('users', 'module');
require_once cot_langfile('comments', 'plug');
require_once cot_incfile('comments', 'plug', 'resources');
require_once cot_incfile('forms');
// Table names
cot::$db->registerTable('com');
cot_extrafields_register_table('com');
/**
 * Returns number of comments for item
 *
 * @param string $ext_name Target extension name
 * @param string $code Item code
 * @param array $row Database row entry (optional)
 * @return int
 * @global CotDB $db
 */
function cot_comments_count($ext_name, $code, $row = array())
{
    global $db, $db_com;
    static $com_cache = array();
    if (isset($com_cache[$ext_name][$code])) {
        return $com_cache[$ext_name][$code];
Пример #7
0
 *
 * @package folio
 * @version 2.5.8
 * @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('folio', 'any', 'RWA');
// Requirements
require_once cot_langfile('folio', 'module');
require_once cot_incfile('forms');
require_once cot_incfile('extrafields');
// Tables and extras
cot::$db->registerTable('folio');
cot_extrafields_register_table('folio');
$structure['folio'] = is_array($structure['folio']) ? $structure['folio'] : array();
/**
 * Update product categories counters
 *
 * @param string $cat Cat code
 * @return int
 * @global CotDB $db
 */
function cot_folio_sync($cat)
{
    global $db, $db_structure, $db_folio, $cache;
    $parent = cot_structure_parents('folio', $cat, 'first');
    $cats = cot_structure_children('folio', $parent, true, true);
    foreach ($cats as $c) {
        $subcats = cot_structure_children('folio', $c, true, true);
Пример #8
0
 * @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('projects', 'any', 'RWA');
// Requirements
require_once cot_langfile('projects', 'module');
require_once cot_incfile('forms');
require_once cot_incfile('extrafields');
// Tables and extras
cot::$db->registerTable('projects');
cot::$db->registerTable('projects_types');
cot::$db->registerTable('projects_offers');
cot::$db->registerTable('projects_posts');
cot_extrafields_register_table('projects');
cot_extrafields_register_table('projects_offers');
$structure['projects'] = is_array($structure['projects']) ? $structure['projects'] : array();
/**
 * Update projects categories counters
 *
 * @param string $cat Cat code
 * @return int
 * @global CotDB $db
 */
function cot_projects_sync($cat)
{
    global $db, $db_structure, $db_projects, $cache;
    $parent = cot_structure_parents('projects', $cat, 'first');
    $cats = cot_structure_children('projects', $parent, true, true);
    foreach ($cats as $c) {
        $subcats = cot_structure_children('projects', $c, true, true);
Пример #9
0
/**
 * User Functions
 *
 * @package Cotonti
 * @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('auth');
require_once cot_langfile('users', 'core');
require_once cot_incfile('users', 'module', 'resources');
require_once cot_incfile('extrafields');
// Extafield globals
cot_extrafields_register_table('users');
/**
 * Adds new user
 *
 * @param array $ruser User data array
 * @param string $email Email address
 * @param string $name User name; defaults to $email if omitted
 * @param string $password Password; randomly generated if omitted
 * @param string $maingrp Custom main grp
 * @param float $sendemail Send email if need activation
 * @return int New user ID or false
 * @global CotDB $db
 */
function cot_add_user($ruser, $email = null, $name = null, $password = null, $maingrp = null, $sendemail = true)
{
    global $cfg, $cot_extrafields, $db, $db_users, $db_groups_users, $db_x, $L, $R, $sys, $uploadfiles, $usr;
Пример #10
0
 *
 * @package Forums
 * @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_langfile('forums', 'module');
require_once cot_incfile('forums', 'module', 'resources');
require_once cot_incfile('extrafields');
// Registering tables and fields
cot::$db->registerTable('forum_posts');
cot::$db->registerTable('forum_topics');
cot::$db->registerTable('forum_stats');
cot_extrafields_register_table('forum_posts');
cot_extrafields_register_table('forum_topics');
/**
 * Builds forum category path
 *
 * @param string $cat Category code
 * @param bool $forumslink Include forums main link
 * @return array
 * @see cot_breadcrumbs()
 */
function cot_forums_buildpath($cat, $forumslink = true)
{
    global $structure, $cfg, $L;
    $tmp = array();
    if ($forumslink) {
        $tmp[] = array(cot_url('forums'), $L['Forums']);
    }
Пример #11
0
<?php

defined('COT_CODE') or die('Wrong URL.');
if (cot_plugin_active('comments') && !function_exists('cot_comments_remove')) {
    require_once cot_incfile('comments', 'plug');
}
if (empty($GLOBALS['db_advboard'])) {
    cot::$db->registerTable('advboard');
    cot_extrafields_register_table('advboard');
}
/**
 * Модель advboard_model_Advert
 *
 * Модель объявления
 *
 * @method static advboard_model_Advert getById($pk);
 * @method static advboard_model_Advert fetchOne($conditions = array(), $order = '')
 * @method static advboard_model_Advert[] find($conditions = array(), $limit = 0, $offset = 0, $order = '');
 *
 * @property int    $id             id
 * @property string $alias          Алияс
 * @property int    $state          Состояние
 *                                      0 - Опубликовано, 1 - на модерации, 2 - Черновик
 * @property string $category       Категория
 * @property double $price          Цена
 * @property string $title          Заголовок
 * @property string $description    Краткое описание
 * @property string $text           Текст
 * @property string $person         Контактное лицо
 * @property string $email          Email для связи, если разместил объявление гость
 * @property regioncity_model_City  $city    Город