本文整理匯總了PHP中DB_save函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_save函數的具體用法?PHP DB_save怎麽用?PHP DB_save使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_save函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: upgrade_plugins_141
function upgrade_plugins_141()
{
global $_TABLES;
if (DB_count($_TABLES['plugins'], 'pi_name', 'links') == 1) {
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.0.1', pi_gl_version = '1.4.1' WHERE pi_name = 'links'");
}
// add remarks-field to polls
if (DB_count($_TABLES['plugins'], 'pi_name', 'polls') == 1) {
DB_query("ALTER TABLE {$_TABLES['pollanswers']} ADD remark varchar(255) NULL AFTER votes");
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'polls'");
}
if (DB_count($_TABLES['plugins'], 'pi_name', 'spamx') == 1) {
// delete MT-Blacklist entries from Spam-X plugin
DB_query("DELETE FROM {$_TABLES['spamx']} WHERE name = 'MTBlacklist'");
// the count of deleted spams was introduced in 1.4.0 but not added
// when upgrading from an older database, so add it now if it's missing
$val = DB_getItem($_TABLES['vars'], 'value', "name = 'spamx.counter'");
if (empty($val)) {
DB_save($_TABLES['vars'], 'name,value', "'spamx.counter','0'");
}
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.1.0', pi_gl_version = '1.4.1' WHERE pi_name = 'spamx'");
}
// add field to support advanced editor and a help link in staticpages
if (DB_count($_TABLES['plugins'], 'pi_name', 'staticpages') == 1) {
DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD postmode varchar(16) DEFAULT 'html' NOT NULL AFTER sp_inblock");
DB_query("ALTER TABLE {$_TABLES['staticpage']} ADD sp_help varchar(255) default '' AFTER sp_centerblock");
DB_query("UPDATE {$_TABLES['plugins']} SET pi_version = '1.4.3', pi_gl_version = '1.4.1' WHERE pi_name = 'staticpages'");
}
}
示例2: MG_approveSubmission
function MG_approveSubmission($media_id)
{
global $_CONF, $_TABLES, $LANG_MG01;
$mid = addslashes($media_id);
$owner_uid = DB_getItem($_TABLES['mg_mediaqueue'], 'media_user_id', "media_id='" . $mid . "'");
DB_delete($_TABLES['mg_mediaqueue'], 'media_id', $mid);
$album_id = DB_getItem($_TABLES['mg_media_album_queue'], 'album_id', "media_id='" . $mid . "'");
DB_save($_TABLES['mg_media_albums'], 'album_id, media_id, media_order', "{$album_id}, '{$mid}', 0");
require_once $_CONF['path'] . 'plugins/mediagallery/include/sort.php';
MG_SortMedia($album_id);
DB_delete($_TABLES['mg_media_album_queue'], 'media_id', $mid);
$sql = "SELECT media_filename, media_type " . "FROM {$_TABLES['mg_media']} WHERE media_id='" . $mid . "'";
$result = DB_query($sql);
list($media_filename, $media_type) = DB_fetchArray($result);
$media_count = DB_getItem($_TABLES['mg_albums'], 'media_count', 'album_id=' . $album_id);
$media_count++;
DB_change($_TABLES['mg_albums'], 'media_count', $media_count, 'album_id', $album_id);
MG_updateAlbumLastUpdate($album_id);
$album_cover = DB_getItem($_TABLES['mg_albums'], 'album_cover', 'album_id=' . $album_id);
if ($album_cover == -1 && $media_type == 0) {
DB_change($_TABLES['mg_albums'], 'album_cover_filename', $media_filename, 'album_id', $album_id);
}
// email the owner / uploader that the item has been approved.
COM_clearSpeedlimit(600, 'mgapprove');
$last = COM_checkSpeedlimit('mgapprove');
if ($last == 0) {
$result2 = DB_query("SELECT username, fullname, email FROM {$_TABLES['users']} WHERE uid='" . $owner_uid . "'");
list($username, $fullname, $email) = DB_fetchArray($result2);
if ($email != '') {
$subject = $LANG_MG01['upload_approved'];
$body = $LANG_MG01['upload_approved'];
$body .= '<br' . XHTML . '><br' . XHTML . '>';
$body .= $LANG_MG01['thanks_submit'];
$body .= '<br' . XHTML . '><br' . XHTML . '>';
$body .= $_CONF['site_name'] . '<br' . XHTML . '>';
$body .= $_CONF['site_url'] . '<br' . XHTML . '>';
$to = array();
$from = array();
$to = COM_formatEmailAddress($username, $email);
$from = COM_formatEmailAddress($_CONF['site_name'], $_CONF['site_mail']);
if (!COM_mail($to, $subject, $body, $from, true)) {
COM_errorLog("Media Gallery Error - Unable to send queue notification email");
}
COM_updateSpeedlimit('mgapprove');
}
}
// PLG_itemSaved($media_id, 'mediagallery');
// COM_rdfUpToDateCheck();
// COM_olderStuff();
return;
}
示例3: MG_saveRSS
function MG_saveRSS()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $_POST;
$rss_full_enabled = isset($_POST['rss_full_enabled']) ? COM_applyFilter($_POST['rss_full_enabled'], true) : 0;
$rss_feed_type = COM_applyFilter($_POST['rss_feed_type']);
$rss_ignore_empty = isset($_POST['rss_ignore_empty']) ? COM_applyFilter($_POST['rss_ignore_empty'], true) : 0;
$rss_anonymous_only = isset($_POST['rss_anonymous_only']) ? COM_applyFilter($_POST['rss_anonymous_only'], true) : 0;
$rss_feed_name = COM_applyFilter($_POST['rss_feed_name']);
$hide_email = isset($_POST['hide_email']) ? COM_applyFilter($_POST['hide_email'], true) : 0;
DB_save($_TABLES['mg_config'], "config_name, config_value", "'rss_full_enabled','{$rss_full_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'rss_feed_type','{$rss_feed_type}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'rss_ignore_empty','{$rss_ignore_empty}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'rss_anonymous_only','{$rss_anonymous_only}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'rss_feed_name','{$rss_feed_name}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'hide_author_email','{$hide_email}'");
$_MG_CONF['rss_full_enabled'] = $rss_full_enabled;
MG_buildFullRSS();
echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=6');
exit;
}
示例4: POLLS_saveVote_AJAX
function POLLS_saveVote_AJAX($pid, $aid)
{
global $_CONF, $_PO_CONF, $_TABLES, $LANG_POLLS;
$retval = array('html' => '', 'statusMessage' => '');
if (POLLS_ipAlreadyVoted($pid)) {
$retval['statusMessage'] = 'You have already voted on this poll';
$retval['html'] = POLLS_pollResults($pid, 400, '', '', 2);
} else {
setcookie('poll-' . $pid, implode('-', $aid), time() + $_PO_CONF['pollcookietime'], $_CONF['cookie_path'], $_CONF['cookiedomain'], $_CONF['cookiesecure']);
DB_change($_TABLES['polltopics'], 'voters', "voters + 1", 'pid', DB_escapeString($pid), '', true);
$answers = count($aid);
for ($i = 0; $i < $answers; $i++) {
DB_change($_TABLES['pollanswers'], 'votes', "votes + 1", array('pid', 'qid', 'aid'), array(DB_escapeString($pid), $i, COM_applyFilter($aid[$i], true)), '', true);
}
DB_save($_TABLES['pollvoters'], 'ipaddress,date,pid', "'" . DB_escapeString($_SERVER['REMOTE_ADDR']) . "'," . time() . ",'" . DB_escapeString($pid) . "'");
}
$eMsg = $LANG_POLLS['savedvotemsg'] . ' "' . DB_getItem($_TABLES['polltopics'], 'topic', "pid = '" . DB_escapeString($pid) . "'") . '"';
$retval['statusMessage'] = $eMsg;
$retval['html'] = POLLS_pollResults($pid, 400, '', '', 2);
return $retval;
}
示例5: MG_usage
function MG_usage($application, $album_title, $media_title, $media_id)
{
global $_MG_CONF, $_USER, $_TABLES, $REMOTE_ADDR;
if (!$_MG_CONF['usage_tracking']) {
return;
}
$now = time();
if ($now - $_MG_CONF['last_usage_purge'] > 5184000) {
$purgetime = $now - 5184000;
// 60 days
DB_query("DELETE FROM {$_TABLES['mg_usage_tracking']} WHERE time < " . $purgetime);
DB_save($_TABLES['mg_config'], 'config_name,config_value', "'last_usage_purge','{$now}'");
COM_errorLog("Media Gallery: Purged old data from Usage Tracking Tables");
}
$log_time = $now;
$user_id = (int) $_USER['uid'];
$user_ip = DB_escapeString($REMOTE_ADDR);
$user_name = DB_escapeString($_USER['username']);
$title = DB_escapeString($album_title);
$ititle = DB_escapeString($media_title);
$sql = "INSERT INTO " . $_TABLES['mg_usage_tracking'] . " (time,user_id,user_ip, user_name,application, album_title, media_title,media_id)" . " VALUES ({$log_time}, {$user_id}, '{$user_ip}', '{$user_name}', '{$application}', '{$title}', '{$ititle}', '{$media_id}')";
DB_query($sql);
}
示例6: MG_saveConfig
//.........這裏部分代碼省略.........
$displayblocks = 0;
}
if ($usage_tracking < 0 || $usage_tracking > 1) {
$usage_tracking = 0;
}
if ($whatsnew < 0 || $whatsnew > 1) {
$whatsnew = 0;
}
if ($orig_jpg_quality < 25 || $orig_jpg_quality > 100) {
$orig_jpg_quality = 75;
}
if ($jpg_quality < 25 || $jpg_quality > 100) {
$jpg_quality = 75;
}
if ($tn_jpg_quality < 25 || $tn_jpg_quality > 100) {
$tn_jpg_quality = 75;
}
if ($truncate_breadcrumb == '') {
$truncate_breadcrumb = 0;
}
if ($seperator == '') {
$seperator = '/';
}
// check the batch options...
if ($time_limit < 30) {
$time_limit = 30;
}
if ($item_limit < 5) {
$item_limit = 5;
}
if ($refresh_rate < 5) {
$refresh_rate = 5;
}
DB_save($_TABLES['mg_config'], "config_name, config_value", "'loginrequired', '{$loginrequired}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'anonymous_uploads', '{$anonymous_uploads}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'album_display_columns', '{$album_display_columns}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'album_display_rows', '{$album_display_rows}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'displayblocks', '{$displayblocks}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'usage_tracking', '{$usage_tracking}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'dfid', '{$dfid}'");
// DB_save($_TABLES['mg_config'],"config_name, config_value","'htmlallowed', '$htmlallowed'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'whatsnew', '{$whatsnew}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'jpg_orig_quality', '{$orig_jpg_quality}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'jpg_quality', '{$jpg_quality}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'tn_jpg_quality', '{$tn_jpg_quality}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'truncate_breadcrumb', '{$truncate_breadcrumb}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'whatsnew_time', '{$whatsnew_time}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'gallery_tn_size', '{$gallery_tn_size}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'gallery_tn_height', '{$gallery_tn_height}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'gallery_tn_width', '{$gallery_tn_width}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'use_flowplayer', '{$flv_player}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'seperator', '{$seperator}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'up_display_rows_enabled', '{$up_display_rows_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'up_display_columns_enabled','{$up_display_columns_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'up_mp3_player_enabled', '{$up_mp3_player_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'up_av_playback_enabled', '{$up_av_playback_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'up_thumbnail_size_enabled', '{$up_thumbnail_size_enabled}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'zip_enabled', '{$enable_zip}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'zip_path', '{$zip_path}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'tmp_path', '{$tmp_path}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'ftp_path', '{$ftp_path}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'ffmpeg_enabled', '{$enable_ffmpeg}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'ffmpeg_path', '{$ffmpeg_path}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'preserve_filename',' {$preserve_filename}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'discard_original','{$discard_originals}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'verbose','{$verbose}'");
示例7: MB_saveEditMenu
function MB_saveEditMenu()
{
global $_CONF, $_TABLES, $_GROUPS, $LANG_MB;
$errors = 0;
$errMsg = '';
// sanity check
if (!isset($_POST['menuname']) || $_POST['menuname'] == '') {
$errors++;
$errMsg .= $LANG_MB['menu_name_error'];
} else {
$menuname = COM_applyFilter($_POST['menuname']);
if (strstr($menuname, ' ') !== FALSE) {
$errors++;
$errMsg .= $LANG_MB['menu_name_space'];
}
}
if ($errors > 0) {
return $errMsg;
}
$menu_id = COM_applyFilter($_POST['menu_id'], true);
$menuname = DB_escapeString(COM_applyFilter($_POST['menuname']));
$menutype = COM_applyFilter($_POST['menutype'], true);
$menuactive = isset($_POST['menuactive']) ? COM_applyFilter($_POST['menuactive'], true) : 0;
$menugroup = COM_applyFilter($_POST['group'], true);
$sqlFieldList = 'id,menu_name,menu_type,menu_active,group_id';
$sqlDataValues = "'{$menu_id}','{$menuname}',{$menutype},{$menuactive},{$menugroup}";
DB_save($_TABLES['menu'], $sqlFieldList, $sqlDataValues);
CACHE_remove_instance('menu');
CACHE_remove_instance('css');
$randID = rand();
DB_save($_TABLES['vars'], 'name,value', "'cacheid',{$randID}");
return '';
}
示例8: MG_savePBOption
function MG_savePBOption($mid, $name, $val, $is_num = false)
{
global $_TABLES;
$mid = addslashes($mid);
$name = addslashes($name);
if ($is_num) {
$val = intval($val);
} else {
$val = addslashes($val);
}
DB_save($_TABLES['mg_playback_options'], 'media_id, option_name, option_value', "'{$mid}', '{$name}', '{$val}'");
}
示例9: service_submit_staticpages
//.........這裏部分代碼省略.........
$sp_label = "";
$sp_centerblock = 0;
$sp_php = 0;
$sp_inblock = 0;
$sp_nf = 0;
$sp_hits = 0;
$meta_description = "";
$meta_keywords = "";
} else {
// See if it was a template before, if so and option changed, remove use from other pages
if (DB_getItem($_TABLES['staticpage'], 'template_flag', "sp_id = '{$sp_old_id}'") == 1) {
$sql = "UPDATE {$_TABLES['staticpage']} SET template_id = '' WHERE template_id = '{$sp_old_id}'";
$result = DB_query($sql);
}
if ($template_id != '') {
// If using a template, make sure php disabled
$sp_php = 0;
// Double check template id exists and is still a template
$perms = SP_getPerms();
if (!empty($perms)) {
$perms = ' AND ' . $perms;
}
if (DB_getItem($_TABLES['staticpage'], 'COUNT(sp_id)', "sp_id = '{$template_id}' AND template_flag = 1 AND (draft_flag = 0)" . $perms) == 0) {
$template_id = '';
}
}
}
// make sure there's only one "entire page" static page per topic
if ($sp_centerblock == 1 && $sp_where == 0) {
$sql = "UPDATE {$_TABLES['staticpage']} SET sp_centerblock = 0 WHERE (sp_centerblock = 1) AND (sp_where = 0) AND (sp_tid = '{$sp_tid}') AND (draft_flag = 0)";
// if we're in a multi-language setup, we need to allow one "entire
// page" centerblock for 'all' or 'none' per language
if (!empty($_CONF['languages']) && !empty($_CONF['language_files']) && ($sp_tid == 'all' || $sp_tid == 'none')) {
$ids = explode('_', $sp_id);
if (count($ids) > 1) {
$lang_id = array_pop($ids);
$sql .= " AND sp_id LIKE '%\\_{$lang_id}'";
}
}
DB_query($sql);
}
$formats = array('allblocks', 'blankpage', 'leftblocks', 'noblocks');
if (!in_array($sp_format, $formats)) {
$sp_format = 'allblocks';
}
if (!$args['gl_svc']) {
list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($perm_owner, $perm_group, $perm_members, $perm_anon);
}
// Retrieve created date
$datecreated = DB_getItem($_TABLES['staticpage'], 'created', "sp_id = '{$sp_id}'");
if ($datecreated == '') {
$datecreated = date('Y-m-d H:i:s');
}
DB_save($_TABLES['staticpage'], 'sp_id,sp_title,sp_page_title, sp_content,created,modified,sp_hits,sp_format,sp_onmenu,sp_label,commentcode,meta_description,meta_keywords,template_flag,template_id,draft_flag,owner_id,group_id,' . 'perm_owner,perm_group,perm_members,perm_anon,sp_php,sp_nf,sp_centerblock,sp_help,sp_tid,sp_where,sp_inblock,postmode', "'{$sp_id}','{$sp_title}','{$sp_page_title}','{$sp_content}','{$datecreated}',NOW(),{$sp_hits},'{$sp_format}',{$sp_onmenu},'{$sp_label}','{$commentcode}','{$meta_description}','{$meta_keywords}',{$template_flag},'{$template_id}',{$draft_flag},{$owner_id},{$group_id}," . "{$perm_owner},{$perm_group},{$perm_members},{$perm_anon},'{$sp_php}','{$sp_nf}',{$sp_centerblock},'{$sp_help}','{$sp_tid}',{$sp_where}," . "'{$sp_inblock}','{$postmode}'");
if ($delete_old_page && !empty($sp_old_id)) {
// If a template and the id changed, update any staticpages that use it
if ($template_flag == 1) {
$sql = "UPDATE {$_TABLES['staticpage']} SET template_id = '{$sp_id}' WHERE template_id = '{$sp_old_id}'";
$result = DB_query($sql);
}
DB_delete($_TABLES['staticpage'], 'sp_id', $sp_old_id);
}
if (empty($sp_old_id) || $sp_id == $sp_old_id) {
if (!$template_flag) {
PLG_itemSaved($sp_id, 'staticpages');
} else {
// If template then have to notify of all pages that use this template that a change to the page happened
$sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
$result = DB_query($sql);
while ($A = DB_fetchArray($result)) {
PLG_itemSaved($A['sp_id'], 'staticpages');
}
}
} else {
DB_change($_TABLES['comments'], 'sid', addslashes($sp_id), array('sid', 'type'), array(addslashes($sp_old_id), 'staticpages'));
if (!$template_flag) {
PLG_itemSaved($sp_id, 'staticpages', $sp_old_id);
} else {
// If template then have to notify of all pages that use this template that a change to the page happened
$sql = "SELECT sp_id FROM {$_TABLES['staticpage']} WHERE template_id = '{$sp_id}'";
$result = DB_query($sql);
while ($A = DB_fetchArray($result)) {
PLG_itemSaved($A['sp_id'], 'staticpages');
}
}
}
$url = COM_buildURL($_CONF['site_url'] . '/staticpages/index.php?page=' . $sp_id);
$output .= PLG_afterSaveSwitch($_SP_CONF['aftersave'], $url, 'staticpages', 19);
$svc_msg['id'] = $sp_id;
return PLG_RET_OK;
} else {
$output .= COM_siteHeader('menu', $LANG_STATIC['staticpageeditor']);
$output .= COM_errorLog($LANG_STATIC['no_title_or_content'], 2);
if (!$args['gl_svc']) {
$output .= staticpageeditor($sp_id);
}
$output .= COM_siteFooter();
return PLG_RET_ERROR;
}
}
示例10: doTest
$display .= doTest($url, 'data/test.txt', 'data directory');
@unlink($_CONF['path_data'] . 'test.txt');
} else {
$display .= '<li>' . sprintf($LANG_SECTEST['failed_tmp'], 'data') . '</li>';
}
$display .= checkDefaultPassword();
$display .= '</ol>';
} else {
$resultInstallDirCheck = checkInstallDir();
$resultPasswordCheck = checkDefaultPassword();
if ($failed_tests == 0) {
$display .= '<p>' . $LANG_SECTEST['okay'] . '</p>';
} else {
$display .= '<ol>';
$display .= $resultInstallDirCheck . LB . $resultPasswordCheck;
$display .= '</ol>';
}
}
if ($failed_tests > 0) {
$display .= '<p class="warningsmall"><strong>' . $LANG_SECTEST['please_fix'] . '</strong></p>';
DB_save($_TABLES['vars'], 'name,value', "'security_check','0'");
} else {
$display .= '<p>' . $LANG_SECTEST['please_note'] . '</p>';
DB_save($_TABLES['vars'], 'name,value', "'security_check','1'");
}
$ml = COM_createLink('geeklog-announce', 'http://lists.geeklog.net/mailman/listinfo/geeklog-announce');
$versioncheck = '<strong>' . $LANG01[107] . '</strong>';
$display .= '<p>' . sprintf($LANG_SECTEST['stay_informed'], $ml, $versioncheck) . '</p>';
$display .= COM_endBlock();
$display .= COM_siteFooter();
COM_output($display);
示例11: TRB_saveTrackbackComment
/**
* Save a trackback (or pingback) comment.
*
* Also filters parameters and handles multiple trackbacks from the same source.
*
* Note: Spam check should have been done before calling this function.
*
* @param string $sid entry id
* @param string $type type of entry ('article' = story, etc.)
* @param string $url URL of the trackback comment
* @param string $title title of the comment (set to $url if empty)
* @param string $blog name of the blog that sent the comment
* @param string $excerpt excerpt from the comment
* @return int < 0: error, > 0: ID of the trackback comment
*
*/
function TRB_saveTrackbackComment($sid, $type, $url, $title = '', $blog = '', $excerpt = '')
{
global $_CONF, $_TABLES;
$url = COM_applyFilter($url);
$title = TRB_filterTitle($title);
$blog = TRB_filterBlogname($blog);
$excerpt = TRB_filterExcerpt($excerpt);
// MT does that, so follow its example ...
if (MBYTE_strlen($excerpt) > 255) {
$excerpt = MBYTE_substr($excerpt, 0, 252) . '...';
}
$title = str_replace(array('$', '{', '}'), array('$', '{', '~'), $title);
$excerpt = str_replace(array('$', '{', '}'), array('$', '{', '~'), $excerpt);
$blog = str_replace(array('$', '{', '}'), array('$', '{', '~'), $blog);
$url = DB_escapeString($url);
$title = DB_escapeString($title);
$blog = DB_escapeString($blog);
$excerpt = DB_escapeString($excerpt);
if ($_CONF['multiple_trackbacks'] == 0) {
// multiple trackbacks not allowed - check if we have this one already
if (DB_count($_TABLES['trackback'], array('url', 'sid', 'type'), array($url, $sid, $type)) >= 1) {
return TRB_SAVE_REJECT;
}
} else {
if ($_CONF['multiple_trackbacks'] == 1) {
// delete any earlier trackbacks from the same URL
DB_delete($_TABLES['trackback'], array('url', 'sid', 'type'), array($url, $sid, $type));
}
}
// else: multiple trackbacks allowed
DB_save($_TABLES['trackback'], 'sid,url,title,blog,excerpt,date,type,ipaddress', "'{$sid}','{$url}','{$title}','{$blog}','{$excerpt}',NOW(),'{$type}','{$_SERVER['REMOTE_ADDR']}'");
$comment_id = DB_insertId();
if ($type == 'article') {
DB_query("UPDATE {$_TABLES['stories']} SET trackbacks = trackbacks + 1 WHERE (sid = '{$sid}')");
}
return $comment_id;
}
示例12: CMT_approveModeration
/**
* Moves comment from submission table to comments table
*
* @copyright Jared Wenerd 2008
* @author Jared Wenerd, wenerd87 AT gmail DOT com
* @param string $cid comment id
* @return string of story id
*/
function CMT_approveModeration($cid)
{
global $_CONF, $_TABLES;
$result = DB_query("SELECT type, sid, date, title, comment, uid, name, pid, ipaddress FROM {$_TABLES['commentsubmissions']} WHERE cid = '{$cid}'");
$A = DB_fetchArray($result);
if ($A['pid'] > 0) {
// get indent+1 of parent
$indent = DB_getItem($_TABLES['comments'], 'indent+1', "cid = '{$A['pid']}'");
} else {
$indent = 0;
}
$A['title'] = addslashes($A['title']);
$A['comment'] = addslashes($A['comment']);
if (isset($A['name'])) {
// insert data
$A['name'] = addslashes($A['name']);
DB_save($_TABLES['comments'], 'type,sid,date,title,comment,uid,name,pid,ipaddress,indent', "'{$A['type']}','{$A['sid']}','{$A['date']}','{$A['title']}','{$A['comment']}','{$A['uid']}'," . "'{$A['name']}','{$A['pid']}','{$A['ipaddress']}',{$indent}");
} else {
// insert data, null automatically goes into name column
DB_save($_TABLES['comments'], 'type,sid,date,title,comment,uid,pid,ipaddress,indent', "'{$A['type']}','{$A['sid']}','{$A['date']}','{$A['title']}','{$A['comment']}','{$A['uid']}'," . "'{$A['pid']}','{$A['ipaddress']}',{$indent}");
}
$newcid = DB_insertId();
DB_delete($_TABLES['commentsubmissions'], 'cid', $cid);
DB_change($_TABLES['commentnotifications'], 'cid', $newcid, 'mid', $cid);
// notify of new published comment
if ($_CONF['allow_reply_notifications'] == 1 && $A['pid'] > 0) {
$result = DB_query("SELECT cid, uid, deletehash FROM {$_TABLES['commentnotifications']} WHERE cid = {$A['pid']}");
$B = DB_fetchArray($result);
if ($B !== false) {
CMT_sendReplyNotification($B);
}
}
return $A['sid'];
}
示例13: savelink
/**
* Saves link to the database
*
* @param string $lid ID for link
* @param string $old_lid old ID for link
* @param string $cid cid of category link belongs to
* @param string $categorydd Category links belong to
* @param string $url URL of link to save
* @param string $description Description of link
* @param string $title Title of link
* @param int $hits Number of hits for link
* @param int $owner_id ID of owner
* @param int $group_id ID of group link belongs to
* @param int $perm_owner Permissions the owner has
* @param int $perm_group Permissions the group has
* @param int $perm_members Permissions members have
* @param int $perm_anon Permissions anonymous users have
* @return string HTML redirect or error message
* @global array core config vars
* @global array core group data
* @global array core table data
* @global array core user data
* @global array core msg data
* @global array links plugin lang admin vars
*
*/
function savelink($lid, $old_lid, $cid, $categorydd, $url, $description, $title, $hits, $owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon)
{
global $_CONF, $_GROUPS, $_TABLES, $_USER, $MESSAGE, $LANG_LINKS_ADMIN, $_LI_CONF;
$retval = '';
// Convert array values to numeric permission values
if (is_array($perm_owner) or is_array($perm_group) or is_array($perm_members) or is_array($perm_anon)) {
list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($perm_owner, $perm_group, $perm_members, $perm_anon);
}
// Remove any autotags the user doesn't have permission to use
$description = PLG_replaceTags($description, '', true);
// clean 'em up
$description = DB_escapeString(COM_checkHTML(COM_checkWords($description), 'links.edit'));
$title = DB_escapeString(strip_tags(COM_checkWords($title)));
$cid = DB_escapeString($cid);
if (empty($owner_id)) {
// this is new link from admin, set default values
$owner_id = $_USER['uid'];
if (isset($_GROUPS['Links Admin'])) {
$group_id = $_GROUPS['Links Admin'];
} else {
$group_id = SEC_getFeatureGroup('links.edit');
}
$perm_owner = 3;
$perm_group = 2;
$perm_members = 2;
$perm_anon = 2;
}
$lid = COM_sanitizeID($lid);
$old_lid = COM_sanitizeID($old_lid);
if (empty($lid)) {
if (empty($old_lid)) {
$lid = COM_makeSid();
} else {
$lid = $old_lid;
}
}
// check for link id change
if (!empty($old_lid) && $lid != $old_lid) {
// check if new lid is already in use
if (DB_count($_TABLES['links'], 'lid', $lid) > 0) {
// TBD: abort, display editor with all content intact again
$lid = $old_lid;
// for now ...
}
}
$access = 0;
$old_lid = DB_escapeString($old_lid);
if (DB_count($_TABLES['links'], 'lid', $old_lid) > 0) {
$result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE lid = '{$old_lid}'");
$A = DB_fetchArray($result);
$access = SEC_hasAccess($A['owner_id'], $A['group_id'], $A['perm_owner'], $A['perm_group'], $A['perm_members'], $A['perm_anon']);
} else {
$access = SEC_hasAccess($owner_id, $group_id, $perm_owner, $perm_group, $perm_members, $perm_anon);
}
if ($access < 3 || !SEC_inGroup($group_id)) {
$display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
COM_accessLog("User {$_USER['username']} tried to illegally submit or edit link {$lid}.");
COM_output($display);
exit;
} elseif (!empty($title) && !empty($description) && !empty($url)) {
if ($categorydd != $LANG_LINKS_ADMIN[7] && !empty($categorydd)) {
$cid = DB_escapeString($categorydd);
} else {
if ($categorydd != $LANG_LINKS_ADMIN[7]) {
echo COM_refresh($_CONF['site_admin_url'] . '/plugins/links/index.php');
}
}
DB_delete($_TABLES['linksubmission'], 'lid', $old_lid);
DB_delete($_TABLES['links'], 'lid', $old_lid);
DB_save($_TABLES['links'], 'lid,cid,url,description,title,date,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon', "'{$lid}','{$cid}','{$url}','{$description}','{$title}',NOW(),'{$hits}',{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon}");
if (empty($old_lid) || $old_lid == $lid) {
PLG_itemSaved($lid, 'links');
} else {
//.........這裏部分代碼省略.........
示例14: USER_save
//.........這裏部分代碼省略.........
}
$aids = '';
if (sizeof($AIDS) > 0) {
foreach ($AIDS as $key => $val) {
$AIDS[$key] = intval($val);
}
$aids = DB_escapeString(implode(' ', $AIDS));
}
$selectedblocks = '';
$selectedBoxes = array();
if (count($BOXES) > 0) {
foreach ($BOXES as $key => $val) {
$BOXES[$key] = intval($val);
}
$boxes = DB_escapeString(implode(',', $BOXES));
$blockresult = DB_query("SELECT bid,name FROM {$_TABLES['blocks']} WHERE bid NOT IN ({$boxes})");
$numRows = DB_numRows($blockresult);
for ($x = 1; $x <= $numRows; $x++) {
$row = DB_fetchArray($blockresult);
if ($row['name'] != 'user_block' and $row['name'] != 'admin_block' and $row['name'] != 'section_block') {
$selectedblocks .= $row['bid'];
if ($x != $numRows) {
$selectedblocks .= ' ';
}
}
}
}
$etids = '-';
if (sizeof($ETIDS) > 0) {
$etids = DB_escapeString(implode(' ', array_intersect($AETIDS, $ETIDS)));
} else {
$etids = '-';
}
DB_save($_TABLES['userindex'], "uid,tids,aids,boxes,noboxes,maxstories,etids", "{$uid},'{$tids}','{$aids}','{$selectedblocks}',{$noboxes},{$maxstories},'{$etids}'");
// usercomment
DB_save($_TABLES['usercomment'], 'uid,commentmode,commentorder,commentlimit', "{$uid},'{$commentmode}','{$commentorder}'," . intval($commentlimit));
if ($_CONF['custom_registration'] and function_exists('CUSTOM_userSave')) {
CUSTOM_userSave($uid);
}
if ($_CONF['usersubmission'] == 1 && $oldstatus == USER_ACCOUNT_AWAITING_APPROVAL && ($userstatus == USER_ACCOUNT_ACTIVE || $userstatus == USER_ACCOUNT_AWAITING_ACTIVATION || $userstatus == USER_ACCOUNT_AWAITING_VERIFICATION)) {
USER_createAndSendPassword($username, $email, $uid);
}
if ($userstatus == USER_ACCOUNT_DISABLED) {
SESS_endUserSession($uid);
}
$userChanged = true;
// if groups is -1 then this user isn't allowed to change any groups so ignore
if (is_array($groups) && SEC_hasRights('group.edit')) {
if (!SEC_inGroup('Root')) {
$rootgrp = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'");
if (in_array($rootgrp, $groups)) {
COM_accessLog("User {$_USER['username']} ({$_USER['uid']}) just tried to give Root permissions to user {$username}.");
echo COM_refresh($_CONF['site_admin_url'] . '/index.php');
exit;
}
}
// make sure the Remote Users group is in $groups
if (SEC_inGroup('Remote Users', $uid)) {
$remUsers = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Remote Users'");
if (!in_array($remUsers, $groups)) {
$groups[] = $remUsers;
}
}
if ($_USER_VERBOSE) {
COM_errorLog("deleting all group_assignments for user {$uid}/{$username}", 1);
}
示例15: MG_saveMemberDefaults
function MG_saveMemberDefaults()
{
global $_CONF, $_MG_CONF, $_TABLES, $_USER, $_POST;
$member_albums = isset($_POST['member_albums']) ? COM_applyFilter($_POST['member_albums'], true) : 0;
$member_quota = COM_applyFilter($_POST['member_quota'], true) * 1048576;
$auto_create = isset($_POST['auto_create']) ? COM_applyFilter($_POST['auto_create'], true) : 0;
$allow_create = isset($_POST['allow_create']) ? COM_applyFilter($_POST['allow_create'], true) : 0;
$member_use_fullname = isset($_POST['member_use_fullname']) ? COM_applyFilter($_POST['member_use_fullname'], true) : 0;
$feature_member_album = isset($_POST['feature_member_album']) ? COM_applyFilter($_POST['feature_member_album'], true) : 0;
$allow_remote = isset($_POST['allow_remote']) ? COM_applyFilter($_POST['allow_remote'], true) : 0;
$member_root = isset($_POST['member_root']) ? COM_applyFilter($_POST['member_root'], true) : 0;
$member_archive = isset($_POST['member_archive']) ? COM_applyFilter($_POST['member_archive'], true) : 0;
$enable_random = isset($_POST['enable_random']) ? COM_applyFilter($_POST['enable_random'], true) : 0;
$max_image_width = COM_applyFilter($_POST['max_image_width'], true);
$max_image_height = COM_applyFilter($_POST['max_image_height'], true);
$max_filesize = COM_applyFilter($_POST['max_filesize'], true) * 1024;
$uploads = isset($_POST['uploads']) ? COM_applyFilter($_POST['uploads'], true) : 0;
$moderate = isset($_POST['moderate']) ? COM_applyFilter($_POST['moderate'], true) : 0;
$mod_id = COM_applyFilter($_POST['mod_id'], true);
$email_mod = isset($_POST['email_mod']) ? COM_applyFilter($_POST['email_mod'], true) : 0;
$tperm_owner = isset($_POST['perm_owner']) ? $_POST['perm_owner'] : 0;
$tperm_group = isset($_POST['perm_group']) ? $_POST['perm_group'] : 0;
$tperm_members = isset($_POST['perm_members']) ? $_POST['perm_members'] : 0;
$tperm_anon = isset($_POST['perm_anon']) ? $_POST['perm_anon'] : 0;
list($perm_owner, $perm_group, $perm_members, $perm_anon) = SEC_getPermissionValues($tperm_owner, $tperm_group, $tperm_members, $tperm_anon);
// valid media formats....
$format_jpg = isset($_POST['format_jpg']) ? COM_applyFilter($_POST['format_jpg'], true) : 0;
$format_png = isset($_POST['format_png']) ? COM_applyFilter($_POST['format_png'], true) : 0;
$format_tif = isset($_POST['format_tif']) ? COM_applyFilter($_POST['format_tif'], true) : 0;
$format_gif = isset($_POST['format_gif']) ? COM_applyFilter($_POST['format_gif'], true) : 0;
$format_bmp = isset($_POST['format_bmp']) ? COM_applyFilter($_POST['format_bmp'], true) : 0;
$format_tga = isset($_POST['format_tga']) ? COM_applyFilter($_POST['format_tga'], true) : 0;
$format_psd = isset($_POST['format_psd']) ? COM_applyFilter($_POST['format_psd'], true) : 0;
$format_mp3 = isset($_POST['format_mp3']) ? COM_applyFilter($_POST['format_mp3'], true) : 0;
$format_ogg = isset($_POST['format_ogg']) ? COM_applyFilter($_POST['format_ogg'], true) : 0;
$format_asf = isset($_POST['format_asf']) ? COM_applyFilter($_POST['format_asf'], true) : 0;
$format_swf = isset($_POST['format_swf']) ? COM_applyFilter($_POST['format_swf'], true) : 0;
$format_mov = isset($_POST['format_mov']) ? COM_applyFilter($_POST['format_mov'], true) : 0;
$format_mp4 = isset($_POST['format_mp4']) ? COM_applyFilter($_POST['format_mp4'], true) : 0;
$format_mpg = isset($_POST['format_mpg']) ? COM_applyFilter($_POST['format_mpg'], true) : 0;
$format_zip = isset($_POST['format_zip']) ? COM_applyFilter($_POST['format_zip'], true) : 0;
$format_other = isset($_POST['format_other']) ? COM_applyFilter($_POST['format_other'], true) : 0;
$format_flv = isset($_POST['format_flv']) ? COM_applyFilter($_POST['format_flv'], true) : 0;
$format_rflv = isset($_POST['format_rflv']) ? COM_applyFilter($_POST['format_rflv'], true) : 0;
$format_emb = isset($_POST['format_emb']) ? COM_applyFilter($_POST['format_emb'], true) : 0;
$member_valid_formats = $format_jpg + $format_png + $format_tif + $format_gif + $format_bmp + $format_tga + $format_psd + $format_mp3 + $format_ogg + $format_asf + $format_swf + $format_mov + $format_mp4 + $format_mpg + $format_zip + $format_other + $format_flv + $format_rflv + $format_emb;
// put any error checking / validation here
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_albums','{$member_albums}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_use_fullname','{$member_use_fullname}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'feature_member_album','{$feature_member_album}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'allow_remote','{$allow_remote}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_quota','{$member_quota}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_auto_create','{$auto_create}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_create_new','{$allow_create}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_album_root','{$member_root}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_album_archive','{$member_archive}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_enable_random','{$enable_random}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_max_width','{$max_image_width}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_max_height','{$max_image_height}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_max_filesize','{$max_filesize}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_uploads','{$uploads}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_moderate','{$moderate}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_mod_group_id','{$mod_id}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_email_mod','{$email_mod}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_perm_owner','{$perm_owner}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_perm_group','{$perm_group}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_perm_members','{$perm_members}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_perm_anon','{$perm_anon}'");
DB_save($_TABLES['mg_config'], "config_name, config_value", "'member_valid_formats','{$member_valid_formats}'");
CACHE_remove_instance('stmenu');
echo COM_refresh($_MG_CONF['admin_url'] . 'index.php?msg=12');
exit;
}