本文整理汇总了PHP中user_lang函数的典型用法代码示例。如果您正苦于以下问题:PHP user_lang函数的具体用法?PHP user_lang怎么用?PHP user_lang使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_lang函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: splurgh_master_build
/**
* Get a splurghified version of the specified item.
*
* @param string The name of what the key we want to reference is in our array of maps (e.g. 'id')
* @param array A row of maps for data we are splurghing; this is probably just the result of $GLOBALS['SITE_DB']->query_select
* @param URLPATH The stub that links will be passed through
* @param ID_TEXT The page name we will be saving customised HTML under
* @param TIME The time we did our last change to the data being splurghed (so it can see if we can simply decache instead of deriving)
* @param ?AUTO_LINK The ID that is at the root of our tree (NULL: db_get_first_id)
* @return string A string of HTML that represents our splurghing (will desplurgh in the users browser)
*/
function splurgh_master_build($key_name, $map, $url_stub, $_cache_file, $last_change_time, $first_id = NULL)
{
if (is_null($first_id)) {
$first_id = db_get_first_id();
}
if (!array_key_exists($first_id, $map)) {
return '';
}
if (!has_js()) {
warn_exit(do_lang_tempcode('MSG_JS_NEEDED'));
}
require_javascript('javascript_splurgh');
if (is_browser_decacheing()) {
$last_change_time = time();
}
$cache_file = zone_black_magic_filterer(get_custom_file_base() . '/' . get_zone_name() . '/pages/html_custom/' . filter_naughty(user_lang()) . '/' . filter_naughty($_cache_file) . '.htm');
if (!file_exists($cache_file) || is_browser_decacheing() || filesize($cache_file) == 0 || $last_change_time > filemtime($cache_file)) {
$myfile = @fopen($cache_file, 'wt');
if ($myfile === false) {
intelligent_write_error($cache_file);
}
$fulltable = array();
$splurgh = _splurgh_do_node($map, $first_id, '', $fulltable, 0);
$page = do_template('SPLURGH', array('_GUID' => '8775edfc5a386fdf2cec69b0fc889952', 'KEY_NAME' => $key_name, 'URL_STUB' => $url_stub, 'SPLURGH' => str_replace('"', '\'', $splurgh)));
$ev = $page->evaluate();
if (fwrite($myfile, $ev) < strlen($ev)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($cache_file);
sync_file($cache_file);
return $ev;
}
return file_get_contents($cache_file, FILE_TEXT);
}
示例2: get_future_version_information
/**
* Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
*
* @return tempcode Information about the installed ocPortal version
*/
function get_future_version_information()
{
require_lang('version');
$url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
$data = http_download_file($url, NULL, false);
if (!is_null($data)) {
$data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
if ($GLOBALS['XSS_DETECT']) {
ocp_mark_as_escaped($data);
}
require_code('character_sets');
$data = convert_to_internal_encoding($data);
$table = new ocp_tempcode();
$lines = explode(chr(10), $data);
foreach ($lines as $line) {
if (trim($line) != '') {
$table->attach(paragraph($line));
}
}
$table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
} else {
$table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
}
require_code('xhtml');
/*$table->attach('<script type="text/javascript">// <![CDATA[
window.open(\''.$url.'\');
//]]></script>');*/
return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
示例3: run_tool
/**
* Run the checks
*/
function run_tool()
{
$this->check_table_flash_bbcodes(POSTS_TABLE, 'post_id', 'post_text', 'bbcode_uid', 'bbcode_bitfield');
$this->check_table_flash_bbcodes(PRIVMSGS_TABLE, 'msg_id', 'message_text', 'bbcode_uid', 'bbcode_bitfield');
$this->check_table_flash_bbcodes(USERS_TABLE, 'user_id', 'user_sig', 'user_sig_bbcode_uid', 'user_sig_bbcode_bitfield');
// Not checked atm
// check_table_flash_bbcodes(FORUMS_TABLE, 'forum_id', 'forum_desc', 'forum_desc_uid', 'forum_desc_bitfield');
// check_table_flash_bbcodes(FORUMS_TABLE, 'forum_id', 'forum_rules', 'forum_rules_uid', 'forum_rules_bitfield');
// check_table_flash_bbcodes(GROUPS_TABLE, 'group_id', 'group_desc', 'group_desc_uid', 'group_desc_bitfield');
// Nothing found
if (empty($this->_vulnerable)) {
trigger_error('FLASH_CHECKER_NO_FOUND');
}
// Here we'll create the cache files the reparse BBCode tool expects so
// the tool can be run straight away
global $cache;
$ids = implode(',', $this->_vulnerable[POSTS_TABLE]);
if ($ids) {
$cache->put('_stk_reparse_posts', $ids);
$ids = implode(',', $this->_vulnerable[POSTS_TABLE]);
$message = user_lang('FLASH_CHECKER_FOUND', append_sid(STK_INDEX, array('c' => 'admin', 't' => 'reparse_bbcode', 'reparseids' => $ids, 'submit' => true)));
$message .= '<br />' . user_lang('FLASH_CHECKER_POST', append_sid(PHPBB_ROOT_PATH . 'viewtopic.' . PHP_EXT . '?p=' . $ids . '#' . $ids)) . '';
}
if (!empty($this->_vulnerable[PRIVMSGS_TABLE])) {
$cache->put('_stk_reparse_pms', implode(',', $this->_vulnerable[PRIVMSGS_TABLE]));
$privmsgs_ids = implode(',', $this->_vulnerable[PRIVMSGS_TABLE]);
$message = user_lang('FLASH_CHECKER_FOUND', append_sid(STK_INDEX, array('c' => 'admin', 't' => 'reparse_bbcode', 'reparsepms' => $privmsgs_ids, 'submit' => true)));
}
trigger_error($message, E_USER_WARNING);
}
示例4: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
unset($map);
require_css('side_blocks');
$langs = nice_get_langs(user_lang());
return do_template('BLOCK_SIDE_LANGUAGE', array('_GUID' => '5dd7dd434722d7fd958773bd08e838c7', 'LANGS' => $langs));
}
示例5: put_into_cache
/**
* Put a result into the cache.
*
* @param ID_TEXT The codename to check for cacheing
* @param integer The TTL of what is being cached in minutes
* @param LONG_TEXT The requisite situational information (a serialized map) [-> further restraints when reading]
* @param mixed The result we are cacheing
* @param ?array A list of the language files that need loading to use tempcode embedded in the cache (NULL: none required)
* @param ?array A list of the javascript files that need loading to use tempcode embedded in the cache (NULL: none required)
* @param ?array A list of the css files that need loading to use tempcode embedded in the cache (NULL: none required)
* @param boolean Whether we are cacheing Tempcode (needs special care)
* @param ?ID_TEXT The theme this is being cached for (NULL: current theme)
* @param ?LANGUAGE_NAME The language this is being cached for (NULL: current language)
*/
function put_into_cache($codename, $ttl, $cache_identifier, $cache, $_langs_required = NULL, $_javascripts_required = NULL, $_csss_required = NULL, $tempcode = false, $theme = NULL, $lang = NULL)
{
if ($theme === NULL) {
$theme = $GLOBALS['FORUM_DRIVER']->get_theme();
}
if ($lang === NULL) {
$lang = user_lang();
}
global $KEEP_MARKERS, $SHOW_EDIT_LINKS;
if ($KEEP_MARKERS || $SHOW_EDIT_LINKS) {
return;
}
$langs_required = is_null($_langs_required) ? '' : implode(':', $_langs_required);
$langs_required .= '!';
$langs_required .= is_null($_javascripts_required) ? '' : implode(':', $_javascripts_required);
$langs_required .= '!';
$langs_required .= is_null($_csss_required) ? '' : implode(':', $_csss_required);
if (!is_null($GLOBALS['MEM_CACHE'])) {
$pcache = persistant_cache_get(array('CACHE', $codename));
if (is_null($pcache)) {
$pcache = array();
}
$pcache[$cache_identifier][$lang][$theme] = array('langs_required' => $langs_required, 'date_and_time' => time(), 'the_value' => $cache);
persistant_cache_set(array('CACHE', $codename), $pcache, false, $ttl * 60);
} else {
$GLOBALS['SITE_DB']->query_delete('cache', array('lang' => $lang, 'the_theme' => $theme, 'cached_for' => $codename, 'identifier' => md5($cache_identifier)), '', 1);
$GLOBALS['SITE_DB']->query_insert('cache', array('langs_required' => $langs_required, 'lang' => $lang, 'cached_for' => $codename, 'the_value' => $tempcode ? $cache->to_assembly($lang) : serialize($cache), 'date_and_time' => time(), 'the_theme' => $theme, 'identifier' => md5($cache_identifier)), false, true);
}
}
示例6: display_options
/**
* Display Options
*
* Output the options available
*/
function display_options()
{
global $template, $user;
// This is kinda like the main page
// Output the main page
page_header($user->lang['SUPPORT_TOOL_KIT']);
// Category title and desc if available
$template->assign_vars(array('L_TITLE' => $user->lang['CAT_ERK'], 'L_TITLE_EXPLAIN' => user_lang('CAT_ERK_EXPLAIN', append_sid(STK_ROOT_PATH . 'erk.' . PHP_EXT))));
$template->set_filenames(array('body' => 'index_body.html'));
page_footer();
}
示例7: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
//if (!addon_installed('octhief')) return;
require_lang('insults');
// ensure it is done once per week
$time = time();
$last_time = intval(get_value('last_insult_time'));
if ($last_time > time() - 24 * 60 * 60) {
return;
}
// run it once a day
set_value('last_insult_time', strval($time));
// how many points a correct response will give
$_insult_points = get_option('insult_points', true);
if (is_null($_insult_points)) {
// add option and default value if not installed yet
require_code('database_action');
add_config_option('INSULT_POINTS', 'insult_points', 'integer', 'return \'10\';', 'POINTS', 'INSULT_TITLE');
}
$insult_points = isset($_insult_points) && is_numeric($_insult_points) ? intval($_insult_points) : 10;
// who to insult?
$selected_members = $GLOBALS['FORUM_DB']->query('SELECT id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_members WHERE id <> ' . strval($GLOBALS['FORUM_DRIVER']->get_guest_id()) . ' ORDER BY RAND( ) ', 2, NULL, true);
$selected_member1 = isset($selected_members[0]['id']) && $selected_members[0]['id'] > 0 ? $selected_members[0]['id'] : 0;
$selected_member2 = isset($selected_members[1]['id']) && $selected_members[1]['id'] > 0 ? $selected_members[1]['id'] : 0;
// send insult to picked members
if ($selected_member1 != 0 && $selected_member2 != 0) {
$get_insult = '';
if (is_file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt')) {
$insults = file(get_file_base() . '/text_custom/' . user_lang() . '/insults.txt');
$insults_array = array();
foreach ($insults as $insult) {
$x = explode('=', $insult);
$insults_array[] = $x[0];
}
$rand_key = array_rand($insults_array, 1);
$rand_key = is_array($rand_key) ? $rand_key[0] : $rand_key;
$get_insult = $insults_array[$rand_key];
}
if ($get_insult != '') {
global $SITE_INFO;
$insult_pt_topic_post = do_lang('INSULT_EXPLANATION', get_site_name(), $get_insult, $insult_points);
$subject = do_lang('INSULT_PT_TOPIC', $GLOBALS['FORUM_DRIVER']->get_username($selected_member2), $GLOBALS['FORUM_DRIVER']->get_username($selected_member1));
require_code('ocf_topics_action');
$topic_id = ocf_make_topic(NULL, $subject, '', 1, 1, 0, 0, 0, $selected_member2, $selected_member1, true, 0, NULL, '');
require_code('ocf_posts_action');
$post_id = ocf_make_post($topic_id, $subject, $insult_pt_topic_post, 0, true, 1, 0, do_lang('SYSTEM'), NULL, NULL, $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, NULL, NULL, false, true, NULL, true, $subject, 0, NULL, true, true, true);
require_code('ocf_topics_action2');
send_pt_notification($post_id, $subject, $topic_id, $selected_member2, $selected_member1);
}
}
}
示例8: run
/**
* Standard modular run function for RSS hooks.
*
* @param string A list of categories we accept from
* @param TIME Cutoff time, before which we do not show results from
* @param string Prefix that represents the template set we use
* @set RSS_ ATOM_
* @param string The standard format of date to use for the syndication type represented in the prefix
* @param integer The maximum number of entries to return, ordering by date
* @return ?array A pair: The main syndication section, and a title (NULL: error)
*/
function run($_filters, $cutoff, $prefix, $date_string, $max)
{
if (get_forum_type() != 'ocf') {
return NULL;
}
if (!has_actual_page_access(get_member(), 'forumview')) {
return NULL;
}
if (is_guest()) {
return NULL;
}
$condition = 'l_time<t_cache_last_time OR (l_time IS NULL AND t_cache_last_time>' . strval(time() - 60 * 60 * 24 * intval(get_option('post_history_days'))) . ')';
$query = ' FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_topics top LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_read_logs l ON (top.id=l.l_topic_id AND l.l_member_id=' . strval((int) get_member()) . ') LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND top.t_cache_first_post=t.id WHERE (' . $condition . ') AND t_forum_id IS NOT NULL ' . (!has_specific_permission(get_member(), 'see_unvalidated') ? ' AND t_validated=1 ' : '') . ' ORDER BY t_cache_last_time DESC';
$rows = $GLOBALS['FORUM_DB']->query('SELECT *,top.id AS t_id ' . $query, $max);
$categories = collapse_2d_complexity('id', 'f_name', $GLOBALS['FORUM_DB']->query('SELECT id,f_name FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE f_cache_num_posts>0'));
$content = new ocp_tempcode();
foreach ($rows as $row) {
if ((!is_null($row['t_forum_id']) || $row['t_pt_to'] == get_member()) && has_category_access(get_member(), 'forums', strval($row['t_forum_id']))) {
$id = strval($row['id']);
$author = $row['t_cache_first_username'];
$news_date = date($date_string, $row['t_cache_first_time']);
$edit_date = date($date_string, $row['t_cache_last_time']);
if ($edit_date == $news_date) {
$edit_date = '';
}
$news_title = xmlentities($row['t_cache_first_title']);
$_summary = get_translated_tempcode($row['t_cache_first_post'], $GLOBALS['FORUM_DB']);
$summary = xmlentities($_summary->evaluate());
$news = '';
$category = array_key_exists($row['t_forum_id'], $categories) ? $categories[$row['t_forum_id']] : do_lang('NA');
$category_raw = strval($row['t_forum_id']);
$view_url = build_url(array('page' => 'topicview', 'id' => $row['t_id']), get_module_zone('topicview'));
if ($prefix == 'RSS_') {
$if_comments = do_template('RSS_ENTRY_COMMENTS', array('COMMENT_URL' => $view_url, 'ID' => strval($row['t_id'])));
} else {
$if_comments = new ocp_tempcode();
}
$content->attach(do_template($prefix . 'ENTRY', array('VIEW_URL' => $view_url, 'SUMMARY' => $summary, 'EDIT_DATE' => $edit_date, 'IF_COMMENTS' => $if_comments, 'TITLE' => $news_title, 'CATEGORY_RAW' => $category_raw, 'CATEGORY' => $category, 'AUTHOR' => $author, 'ID' => $id, 'NEWS' => $news, 'DATE' => $news_date)));
}
}
require_lang('ocf');
return array($content, do_lang('TOPICS_UNREAD'));
}
示例9: write_text_file
/**
* Write a text file, using the _custom system
*
* @param string The file name (without .txt)
* @param ?LANGUAGE_NAME The language to write for (NULL: none) (blank: search)
* @param string The data to write
*/
function write_text_file($codename, $lang, $out)
{
$xpath = _find_text_file_path($codename, $lang);
if ($xpath == '') {
$xpath = get_file_base() . '/text/' . user_lang() . '/' . $codename . '.txt';
}
$path = str_replace(get_file_base() . '/text/', get_custom_file_base() . '/text_custom/', $xpath);
$myfile = @fopen($path, 'wt');
if ($myfile === false) {
intelligent_write_error($path);
}
$out = unixify_line_format($out);
if (fwrite($myfile, $out) < strlen($out)) {
warn_exit(do_lang_tempcode('COULD_NOT_SAVE_FILE'));
}
fclose($myfile);
fix_permissions($path);
sync_file($path);
}
示例10: basic_newsletter_join
/**
* Add to the newsletter, in the simplest way.
*
* @param EMAIL The email address of the subscriber
* @param integer The interest level
* @range 1 4
* @param ?LANGUAGE_NAME The language (NULL: users)
* @param boolean Whether to require a confirmation mail
* @param ?AUTO_LINK The newsletter to join (NULL: the first)
* @param string Subscribers forename
* @param string Subscribers surname
* @return string Newsletter password
*/
function basic_newsletter_join($email, $interest_level = 4, $lang = NULL, $get_confirm_mail = false, $newsletter_id = NULL, $forename = '', $surname = '')
{
if (is_null($lang)) {
$lang = user_lang();
}
if (is_null($newsletter_id)) {
$newsletter_id = db_get_first_id();
}
$password = get_rand_password();
$code_confirm = $get_confirm_mail ? mt_rand(1, 9999999) : 0;
$test = $GLOBALS['SITE_DB']->query_value_null_ok('newsletter_subscribe', 'the_level', array('newsletter_id' => $newsletter_id, 'email' => $email));
if ($test === 0) {
$GLOBALS['SITE_DB']->query_delete('newsletter_subscribe', array('newsletter_id' => $newsletter_id, 'email' => $email), '', 1);
$test = NULL;
}
if (is_null($test)) {
require_lang('newsletter');
$test = $GLOBALS['SITE_DB']->query_value_null_ok('newsletter', 'email', array('email' => $email));
if (is_null($test)) {
$salt = produce_salt();
$GLOBALS['SITE_DB']->query_insert('newsletter', array('n_forename' => $forename, 'n_surname' => $surname, 'join_time' => time(), 'email' => $email, 'code_confirm' => $code_confirm, 'pass_salt' => $salt, 'the_password' => md5($password . $salt), 'language' => $lang), false, true);
// race condition
if ($get_confirm_mail) {
$_url = build_url(array('page' => 'newsletter', 'type' => 'confirm', 'email' => $email, 'confirm' => $code_confirm), get_module_zone('newsletter'));
$url = $_url->evaluate();
$message = do_lang('NEWSLETTER_SIGNUP_TEXT', comcode_escape($url), comcode_escape($password), array($forename, $surname, $email, get_site_name()), $lang);
require_code('mail');
mail_wrap(do_lang('NEWSLETTER_SIGNUP', NULL, NULL, NULL, $lang), $message, array($email));
}
} else {
$GLOBALS['SITE_DB']->query_update('newsletter', array('join_time' => time()), array('email' => $email), '', 1);
$password = '';
}
$GLOBALS['SITE_DB']->query_insert('newsletter_subscribe', array('newsletter_id' => $newsletter_id, 'the_level' => $interest_level, 'email' => $email), false, true);
// race condition
return $password;
}
return do_lang('NA');
}
示例11: ocf_list_multi_moderations
/**
* List all the multi moderations that may be used in a certain forum.
*
* @param ?AUTO_LINK The forum we are listing for (NULL: private topics).
* @return array List of multi moderations.
*/
function ocf_list_multi_moderations($forum_id)
{
if (!addon_installed('ocf_multi_moderations')) {
return array();
}
if (is_null($forum_id)) {
return array();
}
$rows = $GLOBALS['FORUM_DB']->query_select('f_multi_moderations m LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND m.mm_name=t.id', array('mm_forum_multi_code', 'm.id', 'm.mm_name', 'text_original AS _mm_name'), NULL, 'ORDER BY text_original');
$out = array();
if (count($rows) == 0) {
return $out;
}
$lots_of_forums = $GLOBALS['FORUM_DB']->query_value('f_forums', 'COUNT(*)') > 200;
if (!$lots_of_forums) {
$all_forums = collapse_2d_complexity('id', 'f_parent_forum', $GLOBALS['FORUM_DB']->query_select('f_forums', array('id', 'f_parent_forum')));
}
foreach ($rows as $row) {
if ($GLOBALS['RECORD_LANG_STRINGS_CONTENT'] || is_null($row['_mm_name'])) {
$row['_mm_name'] = get_translated_text($row['mm_name'], $GLOBALS['FORUM_DB']);
}
require_code('ocfiltering');
if ($lots_of_forums) {
$sql = ocfilter_to_sqlfragment($row['mm_forum_multi_code'], 'id', 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
if (!is_null($GLOBALS['FORUM_DB']->query_value_null_ok_full('SELECT id FROM ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'f_forums WHERE id=' . strval($forum_id) . ' AND (' . $sql . ')'))) {
$out[$row['id']] = $row['_mm_name'];
}
} else {
$idlist = ocfilter_to_idlist_using_memory($row['mm_forum_multi_code'], $all_forums, 'f_forums', 'f_parent_forum', 'f_parent_forum', 'id', true, true, $GLOBALS['FORUM_DB']);
if (in_array($forum_id, $idlist)) {
$out[$row['id']] = $row['_mm_name'];
}
}
}
return $out;
}
示例12: get_products
/**
* Get the products handled by this eCommerce hook.
*
* IMPORTANT NOTE TO PROGRAMMERS: This function may depend only on the database, and not on get_member() or any GET/POST values.
* Such dependencies will break IPN, which works via a Guest and no dependable environment variables. It would also break manual transactions from the Admin Zone.
*
* @param boolean Whether to make sure the language for item_name is the site default language (crucial for when we read/go to third-party sales systems and use the item_name as a key).
* @param ?ID_TEXT Product being searched for (NULL: none).
* @param boolean Whether $search refers to the product name rather than the product_id.
* @return array A map of product name to list of product details.
*/
function get_products($site_lang = false, $search = NULL, $search_titles_not_ids = false)
{
$products = array();
require_lang('shopping');
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
if (!is_null($search)) {
$where = '1=1';
if (!$search_titles_not_ids) {
$l = do_lang('CART_ORDER', '', NULL, NULL, $site_lang ? get_site_default_lang() : user_lang());
if (substr($search, 0, strlen($l)) != $l) {
return array();
}
$where .= ' AND id=' . strval(intval(substr($search, strlen($l))));
}
} else {
$where = '(' . db_string_equal_to('order_status', 'ORDER_STATUS_awaiting_payment') . ' OR ' . db_string_equal_to('order_status', 'ORDER_STATUS_payment_received') . ')';
}
if (is_null($search)) {
$count = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . get_table_prefix() . 'shopping_order WHERE ' . $where);
if ($count > 50) {
return array();
}
// Too many to list
}
$start = 0;
do {
$orders = $GLOBALS['SITE_DB']->query('SELECT id,tot_price FROM ' . get_table_prefix() . 'shopping_order WHERE ' . $where, 500);
foreach ($orders as $order) {
$products[do_lang('CART_ORDER', strval($order['id']), NULL, NULL, $site_lang ? get_site_default_lang() : user_lang())] = array(PRODUCT_ORDERS, $order['tot_price'], 'handle_product_orders', array(), do_lang('CART_ORDER', strval($order['id']), NULL, NULL, $site_lang ? get_site_default_lang() : user_lang()));
}
$start += 500;
} while (count($orders) == 500);
return $products;
}
示例13: run_tool
/**
* Run the checks
*/
function run_tool()
{
$this->check_table_flash_bbcodes(POSTS_TABLE, 'post_id', 'post_text', 'bbcode_uid', 'bbcode_bitfield');
$this->check_table_flash_bbcodes(PRIVMSGS_TABLE, 'msg_id', 'message_text', 'bbcode_uid', 'bbcode_bitfield');
$this->check_table_flash_bbcodes(USERS_TABLE, 'user_id', 'user_sig', 'user_sig_bbcode_uid', 'user_sig_bbcode_bitfield');
// Not checked atm
// check_table_flash_bbcodes(FORUMS_TABLE, 'forum_id', 'forum_desc', 'forum_desc_uid', 'forum_desc_bitfield');
// check_table_flash_bbcodes(FORUMS_TABLE, 'forum_id', 'forum_rules', 'forum_rules_uid', 'forum_rules_bitfield');
// check_table_flash_bbcodes(GROUPS_TABLE, 'group_id', 'group_desc', 'group_desc_uid', 'group_desc_bitfield');
// Nothing found
if (empty($this->_vulnerable)) {
trigger_error('FLASH_CHECKER_NO_FOUND');
}
// Here we'll create the cache files the reparse BBCode tool expects so
// the tool can be run straight away
global $cache;
if (!empty($this->_vulnerable[POSTS_TABLE])) {
$cache->put('_stk_reparse_posts', implode(',', $this->_vulnerable[POSTS_TABLE]));
}
if (!empty($this->_vulnerable[PRIVMSGS_TABLE])) {
$cache->put('_stk_reparse_pms', implode(',', $this->_vulnerable[PRIVMSGS_TABLE]));
}
trigger_error(user_lang('FLASH_CHECKER_FOUND', append_sid(STK_INDEX, array('c' => 'admin', 't' => 'reparse_bbcode', 'submit' => true))));
}
示例14: points_get_transactions
/**
* Show the point transactions a member has had.
*
* @param ID_TEXT The type of transactions we are looking for
* @set from to
* @param MEMBER Who we are looking at transactions for
* @param MEMBER Who we are looking at transactions using the account of
* @return tempcode The UI
*/
function points_get_transactions($type, $member_id_of, $member_id_viewing)
{
$where = array('gift_' . $type => $member_id_of);
if ($type == 'from') {
$where['anonymous'] = 0;
}
$start = get_param_integer('gift_start_' . $type, 0);
$max = get_param_integer('gift_max_' . $type, 10);
$sortables = array('date_and_time' => do_lang_tempcode('DATE'), 'amount' => do_lang_tempcode('AMOUNT'));
$test = explode(' ', get_param('gift_sort_' . $type, 'date_and_time DESC'));
if (count($test) == 1) {
$test[1] = 'DESC';
}
list($sortable, $sort_order) = $test;
if (strtoupper($sort_order) != 'ASC' && strtoupper($sort_order) != 'DESC' || !array_key_exists($sortable, $sortables)) {
log_hack_attack_and_exit('ORDERBY_HACK');
}
global $NON_CANONICAL_PARAMS;
$NON_CANONICAL_PARAMS[] = 'gift_sort_' . $type;
$NON_CANONICAL_PARAMS[] = 'gift_start_' . $type;
$max_rows = $GLOBALS['SITE_DB']->query_value('gifts', 'COUNT(*)', $where);
$rows = $GLOBALS['SITE_DB']->query_select('gifts g LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=g.reason', array('*'), $where, 'ORDER BY ' . $sortable . ' ' . $sort_order, $max, $start);
$out = new ocp_tempcode();
$viewing_name = $GLOBALS['FORUM_DRIVER']->get_username($member_id_of);
if (is_null($viewing_name)) {
$viewing_name = do_lang('UNKNOWN');
}
require_code('templates_results_table');
$fields_title = results_field_title(array(do_lang_tempcode('DATE'), do_lang_tempcode('AMOUNT'), do_lang_tempcode('FROM'), do_lang_tempcode('TO'), do_lang_tempcode('REASON')), $sortables, 'gift_sort_' . $type, $sortable . ' ' . $sort_order);
foreach ($rows as $myrow) {
if ($myrow['anonymous'] == 1 && $type == 'from') {
continue;
}
// Their name
$fromname = is_guest($myrow['gift_from']) ? get_site_name() : $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_from']);
$toname = $GLOBALS['FORUM_DRIVER']->get_username($myrow['gift_to']);
if (is_null($fromname)) {
$fromname = do_lang('UNKNOWN');
}
if ($myrow['anonymous'] == 1 && !is_guest($myrow['gift_from'])) {
if (!has_specific_permission($member_id_viewing, 'trace_anonymous_gifts')) {
$_fromname = do_lang_tempcode('ANON');
} else {
$_fromname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), do_lang_tempcode('ANON'), false, false, escape_html($fromname));
}
} else {
$_fromname = is_guest($myrow['gift_from']) ? make_string_tempcode(escape_html($fromname)) : hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_from']), get_module_zone('points')), escape_html($fromname), false, false, do_lang_tempcode('VIEW_POINTS'));
}
$_toname = hyperlink(build_url(array('page' => 'points', 'type' => 'member', 'id' => $myrow['gift_to']), get_module_zone('points')), escape_html($toname), false, false, do_lang_tempcode('VIEW_POINTS'));
$date = get_timezoned_date($myrow['date_and_time']);
$amount = $myrow['amount'];
if (get_page_name() != 'search' && array_key_exists('text_parsed', $myrow) && !is_null($myrow['text_parsed']) && $myrow['text_parsed'] != '' && $myrow['reason'] != 0) {
$reason = new ocp_tempcode();
if (!$reason->from_assembly($myrow['text_parsed'], true)) {
$reason = get_translated_tempcode($myrow['reason']);
}
} else {
$reason = get_translated_tempcode($myrow['reason']);
}
$out->attach(results_entry(array(escape_html($date), escape_html(integer_format($amount)), $_fromname, $_toname, $reason)));
}
$out = results_table(do_lang_tempcode('_POINTS', escape_html($viewing_name)), $start, 'gift_start_' . $type, $max, 'gift_max_' . $type, $max_rows, $fields_title, $out, $sortables, $sortable, $sort_order, 'gift_sort_' . $type, NULL, NULL, NULL, 8, 'gfhfghtrhhjghgfhfgf', false, 'tab__points');
if ($type == 'to') {
$title = do_lang_tempcode('POINTS_TO');
} else {
$title = do_lang_tempcode('POINTS_FROM');
}
return do_template('POINTS_TRANSACTIONS_WRAP', array('_GUID' => 'f19e3eedeb0b8bf398251b24e8389723', 'CONTENT' => $out, 'TITLE' => $title));
}
示例15: get_sitemap_pagelinks
/**
* Standard modular new-style deep page-link finder function (does not return the main entry-points).
*
* @param string Callback function to send discovered page-links to.
* @param MEMBER The member we are finding stuff for (we only find what the member can view).
* @param integer Code for how deep we are tunnelling down, in terms of whether we are getting entries as well as categories.
* @param string Stub used to create page-links. This is passed in because we don't want to assume a zone or page name within this function.
*/
function get_sitemap_pagelinks($callback, $member_id, $depth, $pagelink_stub)
{
// Entries
if ($depth >= DEPTH__ENTRIES) {
$rows = $GLOBALS['SITE_DB']->query_select('iotd c LEFT JOIN ' . get_table_prefix() . 'translate t ON ' . db_string_equal_to('language', user_lang()) . ' AND t.id=c.i_title', array('c.i_title', 'c.id', 't.text_original AS title', 'add_date', 'edit_date'), array('used' => 1));
foreach ($rows as $row) {
if (is_null($row['title'])) {
$row['title'] = get_translated_text($row['i_title']);
}
$pagelink = $pagelink_stub . 'view:' . strval($row['id']);
call_user_func_array($callback, array($pagelink, $pagelink_stub . 'misc', $row['add_date'], $row['edit_date'], 0.2, $row['title']));
// Callback
}
}
}