本文整理汇总了PHP中cot_import函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_import函数的具体用法?PHP cot_import怎么用?PHP cot_import使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_import函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cot_star_pm
/**
* Star/Unstar private messages
*
* @param array $message_id messages ids
*
* @return bool true if action sucsessfull
* @global CotDB $db
*/
function cot_star_pm($message_id)
{
global $db, $usr, $db_pm, $cfg;
if (!is_array($message_id)) {
return false;
}
foreach ($message_id as $k => $v) {
$msg[] = (int) cot_import($k, 'D', 'INT');
}
if (count($msg) > 0) {
$msg = '(' . implode(',', $msg) . ')';
$sql = $db->query("SELECT * FROM {$db_pm} WHERE pm_id IN {$msg}");
while ($row = $sql->fetch()) {
$id = $row['pm_id'];
if ($row['pm_fromuserid'] == $usr['id'] && $row['pm_touserid'] == $usr['id']) {
$fromstate = $row['pm_fromstate'] == 2 ? 1 : 2;
$sql2 = $db->update($db_pm, array('pm_tostate' => (int) $fromstate, 'pm_fromstate' => (int) $fromstate), "pm_id = {$id}");
} elseif ($row['pm_touserid'] == $usr['id']) {
$tostate = $row['pm_tostate'] == 2 ? 1 : 2;
$sql2 = $db->update($db_pm, array('pm_tostate' => (int) $tostate), "pm_id = {$id}");
} elseif ($row['pm_fromuserid'] == $usr['id']) {
$fromstate = $row['pm_fromstate'] == 2 ? 1 : 2;
$sql2 = $db->update($db_pm, array('pm_fromstate' => (int) $fromstate), "pm_id = {$id}");
}
}
$sql->closeCursor();
}
return true;
}
示例2: indexAction
public function indexAction()
{
global $structure;
if (!cot_module_active('rss')) {
cot_die_message(404, TRUE);
}
$c = cot_import('c', 'G', 'TXT');
if (!empty($c)) {
if (!isset($structure['advboard'][$c])) {
cot_die_message(404, TRUE);
}
list(cot::$usr['auth_read'], cot::$usr['auth_write'], cot::$usr['isadmin']) = cot_auth('advboard', $c);
cot_block(cot::$usr['auth_read']);
}
$rss_title = cot::$L['advboard_rss_feed'] . cot::$cfg['maintitle'];
$rss_link = cot::$cfg['mainurl'];
$rss_description = cot::$cfg['subtitle'];
$domain = cot::$sys['domain'];
$condition = array(array('state', advboard_model_Advert::PUBLISHED), array('begin', cot::$sys['now'], '<='), array('SQL', "expire = 0 OR expire > " . cot::$sys['now']));
if (!empty($c)) {
$rss_title = cot::$L['advboard_rss_feed'] . $structure['advboard'][$c]['title'] . ' - ' . cot::$cfg['maintitle'];
$condition[] = array('category', $c);
}
$advertisement = advboard_model_Advert::find($condition, cot::$cfg['rss']['rss_maxitems'], 0, array(array('sort', 'desc')));
$t = new XTemplate(cot_tplfile('rss'));
$now = cot::$sys['now'];
$now += cot::$usr['timezone'] * 3600;
$t->assign(array('RSS_ENCODING' => cot::$cfg['rss']['rss_charset'], 'RSS_TITLE' => htmlspecialchars($rss_title), 'RSS_LINK' => $rss_link, 'RSS_LANG' => cot::$cfg['defaultlang'], 'RSS_DESCRIPTION' => htmlspecialchars($rss_description), 'RSS_DATE' => $this->fixPubDate(date("r", $now))));
if (!empty($advertisement)) {
foreach ($advertisement as $advert) {
$url = $advert->url;
if (!cot_url_check($url)) {
$url = COT_ABSOLUTE_URL . $url;
}
$date = '';
if (!empty($advert->created)) {
$date = strtotime($advert->created);
$date += cot::$usr['timezone'] * 3600;
$date = date('r', $date);
$date = $this->fixPubDate($date);
}
$text = $advert->text;
$textlength = intval(cot::$cfg['rss']['rss_pagemaxsymbols']);
if ($textlength > 0 && mb_strlen($text) > $textlength) {
$text = cot_string_truncate($text, $textlength, true, false, cot::$R['advboard_cuttext']);
}
$t->assign(array('RSS_ROW_TITLE' => htmlspecialchars($advert->title), 'RSS_ROW_DESCRIPTION' => $this->convertRelativeUrls($text), 'RSS_ROW_DATE' => $date, 'RSS_ROW_LINK' => $url));
$t->parse('MAIN.ITEM_ROW');
}
}
$t->parse('MAIN');
// ob_clean();
header('Content-type: text/xml; charset=UTF-8');
echo $t->text('MAIN');
exit;
}
示例3: mcaptcha_validate
/**
* Validates captcha input
*
* @param int $res User result
* @return bool
*/
function mcaptcha_validate($res)
{
global $cfg;
// Check anti-hammer
if (time() - $_SESSION['mcaptcha_time'] > $cfg['plugin']['mcaptcha']['delay']) {
// Check salt (form-to-session tie)
if (cot_import('mcaptcha_salt', 'POST', 'ALP') == $_SESSION['mcaptcha_salt']) {
// Check per-result counter
if ($_SESSION['mcaptcha_count'] == 0) {
// Check the result
if ($res == $_SESSION['mcaptcha_res']) {
return TRUE;
}
}
}
}
$_SESSION['mcaptcha_count']++;
return FALSE;
}
示例4: brs_importFile
/**
* Импортировать файл
*/
function brs_importFile($inputname, $oldvalue = '')
{
global $lang, $cot_translit, $brs_allowed_ext, $brs_files_dir, $cfg;
$import = !empty($_FILES[$inputname]) ? $_FILES[$inputname] : array();
$import['delete'] = cot_import('del_' . $inputname, 'P', 'BOL') ? 1 : 0;
// Если пришел файл или надо удалить существующий
if (is_array($import) && !$import['error'] && !empty($import['name'])) {
$fname = mb_substr($import['name'], 0, mb_strrpos($import['name'], '.'));
$ext = mb_strtolower(mb_substr($import['name'], mb_strrpos($import['name'], '.') + 1));
if (!file_exists($brs_files_dir)) {
mkdir($brs_files_dir);
}
//check extension
if (empty($brs_allowed_ext) || in_array($ext, $brs_allowed_ext)) {
if ($lang != 'en') {
require_once cot_langfile('translit', 'core');
$fname = is_array($cot_translit) ? strtr($fname, $cot_translit) : '';
}
$fname = str_replace(' ', '_', $fname);
$fname = preg_replace('#[^a-zA-Z0-9\\-_\\.\\ \\+]#', '', $fname);
$fname = str_replace('..', '.', $fname);
$fname = empty($fname) ? cot_unique() : $fname;
$fname .= file_exists("{$brs_files_dir}/{$fname}.{$ext}") && $oldvalue != $fname . '.' . $ext ? date("YmjGis") : '';
$fname .= '.' . $ext;
$file['old'] = !empty($oldvalue) && ($import['delete'] || $import['tmp_name']) ? $oldvalue : '';
$file['tmp'] = !$import['delete'] ? $import['tmp_name'] : '';
$file['new'] = !$import['delete'] ? $brs_files_dir . $fname : '';
if (!empty($file['old']) && file_exists($file['old'])) {
unlink($file['old']);
}
if (!empty($file['tmp']) && !empty($file['tmp'])) {
move_uploaded_file($file['tmp'], $file['new']);
}
return $file['new'];
} else {
cot_error(cot::$L['brs_err_inv_file_type'], $inputname);
return '';
}
}
}
示例5: cot_url
/* ======== System messages ======== */
/* ======== System messages ======== */
case '916':
$rd = 2;
$ru = cot_url('admin');
break;
case '920':
if (!empty($m)) {
// Load module or plugin langfile
if (file_exists(cot_langfile($m, 'module'))) {
include cot_langfile($m, 'module');
} elseif (file_exists(cot_langfile($m, 'plug'))) {
include cot_langfile($m, 'plug');
}
}
$lng = cot_import('lng', 'G', 'ALP');
if (!empty($lng)) {
// Assign custom message
if (isset($L[$lng])) {
$body = $L[$lng];
}
}
$rc = '920';
break;
case '930':
if ($usr['id'] > 0) {
break;
}
$rd = 2;
if (!empty($redirect)) {
$uri_redirect = base64_decode($redirect);
示例6: defined
* [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'];
if ($cfg['plugin']['roboxbilling']['testmode']) {
$test_string = "&IsTest=1";
示例7: defined
<?php
/**
* mavatars for Cotonti CMF
*
* @version 1.00
* @author esclkm
* @copyright (c) 2013 esclkm
*/
defined('COT_CODE') or die('Wrong URL');
$ext = cot_import('ext', 'G', 'TXT');
$cat = cot_import('cat', 'G', 'TXT');
$code = cot_import('code', 'G', 'TXT');
$id = cot_import('id', 'G', 'INT');
$width = cot_import('width', 'G', 'INT');
$height = cot_import('height', 'G', 'INT');
$resize = cot_import('resize', 'G', 'TXT');
$filter = cot_import('filter', 'G', 'TXT');
$quality = cot_import('quality', 'G', 'INT');
if (empty($quality)) {
$quality = 85;
}
if (empty($resize)) {
$resize = 'crop';
}
$mavatar = new mavatar($ext, $cat, $code, $id);
$mavatars_tags = $mavatar->tags();
$image = $mavatar->thumb($mavatars_tags[1], $width, $height, $resize, $filter, $quality);
header('Content-Type: image/jpeg');
readfile($image);
exit;
示例8: array
}
$where = array();
$order = array();
$where['state'] = "item_state=0";
if (!empty($c)) {
$catsub = cot_structure_children('market', $c);
$where['cat'] = "item_cat IN ('" . implode("','", $catsub) . "')";
}
if (!empty($sq)) {
$words = explode(' ', preg_replace("'\\s+'", " ", $sq));
$sqlsearch = '%' . implode('%', $words) . '%';
$where['search'] = "(item_title LIKE '" . $db->prep($sqlsearch) . "' OR item_text LIKE '" . $db->prep($sqlsearch) . "')";
}
// Extra fields
foreach ($cot_extrafields[$db_market] as $exfld) {
$fld_value = cot_import($exfld['field_name'], 'G', 'TXT');
$fld_value = $db->prep($fld_value);
if (!empty($shfld[$exfld['field_name']])) {
$where[$exfld['field_name']] = "item_" . $exfld['field_name'] . " LIKE '%" . $fld_value . "%'";
}
}
switch ($sort) {
case 'costasc':
$order['cost'] = 'item_cost ASC';
break;
case 'costdesc':
$order['cost'] = 'item_cost DESC';
break;
default:
$order['date'] = 'item_date DESC';
break;
示例9: defined
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}");
cot_message('Updated');
} elseif ($a == 'unval') {
$db->update($db_contact, array('contact_val' => 0), "contact_id = {$id}");
cot_message('Updated');
示例10: defined
/**
* folio module
*
* @package folio
* @version 2.5.2
* @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');
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']);
示例11: foreach
* 3 - deleted message
*/
/* === Hook === */
foreach (cot_getextplugins('pm.list.first') as $pl) {
include $pl;
}
/* ===== */
if (!empty($a)) {
$id = cot_import('id', 'G', 'INT');
// Message id
if ((int) $id > 0) {
$msg[$id] = $id;
}
} else {
$msg = cot_import('msg', 'P', 'ARR');
$a = cot_import('action', 'P', 'TXT');
}
if (count($msg) > 0) {
if ($a == 'delete') {
cot_check_xg();
cot_remove_pm($msg);
} elseif (!empty($a)) {
cot_star_pm($msg);
if (COT_AJAX && (int) $id > 0) {
die;
}
}
}
list($totalsentbox, $totalinbox) = cot_message_count($usr['id']);
$title[] = array(cot_url('pm'), $L['Private_Messages']);
if ($f == 'sentbox') {
示例12: defined
* [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);
}
$where['owner'] = "item_userid=" . $urr['user_id'];
$order['date'] = "item_date DESC";
$wherecount = $where;
示例13: defined
<?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));
示例14: defined
<?php
/**
* [BEGIN_COT_EXT]
* Hooks=users.details.tags
* [END_COT_EXT]
*/
/**
* Reviews plugin
*
* @package reviews
* @version 2.0.0
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL.');
$tab = cot_import('tab', 'G', 'ALP');
$t->assign('REVIEWS', cot_reviews_list($urr['user_id'], 'users', '', 'users', "m=details&id=" . $urr['user_id'] . "&u=" . $urr['user_name'] . "&tab=reviews", '', $cfg['plugin']['reviews']['userall']));
if (!$cfg['plugin']['reviews']['userall']) {
$sqlarea = " AND item_area='users'";
}
$user_reviews_count = $db->query("SELECT COUNT(*) FROM {$db_reviews} WHERE item_touserid=" . (int) $urr['user_id'] . " {$sqlarea}")->fetchColumn();
$t->assign(array('USERS_DETAILS_REVIEWS_COUNT' => $user_reviews_count, "USERS_DETAILS_REVIEWS_URL" => cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name'] . '&tab=reviews')));
示例15: session_start
session_start();
// Getting the server-relative path
$url = parse_url($cfg['mainurl']);
$sys['secure'] = $url['scheme'] == 'https' ? true : false;
$sys['scheme'] = $url['scheme'];
$sys['site_uri'] = $url['path'];
$sys['host'] = $url['host'];
$sys['domain'] = preg_replace('#^www\\.#', '', $url['host']);
if ($sys['site_uri'][mb_strlen($sys['site_uri']) - 1] != '/') {
$sys['site_uri'] .= '/';
}
$sys['port'] = empty($url['port']) ? '' : ':' . $url['port'];
$sys['abs_url'] = $url['scheme'] . '://' . $sys['host'] . $sys['port'] . $sys['site_uri'];
// Installer language selection support
if (empty($_SESSION['cot_inst_lang'])) {
$lang = cot_import('lang', 'P', 'ALP');
if (empty($lang)) {
$lang = cot_lang_determine();
}
} else {
$lang = $_SESSION['cot_inst_lang'];
}
require_once cot_langfile('main', 'core');
require_once $cfg['system_dir'] . '/resources.rc.php';
} else {
$branch = 'siena';
$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();