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


PHP DB_insertId函数代码示例

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


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

示例1: update_addFilemanager

function update_addFilemanager()
{
    global $_CONF, $_TABLES;
    $configAdminId = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Configuration Admin' ");
    $storyAdminId = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Story Admin' ");
    // Add Filemanager Admin group
    DB_query("INSERT INTO {$_TABLES['groups']} (grp_id, grp_name, grp_descr, grp_gl_core) VALUES (null, 'Filemanager Admin', 'Has full access to File Manager', 1);");
    $groupId = DB_insertId();
    // Add features
    $featureIds = array();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'filemanager.admin', 'Ability to use File Manager', 0)");
    $featureIds['filemanager.admin'] = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_general', 'Access to configure Filemanager General Settings', 0)");
    $featureIds['config.Filemanager.tab_general'] = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_upload', 'Access to configure Filemanager Upload Settings', 0)");
    $featureIds['config.Filemanager.tab_upload'] = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_images', 'Access to configure Filemanager Images Settings', 0)");
    $featureIds['config.Filemanager.tab_images'] = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_videos', 'Access to configure Filemanager Videos Settings', 0)");
    $featureIds['config.Filemanager.tab_videos'] = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['features']} (ft_id, ft_name, ft_descr, ft_gl_core) VALUES (null, 'config.Filemanager.tab_audios', 'Access to configure Filemanager Audios Settings', 0)");
    $featureIds['config.Filemanager.tab_audios'] = DB_insertId();
    // Add access rights
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['filemanager.admin']}, {$groupId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['filemanager.admin']}, {$storyAdminId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_general']}, {$configAdminId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_upload']}, {$configAdminId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_images']}, {$configAdminId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_videos']}, {$configAdminId}) ");
    DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$featureIds['config.Filemanager.tab_audios']}, {$configAdminId}) ");
    // Add group assignment
    DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_uid, ug_grp_id) VALUES ({$groupId}, NULL, 1) ");
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:33,代码来源:mssql_2.0.0_to_2.1.0.php

示例2: plugin_install_now

/**
* Puts the datastructures for this plugin into the Geeklog database
*
* @return   boolean TRUE if successful FALSE otherwise
*/
function plugin_install_now()
{
    global $pi_name, $pi_version, $gl_version, $pi_url, $NEWFEATURE;
    global $_TABLES, $_CONF;
    DB_query("INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr) " . "VALUES ('{$pi_name} Admin', 'Users in this group can administer the {$pi_name} plugin')", 1);
    if (DB_error()) {
        COM_errorLog('failed insert groups table', 1);
        plugin_uninstall_nmoxtopicown();
        return FALSE;
    }
    $group_id = DB_insertId();
    DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('{$pi_name}_admin', '{$group_id}')", 1);
    if (DB_error()) {
        COM_errorLog('failed insert vars table', 1);
        plugin_uninstall_nmoxtopicown();
        return FALSE;
    }
    foreach ($NEWFEATURE as $feature => $desc) {
        DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) " . "VALUES ('{$feature}','{$desc}')", 1);
        if (DB_error()) {
            COM_errorLog('failed insert feature table', 1);
            plugin_uninstall_nmoxtopicown();
            return FALSE;
        }
        $feat_id = DB_insertId();
        DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$feat_id}, {$group_id})");
        if (DB_error()) {
            COM_errorLog('failed insert access table', 1);
            plugin_uninstall_nmoxtopicown();
            return FALSE;
        }
    }
    DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES ({$group_id}, NULL, 1)");
    if (DB_error()) {
        COM_errorLog('failed insert group_assignments table', 1);
        plugin_uninstall_nmoxtopicown();
        return FALSE;
    }
    DB_delete($_TABLES['plugins'], 'pi_name', 'nmoxtopicown');
    DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) " . "VALUES ('{$pi_name}', '{$pi_version}', '{$gl_version}', '{$pi_url}', 1)");
    if (DB_error()) {
        COM_errorLog('failed insert plugin table', 1);
        plugin_uninstall_nmoxtopicown();
        return FALSE;
    }
    return TRUE;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:52,代码来源:install.php

示例3: submit_file

/**
* Add a file to the submission queue
*
* Most of the code in this function has been lifted from the File Management
* plugin's submit.php
*
*/
function submit_file($submitter, $filename, $title, $desc, $version, $homepage, $cid = 0)
{
    global $_CONF, $_USER, $_FM_TABLES, $_FMDOWNLOAD, $filemgmt_FileStore;
    $myts = new MyTextSanitizer();
    // MyTextSanitizer object
    $name = basename($filename);
    $url = rawurlencode($name);
    $name = $myts->makeTboxData4Save($name);
    $url = $myts->makeTboxData4Save($url);
    if (DB_count($_FM_TABLES['filemgmt_filedetail'], 'url', $name) > 0) {
        COM_errorLog("FM submit_file: file '" . $name . "' already exists in DB");
        return false;
    }
    $title = $myts->makeTboxData4Save($title);
    $homepage = $myts->makeTboxData4Save($homepage);
    $version = $myts->makeTboxData4Save($version);
    $size = sprintf('%u', filesize($filename));
    $description = $myts->makeTareaData4Save($desc);
    //$comments = ($_CONF['comment_code'] == 0) ? 1 : 0;
    $comments = 0;
    // prefer no comments on Geeklog tarballs
    $date = time();
    $tmpfilename = randomfilename();
    $uploadfilename = basename($filename);
    $pos = strrpos($uploadfilename, '.') + 1;
    $fileExtension = strtolower(substr($uploadfilename, $pos));
    if (array_key_exists($fileExtension, $_FMDOWNLOAD)) {
        if ($_FMDOWNLOAD[$fileExtension] == 'reject') {
            COM_errorLog("FM submit_file: file extension '" . $fileExtension . "' not allowed.");
            return false;
        }
        $fileExtension = $_FMDOWNLOAD[$fileExtension];
        $tmpfilename = $tmpfilename . '.' . $fileExtension;
        $pos = strrpos($url, '.') + 1;
        $url = strtolower(substr($url, 0, $pos)) . $fileExtension;
    } else {
        $tmpfilename = $tmpfilename . '.' . $fileExtension;
    }
    // would have preferred rename (i.e. move), but ran into file permission
    // problems on www.geeklog.net ...
    copy($filename, $filemgmt_FileStore . 'tmp/' . $tmpfilename);
    $logourl = '';
    DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedetail']} (cid, title, url, homepage, version, size, platform, logourl, submitter, status, date, hits, rating, votes, comments) VALUES ('{$cid}', '{$title}', '{$url}', '{$homepage}', '{$version}', '{$size}', '{$tmpfilename}', '{$logourl}', '{$submitter}', 0, '{$date}', 0, 0, 0, '{$comments}')");
    $newid = DB_insertId();
    DB_query("INSERT INTO {$_FM_TABLES['filemgmt_filedesc']} (lid, description) VALUES ({$newid}, '{$description}')");
    return true;
}
开发者ID:Geeklog-Core,项目名称:tools,代码行数:54,代码来源:submit-local-file.php

示例4: update_addLanguage

/**
 * Add Language feature
 */
function update_addLanguage()
{
    global $_TABLES;
    // Add `language_items` table
    $sql = "\nCREATE TABLE {$_TABLES['language_items']} (\n  id INT(11) NOT NULL AUTO_INCREMENT,\n  var_name VARCHAR(30) NOT NULL,\n  language VARCHAR(30) NOT NULL,\n  name VARCHAR(30) NOT NULL,\n  value VARCHAR(255) NOT NULL DEFAULT '',\n  PRIMARY KEY (id)\n) ENGINE=MyISAM\n";
    DB_query($sql);
    // Add `Language Admin` group
    $sql = "INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr, grp_gl_core) VALUES ('Language Admin', 'Has full access to language', 1);";
    DB_query($sql, 1);
    $grpId = DB_insertId();
    // Add `language.edit` feature
    $sql = "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('language.edit', 'Can manage Language Settings', 1)";
    DB_query($sql, 1);
    $ftId = DB_insertId();
    // Give `language.edit` feature to `Language Admin` group
    $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ftId}, {$grpId}) ";
    DB_query($sql, 1);
    // Add Root users to `Language Admin`
    $sql = "INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_uid, ug_grp_id) VALUES ({$grpId}, NULL, 1) ";
    DB_query($sql, 1);
}
开发者ID:mystralkk,项目名称:geeklog,代码行数:24,代码来源:mysql_2.1.1_to_2.1.2.php

示例5: xmlsitemap_update_ConfigSecurity_1_0_0

/**
 * Add is new security rights for the Group "XMLSitemap Admin"
 *
 */
function xmlsitemap_update_ConfigSecurity_1_0_0()
{
    global $_TABLES;
    // Add in security rights for XMLSitemap Admin
    $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'XMLSitemap Admin'");
    /*
     * For some time, from Geeklog 1.6.0 through to 1.7.0, we already had
     * an XMLSitemap Admin group in the database. It was dropped in 1.7.1
     * but not removed from the database. This is now coming back to haunt
     * us ... We also need to remove the unused xmlsitemap.edit permission
     * while we're at it.
     */
    if (empty($group_id)) {
        // cover: null, false, 0, etc. - doesn't exist yet
        // Add new Core Admin Group for Configuration
        DB_query("INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr, grp_gl_core) VALUES ('XMLSitemap Admin', 'Has full access to XMLSitemap features', 0);");
        $group_id = DB_insertId();
        // Assign XMLSitemap Admin group to Root group
        DB_query("INSERT INTO {$_TABLES['group_assignments']} (ug_main_grp_id, ug_uid, ug_grp_id) VALUES ({$group_id}, NULL, 1)");
    } else {
        // if the XMLSitemap Admin group already exists, then there will
        // probably also be a xmlsitemap.edit permission - remove it
        SEC_removeFeatureFromDB('xmlsitemap.edit');
    }
    // now that we cleaned this up, add the new stuff
    if ($group_id > 0) {
        $ft_names[] = 'config.xmlsitemap.tab_main';
        $ft_names[] = 'config.xmlsitemap.tab_pri';
        $ft_names[] = 'config.xmlsitemap.tab_freq';
        foreach ($ft_names as $name) {
            $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '{$name}'");
            if ($ft_id > 0) {
                $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$group_id})";
                DB_query($sql);
            }
        }
    }
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:42,代码来源:mssql_updates.php

示例6: install_spamx_plugin

/**
* Install SpamX plugin (also handled updates from version 1.0)
*
*/
function install_spamx_plugin()
{
    global $_TABLES;
    $_SPX_TABLE = "CREATE TABLE {$_TABLES['spamx']} (" . " name varchar(20) NOT NULL default ''," . " value varchar(255) NOT NULL default ''," . " INDEX spamx_name (name)" . ") TYPE=MyISAM";
    // SpamX plugin information, 'spamx.admin' feature, SpamX Admin group
    $_SPX_PLUGIN = "INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_enabled, pi_homepage) VALUES ('spamx', '1.0.1','1.3.10',1,'http://www.pigstye.net/gplugs/staticpages/index.php/spamx') ";
    $_SPX_FEAT = "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('spamx.admin', 'spamx Admin', 0) ";
    $_SPX_ADMIN = "INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr, grp_gl_core) VALUES ('spamx Admin', 'Users in this group can administer the spamx plugin',0) ";
    $group_id = DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'spamx Admin'");
    if ($group_id <= 0) {
        DB_query($_SPX_ADMIN);
        // add SpamX Admin group
        $group_id = DB_insertId();
    }
    $feat_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = 'spamx.admin'");
    if ($feat_id <= 0) {
        DB_query($_SPX_FEAT);
        // add 'spamx.admin' feature
        $feat_id = DB_insertId();
    }
    if (DB_getItem($_TABLES['access'], 'acc_grp_id', "acc_ft_id = {$feat_id}") != $group_id) {
        // add feature to spamx admin group
        DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$feat_id}, {$group_id})");
    }
    if (DB_getItem($_TABLES['group_assignments'], 'ug_main_grp_id', "ug_uid = NULL AND ug_grp_id = 1") != $group_id) {
        // make Root group a member of the SpamX Admin group
        DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES ({$group_id}, NULL, 1)");
    }
    $spxversion = get_SPX_Ver();
    if ($spxversion == 0 || $spxversion == 1) {
        // delete plugin entry so that we can update it below
        DB_delete($_TABLES['plugins'], 'pi_name', 'spamx');
        // create 'spamx' table
        DB_query($_SPX_TABLE);
        DB_query($_SPX_PLUGIN);
        // add entry to 'plugins' table
    }
    return true;
}
开发者ID:alxstuart,项目名称:ajfs.me,代码行数:43,代码来源:mysql_1.3.9_to_1.3.10.php

示例7: plugin_install_dataproxy

/**
* Puts the datastructures for this plugin into the Geeklog database
*
* Note: Corresponding uninstall routine is in functions.inc
* 
* @return   boolean True if successful False otherwise
*/
function plugin_install_dataproxy()
{
    global $pi_name, $pi_version, $gl_version, $pi_url, $NEWTABLE, $DEFVALUES, $NEWFEATURE, $_TABLES, $_CONF;
    COM_errorLog("Attempting to install the {$pi_name} Plugin", 1);
    // Create the Plugins Tables
    foreach ($NEWTABLE as $table => $sql) {
        COM_errorLog("Creating {$table} table", 1);
        DB_query($sql, 1);
        if (DB_error()) {
            COM_errorLog("Error Creating {$table} table", 1);
            plugin_uninstall_dataproxy();
            return false;
        }
        COM_errorLog("Success - Created {$table} table", 1);
    }
    // Insert Default Data
    foreach ($DEFVALUES as $table => $sqls) {
        COM_errorLog("Inserting default data into {$table} table", 1);
        foreach ($sqls as $sql) {
            DB_query($sql, 1);
            if (DB_error()) {
                COM_errorLog("Error inserting default data into {$table} table", 1);
                plugin_uninstall_dataproxy();
                return false;
            }
        }
        COM_errorLog("Success - inserting data into {$table} table", 1);
    }
    // Create the plugin admin security group
    COM_errorLog("Attempting to create {$pi_name} admin group", 1);
    DB_query("INSERT INTO {$_TABLES['groups']} (grp_name, grp_descr) " . "VALUES ('{$pi_name} Admin', 'Users in this group can administer the {$pi_name} plugin')", 1);
    if (DB_error()) {
        plugin_uninstall_dataproxy();
        return false;
    }
    COM_errorLog('...success', 1);
    $group_id = DB_insertId();
    // Save the grp id for later uninstall
    COM_errorLog('About to save group_id to vars table for use during uninstall', 1);
    DB_query("INSERT INTO {$_TABLES['vars']} VALUES ('{$pi_name}_gid', '{$group_id}')", 1);
    if (DB_error()) {
        plugin_uninstall_dataproxy();
        return false;
    }
    COM_errorLog('...success', 1);
    // Add plugin Features
    foreach ($NEWFEATURE as $feature => $desc) {
        COM_errorLog("Adding {$feature} feature", 1);
        DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr) " . "VALUES ('{$feature}','{$desc}')", 1);
        if (DB_error()) {
            COM_errorLog("Failure adding {$feature} feature", 1);
            plugin_uninstall_dataproxy();
            return false;
        }
        $feat_id = DB_insertId();
        COM_errorLog('Success', 1);
        COM_errorLog("Adding {$feature} feature to admin group", 1);
        DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ('{$feat_id}', '{$group_id}')");
        if (DB_error()) {
            COM_errorLog("Failure adding {$feature} feature to admin group", 1);
            plugin_uninstall_dataproxy();
            return false;
        }
        COM_errorLog("Success", 1);
    }
    /**
     * OK, now give Root users access to this plugin now!
     * NOTE: Root group should always be 1
     */
    COM_errorLog("Attempting to give all users in Root group access to {$pi_name} admin group", 1);
    DB_query("INSERT INTO {$_TABLES['group_assignments']} VALUES ('{$group_id}', NULL, 1)");
    if (DB_error()) {
        plugin_uninstall_dataproxy();
        return false;
    }
    // Register the plugin with Geeklog
    COM_errorLog("Registering {$pi_name} plugin with Geeklog", 1);
    DB_delete($_TABLES['plugins'], 'pi_name', 'dataproxy');
    DB_query("INSERT INTO {$_TABLES['plugins']} (pi_name, pi_version, pi_gl_version, pi_homepage, pi_enabled) " . "VALUES ('{$pi_name}', '{$pi_version}', '{$gl_version}', '{$pi_url}', 1)");
    if (DB_error()) {
        plugin_uninstall_dataproxy();
        return false;
    }
    COM_errorLog("Succesfully installed the {$pi_name} Plugin!", 1);
    return true;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:93,代码来源:install.php

示例8: plugin_postinstall_tag

/**
* Adds PHP blocks and scans all the items supported by the Tag plugin
*/
function plugin_postinstall_tag($pi_name)
{
    global $_CONF, $_TABLES, $_USER, $_TAG_CONF, $LANG_TAG;
    require_once dirname(__FILE__) . '/functions.inc';
    if (is_callable('COM_createHTMLDocument')) {
        // Adds a tag cloud block to the site
        $sql = "INSERT INTO {$_TABLES['blocks']} " . "  (is_enabled, name, type, title, blockorder, onleft, " . "  phpblockfn, owner_id, group_id, perm_owner, perm_group, " . "  perm_members, perm_anon) " . "VALUES (1, '" . addslashes($_TAG_CONF['default_block_name']) . "', 'phpblock', '" . addslashes($LANG_TAG['default_block_title']) . "', 1, 0, 'phpblock_tag_cloud', '" . addslashes($_USER['uid']) . "', 1, 3, 3, 2, 2)";
        DB_query($sql);
        $bid = DB_insertId();
        $sql = "INSERT INTO {$_TABLES['topic_assignments']} " . "  (tid, type, id, inherit, tdefault) " . "VALUES ('all', 'block', {$bid}, 1, 0) ";
        DB_query($sql);
        // Adds a tag menu block to the site
        $sql = "INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, " . "  blockorder, onleft, phpblockfn, owner_id, group_id, " . "  perm_owner, perm_group, perm_members, perm_anon) " . "VALUES (1, '" . addslashes($_TAG_CONF['default_block_name_menu']) . "', 'phpblock', '" . addslashes($LANG_TAG['default_block_title_menu']) . "', 1, 1, 'phpblock_tag_menu', '" . addslashes($_USER['uid']) . "', 1, 3, 3, 2, 2)";
        DB_query($sql);
        $bid = DB_insertId();
        $sql = "INSERT INTO {$_TABLES['topic_assignments']} " . "  (tid, type, id, inherit, tdefault) " . "VALUES ('all', 'block', {$bid}, 1, 0) ";
        DB_query($sql);
    } else {
        // Adds a tag cloud block to the site
        $sql = "INSERT INTO {$_TABLES['blocks']} " . "  (is_enabled, name, type, title, tid, blockorder, onleft, " . "  phpblockfn, owner_id, group_id, perm_owner, perm_group, " . "  perm_members, perm_anon) " . "VALUES (1, '" . addslashes($_TAG_CONF['default_block_name']) . "', 'phpblock', '" . addslashes($LANG_TAG['default_block_title']) . "', 'all', '1', '0', 'phpblock_tag_cloud', '" . addslashes($_USER['uid']) . "', '1', '3', '3', '2', '2')";
        DB_query($sql);
        // Adds a tag menu block to the site
        $sql = "INSERT INTO {$_TABLES['blocks']} (is_enabled, name, type, title, " . "  tid, blockorder, onleft, phpblockfn, owner_id, group_id, " . "  perm_owner, perm_group, perm_members, perm_anon) " . "VALUES ('1', '" . addslashes($_TAG_CONF['default_block_name_menu']) . "', 'phpblock', '" . addslashes($LANG_TAG['default_block_title_menu']) . "', 'all', '1', '1', 'phpblock_tag_menu', '" . addslashes($_USER['uid']) . "', '1', '3', '3', '2', '2')";
        DB_query($sql);
    }
    // Scans all contents for tags
    TAG_scanAll();
    return TRUE;
}
开发者ID:MikeDevue,项目名称:plugin-tag,代码行数:32,代码来源:autoinstall.php

示例9: SaveCategory

 /**
  *   Save a new category submitted with the event.
  *   Returns the ID of the newly-added category, or of the existing
  *   catgory if $cat_name is a duplicate.
  *
  *   @param  string  $cat_name   New category name.
  *   @return integer     ID of category
  */
 public function SaveCategory($cat_name)
 {
     global $_TABLES;
     $cat_name = DB_escapeString($cat_name);
     // Make sure it's not a duplicate name.  While we're at it, get
     // the category ID to return.
     $id = DB_getItem($_TABLES['evlist_categories'], 'id', "name='{$cat_name}'");
     if (!$id) {
         DB_query("INSERT INTO {$_TABLES['evlist_categories']}\n                    (name, status)\n                VALUES\n                    ('{$cat_name}', 1)");
         if (!DB_error()) {
             $id = DB_insertId();
         }
     }
     return $id;
 }
开发者ID:NewRoute,项目名称:evlist,代码行数:23,代码来源:evEvent.class.php

示例10: strlen

     $charset = "abcdefghijklmnopqrstuvwxyz";
     for ($i = 0; $i < 12; $i++) {
         $random_name .= $charset[mt_rand(0, strlen($charset) - 1)];
     }
     $random_name .= '.' . $fileExtension;
     if (fm_uploadfile($directory, $random_name)) {
         if (!get_magic_quotes_gpc()) {
             $uploadfilename = addslashes($uploadfilename);
         }
         // Status of file record will default to 0 -- not online
         $sql = "INSERT INTO {$_TABLES['nxfile_filesubmissions']} ";
         $sql .= "(cid,fname,tempname,title,ftype,description,version_note,size,mimetype,extension,submitter,date,tags) ";
         $sql .= "VALUES ({$_CLEAN['cid']},'{$uploadfilename}','{$random_name}','{$_CLEAN['filetitle']}','file',";
         $sql .= "'{$_CLEAN['description']}','{$_CLEAN['vernote']}','{$filesize}','{$mimetype}','{$fileExtension}','{$uid}','{$date}','{$_CLEAN['tags']}')";
         DB_query($sql);
         $sid = DB_insertId();
         PLG_itemSaved($sid, 'nexfile_filesubmission');
         // Determine if any users that have upload.admin permission for this category
         // or nexfile admin rights should be notified of new file awaiting approval
         fm_sendAdminApprovalNofications($cid, $sid);
         fm_updateAuditLog("New upload submission, in Category: {$cid}");
         $data['message'] = "File successfully uploaded and you will be notified once it's approved";
         $data['error'] = 'File successfully uploaded';
         $data['retcode'] = 200;
     }
 } else {
     $data['retcode'] = 400;
     $data['error'] = 'Error: You do not have upload permission for that folder';
 }
 $retval = json_encode($data);
 break;
开发者ID:hostellerie,项目名称:nexpro,代码行数:31,代码来源:server.php

示例11: INSTALLER_install_block

 function INSTALLER_install_block($step, &$vars)
 {
     global $_TABLES, $_CONF, $_USER;
     COM_errorLog("AutoInstall: Creating block {$step['name']}...");
     $is_enabled = isset($step['is_enabled']) ? intval($step['is_enabled']) : 1;
     $rdflimit = isset($step['rdflimit']) ? intval($step['rdflimit']) : 0;
     $onleft = isset($step['onleft']) ? intval($step['onleft']) : 0;
     $allow_autotags = isset($step['allow_autotags']) ? intval($step['allow_autotags']) : 0;
     $name = isset($step['name']) ? DB_escapeString($step['name']) : '';
     $title = isset($step['title']) ? DB_escapeString($step['title']) : '';
     $type = isset($step['block_type']) ? DB_escapeString($step['block_type']) : 'unknown';
     $phpblockfn = isset($step['phpblockfn']) ? DB_escapeString($step['phpblockfn']) : '';
     $help = isset($step['help']) ? DB_escapeString($step['help']) : '';
     $content = isset($step['content']) ? DB_escapeString($step['content']) : '';
     $blockorder = isset($step['blockorder']) ? intval($step['blockorder']) : 9999;
     $owner_id = isset($_USER['uid']) ? $_USER['uid'] : 2;
     $group_id = isset($vars[$step['group_id']]) ? $vars[$step['group_id']] : 1;
     list($perm_owner, $perm_group, $perm_members, $perm_anon) = $_CONF['default_permissions_block'];
     DB_query("INSERT INTO {$_TABLES['blocks']} " . "(is_enabled,name,type,title,tid,blockorder,content,allow_autotags,rdflimit,onleft,phpblockfn,help,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon)" . " VALUES ({$is_enabled},'{$name}','{$type}','{$title}','all',{$blockorder},'{$content}',{$allow_autotags},{$rdflimit},{$onleft},'{$phpblockfn}','{$help}',{$owner_id},{$group_id},{$perm_owner},{$perm_group},{$perm_members},{$perm_anon})", 1);
     if (DB_error()) {
         COM_errorLog("AutoInstall: Block creation failed!");
         return 1;
     }
     $bid = DB_insertId();
     if (isset($step['variable'])) {
         $vars[$step['variable']] = $bid;
     }
     return "DELETE FROM {$_TABLES['blocks']} WHERE bid = {$bid}";
 }
开发者ID:NewRoute,项目名称:glfusion,代码行数:29,代码来源:lib-install.php

示例12: evlist_upgrade_1_3_0

/**
*   Upgrade to version 1.3.0
*   Many changes in this version, so a function was created to
*   hold them all.
*
*   @return boolean     True on success, False on failure
*/
function evlist_upgrade_1_3_0()
{
    global $_CONF, $_EV_CONF, $_TABLES, $_DB_dbms, $c, $CONF_EVLIST_DEFAULT;
    USES_evlist_class_event();
    $c->add('default_view', $CONF_EVLIST_DEFAULT['default_view'], 'select', 0, 1, 14, 90, true, 'evlist');
    $c->add('max_upcoming_days', $CONF_EVLIST_DEFAULT['max_upcoming_days'], 'text', 0, 1, 0, 100, true, 'evlist');
    // Combine users allowed to add events into one variable
    $can_add = 0;
    if ($EV_CONF['allow_anon_add'] > 0) {
        $can_add += EV_ANON_CAN_ADD;
    }
    if ($EV_CONF['allow_user_add'] > 0) {
        $can_add += EV_USER_CAN_ADD;
    }
    $c->add('can_add', $can_add, 'select', 0, 1, 15, 20, true, 'evlist');
    $c->del('allow_user_add', 'evlist');
    $c->del('allow_anon_add', 'evlist');
    // Add new options for plugin integration
    $c->add('use_locator', $CONF_EVLIST_DEFAULT['use_locator'], 'select', 0, 1, 0, 110, true, 'evlist');
    $c->add('use_weather', $CONF_EVLIST_DEFAULT['use_weather'], 'select', 0, 1, 0, 120, true, 'evlist');
    // Date & Time formats moved from the DB to simple $_CONF  variables
    $format = DB_getItem($_TABLES['evlist_dateformat'], 'format', "id='{$_EV_CONF['date_format']}'");
    if (empty($format)) {
        $format = '%a %b %d, %Y';
    }
    $c->set_default('date_format', $format, 'evlist');
    $c->set('date_format', $format, 'evlist');
    $format = DB_getItem($_TABLES['evlist_timeformat'], 'format', "id='{$_EV_CONF['date_format']}'");
    if (empty($format)) {
        $format = '%I:%M %p';
    }
    $c->set_default('time_format', $format, 'evlist');
    $c->set('time_format', $format, 'evlist');
    DB_query("DROP TABLE {$_TABLES['evlist_dateformat']}");
    DB_query("DROP TABLE {$_TABLES['evlist_timeformat']}");
    // Change feature name
    DB_query("UPDATE {$_TABLES['features']}\n                SET ft_name='evlist.admin' WHERE ft_name='evlist.edit'");
    // Add new "submit" feature & map to Root group
    DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr)\n            VALUES ('evlist.submit', \n                    'Allowed to bypass the evList submission queue')", 1);
    if (!DB_error()) {
        $ft_id = (int) DB_insertId();
        if ($ft_id > 0) {
            DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id)\n                    VALUES('{$ft_id}', '1')");
        }
    }
    EVLIST_do_upgrade_sql('1.3.0');
    // Add the new fields to the event & submission tables
    /*$new_sql = "ADD det_id int(10) NOT NULL,
              ADD show_upcoming tinyint(1) unsigned NOT NULL DEFAULT '1',
              ADD cal_id int(10) unsigned NOT NULL DEFAULT '1',
              ADD options varchar(255)";
      DB_query("ALTER TABLE {$_TABLES['evlist_events']} $new_sql");
      DB_query("ALTER TABLE {$_TABLES['evlist_submissions']} $new_sql");*/
    // Create the new tables
    /*DB_query($_SQL['evlist_repeat']);
      DB_query($_SQL['evlist_calendars']);
      DB_query($_SQL['evlist_detail']);
      DB_query($DEFVALUES['evlist_calendars']);*/
    // Now split out the detail and create the repeats
    $result = DB_query("SELECT * FROM {$_TABLES['evlist_events']}");
    $error = 0;
    while ($A = DB_fetchArray($result, false)) {
        $A = array_map('DB_escapeString', $A);
        $sql = "INSERT INTO {$_TABLES['evlist_detail']} (\n                    ev_id, title, summary, full_description, url, location,\n                    street, city, province, country, postal, contact,\n                    email, phone\n                ) VALUES (\n                    '{$A['id']}', '{$A['title']}', '{$A['summary']}', \n                    '{$A['full_description']}', '{$A['url']}',\n                    '{$A['location']}', '{$A['street']}',\n                    '{$A['city']}', '{$A['province']}',\n                    '{$A['country']}', '{$A['postal']}',\n                    '{$A['contact']}', '{$A['email']}','{$A['phone']}'\n                )";
        DB_query($sql, 1);
        if (DB_error()) {
            $error = 1;
            break;
        } else {
            $DB_det_id = DB_insertID();
        }
        $rec_data = array();
        if ($A['recurring'] == 1) {
            $rec_data['type'] = $A['rec_option'];
            switch ($A['rec_option']) {
                case EV_RECUR_DAILY:
                case EV_RECUR_MONTHLY:
                case EV_RECUR_YEARLY:
                    list($stop, $skip) = explode(';', $A['rec_data']);
                    if (!empty($skip)) {
                        $rec_data['skip'] = (int) $skip;
                    }
                    break;
                case EV_RECUR_WEEKLY:
                    list($listdays, $stop) = explode(';', $A['rec_data']);
                    $rec_data['listdays'] = explode(',', $listdays);
                    break;
                case EV_RECUR_DOM:
                    list($interval, $weekday, $stop) = explode(';', $A['rec_data']);
                    $rec_data['weekday'] = $weekday;
                    $rec_data['interval'] = $interval;
                    break;
                case EV_RECUR_DATES:
//.........这里部分代码省略.........
开发者ID:NewRoute,项目名称:evlist,代码行数:101,代码来源:upgrade.php

示例13: 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('&#36;', '&#123;', '&#126;'), $title);
    $excerpt = str_replace(array('$', '{', '}'), array('&#36;', '&#123;', '&#126;'), $excerpt);
    $blog = str_replace(array('$', '{', '}'), array('&#36;', '&#123;', '&#126;'), $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;
}
开发者ID:milk54,项目名称:geeklog-japan,代码行数:53,代码来源:lib-trackback.php

示例14: Save

 /**
  *   Insert or update a calendar.
  *
  *   @param array    $A  Array of data to save, typically from form
  */
 public function Save($A = array())
 {
     global $_TABLES, $_EV_CONF;
     if (is_array($A) && !empty($A)) {
         $this->SetVars($A);
     }
     if ($this->cat_id > 0) {
         $this->isNew = false;
     } else {
         $this->isNew = true;
     }
     $fld_sql = "name = '" . DB_escapeString($this->cat_name) . "',\n            status = '{$this->cat_status}'";
     if ($this->isNew) {
         $sql = "INSERT INTO {$_TABLES['evlist_categories']} SET \n                    {$fld_sql}";
     } else {
         $sql = "UPDATE {$_TABLES['evlist_categories']} SET \n                    {$fld_sql}\n                    WHERE id='{$this->cat_id}'";
     }
     //echo $sql;die;
     DB_query($sql, 1);
     if (!DB_error()) {
         if ($this->isNew) {
             $this->cat_id = DB_insertId();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:NewRoute,项目名称:evlist,代码行数:33,代码来源:evCategory.class.php

示例15: INST_doDatabaseUpgrades


//.........这里部分代码省略.........
            $session_ip_check = 1;
            if (isset($_SYSTEM['skip_ip_check']) && $_SYSTEM['skip_ip_check'] == 1) {
                $session_ip_check = 0;
            }
            $c->add('session_ip_check', $session_ip_check, 'select', 7, 30, 26, 545, TRUE);
            $c->del('default_search_order', 'Core');
            DB_query("UPDATE {$_TABLES['conf_values']} SET selectionArray = '0' WHERE  name='searchloginrequired' AND group_name='Core'");
            DB_query("ALTER TABLE {$_TABLES['groups']} ADD grp_default tinyint(1) unsigned NOT NULL default '0' AFTER grp_gl_core");
            DB_query("ALTER TABLE {$_TABLES['users']} CHANGE `passwd` `passwd` VARCHAR( 40 ) NOT NULL default ''");
            // clean up group names and assign proper admin setting
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='Bad Behavior2 Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_name='calendar Admin' WHERE grp_name='Calendar Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='calendar Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='filemgmt Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='forum Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_name='links Admin' WHERE grp_name='Links Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='links Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='mediagallery Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_name='polls Admin' WHERE grp_name='Polls Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='polls Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='sitetailor Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_name='staticpages Admin' WHERE grp_name='Static Page Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='staticpages Admin'", 1);
            DB_query("UPDATE {$_TABLES['groups']} SET grp_gl_core=2 WHERE grp_name='spamx Admin'", 1);
            // move multi-language support to its own fieldset
            DB_query("INSERT INTO {$_TABLES['conf_values']} (name,value,type,group_name,default_value,subgroup,selectionArray,sort_order,fieldset) VALUES ('fs_mulitlanguage','N;','fieldset','Core','N;',6,-1,0,41)", 1);
            DB_query("UPDATE {$_TABLES['conf_values']} SET fieldset='41' WHERE name='language_files' AND group_name='Core'", 1);
            DB_query("UPDATE {$_TABLES['conf_values']} SET fieldset='41' WHERE name='languages' AND group_name='Core'", 1);
            // topic sort
            DB_query("ALTER TABLE {$_TABLES['topics']} ADD sort_by TINYINT(1) NOT NULL DEFAULT '0' AFTER archive_flag", 1);
            DB_query("ALTER TABLE {$_TABLES['topics']} ADD sort_dir CHAR( 4 ) NOT NULL DEFAULT 'DESC' AFTER sort_by", 1);
            // new stats.view permission
            DB_query("INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('stats.view','Allows access to the Stats page.',0)", 1);
            $ft_id = DB_insertId();
            $all_grp_id = intval(DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'All Users'"));
            $loggedin_grp_id = intval(DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Logged-in Users'"));
            $root_grp_id = intval(DB_getItem($_TABLES['groups'], 'grp_id', "grp_name = 'Root'"));
            if ($_CONF['statsloginrequired'] || $_CONF['loginrequired']) {
                DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$loggedin_grp_id})", 1);
            } else {
                DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$all_grp_id})", 1);
            }
            DB_query("INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ({$ft_id}, {$root_grp_id})", 1);
            $c->del('statsloginrequired', 'Core');
            $c->add('registration_type', 0, 'select', 4, 19, 27, 785, TRUE, 'Core');
            DB_query("ALTER TABLE {$_TABLES['users']} ADD act_token VARCHAR(32) NOT NULL DEFAULT '' AFTER pwrequestid", 1);
            DB_query("ALTER TABLE {$_TABLES['users']} ADD act_time DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER act_token", 1);
            $c->del('cookie_ip', 'Core');
            DB_query("ALTER TABLE {$_TABLES['sessions']} DROP PRIMARY KEY", 1);
            DB_query("ALTER TABLE {$_TABLES['sessions']} ADD PRIMARY KEY (md5_sess_id)", 1);
            $c->add('comment_postmode', 'plaintext', 'select', 4, 21, 5, 1693, TRUE);
            $c->add('comment_editor', 0, 'select', 4, 21, 28, 1694, TRUE);
            DB_query("INSERT INTO {$_TABLES['vars']} SET value='1.2.0',name='glfusion'", 1);
            DB_query("UPDATE {$_TABLES['vars']} SET value='1.2.0' WHERE name='glfusion'", 1);
            DB_query("DELETE FROM {$_TABLES['vars']} WHERE name='database_version'", 1);
            $current_fusion_version = '1.2.0';
        case '1.2.0':
            DB_query("INSERT INTO {$_TABLES['vars']} SET value='1.2.1',name='glfusion'", 1);
            DB_query("UPDATE {$_TABLES['vars']} SET value='1.2.1' WHERE name='glfusion'", 1);
            DB_query("DELETE FROM {$_TABLES['vars']} WHERE name='database_version'", 1);
            $current_fusion_version = '1.2.1';
        case '1.2.1':
        case '1.2.2':
        case '1.2.3':
            require_once $_CONF['path'] . 'sql/updates/mysql_1.2.2_to_1.3.0.php';
            list($rc, $errors) = INST_updateDB($_SQL);
开发者ID:JohnToro,项目名称:glfusion,代码行数:67,代码来源:install.lib.php


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