本文整理汇总了PHP中CACHE_remove_instance函数的典型用法代码示例。如果您正苦于以下问题:PHP CACHE_remove_instance函数的具体用法?PHP CACHE_remove_instance怎么用?PHP CACHE_remove_instance使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CACHE_remove_instance函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SI_save_site
/**
* Saves the site social memberships
*
* @return none
*
*/
function SI_save_site()
{
global $_CONF, $_TABLES;
$retval = '';
$uid = -1;
// use -1 for site items
$cfg =& config::get_instance();
// run through the POST vars to see which ones are set.
$social_services = SOC_followMeProfile($uid);
foreach ($social_services as $service) {
$service_input = $service['service'] . '_username';
if (isset($_POST['$service_input'])) {
$_POST[$service_input] = strip_tags($_POST[$service_input]);
}
}
foreach ($social_services as $service) {
$service_input = $service['service'] . '_username';
$_POST[$service_input] = DB_escapeString($_POST[$service_input]);
if ($_POST[$service_input] != '') {
$sql = "REPLACE INTO {$_TABLES['social_follow_user']} (ssid,uid,ss_username) ";
$sql .= " VALUES (" . (int) $service['service_id'] . "," . $uid . ",'" . $_POST[$service_input] . "');";
DB_query($sql, 1);
} else {
$sql = "DELETE FROM {$_TABLES['social_follow_user']} WHERE ssid = " . (int) $service['service_id'] . " AND uid=" . (int) $uid;
DB_query($sql, 1);
}
}
if (isset($_POST['extra'])) {
$extra = $_POST['extra'];
$cfg->set('social_site_extra', $extra, 'social_internal');
}
CACHE_remove_instance('social_site');
return $retval;
}
示例2: plugin_configchange_article
/**
* Config Option has changed. (use plugin api)
*
* @return void
*/
function plugin_configchange_article($group, $changes = array())
{
global $_TABLES, $_CONF;
// If trim length changes then need to redo all related url's for articles
if ($group == 'Core' && in_array('whats_related_trim', $changes)) {
$sql = "SELECT sid, introtext, bodytext FROM {$_TABLES['stories']}";
$result = DB_query($sql);
$nrows = DB_numRows($result);
if ($nrows > 0) {
for ($x = 0; $x < $nrows; $x++) {
$A = DB_fetchArray($result);
// Should maybe retrieve through story service but just grab from database and apply any autotags
// This is all the related story column should really need
$fulltext = PLG_replaceTags($A['introtext']) . ' ' . PLG_replaceTags($A['bodytext']);
$related = DB_escapeString(implode("\n", STORY_extractLinks($fulltext, $_CONF['whats_related_trim'])));
if (!empty($related)) {
DB_query("UPDATE {$_TABLES['stories']} SET related = '{$related}' WHERE sid = '{$A['sid']}'");
}
}
}
// For if any articles are being cached
} elseif ($group == 'Core' && (in_array('site_name', $changes) || in_array('contributedbyline', $changes) || in_array('allow_user_photo', $changes) || in_array('article_image_align', $changes) || in_array('related_topics', $changes) || in_array('related_topics_max', $changes) || in_array('allow_page_breaks', $changes) || in_array('page_break_comments', $changes) || in_array('url_rewrite', $changes) || in_array('url_routing', $changes) || in_array('hideviewscount', $changes) || in_array('hideemailicon', $changes) || in_array('loginrequired', $changes) || in_array('emailstoryloginrequired', $changes) || in_array('hideprintericon', $changes))) {
// If any Article options changed then delete all article cache
$cacheInstance = 'article__';
CACHE_remove_instance($cacheInstance);
}
}
示例3: MB_deleteChildElements
/**
* Recursivly deletes all elements and child elements
*
*/
function MB_deleteChildElements($id, $menu_id)
{
global $_CONF, $_TABLES, $_USER;
$sql = "SELECT * FROM {$_TABLES['menu_elements']} WHERE pid=" . (int) $id . " AND menu_id=" . (int) $menu_id;
$aResult = DB_query($sql);
$rowCount = DB_numRows($aResult);
for ($z = 0; $z < $rowCount; $z++) {
$row = DB_fetchArray($aResult);
MB_deleteChildElements($row['id'], $menu_id);
}
$sql = "DELETE FROM " . $_TABLES['menu_elements'] . " WHERE id=" . (int) $id;
DB_query($sql);
CACHE_remove_instance('menu');
}
示例4: saveAlbum
function saveAlbum()
{
global $_TABLES, $MG_albums;
$this->album_disk_usage = (int) $this->album_disk_usage;
$this->last_update = (int) $this->last_update;
$this->views = (int) $this->views;
$this->enable_keywords = (int) $this->enable_keywords;
$this->title = DB_escapeString($this->title);
$this->description = DB_escapeString($this->description);
$sqlFieldList = 'album_id,album_title,album_desc,album_parent,album_order,skin,hidden,album_cover,album_cover_filename,media_count,album_disk_usage,last_update,album_views,display_album_desc,enable_album_views,image_skin,album_skin,display_skin,enable_comments,exif_display,enable_rating,playback_type,tn_attached,enable_slideshow,enable_random,enable_shutterfly,enable_views,enable_keywords,enable_sort,enable_rss,enable_postcard,albums_first,allow_download,full_display,tn_size,max_image_height,max_image_width,max_filesize,display_image_size,display_rows,display_columns,valid_formats,filename_title,shopping_cart,wm_auto,wm_id,opacity,wm_location,album_sort_order,member_uploads,moderate,email_mod,featured,cbposition,cbpage,owner_id,group_id,mod_group_id,perm_owner,perm_group,perm_members,perm_anon,podcast,mp3ribbon,tnheight,tnwidth,usealternate,rsschildren';
$sqlDataValues = "{$this->id},'{$this->title}','{$this->description}',{$this->parent},{$this->order},'{$this->skin}',{$this->hidden},'{$this->cover}','{$this->cover_filename}',{$this->media_count},{$this->album_disk_usage},{$this->last_update},{$this->views},{$this->display_album_desc},{$this->enable_album_views},'{$this->image_skin}','{$this->album_skin}','{$this->display_skin}',{$this->enable_comments},{$this->exif_display},{$this->enable_rating},{$this->playback_type},{$this->tn_attached},{$this->enable_slideshow},{$this->enable_random},{$this->enable_shutterfly},{$this->enable_views},{$this->enable_keywords},{$this->enable_sort},{$this->enable_rss},{$this->enable_postcard},{$this->albums_first},{$this->allow_download},{$this->full},{$this->tn_size},{$this->max_image_height},{$this->max_image_width},{$this->max_filesize},{$this->display_image_size},{$this->display_rows},{$this->display_columns},{$this->valid_formats},{$this->filename_title},{$this->shopping_cart},{$this->wm_auto},{$this->wm_id},{$this->wm_opacity},{$this->wm_location},{$this->album_sort_order},{$this->member_uploads},{$this->moderate},{$this->email_mod},{$this->featured},{$this->cbposition},'{$this->cbpage}',{$this->owner_id},{$this->group_id},{$this->mod_group_id},{$this->perm_owner},{$this->perm_group},{$this->perm_members},{$this->perm_anon},{$this->podcast},{$this->mp3ribbon},{$this->tnHeight},{$this->tnWidth},{$this->useAlternate},{$this->rssChildren}";
DB_save($_TABLES['mg_albums'], $sqlFieldList, $sqlDataValues);
CACHE_remove_instance('whatsnew');
}
示例5: approve
function approve()
{
global $_TABLES, $_TABLES, $_CONF, $myts, $eh, $filemgmt_FileStore, $filemgmt_SnapStore, $filemgmt_Emailoption, $filemgmtFilePermissions;
$lid = (int) COM_applyFilter($_POST['lid'], true);
$title = $_POST['title'];
$cid = intval($_POST['cid']);
if (empty($cid)) {
$cid = 0;
}
$homepage = $_POST['homepage'];
$version = $_POST['version'];
$size = isset($_POST['size']) ? COM_applyFilter($_POST['size'], true) : 0;
$description = $_POST['description'];
if ($_POST['url'] || $_POST['url'] != '') {
$name = $myts->makeTboxData4Save($_POST['url']);
$url = rawurlencode($name);
}
if ($_POST['logourl'] || $_POST['logourl'] != '') {
$shotname = $myts->makeTboxData4Save($_POST['logourl']);
$logourl = $myts->makeTboxData4Save(rawurlencode($_POST['logourl']));
} else {
$logourl = '';
$shotname = '';
}
$result = DB_query("SELECT COUNT(*) FROM {$_TABLES['filemgmt_filedetail']} WHERE url='{$url}' and status=1");
list($numrows) = DB_fetchArray($result);
// Comment out this check if you want to allow duplicate filelistings for same file in the repository
// Check for duplicate files of the same filename (actual filename in repository)
if ($numrows > 0) {
$eh->show("1108");
}
$title = $myts->makeTboxData4Save($title);
$homepage = $myts->makeTboxData4Save($homepage);
$version = $myts->makeTboxData4Save($_POST['version']);
$size = $myts->makeTboxData4Save($size);
$description = $myts->makeTareaData4Save($description);
$commentoption = (int) COM_applyFilter($_POST["commentoption"], true);
// Move file from tmp directory under the document filestore to the main file directory
// Now to extract the temporary names for both the file and optional thumbnail. I've used th platform field which I'm not using now for anything.
$tmpnames = explode(";", DB_getItem($_TABLES['filemgmt_filedetail'], 'platform', "lid='{$lid}'"));
$tmpfilename = $tmpnames[0];
if (isset($tmpnames[1])) {
$tmpshotname = $tmpnames[1];
} else {
$tmpshotname = '';
}
$tmp = $filemgmt_FileStore . "tmp/" . $tmpfilename;
if (file_exists($tmp) && !is_dir($tmp)) {
// if this temporary file was really uploaded?
$newfile = $filemgmt_FileStore . $name;
COM_errorLOG("File move from " . $tmp . " to " . $newfile);
$rename = @rename($tmp, $newfile);
COM_errorLOG("Results of rename is: " . $rename);
$chown = @chmod($newfile, $filemgmtFilePermissions);
if (!file_exists($newfile)) {
COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '" . $newfile . "'");
$AddNewFile = false;
// Set false again - in case it was set true above for actual file
$eh->show("1101");
} else {
$AddNewFile = true;
}
} else {
COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '" . $tmp . "'");
$eh->show("1101");
}
if ($tmpshotname != "") {
$tmp = $filemgmt_SnapStore . "tmp/" . $tmpshotname;
if (file_exists($tmp) && !is_dir($tmp)) {
// if this temporary Thumbnail was really uploaded?
$newfile = $filemgmt_SnapStore . $shotname;
$rename = @rename($tmp, $newfile);
$chown = @chmod($newfile, $filemgmtFilePermissions);
if (!file_exists($newfile)) {
COM_errorLOG("Filemgmt upload approve error: New file does not exist after move of tmp file: '" . $newfile . "'");
$AddNewFile = false;
// Set false again - in case it was set true above for actual file
$eh->show("1101");
}
} else {
COM_errorLOG("Filemgmt upload approve error: Temporary file does not exist: '" . $tmp . "'");
$eh->show("1101");
}
}
if ($AddNewFile) {
DB_query("UPDATE {$_TABLES['filemgmt_filedetail']} SET cid='{$cid}', title='{$title}', url='{$url}', homepage='{$homepage}', version='{$version}', logourl='{$logourl}', status=1, date=" . time() . ", comments={$commentoption} where lid='{$lid}'");
DB_query("UPDATE {$_TABLES['filemgmt_filedesc']} SET description='{$description}' where lid='{$lid}'");
PLG_itemSaved($lid, 'filemgmt');
CACHE_remove_instance('whatsnew');
// Send a email to submitter notifying them that file was approved
if ($filemgmt_Emailoption) {
$result = DB_query("SELECT username, email FROM {$_TABLES['users']} a, {$_TABLES['filemgmt_filedetail']} b WHERE a.uid=b.submitter and b.lid='{$lid}'");
list($submitter_name, $emailaddress) = DB_fetchArray($result);
$mailtext = sprintf(_MD_HELLO, $submitter_name);
$mailtext .= ",\n\n" . _MD_WEAPPROVED . " " . $title . " \n" . _MD_THANKSSUBMIT . "\n\n";
$mailtext .= "{$_CONF["site_name"]}\n";
$mailtext .= "{$_CONF['site_url']}\n";
//COM_errorLOG("email: ".$emailaddress.", text: ".$mailtext);
$to = array();
$to = COM_formatEmailAddress($submitter_name, $emailaddress);
//.........这里部分代码省略.........
示例6: USER_delete
/**
* Delete a user
*
* @param int $uid id of user to delete
* @return string HTML redirect
*
*/
function USER_delete($uid)
{
global $_CONF;
if (!USER_deleteAccount($uid)) {
return COM_refresh($_CONF['site_admin_url'] . '/user.php');
}
CACHE_remove_instance('mbmenu');
COM_setMessage(22);
return COM_refresh($_CONF['site_admin_url'] . '/user.php');
}
示例7: MG_saveEnroll
function MG_saveEnroll()
{
global $_CONF, $_MG_CONF, $_MG_USERPREFS, $_TABLES, $_USER, $LANG_MG03;
if ($_MG_CONF['member_albums'] != 1) {
echo COM_refresh($_MG_CONF['site_url'] . '/index.php');
exit;
}
if (!isset($_MG_CONF['member_quota'])) {
$_MG_CONF['member_quota'] = 0;
}
$sql = "SELECT album_id FROM {$_TABLES['mg_albums']} WHERE owner_id=" . (int) $_USER['uid'] . " AND album_parent=" . $_MG_CONF['member_album_root'];
$result = DB_query($sql);
$nRows = DB_numRows($result);
if ($nRows > 0) {
$display = MG_siteHeader();
$display .= COM_showMessageText($LANG_MG03['existing_member_album'], '', true);
$display .= MG_siteFooter();
echo $display;
exit;
}
$uid = (int) $_USER['uid'];
$aid = plugin_user_create_mediagallery($uid, 1);
$result = DB_query("UPDATE {$_TABLES['mg_userprefs']} SET member_gallery=1,quota=" . $_MG_CONF['member_quota'] . " WHERE uid=" . $uid, 1);
$affected = DB_affectedRows($result);
if (DB_error()) {
$sql = "INSERT INTO {$_TABLES['mg_userprefs']} (uid, active, display_rows, display_columns, mp3_player, playback_mode, tn_size, quota, member_gallery) VALUES (" . $uid . ",1,0,0,-1,-1,-1," . $_MG_CONF['member_quota'] . ",1)";
DB_query($sql, 1);
}
CACHE_remove_instance('menu');
echo COM_refresh($_MG_CONF['site_url'] . '/album.php?aid=' . $aid);
exit;
}
示例8: TOPIC_delete
/**
* Delete a topic
*
* @param string $tid Topic ID
* @return string HTML redirect
*
*/
function TOPIC_delete($tid)
{
global $_CONF, $_TABLES, $_USER;
$result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['topics']} WHERE tid ='{$tid}'");
$A = DB_fetchArray($result);
if (SEC_inGroup('Topic Admin')) {
$access = 3;
} else {
$access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
}
if ($access < 3) {
COM_accessLog("User {$_USER['username']} tried to illegally delete topic {$tid}.");
return COM_refresh($_CONF['site_admin_url'] . '/topic.php');
}
// don't delete topic blocks - assign them to 'all' and disable them
DB_query("UPDATE {$_TABLES['blocks']} SET tid = 'all', is_enabled = 0 WHERE tid = '{$tid}'");
// same with feeds
DB_query("UPDATE {$_TABLES['syndication']} SET topic = '::all', is_enabled = 0 WHERE topic = '{$tid}'");
// remove any alternate topics
DB_query("UPDATE {$_TABLES['stories']} SET alternate_tid = NULL WHERE alternate_tid = '{$tid}'");
// delete comments, trackbacks, images associated with stories in this topic
$result = DB_query("SELECT sid FROM {$_TABLES['stories']} WHERE tid = '{$tid}'");
$numStories = DB_numRows($result);
for ($i = 0; $i < $numStories; $i++) {
$A = DB_fetchArray($result);
STORY_deleteImages($A['sid']);
DB_query("DELETE FROM {$_TABLES['comments']} WHERE sid = '{$A['sid']}' AND type = 'article'");
DB_query("DELETE FROM {$_TABLES['trackback']} WHERE sid = '{$A['sid']}' AND type = 'article'");
}
// delete these
DB_delete($_TABLES['stories'], 'tid', $tid);
DB_delete($_TABLES['storysubmission'], 'tid', $tid);
DB_delete($_TABLES['topics'], 'tid', $tid);
TOPIC_reorderTopics();
// update feed(s) and Older Stories block
COM_rdfUpToDateCheck('article');
COM_olderStuff();
CACHE_remove_instance('stmenu');
COM_setMessage(14);
return COM_refresh($_CONF['site_admin_url'] . '/topic.php');
}
示例9: plugin_itemdeleted_template
/**
* To be called (eventually) whenever Geeklog removes an item from the database.
* Plugins can define their own 'itemdeleted' function to be notified whenever
* an item is deleted.
*
* @param string $id ID of the item
* @param string $type type of the item, e.g. 'article'
* @return void
* @since Geeklog 1.6.0
*
*/
function plugin_itemdeleted_template($id, $type)
{
// See if uses what's new block then delete cache of whatsnew
// This will not catch everything though like trackbacks, comments, and
// plugins that do not use itemsaved but let's delete the cache when we can
// Also delete cache for topics block and topic_tree when topic or article is updated or deleted
// Also delete article cache on article save and delete
$article = false;
$block = false;
$whatsnew = false;
$olderstories = false;
$topicsblock = false;
$topic_tree = false;
if ($type == 'article' or $type == 'story') {
$article = true;
$whatsnew = true;
$olderstories = true;
$topicsblock = true;
} elseif ($type == 'topic') {
$topicsblock = true;
$topic_tree = true;
// These items use topics and may display info about topics
$article = true;
$block = true;
} else {
// hack to see if plugin supports what's new
$fn_head = 'plugin_whatsnewsupported_' . $type;
if (function_exists($fn_head)) {
if (is_array($fn_head())) {
// if array then supported
$whatsnew = true;
}
}
}
if ($article) {
$cacheInstance = 'article__' . $id;
// remove all article instances
CACHE_remove_instance($cacheInstance);
}
if ($block) {
$cacheInstance = 'block__' . $id;
// remove all block instances
CACHE_remove_instance($cacheInstance);
}
if ($whatsnew) {
$cacheInstance = 'whatsnew__';
// remove all whatsnew instances
CACHE_remove_instance($cacheInstance);
}
if ($olderstories) {
$cacheInstance = 'olderarticles__';
// remove all olderarticles instances
CACHE_remove_instance($cacheInstance);
}
if ($topicsblock) {
$cacheInstance = 'topicsblock__';
CACHE_remove_instance($cacheInstance);
}
if ($topic_tree) {
$cacheInstance = 'topic_tree__';
CACHE_remove_instance($cacheInstance);
}
}
示例10: _MG_getFile
//.........这里部分代码省略.........
$resolution_x = $mimeInfo['video']['resolution_x'];
$resolution_y = $mimeInfo['video']['resolution_y'];
} else {
$resolution_x = -1;
$resolution_y = -1;
}
break;
case 'video/x-flv':
if ($mimeInfo['video']['resolution_x'] < 1 || $mimeInfo['video']['resolution_y'] < 1) {
if (isset($mimeInfo['meta']['onMetaData']['width']) && isset($mimeInfo['meta']['onMetaData']['height'])) {
$resolution_x = $mimeInfo['meta']['onMetaData']['width'];
$resolution_y = $mimeInfo['meta']['onMetaData']['height'];
} else {
$resolution_x = -1;
$resolution_y = -1;
}
} else {
$resolution_x = $mimeInfo['video']['resolution_x'];
$resolution_y = $mimeInfo['video']['resolution_y'];
}
break;
case 'video/x-ms-asf':
case 'video/x-ms-asf-plugin':
case 'video/avi':
case 'video/msvideo':
case 'video/x-msvideo':
case 'video/avs-video':
case 'video/x-ms-wmv':
case 'video/x-ms-wvx':
case 'video/x-ms-wm':
case 'application/x-troff-msvideo':
if (isset($mimeInfo['video']['streams']['2']['resolution_x']) && isset($mimeInfo['video']['streams']['2']['resolution_y'])) {
$resolution_x = $mimeInfo['video']['streams']['2']['resolution_x'];
$resolution_y = $mimeInfo['video']['streams']['2']['resolution_y'];
} else {
$resolution_x = -1;
$resolution_y = -1;
}
break;
}
}
if ($replace > 0) {
$sql = "UPDATE " . $tableMedia . " SET\n\t \t\t\t\t\tmedia_filename='" . DB_escapeString($media_filename) . "',\n\t \t\t\t\t\tmedia_original_filename='{$original_filename}',\n\t \t\t\t\t\tmedia_mime_ext='" . DB_escapeString($mimeExt) . "',\n\t \t\t\t\t\tmime_type='" . DB_escapeString($mimeType) . "',\n\t \t\t\t\t\tmedia_time='" . DB_escapeString($media_time) . "',\n\t \t\t\t\t\tmedia_user_id='" . DB_escapeString($media_user_id) . "',\n\t \t\t\t\t\tmedia_type='" . DB_escapeString($mediaType) . "',\n\t \t\t\t\t\tmedia_upload_time='" . DB_escapeString($media_upload_time) . "',\n\t \t\t\t\t\tmedia_watermarked='" . DB_escapeString($successfulWatermark) . "',\n\t \t\t\t\t\tmedia_resolution_x='" . DB_escapeString($resolution_x) . "',\n\t \t\t\t\t\tmedia_resolution_y='" . DB_escapeString($resolution_y) . "'\n\t \t\t\t\t\tWHERE media_id='" . DB_escapeString($replace) . "'";
DB_query($sql);
} else {
$sql = "INSERT INTO " . $tableMedia . " (media_id,media_filename,media_original_filename,media_mime_ext,media_exif,mime_type,media_title,media_desc,media_keywords,media_time,media_views,media_comments,media_votes,media_rating,media_tn_attached,media_tn_image,include_ss,media_user_id,media_user_ip,media_approval,media_type,media_upload_time,media_category,media_watermarked,v100,maint,media_resolution_x,media_resolution_y,remote_media,remote_url,artist,album,genre)\n\t VALUES ('{$new_media_id}','{$media_filename}','{$original_filename}','{$mimeExt}','1','{$mimeType}','{$media_caption}','{$media_desc}','{$media_keywords}','{$media_time}','0','0','0','0.00','{$atttn}','','1','{$media_user_id}','','0','{$mediaType}','{$media_upload_time}','{$category}','{$successfulWatermark}','0','0',{$resolution_x},{$resolution_y},0,'','{$artist}','{$musicAlbum}','{$genre}');";
DB_query($sql);
$x = 0;
$sql = "SELECT MAX(media_order) + 10 AS media_seq FROM " . $_TABLES['mg_media_albums'] . " WHERE album_id = " . $albums;
$result = DB_query($sql);
$row = DB_fetchArray($result);
$media_seq = $row['media_seq'];
if ($media_seq < 10) {
$media_seq = 10;
}
$sql = "INSERT INTO " . $tableMediaAlbum . " (media_id, album_id, media_order) VALUES ('{$new_media_id}', {$albums}, {$media_seq} )";
DB_query($sql);
if ($mediaType == 1 && $resolution_x > 0 && $resolution_y > 0 && $_MG_CONF['use_default_resolution'] == 0) {
DB_save($_TABLES['mg_playback_options'], 'media_id,option_name,option_value', "'{$new_media_id}','width', '{$resolution_x}'");
DB_save($_TABLES['mg_playback_options'], 'media_id,option_name,option_value', "'{$new_media_id}','height', '{$resolution_y}'");
}
// update the media count for the album, only if no moderation...
if ($queue == 0) {
$MG_albums[$albums]->media_count++;
DB_query("UPDATE " . $_TABLES['mg_albums'] . " SET media_count=" . $MG_albums[$albums]->media_count . ",last_update=" . $media_upload_time . " WHERE album_id='" . $MG_albums[$albums]->id . "'");
if ($_MG_CONF['update_parent_lastupdated'] == 1) {
$currentAID = $MG_albums[$albums]->parent;
while ($MG_albums[$currentAID]->id != 0) {
DB_query("UPDATE " . $_TABLES['mg_albums'] . " SET last_update=" . $media_upload_time . " WHERE album_id='" . $MG_albums[$currentAID]->id . "'");
$currentAID = $MG_albums[$currentAID]->parent;
}
}
if ($MG_albums[$albums]->cover == -1 && ($mediaType == 0 || $atttn == 1)) {
if ($atttn == 1) {
$covername = 'tn_' . $media_filename;
} else {
$covername = $media_filename;
}
DB_query("UPDATE {$_TABLES['mg_albums']} SET album_cover_filename='" . $covername . "'" . " WHERE album_id='" . $MG_albums[$albums]->id . "'");
}
}
$x++;
}
}
if ($queue) {
$errMsg .= $LANG_MG01['successful_upload_queue'];
// ' successfully placed in Moderation queue';
} else {
$errMsg .= $LANG_MG01['successful_upload'];
// ' successfully uploaded to album';
}
if ($queue == 0) {
require_once $_CONF['path'] . 'plugins/mediagallery/include/rssfeed.php';
MG_buildFullRSS();
MG_buildAlbumRSS($albums);
CACHE_remove_instance('whatsnew');
}
@unlink($tmpPath);
return array(true, $errMsg);
}
示例11: TRB_deleteTrackbackComment
/**
* Delete a trackback comment
* Note: Permission checks have to be done by the caller.
*
* @param int $cid ID of the trackback comment
* @return void
*/
function TRB_deleteTrackbackComment($cid)
{
global $_TABLES;
$cid = DB_escapeString($cid);
DB_delete($_TABLES['trackback'], 'cid', $cid);
CACHE_remove_instance('whatsnew');
}
示例12: MB_changeActiveStatusMenu
function MB_changeActiveStatusMenu($menu_arr)
{
global $_CONF, $_TABLES;
// disable all menus
$sql = "UPDATE {$_TABLES['menu']} SET menu_active = '0'";
DB_query($sql);
if (isset($menu_arr)) {
foreach ($menu_arr as $menu => $side) {
$menu = COM_applyFilter($menu, true);
// the enable those in the array
$sql = "UPDATE {$_TABLES['menu']} SET menu_active = '1' WHERE id=" . (int) $menu;
DB_query($sql);
}
}
CACHE_remove_instance('menu');
return;
}
示例13: FF_saveTopic
//.........这里部分代码省略.........
} else {
if ($action == 'savereply') {
$fields = "name,email,date,subject,comment,postmode,ip,mood,uid,pid,forum,status";
$sql = "INSERT INTO {$_TABLES['ff_topic']} ({$fields}) ";
$sql .= "VALUES (" . "'" . DB_escapeString($name) . "'," . "'" . DB_escapeString($email) . "'," . "'" . DB_escapeString($date) . "'," . "'{$subject}'," . "'{$comment}'," . "'" . DB_escapeString($postmode) . "'," . "'" . DB_escapeString($REMOTE_ADDR) . "'," . "'" . DB_escapeString($mood) . "'," . (int) $uid . "," . (int) $id . "," . (int) $forum . "," . (int) $status . ")";
DB_query($sql);
// Find the id of the last inserted topic
list($lastid) = DB_fetchArray(DB_query("SELECT max(id) FROM {$_TABLES['ff_topic']} "));
$savedPostID = $lastid;
$topicPID = $id;
/* Check for any uploaded files - during adding reply post */
$uploadErrors = _ff_check4files($lastid);
// Check and see if there are no [file] bbcode tags in content and reset the show_inline value
// This is needed in case user had used the file bbcode tag and then removed it
$imagerecs = '';
$imagerecs = implode(',', $forumfiles);
$sql = "UPDATE {$_TABLES['ff_attachments']} SET show_inline = 0 WHERE topic_id=" . (int) $lastid;
if ($imagerecs != '') {
$sql .= " AND id NOT IN ({$imagerecs})";
}
DB_query($sql);
DB_query("UPDATE {$_TABLES['ff_topic']} SET replies=replies+1, lastupdated='" . DB_escapeString($date) . "',last_reply_rec=" . (int) $lastid . " WHERE id=" . (int) $id);
DB_query("UPDATE {$_TABLES['ff_forums']} SET post_count=post_count+1, last_post_rec=" . (int) $lastid . " WHERE forum_id=" . (int) $forum);
if (DB_Count($_TABLES['ff_attachments'], 'topic_id', (int) $lastid)) {
DB_query("UPDATE {$_TABLES['ff_topic']} SET attachments=1 WHERE id=" . (int) $id);
}
DB_query("DELETE FROM {$_TABLES['ff_log']} WHERE topic=" . (int) $topicPID . " and time > 0");
} elseif ($action == 'saveedit') {
$sql = "UPDATE {$_TABLES['ff_topic']} SET " . "subject='{$subject}'," . "comment='{$comment}'," . "postmode='" . DB_escapeString($postmode) . "'," . "mood='" . DB_escapeString($mood) . "'," . "sticky=" . (int) $sticky . "," . "locked=" . (int) $locked . "," . "status=" . (int) $status . " " . "WHERE (id=" . (int) $editid . ")";
DB_query($sql);
/* Check for any uploaded files - during save of edit */
$uploadErrors = _ff_check4files($editid);
// Check and see if there are no [file] bbcode tags in content and reset the show_inline value
// This is needed in case user had used the file bbcode tag and then removed it
$imagerecs = '';
$imagerecs = implode(',', $forumfiles);
$sql = "UPDATE {$_TABLES['ff_attachments']} SET show_inline = 0 WHERE topic_id=" . (int) $editid . " ";
if ($imagerecs != '') {
$sql .= "AND id NOT IN ({$imagerecs})";
}
DB_query($sql);
$topicPID = DB_getITEM($_TABLES['ff_topic'], "pid", "id=" . (int) $editid);
if ($topicPID == 0) {
$topicPID = $editid;
}
$savedPostID = $editid;
if ($postData['silentedit'] != 1) {
DB_query("UPDATE {$_TABLES['ff_topic']} SET lastupdated='" . DB_escapeString($date) . "' WHERE id=" . (int) $topicPID);
//Remove any lastviewed records in the log so that the new updated topic indicator will appear
DB_query("DELETE FROM {$_TABLES['ff_log']} WHERE topic=" . (int) $topicPID . " and time > 0");
}
if (DB_Count($_TABLES['ff_attachments'], 'topic_id', (int) $editid)) {
DB_query("UPDATE {$_TABLES['ff_topic']} SET attachments=1 WHERE id=" . (int) $topicPID);
}
$topicparent = $topicPID;
}
}
COM_updateSpeedLimit('forum');
PLG_itemSaved($savedPostID, 'forum');
CACHE_remove_instance('forumcb');
if (!COM_isAnonUser()) {
//NOTIFY - Checkbox variable in form set to "on" when checked and they don't already have subscribed to forum or topic
$nid = -$topicPID;
$currentForumNotifyRecID = (int) DB_getItem($_TABLES['subscriptions'], 'sub_id', "type='forum' AND category='" . DB_escapeString($forum) . "' AND id=0 AND uid=" . (int) $uid);
$currentTopicNotifyRecID = (int) DB_getItem($_TABLES['subscriptions'], 'sub_id', "type='forum' AND category='" . DB_escapeString($forum) . "' AND id='" . DB_escapeString($topicPID) . "' AND uid=" . (int) $uid);
$currentTopicUnNotifyRecID = (int) DB_getItem($_TABLES['subscriptions'], 'sub_id', "type='forum' AND category='" . DB_escapeString($forum) . "' AND id='" . DB_escapeString($nid) . "' AND uid=" . (int) $uid);
$forum_name = DB_getItem($_TABLES['ff_forums'], 'forum_name', 'forum_id=' . (int) $forum);
$topic_name = $subject;
if ($notify == 'on' and ($currentForumNotifyRecID < 1 and $currentTopicNotifyRecID < 1)) {
$sql = "INSERT INTO {$_TABLES['subscriptions']} (type,category,category_desc,id,id_desc,uid,date_added) ";
$sql .= "VALUES ('forum','" . DB_escapeString($forum) . "','" . DB_escapeString($forum_name) . "','" . DB_escapeString($topicPID) . "','" . $subject . "'," . (int) $uid . ",now() )";
DB_query($sql);
} elseif ($notify == 'on' and $currentTopicUnNotifyRecID > 1) {
// Had un-subcribed to topic and now wants to subscribe
DB_query("DELETE FROM {$_TABLES['subscriptions']} WHERE sub_id=" . (int) $currentTopicUnNotifyRecID);
} elseif ($notify == '' and $currentTopicNotifyRecID > 1) {
// Subscribed to topic - but does not want to be notified anymore
DB_query("DELETE FROM {$_TABLES['subscriptions']} WHERE type='forum' AND uid=" . (int) $uid . " AND category='" . DB_escapeString($forum) . "' and id = '" . DB_escapeString($topicPID) . "'");
} elseif ($notify == '' and $currentForumNotifyRecID > 1) {
// Subscribed to forum - but does not want to be notified about this topic
DB_query("DELETE FROM {$_TABLES['subscriptions']} WHERE type='forum' AND uid=" . (int) $uid . " AND category='" . DB_escapeString($forum) . "' and id = '" . DB_escapeString($topicPID) . "'");
DB_query("DELETE FROM {$_TABLES['subscriptions']} WHERE type='forum' AND uid=" . (int) $uid . " AND category='" . DB_escapeString($forum) . "' and id = '" . DB_escapeString($nid) . "'");
DB_query("INSERT INTO {$_TABLES['subscriptions']} (type,category,category_desc,id,id_desc,uid,date_added) VALUES ('forum','" . DB_escapeString($forum) . "','" . DB_escapeString($forum_name) . "','" . DB_escapeString($nid) . "','" . $subject . "'," . (int) $uid . ",now() )");
}
}
if ($action != 'saveedit') {
_ff_chknotifications($forum, $savedPostID, $uid);
}
$link = $_CONF['site_url'] . '/forum/viewtopic.php?showtopic=' . $topicPID . '&topic=' . $savedPostID . '#' . $savedPostID;
if ($uploadErrors != '') {
$autorefresh = false;
} else {
$autorefresh = true;
}
$retval .= FF_statusMessage($uploadErrors . $LANG_GF02['msg19'], $link, $LANG_GF02['msg19'], false, '', $autorefresh);
} else {
$retval .= _ff_alertMessage($LANG_GF02['msg18']);
}
return array(true, $retval);
}
示例14: saveToDatabase
/**
* Saves the story in it's final state to the database.
*
* Handles all the SID magic etc.
* @return Integer status result from a constant list.
*/
function saveToDatabase()
{
global $_TABLES, $_CONF;
if (DB_getItem($_TABLES['topics'], 'tid', "archive_flag=1") == $this->_tid) {
$this->_featured = 0;
$this->_frontpage = 0;
$this->_statuscode = STORY_ARCHIVE_ON_EXPIRE;
}
if ($this->_featured != 1) {
$this->_featured = 0;
}
if ($this->_statuscode == '') {
$this->_statuscode = 0;
}
if ($this->_owner_id == '') {
$this->_owner_id = 1;
}
/* if a featured, non-draft, that goes live straight away, unfeature
* other stories in same topic:
*/
if ($this->_featured == '1') {
// there can only be one non-draft featured story
if ($this->_draft_flag == 0 and $this->_date <= time()) {
if ($this->_frontpage == 1) {
// un-feature any featured frontpage story
DB_query("UPDATE {$_TABLES['stories']} SET featured = 0 WHERE featured = 1 AND draft_flag = 0 AND frontpage = 1 AND date <= NOW()");
}
// un-feature any featured story in the same topic
DB_query("UPDATE {$_TABLES['stories']} SET featured = 0 WHERE featured = 1 AND draft_flag = 0 AND tid = '{$this->_tid}' AND date <= NOW()");
}
}
$oldArticleExists = false;
$currentSidExists = false;
/* Fix up old sid => new sid stuff */
if ($this->_sid != $this->_originalSid) {
/* The sid has changed. Load from request will have
* ensured that if the new sid exists an error has
* been thrown, but we need to know if the old sid
* actually existed (as opposed to being a generated
* sid that was then thrown away) to reduce the sheer
* number of SQL queries we do.
*/
$checksid = DB_escapeString($this->_originalSid);
$newsid = DB_escapeString($this->_sid);
$sql = "SELECT 1 FROM {$_TABLES['stories']} WHERE sid='{$checksid}'";
$result = DB_query($sql);
if ($result && DB_numRows($result) > 0) {
$oldArticleExists = true;
}
if ($oldArticleExists) {
/* Move Comments */
$sql = "UPDATE {$_TABLES['comments']} SET sid='{$newsid}' WHERE type='article' AND sid='{$checksid}'";
DB_query($sql);
/* Move Images */
$sql = "UPDATE {$_TABLES['article_images']} SET ai_sid = '{$newsid}' WHERE ai_sid = '{$checksid}'";
DB_query($sql);
/* Move trackbacks */
$sql = "UPDATE {$_TABLES['trackback']} SET sid='{$newsid}' WHERE sid='{$checksid}' AND type='article'";
DB_query($sql);
/* Move ratings */
$sql = "UPDATE {$_TABLES['rating']} SET item_id='{$newsid}' WHERE item_id='{$checksid}' AND type='article'";
DB_query($sql);
$sql = "UPDATE {$_TABLES['rating_votes']} SET item_id='{$newsid}' WHERE item_id='{$checksid}' AND type='article'";
DB_query($sql);
CACHE_remove_instance('story_' . $this->_originalSid);
}
}
/* Acquire Comment Count */
$sql = "SELECT count(1) FROM {$_TABLES['comments']} WHERE type='article' AND sid='" . DB_escapeString($this->_sid) . "'";
$result = DB_query($sql);
if ($result && DB_numRows($result) == 1) {
$array = DB_fetchArray($result);
$this->_comments = $array[0];
} else {
$this->_comments = 0;
}
/* Acquire Rating / Votes */
list($rating_id, $rating, $votes) = RATING_getRating('article', $this->_sid);
$this->_rating = $rating;
$this->_votes = $votes;
//@TODO - remove this call on save
// Get the related URLs
$this->_related = implode("\n", STORY_extractLinks("{$this->_introtext} {$this->_bodytext}"));
$sql = 'REPLACE INTO ' . $_TABLES['stories'] . ' (';
$values = ' VALUES (';
$fields = '';
reset($this->_dbFields);
/* This uses the database field array to generate a SQL Statement. This
* means that when adding new fields to save and load, all we need to do
* is add the field name to the array, and the code will magically cope.
*/
while (list($fieldname, $save) = each($this->_dbFields)) {
if ($save === 1) {
$varname = '_' . $fieldname;
//.........这里部分代码省略.........
示例15: plugin_user_changed_topic
/**
* This function is called when a user's information
* (profile or preferences) has changed.
*
* @param int $uid user id
* @return void
*
*/
function plugin_user_changed_topic($uid)
{
global $_CONF;
// Wipe out user's session variable for last_topic_update (if it exists) since their
// security may have changed and the topic tree should be updated again
$cacheInstance = 'topic_tree__' . CACHE_security_hash();
CACHE_remove_instance($cacheInstance);
}