本文整理汇总了PHP中cot_langfile函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_langfile函数的具体用法?PHP cot_langfile怎么用?PHP cot_langfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_langfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoalias2_convert
/**
* Converts a title into an alias
*
* @param string $title Title
* @param int $id Page ID
* @param bool $duplicate TRUE if duplicate alias was previously detected
* @return string
*/
function autoalias2_convert($title, $id = 0, $duplicate = false)
{
global $cfg, $cot_translit, $cot_translit_custom;
if ($cfg['plugin']['autoalias2']['translit'] && file_exists(cot_langfile('translit', 'core'))) {
include cot_langfile('translit', 'core');
if (is_array($cot_translit_custom)) {
$title = strtr($title, $cot_translit_custom);
} elseif (is_array($cot_translit)) {
$title = strtr($title, $cot_translit);
}
}
$title = preg_replace('#[^\\p{L}0-9\\-_ ]#u', '', $title);
$title = str_replace(' ', $cfg['plugin']['autoalias2']['sep'], $title);
if ($cfg['plugin']['autoalias2']['lowercase']) {
$title = mb_strtolower($title);
}
if ($cfg['plugin']['autoalias2']['prepend_id'] && !empty($id)) {
$title = $id . $cfg['plugin']['autoalias2']['sep'] . $title;
} elseif ($duplicate) {
switch ($cfg['plugin']['autoalias2']['on_duplicate']) {
case 'ID':
if (!empty($id)) {
$title .= $cfg['plugin']['autoalias2']['sep'] . $id;
break;
}
default:
$title .= $cfg['plugin']['autoalias2']['sep'] . rand(2, 99);
break;
}
}
return $title;
}
示例2: cot_send_translated_mail
/**
* Send an email in the recipient's language
*
* @param string $rlang Recipient language
* @param string $remail Recipient email
* @param string $rusername Recipient name
*/
function cot_send_translated_mail($rlang, $remail, $rusername)
{
global $cfg, $usr;
require_once cot_langfile('pm', 'module', $cfg['defaultlang'], $rlang);
if (!$L || !isset($L['pm_notify'])) {
global $L;
}
$rsubject = $L['pm_notifytitle'];
$rbody = sprintf($L['pm_notify'], $rusername, htmlspecialchars($usr['name']), $cfg['mainurl'] . '/' . cot_url('pm', '', '', true));
cot_mail($remail, $rsubject, $rbody);
}
示例3: 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 '';
}
}
}
示例4: defined
/**
* Trashcan interface
*
* @package TrashCan
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') && defined('COT_ADMIN') or die('Wrong URL.');
list($usr['auth_read'], $usr['auth_write'], $usr['isadmin']) = cot_auth('plug', 'trashcan');
cot_block($usr['isadmin']);
require_once cot_incfile('users', 'module');
cot_module_active('page') && (require_once cot_incfile('page', 'module'));
cot_module_active('forums') && (require_once cot_incfile('forums', 'module'));
$cfg['comments'] && (require_once cot_incfile('comments', 'plug'));
require_once cot_incfile('trashcan', 'plug');
require_once cot_langfile('trashcan', 'plug');
$adminhelp = $L['adm_help_trashcan'];
$adminsubtitle = $L['Trashcan'];
$id = cot_import('id', 'G', 'INT');
$maxperpage = $cfg['maxrowsperpage'] && is_numeric($cfg['maxrowsperpage']) && $cfg['maxrowsperpage'] > 0 ? $cfg['maxrowsperpage'] : 15;
list($pg, $d, $durl) = cot_import_pagenav('d', $maxperpage);
$info = $a == 'info' ? 1 : 0;
/* === Hook === */
foreach (cot_getextplugins('trashcan.admin.first') as $pl) {
include $pl;
}
/* ===== */
if ($a == 'wipe') {
cot_check_xg();
/* === Hook === */
foreach (cot_getextplugins('trashcan.admin.wipe') as $pl) {
示例5: defined
<?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));
}
示例6: defined
<?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'])) {
示例7: defined
*
* @package Tags
* @copyright (c) Cotonti Team
* @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
*/
defined('COT_CODE') && defined('COT_PLUG') or die('Wrong URL');
$a = cot_import('a', 'G', 'ALP');
$a = empty($a) ? 'all' : $a;
$qs = cot_import('t', 'G', 'TXT');
if (empty($qs)) {
$qs = cot_import('t', 'P', 'TXT');
}
$qs = str_replace('-', ' ', $qs);
$tl = cot_import('tl', 'G', 'BOL');
if ($tl && file_exists(cot_langfile('translit', 'core'))) {
include_once cot_langfile('translit', 'core');
$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')) {
示例8: defined
<?php
/**
* Payments module
*
* @package payments
* @version 1.1.2
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL');
// Requirements
require_once cot_langfile('payments', 'module');
// Global variables
global $db_payments, $db_payments_services, $db_x;
$db_payments = isset($db_payments) ? $db_payments : $db_x . 'payments';
$db_payments_outs = isset($db_payments_outs) ? $db_payments_outs : $db_x . 'payments_outs';
$db_payments_services = isset($db_payments_services) ? $db_payments_services : $db_x . 'payments_services';
/**
* Удаление услуг с истекщим сроком действия (если установлен параметр service_expire)
*
* @param string $area идентификатор услуги
* @param int $userid id пользователя
* @return bool
*/
function cot_payments_delete_expired_services($area, $userid = null)
{
global $db_payments_services, $db, $sys;
if ($userid > 0) {
$query_string = "AND service_userid=" . $userid;
示例9: cot_page_validate
/**
* Validates page data.
* @param array $rpage Imported page data
* @return boolean TRUE if validation is passed or FALSE if errors were found
*/
function cot_page_validate($rpage)
{
global $cfg, $structure;
cot_check(empty($rpage['page_cat']), 'page_catmissing', 'rpagecat');
if ($structure['page'][$rpage['page_cat']]['locked']) {
global $L;
require_once cot_langfile('message', 'core');
cot_error('msg602_body', 'rpagecat');
}
cot_check(mb_strlen($rpage['page_title']) < 2, 'page_titletooshort', 'rpagetitle');
cot_check(!empty($rpage['page_alias']) && preg_match('`[+/?%#&]`', $rpage['page_alias']), 'page_aliascharacters', 'rpagealias');
$allowemptytext = isset($cfg['page']['cat_' . $rpage['page_cat']]['allowemptytext']) ? $cfg['page']['cat_' . $rpage['page_cat']]['allowemptytext'] : $cfg['page']['cat___default']['allowemptytext'];
cot_check(!$allowemptytext && empty($rpage['page_text']), 'page_textmissing', 'rpagetext');
return !cot_error_found();
}
示例10: defined
<?php
/**
* User Categories plugin
*
* @package usercategories
* @version 2.5.6
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL');
require_once cot_langfile('usercategories', 'plug');
// Global variables
function cot_cfg_usercategories()
{
global $cfg;
$tpaset = str_replace("\r\n", "\n", $cfg['plugin']['usercategories']['catslimit']);
$tpaset = explode("\n", $tpaset);
$paytopset = array();
foreach ($tpaset as $lineset) {
$lines = explode("|", $lineset);
$lines[0] = trim($lines[0]);
$lines[1] = trim($lines[1]);
if ($lines[0] > 0 && $lines[1] > 0) {
$catslimit[$lines[0]] = $lines[1];
}
}
return $catslimit;
}
/**
示例11: safename
/**
* Strips all unsafe characters from file base name and converts it to latin
*
* @param string $name File base name
* @param string $ext File extension
* @param string $savedirectory File path
* @param string $unique_name File path
* @return string
*/
function safename($name, $ext, $savedirectory = '', $unique_name = true)
{
global $lang, $cot_translit, $sys;
if (!$cot_translit && $lang != 'en' && file_exists(cot_langfile('translit', 'core'))) {
require_once cot_langfile('translit', 'core');
}
if ($lang != 'en' && is_array($cot_translit)) {
$name = strtr($name, $cot_translit);
}
$name = str_replace(' ', '_', $name);
$name = preg_replace('#[^a-zA-Z0-9\\-_\\.\\ \\+]#', '', $name);
$name = str_replace('..', '.', $name);
$name = mb_substr($name, 0, 200);
if (empty($name)) {
$name = cot_unique();
}
if ($unique_name && file_exists($this->file_path($savedirectory, $name, $ext))) {
$name .= "_" . cot_date('dmY_His', $sys['now']);
}
if ($unique_name && file_exists($this->file_path($savedirectory, $name, $ext))) {
$name .= "_" . rand(1, 999);
}
return $name;
}
示例12: defined
<?php
/**
* PayPro plugin
*
* @package paypro
* @version 1.0
* @author CMSWorks Team
* @copyright Copyright (c) CMSWorks.ru, littledev.ru
* @license BSD
*/
defined('COT_CODE') or die('Wrong URL');
// Requirements
require_once cot_langfile('paypro', 'plug');
require_once cot_incfile('payments', 'module');
// Global variables
global $db_users_pro, $db_x;
$db_users_pro = isset($db_users_pro) ? $db_users_pro : $db_x . 'users_pro';
function cot_getuserpro($user = '')
{
global $db, $db_users, $sys, $usr;
if (empty($user) && $usr['profile']['user_pro'] > 0) {
$upro = $usr['profile']['user_pro'];
$userid = $usr['id'];
} elseif (!empty($user) && !is_array($user)) {
$upro = $db->query("SELECT user_pro FROM {$db_users} WHERE user_id=" . $user)->fetchColumn();
$userid = $user;
} elseif (is_array($user)) {
$upro = $user['user_pro'];
$userid = $user['user_id'];
}
示例13: cot_import
}
/* ===== */
$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');
}
if (mb_strlen($rmsg['fp_text']) < $cfg['forums']['minpostlength']) {
cot_error('forums_messagetooshort', 'rmsgtext');
}
if (!strpos($structure['forums'][$s]['path'], '.')) {
// Attempting to create a topic in a root category
include cot_langfile('message', 'core');
cot_error($L['msg602_body']);
}
foreach ($cot_extrafields[$db_forum_topics] as $exfld) {
$rtopic['ft_' . $exfld['field_name']] = cot_import_extrafields('rtopic' . $exfld['field_name'], $exfld);
}
foreach ($cot_extrafields[$db_forum_posts] as $exfld) {
$rmsg['fp_' . $exfld['field_name']] = cot_import_extrafields('rmsg' . $exfld['field_name'], $exfld);
}
if (!cot_error_found()) {
if (mb_substr($rtopic['ft_title'], 0, 1) == "#") {
$rtopic['ft_title'] = str_replace('#', '', $rtopic['ft_title']);
}
$rtopic['ft_state'] = 0;
$rtopic['ft_sticky'] = 0;
$rtopic['ft_cat'] = $s;
示例14: defined
<?php
/**
* Ratings API
*
* @package Ratings
* @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('users', 'module');
require_once cot_langfile('ratings', 'plug');
require_once cot_incfile('ratings', 'plug', 'resources');
// Table name globals
cot::$db->registerTable('ratings');
cot::$db->registerTable('rated');
/**
* Generates ratings display for a given item
*
* @param string $ext_name Module or plugin code
* @param string $code Item identifier
* @param string $cat Item category code (optional)
* @param bool $readonly Display as read-only
* @return array Rendered HTML output for ratings and average integer value as an array with 2 elements
* @global CotDB $db
*/
function cot_ratings_display($ext_name, $code, $cat = '', $readonly = false)
{
global $db, $db_ratings, $db_rated, $db_users, $cfg, $usr, $sys, $L, $R;
// Check permissions
示例15: defined
<?php
defined('COT_CODE') or die('Wrong URL');
global $db_users;
require_once cot_langfile('karma', 'plug');
cot_extrafield_add($db_users, 'karma', 'input', $R['input_text'], '', '0', 0, 'HTML', $L['f_karma'], '', '1', false, 'float NOT NULL');
cot_extrafield_add($db_users, 'karma_auth', 'input', $R['input_text'], '', 'NULL', 0, 'HTML', 'karma auth', '', '1', false, 'varchar(255) NULL');