本文整理汇总了PHP中mixed函数的典型用法代码示例。如果您正苦于以下问题:PHP mixed函数的具体用法?PHP mixed怎么用?PHP mixed使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mixed函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('iotds')) {
return array();
}
if (get_option('iotd_update_time') == '') {
return array();
}
require_lang('iotds');
$date = $GLOBALS['SITE_DB']->query_value_null_ok('iotd', 'date_and_time', array('is_current' => 1));
$limit_hours = intval(get_option('iotd_update_time'));
$seconds_ago = mixed();
if (!is_null($date)) {
$seconds_ago = time() - $date;
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'iotd_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'cms_iotds', 'type' => 'ed'), get_module_zone('cms_iotds'));
$num_queue = $this->get_num_iotd_queue();
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$info->attach(do_lang_tempcode('NUM_QUEUE', integer_format($num_queue)));
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '5c55aed7bedca565c8aa553548b88e64', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('PT_choose_iotd'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'iotd_update_time'));
}
示例2: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('news')) {
return array();
}
if (get_option('news_update_time') == '') {
return array();
}
require_lang('news');
$date = $GLOBALS['SITE_DB']->query_value_null_ok('news n JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_categories c ON n.news_category=c.id', 'MAX(date_and_time)', array('validated' => 1, 'nc_owner' => NULL));
$limit_hours = intval(get_option('news_update_time'));
$seconds_ago = mixed();
if (!is_null($date)) {
$seconds_ago = time() - $date;
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'news_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'cms_news', 'type' => 'ad'), get_module_zone('cms_news'));
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => 'dd14f34eafa4f24c4c173c195cd84fe3', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('ADD_NEWS'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'news_update_time'));
}
示例3: member_profile_url
/**
* Get a URL to a forum member's member profile.
*
* @param MEMBER The forum member
* @param boolean Whether to be insistent that we go to the profile, rather than possibly starting an IM which can link to the profile
* @param boolean Whether it is okay to return the result using Tempcode (more efficient, and allows keep_* parameters to propagate which you almost certainly want!)
* @return mixed The URL
*/
function member_profile_url($id, $definitely_profile = false, $tempcode_okay = false)
{
$url = mixed();
if (!$definitely_profile && $id != $this->get_guest_id() && addon_installed('chat') && has_specific_permission(get_member(), 'start_im')) {
$username_click_im = get_option('username_click_im', true);
if ($username_click_im == '1') {
$url = build_url(array('page' => 'chat', 'type' => 'misc', 'enter_im' => $id), get_module_zone('chat'));
if (!$tempcode_okay) {
$url = $url->evaluate();
}
return $url;
}
}
$url = $this->_member_profile_url($id, $tempcode_okay);
if ($tempcode_okay && !is_object($url)) {
$url = make_string_tempcode($url);
}
if (get_forum_type() != 'none' && get_forum_type() != 'ocf' && get_option('forum_in_portal', true) == '1') {
$url = build_url(array('page' => 'forums', 'url' => $url), get_module_zone('forums'));
if (!$tempcode_okay) {
$url = $url->evaluate();
}
}
return $url;
}
示例4: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('newsletter')) {
return array();
}
if (get_option('news_update_time', true) == '') {
return array();
}
$limit_hours = intval(get_option('news_update_time', true));
$limit_hours = intval($limit_hours / 3);
// 3 news pieces (+ other stuff) per newsletter seems reasonable
require_lang('newsletter');
$date = get_value('newsletter_send_time');
$seconds_ago = mixed();
if (!is_null($date)) {
$seconds_ago = time() - intval($date);
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'news_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'admin_newsletter', 'type' => 'whatsnew'), 'adminzone');
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => 'fb9483bb05ad90b9f2b7eba0c53996f4', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('NEWSLETTER_SEND'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'news_update_time'));
}
示例5: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('flagrant')) {
return array();
}
require_lang('flagrant');
$rows = $GLOBALS['SITE_DB']->query_select('text', array('activation_time', 'days'), array('active_now' => 1), '', NULL, NULL, true);
if (is_null($rows)) {
return array();
}
$seconds_due_in = mixed();
if (array_key_exists(0, $rows)) {
$activation_time = $rows[0]['activation_time'];
$days = $rows[0]['days'];
$date = $activation_time + $days * 24 * 60 * 60;
$seconds_due_in = $date - time();
$status = $seconds_due_in <= 0 ? 0 : 1;
} else {
$status = 1;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$url = build_url(array('page' => 'admin_flagrant', 'type' => 'misc'), 'adminzone');
$num_queue = $this->get_num_flagrant_queue();
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_due_in);
$info->attach(do_lang_tempcode('NUM_QUEUE', escape_html(integer_format($num_queue))));
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '820e0e3cd80754dc7dfd9a0d05a43ec0', 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('CHOOSE_FLAGRANT'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, NULL));
}
示例6: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('backup')) {
return array();
}
if (get_option('backup_time', true) == '') {
return array();
}
$limit_hours = intval(get_option('backup_time', true));
require_lang('backups');
$date = intval(get_value('last_backup'));
$seconds_ago = mixed();
if ($date != 0) {
$seconds_ago = time() - $date;
$status = intval($seconds_ago) > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'backup_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'admin_backup', 'type' => 'misc'), 'adminzone');
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '432685ec6c9f7548ce8b488b6ce00030', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('BACKUP'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'backup_time'));
}
示例7: create_session
/**
* Set up a new session / Restore an existing one that was lost.
*
* @param MEMBER Logged in member
* @param BINARY Whether the session should be considered confirmed
* @param boolean Whether the session should be invisible
* @return AUTO_LINK New session ID
*/
function create_session($member, $session_confirmed = 0, $invisible = false)
{
global $SESSION_CACHE;
global $MEMBER_CACHED;
$MEMBER_CACHED = $member;
if ($invisible && get_option('is_on_invisibility') == '0') {
$invisible = false;
}
$new_session = mixed();
$restored_session = delete_expired_sessions_or_recover($member);
if (is_null($restored_session)) {
// Generate random session
$new_session = mt_rand(0, mt_getrandmax() - 1);
// Store session
$username = $GLOBALS['FORUM_DRIVER']->get_username($member);
$new_session_row = array('the_session' => $new_session, 'last_activity' => time(), 'the_user' => $member, 'ip' => get_ip_address(3), 'session_confirmed' => $session_confirmed, 'session_invisible' => $invisible ? 1 : 0, 'cache_username' => $username, 'the_title' => '', 'the_zone' => get_zone_name(), 'the_page' => substr(get_page_name(), 0, 80), 'the_type' => substr(get_param('type', '', true), 0, 80), 'the_id' => substr(either_param('id', ''), 0, 80));
$GLOBALS['SITE_DB']->query_insert('sessions', $new_session_row, false, true);
$SESSION_CACHE[$new_session] = $new_session_row;
$big_change = true;
} else {
$new_session = $restored_session;
$prior_session_row = $SESSION_CACHE[$new_session];
$new_session_row = array('the_title' => '', 'the_zone' => get_zone_name(), 'the_page' => get_page_name(), 'the_type' => substr(either_param('type', ''), 0, 80), 'the_id' => substr(either_param('id', ''), 0, 80), 'last_activity' => time(), 'ip' => get_ip_address(3), 'session_confirmed' => $session_confirmed);
$big_change = $prior_session_row['last_activity'] < time() - 10 || $prior_session_row['session_confirmed'] != $session_confirmed || $prior_session_row['ip'] != $new_session_row['ip'];
if ($big_change) {
$GLOBALS['SITE_DB']->query_update('sessions', $new_session_row, array('the_session' => $new_session), '', 1, NULL, false, true);
}
$SESSION_CACHE[$new_session] = array_merge($SESSION_CACHE[$new_session], $new_session_row);
}
if ($big_change) {
if (get_value('session_prudence') !== '1') {
// With session prudence we don't store all these in persistant cache due to the size of it all. So only re-save if that's not on.
persistant_cache_set('SESSION_CACHE', $SESSION_CACHE);
}
}
set_session_id($new_session);
// We won't set it true here, but something that really needs it to persist might come back and re-set it
// New sessions = Login points
if (!is_null($member) && addon_installed('points') && addon_installed('stats') && !is_guest($member)) {
$points_per_daily_visit = intval(get_option('points_per_daily_visit', true));
if ($points_per_daily_visit != 0) {
// See if this is the first visit today
$test = $GLOBALS['SITE_DB']->query_value('stats', 'MAX(date_and_time)', array('the_user' => $member));
if (!is_null($test)) {
require_code('temporal');
require_code('tempcode');
if (date('d/m/Y', tz_time($test, get_site_timezone())) != date('d/m/Y', tz_time(time(), get_site_timezone()))) {
require_code('points');
$_before = point_info($member);
if (array_key_exists('points_gained_given', $_before)) {
$GLOBALS['FORUM_DRIVER']->set_custom_field($member, 'points_gained_given', strval(intval($_before['points_gained_given']) + $points_per_daily_visit));
}
}
}
}
}
$GLOBALS['SESSION_CONFIRMED'] = $session_confirmed;
return $new_session;
}
示例8: send_validation_request
/**
* Send (by e-mail) a validation request for a submitted item to the admin.
*
* @param ID_TEXT The validation request will say one of this type has been submitted. By convention it is the language code of what was done, e.g. ADD_DOWNLOAD
* @param ?ID_TEXT The table saved into (NULL: unknown)
* @param boolean Whether the ID field is not an integer
* @param ID_TEXT The validation request will say this ID has been submitted
* @param tempcode The validation request will link to this URL
* @param ?MEMBER Member doing the submitting (NULL: current member)
*/
function send_validation_request($type, $table, $non_integer_id, $id, $url, $member_id = NULL)
{
$good = NULL;
if (!is_null($table)) {
$_hooks = find_all_hooks('modules', 'admin_unvalidated');
foreach (array_keys($_hooks) as $hook) {
require_code('hooks/modules/admin_unvalidated/' . filter_naughty_harsh($hook));
$object = object_factory('Hook_unvalidated_' . filter_naughty_harsh($hook), true);
if (is_null($object)) {
continue;
}
$info = $object->info();
if (is_null($info)) {
continue;
}
if ($info['db_table'] == $table) {
$good = $info;
break;
}
}
}
$title = mixed();
$title = '';
if (!is_null($good) && !is_array($good['db_identifier'])) {
$db = array_key_exists('db', $good) ? $good['db'] : $GLOBALS['SITE_DB'];
$where = $good['db_identifier'] . '=' . $id;
if ($non_integer_id) {
$where = db_string_equal_to($good['db_identifier'], $id);
}
$rows = $db->query('SELECT ' . $good['db_identifier'] . (array_key_exists('db_title', $good) ? ',' . $good['db_title'] : '') . ' FROM ' . $db->get_table_prefix() . $good['db_table'] . ' WHERE ' . $where, 100);
if (array_key_exists('db_title', $good)) {
$title = $rows[0][$good['db_title']];
if ($good['db_title_dereference']) {
$title = get_translated_text($title, $db);
}
// May actually be comcode (can't be certain), but in which case it will be shown as source
} else {
$title = '#' . (is_integer($id) ? strval($id) : $id);
}
}
if ($title == '') {
$title = '#' . (is_integer($id) ? strval($id) : $id);
}
if (is_null($member_id)) {
$member_id = get_member();
}
require_lang('unvalidated');
$_type = do_lang($type, NULL, NULL, NULL, NULL, false);
if (!is_null($_type)) {
$type = $_type;
}
$comcode = do_template('VALIDATION_REQUEST', array('_GUID' => '1885be371b2ff7810287715ef2f7b948', 'USERNAME' => $GLOBALS['FORUM_DRIVER']->get_username($member_id), 'TYPE' => $type, 'ID' => $id, 'URL' => $url), get_site_default_lang());
require_code('notifications');
$subject = do_lang('UNVALIDATED_TITLE', $title, '', '', get_site_default_lang());
$message = $comcode->evaluate(get_site_default_lang(), false);
dispatch_notification('needs_validation', NULL, $subject, $message);
}
示例9: give_award
/**
* Give an award.
*
* @param AUTO_LINK The award ID
* @param ID_TEXT The content ID
* @param ?TIME Time the award was given (NULL: now)
*/
function give_award($award_id, $content_id, $time = NULL)
{
require_lang('awards');
if (is_null($time)) {
$time = time();
}
$awards = $GLOBALS['SITE_DB']->query_select('award_types', array('*'), array('id' => $award_id), '', 1);
if (!array_key_exists(0, $awards)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$award_title = get_translated_text($awards[0]['a_title']);
log_it('GIVE_AWARD', strval($award_id), $award_title);
require_code('hooks/systems/awards/' . filter_naughty_harsh($awards[0]['a_content_type']));
$object = object_factory('Hook_awards_' . $awards[0]['a_content_type']);
$info = $object->info();
if (is_null($info)) {
fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
if (array_key_exists('submitter_field', $info) && $awards[0]['a_content_type'] != 'author' && !is_null($info['submitter_field'])) {
require_code('content');
list($content_title, $member_id, , $content) = content_get_details($awards[0]['a_content_type'], $content_id);
if (is_null($content)) {
warn_exit(do_lang_tempcode('_MISSING_RESOURCE', escape_html($awards[0]['a_content_type'] . ':' . $content_id)));
}
// Lots of fiddling around to work out how to check permissions for this
$permission_type_code = convert_ocportal_type_codes('award_hook', $awards[0]['a_content_type'], 'permissions_type_code');
$module = convert_ocportal_type_codes('module', $awards[0]['a_content_type'], 'permissions_type_code');
if ($module == '') {
$module = $content_id;
}
$category_id = mixed();
if (isset($info['category_field'])) {
if (is_array($info['category_field'])) {
$category_id = $content[$info['category_field'][1]];
} else {
$category_id = $content[$info['category_field']];
}
}
if (has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), 'awards') && has_actual_page_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), $module) && ($permission_type_code == '' || is_null($category_id) || has_category_access($GLOBALS['FORUM_DRIVER']->get_guest_id(), $permission_type_code, is_integer($category_id) ? strval($category_id) : $category_id))) {
syndicate_described_activity(is_null($member_id) || is_guest($member_id) ? 'awards:_ACTIVITY_GIVE_AWARD' : 'awards:ACTIVITY_GIVE_AWARD', $award_title, $content_title, '', '_SEARCH:awards:award:' . strval($award_id), '', '', 'awards', 1, NULL, false, $member_id);
}
} else {
$member_id = NULL;
}
if (is_null($member_id)) {
$member_id = $GLOBALS['FORUM_DRIVER']->get_guest_id();
}
if (!is_guest($member_id) && addon_installed('points')) {
require_code('points2');
system_gift_transfer(do_lang('_AWARD', get_translated_text($awards[0]['a_title'])), $awards[0]['a_points'], $member_id);
}
$GLOBALS['SITE_DB']->query_insert('award_archive', array('a_type_id' => $award_id, 'member_id' => $member_id, 'content_id' => $content_id, 'date_and_time' => $time));
decache('main_awards');
decache('main_multi_content');
}
示例10: init__ocf_forums
/**
* Standard code module initialisation function.
*/
function init__ocf_forums()
{
global $USER_ACCESS_CACHE;
$USER_ACCESS_CACHE = array();
global $CATEGORY_TITLES;
$CATEGORY_TITLES = NULL;
global $FORUM_TREE_SECURE_CACHE;
$FORUM_TREE_SECURE_CACHE = mixed();
global $ALL_FORUMS_STRUCT;
$ALL_FORUMS_STRUCT = NULL;
}
示例11: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
$award_types = $GLOBALS['SITE_DB']->query_select('award_types', array('*'));
$out = array();
foreach ($award_types as $award) {
// Find out how many submissions we've had since the last award was given
if (!file_exists(get_file_base() . '/sources/hooks/systems/awards/' . filter_naughty_harsh($award['a_content_type']) . '.php') && !file_exists(get_file_base() . '/sources_custom/hooks/systems/awards/' . filter_naughty_harsh($award['a_content_type']) . '.php')) {
continue;
}
require_code('hooks/systems/awards/' . $award['a_content_type']);
$hook_object = object_factory('Hook_awards_' . $award['a_content_type'], true);
if (is_null($hook_object)) {
continue;
}
$details = $hook_object->info();
if (!is_null($details)) {
$date = $GLOBALS['SITE_DB']->query_value_null_ok('award_archive', 'date_and_time', array('a_type_id' => $award['id']), 'ORDER BY date_and_time DESC');
$seconds_ago = mixed();
$limit_hours = $award['a_update_time_hours'];
if (!is_null($date)) {
$seconds_ago = time() - $date;
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$config_url = build_url(array('page' => 'admin_awards', 'type' => '_ed', 'id' => $award['id']), get_module_zone('admin_awards'));
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$url = $details['add_url'];
if (is_object($url)) {
$url = $url->evaluate();
}
$url = str_replace('=!', '_ignore=1', $url);
$task = escape_html(get_translated_text($award['a_title']));
if (!is_null($date) && !is_null($details['date_field'])) {
$where = filter_naughty_harsh($details['date_field']) . '>' . strval(intval($date));
$num_queue = $details['connection']->query_value_null_ok_full('SELECT COUNT(*) FROM ' . $details['connection']->get_table_prefix() . str_replace('1=1', $where, $details['table']) . ' r WHERE ' . $where);
$_num_queue = integer_format($num_queue);
$num_new_since = do_lang_tempcode('NUM_NEW_SINCE', $_num_queue);
} else {
$num_new_since = new ocp_tempcode();
}
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$info->attach($num_new_since);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => '4049affae5a6f38712ee3e0237a2e18e', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => $task, 'INFO' => $info));
$out[] = array($tpl, $seconds_due_in, NULL, NULL);
}
}
return $out;
}
示例12: activities_addon_syndicate_described_activity
/**
* @license http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
* @copyright ocProducts Ltd
* @package activity_feed
*/
function activities_addon_syndicate_described_activity($a_language_string_code = '', $a_label_1 = '', $a_label_2 = '', $a_label_3 = '', $a_pagelink_1 = '', $a_pagelink_2 = '', $a_pagelink_3 = '', $a_addon = '', $a_is_public = 1, $a_member_id = NULL, $sitewide_too = false, $a_also_involving = NULL)
{
require_code('activities');
require_lang('activities');
if (get_db_type() == 'xml' && get_param_integer('keep_testing_logging', 0) != 1) {
return NULL;
}
$stored_id = 0;
if (is_null($a_member_id)) {
$a_member_id = get_member();
}
if (is_guest($a_member_id)) {
return NULL;
}
$go = array('a_language_string_code' => $a_language_string_code, 'a_label_1' => $a_label_1, 'a_label_2' => $a_label_2, 'a_label_3' => $a_label_3, 'a_is_public' => $a_is_public);
$stored_id = mixed();
// Check if this has been posted previously (within the last 10 minutes) to
// stop spamming but allow generalised repeat status messages.
$test = $GLOBALS['SITE_DB']->query_select('activities', array('a_language_string_code', 'a_label_1', 'a_label_2', 'a_label_3', 'a_is_public'), NULL, 'WHERE a_time>' . strval(time() - 600), 1);
if (!array_key_exists(0, $test) || $test[0] != $go || running_script('execute_temp')) {
// Log the activity
$row = $go + array('a_member_id' => $a_member_id, 'a_also_involving' => $a_also_involving, 'a_pagelink_1' => $a_pagelink_1, 'a_pagelink_2' => $a_pagelink_2, 'a_pagelink_3' => $a_pagelink_3, 'a_time' => time(), 'a_addon' => $a_addon, 'a_is_public' => $a_is_public);
$stored_id = $GLOBALS['SITE_DB']->query_insert('activities', $row, true);
// Update the latest activity file
log_newest_activity($stored_id, 1000);
// External places
if ($a_is_public == 1 && !$GLOBALS['IS_ACTUALLY_ADMIN']) {
$dests = find_all_hooks('systems', 'syndication');
foreach (array_keys($dests) as $hook) {
require_code('hooks/systems/syndication/' . $hook);
$ob = object_factory('Hook_Syndication_' . $hook);
if ($ob->is_available()) {
$ob->syndicate_user_activity($a_member_id, $row);
if ($sitewide_too && has_specific_permission(get_member(), 'syndicate_site_activity') && post_param_integer('syndicate_this', 0) == 1) {
$ob->syndicate_site_activity($row);
}
}
}
}
list($message) = render_activity($row, false);
require_code('notifications');
$username = $GLOBALS['FORUM_DRIVER']->get_username($a_member_id);
$subject = do_lang('ACTIVITY_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $username, html_entity_decode(strip_tags($message->evaluate()), ENT_QUOTES, get_charset()));
$mail = do_lang('ACTIVITY_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($username), array('[semihtml]' . $message->evaluate() . '[/semihtml]'));
dispatch_notification('activity', strval($a_member_id), $subject, $mail);
}
return $stored_id;
}
示例13: run
/**
* Standard modular run function.
*
* @return array An array of tuples: The task row to show, the number of seconds until it is due (or NULL if not on a timer), the number of things to sort out (or NULL if not on a queue), The name of the config option that controls the schedule (or NULL if no option).
*/
function run()
{
if (!addon_installed('news')) {
return array();
}
if (get_option('blog_update_time') == '') {
return array();
}
require_lang('news');
$admin_groups = array_merge($GLOBALS['FORUM_DRIVER']->get_super_admin_groups(), $GLOBALS['FORUM_DRIVER']->get_moderator_groups());
$staff = $GLOBALS['FORUM_DRIVER']->member_group_query(array_keys($admin_groups), 100);
if (count($staff) >= 100) {
return array();
}
$or_list = '';
foreach (array_keys($staff) as $staff_id) {
if ($or_list != '') {
$or_list .= ' OR ';
}
$or_list .= 'c.nc_owner=' . strval($staff_id);
}
if ($or_list == '') {
return array();
}
$query = 'SELECT MAX(date_and_time) FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news n JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'news_categories c ON n.news_category=c.id WHERE validated=1 AND (' . $or_list . ')';
$date = $GLOBALS['SITE_DB']->query_value_null_ok_full($query);
$limit_hours = intval(get_option('blog_update_time'));
$seconds_ago = mixed();
if (!is_null($date)) {
$status = $seconds_ago > $limit_hours * 60 * 60 ? 0 : 1;
} else {
$status = 0;
}
$_status = $status == 0 ? do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_0') : do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM_STATUS_1');
$config_row = $GLOBALS['SITE_DB']->query_select('config', array('the_page', 'section'), array('the_name' => 'blog_update_time'), '', 1);
if (array_key_exists(0, $config_row)) {
$_config_url = build_url(array('page' => 'admin_config', 'type' => 'category', 'id' => $config_row[0]['the_page']), get_module_zone('admin_config'));
$config_url = $_config_url->evaluate();
$config_url .= '#group_' . $config_row[0]['section'];
} else {
$config_url = NULL;
}
$url = build_url(array('page' => 'cms_blogs', 'type' => 'ad'), get_module_zone('cms_blogs'));
list($info, $seconds_due_in) = staff_checklist_time_ago_and_due($seconds_ago, $limit_hours);
$tpl = do_template('BLOCK_MAIN_STAFF_CHECKLIST_ITEM', array('_GUID' => 'a75d4a165aa5e16ad3aa06d2e0bab5db', 'CONFIG_URL' => $config_url, 'URL' => $url, 'STATUS' => $_status, 'TASK' => do_lang_tempcode('BLOG'), 'INFO' => $info));
return array(array($tpl, $seconds_due_in, NULL, 'blog_update_time'));
}
示例14: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
if (get_option('is_on_comments') == '0') {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
$serialized_options = get_param('serialized_options', false, true);
$hash = get_param('hash');
if (best_hash($serialized_options, get_site_salt()) != $hash) {
warn_exit(do_lang_tempcode('INTERNAL_ERROR'));
}
secure_serialized_data($serialized_options);
list($topic_id, $num_to_show_limit, $allow_comments, $invisible_if_no_comments, $forum, $reverse, $may_reply, $highlight_by_user, $allow_reviews) = unserialize($serialized_options);
$posts = array_map('intval', explode(',', get_param('ids', false, true)));
$_parent_id = get_param('id', '');
$parent_id = $_parent_id == '' ? mixed() : intval($_parent_id);
require_code('topics');
$renderer = new OCP_Topic();
return $renderer->render_posts_from_topic($topic_id, $num_to_show_limit, $allow_comments, $invisible_if_no_comments, $forum, NULL, $reverse, $may_reply, $highlight_by_user, $allow_reviews, $posts, $parent_id);
}
示例15: run
/**
* Standard modular run function for OcCLE hooks.
*
* @param array The options with which the command was called
* @param array The parameters with which the command was called
* @param array A reference to the OcCLE filesystem object
* @return array Array of stdcommand, stdhtml, stdout, and stderr responses
*/
function run($options, $parameters, &$occle_fs)
{
if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
return array('', do_command_help('clear_caches', array('h'), array(true)), '', '');
} else {
require_code('view_modes');
$_caches = mixed();
if (array_key_exists(0, $parameters)) {
$_caches = array();
$caches = explode(',', $parameters[0]);
foreach ($caches as $cache) {
$_caches[] = trim($cache);
}
}
$messages = static_evaluate_tempcode(ocportal_cleanup($_caches));
if ($messages == '') {
$messages = do_lang('SUCCESS');
}
return array('', $messages, '', '');
}
}