当前位置: 首页>>代码示例>>PHP>>正文


PHP DB_change函数代码示例

本文整理汇总了PHP中DB_change函数的典型用法代码示例。如果您正苦于以下问题:PHP DB_change函数的具体用法?PHP DB_change怎么用?PHP DB_change使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DB_change函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MG_haveEXIF

function MG_haveEXIF($mid)
{
    global $_CONF, $_MG_CONF, $_TABLES, $LANG_MG04;
    $count = 0;
    $exifItems = 0;
    $result = DB_query("SELECT media_filename,media_mime_ext,media_exif FROM {$_TABLES['mg_media']} WHERE media_id='" . addslashes($mid) . "'");
    list($media_filename, $media_mime_ext, $media_exif) = DB_fetchArray($result);
    if ($media_exif == 0) {
        return 0;
    }
    if ($media_filename == '') {
        return 0;
    }
    $exif = array();
    if ($_MG_CONF['discard_original'] == 1) {
        $exif = ExifProcessor($_MG_CONF['path_mediaobjects'] . 'disp/' . $media_filename[0] . '/' . $media_filename . '.jpg');
    } else {
        $exif = ExifProcessor($_MG_CONF['path_mediaobjects'] . 'orig/' . $media_filename[0] . '/' . $media_filename . '.' . $media_mime_ext);
    }
    if (count($exif) == 0) {
        DB_change($_TABLES['mg_media'], 'media_exif', 0, 'media_id', addslashes($mid));
        return 0;
    }
    return count($exif);
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:25,代码来源:lib-exif.php

示例2: disableUser

 /**
  * Disables a specified user
  *
  * @param    int $uid
  **/
 protected function disableUser($uid)
 {
     global $_TABLES, $_USER;
     $this->result = PLG_SPAM_ACTION_DELETE;
     DB_change($_TABLES['users'], 'status', USER_ACCOUNT_DISABLED, 'uid', $uid);
     SPAMX_log("User {$_USER['username']} banned for profile spam.");
 }
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:12,代码来源:BaseCommand.class.php

示例3: execute

 function execute($comment)
 {
     global $result, $_CONF, $_TABLES, $LANG_SX00;
     $result = 128;
     // update count of deleted spam posts
     DB_change($_TABLES['vars'], 'value', 'value + 1', 'name', 'spamx.counter', '', true);
     SPAMX_log($LANG_SX00['spamdeleted']);
     return 1;
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:9,代码来源:DeleteComment.Action.class.php

示例4: execute

 /**
  * Execute
  *
  * @param  string $comment
  * @return int
  */
 public function execute($comment)
 {
     global $result, $_CONF, $_TABLES, $LANG_SX00, $_USER;
     $url = COM_getCurrentURL();
     if (strpos($url, 'usersettings.php') !== false) {
         $this->result = PLG_SPAM_ACTION_DELETE;
         DB_change($_TABLES['users'], 'status', USER_ACCOUNT_DISABLED, 'uid', $_USER['uid']);
         SPAMX_log("User {$_USER['username']} banned for profile spam.");
     }
     return 1;
 }
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:17,代码来源:BanUser.Action.class.php

示例5: calendar_update_move_states

/**
* Replace the old $_STATES array with a free-form text field
*
*/
function calendar_update_move_states()
{
    global $_TABLES, $_STATES;
    if (isset($_STATES) && is_array($_STATES)) {
        $tables = array($_TABLES['events'], $_TABLES['eventsubmission'], $_TABLES['personal_events']);
        foreach ($_STATES as $key => $state) {
            foreach ($tables as $table) {
                DB_change($table, 'state', DB_escapeString($state), 'state', DB_escapeString($key));
            }
        }
    }
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:16,代码来源:mssql_updates.php

示例6: 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;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:51,代码来源:moderate.php

示例7: MG_saveUser

function MG_saveUser()
{
    global $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
    $uid = COM_applyFilter($_POST['uid'], true);
    $quota = COM_applyFilter($_POST['quota'], true) * 1048576;
    $active = COM_applyFilter($_POST['active'], true);
    $result = DB_query("SELECT uid FROM {$_TABLES['mg_userprefs']} WHERE uid=" . $uid);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        DB_change($_TABLES['mg_userprefs'], 'quota', $quota, 'uid', $uid);
        DB_change($_TABLES['mg_userprefs'], 'active', $active, 'uid', $uid);
    } else {
        DB_query("INSERT INTO {$_TABLES['mg_userprefs']} SET uid=" . $uid . ", quota=" . $quota . ",active=" . $active, 1);
    }
    echo COM_refresh($_MG_CONF['admin_url'] . 'quotareport.php');
    exit;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:17,代码来源:edituser.php

示例8: update_UsersFor180

/**
 * Add passwords for OAuth and OpenID users
 *
 */
function update_UsersFor180()
{
    global $_CONF, $_TABLES;
    require_once $_CONF['path_system'] . 'lib-security.php';
    $passwords = array();
    $sql = "SELECT uid FROM {$_TABLES['users']} WHERE (remoteservice IS NOT NULL OR remoteservice != '') AND passwd = ''";
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    for ($i = 0; $i < $nrows; $i++) {
        $A = DB_fetchArray($result);
        /* Formerlly USER_changePassword */
        $passwd['normal'] = rand();
        $passwd['normal'] = md5($passwd['normal']);
        $passwd['normal'] = substr($passwd['normal'], 1, 8);
        $passwd['encrypted'] = SEC_encryptPassword($passwd['normal'], '', HashFunction::md5, 1);
        /* use default md5 only */
        if ($A['uid'] > 1) {
            DB_change($_TABLES['users'], 'passwd', $passwd['encrypted'], 'uid', $A['uid']);
        }
    }
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:25,代码来源:mysql_1.7.2_to_1.8.0.php

示例9: 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;
}
开发者ID:spacequad,项目名称:glfusion,代码行数:21,代码来源:ajax_handler.php

示例10: COM_refresh

*/
require_once '../lib-common.php';
if (!in_array('links', $_PLUGINS)) {
    echo COM_refresh($_CONF['site_url'] . '/index.php');
    exit;
}
// MAIN
$url = '';
COM_setArgNames(array('what', 'item'));
$what = COM_getArgument('what');
if ($what == 'link') {
    $item = COM_applyFilter(COM_getArgument('item'));
    if (!empty($item)) {
        // Hack: due to PLG_afterSaveSwitch settings, we may get
        // an attached &msg - strip it off
        $i = explode('&', $item);
        $item = $i[0];
    }
    if (!empty($item)) {
        $url = DB_getItem($_TABLES['links'], 'url', "lid = '{$item}'");
        if (!empty($url)) {
            DB_change($_TABLES['links'], 'hits', 'hits + 1', 'lid', $item, '', true);
        }
    }
}
if (empty($url)) {
    $url = $_CONF['site_url'];
}
header('HTTP/1.1 301 Moved');
header('Location: ' . $url);
header('Connection: close');
开发者ID:hostellerie,项目名称:nexpro,代码行数:31,代码来源:portal.php

示例11: PLG_resolveDependencies

/**
*  Disables all plugins with unresolved dependencies
*  and resolves the load order for all enabled plugins.
*
* @return   bool    True or False, depending on whether it was
*                   necessary to alter the load order of a plugin
* @since            Geeklog 1.8.0
*/
function PLG_resolveDependencies()
{
    global $_PLUGINS, $_TABLES;
    $retval = '';
    $flag = true;
    // false means that all dependencies are resolved
    while ($flag) {
        // loop until ALL dependencies are satisfied
        $flag = false;
        // set this if any plugin has been disabled during the loop
        foreach ($_PLUGINS as $key => $pi_name) {
            if (!PLG_checkDependencies($pi_name)) {
                // plugin has unresolved dependencies
                // disable plugin;
                $flag = true;
                // disabling a plugin can break the dependencies of a plugin that has already been checked, remember to loop again
                PLG_enableStateChange($pi_name, false);
                DB_change($_TABLES['plugins'], 'pi_enabled', 0, 'pi_name', $pi_name);
                PLG_pluginStateChange($pi_name, 'disabled');
                unset($_PLUGINS[$key]);
            }
        }
    }
    // automatically resolve load order for enabled plugins
    $index = 2000;
    // how far through the load order to push back plugins
    $maxqueries = 50;
    // just in case...
    $globalflag = false;
    // remember if we change the load order of any plugin
    $flag = true;
    // set true if we need another pass in the while loop
    while ($flag && $maxqueries) {
        // Now check if the load order is correct
        $flag = false;
        // get the load orders of all enabled plugins
        $q = DB_query("SELECT pi_name, pi_load FROM {$_TABLES['plugins']} WHERE pi_enabled='1'");
        $plo = array();
        // Plugins Load Order
        while ($a = DB_fetchArray($q)) {
            $plo[] = $a;
        }
        $params = array();
        foreach ($plo as $key => $value) {
            // for each available plugin
            $maxqueries--;
            $params = PLG_getParams($value['pi_name']);
            // get dependencies
            if (isset($params['requires']) && is_array($params['requires'])) {
                // if any
                foreach ($params['requires'] as $rkey => $rvalue) {
                    // process each dependency
                    if (isset($rvalue['plugin'])) {
                        // get the load order of the required plugin
                        foreach ($plo as $new_key => $new_value) {
                            if ($new_value['pi_name'] == $rvalue['plugin']) {
                                $dep_load = $new_value['pi_load'];
                                break;
                            }
                        }
                        if ($dep_load > $value['pi_load']) {
                            // incorrect load order
                            // move down the order
                            DB_query("UPDATE {$_TABLES['plugins']} SET pi_load = '{$index}' WHERE pi_name = '{$value['pi_name']}'");
                            $index++;
                            $flag = true;
                            $globalflag = true;
                        }
                    }
                }
            }
        }
    }
    reorderplugins();
    if ($globalflag == false) {
        return true;
        // no change
    } else {
        return false;
        // something changed
    }
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:90,代码来源:lib-plugins.php

示例12: _userSetnewpwd

function _userSetnewpwd()
{
    global $_CONF, $_TABLES, $_USER, $LANG04;
    $retval = '';
    if (empty($_POST['passwd']) || $_POST['passwd'] != $_POST['passwd_conf']) {
        echo COM_refresh($_CONF['site_url'] . '/users.php?mode=newpwd&amp;uid=' . COM_applyFilter($_POST['uid'], true) . '&amp;rid=' . COM_applyFilter($_POST['rid']));
    } else {
        $uid = COM_applyFilter($_POST['uid'], true);
        $reqid = COM_sanitizeID(COM_applyFilter($_POST['rid']));
        if (!empty($uid) && is_numeric($uid) && $uid > 1 && !empty($reqid) && strlen($reqid) == 16) {
            $uid = (int) $uid;
            $safereqid = DB_escapeString($reqid);
            $valid = DB_count($_TABLES['users'], array('uid', 'pwrequestid'), array($uid, $safereqid));
            if ($valid == 1) {
                $passwd = SEC_encryptPassword($_POST['passwd']);
                DB_change($_TABLES['users'], 'passwd', DB_escapeString($passwd), "uid", $uid);
                DB_delete($_TABLES['sessions'], 'uid', $uid);
                DB_change($_TABLES['users'], 'pwrequestid', "NULL", 'uid', $uid);
                echo COM_refresh($_CONF['site_url'] . '/users.php?msg=53');
            } else {
                // request invalid or expired
                $retval .= COM_showMessage(54, '', '', 1, 'error');
                $retval .= getpasswordform();
            }
        } else {
            // this request doesn't make sense - ignore it
            echo COM_refresh($_CONF['site_url']);
        }
    }
}
开发者ID:spacequad,项目名称:glfusion,代码行数:30,代码来源:users.php

示例13: SEC_remoteAuthentication

/**
 * Check to see if we can authenticate this user with a remote server
 * A user has not managed to login localy, but has an @ in their user
 * name and we have enabled distributed authentication. Firstly, try to
 * see if we have cached the module that we used to authenticate them
 * when they signed up (i.e. they've actualy changed their password
 * elsewhere and we need to synch.) If not, then try to authenticate
 * them with /every/ authentication module. If this suceeds, create
 * a user for them.
 *
 * @param  string $loginname Their username
 * @param  string $passwd    The password entered
 * @param  string $service   The service portion of $username
 * @param  string $uid       OUTPUT parameter, pass it by ref to get uid back.
 * @return int     user status, -1 for fail.
 */
function SEC_remoteAuthentication(&$loginname, $passwd, $service, &$uid)
{
    global $_CONF, $_TABLES;
    /* First try a local cached login */
    $remoteusername = DB_escapeString($loginname);
    $remoteservice = DB_escapeString($service);
    $result = DB_query("SELECT passwd, status, uid FROM {$_TABLES['users']} WHERE remoteusername='{$remoteusername}' AND remoteservice='{$remoteservice}'");
    $tmp = DB_error();
    $nrows = DB_numRows($result);
    if ($tmp == 0 && $nrows == 1) {
        $U = DB_fetchArray($result);
        $uid = $U['uid'];
        $mypass = $U['passwd'];
        // also used to see if the user existed later.
        if ($mypass == SEC_encryptPassword($passwd)) {
            /* Valid password for cached user, return status */
            return $U['status'];
        }
    }
    $service = COM_sanitizeFilename($service);
    $servicefile = $_CONF['path_system'] . 'classes/authentication/' . $service . '.auth.class.php';
    if (file_exists($servicefile)) {
        require_once $servicefile;
        $authmodule = new $service();
        if ($authmodule->authenticate($loginname, $passwd)) {
            /* check to see if they have logged in before: */
            if (empty($mypass)) {
                // no such user, create them
                // Check to see if their remoteusername is unique locally
                $checkName = DB_getItem($_TABLES['users'], 'username', "username='{$remoteusername}'");
                if (!empty($checkName)) {
                    // no, call custom function.
                    if (function_exists('CUSTOM_uniqueRemoteUsername')) {
                        $loginname = CUSTOM_uniqueRemoteUsername($loginname, $service);
                    }
                }
                USER_createAccount($loginname, $authmodule->email, $passwd, $authmodule->fullname, $authmodule->homepage, $remoteusername, $remoteservice);
                $uid = DB_getItem($_TABLES['users'], 'uid', "remoteusername = '{$remoteusername}' AND remoteservice='{$remoteservice}'");
                // Store full remote account name:
                DB_query("UPDATE {$_TABLES['users']} SET remoteusername='{$remoteusername}', remoteservice='{$remoteservice}', status=3 WHERE uid='{$uid}'");
                // Add to remote users:
                $remote_grp = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name='Remote Users'");
                DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id,ug_uid) VALUES ({$remote_grp}, {$uid})");
                return 3;
                // Remote auth precludes usersubmission,
                // and integrates user activation, see?
            } else {
                // user existed, update local password:
                DB_change($_TABLES['users'], 'passwd', SEC_encryptPassword($passwd), array('remoteusername', 'remoteservice'), array($remoteusername, $remoteservice));
                // and return their status
                return DB_getItem($_TABLES['users'], 'status', "remoteusername='{$remoteusername}' AND remoteservice='{$remoteservice}'");
            }
        } else {
            return -1;
        }
    } else {
        return -1;
    }
}
开发者ID:Geeklog-Core,项目名称:geeklog,代码行数:75,代码来源:lib-security.php

示例14: 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;
    }
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:101,代码来源:services.inc.php

示例15: MG_watermarkBatchProcess

function MG_watermarkBatchProcess($album_id, $mid)
{
    global $_CONF, $_MG_CONF, $_TABLES;
    $sql = "SELECT media_id,media_watermarked,media_type,media_filename,media_mime_ext " . "FROM {$_TABLES['mg_media']} WHERE media_id='" . addslashes($mid) . "'";
    $result = DB_query($sql);
    $nRows = DB_numRows($result);
    if ($nRows > 0) {
        $row = DB_fetchArray($result);
        if ($row['media_watermarked'] == 1 || $row['media_type'] != 0) {
            return;
        }
        if ($_MG_CONF['discard_original'] == 1) {
            $origImage = $_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.jpg';
            $rc = MG_watermark($origImage, $album_id, 1);
        } else {
            $origImage = $_MG_CONF['path_mediaobjects'] . 'orig/' . $row['media_filename'][0] . '/' . $row['media_filename'] . '.' . $row['media_mime_ext'];
            $rc = MG_watermark($origImage, $album_id, 1);
            if ($rc == true) {
                $origImage = '';
                foreach ($_MG_CONF['validExtensions'] as $ext) {
                    if (file_exists($_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext)) {
                        $origImage = $_MG_CONF['path_mediaobjects'] . 'disp/' . $row['media_filename'][0] . '/' . $row['media_filename'] . $ext;
                        break;
                    }
                }
                if ($origImage != '') {
                    $rc = MG_watermark($origImage, $album_id, 0);
                }
            }
        }
        // update the database to show they have been watermarked...
        if ($rc == true) {
            DB_change($_TABLES['mg_media'], 'media_watermarked', 1, 'media_id', addslashes($mid));
        }
    }
    return;
}
开发者ID:mistgrass,项目名称:geeklog-ivywe,代码行数:37,代码来源:lib-watermark.php


注:本文中的DB_change函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。