本文整理汇总了PHP中cot_message函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_message函数的具体用法?PHP cot_message怎么用?PHP cot_message使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cot_check_requirements
/**
* Checks all requirements defined for some Extension
*
* @param array $info Extension info array, from setup file header
* @param bool $mute_err_msg (optional) Disable error messages firing
* @param bool $mute_info_msg (optional) Disable success messages. Disabled by default.
* @return boolean Result of check
*
* @see cot_infoget() from `API - Extensions` package
* @uses cot_requirements_satisfied()
*/
function cot_check_requirements($info, $mute_err_msg = false, $mute_info_msg = false)
{
foreach ($info as $key => $constraint) {
if (strpos(trim($key), 'Requires') === 0) {
list(, $package) = explode('_', $key, 2);
$package = $package ?: 'Core';
$package = strtolower($package);
if (in_array($package, array('plugins', 'modules'))) {
// old style requirements check
$list = explode(',', $constraint);
foreach ($list as $extname) {
$extname = trim($extname);
$satisfied = cot_requirements_satisfied(substr($package, 0, -1), '*', $extname);
if (!$satisfied) {
break;
}
}
} else {
// new style constraints
$check_installed = strpos($constraint, '?') === false;
if (!$check_installed) {
$constraint = str_replace('?', '', $constraint);
}
$satisfied = cot_requirements_satisfied($package, $constraint, null, $check_installed);
}
$requirement_str = " {$package}: {$info[$key]}";
if ($satisfied === false) {
$mute_err_msg || cot_error(cot_rc('req_not_satisfied', array('req' => $requirement_str)));
} elseif ($satisfied !== true) {
// get error with constraint
$mute_err_msg || cot_message(cot_rc('req_not_valid', array('req' => $requirement_str, 'error_msg' => $satisfied)), 'warning');
} else {
$mute_info_msg || cot_message(cot_rc('req_satisfied', array('req' => $requirement_str)), 'ok');
}
if ($satisfied !== true) {
return false;
}
// #FIXME comment for test
}
}
//return false; // #FIXME uncomment for test
return true;
}
示例2: mkdir
mkdir($cfg['cache_dir'] . '/' . $sub, $cfg['dir_perms']);
}
}
// Run SQL patches for core
$script = file_get_contents("./setup/{$branch}/patch-{$prev_branch}.sql");
$error = $db->runScript($script);
if (empty($error)) {
cot_message(cot_rc('install_update_patch_applied', array('f' => "setup/{$branch}/patch-{$prev_branch}.sql", 'msg' => 'OK')));
} else {
cot_error(cot_rc('install_update_patch_error', array('f' => "setup/{$branch}/patch-{$prev_branch}.sql", 'msg' => $error)));
}
// Run PHP patches
$ret = (include "./setup/{$branch}/patch-{$prev_branch}.inc");
if ($ret !== false) {
$msg = $ret == 1 ? 'OK' : $ret;
cot_message('install_update_patch_applied', array('f' => "setup/{$branch}/patch-{$prev_branch}.inc", 'msg' => $ret));
} else {
cot_error('install_update_patch_error', array('f' => "setup/{$branch}/patch-{$prev_branch}.inc", 'msg' => $L['Error']));
}
// Unregister modules which have no registration anymore
$db->delete($db_core, "ct_code IN ('comments', 'ratings', 'trash')");
// Set Module versions to Genoa version before upgrade
$db->update($db_core, array('ct_version' => '0.8.99'), '1');
// Update modules
foreach (array('forums', 'index', 'page', 'pfs', 'pm', 'polls', 'users') as $code) {
$ret = cot_extension_install($code, true, true);
if ($ret === false) {
cot_error(cot_rc('ext_update_error', array('type' => $L['Module'], 'name' => $code)));
}
}
// Update installed Siena plugins and uninstall Genoa plugins
示例3: foreach
foreach (cot_getextplugins('trashcan.admin.wipeall') as $pl) {
include $pl;
}
/* ===== */
$sql = $db->query("TRUNCATE {$db_trash}");
cot_message('adm_trashcan_prune');
cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
} elseif ($a == 'restore') {
cot_check_xg();
/* === Hook === */
foreach (cot_getextplugins('trashcan.admin.restore') as $pl) {
include $pl;
}
/* ===== */
cot_trash_restore($id);
cot_message('adm_trashcan_restored');
cot_redirect(cot_url('admin', 'm=other&p=trashcan', '', true));
}
$tr_t = new XTemplate(cot_tplfile($info ? 'trashcan.info.admin' : 'trashcan.admin', 'plug', true));
$totalitems = (int) $db->query("SELECT COUNT(*) FROM {$db_trash} WHERE tr_parentid=0")->fetchColumn();
$pagenav = cot_pagenav('admin', 'm=other&p=trashcan', $d, $totalitems, $maxperpage, 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$sql_query = $info ? "AND tr_id={$id} LIMIT 1" : "ORDER by tr_id DESC LIMIT {$d}, " . $maxperpage;
$sql = $db->query("SELECT t.*, u.user_name FROM {$db_trash} AS t\n\tLEFT JOIN {$db_users} AS u ON t.tr_trashedby=u.user_id\n\tWHERE tr_parentid=0 {$sql_query}");
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('trashcan.admin.loop');
/* ===== */
foreach ($sql->fetchAll() as $row) {
$ii++;
switch ($row['tr_type']) {
case 'comment':
示例4: foreach
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');
} elseif ($a == 'send' && $rtext != '') {
$row = $db->query("SELECT contact_email FROM {$db_contact} WHERE contact_id = {$id}")->fetch();
cot_mail($row['contact_email'], $cfg['mainurl'], $rtext);
$db->update($db_contact, array('contact_reply' => $rtext), "contact_id = {$id}");
cot_message('Done');
}
$adminsubtitle = $L['contact_title'];
$tuman = new XTemplate(cot_tplfile('contact.tools', 'plug', true));
$totallines = $db->query("SELECT COUNT(*) FROM {$db_contact}")->fetchColumn();
$sql = $db->query("SELECT * FROM {$db_contact} ORDER BY contact_val ASC, contact_id DESC LIMIT {$d}, " . $cfg['maxrowsperpage']);
$pagnav = cot_pagenav('admin', 'm=other&p=contact', $d, $totallines, $cfg['maxrowsperpage'], 'd', '', $cfg['jquery'] && $cfg['turnajax']);
$i = 0;
foreach ($sql->fetchAll() as $row) {
$i++;
$shorttext = $row['contact_text'];
$shorttext = cot_string_truncate($shorttext, 150);
$shorttext .= '...';
$val = $row['contact_val'] == 1 ? 'unval' : 'val';
$urlParams = array('m' => 'other', 'p' => 'contact');
$tmp = $urlParams;
示例5: empty
}
/* ===== */
if (!empty($offer_post['post_text']) && (in_array($usr['id'], array($offer['offer_userid'], $item['item_userid'])) || $usr['isadmin']) && !cot_error_found()) {
$db->insert($db_projects_posts, $offer_post);
if ($usr['id'] == $offer['offer_userid']) {
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
$rbody = cot_rc($L['project_added_post_body'], array('user_name' => $item['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
cot_mail($item['user_email'], $rsubject, $rbody);
} else {
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
$rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
cot_mail($offer['user_email'], $rsubject, $rbody);
}
cot_message($L['offers_add_post'], 'ok');
/* === Hook === */
foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
include $pl;
}
/* ===== */
}
cot_redirect(cot_url('projects', 'id=' . $id, '', true));
exit;
}
$t_o = new XTemplate(cot_tplfile(array('projects', 'offers', $structure['projects'][$item['item_cat']]['tpl'])));
// Вычисление выбранного исполнителя по проекту
if ($item['item_performer']) {
$t_o->assign(cot_generate_usertags($item['item_performer'], 'PRJ_PERFORMER_'));
}
$where = array();
示例6: foreach
// Run configure extension part if present
if (file_exists($dir . "/" . $p . "/setup/" . $p . ".configure.php")) {
include $dir . "/" . $p . "/setup/" . $p . ".configure.php";
}
}
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.update.done') as $pl) {
include $pl;
}
/* ===== */
$cache && $cache->clear();
if ($updated) {
$errors ? cot_message('adm_partially_updated', 'warning') : cot_message('Updated');
} else {
if (!$errors) {
cot_message('adm_already_updated');
}
}
} elseif ($a == 'reset' && !empty($v)) {
cot_config_reset($p, $v, $o, '');
$optionslist = cot_config_list($o, $p, '');
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.reset.done') as $pl) {
include $pl;
}
/* ===== */
$cache && $cache->clear();
cot_redirect(cot_url('admin', array('m' => 'config', 'n' => 'edit', 'o' => $o, 'p' => $p), '', true));
}
if ($o == 'core') {
$adminpath[] = array(cot_url('admin', 'm=config'), $L['Configuration']);
示例7: cot_config_update_options
if ($a == 'update' && !empty($_POST)) {
cot_config_update_options($p, $optionslist, $o);
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";
}
}
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.update.done') as $pl) {
include $pl;
}
/* ===== */
$cache && $cache->clear();
cot_message('Updated');
} elseif ($a == 'reset' && !empty($v)) {
cot_config_reset($p, $v, $o, '');
$optionslist = cot_config_list($o, $p, '');
$optionslist[$v]['config_name'] = $optionslist[$v]['config_defaul'];
/* === Hook === */
foreach (cot_getextplugins('admin.config.edit.reset.done') as $pl) {
include $pl;
}
/* ===== */
$cache && $cache->clear();
}
if ($o == 'core') {
$adminpath[] = array(cot_url('admin', 'm=config'), $L['Configuration']);
$adminpath[] = array(cot_url('admin', 'm=config&n=edit&o=' . $o . '&p=' . $p), $L['core_' . $p]);
} else {
示例8: cot_error
/**
* Records an error message to be displayed on results page
*
* @global int $cot_error Global error counter
* @param string $message Message lang string code or full text
* @param string $src Error source identifier, such as field name for invalid input
* @see cot_message()
*/
function cot_error($message, $src = 'default')
{
global $cot_error;
$cot_error ? $cot_error++ : ($cot_error = 1);
cot_message($message, 'error', $src);
}
示例9: fputs
}
// Write the rule to urltrans.dat
fputs($fp, $ut_area[$i] . "\t" . $ut_params[$i] . "\t" . $ut_format[$i] . "\n");
if ($ut_area[$i] == '*' && $ut_params[$i] == '*' && $ut_format[$i] == '{$_area}.php') {
// Default rule doesn't need any rewrite rules
continue;
}
$has_callbacks = false;
if (preg_match('#\\{[\\w_]+\\(\\)\\}#', $ut_format[$i])) {
// Rule with callback, requires custom rewrite
cot_message($L['adm_urls_callbacks'] . ': ' . htmlspecialchars($ut_format[$i]), 'warning');
$has_callbacks = true;
continue;
}
if ($has_callbacks) {
cot_message('adm_urls_errors');
}
// Remove unsets
$ut_format[$i] = preg_replace('#\\{\\!\\$.+?\\}#', '', $ut_format[$i]);
// Set some defaults
$hta_line = $hta_rule . ' ' . $rb;
$format = $ut_format[$i];
$area = $ut_area[$i] == '*' ? $var_pattern : $ut_area[$i];
mb_parse_str($ut_params[$i], $params);
$j = 0;
$k = 0;
$m_count = 0;
$qs = '';
$area_sub = '';
if (preg_match('#^https?\\://([^/]+)/(.*)$#', $format, $mt)) {
// Subdomains support
示例10: deleteAction
public function deleteAction()
{
$id = cot_import('id', 'G', 'INT');
$d = cot_import('d', 'G', 'INT');
$backUrlParams = array('m' => 'subscribe');
if (!empty($d)) {
$backUrlParams['d'] = $d;
}
// Фильтры из списка
$f = cot_import('f', 'G', 'ARR');
if (!empty($f)) {
foreach ($f as $key => $val) {
if ($key == 'id') {
continue;
}
$backUrlParams["f[{$key}]"] = $val;
}
}
$sort = cot_import('s', 'G', 'ALP');
// order field name
$way = cot_import('w', 'G', 'ALP', 4);
// order way (asc, desc)
if ($sort != 'title') {
$backUrlParams['s'] = $sort;
}
if ($way != 'asc') {
$backUrlParams['w'] = $way;
}
if (!$id) {
cot_error(cot::$L['subscribe_err_not_found']);
cot_redirect(cot_url('admin', $backUrlParams));
}
$item = subscribe_model_Subscribe::getById($id);
if (!$item) {
cot_error(cot::$L['subscribe_err_not_found']);
cot_redirect(cot_url('admin', $backUrlParams));
}
$title = $item->title;
$item->delete();
cot_message(sprintf(cot::$L['subscribe_deleted'], $title));
cot_redirect(cot_url('admin', $backUrlParams, '', true));
}
示例11: cot_message
// Empty resource consolidation cache
$db->delete($db_cache, "c_name = 'cot_rc_html'");
} else {
cot_message('Error');
}
} elseif ($a == 'delete') {
$is_id = mb_strpos($id, '/') === false && mb_strpos($id, '\\') === false && $id != '.' && $id != '..';
$is_onlyf = $id == COT_DISKCACHE_ONLYFILES;
if (cot_check_xg() && $is_id && cot_diskcache_clear($cfg['cache_dir'] . ($is_onlyf ? '' : "/{$id}"), !$is_onlyf)) {
cot_message('adm_delcacheitem');
if ($id == 'static' || $is_onlyf) {
// Empty resource consolidation cache
$db->delete($db_cache, "c_name = 'cot_rc_html'");
}
} else {
cot_message('Error');
}
}
$row = cot_diskcache_list();
$cachefiles = $cachesize = 0;
$ii = 0;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('admin.cache.disk.loop');
/* ===== */
foreach ($row as $i => $x) {
$cachefiles += $x[0];
$cachesize += $x[1];
$t->assign(array('ADMIN_DISKCACHE_ITEM_DEL_URL' => cot_url('admin', 'm=cache&s=disk&a=delete&id=' . $i . '&' . cot_xg()), 'ADMIN_DISKCACHE_ITEM_NAME' => $i, 'ADMIN_DISKCACHE_FILES' => $x[0], 'ADMIN_DISKCACHE_SIZE' => $x[1], 'ADMIN_DISKCACHE_ROW_ODDEVEN' => cot_build_oddeven($ii)));
/* === Hook - Part2 : Include === */
foreach ($extp as $pl) {
include $pl;
示例12: unset
$ruser['user_birthdate'] = 'NULL';
} else {
unset($ruser['user_birthdate']);
}
} else {
$ruser['user_birthdate'] = cot_stamp2date($ruser['user_birthdate']);
}
$ruser['user_auth'] = '';
$db->update($db_users, $ruser, "user_id='" . $usr['id'] . "'");
cot_extrafield_movefiles();
/* === Hook === */
foreach (cot_getextplugins('users.profile.update.done') as $pl) {
include $pl;
}
/* ===== */
cot_message('Profile_updated');
cot_redirect(cot_url('users', 'm=profile', '', true));
}
}
$sql = $db->query("SELECT * FROM {$db_users} WHERE user_id='" . $usr['id'] . "' LIMIT 1");
$urr = $sql->fetch();
$out['subtitle'] = $L['Profile'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'profile'), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.profile.main') as $pl) {
include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
示例13: deleteAction
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));
}
示例14: foreach
}
}
// Done
/* === Hook === */
foreach (cot_getextplugins('i18n.structure.update.done') as $pl) {
include $pl;
}
/* =============*/
if ($inserted_cnt > 0) {
cot_message(cot_rc('i18n_items_added', array('cnt' => $inserted_cnt)));
}
if ($updated_cnt > 0) {
cot_message(cot_rc('i18n_items_updated', array('cnt' => $updated_cnt)));
}
if ($removed_cnt > 0) {
cot_message(cot_rc('i18n_items_removed', array('cnt' => $removed_cnt)));
}
cot_redirect(cot_url('plug', "e=i18n&m=structure&l={$i18n_locale}&d={$durl}", '', true));
}
$t = new XTemplate(cot_tplfile('i18n.structure', 'plug'));
// Render table
$ii = 0;
$k = -1;
/* === Hook - Part1 : Set === */
$extp = cot_getextplugins('i18n.structure.loop');
/* ===== */
foreach ($structure['page'] as $code => $row) {
if (cot_i18n_enabled($code)) {
$k++;
if ($k < $d || $ii == $maxperpage) {
continue;
示例15: cot_config_import
/**
* Imports data for config values from outer world
*
* @param string|array $name Name of value or array of names for list of values
* @param string $source Source type
* @param string $filter Filter type
* @param string $defvalue Default value for filtered data
* @see cot_import()
* @return mixed Filtered value of array of values
*/
function cot_config_import($name, $source = 'POST', $filter = 'NOC', $defvalue = null)
{
global $cot_import_filters;
if (!$name) {
return null;
}
if (!is_array($name)) {
$name = array($name);
$single_value = true;
}
$res = array();
foreach ($name as $idx => $value_name) {
$filter_type = is_array($filter) ? $filter[$value_name] ? $filter[$value_name] : ($filter[$idx] ? $filter[$idx] : 'NOC') : $filter;
$not_filtered = cot_import($value_name, $source, 'NOC');
$value = cot_import($value_name, $source, $filter_type);
// addition filtering by varname
if (sizeof($cot_import_filters[$value_name])) {
$value = cot_import($value, 'DIRECT', $value_name);
}
// if invalid value is used
if (is_null($value)) {
$warning_msg = cot_rc('adm_invalid_input', array('value' => $not_filtered, 'field_name' => $value_name));
if (!is_null($defvalue)) {
$value = !is_array($defvalue) ? $defvalue : (isset($defvalue[$value_name]) ? $defvalue[$value_name] : (isset($defvalue[$idx]) ? $defvalue[$idx] : null));
$warning_msg .= '. ' . cot_rc('adm_set_default', $value);
}
cot_message($warning_msg, 'warning', $name . '_int_filter');
}
$res[$value_name] = $value;
}
return $single_value ? $value : $res;
}