本文整理汇总了PHP中attach_message函数的典型用法代码示例。如果您正苦于以下问题:PHP attach_message函数的具体用法?PHP attach_message怎么用?PHP attach_message使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了attach_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: go
/**
* Run the loader, to load up field-restrictions from the XML file.
*
* @param string The default breadcrumbs
* @param string The breadcrumb XML data
*/
function go($current_breadcrumbs, $data)
{
$this->tag_stack = array();
$this->attribute_stack = array();
$this->substitution_current_match_key = NULL;
$this->substitution_current_label = NULL;
$this->links = array();
$this->substitutions = array();
$breadcrumb_tpl = do_template('BREADCRUMB_ESCAPED');
$this->breadcrumb_tpl = $breadcrumb_tpl->evaluate();
$this->current_breadcrumbs = $current_breadcrumbs;
// Create and setup our parser
$xml_parser = @xml_parser_create();
if ($xml_parser === false) {
return;
// PHP5 default build on windows comes with this function disabled, so we need to be able to escape on error
}
xml_set_object($xml_parser, $this);
@xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, get_charset());
@xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
xml_set_element_handler($xml_parser, 'startElement', 'endElement');
xml_set_character_data_handler($xml_parser, 'startText');
// Run the parser
if (@xml_parse($xml_parser, $data, true) == 0) {
attach_message('breadcrumbs.xml: ' . xml_error_string(xml_get_error_code($xml_parser)), 'warn');
return;
}
@xml_parser_free($xml_parser);
}
示例2: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_code('textfiles');
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$lang_none = array_key_exists('lang_none', $map) ? $map['lang_none'] : '0';
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$lang = $lang_none == '1' ? NULL : '';
$file = filter_naughty($file, true);
$new = post_param('new', NULL);
if (!is_null($new)) {
$hooks = find_all_hooks('blocks', 'main_notes');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/blocks/main_notes/' . filter_naughty_harsh($hook));
$ob = object_factory('Hook_notes_' . filter_naughty_harsh($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($file);
}
write_text_file($file, $lang, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = read_text_file($file, $lang, true);
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => 'f737053505de3bd8ccfe806ec014b8fb', 'TITLE' => $title, 'BLOCK_NAME' => 'main_notes', 'MAP' => $map_comcode, 'CONTENTS' => $contents, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'URL' => $post_url));
}
示例3: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_javascript('javascript_realtime_rain');
require_javascript('javascript_ajax');
require_javascript('javascript_more');
require_lang('realtime_rain');
require_css('realtime_rain');
$title = get_page_title('REALTIME_RAIN');
if (!has_js()) {
// Send them to the page permissions screen
$url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
require_code('site2');
assign_refresh($url, 5.0);
return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_REALTIME')));
}
$GLOBALS['TEMPCODE_SETGET']['chrome_frame'] = make_string_tempcode('1');
if (browser_matches('ie6')) {
attach_message(do_lang_tempcode('IE_OLD_PLEASE_UPGRADE'), 'warn');
}
if (!has_js()) {
// Send them to the stats screen
$url = build_url(array('page' => 'admin_stats', 'type' => 'misc'), '_SELF');
require_code('site2');
assign_refresh($url, 5.0);
return do_template('REDIRECT_SCREEN', array('URL' => $url, 'TITLE' => $title, 'TEXT' => do_lang_tempcode('NO_JS_ADVANCED_SCREEN_REALTIME_RAIN')));
}
$min_time = $GLOBALS['SITE_DB']->query_value('stats', 'MIN(date_and_time)');
if (is_null($min_time)) {
$min_time = time();
}
return do_template('REALTIME_RAIN_OVERLAY', array('MIN_TIME' => strval($min_time)));
}
示例4: lookup_member_page
/**
* Get information about the specified member.
*
* @param mixed The member for whom we are getting the page
* @param ?string The member's name (by reference) (NULL: unknown)
* @param ?AUTO_LINK The member's ID (by reference) (NULL: unknown)
* @param ?string The member's IP (by reference) (NULL: unknown)
* @return array The member's stats rows
*/
function lookup_member_page($member, &$name, &$id, &$ip)
{
if (!addon_installed('stats')) {
return array();
}
if (is_numeric($member)) {
// From member ID
$name = $GLOBALS['FORUM_DRIVER']->get_username(intval($member));
if (is_null($name)) {
return array();
}
$id = intval($member);
$ip = $GLOBALS['FORUM_DRIVER']->get_member_ip($id);
if (is_null($ip)) {
$ip = '127.0.0.1';
}
} elseif (strpos($member, '.') !== false || strpos($member, ':') !== false) {
// From IP
$ids = wrap_probe_ip($member);
$ip = $member;
if (is_null($ip)) {
$ip = '127.0.0.1';
}
if (count($ids) == 0) {
return array();
} else {
$id = $ids[0]['id'];
}
if (count($ids) != 1) {
$also = new ocp_tempcode();
foreach ($ids as $t => $_id) {
if ($t != 0) {
if (!$also->is_empty()) {
$also->attach(do_lang('LIST_SEP'));
}
$also->attach($GLOBALS['FORUM_DRIVER']->member_profile_hyperlink($_id['id']));
}
}
attach_message(do_lang_tempcode('MEMBERS_ALSO_ON_IP', $also), 'inform');
}
$name = $GLOBALS['FORUM_DRIVER']->get_username($id);
if (is_null($name)) {
$name = do_lang('UNKNOWN');
}
} else {
// From name
$id = $GLOBALS['FORUM_DRIVER']->get_member_from_username($member);
$name = $member;
if (is_null($id)) {
return array();
}
$ip = $GLOBALS['FORUM_DRIVER']->get_member_ip($id);
if (is_null($ip)) {
$ip = '127.0.0.1';
}
}
return $GLOBALS['SITE_DB']->query('SELECT ip,MAX(date_and_time) AS date_and_time FROM ' . get_table_prefix() . 'stats WHERE the_user=' . strval((int) $id) . ' GROUP BY ip ORDER BY date_and_time DESC');
}
示例5: _do_template
/**
* A template has not been structurally cached, so compile it and store in the cache.
*
* @param ID_TEXT The theme the template is in the context of
* @param PATH The path to the template file
* @param ID_TEXT The codename of the template (e.g. foo)
* @param ID_TEXT The actual codename to use for the template (e.g. thin_foo)
* @param LANGUAGE_NAME The language the template is in the context of
* @param string File type suffix of template file
* @param ?ID_TEXT The theme to cache in (NULL: main theme)
* @return tempcode The compiled tempcode
*/
function _do_template($theme, $path, $codename, $_codename, $lang, $suffix, $theme_orig = NULL)
{
if (is_null($theme_orig)) {
$theme_orig = $theme;
}
$base_dir = ($theme == 'default' && ($suffix != '.css' || strpos($path, '/css_custom') === false) ? get_file_base() : get_custom_file_base()) . '/themes/';
global $CACHE_TEMPLATES, $FILE_ARRAY, $TEMPLATE_PREVIEW_OP, $MEM_CACHE;
if (isset($FILE_ARRAY)) {
$html = unixify_line_format(file_array_get('themes/' . $theme . $path . $codename . $suffix));
} else {
$html = unixify_line_format(file_get_contents($base_dir . filter_naughty($theme . $path . $codename) . $suffix, FILE_TEXT));
}
if (strpos($html, '{$,Parser hint: pure}') !== false) {
return make_string_tempcode(preg_replace('#\\{\\$,.*\\}#U', '/*no minify*/', $html));
}
if ($GLOBALS['SEMI_DEBUG_MODE'] && strpos($html, '.innerHTML') !== false && strpos($html, 'Parser hint: .innerHTML okay') === false) {
require_code('site');
attach_message('Do not use the .innerHTML property in your Javascript because it will not work in true XHTML (when the browsers real XML parser is in action). Use ocPortal\'s global setInnerHTML/getInnerHTML functions.', 'warn');
}
// Strip off trailing final lines from single lines templates. Editors often put these in, and it causes annoying "visible space" issues
if (substr($html, -1, 1) == chr(10) && substr_count($html, chr(10)) == 1) {
$html = substr($html, 0, strlen($html) - 1);
}
if ($TEMPLATE_PREVIEW_OP) {
$test = post_param($codename, NULL);
if (!is_null($test)) {
$html = post_param($test . '_new');
}
}
$result = template_to_tempcode($html, 0, false, $codename, $theme, $lang);
if ($CACHE_TEMPLATES && ($suffix == '.tpl' || $codename == 'no_cache')) {
if (!is_null($MEM_CACHE)) {
persistant_cache_set(array('TEMPLATE', $theme, $lang, $_codename), $result->to_assembly(), strpos($path, 'default/templates/') !== false);
} else {
$path2 = get_custom_file_base() . '/themes/' . $theme_orig . '/templates_cached/' . filter_naughty($lang) . '/';
$myfile = @fopen($path2 . filter_naughty($_codename) . $suffix . '.tcd', 'wb');
if ($myfile === false) {
if (@mkdir($path2, 0777)) {
require_code('files');
fix_permissions($path2, 0777);
} else {
if (file_exists($path2 . filter_naughty($_codename) . $suffix . '.tcd')) {
warn_exit(do_lang_tempcode('WRITE_ERROR', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
} else {
warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', $path2 . filter_naughty($_codename) . $suffix . '.tcd'));
}
}
} else {
fwrite($myfile, $result->to_assembly($lang));
fclose($myfile);
fix_permissions($path2 . filter_naughty($_codename) . $suffix . '.tcd');
}
}
}
return $result;
}
示例6: get_banner_form_fields
/**
* Get the tempcode for the form to add a banner, with the information passed along to it via the parameters already added in.
*
* @param boolean Whether to simplify the banner interface (for the point-store buy process)
* @param ID_TEXT The name of the banner
* @param URLPATH The URL to the banner image
* @param URLPATH The URL to the site the banner leads to
* @param SHORT_TEXT The caption of the banner
* @param LONG_TEXT Any notes associated with the banner
* @param integer The banners "importance modulus"
* @range 1 max
* @param ?integer The number of hits the banner may have (NULL: not applicable for this banner type)
* @range 0 max
* @param SHORT_INTEGER The type of banner (0=permanent, 1=campaign, 2=default)
* @set 0 1 2
* @param ?TIME The banner expiry date (NULL: never expires)
* @param ?ID_TEXT The username of the banners submitter (NULL: current member)
* @param BINARY Whether the banner has been validated
* @param ID_TEXT The banner type (can be anything, where blank means 'normal')
* @param SHORT_TEXT The title text for the banner (only used for text banners, and functions as the 'trigger text' if the banner type is shown inline)
* @return tempcode The input field tempcode
*/
function get_banner_form_fields($simplified = false, $name = '', $image_url = '', $site_url = '', $caption = '', $notes = '', $importancemodulus = 3, $campaignremaining = 50, $the_type = 1, $expiry_date = NULL, $submitter = NULL, $validated = 1, $b_type = '', $title_text = '')
{
require_code('images');
$fields = new ocp_tempcode();
require_code('form_templates');
$fields->attach(form_input_codename(do_lang_tempcode('CODENAME'), do_lang_tempcode('DESCRIPTION_BANNER_NAME'), 'name', $name, true));
$fields->attach(form_input_line(do_lang_tempcode('DESTINATION_URL'), do_lang_tempcode('DESCRIPTION_BANNER_URL'), 'site_url', $site_url, false));
// Blank implies iframe
if (!$simplified) {
$types = nice_get_banner_types($b_type);
if ($types->is_empty()) {
warn_exit(do_lang_tempcode('NO_CATEGORIES'));
}
$fields->attach(form_input_list(do_lang_tempcode('_BANNER_TYPE'), do_lang_tempcode('_DESCRIPTION_BANNER_TYPE'), 'b_type', $types, NULL, false, false));
} else {
$fields->attach(form_input_hidden('b_type', $b_type));
}
if (has_specific_permission(get_member(), 'full_banner_setup')) {
$fields->attach(form_input_username(do_lang_tempcode('OWNER'), do_lang_tempcode('DESCRIPTION_SUBMITTER'), 'submitter', is_null($submitter) ? $GLOBALS['FORUM_DRIVER']->get_username(get_member()) : $submitter, false));
}
if (get_value('disable_staff_notes') !== '1') {
$fields->attach(form_input_text(do_lang_tempcode('NOTES'), do_lang_tempcode('DESCRIPTION_NOTES'), 'notes', $notes, false));
}
if (has_specific_permission(get_member(), 'bypass_validation_midrange_content', 'cms_banners')) {
if ($validated == 0) {
$validated = get_param_integer('validated', 0);
if ($validated == 1) {
attach_message(do_lang_tempcode('WILL_BE_VALIDATED_WHEN_SAVING'));
}
}
if (addon_installed('unvalidated')) {
$fields->attach(form_input_tick(do_lang_tempcode('VALIDATED'), do_lang_tempcode('DESCRIPTION_VALIDATED'), 'validated', $validated == 1));
}
}
$fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('SOURCE_MEDIA'))));
$fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD_BANNER'), 'file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images') . ',swf')));
$fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('IMAGE_URL')), do_lang_tempcode('DESCRIPTION_URL_BANNER'), 'image_url', $image_url, false));
$fields->attach(form_input_line_comcode(do_lang_tempcode('BANNER_TITLE_TEXT'), do_lang_tempcode('DESCRIPTION_BANNER_TITLE_TEXT'), 'title_text', $title_text, false));
$fields->attach(form_input_line_comcode(do_lang_tempcode('DESCRIPTION'), do_lang_tempcode('DESCRIPTION_BANNER_DESCRIPTION'), 'caption', $caption, false));
$fields->attach(do_template('FORM_SCREEN_FIELD_SPACER', array('TITLE' => do_lang_tempcode('DEPLOYMENT_DETERMINATION'))));
if (has_specific_permission(get_member(), 'full_banner_setup')) {
$radios = new ocp_tempcode();
$radios->attach(form_input_radio_entry('the_type', strval(BANNER_PERMANENT), $the_type == BANNER_PERMANENT, do_lang_tempcode('BANNER_PERMANENT')));
$radios->attach(form_input_radio_entry('the_type', strval(BANNER_CAMPAIGN), $the_type == BANNER_CAMPAIGN, do_lang_tempcode('BANNER_CAMPAIGN')));
$radios->attach(form_input_radio_entry('the_type', strval(BANNER_DEFAULT), $the_type == BANNER_DEFAULT, do_lang_tempcode('BANNER_DEFAULT')));
$fields->attach(form_input_radio(do_lang_tempcode('DEPLOYMENT_AGREEMENT'), do_lang_tempcode('DESCRIPTION_BANNER_TYPE'), 'the_type', $radios));
$fields->attach(form_input_integer(do_lang_tempcode('HITS_ALLOCATED'), do_lang_tempcode('DESCRIPTION_HITS_ALLOCATED'), 'campaignremaining', $campaignremaining, false));
$total_importance = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT SUM(importance_modulus) FROM ' . get_table_prefix() . 'banners WHERE ' . db_string_not_equal_to('name', $name));
if (is_null($total_importance)) {
$total_importance = 0;
}
$fields->attach(form_input_integer(do_lang_tempcode('IMPORTANCE_MODULUS'), do_lang_tempcode('DESCRIPTION_IMPORTANCE_MODULUS', strval($total_importance), strval($importancemodulus)), 'importancemodulus', $importancemodulus, true));
}
$fields->attach(form_input_date(do_lang_tempcode('EXPIRY_DATE'), do_lang_tempcode('DESCRIPTION_EXPIRY_DATE'), 'expiry_date', true, is_null($expiry_date), true, $expiry_date, 2));
return $fields;
}
示例7: misc
/**
* The do-next manager for before content management.
*
* @return tempcode The UI
*/
function misc()
{
require_lang('menus');
$also_url = build_url(array('page' => 'cms_chat'), get_module_zone('cms_chat'));
attach_message(do_lang_tempcode('ALSO_SEE_CMS', escape_html($also_url->evaluate())), 'inform');
$this->add_one_label = do_lang_tempcode('ADD_CHATROOM');
$this->edit_this_label = do_lang_tempcode('EDIT_THIS_CHATROOM');
$this->edit_one_label = do_lang_tempcode('EDIT_CHATROOM');
require_code('templates_donext');
return do_next_manager(get_page_title('MANAGE_CHATROOMS'), comcode_lang_string('DOC_CHAT'), array(array('add_one', array('_SELF', array('type' => 'ad'), '_SELF'), do_lang('ADD_CHATROOM')), array('edit_one', array('_SELF', array('type' => 'ed'), '_SELF'), do_lang('EDIT_CHATROOM')), array('delete', array('_SELF', array('type' => 'delete_all'), '_SELF'), do_lang('DELETE_ALL_ROOMS'))), do_lang('MANAGE_CHATROOMS'));
}
示例8: auth_set
function auth_set($member_id, $oauth_url)
{
require_lang('facebook');
require_code('facebook_connect');
global $FACEBOOK_CONNECT;
$code = get_param('code', '', true);
if ($code == '') {
$oauth_redir_url = $FACEBOOK_CONNECT->getLoginUrl(array('redirect_uri' => $oauth_url->evaluate(), 'scope' => array('publish_stream')));
header('Location: ' . $oauth_redir_url);
exit;
}
if (!is_null(get_param('error_reason', NULL))) {
attach_message(do_lang_tempcode('FACEBOOK_OAUTH_FAIL', escape_html(get_param('error_reason'))), 'warn');
return false;
}
// oauth apparently worked
$access_token = $FACEBOOK_CONNECT->getAccessToken();
if (is_null($access_token)) {
attach_message(do_lang_tempcode('FACEBOOK_OAUTH_FAIL', escape_html(do_lang('UNKNOWN'))), 'warn');
return false;
}
if (is_null($member_id)) {
/*$FACEBOOK_CONNECT->setExtendedAccessToken(); Facebook API no longer has this
$FACEBOOK_CONNECT->api('/oauth/access_token', 'POST',
array(
'grant_type'=>'fb_exchange_token',
'client_id'=>get_option('facebook_appid'),
'client_secret'=>get_option('facebook_secret_code'),
'fb_exchange_token'=>$access_token
)
);*/
if (get_option('facebook_uid') == '') {
require_code('config2');
$facebook_uid = $FACEBOOK_CONNECT->getUser();
set_option('facebook_uid', strval($facebook_uid));
}
}
if (strpos($access_token, '|') === false || is_null($member_id)) {
$save_to = 'facebook_oauth_token';
if (!is_null($member_id)) {
$save_to .= '__' . strval($member_id);
}
set_long_value($save_to, $access_token);
}
if (get_page_name() != 'facebook_oauth') {
header('Location: ' . str_replace('&syndicate_start__facebook=1', '', str_replace('oauth_in_progress=1&', 'oauth_in_progress=0&', $oauth_url->evaluate())));
exit;
}
return true;
}
示例9: zip_open
/**
* Open a zip file for reading.
*
* @param PATH The zip file path
* @return mixed The zip file resource (number if error)
*/
function zip_open($zip_file)
{
global $M_ZIP_DIR_HANDLES, $M_ZIP_DIR_OPEN_PATHS;
if (function_exists('set_time_limit')) {
@set_time_limit(200);
}
list($usec, $sec) = explode(' ', microtime(false));
$id = strval(intval($sec) - 1007700000) . str_pad(strval(intval($usec) * 1000000), 6, '0', STR_PAD_LEFT) . str_pad(strval(mt_rand(0, 999)), 3, '0', STR_PAD_LEFT);
$_m_zip_open_file = explode('/', str_replace("\\", '/', $zip_file));
$m_zip_open_file = 'Z' . $id . $_m_zip_open_file[count($_m_zip_open_file) - 1];
$zip_dir = UNZIP_DIR . '/' . $m_zip_open_file . '/';
mkdir($zip_dir, 0777);
$unzip_cmd = UNZIP_CMD;
$unzip_cmd = str_replace('@_SRC_@', '"' . $zip_file . '"', $unzip_cmd);
$unzip_cmd = str_replace('@_DST_@', '"' . $zip_dir . '"', $unzip_cmd);
$bits = explode(' ', UNZIP_CMD);
if (!@file_exists(array_shift($bits))) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => 'SITE'), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_ARCHIVES';
attach_message(do_lang_tempcode('NO_SHELL_ZIP_POSSIBLE2', escape_html($config_url)), 'warn');
return substr(phpversion(), 0, 2) == '4.' ? 20 : constant('ZIPARCHIVE::ER_INTERNAL');
}
$res = -1;
// any nonzero value
$unused_array_result = array();
if (strpos(@ini_get('disable_functions'), 'shell_exec') !== false) {
attach_message(do_lang_tempcode('NO_SHELL_ZIP_POSSIBLE'), 'warn');
return substr(phpversion(), 0, 2) == '4.' ? 20 : constant('ZIPARCHIVE::ER_INTERNAL');
}
$res = shell_exec($unzip_cmd);
// IT IS IMPORTANT THAT YOUR COMMANDLINE ZUNZIP TOOL CORRECTLY SETS RESULT CODE
// result code 0 == NO ERROR as in:
if (is_null($res)) {
m_deldir($zip_dir);
return substr(phpversion(), 0, 2) == '4.' ? 20 : constant('ZIPARCHIVE::ER_INTERNAL');
}
// OTHERWISE, you still have the option of parsing $unused_array_result to find clues of errors
// (lines starting with or "inflating" mean no error)
$m_zip_open_dirs = array(opendir($zip_dir));
$m_zip_dir_paths = array($zip_dir);
$M_ZIP_DIR_HANDLES[$zip_file] = false;
unset($M_ZIP_DIR_HANDLES[$zip_file]);
$M_ZIP_DIR_OPEN_PATHS[$zip_file] = false;
unset($M_ZIP_DIR_OPEN_PATHS[$zip_file]);
return array($zip_file, $m_zip_open_file, $m_zip_open_dirs, $m_zip_dir_paths);
}
示例10: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
require_lang('messaging');
require_code('feedback');
$to = array_key_exists('param', $map) ? $map['param'] : get_option('staff_address');
$post = post_param('post', '');
if (post_param_integer('_comment_form_post', 0) == 1 && $post != '') {
if (addon_installed('captcha')) {
if (get_option('captcha_on_feedback') == '1') {
require_code('captcha');
enforce_captcha();
}
}
$message = new ocp_tempcode();
/*Used to be written out here*/
attach_message(do_lang_tempcode('MESSAGE_SENT'), 'inform');
require_code('mail');
$email_from = trim(post_param('email', $GLOBALS['FORUM_DRIVER']->get_member_email_address(get_member())));
mail_wrap(post_param('title'), $post, array($to), NULL, $email_from, $GLOBALS['FORUM_DRIVER']->get_username(get_member()), 3, NULL, false, get_member());
if ($email_from != '') {
mail_wrap(do_lang('YOUR_MESSAGE_WAS_SENT_SUBJECT', post_param('title')), do_lang('YOUR_MESSAGE_WAS_SENT_BODY', $post), array($email_from), NULL, '', '', 3, NULL, false, get_member());
}
} else {
$message = new ocp_tempcode();
}
$box_title = array_key_exists('title', $map) ? $map['title'] : do_lang('CONTACT_US');
$private = array_key_exists('private', $map) && $map['private'] == '1';
$em = $GLOBALS['FORUM_DRIVER']->get_emoticon_chooser();
require_javascript('javascript_editing');
$comcode_help = build_url(array('page' => 'userguide_comcode'), get_comcode_zone('userguide_comcode', false));
require_javascript('javascript_validation');
$comment_url = get_self_url();
$email_optional = array_key_exists('email_optional', $map) ? intval($map['email_optional']) == 1 : true;
if (addon_installed('captcha')) {
require_code('captcha');
$use_captcha = get_option('captcha_on_feedback') == '1' && use_captcha();
if ($use_captcha) {
generate_captcha();
}
} else {
$use_captcha = false;
}
$comment_details = do_template('COMMENTS_POSTING_FORM', array('JOIN_BITS' => '', 'FIRST_POST_URL' => '', 'FIRST_POST' => '', 'USE_CAPTCHA' => $use_captcha, 'EMAIL_OPTIONAL' => $email_optional, 'POST_WARNING' => '', 'COMMENT_TEXT' => '', 'GET_EMAIL' => !$private, 'GET_TITLE' => !$private, 'EM' => $em, 'DISPLAY' => 'block', 'TITLE' => $box_title, 'COMMENT_URL' => $comment_url));
$out = do_template('BLOCK_MAIN_CONTACT_SIMPLE', array('_GUID' => '298a357f442f440c6b42e58d6717e57c', 'EMAIL_OPTIONAL' => true, 'COMMENT_DETAILS' => $comment_details, 'MESSAGE' => $message));
return $out;
}
示例11: run
/**
* Standard modular run function.
*
* @return tempcode The result of execution.
*/
function run()
{
require_code('templates_donext');
require_code('menus');
require_all_lang();
$type = get_param('type', 'misc');
if ((!has_specific_permission(get_member(), 'avoid_simplified_adminzone_look') || $GLOBALS['FORUM_DRIVER']->is_super_admin(get_member())) && num_staff_icons() < MIN_STAFF_ICONS_BEFORE_COLLAPSE) {
if ($type == 'misc') {
return do_next_manager_admin_simplified();
}
}
// Warning about whether the Setup Wizard still needs running
if (get_param_integer('cancel_sw_warn', 0) == 1 || !addon_installed('setupwizard')) {
set_value('setup_wizard_completed', '1');
} else {
$_done_sw_once = get_value('setup_wizard_completed');
$done_sw_once = !is_null($_done_sw_once);
if (!$done_sw_once && get_param('page', '') != 'admin_setupwizard' && has_actual_page_access(get_member(), 'admin_setupwizard')) {
$setup_wizard_url = build_url(array('page' => 'admin_setupwizard'), get_module_zone('admin_setupwizard'));
$cancel_sw_url = get_self_url(false, false, array('cancel_sw_warn' => 1));
attach_message(do_lang_tempcode('SETUP_WIZARD_NOT_RUN', escape_html($setup_wizard_url->evaluate()), escape_html($cancel_sw_url->evaluate())), 'notice');
}
}
switch ($type) {
case 'misc':
return do_next_manager_hooked('ADMIN_ZONE', 'DOC_ADMIN_ZONE', '');
case 'structure':
return do_next_manager_hooked('STRUCTURE', 'DOC_STRUCTURE', 'structure');
case 'usage':
return do_next_manager_hooked('USAGE', 'DOC_USAGE', 'usage');
case 'style':
return do_next_manager_hooked('STYLE', 'DOC_STYLE', 'style');
case 'setup':
return do_next_manager_hooked('SETUP', 'DOC_SETUP', 'setup');
case 'tools':
return do_next_manager_hooked('TOOLS', 'DOC_TOOLS', 'tools');
case 'security':
return do_next_manager_hooked('SECURITY', 'DOC_SECURITY', 'security');
case 'search':
return $this->search();
}
return new ocp_tempcode();
}
示例12: render_tab
/**
* Standard modular render function for profile tabs edit hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('PHOTO');
$order = 30;
// Actualiser
if (post_param_integer('submitting_photo_tab', 0) == 1) {
require_code('ocf_members_action');
require_code('ocf_members_action2');
ocf_member_choose_photo('photo_url', 'photo_file', $member_id_of);
attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform');
}
if ($leave_to_ajax_if_possible) {
return NULL;
}
$photo_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_url');
$thumb_url = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_photo_thumb_url');
// UI fields
$fields = new ocp_tempcode();
require_code('form_templates');
$fields->attach(form_input_upload(do_lang_tempcode('UPLOAD'), do_lang_tempcode('DESCRIPTION_UPLOAD'), 'photo_file', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images'))));
$fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'photo_url', $photo_url, false));
if (get_option('is_on_gd') == '0' || !function_exists('imagetypes')) {
$thumb_width = get_option('thumb_width');
$fields->attach(form_input_upload(do_lang_tempcode('THUMBNAIL'), do_lang_tempcode('DESCRIPTION_THUMBNAIL', escape_html($thumb_width)), 'photo_file2', false, NULL, NULL, true, str_replace(' ', '', get_option('valid_images'))));
$fields->attach(form_input_line(do_lang_tempcode('ALT_FIELD', do_lang_tempcode('URL')), do_lang_tempcode('DESCRIPTION_ALTERNATE_URL'), 'photo_thumb_url', $thumb_url, false));
}
$hidden = new ocp_tempcode();
handle_max_file_size($hidden, 'image');
$hidden->attach(form_input_hidden('submitting_photo_tab', '1'));
$text = new ocp_tempcode();
require_code('images');
$max = floatval(get_max_image_size()) / floatval(1024 * 1024);
if ($max < 3.0) {
require_code('files2');
$config_url = get_upload_limit_config_url();
$text->attach(paragraph(do_lang_tempcode(is_null($config_url) ? 'MAXIMUM_UPLOAD' : 'MAXIMUM_UPLOAD_STAFF', escape_html($max > 10.0 ? integer_format(intval($max)) : float_format($max)), is_null($config_url) ? '' : escape_html($config_url))));
}
$text = do_template('OCF_EDIT_PHOTO_TAB', array('TEXT' => $text, 'MEMBER_ID' => strval($member_id_of), 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id_of), 'PHOTO' => $GLOBALS['FORUM_DRIVER']->get_member_photo_url($member_id_of)));
$javascript = '';
return array($title, $fields, $text, $javascript, $order, $hidden);
}
示例13: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
$file = array_key_exists('param', $map) ? $map['param'] : 'admin_notes';
$title = array_key_exists('title', $map) ? $map['title'] : do_lang('NOTES');
$scrolls = array_key_exists('scrolls', $map) ? $map['scrolls'] : '0';
$new = post_param('new', NULL);
if (!is_null($new)) {
set_long_value('note_text_' . $file, $new);
log_it('NOTES', $file);
attach_message(do_lang_tempcode('SUCCESS'), 'inform');
}
$contents = get_long_value('note_text_' . $file);
if (is_null($contents)) {
$contents = '';
}
$post_url = get_self_url();
$map_comcode = '';
foreach ($map as $key => $val) {
$map_comcode .= ' ' . $key . '="' . addslashes($val) . '"';
}
return do_template('BLOCK_MAIN_NOTES', array('_GUID' => '2a9e1c512b66600583735552b56e0911', 'TITLE' => $title, 'BLOCK_NAME' => 'main_db_notes', 'MAP' => $map_comcode, 'SCROLLS' => array_key_exists('scrolls', $map) && $map['scrolls'] == '1', 'CONTENTS' => $contents, 'URL' => $post_url));
}
示例14: render_tab
/**
* Standard modular render function for profile tabs edit hooks.
*
* @param MEMBER The ID of the member who is being viewed
* @param MEMBER The ID of the member who is doing the viewing
* @param boolean Whether to leave the tab contents NULL, if tis hook supports it, so that AJAX can load it later
* @return ?array A tuple: The tab title, the tab body text (may be blank), the tab fields, extra Javascript (may be blank) the suggested tab order, hidden fields (optional) (NULL: if $leave_to_ajax_if_possible was set)
*/
function render_tab($member_id_of, $member_id_viewing, $leave_to_ajax_if_possible = false)
{
$title = do_lang_tempcode('MEMBER_TITLE');
$order = 50;
// Actualiser
$_title = post_param('member_title', NULL);
if ($_title !== NULL) {
require_code('ocf_members_action');
require_code('ocf_members_action2');
ocf_member_choose_title($_title, $member_id_of);
attach_message(do_lang_tempcode('SUCCESS_SAVE'), 'inform');
}
if ($leave_to_ajax_if_possible) {
return NULL;
}
// UI fields
$fields = new ocp_tempcode();
$_title = $GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id_of, 'm_title');
require_code('form_templates');
$fields->attach(form_input_line(do_lang_tempcode('MEMBER_TITLE'), '', 'member_title', $_title, false, NULL, intval(get_option('max_member_title_length'))));
$text = do_lang_tempcode('DESCRIPTION_MEMBER_TITLE', escape_html($GLOBALS['FORUM_DRIVER']->get_username($member_id_of)));
$javascript = '';
return array($title, $fields, $text, $javascript, $order);
}
示例15: do_gallery_flow_mode
//.........这里部分代码省略.........
$where = db_string_equal_to('cat', $cat);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {
$where .= ' AND validated=1';
}
if (get_param('days', '') != '') {
$where .= ' AND add_date>' . strval(time() - get_param_integer('days') * 60 * 60 * 24);
}
$first_image = $GLOBALS['SITE_DB']->query('SELECT *' . $sql_suffix_images . ' FROM ' . get_table_prefix() . 'images r WHERE ' . $where . ' ORDER BY ' . $sort, 1);
if (array_key_exists(0, $first_image)) {
$row = $first_image[0];
$probe_type = 'image';
$probe_id = $row['id'];
}
// If else, then we have no probe_type, and thus won't be able to show anything
}
}
if (!is_null($row) && $row['validated'] == 0) {
if (!has_specific_permission(get_member(), 'jump_to_unvalidated')) {
access_denied('SPECIFIC_PERMISSION', 'jump_to_unvalidated');
}
$warning_details = do_template('WARNING_TABLE', array('WARNING' => do_lang_tempcode(get_param_integer('redirected', 0) == 1 ? 'UNVALIDATED_TEXT_NON_DIRECT' : 'UNVALIDATED_TEXT')));
} else {
$warning_details = new ocp_tempcode();
}
switch ($probe_type) {
case 'video':
if (is_null($row)) {
$map = array('cat' => $cat, 'id' => $probe_id);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {
$map['validated'] = 1;
}
$rows = $GLOBALS['SITE_DB']->query_select('videos', array('*'), $map, '', 1);
if (!array_key_exists(0, $rows)) {
attach_message(do_lang_tempcode('MISSING_RESOURCE'), 'warn');
break;
}
$row = $rows[0];
}
if (has_actual_page_access(NULL, 'cms_galleries', NULL, NULL) && has_edit_permission('mid', get_member(), $row['submitter'], 'cms_galleries', array('galleries', $cat))) {
$entry_edit_url = build_url(array('page' => 'cms_galleries', 'type' => '_ev', 'id' => $row['id']), get_module_zone('cms_galleries'));
}
/*$view_url=build_url(array('page'=>'_SELF','type'=>'video','root'=>($root=='root')?NULL:$root,'wide'=>1,'id'=>$row['id']),'_SELF');
$thumb_url=$row['thumb_url'];
if (($thumb_url!='') && (url_is_local($thumb_url))) $thumb_url=get_custom_base_url().'/'.$thumb_url;
if ($thumb_url=='') $thumb_url=find_theme_image('na');
$thumb=do_image_thumb($thumb_url,'');*/
// Video HTML
$thumb_url = $row['thumb_url'];
$url = $row['url'];
$video_player = show_gallery_media($url, $thumb_url, $row['video_width'], $row['video_height'], $row['video_length']);
$view_url = build_url(array('page' => '_SELF', 'type' => 'video', 'id' => $row['id'], 'wide' => 1, 'days' => get_param('days', '') == '' ? NULL : get_param('days'), 'sort' => $sort == 'add_date DESC' ? NULL : $sort, 'select' => $image_select == '*' ? NULL : $image_select, 'video_select' => $video_select == '*' ? NULL : $video_select), '_SELF');
// Some extra variables relating to the currently selected entry
$entry_title = get_translated_text($row['title']);
$entry_rating_details = get_rating_box(get_self_url(true), $entry_title, 'videos', strval($row['id']), $row['allow_rating'] == 1, $row['submitter']);
$entry_comment_details = get_comments('videos', $row['allow_comments'] == 1, strval($row['id']), false, get_value('comment_forum__videos'), NULL, NULL, false, false, $row['submitter'], $row['allow_comments'] == 2);
$entry_trackback_details = get_trackbacks('videos', strval($row['id']), $row['allow_trackbacks'] == 1);
$entry_add_date_raw = is_null($row['add_date']) ? '' : strval($row['add_date']);
$entry_edit_date_raw = is_null($row['edit_date']) ? '' : strval($row['edit_date']);
$entry_views = integer_format($row['video_views']);
$current_entry = do_template('GALLERY_FLOWMODE_VIDEO', array('_GUID' => 'b6a795dc3853789df2a2951293d0fb26', '_TITLE' => get_translated_text($row['title']), 'EDIT_URL' => $entry_edit_url, 'MAIN' => true, 'RATING_DETAILS' => $entry_rating_details, 'DESCRIPTION' => get_translated_tempcode($row['comments']), 'CAT' => $cat, 'THUMB_URL' => $url, 'FULL_URL' => $full_url, 'ID' => strval($row['id']), 'VIEWS' => strval($row['video_views']), 'ADD_DATE_RAW' => strval($row['add_date']), 'EDIT_DATE_RAW' => is_null($row['edit_date']) ? '' : strval($row['edit_date']), 'SUBMITTER' => strval($row['submitter']), 'VIDEO_PLAYER' => $video_player, 'VIEW_URL' => $view_url, 'VIDEO_DETAILS' => show_video_details($row)));
$GLOBALS['SITE_DB']->query_update('videos', array('video_views' => $row['video_views'] + 1), array('id' => $row['id']), '', 1, NULL, false, true);
break;
case 'image':
if (is_null($row)) {
$map = array('cat' => $cat, 'id' => $probe_id);
if (!has_specific_permission(get_member(), 'see_unvalidated')) {