本文整理汇总了PHP中fetch_product_list函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_product_list函数的具体用法?PHP fetch_product_list怎么用?PHP fetch_product_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_product_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSetting
/**
* This function updates specified settings
* @param array $values
* 'varname' => $vbulletin->GPC['varname'],
* 'grouptitle' => $vbulletin->GPC['grouptitle'],
* 'optioncode' => $vbulletin->GPC['optioncode'],
* 'defaultvalue' => $vbulletin->GPC['defaultvalue'],
* 'displayorder' => $vbulletin->GPC['displayorder'],
* 'volatile' => $vbulletin->GPC['volatile'],
* 'datatype' => $vbulletin->GPC['datatype'],
* 'validationcode' => $vbulletin->GPC['validationcode'],
* 'product' => $vbulletin->GPC['product'],
* 'blacklist' => $vbulletin->GPC['blacklist'],
* 'title' => $vbulletin->GPC['title'],
* 'username' => $vbulletin->userinfo['username'],
* 'description' => $vbulletin->GPC['description']
* @return array, $response
*/
public function updateSetting($values)
{
require_once DIR . '/includes/class_xml.php';
require_once DIR . '/includes/functions_file.php';
require_once DIR . '/includes/adminfunctions_options.php';
require_once DIR . '/includes/adminfunctions.php';
$response = array();
$langid = $values['volatile'] ? -1 : 0;
if (defined('DEV_AUTOEXPORT') and DEV_AUTOEXPORT) {
$old_setting = vB::getDbAssertor()->getRow('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'varname' => $values['varname']));
}
vB::getDbAssertor()->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'grouptitle' => $values['grouptitle'], 'optioncode' => $values['optioncode'], 'defaultvalue' => $values['defaultvalue'], 'displayorder' => $values['displayorder'], 'volatile' => $values['volatile'], 'datatype' => $values['datatype'], 'validationcode' => $values['validationcode'], 'product' => $values['product'], 'blacklist' => $values['blacklist'], 'ispublic' => $values['ispublic'], 'adminperm' => isset($values['adminperm']) ? $values['adminperm'] : '', vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => $values['varname'], 'operator' => vB_dB_Query::OPERATOR_EQ))));
$phrases = vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'languageid' => array(-1, 0), 'fieldname' => 'vbsettings', 'varname' => array("setting_" . $values['varname'] . "_title", "setting_" . $values['varname'] . "_desc")));
$full_product_info = fetch_product_list(true);
$product_version = $full_product_info[$values['product']]['version'];
if ($phrases and $phrases->valid()) {
foreach ($phrases as $phrase) {
if ($phrase['varname'] == "setting_" . $values['varname'] . "_title") {
vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'languageid' => $langid, 'text' => $values['title'], 'product' => $values['product'], 'username' => $values['username'], 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'languageid', 'value' => $phrase['languageid'], 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'varname', 'value' => "setting_" . $values['varname'] . "_title", 'operator' => vB_dB_Query::OPERATOR_EQ))));
} else {
if ($phrase['varname'] == "setting_" . $values['varname'] . "_desc") {
vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'languageid' => $langid, 'text' => $values['description'], 'product' => $values['product'], 'username' => $values['username'], 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'languageid', 'value' => $phrase['languageid'], 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'varname', 'value' => "setting_" . $values['varname'] . "_desc", 'operator' => vB_dB_Query::OPERATOR_EQ))));
}
}
}
}
vB::getDatastore()->build_options();
$response['update'] = true;
return $response;
}
示例2: install_product
/**
* Installs a product from the xml text
*
* This function depends on the vb class loader, which requires that the
* framework init is called.
*
* @return bool True if the product requires a template merge, false otherwise
*/
function install_product($xml, $allow_overwrite)
{
global $vbphrase;
global $vbulletin;
global $db;
require_once(DIR . '/includes/class_bitfield_builder.php');
require_once(DIR . '/includes/class_xml.php');
require_once(DIR . '/includes/class_block.php');
//share some code with the main xml style import
require_once(DIR . '/includes/adminfunctions_template.php');
print_dots_start('<b>' . $vbphrase['importing_product'] . "</b>, $vbphrase[please_wait]", ':', 'dspan');
$xmlobj = new vB_XML_Parser($xml);
if ($xmlobj->error_no == 1)
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage('no_xml_and_no_path');
}
if(!$arr = $xmlobj->parse())
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(
array('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line()));
}
// ############## general product information
$info = array(
'productid' => substr(preg_replace('#[^a-z0-9_]#', '', strtolower($arr['productid'])), 0, 25),
'title' => $arr['title'],
'description' => $arr['description'],
'version' => $arr['version'],
'active' => $arr['active'],
'url' => $arr['url'],
'versioncheckurl' => $arr['versioncheckurl']
);
if (!$info['productid'])
{
print_dots_stop();
if (!empty($arr['plugin']))
{
throw new vB_Exception_AdminStopMessage('this_file_appears_to_be_a_plugin');
}
else
{
throw new vB_Exception_AdminStopMessage('invalid_file_specified');
}
}
if (strtolower($info['productid']) == 'vbulletin')
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', 'vBulletin'));
}
// check for bitfield conflicts on install
$bitfields = vB_Bitfield_Builder::return_data();
if (!$bitfields)
{
$bfobj =& vB_Bitfield_Builder::init();
if ($bfobj->errors)
{
print_dots_stop();
throw new vB_Exception_AdminStopMessage(array(
'bitfield_conflicts_x',
'<li>' . implode('</li><li>', $bfobj->errors) . '</li>'
));
}
}
// get system version info
$system_versions = array(
'php' => PHP_VERSION,
'vbulletin' => $vbulletin->options['templateversion'],
'products' => fetch_product_list(true)
);
$mysql_version = $db->query_first("SELECT VERSION() AS version");
$system_versions['mysql'] = $mysql_version['version'];
// ############## import dependencies
if (is_array($arr['dependencies']['dependency']))
{
$dependencies =& $arr['dependencies']['dependency'];
if (!isset($dependencies[0]))
{
$dependencies = array($dependencies);
}
//.........这里部分代码省略.........
示例3: post_install
//.........这里部分代码省略.........
$sql = array();
foreach ($faq_entries as $faq) {
$sql[] = "\n\t\t\t\t\t('" . $this->db->escape_string($faq['faqname']) . "',\n\t\t\t\t\t'" . $this->db->escape_string($faq['faqparent']) . "',\n\t\t\t\t\t" . intval($faq['displayorder']) . ",\n\t\t\t\t\t1,\n\t\t\t\t\t'" . $this->db->escape_string($this->productinfo['productid']) . "')\n\t\t\t\t";
}
if ($sql) {
/*insert query*/
$this->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "faq\n\t\t\t\t\t\t(faqname, faqparent, displayorder, volatile, product)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(',', $sql) . "\n\t\t\t\t");
}
}
// ############## import widgets
/* Copied from adminfinctions_product.php
At some point we need to get rid of this product install duplication */
if (isset($this->productobj['widgets']['widget']) and is_array($this->productobj['widgets']['widget'])) {
$widgets =& $this->productobj['widgets']['widget'];
if (!isset($widgets[0])) {
$widgets = array($widgets);
}
$assertor = vB::getDbAssertor();
foreach ($widgets as $widget) {
$existing = $assertor->getRow('widget', array('guid' => $widget['guid'], 'product' => $info['productid']));
if ($existing['widgetid']) {
$data = $widget + $existing;
unset($data['definitions']);
$data['isthirdparty'] = 1;
$data['product'] = $info['productid'];
$result = $assertor->update('widget', $data, array('widgetid' => $existing['widgetid']));
$wdfs_old = $assertor->getRows('widgetdefinition', array('widgetid' => $existing['widgetid']));
$assertor->delete('widgetdefinition', array('widgetid' => $existing['widgetid']));
$index_old = array();
foreach ($wdfs_old as $key => $definition) {
$index_old[$key] = $definition['name'];
}
$wdfs_new =& $widget['definitions']['definition'];
if (!isset($wdfs_new[0])) {
$wdfs_new = array($wdfs_new);
}
foreach ($wdfs_new as &$definition) {
if ($key_old = array_search($definition['name'], $index_old)) {
$definition = $definition + $wdfs_old[$key_old];
}
$data = $definition;
$data['product'] = $info['productid'];
$data['widgetid'] = $existing['widgetid'];
$assertor->insert('widgetdefinition', $data);
}
} else {
$data = $widget;
$data['isthirdparty'] = 1;
$data['product'] = $info['productid'];
unset($data['definitions']);
$result = $assertor->insert('widget', $data);
$widgetid = is_array($result) ? array_pop($result) : $result;
if ($widgetid and is_array($widget['definitions']['definition'])) {
$definitions =& $widget['definitions']['definition'];
if (!isset($definitions[0])) {
$definitions = array($definitions);
}
foreach ($definitions as $definition) {
$data = $definition;
$data['widgetid'] = $widgetid;
$data['product'] = $info['productid'];
$assertor->insert('widgetdefinition', $data);
}
}
}
}
}
$products = fetch_product_list(true);
// Check if the plugin system is disabled. If it is, enable it if this product isn't installed.
if (!$this->registry->options['enablehooks'] and !$products[$this->productinfo['productid']]) {
$this->db->query_write("\n\t\t\t\tUPDATE " . TABLE_PREFIX . "setting\n\t\t\t\tSET value = '1'\n\t\t\t\tWHERE varname = 'enablehooks'\n\t\t\t");
$rebuild['options'] = true;
}
// Now rebuild everything we need...
if ($rebuild['hooks']) {
vB_Api::instanceInternal("Hook")->buildHookDatastore();
}
if ($rebuild['templates']) {
if ($error = build_all_styles(0, 0, '')) {
return $error;
}
}
if ($rebuild['phrases']) {
require_once DIR . '/includes/adminfunctions_language.php';
build_language();
}
if ($rebuild['options']) {
vB::getDatastore()->build_options();
}
if ($rebuild['cron']) {
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
}
build_product_datastore();
// build bitfields to remove/add this products bitfields
vB_Bitfield_Builder::save($this->db);
print_dots_stop();
$this->productinfo['need_merge'] = ($rebuild['templates'] and $installed_version);
return $this->productinfo;
}
示例4: print_stop_message
print_stop_message('product_x_uninstalled', $vbulletin->GPC['productid']);
}
// #############################################################################
if ($_REQUEST['do'] == 'productdelete') {
$vbulletin->input->clean_array_gpc('r', array('productid' => TYPE_STR));
if (strtolower($vbulletin->GPC['productid']) == 'vbulletin') {
print_cp_redirect('plugin.php?do=product');
}
$dependency_result = $db->query_read("\r\n\t\tSELECT productid, parentproductid\r\n\t\tFROM " . TABLE_PREFIX . "productdependency\r\n\t\tWHERE dependencytype = 'product' AND parentproductid <> ''\r\n\t");
// find child products -- these may break if we uninstall this
$dependency_list = array();
while ($dependency = $db->fetch_array($dependency_result)) {
$dependency_list["{$dependency['parentproductid']}"][] = $dependency['productid'];
}
$children = fetch_product_dependencies($vbulletin->GPC['productid'], $dependency_list);
$product_list = fetch_product_list(true);
$children_text = array();
foreach ($children as $childproductid) {
$childproduct = $product_list["{$childproductid}"];
if ($childproduct) {
$children_text[] = $childproduct['title'];
}
}
if ($children_text) {
$affected_children = construct_phrase($vbphrase['uninstall_product_break_products_x'], '<li>' . implode('</li><li>', $children_text) . '</li>');
} else {
$affected_children = '';
}
print_delete_confirmation('product', $vbulletin->GPC['productid'], 'plugin', 'productkill', '', 0, $affected_children);
}
// #############################################################################
示例5: xml_import_style
/**
* Reads XML style file and imports data from it into the database
*
* @param string XML data
* @param integer Style ID
* @param integer Parent style ID
* @param string New style title
* @param boolean Allow vBulletin version mismatch
* @param integer Display order for new style
* @param boolean Allow user selection of new style
*/
function xml_import_style($xml = false, $styleid = -1, $parentid = -1, $title = '', $anyversion = false, $displayorder = 1, $userselect = true)
{
// $GLOBALS['path'] needs to be passed into this function or reference $vbulletin->GPC['path']
global $vbulletin, $vbphrase;
print_dots_start('<b>' . $vbphrase['importing_style'] . "</b>, {$vbphrase['please_wait']}", ':', 'dspan');
require_once DIR . '/includes/class_xml.php';
$xmlobj = new vB_XML_Parser($xml, $vbulletin->GPC['path']);
if ($xmlobj->error_no == 1) {
print_dots_stop();
print_stop_message('no_xml_and_no_path');
} else {
if ($xmlobj->error_no == 2) {
print_dots_stop();
print_stop_message('please_ensure_x_file_is_located_at_y', 'vbulletin-style.xml', $vbulletin->GPC['path']);
}
}
if (!($arr = $xmlobj->parse())) {
print_dots_stop();
print_stop_message('xml_error_x_at_line_y', $xmlobj->error_string(), $xmlobj->error_line());
}
if (!$arr['templategroup']) {
print_dots_stop();
print_stop_message('invalid_file_specified');
}
$version = $arr['vbversion'];
$master = $arr['type'] == 'master' ? 1 : 0;
$title = empty($title) ? $arr['name'] : $title;
$product = empty($arr['product']) ? 'vbulletin' : $arr['product'];
$arr = $arr['templategroup'];
if (empty($arr[0])) {
$arr = array($arr);
}
$full_product_info = fetch_product_list(true);
$product_info = $full_product_info["{$product}"];
// version check
if ($version != $product_info['version'] and !$anyversion and !$master) {
print_dots_stop();
print_stop_message('upload_file_created_with_different_version', $product_info['version'], $version);
}
if ($master) {
// overwrite master style
echo "<h3>{$vbphrase['master_style']}</h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "template WHERE styleid = -10 AND (product = '" . $vbulletin->db->escape_string($product) . "'" . iif($product == 'vbulletin', " OR product = ''") . ")");
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "template SET styleid = -10 WHERE styleid = -1 AND (product = '" . $vbulletin->db->escape_string($product) . "'" . iif($product == 'vbulletin', " OR product = ''") . ")");
$styleid = -1;
} else {
if ($styleid == -1) {
// creating a new style
if ($test = $vbulletin->db->query_first("SELECT styleid FROM " . TABLE_PREFIX . "style WHERE title = '" . $vbulletin->db->escape_string($title) . "'")) {
print_dots_stop();
print_stop_message('style_already_exists', $title);
} else {
echo "<h3><b>" . construct_phrase($vbphrase['creating_a_new_style_called_x'], $title) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
/*insert query*/
$styleresult = $vbulletin->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "style\n\t\t\t\t\t(title, parentid, displayorder, userselect)\n\t\t\t\t\tVALUES\n\t\t\t\t\t('" . $vbulletin->db->escape_string($title) . "', {$parentid}, {$displayorder}, " . ($userselect ? 1 : 0) . ")\n\t\t\t\t");
$styleid = $vbulletin->db->insert_id($styleresult);
}
} else {
// overwriting an existing style
if ($getstyle = $vbulletin->db->query_first("SELECT title FROM " . TABLE_PREFIX . "style WHERE styleid = {$styleid}")) {
echo "<h3><b>" . construct_phrase($vbphrase['overwriting_style_x'], $getstyle['title']) . "</b></h3>\n<p>{$vbphrase['please_wait']}</p>";
vbflush();
} else {
print_dots_stop();
print_stop_message('cant_overwrite_non_existent_style');
}
}
}
// types array...
$types = array($vbphrase['template'], $vbphrase['stylevar'], $vbphrase['css'], $vbphrase['replacement_variable']);
$querybits = array();
$querytemplates = 0;
foreach ($arr as $templategroup) {
if (empty($templategroup['template'][0])) {
$tg = array($templategroup['template']);
} else {
$tg =& $templategroup['template'];
}
foreach ($tg as $template) {
$title = $vbulletin->db->escape_string($template['name']);
$template['template'] = $vbulletin->db->escape_string($template['value']);
$template['username'] = $vbulletin->db->escape_string($template['username']);
if ($template['templatetype'] != 'template') {
// template is a special template
$querybits[] = "({$styleid}, '{$template['templatetype']}', '{$title}', '{$template['template']}', '', {$template['date']}, '{$template['username']}', '" . $vbulletin->db->escape_string($template['version']) . "', '" . $vbulletin->db->escape_string($product) . "')";
} else {
// template is a standard template
//.........这里部分代码省略.........
示例6: print_stop_message
print_stop_message('pruned_moderator_log_successfully');
}
// ###################### Start modify #######################
if ($_REQUEST['do'] == 'choose') {
$users = $db->query_read("\n\t\tSELECT DISTINCT moderatorlog.userid, user.username\n\t\tFROM " . TABLE_PREFIX . "moderatorlog AS moderatorlog\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)\n\t\tORDER BY username\n\t");
$userlist = array('no_value' => $vbphrase['all_log_entries']);
while ($user = $db->fetch_array($users)) {
$userlist["{$user['userid']}"] = $user['username'];
}
print_form_header('modlog', 'view');
print_table_header($vbphrase['moderator_log_viewer']);
print_input_row($vbphrase['log_entries_to_show_per_page'], 'perpage', 15);
print_select_row($vbphrase['show_only_entries_generated_by'], 'userid', $userlist);
print_time_row($vbphrase['start_date'], 'startdate', 0, 0);
print_time_row($vbphrase['end_date'], 'enddate', 0, 0);
if (count($products = fetch_product_list()) > 1) {
print_select_row($vbphrase['product'], 'product', array('' => $vbphrase['all_products']) + $products);
}
print_select_row($vbphrase['order_by'], 'orderby', array('date' => $vbphrase['date'], 'user' => $vbphrase['username']), 'date');
print_submit_row($vbphrase['view'], 0);
if (can_access_logs($vbulletin->config['SpecialUsers']['canpruneadminlog'], 0, '')) {
print_form_header('modlog', 'prunelog');
print_table_header($vbphrase['prune_moderator_log']);
print_select_row($vbphrase['remove_entries_logged_by_user'], 'userid', $userlist);
if (count($products) > 1) {
print_select_row($vbphrase['product'], 'product', array('' => $vbphrase['all_products']) + $products);
}
print_input_row($vbphrase['remove_entries_older_than_days'], 'daysprune', 30);
print_submit_row($vbphrase['prune_log_entries'], 0);
}
}
示例7: print_description_row
if ($adminmessage['execurl']) {
$buttons .= '<input type="submit" name="address[' . $adminmessage['adminmessageid'] . ']" value="' . $vbphrase['address'] . '" class="button" />';
}
if ($adminmessage['dismissable'] or !$adminmessage['execurl']) {
$buttons .= ' <input type="submit" name="dismiss[' . $adminmessage['adminmessageid'] . ']" value="' . $vbphrase['dismiss'] . '" class="button" />';
}
print_description_row("<div style=\"float: right\">{$buttons}</div><div>" . $vbphrase['admin_attention_required'] . "</div>", false, 2, 'thead');
print_description_row('<div class="smallfont">' . fetch_error($adminmessage['varname']) . "</div>");
}
$news_rows['admin_messages'] = ob_get_clean();
}
if (can_administer('canadminstyles')) {
// before the quick stats, display the number of templates that need updating
require_once DIR . '/includes/adminfunctions_template.php';
$need_updates = 0;
$full_product_info = fetch_product_list(true);
$update_templates = $db->query_read("\n\t\tSELECT tCustom.version AS customversion, tGlobal.version AS globalversion,\n\t\t\ttGlobal.product\n\t\tFROM " . TABLE_PREFIX . "template AS tCustom\n\t\tINNER JOIN " . TABLE_PREFIX . "template AS tGlobal ON (tGlobal.styleid = -1 AND tGlobal.title = tCustom.title)\n\t\tINNER JOIN " . TABLE_PREFIX . "style AS style ON (style.styleid = tCustom.styleid)\n\t\tWHERE tCustom.styleid <> -1\n\t\t\tAND tCustom.templatetype = 'template'\n\t");
while ($update_template = $db->fetch_array($update_templates)) {
if (!$update_template['product']) {
$update_template['product'] = 'vbulletin';
}
$product_version = $full_product_info["{$update_template['product']}"]['version'];
// version in the template is newer than the version of the product,
// which probably means it's using the vB version
if (is_newer_version($update_template['globalversion'], $product_version)) {
$update_template['globalversion'] = $product_version;
}
if (is_newer_version($update_template['customversion'], $product_version)) {
$update_template['customversion'] = $product_version;
}
if (is_newer_version($update_template['globalversion'], $update_template['customversion'])) {
示例8: print_dots_stop
}
if (strtolower($info['productid']) == 'vbulletin') {
print_dots_stop();
print_stop_message('product_x_installed_no_overwrite', 'vBulletin');
}
// check for bitfield conflicts on install
$bitfields = vB_Bitfield_Builder::return_data();
if (!$bitfields) {
$bfobj =& vB_Bitfield_Builder::init();
if ($bfobj->errors) {
print_dots_stop();
print_stop_message('bitfield_conflicts_x', '<li>' . implode('</li><li>', $bfobj->errors) . '</li>');
}
}
// get system version info
$system_versions = array('php' => PHP_VERSION, 'vbulletin' => $vbulletin->options['templateversion'], 'products' => fetch_product_list(true));
$mysql_version = $db->query_first("SELECT VERSION() AS version");
$system_versions['mysql'] = $mysql_version['version'];
// ############## import dependencies
if (is_array($arr['dependencies']['dependency'])) {
$dependencies =& $arr['dependencies']['dependency'];
if (!isset($dependencies[0])) {
$dependencies = array($dependencies);
}
$dependency_errors = array();
$ignore_dependency_errors = array();
// let's check the dependencies
foreach ($dependencies as $dependency) {
// if we get an error, we haven't met this dependency
// if we go through without a problem, we have automatically met
// all dependencies for this "class" (mysql, php, vb, a specific product, etc)
示例9: autoexport_write_master_style
function autoexport_write_master_style()
{
require_once(DIR . '/includes/adminfunctions_template.php');
$full_product_info = fetch_product_list(true);
$xml = get_style_export_xml(-1, 'vbulletin', $full_product_info['vbulletin']['version'], '', 2);
autoexport_write_file_with_backup(DIR . '/install/vbulletin-style.xml', $xml);
//we don't want the templates in the xml on the filesystem
require_once(DIR . '/includes/class_filesystemxml_template.php');
$helper = new vB_FilesystemXml_Template();
$helper->remove_product_templates('vbulletin');
}
示例10: fetch_old_templates
function fetch_old_templates()
{
global $db;
$full_product_info = fetch_product_list(true);
$customcache = array();
$count = 0;
$templates = $db->query_read("\n\t\tSELECT tCustom.templateid, tCustom.title, tCustom.styleid, tCustom.mergestatus AS custommergestatus,\n\t\t\ttCustom.username AS customuser, tCustom.dateline AS customdate, tCustom.version AS customversion,\n\t\t\ttGlobal.username AS globaluser, tGlobal.dateline AS globaldate, tGlobal.version AS globalversion,\n\t\t\ttGlobal.product\n\t\tFROM " . TABLE_PREFIX . "template AS tCustom\n\t\tINNER JOIN " . TABLE_PREFIX . "style AS style ON (style.styleid = tCustom.styleid)\n\t\tINNER JOIN " . TABLE_PREFIX . "template AS tGlobal ON (tGlobal.styleid = IF(style.type = 'standard', -1, -2) AND tGlobal.title = tCustom.title)\n\t\tWHERE\n\t\t\ttCustom.styleid > 0\n\t\t\t\tAND\n\t\t\ttCustom.templatetype = 'template'\n\t\t\t\tAND\n\t\t\ttCustom.mergestatus = 'none'\n\t\tORDER BY tCustom.title\n\t");
while ($template = $db->fetch_array($templates)) {
if (!$template['product']) {
$template['product'] = 'vbulletin';
}
$product_version = $full_product_info["{$template['product']}"]['version'];
// version in the template is newer than the version of the product,
// which probably means it's using the vB version
if (is_newer_version($template['globalversion'], $product_version)) {
$template['globalversion'] = $product_version;
}
if (is_newer_version($template['customversion'], $product_version)) {
$template['customversion'] = $product_version;
}
if (is_newer_version($template['globalversion'], $template['customversion'])) {
$count++;
$customcache["{$template['styleid']}"]["{$template['templateid']}"] = $template;
}
}
return array('count' => $count, 'cache' => $customcache);
}
示例11: step_7
/**
* Step #7 Check Product Dependencies
*
*/
function step_7()
{
if (VB_AREA == 'Install') {
$this->skip_message();
return;
}
$this->show_message($this->phrase['final']['verifying_product_dependencies']);
require_once DIR . '/includes/class_upgrade_product.php';
$this->product = new vB_Upgrade_Product($this->registry, $this->phrase['vbphrase'], true, $this->caller);
$dependency_list = array();
$product_dependencies = $this->db->query_read("\n\t\t\tSELECT pd.*\n\t\t\tFROM " . TABLE_PREFIX . "productdependency AS pd\n\t\t\tINNER JOIN " . TABLE_PREFIX . "product AS p ON (p.productid = pd.productid)\n\t\t\tWHERE\n\t\t\t\tpd.productid IN ('vbblog', 'vbcms', 'skimlinks', 'forumrunner', 'postrelease', 'vbapi')\n\t\t\t\t\tAND\n\t\t\t\tp.active = 1\n\t\t\tORDER BY\n\t\t\t\tpd.dependencytype, pd.parentproductid, pd.minversion\n\t\t");
while ($product_dependency = $this->db->fetch_array($product_dependencies)) {
$dependency_list["{$product_dependency['productid']}"][] = array('dependencytype' => $product_dependency['dependencytype'], 'parentproductid' => $product_dependency['parentproductid'], 'minversion' => $product_dependency['minversion'], 'maxversion' => $product_dependency['maxversion']);
}
$product_list = fetch_product_list(true);
$disabled = array();
foreach ($dependency_list as $productid => $dependencies) {
$this->show_message(sprintf($this->phrase['final']['verifying_product_x'], $productid));
$this->product->productinfo['productid'] = $productid;
$disableproduct = false;
try {
$this->product->import_dependencies($dependencies);
} catch (vB_Exception_AdminStopMessage $e) {
$message = $this->stop_exception($e);
$this->show_message($message);
$disableproduct = true;
}
if ($disableproduct) {
$disabled[] = $productid;
$this->product->disable();
$this->add_adminmessage('disabled_product_x_y_z', array('dismissable' => 1, 'script' => '', 'action' => '', 'execurl' => '', 'method' => '', 'status' => 'undone'), true, array($product_list["{$productid}"]['title'], $productid, $message));
$this->show_message(sprintf($this->phrase['final']['product_x_disabled'], $productid));
}
}
if (!should_install_suite()) {
if (!$disabled['vbblog'] and $product_list['vbblog']['active']) {
$this->product = new vB_Upgrade_Product($this->registry, $this->phrase['vbphrase'], true, $this->caller);
$this->product->productinfo['productid'] = 'vbblog';
$this->product->disable();
$this->show_message(sprintf($this->phrase['final']['product_x_disabled'], 'vbblog'));
}
if (!$disabled['vbcms'] and $product_list['vbcms']['active']) {
$this->product = new vB_Upgrade_Product($this->registry, $this->phrase['vbphrase'], true, $this->caller);
$this->product->productinfo['productid'] = 'vbcms';
$this->product->disable();
$this->show_message(sprintf($this->phrase['final']['product_x_disabled'], 'vbcms'));
}
}
}
示例12: save
/**
* Add a new phrase or update an existing phrase
* @param string $fieldname New Phrase Type for adding, old Phrase Type for editing
* @param string $varname New Varname for adding, old Varname for editing
* @param array $data Phrase data to be added or updated
* 'text' => Phrase text array.
* 'oldvarname' => Old varname for editing only
* 'oldfieldname' => Old fieldname for editing only
* 't' =>
* 'ismaster' =>
* 'product' => Product ID of the phrase
* @return void
*/
public function save($fieldname, $varname, $data)
{
$fieldname = trim($fieldname);
$varname = trim($varname);
$vb5_config =& vB::getConfig();
$install = false;
if (defined('VBINSTALL') and VBINSTALL) {
$install = true;
}
$session = vB::getCurrentSession();
if (!empty($session)) {
$userinfo = $session->fetch_userinfo();
} else {
$userinfo = vB_User::fetchUserinfo(1);
}
require_once DIR . '/includes/adminfunctions.php';
$full_product_info = fetch_product_list(true);
if (empty($varname)) {
throw new vB_Exception_Api('please_complete_required_fields');
}
if (!preg_match('#^[' . self::VALID_CLASS . ']+$#', $varname)) {
throw new vB_Exception_Api('invalid_phrase_varname');
}
require_once DIR . '/includes/functions_misc.php';
foreach ($data['text'] as $text) {
if (!validate_string_for_interpolation($text)) {
throw new vB_Exception_Api('phrase_text_not_safe', array($varname));
}
}
// it's an update
if (!empty($data['oldvarname']) and !empty($data['oldfieldname'])) {
if (vB::getDbAssertor()->getField('phrase_fetchid', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'varname' => $varname))) {
// Don't check if we are moving a phrase to another group but keeping the same name. See VBV-4192.
if ($varname != $data['oldvarname'] and $fieldname != $data['oldfieldname']) {
throw new vB_Exception_Api('there_is_already_phrase_named_x', array($varname));
}
if ($varname != $data['oldvarname']) {
throw new vB_Exception_Api('variable_name_exists', array($data['oldvarname'], $varname));
}
}
if (!is_array($data['oldfieldname'])) {
$data['oldfieldname'] = array($data['oldfieldname']);
}
if (!in_array($fieldname, $data['oldfieldname'])) {
$data['oldfieldname'][] = $fieldname;
}
// delete old phrases
vB::getDbAssertor()->assertQuery('deleteOldPhrases', array('varname' => $data['oldvarname'], 'fieldname' => $data['oldfieldname'], 't' => $data['t'], 'debug' => empty($data['skipdebug']) && ($vb5_config['Misc']['debug'] or $install)));
$update = 1;
$this->setPhraseDate();
}
if (empty($update)) {
if (empty($data['text'][0]) and $data['text'][0] != '0' and !$data['t'] or empty($varname)) {
throw new vB_Exception_Api('please_complete_required_fields');
}
if (vB::getDbAssertor()->getField('phrase_fetchid', array('varname' => $varname, 'fieldname' => $fieldname))) {
throw new vB_Exception_Api('there_is_already_phrase_named_x', array($varname));
}
}
if ($data['ismaster']) {
if (($vb5_config['Misc']['debug'] or $install) and !$data['t']) {
/*insert query*/
vB::getDbAssertor()->assertQuery('phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_REPLACE, 'languageid' => -1, 'varname' => $varname, 'text' => $data['text'][0], 'fieldname' => $fieldname, 'product' => $data['product'], 'username' => $userinfo['username'], 'dateline' => vB::getRequest()->getTimeNow(), 'version' => $full_product_info[$data['product']]['version']));
}
unset($data['text'][0]);
}
foreach ($data['text'] as $_languageid => $txt) {
$_languageid = intval($_languageid);
if (!empty($txt) or $txt == '0') {
/*insert query*/
vB::getDbAssertor()->assertQuery('phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_REPLACE, 'languageid' => $_languageid, 'varname' => $varname, 'text' => $txt, 'fieldname' => $fieldname, 'product' => $data['product'], 'username' => $userinfo['username'], 'dateline' => vB::getRequest()->getTimeNow(), 'version' => $full_product_info[$data['product']]['version']));
}
}
require_once DIR . '/includes/adminfunctions.php';
require_once DIR . '/includes/adminfunctions_language.php';
build_language(-1);
}
示例13: save
/**
* Insert a new cron or Update an existing cron
*
* @param array $data Cron data to be inserted or updated
* 'varname' => Varname
* 'filename' => Filename
* 'title' => Title
* 'description' => Description
* 'logphrase' => Log Phrase
* 'weekday' => Day of the Week (Note: this overrides the 'day of the month' option)
* 'day' => Day of the Month
* 'hour' => Hour
* 'minute' => Minute
* 'active' => Active. Boolean.
* 'loglevel' => Log Entries. Boolean.
* 'product' => Product
* 'volatile' => vBulletin Default. Boolean.
* @param int $cronid If not 0, it's the cron ID to be updated
*
* @return int New cron ID or updated Cron's ID
*/
public function save($data, $cronid = 0)
{
$this->checkHasAdminPermission('canadmincron');
$cronid = intval($cronid);
$vb5_config = vB::getConfig();
$userinfo = vB::getDatastore()->get_value('userinfo');
if (empty($cronid)) {
if (empty($data['varname'])) {
throw new vB_Exception_Api('please_complete_required_fields');
}
if (!preg_match('#^[a-z0-9_]+$#i', $data['varname'])) {
throw new vB_Exception_Api('invalid_phrase_varname');
}
if (vB::getDbAssertor()->getRow('cron', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'varname' => $data['varname']))) {
throw new vB_Exception_Api('there_is_already_option_named_x', array($data['varname']));
}
if (empty($data['title'])) {
throw new vB_Exception_Api('please_complete_required_fields');
}
} else {
$cron = vB::getDbAssertor()->getRow('cron', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'cronid' => $cronid));
if (!$cron) {
throw new vB_Exception_Api('invalid_option_specified');
}
if ((!$cron['volatile'] or $vb5_config['Misc']['debug']) and empty($data['title'])) {
// custom entry or in debug mode means the title is editable
throw new vB_Exception_Api('please_complete_required_fields');
}
$data['varname'] = $cron['varname'];
}
if ($data['filename'] == '' or $data['filename'] == './includes/cron/.php') {
throw new vB_Exception_Api('invalid_filename_specified');
}
$data['weekday'] = str_replace('*', '-1', $data['weekday']);
$data['day'] = str_replace('*', '-1', $data['day']);
$data['hour'] = str_replace('*', '-1', $data['hour']);
// need to deal with minute properly :)
sort($data['minute'], SORT_NUMERIC);
$newminute = array();
foreach ($data['minute'] as $time) {
$newminute["{$time}"] = true;
}
unset($newminute["-2"]);
// this is the "-" (don't run) entry
if ($newminute["-1"]) {
// its run every minute so lets just ignore every other entry
$newminute = array(0 => -1);
} else {
// $newminute's keys are the values of the GPC variable, so get the values back
$newminute = array_keys($newminute);
}
if (empty($cronid)) {
/*insert query*/
$cronid = vB::getDbAssertor()->assertQuery('cron', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_INSERT, 'varname' => trim($data['varname'])));
if (!empty($cronid['errors'])) {
throw new vB_Exception_Api('invalid_data');
}
} else {
// updating an entry. If we're changing the volatile status, we
// need to remove the entries in the opposite language id.
// Only possible in debug mode.
if ($data['volatile'] != $cron['volatile']) {
$old_languageid = $cron['volatile'] ? -1 : 0;
vB::getDbAssertor()->assertQuery('phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'languageid' => $old_languageid, 'fieldname' => 'cron', 'varname' => array('task_$cron[varname]_title', 'task_$cron[varname]_desc', 'task_$cron[varname]_log')));
}
}
$escaped_product = $data['product'];
// update
$result = vB::getDbAssertor()->assertQuery('cron', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'loglevel' => intval($data['loglevel']), 'weekday' => intval($data['weekday']), 'day' => intval($data['day']), 'hour' => intval($data['hour']), 'minute' => serialize($newminute), 'filename' => $data['filename'], 'active' => $data['active'], 'volatile' => $data['volatile'], 'product' => $data['product'], vB_dB_Query::CONDITIONS_KEY => array('cronid' => $cronid)));
if (!empty($result['errors'])) {
throw new vB_Exception_Api('invalid_data');
}
$new_languageid = $data['volatile'] ? -1 : 0;
require_once DIR . '/includes/adminfunctions.php';
$full_product_info = fetch_product_list(true);
$product_version = $full_product_info["{$escaped_product}"]['version'];
if (!$data['volatile'] or $vb5_config['Misc']['debug']) {
/*insert_query*/
$result = vB::getDbAssertor()->assertQuery('cron_insertphrases', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED, 'new_languageid' => $new_languageid, 'varname' => $data['varname'], 'product' => $data['product'], 'username' => $userinfo['username'], 'timenow' => vB::getRequest()->getTimeNow(), 'product_version' => $product_version, 'title' => trim($data['title']), 'description' => trim($data['description']), 'logphrase' => trim($data['logphrase'])));
//.........这里部分代码省略.........
示例14: updateGroupSettings
/**
* This function updates group settings.
* @param array $group Group values
* @return array, $response
*/
public function updateGroupSettings($group, $username, $oldproduct = '', $adminperm = false)
{
$this->checkHasAdminPermission('canadminsettings');
require_once DIR . '/includes/class_xml.php';
require_once DIR . '/includes/functions_file.php';
require_once DIR . '/includes/adminfunctions_options.php';
require_once DIR . '/includes/adminfunctions.php';
$response = array();
$existing = vB::getDbAssertor()->assertQuery('settinggroup', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'grouptitle' => $group['grouptitle']));
if ($existing->valid()) {
$existing = $existing->current();
if (!empty($existing['adminperm']) and !vB::getUserContext()->hasAdminPermission($existing['adminperm'])) {
throw new vB_Exception_AccessDenied('no_permission');
}
}
$updates = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'displayorder' => $group['displayorder'], 'volatile' => $group['volatile'], 'product' => $group['product'], vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'grouptitle', 'value' => $group['grouptitle'], 'operator' => vB_dB_Query::OPERATOR_EQ)));
if ($adminperms !== false and vB::getUserContext()->hasAdminPermission('canadminsettingsall')) {
$adminperm = vB::getCleaner()->clean($adminperm, vB_Cleaner::TYPE_STR);
if (empty($adminperm)) {
$updates['adminperm'] = '';
} else {
$updates['adminperm'] = substr($adminperm, 0, 32);
}
}
$updateSetting = vB::getDbAssertor()->assertQuery('settinggroup', $updates);
if ($updateSetting['errors']) {
$response['errors'] = $updateSetting['errors'];
}
$full_product_info = fetch_product_list(true);
$product_version = $full_product_info[$group['product']]['version'];
$updatePhrase = vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'text' => $group['title'], 'product' => $group['product'], 'username' => $username, 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => "settinggroup_" . $group['grouptitle'], 'operator' => vB_dB_Query::OPERATOR_EQ))));
if ($updatePhrase['errors']) {
$response['errors'] = $updatePhrase['errors'];
}
$settingnames = array();
$phrasenames = array();
$settings = vB::getDbAssertor()->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'grouptitle' => $group['grouptitle'], 'product' => $oldproduct));
if ($settings and $settings->valid()) {
foreach ($settings as $setting) {
$settingnames[] = $setting['varname'];
$phrasenames[] = 'setting_' . $setting['varname'] . '_desc';
$phrasenames[] = 'setting_' . $setting['varname'] . '_title';
}
$full_product_info = fetch_product_list(true);
$product_version = $full_product_info[$group['product']]['version'];
vB::getDbAssertor()->assertQuery('setting', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'product' => $group['product'], vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => $settingnames, 'operator' => vB_dB_Query::OPERATOR_EQ))));
vB::getDbAssertor()->assertQuery('vBForum:phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'product' => $group['product'], 'username' => $username, 'dateline' => TIMENOW, 'version' => $product_version, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'varname', 'value' => $phrasenames, 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'fieldname', 'value' => 'vbsettings', 'operator' => vB_dB_Query::OPERATOR_EQ))));
}
vB::getDatastore()->build_options();
if (defined('DEV_AUTOEXPORT') and DEV_AUTOEXPORT) {
require_once DIR . '/includes/functions_filesystemxml.php';
autoexport_write_settings_and_language(-1, array($oldproduct, $group['product']));
}
$response['update'] = true;
return $response;
}
示例15: replace
/**
* Find and replace phrases in languages
*
* @param array $replace A list of phrase ID to be replaced
* @param string $searchstring Search string
* @param string $replacestring Replace string
* @param int $languageid Language ID
* @return void
*/
public function replace($replace, $searchstring, $replacestring, $languageid)
{
$this->checkHasAdminPermission('canadminlanguages');
if (empty($replace)) {
throw new vB_Exception_Api('please_complete_required_fields');
}
$userinfo = vB::getCurrentSession()->fetch_userinfo();
require_once DIR . '/includes/adminfunctions.php';
$full_product_info = fetch_product_list(true);
$phrases = vB::getDbAssertor()->assertQuery('phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'phraseid' => $replace));
$products = array();
foreach ($phrases as $phrase) {
$phrase['product'] = empty($phrase['product']) ? 'vbulletin' : $phrase['product'];
$phrase['text'] = str_replace($searchstring, $replacestring, $phrase['text']);
if ($phrase['languageid'] == $languageid) {
// update
vB::getDbAssertor()->assertQuery('phrase', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_UPDATE, 'text' => $phrase['text'], 'username' => $userinfo['username'], 'dateline' => vB::getRequest()->getTimeNow(), 'version' => $full_product_info["{$phrase['product']}"]['version'], vB_dB_Query::CONDITIONS_KEY => array('phraseid' => $phrase['phraseid'])));
} else {
// insert
/*insert query*/
vB::getDbAssertor()->assertQuery('phrase_replace', array('languageid' => $languageid, 'varname' => $phrase['varname'], 'text' => $phrase['text'], 'fieldname' => $phrase['fieldname'], 'product' => $phrase['product'], 'username' => $userinfo['username'], 'dateline' => vB::getRequest()->getTimeNow(), 'version' => $full_product_info["{$phrase['product']}"]['version']));
}
$products[$phrase['product']] = 1;
}
$this->setPhraseDate();
return array_keys($products);
}