本文整理汇总了PHP中delete_product函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_product函数的具体用法?PHP delete_product怎么用?PHP delete_product使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_product函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeProducts
/**
* Disables or deletes a set of products (does not run any uninstall code.
*/
public function removeProducts($products, $versions = array(), $echo = false, $disable_only = false, $reason = '')
{
if (!$products or !$this->hasPermission()) {
return false;
}
if (!$versions) {
$versions = array();
}
if ($disable_only) {
$this->assertor->assertQuery('disableProducts', array('reason' => $reason, 'products' => $products, vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD));
} else {
$first = true;
foreach ($products as $pid) {
$result = delete_product($pid);
if ($result and $echo) {
if ($first) {
$first = false;
$msg = new vB_Phrase('hooks', 'products_removed');
$this->message($msg, 1);
}
if ($versions[$pid]) {
$this->message($versions[$pid]['title'] . ' - ' . $versions[$pid]['version'], 1);
} else {
$this->message($versions[$pid]['title'], 1);
}
}
}
}
}
示例2: step_3
function step_3()
{
if ($existingprod = $this->db->query_first("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "product\n\t\t\tWHERE productid = 'vbapi'")) {
$this->show_message($this->phrase['version']['4110a1']['remove_vbapi_product']);
require_once DIR . '/includes/adminfunctions_plugin.php';
delete_product('vbapi');
} else {
$this->skip_message();
}
}
示例3: delete_product
<?php
require __DIR__ . '/../src/bootstrap_admin.php';
if (array_key_exists('product_id', $_GET)) {
delete_product($_GET['product_id']);
}
header('Location: /admin/index.php');
示例4: print_upgrade_footer
// #############################################################################
// welcome step
if ($vbulletin->GPC['step'] == 'welcome') {
if ($vbulletin->options['templateversion'] == PREV_VERSION) {
echo "<blockquote><p> </p>";
echo "{$vbphrase['upgrade_start_message']}";
echo "<p> </p></blockquote>";
} else {
echo "<blockquote><p> </p>";
echo "{$vbphrase['upgrade_wrong_version']}";
echo "<p> </p></blockquote>";
print_upgrade_footer();
}
}
// #############################################################################
// FINAL step (notice the SCRIPTCOMPLETE define)
if ($vbulletin->GPC['step'] == 1) {
require_once DIR . '/includes/adminfunctions_plugin.php';
delete_product('vb_calendar366_xss_fix', true);
// tell log_upgrade_step() that the script is done
define('SCRIPTCOMPLETE', true);
}
// #############################################################################
print_next_step();
print_upgrade_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:39, Wed May 30th 2012
|| # CVS: $RCSfile$ - $Revision: 39862 $
|| ####################################################################
\*======================================================================*/
示例5: build_datastore
// Packages, routes, actions, contenttypes
$db->query_write("\r\n\t\tDELETE package, route, action, contenttype\r\n\t\tFROM " . TABLE_PREFIX . "package AS package\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "route AS route\r\n\t\t\tON route.packageid = package.packageid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "action AS action\r\n\t\t\tON action.routeid = route.routeid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "contenttype AS contenttype\r\n\t\t\tON contenttype.packageid = package.packageid\r\n\t\tWHERE productid = '{$safe_productid}'\r\n\t");
// Clear routes from datastore
build_datastore('routes', serialize(array()), 1);
//clear the type cache.
vB_Cache::instance()->purge('vb_types.types');
// need to remove the language columns for this product as well
require_once DIR . '/includes/class_dbalter.php';
$db_alter = new vB_Database_Alter_MySQL($db);
if ($db_alter->fetch_table_info('language')) {
$phrasetypes = $db->query_read("\r\n\t\t\tSELECT fieldname\r\n\t\t\tFROM " . TABLE_PREFIX . "phrasetype\r\n\t\t\tWHERE product = '" . $db->escape_string($vbulletin->GPC['productid']) . "'\r\n\t\t");
while ($phrasetype = $db->fetch_array($phrasetypes)) {
$db_alter->drop_field("phrasegroup_{$phrasetype['fieldname']}");
}
}
delete_product($vbulletin->GPC['productid']);
build_all_styles();
vBulletinHook::build_datastore($db);
require_once DIR . '/includes/adminfunctions_language.php';
build_language();
build_options();
require_once DIR . '/includes/functions_cron.php';
build_cron_next_run();
build_product_datastore();
// build bitfields to remove/add this products bitfields
require_once DIR . '/includes/class_bitfield_builder.php';
vB_Bitfield_Builder::save($db);
// reload block types
$blockmanager = vB_BlockManager::create($vbulletin);
$blockmanager->reloadBlockTypes(true);
if (!defined('DISABLE_PRODUCT_REDIRECT')) {
示例6: get_category_name
if ($category_id == NULL || $category_id == FALSE) {
$category_id = 1;
}
$category_name = get_category_name($category_id);
$categories = get_categories();
$products = get_products_by_category($category_id);
include 'product_list.php';
} else {
if ($action == 'delete_product') {
$product_id = filter_input(INPUT_POST, 'product_id', FILTER_VALIDATE_INT);
$category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
if ($category_id == NULL || $category_id == FALSE || $product_id == NULL || $product_id == FALSE) {
$error = "Missing or incorrect product id or category id.";
include '../errors/error.php';
} else {
delete_product($product_id);
header("Location: .?category_id={$category_id}");
}
} else {
if ($action == 'show_add_form') {
$categories = get_categories();
include 'product_add.php';
} else {
if ($action == 'add_product') {
$category_id = filter_input(INPUT_POST, 'category_id', FILTER_VALIDATE_INT);
$code = filter_input(INPUT_POST, 'code');
$name = filter_input(INPUT_POST, 'name');
$price = filter_input(INPUT_POST, 'price');
if ($category_id == NULL || $category_id == FALSE || $code == NULL || $name == NULL || $price == NULL || $price == FALSE) {
$error = "Invalid product data. Check all fields and try again.";
include '../errors/error.php';
示例7: array
if (!isset($codes[0])) {
$codes = array($codes);
}
// run each of the codes
foreach ($codes as $code) {
// Run if: code version is * (meaning always run), no version
// previously installed, or if the code is for a newer version
// than is currently installed
if ($code['version'] == '*' or $installed_version === null or is_newer_version($code['version'], $installed_version)) {
eval($code['installcode']);
}
}
}
// dependencies checked, install code run. Now clear out the old product info;
// settings should be retained in memory already
delete_product($info['productid']);
if (is_array($codes)) {
// we've now run all the codes, if execution is still going
// then it's going to complete fully, so insert the codes
foreach ($codes as $code) {
/* insert query */
$db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productcode\n\t\t\t\t\t(productid, version, installcode, uninstallcode)\n\t\t\t\tVALUES\n\t\t\t\t\t('" . $db->escape_string($info['productid']) . "',\n\t\t\t\t\t'" . $db->escape_string($code['version']) . "',\n\t\t\t\t\t'" . $db->escape_string($code['installcode']) . "',\n\t\t\t\t\t'" . $db->escape_string($code['uninstallcode']) . "')\n\t\t\t");
}
}
if (is_array($dependencies)) {
// dependencies met, codes run -- now we can insert the dependencies into the DB
foreach ($dependencies as $dependency) {
/* insert query */
$db->query_write("\n\t\t\t\tINSERT INTO " . TABLE_PREFIX . "productdependency\n\t\t\t\t\t(productid, dependencytype, parentproductid, minversion, maxversion)\n\t\t\t\tVALUES\n\t\t\t\t\t('" . $db->escape_string($info['productid']) . "',\n\t\t\t\t\t'" . $db->escape_string($dependency['dependencytype']) . "',\n\t\t\t\t\t'" . $db->escape_string($dependency['parentproductid']) . "',\n\t\t\t\t\t'" . $db->escape_string($dependency['minversion']) . "',\n\t\t\t\t\t'" . $db->escape_string($dependency['maxversion']) . "')\n\t\t\t");
}
}
示例8: switch
<?php
//type of request
//1: get description of product
//2: delete product
//3: edit price
$cmd = $_REQUEST['cmd'];
switch ($cmd) {
case 1:
get_products($_REQUEST['id']);
break;
case 2:
delete_product($_REQUEST['id']);
break;
default:
}
function get_products($id)
{
include "products.php";
$obj = new products();
$row = $obj->get_product($id);
//return a JSON string to browser when request comes to get description
echo '{"result":1,"desc":"' . $row['description'] . '"}';
}
function delete_product($id)
{
include "products.php";
$obj = new products();
if ($obj->delete($id)) {
echo '{"result":1,"message": "deleted"}';
} else {
示例9: filter_input
require '../model/database.php';
require '../model/product_db.php';
$action = filter_input(INPUT_POST, 'action');
if ($action === NULL) {
$action = filter_input(INPUT_GET, 'action');
if ($action === NULL) {
$action = 'list_products';
}
}
if ($action == 'list_products') {
$products = get_products();
include 'product_list.php';
} else {
if ($action == 'delete_product') {
$product_code = filter_input(INPUT_POST, 'product_code');
delete_product($product_code);
header("Location: .");
// redirect request returns to the same page
} else {
if ($action == 'show_add_form') {
include 'product_add.php';
} else {
if ($action == 'add_product') {
$code = filter_input(INPUT_POST, 'code');
$name = filter_input(INPUT_POST, 'name');
$version = filter_input(INPUT_POST, 'version', FILTER_VALIDATE_FLOAT);
$release_date = filter_input(INPUT_POST, 'release_date');
// Validate the inputs
if ($code === NULL || $name === FALSE || $version === NULL || $version === FALSE || $release_date === NULL) {
$error = "Invalid product data. Check all fields and try again.";
include '../errors/error.php';
示例10: delete_product
<div class="container">
<div class="row">
<?php
if (isset($_GET['del'])) {
$message = delete_product($_GET['del']);
echo '<div style="border:1px solid #000; padding: 5px; background-color:orange">' . $message . '</div>';
}
?>
<section class="content">
<h2>My products</h2>
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-container">
<table class="table table-filter">
<tbody>
<?php
$items = show_my_items();
if (!empty($items)) {
foreach ($items as $key => $value) {
echo '<tr>
<td>
<div class="media">
<img class="pull-left" src="' . $value[5] . '" alt="pic" width="100">
<div class="media-body">
<h4 class="title">' . $value[1] . '</h4>
<p class="description">Description: ' . $value[8] . '</p>
</div>
</div>
示例11: add_product
$add_product = add_product($_POST['product_name'], $product_image_url, $_POST['category_id'], $_POST['unit_price']);
if ($add_product == 1) {
$message = "Product has been added.";
} else {
$errormessage = "Something wrong. Please Try Again!!";
}
} else {
$errormessage = "Product Image is invalid. Please Try Again!!";
}
}
$all_category = all_category();
//for select box
$all_product = all_product();
/*******************************delete product********************************************/
if (!empty($_GET['delete'])) {
$delete_product = delete_product($_GET['delete']);
if ($delete_product == 1) {
header('Location:product.php');
} else {
$errormessage = "Something wrong. Please try again!!.";
}
}
/*******************************end delete product****************************************/
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Manage Product</h1>
示例12: get_products_by_category
/*********************************************
* Select some products
**********************************************/
// Sample data
$product_name = 'Fender Telecaster';
// Sample data
$cat_id = 1;
// Get the products
$products = get_products_by_category($cat_id);
// Get a product by name
$product_by_name = get_product_by_name($product_name);
/***************************************
* Delete a product
****************************************/
//print_r($product_by_name);
delete_product($product_by_name['productID']);
// Delete the product and display an appropriate messge
$delete_message = "No rows were deleted.";
/***************************************
* Insert a product
****************************************/
// Sample data
$category_id = 1;
$code = 'hgjh';
$name = 'Blahblah';
$description = 'NA';
$price = '949.99';
// Insert the data
add_product($category_id, $code, $name, $description, $price, 0.1);
// Display an appropriate message
$insert_message = "No rows were inserted.";
示例13: get_products_by_category
* Select some products
**********************************************/
// Sample data
$cat_id = 1;
// Get the products
$products = get_products_by_category($cat_id);
/***************************************
* Delete a product
****************************************/
// Sample data
$product_name = 'Fender Telecaster';
// Delete the product and display an appropriate messge
$product = get_product_by_name($product_name);
if ($product) {
$product_id = $product['productID'];
$row_count = delete_product($product_id);
if ($row_count > 0) {
$delete_message = "{$row_count} row was deleted.";
} else {
$delete_message = "No rows were deleted.";
}
} else {
$delete_message = "There is no product with that name.";
}
/***************************************
* Insert a product
****************************************/
// Sample data
$category_id = 1;
$code = 'tele';
$name = 'Fender Telecaster';
示例14: remove_products
function remove_products($products, $versions = array(), $echo = true, $disable_only = false, $reason = '')
{
global $db, $vbphrase;
if (!$versions) {
$versions = array();
}
if ($disable_only) {
$reason = $db->escape_string($reason);
$products = array_map(array($db, 'escape_string'), $products);
$list = "'" . implode("','", $products) . "'";
$db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "product\n\t\t\tSET active = 0, description = CONCAT('{$reason}', description)\n\t\t\tWHERE productid IN ({$list}) AND active = 1\n\t\t");
} else {
$first = true;
foreach ($products as $pid) {
$result = delete_product($pid);
if ($result and $echo) {
if ($first) {
$first = false;
plugin_message($vbphrase['products_removed'], 1, 1, 1);
}
if ($versions[$pid]) {
plugin_message($versions[$pid]['title'] . ' - ' . $versions[$pid]['version'], 1, 1, 1);
} else {
plugin_message($versions[$pid]['title'], 1, 1, 1);
}
}
}
}
}
示例15: install_product
//.........这里部分代码省略.........
throw new vB_Exception_AdminStopMessage(array('product_x_installed_no_overwrite', $info['title']));
}
$active = $existingprod['active'];
// not sure what we're deleting, so rebuild everything
$rebuild = array('templates' => true, 'hooks' => true, 'phrases' => true, 'options' => true, 'cron' => true);
$installed_version = $existingprod['version'];
} else {
$active = $info['active'] ? 1 : 0;
$rebuild = array('templates' => false, 'hooks' => false, 'phrases' => false, 'options' => false, 'cron' => false);
$installed_version = null;
}
// ############## import install/uninstall code
if (isset($arr['codes']['code']) and is_array($arr['codes']['code'])) {
$codes =& $arr['codes']['code'];
if (!isset($codes[0])) {
$codes = array($codes);
}
// run each of the codes
foreach ($codes as $code) {
// Run if: code version is * (meaning always run), no version
// previously installed, or if the code is for a newer version
// than is currently installed
if ($code['version'] == '*' or $installed_version === null or is_newer_version($code['version'], $installed_version)) {
eval($code['installcode']);
}
}
// Clear routes from datastore
build_datastore('routes', serialize(array()), 1);
//assume that the product may have installed content types and purge the content type cache
vB_Cache::instance()->purge('vb_types.types');
}
// dependencies checked, install code run. Now clear out the old product info;
// settings should be retained in memory already
delete_product($info['productid'], false, true);
if (is_array($codes)) {
// we've now run all the codes, if execution is still going
// then it's going to complete fully, so insert the codes
$productCodes = array();
foreach ($codes as $code) {
/* insert query */
$productCodes[] = array('productid' => $info['productid'], 'version' => $code['version'], 'installcode' => $code['installcode'], 'uninstallcode' => $code['uninstallcode']);
}
$assertor->insertMultiple('productcode', array('productid', 'version', 'installcode', 'uninstallcode'), $productCodes);
}
if (is_array($dependencies)) {
// dependencies met, codes run -- now we can insert the dependencies into the DB
$productDependencies = array();
foreach ($dependencies as $dependency) {
/* insert query */
$productDependencies[] = array('productid' => $info['productid'], 'dependencytype' => $dependency['dependencytype'], 'parentproductid' => $dependency['parentproductid'], 'minversion' => $dependency['minversion'], 'maxversion' => $dependency['maxversion']);
}
$assertor->insertMultiple('productdependency', array('productid', 'dependencytype', 'parentproductid', 'minversion', 'maxversion'), $productDependencies);
}
/* insert query */
$assertor->insert('product', array('productid' => $info['productid'], 'title' => $info['title'], 'description' => $info['description'], 'version' => $info['version'], 'active' => intval($active), 'url' => $info['url'], 'versioncheckurl' => $info['versioncheckurl']));
// ############## import templates
if (isset($arr['templates']['template']) and is_array($arr['templates']['template'])) {
$querybits = array();
$querytemplates = 0;
$templates =& $arr['templates']['template'];
if (!isset($templates[0])) {
$templates = array($templates);
}
foreach ($templates as $template) {
$title = $template['name'];
$template['template'] = $template['value'];