本文整理汇总了PHP中decache函数的典型用法代码示例。如果您正苦于以下问题:PHP decache函数的具体用法?PHP decache怎么用?PHP decache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Standard modular run function for snippet hooks. Generates XHTML to insert into a page using AJAX.
*
* @return tempcode The snippet
*/
function run()
{
$type = get_param('type');
if (!has_zone_access(get_member(), 'adminzone')) {
return new ocp_tempcode();
}
decache('main_staff_checklist');
require_lang('staff_checklist');
switch ($type) {
case 'add':
$recurinterval = get_param_integer('recurinterval', 0);
$task_title = get_param('tasktitle', false, true);
$id = $GLOBALS['SITE_DB']->query_insert('customtasks', array('tasktitle' => $task_title, 'datetimeadded' => time(), 'recurinterval' => $recurinterval, 'recurevery' => get_param('recurevery'), 'taskisdone' => NULL), true);
require_code('notifications');
$subject = do_lang('CT_NOTIFICATION_MAIL_SUBJECT', get_site_name(), $task_title);
$mail = do_lang('CT_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($task_title));
dispatch_notification('checklist_task', NULL, $subject, $mail);
return do_template('BLOCK_MAIN_STAFF_CHECKLIST_CUSTOM_TASK', array('TASKTITLE' => comcode_to_tempcode(get_param('tasktitle', false, true)), 'DATETIMEADDED' => display_time_period(time()), 'RECURINTERVAL' => $recurinterval == 0 ? '' : integer_format($recurinterval), 'RECUREVERY' => get_param('recurevery'), 'TASKDONE' => 'not_completed', 'ID' => strval($id)));
case 'delete':
$GLOBALS['SITE_DB']->query_delete('customtasks', array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_done':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => time()), array('id' => get_param_integer('id')), '', 1);
break;
case 'mark_undone':
$GLOBALS['SITE_DB']->query_update('customtasks', array('taskisdone' => NULL), array('id' => get_param_integer('id')), '', 1);
break;
}
return new ocp_tempcode();
}
示例2: add_banner_quiet
/**
* Add a banner to the database, and return the new ID of that banner in the database.
*
* @param ID_TEXT The name of the banner
* @param URLPATH The URL to the banner image
* @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)
* @param SHORT_TEXT The caption of the banner
* @param ?integer The number of hits the banner may have (NULL: not applicable for this banner type)
* @range 0 max
* @param URLPATH The URL to the site the banner leads to
* @param integer The banners "importance modulus"
* @range 1 max
* @param LONG_TEXT Any notes associated with the banner
* @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)
* @param ?MEMBER 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 ?TIME The time the banner was added (NULL: now)
* @param integer The number of return hits from this banners site
* @param integer The number of banner hits to this banners site
* @param integer The number of return views from this banners site
* @param integer The number of banner views to this banners site
* @param ?TIME The banner edit date (NULL: never)
*/
function add_banner_quiet($name, $imgurl, $title_text, $caption, $campaignremaining, $site_url, $importance_modulus, $notes, $the_type, $expiry_date, $submitter, $validated = 0, $b_type = '', $time = NULL, $hits_from = 0, $hits_to = 0, $views_from = 0, $views_to = 0, $edit_date = NULL)
{
if (!is_numeric($importance_modulus)) {
$importance_modulus = 3;
}
if (!is_numeric($campaignremaining)) {
$campaignremaining = NULL;
}
if (is_null($time)) {
$time = time();
}
if (is_null($submitter)) {
$submitter = get_member();
}
$test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => $name));
if (is_null($test)) {
if (!addon_installed('unvalidated')) {
$validated = 1;
}
$GLOBALS['SITE_DB']->query_insert('banners', array('b_title_text' => $title_text, 'b_type' => $b_type, 'edit_date' => $edit_date, 'add_date' => $time, 'expiry_date' => $expiry_date, 'the_type' => $the_type, 'submitter' => $submitter, 'name' => $name, 'img_url' => $imgurl, 'caption' => insert_lang_comcode($caption, 2), 'campaign_remaining' => $campaignremaining, 'site_url' => $site_url, 'importance_modulus' => $importance_modulus, 'notes' => '', 'validated' => $validated, 'hits_from' => $hits_from, 'hits_to' => $hits_to, 'views_from' => $views_from, 'views_to' => $views_to));
if (function_exists('decache')) {
decache('main_banner_wave');
decache('main_topsites');
}
log_it('ADD_BANNER', $name, $caption);
}
}
示例3: ocf_make_topic
/**
* Add a topic.
*
* @param ?AUTO_LINK The ID of the forum the topic will be in (NULL: Private Topic).
* @param SHORT_TEXT Description of the topic.
* @param SHORT_TEXT The theme image code of the emoticon for the topic.
* @param ?BINARY Whether the topic is validated (NULL: detect whether it should be).
* @param BINARY Whether the topic is open.
* @param BINARY Whether the topic is pinned.
* @param BINARY Whether the topic is sunk.
* @param BINARY Whether the topic is cascading.
* @param ?MEMBER If it is a Private Topic, who is it 'from' (NULL: not a Private Topic).
* @param ?MEMBER If it is a Private Topic, who is it 'to' (NULL: not a Private Topic).
* @param boolean Whether to check the poster has permissions for the given topic settings.
* @param integer The number of times the topic has been viewed.
* @param ?AUTO_LINK Force an ID (NULL: don't force an ID)
* @param SHORT_TEXT Link related to the topic (e.g. link to view a ticket).
* @return AUTO_LINK The ID of the newly created topic.
*/
function ocf_make_topic($forum_id, $description = '', $emoticon = '', $validated = NULL, $open = 1, $pinned = 0, $sunk = 0, $cascading = 0, $pt_from = NULL, $pt_to = NULL, $check_perms = true, $num_views = 0, $id = NULL, $description_link = '')
{
if (is_null($pinned)) {
$pinned = 0;
}
if (is_null($sunk)) {
$sunk = 0;
}
if (is_null($description)) {
$description = '';
}
if (is_null($num_views)) {
$num_views = 0;
}
if ($check_perms) {
require_code('ocf_topics');
if (!ocf_may_post_topic($forum_id, get_member())) {
access_denied('I_ERROR');
}
if (!is_null($pt_to)) {
decache('side_ocf_personal_topics', array($pt_to));
decache('_new_pp', array($pt_to));
}
if (!is_null($forum_id)) {
require_code('ocf_posts_action');
ocf_decache_ocp_blocks($forum_id);
}
require_code('ocf_forums');
if (!ocf_may_moderate_forum($forum_id)) {
$pinned = 0;
$sunk = 0;
$open = 1;
$cascading = 0;
}
}
if (is_null($validated) || $check_perms && $validated == 1) {
if (!is_null($forum_id) && !has_specific_permission(get_member(), 'bypass_validation_midrange_content', 'topics', array('forums', $forum_id))) {
$validated = 0;
} else {
$validated = 1;
}
}
if (!addon_installed('unvalidated')) {
$validated = 1;
}
$map = array('t_pinned' => $pinned, 't_sunk' => $sunk, 't_cascading' => $cascading, 't_forum_id' => $forum_id, 't_pt_from' => $pt_from, 't_pt_to' => $pt_to, 't_description' => substr($description, 0, 255), 't_description_link' => substr($description_link, 0, 255), 't_emoticon' => $emoticon, 't_num_views' => $num_views, 't_validated' => $validated, 't_is_open' => $open, 't_poll_id' => NULL, 't_cache_first_post_id' => NULL, 't_cache_first_post' => NULL, 't_cache_first_time' => NULL, 't_cache_first_title' => '', 't_cache_first_username' => '', 't_cache_first_member_id' => NULL, 't_cache_last_post_id' => NULL, 't_cache_last_time' => NULL, 't_cache_last_title' => '', 't_cache_last_username' => '', 't_cache_last_member_id' => NULL, 't_cache_num_posts' => 0, 't_pt_from_category' => '', 't_pt_to_category' => '');
if (!is_null($id)) {
$map['id'] = $id;
}
return $GLOBALS['FORUM_DB']->query_insert('f_topics', $map, true);
}
示例4: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (!addon_installed('catalogues')) {
return;
}
$last = get_value('last_classified_refresh');
$time = time();
if (!is_null($last) && intval($last) > $time - 60 * 60) {
return;
}
// Don't do more than once per hour
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
$start = 0;
do {
$entries = $GLOBALS['SITE_DB']->query_select('catalogue_entries e JOIN ' . get_table_prefix() . 'classifieds_prices p ON p.c_catalogue_name=e.c_name', array('e.*'), array('ce_validated' => 1), '', 1000, $start);
foreach ($entries as $entry) {
if ($entry['ce_last_moved'] == $entry['ce_add_date']) {
require_code('classifieds');
initialise_classified_listing($entry);
}
// Expiring
if ($entry['ce_last_moved'] < $time) {
$GLOBALS['SITE_DB']->query_update('catalogue_entries', array('ce_validated' => 0), array('id' => $entry['id']), '', 1);
decache('main_cc_embed');
decache('main_recent_cc_entries');
require_code('catalogues2');
calculate_category_child_count_cache($entry['cc_id']);
} elseif ($entry['ce_last_moved'] < $time + 60 * 60 * 24 && $entry['ce_last_moved'] > $time + 60 * 60 * 23) {
// Expiring in 24 hours
require_code('notifications');
require_lang('classifieds');
$member_id = $entry['ce_submitter'];
$renew_url = build_url(array('page' => 'classifieds', 'type' => 'adverts', 'id' => $member_id), get_module_zone('classifieds'));
require_code('catalogues');
$data_map = get_catalogue_entry_map($entry, NULL, 'CATEGORY', 'DEFAULT', NULL, NULL, array(0));
$ad_title = $data_map['FIELD_0_PLAIN'];
if (is_object($ad_title)) {
$ad_title = $ad_title->evaluate();
}
$subject_tag = do_lang('SUBJECT_CLASSIFIED_ADVERT_EXPIRING', $ad_title, get_site_name(), NULL, get_lang($member_id), false);
$mail = do_lang('MAIL_CLASSIFIED_ADVERT_EXPIRING', $ad_title, comcode_escape(get_site_name()), comcode_escape($renew_url->evaluate()), get_lang($member_id), false);
// Send actual notification
dispatch_notification('classifieds__' . $entry['c_name'], '', $subject_tag, $mail, array($member_id), A_FROM_SYSTEM_PRIVILEGED);
}
}
} while (count($entries) == 1000);
set_value('last_classified_refresh', strval($time));
}
示例5: run
/**
* Standard modular run function for CRON hooks. Searches for tasks to perform.
*/
function run()
{
if (!addon_installed('backup')) {
return;
}
$backup_schedule_time = intval(get_value('backup_schedule_time'));
if ($backup_schedule_time != 0) {
$backup_recurrance_days = intval(get_value('backup_recurrance_days'));
$time = time();
$last_time = intval(get_value('last_backup'));
if ($time >= $backup_schedule_time) {
decache('main_staff_checklist');
require_lang('backups');
require_code('backup');
$max_size = get_value('backup_max_size');
$b_type = get_value('backup_b_type');
global $MB2_FILE, $MB2_B_TYPE, $MB2_MAX_SIZE;
$end = get_option('backup_overwrite') != '1' || $b_type == 'incremental' ? uniqid('', true) : 'scheduled';
if ($b_type == 'full') {
$file = 'restore_' . $end;
} elseif ($b_type == 'incremental') {
$file = 'dif_' . $end;
} elseif ($b_type == 'sql') {
$file = 'database_' . $end;
}
$MB2_FILE = $file;
$MB2_B_TYPE = $b_type;
$MB2_MAX_SIZE = $max_size;
register_shutdown_function('make_backup_2');
if ($backup_recurrance_days == 0) {
delete_value('backup_schedule_time');
} else {
set_value('backup_schedule_time', strval($backup_schedule_time + $backup_recurrance_days * 60 * 60 * 24));
}
}
}
}
示例6: run
/**
* Standard modular run function.
*
* @param array A map of parameters.
* @return tempcode The result of execution.
*/
function run($map)
{
if (!array_key_exists('param', $map)) {
$map['param'] = 'main';
}
if (!array_key_exists('page', $map)) {
$map['page'] = get_page_name();
}
if (array_key_exists('extra_param_from', $map)) {
$extra = '_' . $map['extra_param_from'];
} else {
$extra = '';
}
require_code('feedback');
$self_url = get_self_url();
$self_title = $map['page'];
$id = $map['page'] . '_' . $map['param'] . $extra;
$test_changed = post_param('rating_' . $id, '');
if ($test_changed != '') {
decache('main_rating');
}
actualise_rating(true, 'block_main_rating', $id, $self_url, $self_title);
return get_rating_box($self_url, $self_title, 'block_main_rating', $id, true);
}
示例7: do_gallery
//.........这里部分代码省略.........
$add_gallery_url = new ocp_tempcode();
}
$may_download_gallery = has_specific_permission(get_member(), 'may_download_gallery', 'galleries', array('galleries', $cat));
$tree = gallery_breadcrumbs($cat, $root, true, get_module_zone('galleries'));
if (!$tree->is_empty()) {
$tree->attach(do_template('BREADCRUMB_ESCAPED'));
}
if (has_specific_permission(get_member(), 'open_virtual_roots')) {
$url = get_self_url(false, false, array('root' => $cat));
$tree->attach(hyperlink($url, escape_html($fullname), false, false, do_lang_tempcode('VIRTUAL_ROOT')));
} else {
$tree->attach('<span>' . escape_html($fullname) . '</span>');
}
$myrow['flow_mode_interface'] = get_param_integer('flow_mode_interface', $myrow['flow_mode_interface']);
// Allow override via URL
// Flow mode puts emphasis on subgalleries, rather than entries; it is subgalleries that there are a lot of, rather than entries
if ($myrow['flow_mode_interface'] == 1) {
$max = get_param_integer('max', get_default_gallery_max());
if ($max < 1) {
$max = 1;
}
$start = get_param_integer('start', 0);
} else {
$max = NULL;
$start = NULL;
}
// Subgalleries
$order = 'add_date DESC';
if (get_option('gallery_name_order') == '1') {
$order = 'name ASC';
}
$rows_children = $GLOBALS['SITE_DB']->query_select('galleries', array('*'), array('parent_id' => $cat), 'ORDER BY ' . $order, 200);
$children = new ocp_tempcode();
$num_galleries = 0;
if (count($rows_children) == 200) {
$rows_children = array();
}
// Lots of personal galleries. Will need to be reached via member profiles
foreach ($rows_children as $child) {
if (substr($child['name'], 0, 9) == 'download_') {
continue;
}
if (!has_category_access(get_member(), 'galleries', $child['name'])) {
continue;
}
if (get_option('show_empty_galleries') == '1' || gallery_has_content($child['name'])) {
if (is_null($max) || $num_galleries >= $start && $num_galleries < $start + $max) {
$content = show_gallery_box($child, $root, true, get_zone_name(), get_option('show_empty_galleries') != '1');
if (!$content->is_empty()) {
$children->attach(do_template('GALLERY_SUBGALLERY_WRAP', array('CONTENT' => $content)));
}
}
$num_galleries++;
}
}
// Views
if (get_db_type() != 'xml') {
$myrow['gallery_views']++;
$GLOBALS['SITE_DB']->query_update('galleries', array('gallery_views' => $myrow['gallery_views']), array('name' => $cat), '', 1, NULL, false, true);
}
// Page title
if (addon_installed('awards')) {
require_code('awards');
$awards = find_awards_for('gallery', $cat);
} else {
$awards = array();
}
$title_to_use = do_lang_tempcode('_GALLERY', escape_html($fullname));
$title_to_use_2 = do_lang('_GALLERY', $fullname);
$title = get_page_title($title_to_use, false, NULL, NULL, $awards);
seo_meta_load_for('gallery', $cat, $title_to_use_2);
$rep_image = $myrow['rep_image'];
if (post_param_integer('rating_' . $cat, -1) != -1) {
decache('main_top_galleries');
}
list($rating_details, $comment_details, $trackback_details) = embed_feedback_systems(get_page_name(), $cat, $myrow['allow_rating'], $myrow['allow_comments'], 0, 1, NULL, build_url(array('page' => '_SELF'), '_SELF', NULL, true, false, true), $title_to_use_2, get_value('comment_forum__galleries'));
breadcrumb_add_segment($tree);
$GLOBALS['META_DATA'] += array('created' => date('Y-m-d', $myrow['add_date']), 'creator' => is_null($myrow['g_owner']) ? '' : $GLOBALS['FORUM_DRIVER']->get_username($myrow['g_owner']), 'publisher' => '', 'modified' => '', 'type' => 'Gallery', 'title' => $fullname, 'identifier' => '_SEARCH:galleries:misc:' . $cat, 'description' => get_translated_text($myrow['description']));
if ($rep_image != '') {
$GLOBALS['META_DATA'] += array('image' => (url_is_local($rep_image) ? get_custom_base_url() . '/' : '') . $rep_image);
}
// Sorting
list($sort, $sort_backwards, $sql_suffix_images, $sql_suffix_videos) = $this->get_sort_order();
if (get_option('is_on_rating') == '1') {
$_selectors['compound_rating DESC'] = 'POPULARITY';
}
$_selectors = array_merge($_selectors, array('url ASC' => 'FILENAME', 'add_date ASC' => 'OLDEST_FIRST', 'add_date DESC' => 'NEWEST_FIRST', 'title ASC' => 'TITLE'));
$selectors = new ocp_tempcode();
foreach ($_selectors as $selector_value => $selector_name) {
$selected = $sort == $selector_value;
$selectors->attach(do_template('RESULTS_BROWSER_SORTER', array('SELECTED' => $selected, 'NAME' => do_lang_tempcode($selector_name), 'VALUE' => $selector_value)));
}
$sort_url = get_self_url(false, false, array('sort' => NULL), false, true);
$sorting = do_template('RESULTS_BROWSER_SORT', array('SORT' => 'sort', 'RAND' => uniqid(''), 'URL' => $sort_url, 'SELECTORS' => $selectors));
if ($myrow['flow_mode_interface'] == 1) {
return $this->do_gallery_flow_mode($rating_details, $comment_details, $cat, $root, $description, $children, $may_download_gallery, $edit_url, $add_gallery_url, $submit_image_url, $submit_video_url, $title, $rep_image, $start, $max, $num_galleries, $fullname, $sorting);
} else {
return $this->do_gallery_regular_mode($rating_details, $comment_details, $cat, $root, $description, $children, $may_download_gallery, $edit_url, $add_gallery_url, $submit_image_url, $submit_video_url, $title, $fullname, $sorting);
}
}
示例8: delete_gallery
/**
* Delete a specified gallery.
*
* @param ID_TEXT The gallery codename
*/
function delete_gallery($name)
{
if ($name == '') {
warn_exit(do_lang_tempcode('NO_DELETE_ROOT'));
}
$rows = $GLOBALS['SITE_DB']->query_select('galleries', array('*'), array('name' => $name), '', 1);
if (!array_key_exists(0, $rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
require_code('files2');
delete_upload('uploads/grepimages', 'galleries', 'rep_image', 'name', $name);
delete_upload('uploads/watermarks', 'galleries', 'watermark_top_left', 'name', $name);
delete_upload('uploads/watermarks', 'galleries', 'watermark_top_right', 'name', $name);
delete_upload('uploads/watermarks', 'galleries', 'watermark_bottom_left', 'name', $name);
delete_upload('uploads/watermarks', 'galleries', 'watermark_bottom_right', 'name', $name);
log_it('DELETE_GALLERY', $name, get_translated_text($rows[0]['fullname']));
delete_lang($rows[0]['fullname']);
delete_lang($rows[0]['description']);
delete_lang($rows[0]['teaser']);
// Images and videos are deleted, because we are deleting the _gallery_, not just a category (nobody is going to be deleting galleries with the expectation of moving the image to a different one in bulk - unlike download categories, for example).
if (function_exists('set_time_limit')) {
@set_time_limit(0);
}
do {
$images = $GLOBALS['SITE_DB']->query_select('images', array('id'), array('cat' => $name), '', 200);
foreach ($images as $image) {
delete_image($image['id'], false);
}
} while ($images != array());
do {
$videos = $GLOBALS['SITE_DB']->query_select('videos', array('id'), array('cat' => $name), '', 200);
foreach ($videos as $video) {
delete_video($video['id'], false);
}
} while ($images != array());
//... but the subgalleries remain
$GLOBALS['SITE_DB']->query_update('galleries', array('parent_id' => $rows[0]['parent_id']), array('parent_id' => $name));
$GLOBALS['SITE_DB']->query_delete('galleries', array('name' => $name), '', 1);
$GLOBALS['SITE_DB']->query_delete('rating', array('rating_for_type' => 'images', 'rating_for_id' => $name));
$GLOBALS['SITE_DB']->query_delete('rating', array('rating_for_type' => 'videos', 'rating_for_id' => $name));
require_code('seo2');
seo_meta_erase_storage('gallery', $name);
$GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'galleries', 'category_name' => $name));
$GLOBALS['SITE_DB']->query_delete('gsp', array('module_the_name' => 'galleries', 'category_name' => $name));
decache('main_top_galleries');
decache('main_recent_galleries');
decache('main_root_galleries');
decache('side_root_galleries');
}
示例9: delete_news
/**
* Delete a news entry.
*
* @param AUTO_LINK The ID of the news to edit
*/
function delete_news($id)
{
$rows = $GLOBALS['SITE_DB']->query_select('news', array('title', 'news', 'news_article'), array('id' => $id), '', 1);
if (!array_key_exists(0, $rows)) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$title = $rows[0]['title'];
$news = $rows[0]['news'];
$news_article = $rows[0]['news_article'];
$_title = get_translated_text($title);
log_it('DELETE_NEWS', strval($id), $_title);
require_code('files2');
delete_upload('uploads/grepimages', 'news', 'news_image', 'id', $id);
$GLOBALS['SITE_DB']->query_delete('news', array('id' => $id), '', 1);
$GLOBALS['SITE_DB']->query_delete('news_category_entries', array('news_entry' => $id));
$GLOBALS['SITE_DB']->query_delete('rating', array('rating_for_type' => 'news', 'rating_for_id' => $id));
$GLOBALS['SITE_DB']->query_delete('trackbacks', array('trackback_for_type' => 'news', 'trackback_for_id' => $id));
delete_lang($title);
delete_lang($news);
require_code('attachments2');
require_code('attachments3');
if (!is_null($news_article)) {
delete_lang_comcode_attachments($news_article, 'news', strval($id));
}
require_code('seo2');
seo_meta_erase_storage('news', strval($id));
decache('main_news');
decache('side_news');
decache('side_news_archive');
decache('bottom_news');
}
示例10: _move
//.........这里部分代码省略.........
if (substr($key, 0, 6) == 'page__' && $val === '1') {
$page = substr($key, 6);
$page_details = _request_page($page, $zone, NULL, NULL, true);
if ($page_details === false) {
warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
}
$pages[$page] = strtolower($page_details[0]);
if (array_key_exists(3, $page_details)) {
$pages[$page] .= '/' . $page_details[3];
}
}
}
$afm_needed = false;
foreach ($pages as $page => $type) {
if (post_param_integer('page__' . $page, 0) == 1) {
if ($type != 'comcode_custom') {
$afm_needed = true;
}
}
}
if ($afm_needed) {
require_code('abstract_file_manager');
force_have_afm_details();
}
$cannot_move = new ocp_tempcode();
foreach ($pages as $page => $type) {
if (!is_string($page)) {
$page = strval($page);
}
if (post_param_integer('page__' . $page, 0) == 1) {
if (substr($type, 0, 7) == 'modules') {
$_page = $page . '.php';
} elseif (substr($type, 0, 7) == 'comcode') {
$_page = $page . '.txt';
} elseif (substr($type, 0, 4) == 'html') {
$_page = $page . '.htm';
}
if (file_exists(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page))) {
if (!$cannot_move->is_empty()) {
$cannot_move->attach(do_lang_tempcode('LIST_SEP'));
}
$cannot_move->attach(do_lang_tempcode('PAGE_WRITE', escape_html($page)));
continue;
}
}
}
$moved_something = NULL;
foreach ($pages as $page => $type) {
if (!is_string($page)) {
$page = strval($page);
}
if (post_param_integer('page__' . $page, 0) == 1) {
$moved_something = $page;
if (substr($type, 0, 7) == 'modules') {
$_page = $page . '.php';
} elseif (substr($type, 0, 7) == 'comcode') {
$_page = $page . '.txt';
} elseif (substr($type, 0, 4) == 'html') {
$_page = $page . '.htm';
}
if (file_exists(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page))) {
continue;
}
if (file_exists(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page))) {
if ($afm_needed) {
afm_move(zone_black_magic_filterer(filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page, true), zone_black_magic_filterer(filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page, true));
} else {
rename(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page), zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty($type) . '/' . $_page));
}
}
// If a non-overridden one is there too, need to move that too
if (strpos($type, '_custom') !== false && file_exists(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page)) && !file_exists(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page))) {
if ($afm_needed) {
afm_move(zone_black_magic_filterer(filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page, true), zone_black_magic_filterer(filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page, true));
} else {
rename(zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($zone) . ($zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page), zone_black_magic_filterer(get_custom_file_base() . '/' . filter_naughty($new_zone) . ($new_zone != '' ? '/' : '') . 'pages/' . filter_naughty(str_replace('_custom', '', $type)) . '/' . $_page));
}
}
log_it('MOVE_PAGES', $page);
}
}
if (is_null($moved_something)) {
warn_exit(do_lang_tempcode('NOTHING_SELECTED'));
}
persistant_cache_empty();
require_lang('addons');
if ($cannot_move->is_empty()) {
$message = do_lang_tempcode('SUCCESS');
} else {
$message = do_lang_tempcode('WOULD_NOT_OVERWRITE_BUT_SUCCESS', $cannot_move);
}
breadcrumb_set_self(do_lang_tempcode('DONE'));
breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('PAGES')), array('_SELF:_SELF:move', do_lang_tempcode('MOVE_PAGES'))));
decache('main_sitemap');
if (has_js()) {
return inform_screen($title, $message);
// Came from site-tree editor, so want to just close this window when done
}
return $this->do_next_manager($title, $moved_something, $new_zone, new ocp_tempcode());
}
示例11: __ed
//.........这里部分代码省略.........
$temp_points = point_info($recipient_id);
$GLOBALS['FORUM_DRIVER']->set_custom_field($recipient_id, 'points_gained_given', strval((array_key_exists('points_gained_given', $temp_points) ? $temp_points['points_gained_given'] : 0) - $amount));
}
}
}
} else {
$submitter = NULL;
}
breadcrumb_set_parents(array_merge($GLOBALS['BREADCRUMB_SET_PARENTS'], array(array('_SELF:_SELF:_e' . $this->type_code . ':' . $id, strpos($doing, ' ') !== false ? protect_from_escaping($doing) : do_lang_tempcode($doing)))));
$delete = post_param_integer('delete', 0);
if ($delete == 1 || $delete == 2) {
if (!is_null($this->permissions_require)) {
check_delete_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
}
$doing = 'DELETE_' . $this->lang_type;
if ($this->catalogue && get_param('catalogue_name', '') != '') {
$catalogue_title = get_translated_text($GLOBALS['SITE_DB']->query_value('catalogues', 'c_title', array('c_name' => get_param('catalogue_name'))));
if ($this->type_code == 'd') {
$doing = do_lang('CATALOGUE_GENERIC_DELETE', escape_html($catalogue_title));
} elseif ($this->type_code == 'c') {
$doing = do_lang('CATALOGUE_GENERIC_DELETE_CATEGORY', escape_html($catalogue_title));
}
}
$title = get_page_title($doing);
$test = $this->handle_confirmations($title);
if (!is_null($test)) {
return $test;
}
$this->delete_actualisation($id);
// Delete custom fields
if ($this->has_tied_catalogue()) {
require_code('fields');
delete_form_custom_fields($this->award_type, $id);
}
/*if ((!is_null($this->redirect_type)) || ((!is_null(get_param('redirect',NULL))))) No - resource is gone now, and redirect would almost certainly try to take us back there
{
$url=(($this->redirect_type=='!') || (is_null($this->redirect_type)))?get_param('redirect'):build_url(array('page'=>'_SELF','type'=>$this->redirect_type),'_SELF');
return redirect_screen($title,$url,do_lang_tempcode('SUCCESS'));
}*/
clear_ocp_autosave();
$description = is_null($this->do_next_description) ? do_lang_tempcode('SUCCESS') : $this->do_next_description;
return $this->do_next_manager($title, $description, NULL);
} else {
if (!is_null($this->permissions_require)) {
check_edit_permission($this->permissions_require, $submitter, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? NULL : $this->get_cat($id), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? NULL : $this->get_cat_b($id)), $this->permission_page_name);
}
$test = $this->handle_confirmations($title);
if (!is_null($test)) {
return $test;
}
if ($this->user_facing && !is_null($this->permissions_require) && array_key_exists('validated', $_POST)) {
if (!has_specific_permission(get_member(), 'bypass_validation_' . $this->permissions_require . 'range_content', $this->permission_page_name, array($this->permissions_cat_require, is_null($this->permissions_cat_name) ? '' : post_param($this->permissions_cat_name), $this->permissions_cat_require_b, is_null($this->permissions_cat_name_b) ? '' : post_param($this->permissions_cat_name_b)))) {
$_POST['validated'] = '0';
}
}
if (!is_null($this->upload)) {
require_code('uploads');
}
$description = $this->edit_actualisation($id);
if (!is_null($this->new_id)) {
$id = $this->new_id;
}
// Save custom fields
if ($this->has_tied_catalogue()) {
require_code('fields');
save_form_custom_fields($this->award_type, $id);
}
if ($this->output_of_action_is_confirmation && !is_null($description)) {
return $description;
}
if (is_null($description)) {
$description = do_lang_tempcode('SUCCESS');
}
if (addon_installed('awards')) {
if (!is_null($this->award_type)) {
require_code('awards');
handle_award_setting($this->award_type, $id);
}
}
if ($this->user_facing) {
if ($this->check_validation && post_param_integer('validated', 0) == 0) {
require_code('submit');
if ($this->send_validation_request) {
$edit_url = build_url(array('page' => '_SELF', 'type' => '_e' . $this->type_code, 'id' => $id, 'validated' => 1), '_SELF', NULL, false, false, true);
if (addon_installed('unvalidated')) {
send_validation_request($doing, $this->table, $this->non_integer_id, $id, $edit_url);
}
}
$description->attach(paragraph(do_lang_tempcode('SUBMIT_UNVALIDATED')));
}
}
}
if (!is_null($this->redirect_type) || !is_null(get_param('redirect', NULL))) {
$url = $this->redirect_type == '!' || is_null($this->redirect_type) ? make_string_tempcode(get_param('redirect')) : build_url(array('page' => '_SELF', 'type' => $this->redirect_type), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS'));
}
clear_ocp_autosave();
decache('main_awards');
return $this->do_next_manager($title, $description, $id);
}
示例12: set_specific_permissions
/**
* The actualiser to set privileges.
*
* @return tempcode The UI
*/
function set_specific_permissions()
{
require_all_lang();
$GLOBALS['HELPER_PANEL_PIC'] = 'pagepics/privileges';
$GLOBALS['HELPER_PANEL_TUTORIAL'] = 'tut_permissions';
if (count($_POST) == 0 && strtolower(ocp_srv('REQUEST_METHOD')) != 'post') {
warn_exit(do_lang_tempcode('PERMISSION_TRAGEDY_PREVENTED'));
}
$title = get_page_title('SPECIFIC_PERMISSIONS');
$p_section = get_param('id');
$_sections = $this->_get_ordered_sections();
$array_keys = array_keys($_sections);
$next_section = $array_keys[0];
$counter = 0;
foreach ($_sections as $s) {
if (is_null($s)) {
continue;
}
if ($counter > array_search($p_section, $array_keys)) {
$next_section = $s['p_section'];
break;
}
$counter++;
}
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
$permissions = collapse_1d_complexity('the_name', $GLOBALS['SITE_DB']->query_select('sp_list', array('the_name'), array('p_section' => $p_section)));
$admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
foreach ($permissions as $permission) {
foreach (array_keys($groups) as $id) {
if (in_array($id, $admin_groups)) {
continue;
}
$val = post_param_integer($permission . '__' . strval($id), 0);
// Delete to cleanup
$GLOBALS['SITE_DB']->query_delete('gsp', array('specific_permission' => $permission, 'group_id' => $id, 'the_page' => '', 'module_the_name' => '', 'category_name' => ''), '', 1);
if ($val == 1) {
$GLOBALS['SITE_DB']->query_insert('gsp', array('specific_permission' => $permission, 'group_id' => $id, 'the_page' => '', 'module_the_name' => '', 'category_name' => '', 'the_value' => 1));
}
}
}
breadcrumb_set_parents(array(array('_SELF:_SELF:specific', do_lang_tempcode('CHOOSE'))));
decache('main_sitemap');
$GLOBALS['SITE_DB']->query_delete('cache');
if (function_exists('persistant_cache_empty')) {
persistant_cache_empty();
}
// Show it worked / Refresh
$url = build_url(array('page' => '_SELF', 'type' => 'specific', 'id' => $next_section), '_SELF');
return redirect_screen($title, $url, do_lang_tempcode('SUCCESS_NOW_NEXT_SCREEN'));
}
示例13: _log_it
/**
* Log an action
*
* @param ID_TEXT The type of activity just carried out (a lang string)
* @param ?SHORT_TEXT The most important parameter of the activity (e.g. id) (NULL: none)
* @param ?SHORT_TEXT A secondary (perhaps, human readable) parameter of the activity (e.g. caption) (NULL: none)
*/
function _log_it($type, $a = NULL, $b = NULL)
{
if (!function_exists('get_member')) {
return;
}
// If this is during installation
if (get_option('site_closed') == '1' && get_option('no_stats_when_closed', true) === '1') {
return;
}
// Run hooks, if any exist
$hooks = find_all_hooks('systems', 'upon_action_logging');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/upon_action_logging/' . filter_naughty($hook));
$ob = object_factory('upon_action_logging' . filter_naughty($hook), true);
if (is_null($ob)) {
continue;
}
$ob->run($type, $a, $b);
}
$ip = get_ip_address();
$GLOBALS['SITE_DB']->query_insert('adminlogs', array('the_type' => $type, 'param_a' => is_null($a) ? '' : substr($a, 0, 80), 'param_b' => is_null($b) ? '' : substr($b, 0, 80), 'date_and_time' => time(), 'the_user' => get_member(), 'ip' => $ip));
decache('side_tag_cloud');
decache('main_staff_actions');
decache('main_staff_checklist');
decache('main_awards');
decache('main_multi_content');
decache('side_stored_menu');
// Due to the content counts in the CMS/Admin Zones
if (get_page_name() != 'admin_themewizard' && get_page_name() != 'admin_import') {
require_all_lang();
static $logged = 0;
$logged++;
if ($logged < 10) {
require_all_lang();
if (is_null($a)) {
$a = do_lang('NA');
}
if (is_null($a)) {
$a = do_lang('NA');
}
require_code('notifications');
$subject = do_lang('ACTIONLOG_NOTIFICATION_MAIL_SUBJECT', get_site_name(), do_lang($type), array($a, $b));
$mail = do_lang('ACTIONLOG_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape(do_lang($type)), array(is_null($a) ? '' : comcode_escape($a), is_null($b) ? '' : comcode_escape($b)));
if (addon_installed('actionlog')) {
dispatch_notification('actionlog', $type, $subject, $mail);
}
}
}
}
示例14: set_permissions
/**
* Set zone access permissions from info in the POST request.
*
* @param ID_TEXT The zone that we're setting permissions for
*/
function set_permissions($zone)
{
$groups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list(false, true);
$admin_groups = $GLOBALS['FORUM_DRIVER']->get_super_admin_groups();
foreach (array_keys($groups) as $id) {
if (in_array($id, $admin_groups)) {
continue;
}
$value = post_param_integer('access_' . strval($id), 0);
$GLOBALS['SITE_DB']->query_delete('group_zone_access', array('zone_name' => $zone, 'group_id' => $id), '', 1);
if ($value == 1) {
$GLOBALS['SITE_DB']->query_insert('group_zone_access', array('zone_name' => $zone, 'group_id' => $id));
}
}
decache('main_sitemap');
$GLOBALS['SITE_DB']->query_delete('cache');
if (function_exists('persistant_cache_empty')) {
persistant_cache_empty();
}
}
示例15: site_tree_script
//.........这里部分代码省略.........
// If $_pagelinks[0] is NULL then it's an error: extract_page_link_permissions is always there when there are cat permissions
// Insertion
foreach ($groups as $group => $group_name) {
if (!in_array($group, $admin_groups)) {
// View access
$view = post_param_integer(strval($i) . 'g_view_' . strval($group), -1);
if ($view != -1) {
$GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => $module, 'category_name' => $category, 'group_id' => $group));
if ($view == 1) {
$GLOBALS['SITE_DB']->query_insert('group_category_access', array('module_the_name' => $module, 'category_name' => $category, 'group_id' => $group));
}
}
// SP's
foreach ($overridables as $overide => $cat_support) {
if (is_array($cat_support)) {
$cat_support = $cat_support[0];
}
if ($cat_support == 0) {
continue;
}
$val = post_param_integer(strval($i) . 'gsp_' . $overide . '_' . strval($group), -2);
if ($val != -2) {
$GLOBALS['SITE_DB']->query_delete('gsp', array('specific_permission' => $overide, 'group_id' => $group, 'module_the_name' => $module, 'category_name' => $category, 'the_page' => ''));
if ($val != -1) {
$new_settings = array('specific_permission' => $overide, 'group_id' => $group, 'module_the_name' => $module, 'category_name' => $category, 'the_page' => '', 'the_value' => $val);
$GLOBALS['SITE_DB']->query_insert('gsp', $new_settings);
}
}
}
}
}
}
}
decache('main_sitemap');
$GLOBALS['SITE_DB']->query_delete('cache');
if (function_exists('persistant_cache_empty')) {
persistant_cache_empty();
}
// Tra la la tada
return;
}
// =======
// Loading
// =======
$default = get_param('default', NULL, true);
header('Content-Type: text/xml');
$permissions_needed = get_param_integer('get_perms', 0) == 1;
// Whether we are limiting our tree to permission-supporting
@ini_set('ocproducts.xss_detect', '0');
echo '<' . '?xml version="1.0" encoding="' . get_charset() . '"?' . '>';
echo '<request><result>';
require_lang('permissions');
require_lang('zones');
$page_link = get_param('id', NULL, true);
$_sp_access = $GLOBALS['SITE_DB']->query_select('gsp', array('*'));
$sp_access = array();
foreach ($_sp_access as $a) {
if (!isset($sp_access[$a['group_id']])) {
$sp_access[$a['group_id']] = array();
}
$sp_access[$a['group_id']][] = $a;
}
if (!is_null($page_link) && $page_link != '' && (strpos($page_link, ':') === false || strpos($page_link, ':') === strlen($page_link) - 1)) {
if (strpos($page_link, ':') === strlen($page_link) - 1) {
$page_link = substr($page_link, 0, strlen($page_link) - 1);
}