本文整理汇总了PHP中_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP _lang函数的具体用法?PHP _lang怎么用?PHP _lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render($block)
{
if (!function_exists('_lang')) {
throw new Exception('You need to define _lang() function in order to use ${lang:...} template construct');
}
return _lang($this->path);
}
示例2: _create_home
//.........这里部分代码省略.........
unset($v['move']);
}
//
$u_tree = _rewrite($tree);
if (count($v)) {
if (isset($v['content']) && $v['content']) {
$v['content'] = str_replace(w('< >'), w('< >'), $v['content']);
}
if ($z['zmode'] == 'create') {
$sql = 'INSERT INTO _tree' . _build_array('INSERT', prefix('tree', $v));
} else {
$sql = 'UPDATE _tree SET ' . _build_array('UPDATE', prefix('tree', $v)) . sql_filter('
WHERE tree_id = ?', $tree['tree_id']);
}
_sql($sql);
if ($z['zmode'] == 'create') {
$u_tree = f($v['alias']) ? $v['alias'] : _nextid();
$sql = 'UPDATE _tree
SET tree_childs = tree_childs + 1
WHERE tree_id = ?';
_sql(sql_filter($sql, $tree['tree_id']));
}
}
redirect(_link($u_tree));
}
//
// Show fieldset
/*$v_fieldset = array(
'subject',
'content',
'description',
'alias',
'child_hide' => 0,
'child_order',
'nav' => 0,
'nav_hide' => 0,
'css_parent',
'css_var',
'quickload' => 0,
'dynamic' => 0,
'tags',
'template',
'redirect',
'allow_comments' => 0,
'approve_comments' => 0,
'form' => 0,
'form_email',
'published'
);
*/
$v_fieldset = array('subject', 'content');
if ($user->v('is_founder')) {
$v_fieldset = array_merge($v_fieldset, array('description', 'alias', 'child_hide' => 0, 'child_order', 'nav' => 0, 'nav_hide' => 0, 'css_parent', 'css_var', 'quickload' => 0, 'dynamic' => 0, 'tags', 'template', 'redirect', 'allow_comments' => 0, 'approve_comments' => 0, 'form' => 0, 'form_email', 'published'));
}
$is_modify = $z['zmode'] == 'modify';
foreach (_array_keys($v_fieldset, '') as $k => $row) {
$name = 'tree_' . $k;
$cp_lang = _lang('CP_' . $k);
$value = $is_modify ? isset($v[$k]) ? $v[$k] : (isset($tree[$name]) ? $tree[$name] : '') : '';
$checked = is_numb($row) && $is_modify && $tree[$name] ? ' checked="checked"' : '';
if (f($value)) {
switch ($k) {
case 'published':
$value = date('d m Y', $value);
break;
}
}
$type = 'text';
if (is_numb($row)) {
$value = 1;
$type = 'checkbox';
}
$tag = 'input';
if ($k == 'content') {
$tag = 'textarea';
}
_style('field', array('NAME' => $k, 'ID' => $k, 'TAG' => $tag, 'TYPE' => $type, 'VALUE' => $value, 'LANG' => $cp_lang, 'CHECKED' => $checked));
if ($k == 'template') {
$i = 0;
$fp = @opendir('./style/custom/');
while ($row_d = @readdir($fp)) {
if (_extension($row_d) != 'htm') {
continue;
}
if (!$i) {
_style('field.templated');
_style('field.templated.row', array('V' => '', 'FILE' => _lang('NONE')));
}
$v_file = str_replace('.htm', '', $row_d);
_style('field.templated.row', array('V' => $v_file, 'FILE' => $v_file));
$i++;
}
@closedir($fp);
}
//
}
$cp_format = !$is_modify ? 'CREATE' : 'MODIFY';
v_style(array('CP_PAGE' => sprintf(_lang('CP_PAGE_' . $cp_format), $tree['tree_subject'])));
return;
}
示例3: attachFile
function attachFile($filename, $mimetype = "application/octet-stream", $szFromAddress, $szFilenameToDisplay)
{
$mime_boundary = "--==================_846811060==_";
$this->msg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . _lang('ENCODING') . "\"\n\n" . $this->msg;
if ($mime_filename) {
$filename = $mime_filename;
$encoded = $this->encode_file($filename);
}
$fd = fopen($filename, "r");
$contents = fread($fd, filesize($filename));
$this->mimeOut = "--" . $mime_boundary . "\n";
$this->mimeOut .= "Content-Type: " . $mimetype . ";\n\tname=\"{$szFilenameToDisplay}\"\n";
$this->mimeOut .= "Content-Transfer-Encoding: quoted-printable\n";
$this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"{$szFilenameToDisplay}\"\n\n";
if ($mimetype == "message/rfc822") {
$this->mimeOut .= "From: " . $szFromAddress . "\n";
$this->mimeOut .= "To: " . $this->emailAddress . "\n";
$this->mimeOut .= "Date: " . date("D, d M Y H:i:s") . " UT\n";
$this->mimeOut .= "Reply-To:" . $szFromAddress . "\n";
$this->mimeOut .= "Subject: " . $this->mailSubject . "\n";
$this->mimeOut .= "X-Mailer: PHP/" . phpversion() . "\n";
$this->mimeOut .= "MIME-Version: 1.0\n";
}
$this->mimeOut .= $contents . "\n";
$this->mimeOut .= "--" . $mime_boundary . "--" . "\n";
return $this->mimeout;
// added -- to notify email client attachment is done
}
示例4: _lang
$template->pparse('body');
if (!defined('IN_PCP')) {
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
}
} else {
// display the page
$page_title = _lang('Search_pm');
if (!defined('IN_PCP')) {
include $phpbb_root_path . 'includes/page_header.' . $phpEx;
}
$template->set_filenames(array('body' => 'privmsga_search_body.tpl'));
privmsg_header($view_user_id, $folder_id, $privmsg_recip_id);
// header
$template->assign_vars(array('L_TITLE' => _lang('Search_pm'), 'L_SEARCH_FOLDER' => _lang('Search_folder'), 'L_SEARCH_FOLDER_EXPLAIN' => _lang('Search_folder_explain'), 'L_SEARCH_AUTHOR' => _lang('Search_recipient'), 'L_SEARCH_AUTHOR_EXPLAIN' => _lang('Search_recipient_explain'), 'L_SEARCH_WORDS' => _lang('Search_words'), 'L_SEARCH_WORDS_EXPLAIN' => _lang('Search_words_explain'), 'L_SUBMIT' => _lang('Submit'), 'L_CANCEL' => _lang('Cancel'), 'L_FIND_USERNAME' => _lang('Find_username'), 'U_SEARCH_USER' => append_sid("search.{$phpEx}?mode=searchuser")));
// data
$s_folders = '<option value="-1">' . _lang('All_folders') . '</option>' . get_folders_list(0, $folder_id);
// vars
$template->assign_vars(array('S_FOLDERS' => $s_folders, 'USERNAME' => empty($username) ? '' : str_replace("''", "'", $username), 'WORDS' => empty($search_words) ? '' : str_replace("''", "'", implode(', ', $search_words))));
// system
_hide(POST_USERS_URL, $view_user_id);
_hide('pmmode', $pmmode);
_hide('sid', $userdata['session_id']);
$template->assign_vars(array('S_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FIELDS' => _hidden_get()));
// send to browser
privmsg_footer();
$template->pparse('body');
if (!defined('IN_PCP')) {
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
}
}
}
示例5: home
public function home()
{
global $core, $user;
$tree = $this->valid_tree();
$v = $this->__(_array_keys(w('is_comment is_form'), 0));
// Form posting enabled and form submitted
if ($v['is_form'] && _button()) {
if (!is_ghost()) {
_fatal(405);
}
if (!$tree['tree_form']) {
_fatal();
}
$sql_fields = 'SELECT form_alias, form_required, form_legend, form_regex,
FROM _form_fields
WHERE form_tree = ?
ORDER BY form_order';
if (!($form = _rowset(sql_filter($sql_fields, $tree['tree_id']), 'form_alias'))) {
$form = _rowset(sql_filter($sql_fields, 0), 'form_alias');
}
$form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => _lang('XCF_LEGEND'));
foreach ($form as $row) {
$v = array_merge($v, $this->__(array($row['form_alias'])));
if (!f($v[$row['form_alias']])) {
if ($row['form_required']) {
$this->_error(sprintf(_lang('E_COMMENT_FIELD_EMPTY'), $row['form_legend']), false);
}
continue;
}
if (f($row['form_regex']) && !preg_match('#' . $row['form_regex'] . '#is', $v[$row['form_alias']])) {
$this->_error(sprintf(_lang('E_COMMENT_FIELD_BAD'), $row['form_legend']), false);
if ($row['form_alias'] == 'secure') {
$v[$row['form_alias']] = '';
}
}
}
require_once XFS . 'core/xcf.php';
$xcf = new captcha();
if ($xcf->check($v['secure']) === false) {
$v['secure'] = '';
$this->_error('#E_COMMENT_INVALID_CAPTCHA');
}
unset($xcf);
require_once XFS . 'core/emailer.php';
$emailer = new emailer();
$emailer->set_decode(true);
$emailer->format('plain');
$emailer->from($v['address']);
$emailer->set_subject(_rm_acute($v['subject']));
$emailer->use_template('contact_email');
if (f($core->v('default_email'))) {
$tree['tree_form_email'] .= (f($tree['tree_form_email']) ? ';' : '') . $core->v('default_email');
}
$form_addresses = array_map('trim', array_unique(explode(';', $tree['tree_form_email'])));
foreach ($form_addresses as $i => $address) {
$row_f = !$i ? 'email_address' : 'cc';
$emailer->{$row_f}($address);
}
unset($v['secure']);
$content = w();
foreach ($form as $row) {
if (!f($v[$row['form_alias']])) {
continue;
}
$content[] = $row['form_legend'] . ":\n" . $v[$row['form_alias']];
}
$emailer->assign_vars(array('CONTENT' => implode("\n\n", $content), 'FORM_ARTICLE' => $tree['tree_subject']));
$emailer->send();
$emailer->reset();
$response = array('lang' => _lang('FORM_SUCCESS'));
$this->e(json_encode($response));
}
// Comment posting enabled and form submitted.
if ($v['is_comment'] && _button()) {
if (!$tree['tree_allow_comments']) {
_fatal();
}
$cv = $this->__(w('comment_username comment_address comment_website comment_message comment_security'));
$comment_time = time();
if (!$user->v('is_member')) {
foreach ($cv as $cv_k => $cv_v) {
if (!f($cv_v)) {
$this->error('E_COMMENT_FILL_FIELDS');
break;
}
}
if (!$this->errors()) {
$sql = 'SELECT comment_time
FROM _comments
WHERE comment_ip = ?
AND comment_status = 0';
if ($row_flood = _fieldrow(sql_filter($sql, $user->ip))) {
if ($comment_time - $row_flood['comment_time'] < 30) {
$this->error('E_COMMENT_FLOOD_TIME');
}
}
}
// CAPTCHA verification
require_once XFS . 'core/xcf.php';
$xcf = new captcha();
//.........这里部分代码省略.........
示例6: _lang
* You can copy this to /app/inc/tpl/site.error.php and update it according to your need.
*
* @package PHPLucidFrame\App
* @since PHPLucidFrame v 1.0.0
* @copyright Copyright (c), PHPLucidFrame.
* @author Sithu K. <cithukyaw@gmail.com>
* @link http://phplucidframe.com
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE
*/
?>
<!DOCTYPE html>
<html lang="<?php
echo _lang();
?>
">
<head>
<title><?php
echo _title('Site Error');
?>
</title>
<?php
include _i('inc/tpl/head.php');
?>
</head>
<body>
<?php
_msg($error->message, isset($error->type) ? $error->type : 'error');
?>
示例7: send_mail
function send_mail($type, $from_userdata, &$to_user_ids, &$recips, $subject, $message, $time = 0, $copy = true, $parsed_values = array())
{
global $db, $board_config, $lang, $phpbb_root_path, $phpEx, $userdata;
// fix some parameters
$subject = trim($subject);
$message = trim($message);
// check we have a message and a subject
if (empty($subject)) {
return 'Empty_subject';
}
if (empty($message)) {
return 'Empty_message';
}
// recipient is not an array, so make one
if (!is_array($to_user_ids) && !empty($to_user_ids)) {
$to_user_ids = array(intval($to_user_ids));
}
// check if recipients
if (empty($to_user_ids)) {
return 'No_to_user';
}
$s_to_user_ids = implode(', ', $to_user_ids);
// censor words
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
// process some cleaning
$subject = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($subject)) : unprepare_message($subject);
$message = count($orig_word) ? preg_replace($orig_word, $replacement_word, unprepare_message($message)) : unprepare_message($message);
// clean any bbcode_uid
$subject = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $subject);
$message = preg_replace('/\\:[0-9a-z\\:]+\\]/si', ']', $message);
// clean HTML
$subject = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $subject);
$message = preg_replace('#(<)([\\/]?.*?)(>)#is', "<\\2>", $message);
// from_user_id can be 0 for sys message (sent by the board)
if (empty($from_userdata)) {
$from_userdata['user_id'] = 0;
$from_userdata['user_level'] = ADMIN;
$from_userdata['username'] = $board_config['sitename'];
}
$from_user_id = intval($from_userdata['user_id']);
// get the recipients
$sql_where = "user_email <> '' AND user_email IS NOT NULL";
// this will require enhancement for the pcp ignore/friend list
if (!$copy) {
$sql_where .= " AND user_id <> " . intval($from_userdata['user_id']);
}
if ($userdata['user_level'] != ADMIN) {
$sql_where .= " AND (user_viewemail = 1 OR user_id = " . intval($userdata['user_id']) . ")";
}
//
// Make sure user wánts the mail
//
$notify_sql = '';
$sql_notify = '';
if ($type == 'privmsg_notify') {
$sql_notify = ', user_notify_pm';
$notify_sql = 'AND user_notify_pm != 0';
}
// read the mail recipients
$sql = "SELECT user_id, user_email, user_lang, username" . $sql_notify . "\n FROM " . USERS_TABLE . "\n WHERE user_id IN ({$s_to_user_ids})\n {$notify_sql}\n AND user_id NOT IN (0, " . ANONYMOUS . ")\n AND {$sql_where}";
if (!($result = $db->sql_query($sql))) {
message_die(GENERAL_ERROR, 'Could not read recipient mail list', '', __LINE__, __FILE__, $sql);
}
$count = 0;
$bcc_list_ary = array();
while ($row = $db->sql_fetchrow($result)) {
$count++;
$bcc_list_ary[$row['user_lang']][] = array('user_id' => $row['user_id'], 'mail' => $row['user_email'], 'username' => $row['username']);
}
if ($count > 0) {
// read the message recipients
$msg_to = '';
if (!empty($recips)) {
for ($i = 0; $i < count($recips); $i++) {
$username = isset($recips[$i]['privmsg_to_username']) ? $recips[$i]['privmsg_to_username'] : $recips[$i]['username'];
if (!empty($username)) {
$msg_to .= (empty($msg_to) ? '' : ', ') . $username;
}
}
}
//
// Let's do some checking to make sure that mass mail functions
// are working in win32 versions of php.
//
if (preg_match('/[c-z]:\\\\.*/i', getenv('PATH')) && !$board_config['smtp_delivery']) {
$ini_val = @phpversion() >= '4.0.0' ? 'ini_get' : 'get_cfg_var';
// We are running on windows, force delivery to use our smtp functions
// since php's are broken by default
$board_config['smtp_delivery'] = 1;
$board_config['smtp_host'] = @$ini_val('SMTP');
}
// init the mailer
$emailer = new emailer($board_config['smtp_delivery']);
// init server vars
$server_name = trim($board_config['server_name']);
$server_protocol = $board_config['cookie_secure'] ? 'https://' : 'http://';
$server_port = $board_config['server_port'] != 80 ? ':' . trim($board_config['server_port']) . '/' : '/';
// sender script
//.........这里部分代码省略.........
示例8: privmsg_header
$template->set_filenames(array('body' => 'privmsga_body.tpl'));
// send header
privmsg_header($view_user_id, $folder_id);
// send list
privmsg_list($privmsg_rowset, $recips, $folder_id, true, $mark_ids);
// pagination
$page_list = generate_pagination("profile.{$phpEx}?mode=privmsg", $count_in_sub_folder, $board_config['topics_per_page'], $pm_start);
$page_number = sprintf(_lang('Page_of'), floor($start / $board_config['topics_per_page']) + 1, ceil($count_in_sub_folder / $board_config['topics_per_page']));
//$page_list = str_replace('&start', '&start', $page_list);
$page_list = preg_replace("/\\&start\\=(\\d*)/", "javascript:document.post.start.value='\\1'; document.post.submit();", $page_list);
// add marked on other pages
for ($i = 0; $i < count($mark_ids); $i++) {
if (empty($marked_on_this_page) || !in_array($mark_ids[$i], $marked_on_this_page)) {
_hide('mark_ids[]', $mark_ids[$i]);
}
}
_hide('start', $pm_start);
_hide('pmmode', $pmmode);
_hide('folder', $folder_id);
_hide(POST_USERS_URL, $view_user_id);
// mark as not first entrance
_hide('refresh', true);
// system
$template->assign_vars(array('S_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FIELDS' => _hidden_get(), 'L_GOTO_PAGE' => $count_in_sub_folder < $board_config['topics_per_page'] ? '' : _lang('Goto_page'), 'PAGINATION' => $count_in_sub_folder < $board_config['topics_per_page'] ? '' : $page_list, 'PAGE_NUMBER' => $page_number));
}
// send to browser
privmsg_footer();
$template->pparse('body');
if (!defined('IN_PCP')) {
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
}
示例9: array
default:
$icones_sort[] = $i;
break;
}
}
// check if the icon exists
$found = false;
for ($i = 0; $i < count($icones_sort) && !$found; $i++) {
$found = $icones[$icones_sort[$i]]['ind'] == $post_icon;
}
if (!$found) {
$post_icon = 0;
}
// send to template
$template->assign_block_vars('switch_icon_checkbox', array());
$template->assign_vars(array('L_ICON_TITLE' => _lang('post_icon_title')));
// display the icons
$nb_row = intval((count($icones_sort) - 1) / $icon_per_row) + 1;
$offset = 0;
for ($i = 0; $i < $nb_row; $i++) {
$template->assign_block_vars('switch_icon_checkbox.row', array());
for ($j = 0; $j < $icon_per_row && $offset < count($icones_sort); $j++) {
$icon_id = $icones_sort[$offset];
// send to cell or cell_none
$template->assign_block_vars('switch_icon_checkbox.row.cell', array('ICON_ID' => $icones[$icon_id]['ind'], 'ICON_CHECKED' => $post_icon == $icones[$icon_id]['ind'] ? ' checked="checked"' : '', 'ICON_IMG' => get_icon_title($icones[$icon_id]['ind'], 2)));
$offset++;
}
}
}
// system
_hide(POST_USERS_URL, $view_user_id);
示例10: advanced_search_form
protected function advanced_search_form($category)
{
global $user;
$sql = "SELECT *\n\t\t\tFROM _search_tables t, _search_categories c\n\t\t\tWHERE t.table_cat = c.category_id\n\t\t\t\tAND c.category_alias = ?\n\t\t\tORDER BY table_id";
$tables = _rowset(sql_filter($sql, $category));
foreach ($tables as $i => $row) {
_style('search_tables', array('V_VALUE' => $row['table_id'], 'V_NAME' => _lang('TABLES_' . $row['table_alias'])));
if (!$i) {
$sql = 'SELECT *
FROM _search_relation
WHERE relation_table = ?';
$relation = _rowset(sql_filter($sql, $row['table_id']));
foreach ($relation as $row2) {
if ($row2['relation_name'] == 'Grupo') {
$groups = explode(',', $user->auth_groups());
if (count($groups) < 2) {
continue;
}
}
_style('relation_field', array('V_VALUE' => $row2['relation_id'], 'V_NAME' => $row2['relation_name']));
}
}
}
return;
}
示例11: _ticket_home
protected function _ticket_home()
{
global $user, $core;
if (!$core->v('cron_enabled')) {
return $this->e('CRON_DISABLED');
}
foreach (w('mail pop3 emailer htmlparser') as $row) {
require_once XFS . 'core/' . $row . '.php';
}
$pop3 = new pop3();
if (!$pop3->connect($core->v('mail_server'), $core->v('mail_port'))) {
return $this->e('MAIL_NO_CONNECT');
}
if (!($total_mail = $pop3->login('recent:' . $core->v('mail_ticket_login'), $core->v('mail_ticket_key')))) {
return $this->e('MAIL_NEW_MAIL');
}
//
$mail = new _mail();
$emailer = new emailer();
//
if (!($blacklist = $core->cache_load('ticket_blacklist'))) {
$sql = 'SELECT *
FROM _tickets_blacklist
ORDER BY list_id';
$blacklist = $core->cache_store(_rowset($sql, 'list_address', 'list_id'));
}
if (!($ticket_status = $core->cache_load('ticket_status_default'))) {
$sql = 'SELECT status_id
FROM _tickets_status
WHERE status_default = 1';
$ticket_status = $core->cache_store(_field($sql, 'status_id', 0));
}
$sql = 'SELECT group_id, group_email
FROM _groups
ORDER BY group_email';
$groups = _rowset($sql, 'group_email', 'group_id');
$sql = 'SELECT group_email, group_name
FROM _groups
ORDER BY group_email';
$groups_name = _rowset($sql, 'group_email', 'group_name');
$sql = 'SELECT gg.group_email, m.user_email
FROM _groups gg, _groups_members g, _members m
WHERE g.member_mod = ?
AND g.member_uid = m.user_id
AND gg.group_id = g.member_group
ORDER BY m.user_email';
$groups_mods = _rowset(sql_filter($sql, 1), 'group_email', 'user_email', true);
foreach ($groups as $a_group_email => $a_group_id) {
if (!isset($groups_mods[$a_group_email])) {
$groups_mods[$a_group_email] = w();
}
}
$sql = 'SELECT s.a_assoc, s.a_value
FROM _members_fields f, _members_store s
WHERE s.a_field = f.field_id
AND f.field_alias LIKE ?
ORDER BY s.a_value';
$email_alt = _rowset(sql_filter($sql, 'email%'), 'a_value', 'a_assoc');
// Pre mail process
$recv = w();
$now = time();
$line_orig = array(' ');
$line_repl = array(' ');
$_v = w('from from_d to ticket subject body date mod ip spam blacklist reply other');
$_c = w('normal reply other blacklist spam', 0);
for ($i = 1; $i <= $total_mail; $i++) {
foreach ($_v as $row) {
${'recv_' . $row} = 0;
}
$s_header = $mail->parse_header(split("\r\n", implode('', $pop3->top($i))));
$recv_from = $mail->parse_address($s_header['from']);
if (isset($blacklist[$recv_from])) {
$recv_blacklist = 1;
}
if ($recv_from == $core->v('mail_ticket_login')) {
$recv_blacklist = 1;
}
_dvar($s_header['to'], '');
_dvar($s_header['cc'], '');
if (f($s_header['cc'])) {
$s_header['to'] .= (f($s_header['to']) ? ', ' : '') . $s_header['cc'];
}
$to_part = array_map('trim', explode(strpos($s_header['to'], ',') ? ',' : ';', $s_header['to']));
foreach ($to_part as $row) {
if (strpos($row, '<') !== false) {
$row = preg_replace('#.*?<(.*?)>#is', '\\1', $row);
}
if (isset($blacklist[$row])) {
$recv_blacklist = 1;
} else {
$recv_blacklist = 0;
$row_first = array_key(explode('@', $row), 0);
if (isset($groups[$row_first])) {
$recv_to = $row_first;
}
}
}
if (strstr($s_header['to'], _lang('MAIL_TO_UNKNOWN')) !== false) {
$recv_to = array_key(explode('@', $core->v('mail_ticket_login')), 0);
}
//.........这里部分代码省略.........
示例12: process
public function process($filepath, $files, $extension, $filesize, $safe = true)
{
$umask = umask(0);
if (!($files = $this->_merge($files))) {
return $this->error('UPLOAD_NO_FILES');
}
foreach ($files as $i => $row) {
$row['extension'] = _extension($row['name']);
$row['name'] = strtolower($row['name']);
if (!in_array($row['extension'], $extension)) {
return $this->error(sprintf(_lang('UPLOAD_INVALID_EXT'), $row['name']), $row['filepath']);
} elseif ($safe && preg_match('/\\.(' . $this->ext_blacklist . ')$/', $row['name'])) {
$row['extension'] = 'txt';
} elseif ($row['size'] > $filesize) {
return $this->error(sprintf(_lang('UPLOAD_TOO_BIG'), $row['name'], $filesize / 1048576), $row['filepath']);
}
$row['random_name'] = time() . '_' . substr(md5(unique_id()), 6);
$row['filename'] = _filename($row['random_name'], $row['extension']);
$row['filepath'] = $filepath . $row['filename'];
if (!@move_uploaded_file($row['tmp_name'], $row['filepath'])) {
return $this->error(sprintf(_lang('UPLOAD_FAILED'), $row['name']), $row['filepath']);
}
$this->chmod($row['filepath']);
if (@filesize($row['filepath']) > $filesize) {
return $this->error(sprintf(_lang('UPLOAD_TOO_BIG'), $row['name'], $filesize / 1048576), $row['filepath']);
}
$files[$i] = $row;
}
@umask($umask);
return count($files) ? $files : false;
}
示例13: _help_add
function _help_add()
{
global $bio, $core;
$error = array();
$sub = $this->control->get_var('sub', '');
$submit = isset($_POST['submit']) ? true : false;
$menu = array('module' => 'CONTROL_COMMENTS_HELP_MODULE', 'cat' => 'CATEGORY', 'faq' => 'FAQ');
switch ($sub) {
case 'cat':
$module_id = 0;
$help_es = '';
$help_en = '';
break;
case 'faq':
$help_id = 0;
$question_es = '';
$question_en = '';
$answer_es = '';
$answer_en = '';
break;
case 'module':
$module_name = '';
break;
default:
_style('menu');
foreach ($menu as $url => $name) {
_style('menu.item', array('URL' => _link_control('comments', array('mode' => $this->mode, 'manage' => $this->manage, 'sub' => $url)), 'TITLE' => _lang($name)));
}
break;
}
if ($submit) {
switch ($sub) {
case 'cat':
$module_id = $this->control->get_var('module_id', 0);
$help_es = $this->control->get_var('help_es', '');
$help_en = $this->control->get_var('help_en', '');
if (empty($help_es) || empty($help_en)) {
$error[] = 'CONTROL_COMMENTS_HELP_EMPTY';
}
// Insert
if (!sizeof($error)) {
$sql_insert = array('help_module' => (int) $module_id, 'help_es' => $help_es, 'help_en' => $help_en);
$sql = 'INSERT INTO _help_cat' . $db->sql_build_array('INSERT', $sql_insert);
}
break;
case 'faq':
$help_id = $this->control->get_var('help_id', 0);
$question_es = $this->control->get_var('question_es', '');
$question_en = $this->control->get_var('question_en', '');
$answer_es = $this->control->get_var('answer_es', '');
$answer_en = $this->control->get_var('answer_en', '');
if (empty($question_es) || empty($question_en) || empty($answer_es) || empty($answer_en)) {
$error[] = 'CONTROL_COMMENTS_HELP_EMPTY';
}
if (!sizeof($error)) {
$sql_insert = array('help_id' => $help_id, 'faq_question_es' => $question_es, 'faq_question_en' => $question_en, 'faq_answer_es' => $answer_es, 'faq_answer_en' => $answer_en);
$sql = 'INSERT INTO _help_faq' . $db->sql_build_array('INSERT', $sql_insert);
}
break;
case 'module':
$module_name = $this->control->get_var('module_name', '');
if (empty($module_name)) {
$error[] = 'CONTROL_COMMENTS_HELP_EMPTY';
}
if (!sizeof($error)) {
$sql_insert = array('module_name' => $module_name);
$sql = 'INSERT INTO _help_modules' . $db->sql_build_array('INSERT', $sql_insert);
}
break;
}
if (!sizeof($error)) {
$db->sql_query($sql);
$cache->unload('help_cat', 'help_faq', 'help_modules');
redirect(_link_control('comments', array('mode' => $this->mode)));
} else {
_style('error', array('MESSAGE' => parse_error($error)));
}
}
$this->nav();
$this->control->set_nav(array('mode' => $this->mode, 'manage' => $this->manage), 'CONTROL_ADD');
$this->control->set_nav(array('mode' => $this->mode, 'manage' => $this->manage, 'sub' => $sub), _lang($menu[$sub]));
$sv = array('SUB' => $sub, 'S_HIDDEN' => _hidden(array('module' => $this->control->module, 'mode' => $this->mode, 'manage' => $this->manage, 'sub' => $sub)));
switch ($sub) {
case 'cat':
$sql = 'SELECT *
FROM _help_modules
ORDER BY module_id';
$result = $db->sql_query($sql);
$select_mod = '';
while ($row = $db->sql_fetchrow($result)) {
$selected = $row['module_id'] == $module_id;
$select_mod .= '<option' . ($selected ? ' class="bold"' : '') . ' value="' . $row['module_id'] . '"' . ($selected ? ' selected' : '') . '>' . $row['module_name'] . '</option>';
}
$db->sql_freeresult($result);
$sv += array('MODULE' => $select_mod, 'HELP_ES' => $help_es, 'HELP_EN' => $help_en);
break;
case 'faq':
$sql = 'SELECT *
FROM _help_cat
ORDER BY help_id';
//.........这里部分代码省略.........
示例14: _url
* Header template file
*/
?>
<div id="wrapper">
<div id="page-container">
<div id="header">
<div class="container clearfix">
<a href="<?php
echo _url('home');
?>
" id="logo">PHPLucidFrame</a>
<div id="language-switcher">
<?php
$languages = _cfg('languages');
foreach ($languages as $lcode => $lname) {
$class = _lang() == $lcode ? 'active' : '';
$url = _self(NULL, $lcode);
?>
<a href="<?php
echo $url;
?>
" class="<?php
echo $class;
?>
">
<span><?php
_image('flags/' . $lcode . '.png', $lname);
?>
</span>
</a>
<?php
示例15: yes_no
public function yes_no($name, $selected = 1) {
global $user;
$selected = (int) $selected;
$class = ($selected) ? 'yes' : 'no';
$html = '<span id="swyn_' . $name . '" class="swyn_' . $class . '">' . _lang(strtoupper($class)) . '</span><input type="hidden" id="tswyn_' . $name . '" name="' . $name . '" value="' . $selected . '" />
<script type="text/javascript">
//<![CDATA[
_.input.radio(\'swyn_' . $name . '\');
//]]>
</script>';
return $html;
}