예제 #1
0
 public function SetThreadId($threadid)
 {
     if ($this->vbulletin->options['dle_onoff'] && $this->vbulletin->options['dle_discussion']) {
         $this->vbulletin->input->clean_gpc('p', 'news_id', TYPE_UINT);
         if ($this->vbulletin->GPC['news_id']) {
             $this->_db_connect();
             $this->db->query_write("UPDATE " . PREFIX . "_post SET vb_threadid={$threadid} WHERE id=" . $this->vbulletin->GPC['news_id']);
             $this->_db_disconnect();
         }
     }
 }
 /**
  * Disable a product, not delete
  *
  */
 public function disable($productid = null)
 {
     $productid = $productid ? $productid : $this->productinfo['productid'];
     $this->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "product\n\t\t\tSET active = 0\n\t\t\tWHERE productid = '" . $this->db->escape_string($productid) . "'\n\t\t");
     build_product_datastore();
     // build bitfields to remove/add this products bitfields
     require_once DIR . '/includes/class_bitfield_builder.php';
     vB_Bitfield_Builder::save($this->db);
     // Products can enable a cron entries, so we need to rebuild that as well
     require_once DIR . '/includes/functions_cron.php';
     build_cron_next_run();
     // Purge cache -- doesn't apply to pre-vB4 versions
     if (class_exists('vB_Cache')) {
         vB_Cache::instance()->purge('vb_types.types');
     }
     // Reload blocks and block types -- doesn't apply to pre-vB4 versions
     if (class_exists('vB_BlockManager')) {
         $blockmanager = vB_BlockManager::create($this->registry);
         $blockmanager->reloadBlockTypes();
         $blockmanager->getBlocks(true, true);
     }
 }
예제 #3
0
파일: class_dm.php 프로젝트: holandacz/nb4
 /**
  * Executes the necessary query/queries to update the records
  *
  * @param	boolean	Actually perform the query?
  */
 function execute_query($doquery = true)
 {
     $condition = $this->primary_id . ' IN (' . implode(',', $this->primary_ids) . ')';
     $master =& $this->children[reset($this->primary_ids)];
     $sql = $master->fetch_update_sql(TABLE_PREFIX, $master->table, $condition);
     if ($doquery) {
         if ($sql) {
             $this->dbobject->query_write($sql);
         }
     } else {
         echo "<pre>{$sql}<hr /></pre>";
     }
 }
예제 #4
0
 /**
  * Updates this user's CSS cache.
  *
  * @return	string	Compiled CSS
  */
 function update_css_cache()
 {
     $buildcss = $this->build_css();
     $this->dbobject->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "usercsscache\n\t\t\t\t(userid, cachedcss, buildpermissions)\n\t\t\tVALUES\n\t\t\t\t(" . $this->userid . ", '" . $this->dbobject->escape_string($buildcss) . "', " . intval($this->permissions['usercsspermissions']) . ")\n\t\t");
     return $buildcss;
 }
예제 #5
0
 /**
  * Executes the specified modifications.
  *
  * @param	boolean	Whether to close the list tags at the end of exeuction
  */
 function execute($close_list = true)
 {
     if (!$this->inside_list) {
         echo "<ul>\n";
         $this->inside_list = true;
     }
     foreach ($this->modifications as $modification) {
         if (!empty($modification['message'])) {
             echo "\t<li>{$modification['message']}</li>\n";
         }
         $data =& $modification['data'];
         if (!empty($modification['alter'])) {
             $db_alter =& $this->setup_db_alter_class($data['table']);
         } else {
             unset($db_alter);
         }
         $alter_result = null;
         switch ($modification['modification_type']) {
             case 'add_field':
                 $alter_result = $db_alter->add_field($data);
                 break;
             case 'drop_field':
                 $alter_result = $db_alter->drop_field($data['name']);
                 break;
             case 'add_index':
                 $alter_result = $db_alter->add_index($data['name'], $data['fields'], $data['type']);
                 break;
             case 'drop_index':
                 $alter_result = $db_alter->drop_index($data['name']);
                 break;
             case 'run_query':
                 $error_state = $this->db->reporterror;
                 if ($error_state) {
                     $this->db->hide_errors();
                 }
                 $query_result = $this->db->query_write($data['query']);
                 if ($errno = $this->db->errno()) {
                     if (!in_array($errno, $data['ignorable_errors'])) {
                         echo "</ul>";
                         $this->db->show_errors();
                         $this->db->sql = $data['query'];
                         $this->db->halt();
                     } else {
                         // error occurred, but was ignorable
                         $this->db->errno = 0;
                     }
                 }
                 if ($error_state) {
                     $this->db->show_errors();
                 }
                 break;
             case 'show_message':
                 // do nothing -- just show the message
                 break;
             case 'debug_break':
                 echo "</ul><div>Debug break point. Stopping execution.</div>";
                 exit;
             default:
                 trigger_error("<strong>vB_UpgradeQueries</strong>: Invalid modification type '{$modification['modification_type']}' specified.", E_USER_ERROR);
         }
         if ($alter_result === false) {
             if ($db_alter->error_no == ERRDB_MYSQL) {
                 echo "</ul>";
                 $this->db->show_errors();
                 $this->db->sql = $db_alter->sql;
                 $this->db->connection_recent = null;
                 $this->db->error = $db_alter->error_desc;
                 $this->db->errno = -1;
                 $this->db->halt();
             } else {
                 if (ob_start()) {
                     print_r($modification);
                     $results = ob_get_contents();
                     ob_end_clean();
                 } else {
                     $results = serialize($modification);
                 }
                 echo "\t\t<!-- {$results}\n\t\t" . "Error information: " . $db_alter->error_no . " / " . htmlspecialchars($db_alter->error_desc) . " -->\n\n";
             }
         }
     }
     if ($close_list) {
         echo "</ul>\n";
         $this->inside_list = false;
     }
     $this->modifications = array();
 }
예제 #6
0
 /**
  * Log the current location of the upgrade
  *
  * @param	string	Upgrade Step
  * @param	int			Startat value for multi step steps
  * @param	bool		Process only the current version upgrade
  */
 public function log_upgrade_step($step, $startat = 0, $only = false)
 {
     $complete = $step == $this->stepcount;
     $perpage = 0;
     $insertstep = true;
     if ($complete) {
         $step = 0;
         if ($this->SHORT_VERSION == 'final' or $only) {
             $this->db->query_write("\n\t\t\t\t\tDELETE FROM " . TABLE_PREFIX . "upgradelog\n\t\t\t\t\tWHERE script IN ('final', 'vbblog', 'vbcms', 'skimlinks', 'forumrunner', 'postrelease')\n\t\t\t\t");
             $insertstep = false;
         } else {
             if (is_newer_version($this->LONG_VERSION, $this->registry->options['templateversion'])) {
                 $this->db->query_write("UPDATE " . TABLE_PREFIX . "setting SET value = '" . $this->LONG_VERSION . "' WHERE varname = 'templateversion'");
             }
             if (!defined('SKIPDB')) {
                 build_options();
             }
             $this->registry->options['templateversion'] = $this->LONG_VERSION;
         }
     }
     if ($insertstep and !defined('SKIPDB')) {
         // use time() not TIMENOW to actually time the script's execution
         /*insert query*/
         $this->db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "upgradelog(script, steptitle, step, startat, perpage, dateline, only)\n\t\t\t\tVALUES (\n\t\t\t\t\t'" . $this->db->escape_string($this->SHORT_VERSION) . "',\n\t\t\t\t\t'',\n\t\t\t\t\t{$step},\n\t\t\t\t\t{$startat},\n\t\t\t\t\t{$perpage},\n\t\t\t\t\t" . time() . ",\n\t\t\t\t\t" . intval($only) . "\n\t\t\t)");
     }
 }
예제 #7
0
 function replacePerms($params, vB_Database $db, $check_only = false)
 {
     if ($check_only) {
         return !empty($params['fields']);
     }
     $sql = "REPLACE INTO " . TABLE_PREFIX . "attachmentpermission\n\t\t\t\t\t\t(extension, usergroupid, size, width, height, attachmentpermissions)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(',', $params['fields']);
     $config = vB::getConfig();
     if (isset($config['Misc']['debug_sql']) and $config['Misc']['debug_sql']) {
         echo "sql: {$sql}<br />\n";
     }
     $db->query_write($sql);
 }