本文整理汇总了PHP中db::db_Update方法的典型用法代码示例。如果您正苦于以下问题:PHP db::db_Update方法的具体用法?PHP db::db_Update怎么用?PHP db::db_Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::db_Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) {
die("Unauthorised Access");
}
if (!getperms("2")) {
header("location:" . e_BASE . "index.php");
exit;
}
$sql = e107::getDb();
$tp = e107::getParser();
if (isset($_POST['reset'])) {
for ($mc = 1; $mc <= 5; $mc++) {
$sql->db_Select("menus", "*", "menu_location='" . $mc . "' ORDER BY menu_order");
$count = 1;
$sql2 = new db();
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch()) {
$sql2->db_Update("menus", "menu_order='{$count}' WHERE menu_id='{$menu_id}' ");
$count++;
}
$text = "<b>Menus reset in database</b><br /><br />";
}
} else {
unset($text);
}
$frm = e107::getForm();
$text = "The Menu-Manager allows you to place and arrange your menus within your theme template. \n[u]Hover[/u] over the sub-areas to modify existing menu items. \n\nIf you find the menus are not updating correctly, clicking the refresh button below may help. \n[html]\n<form method='post' id='menurefresh' action='" . $_SERVER['PHP_SELF'] . "'>\n<div>\n" . $frm->admin_button('reset', 'Refresh', 'cancel') . "</div>\n</form>\n<div class='indent'><span class='required'><i class='icon-search icon-white'></i></span> indicates that the menu's visibility has been modified.</div>\n[/html]\n";
$text = $tp->toHtml($text, true);
$ns->tablerender("Menus Help", $text);
示例2: db
$sql = new db();
if (isset($_POST['create_new'])) {
// Create a new record in Properties table
$sql->db_Insert(easyshop_properties, "0,\r\n '" . $tp->toDB($_POST['prop_display_name']) . "',\r\n\t\t'" . $tp->toDB($_POST['prop_list']) . "',\r\n\t\t''\r\n ") or die(mysql_error());
}
if (isset($_POST['update_prop'])) {
// Update the existing record in Properties table
$prop_list = $_POST['prop_list'];
$prop_prices = $_POST['prop_prices'];
// Clean the property array from empty elements
General::Array_Clean("", $prop_list);
// Transfer the prop_list array back to a string separated by comma's
$prop_list = implode(",", $prop_list);
$prop_prices = implode(",", $prop_prices);
// Actual update
$sql->db_Update(easyshop_properties, "prop_display_name='" . $tp->toDB($_POST['prop_display_name']) . "',\r\n\t\tprop_list='" . $tp->toDB($prop_list) . "',\r\n\t\tprop_prices='" . $tp->toDB($prop_prices) . "'\r\n\t\tWHERE property_id='" . $tp->toDB($_POST['property_id']) . "'");
}
$upd_message = EASYSHOP_ADMIN_PROP_08;
// Property information saved message
}
// Displays the update message to confirm data is stored in database
if (isset($upd_message)) {
$ns->tablerender("", "<div style='text-align:center'><b>" . $upd_message . "</b></div>");
header("Location: admin_properties.php");
}
// ----------------------------------------------------------------------------+
// ---------------------------- Delete records --------------------------------+
// ----------------------------------------------------------------------------+
if ($action == 'delete') {
// Verify deletion before actual delete
$delete_text = "\r\n <br /><br />\r\n <center>\r\n " . EASYSHOP_ADMIN_PROP_15 . "\r\n <br /><br />\r\n <table width='100'>\r\n <tr>\r\n <td>\r\n <a href='admin_properties.php?delete_final." . $action_id . "'>" . EASYSHOP_ADMIN_PROP_16 . "</a>\r\n </td>\r\n <td>\r\n <a href='admin_properties.php'>" . EASYSHOP_ADMIN_PROP_17 . "</a>\r\n </td>\r\n </tr>\r\n </table>\r\n </center>";
示例3: db
function convert_rating()
{
global $plugintable;
$plugintable = "pcontent";
if (!is_object($sqlcr)) {
$sqlcr = new db();
}
$numr = $sqlcr->db_Count("rate", "(*)", "WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') ");
if ($numr > 0) {
$sqlcr->db_Update("rate", "rate_table = '" . $plugintable . "' WHERE (rate_table = 'article' || rate_table = 'review' || rate_table = 'content') ");
}
}
示例4: class_remove
/**
* Removes all users in list from a specified user class
* (Moved in from e_userclass class)
* @param integer $cid - user class ID
* @param $uinfoArray is array(uid=>user_class) - list of affected users
* @return none
*/
public function class_remove($cid, $uinfoArray)
{
$e107 = e107::getInstance();
$uc_sql = new db();
foreach ($uinfoArray as $uid => $curclass) {
$newarray = array_diff(explode(',', $curclass), array('', $cid));
$new_userclass = implode(',', $newarray);
$uc_sql->db_Update('user', "user_class='" . $e107->tp->toDB($new_userclass, true) . "' WHERE user_id=" . intval($uid));
}
}
示例5: unset
// e.g. 06
$day_till = $tmp[2];
// e.g. 30
unset($tmp);
// unset the arrays, so next time tmp will be determined as new
$_POST['discount_valid_till'] = mktime(23, 59, 59, $month_till, $day_till, $year_till);
// Till end of day
}
if (isset($_POST['create_new'])) {
// Create a new record in Discounts table
$sql->db_Insert(easyshop_discount, "0,\n '" . $tp->toDB($_POST['discount_name']) . "',\n\t\t'" . $tp->toDB($_POST['discount_class']) . "',\n\t\t'" . $tp->toDB($_POST['discount_flag']) . "',\n\t\t'" . $tp->toDB($discount_price) . "',\n\t\t'" . $tp->toDB($discount_percentage) . "',\n\t\t'" . $tp->toDB($_POST['discount_valid_from']) . "',\n\t\t'" . $tp->toDB($_POST['discount_valid_till']) . "',\n\t\t'" . $tp->toDB(trim($_POST['discount_code'])) . "'\n ") or die(mysql_error());
}
if (isset($_POST['update_disc'])) {
// Update the existing record in Discounts table
// Actual update
$sql->db_Update(easyshop_discount, "discount_name='" . $tp->toDB($_POST['discount_name']) . "',\n\t\tdiscount_class='" . intval($tp->toDB($_POST['discount_class'])) . "',\n\t\tdiscount_flag='" . $tp->toDB($_POST['discount_flag']) . "',\n\t\tdiscount_price='" . $tp->toDB($discount_price) . "',\n\t\tdiscount_percentage='" . $tp->toDB($discount_percentage) . "',\n\t\tdiscount_valid_from='" . $tp->toDB($_POST['discount_valid_from']) . "',\n\t\tdiscount_valid_till='" . $tp->toDB($_POST['discount_valid_till']) . "',\n\t\tdiscount_code='" . $tp->toDB(trim($_POST['discount_code'])) . "'\n\t\tWHERE discount_id='" . $tp->toDB($_POST['discount_id']) . "'");
}
$upd_message = EASYSHOP_ADMIN_DISC_13;
// Discount information saved message
}
// Displays the update message to confirm data is stored in database
if (isset($upd_message)) {
$ns->tablerender("", "<div style='text-align:center'><b>" . $upd_message . "</b></div>");
header("Location: admin_discounts.php");
}
// ----------------------------------------------------------------------------+
// ---------------------------- Delete records --------------------------------+
// ----------------------------------------------------------------------------+
if ($action == 'delete') {
// Verify deletion before actual delete
$delete_text = "\n <br /><br />\n <center>\n " . EASYSHOP_ADMIN_DISC_20 . "\n <br /><br />\n <table width='100'>\n <tr>\n <td>\n <a href='admin_discounts.php?delete_final." . $action_id . "'>" . EASYSHOP_ADMIN_DISC_21 . "</a>\n </td>\n <td>\n <a href='admin_discounts.php'>" . EASYSHOP_ADMIN_DISC_22 . "</a>\n </td>\n </tr>\n </table>\n </center>";
示例6: editPost
//.........这里部分代码省略.........
if ($tempDate == 1) {
$dateCreated = $content->structMem('dateCreated')->serialize();
// Not all clients send dateCreated info. So add if statement here if you want to use it.
$timestamp = iso8601_decode($dateCreated);
// To convert to unix timestamp
} else {
$timestamp = time();
}
//22/10/2009 11.51.54 added $mt_excerpt
//add the news summary
//check if we have something...
$tempExcerpt = checkXmlElementS($content->serialize(), 'mt_excerpt');
if ($tempExcerpt == 1) {
$mt_excerpt = $content->structMem('mt_excerpt')->scalarval();
}
//22/10/2009 11.51.54 added $mt_allow_comments
//add the news_allow_comments flag
//check if we have something...
$tempAllowComments = checkXmlElementS($content->serialize(), 'mt_allow_comments');
if ($tempAllowComments == 1) {
$mt_allow_comments = $content->structMem('mt_allow_comments')->scalarval();
}
//26/10/2009 14.30.41 added mt_keywords ie tags
//check if we have something...
$tempKeywords = checkXmlElementS($content->serialize(), 'mt_keywords');
if ($tempKeywords == 1) {
$mt_keywords = $content->structMem('mt_keywords')->scalarval();
}
//author from e107
$query = 'SELECT u.user_id FROM `#user` AS u WHERE u.user_loginname = \'' . $username . '\' AND u.user_password = \'' . md5($password) . '\'';
$sql = new db();
$sql->db_Select_gen($query);
$row = $sql->db_Fetch();
$author = $row['user_id'];
if ($content->structMem('categories')->arraySize() > 0) {
$categories = $content->structMem('categories')->arrayMem(0)->scalarval();
//try to read out the id of the category
if ($categories != '') {
$query = 'SELECT c.category_id FROM `#news_category` AS c WHERE c.category_name = \'' . $categories . '\'';
$sql->db_Select_gen($query);
$row = $sql->db_Fetch();
$categories = $row['category_id'];
}
}
$published = $xmlrpcmsg->getParam(4)->scalarval();
// TODO use:
// $ix = new news;
// $ret = $ix->submit_item($arrayvalues);
//edit data with new fuctions
$data = array();
//to update we need to set news id...
$data['data']['news_id'] = $postid;
$data['_FIELD_TYPES']['news_id'] = 'int';
$data['data']['news_title'] = $title;
$data['_FIELD_TYPES']['news_title'] = 'todb';
$data['data']['news_body'] = $description;
$data['_FIELD_TYPES']['news_body'] = 'todb';
$data['data']['news_extended'] = $mt_text_more;
$data['_FIELD_TYPES']['news_extended'] = 'todb';
$data['data']['news_datestamp'] = $timestamp;
$data['_FIELD_TYPES']['news_datestamp'] = 'int';
$data['data']['news_author'] = $author;
$data['_FIELD_TYPES']['news_author'] = 'int';
$data['data']['news_category'] = $categories;
//category id is taken by a query against news categories
$data['_FIELD_TYPES']['news_category'] = 'int';
$data['data']['news_allow_comments'] = $mt_allow_comments;
$data['_FIELD_TYPES']['news_allow_comments'] = 'int';
$data['data']['news_start'] = '';
//NOT AVAIBLE MAKE A CUSTOM FIELD?
$data['_FIELD_TYPES']['news_start'] = 'int';
$data['data']['news_end'] = '';
//NOT AVAIBLE MAKE A CUSTOM FIELD?
$data['_FIELD_TYPES']['news_end'] = 'int';
//$data['data']['news_class'] = $news['news_class'];
//$data['_FIELD_TYPES']['news_class'] = 'todb';
$data['data']['news_render_type'] = eXMLRPC_NEWS_RENDER_TYPE_LOC;
//from preferences
$data['_FIELD_TYPES']['news_render_type'] = 'int';
//news_comment_total
$data['data']['news_summary'] = $mt_excerpt;
//NOT AVAIBLE MAKE A CUSTOM FIELD?
$data['_FIELD_TYPES']['news_summary'] = 'todb';
$data['data']['news_thumbnail'] = '';
//NOT APPLICABLE?
$data['_FIELD_TYPES']['news_thumbnail'] = 'todb';
$data['data']['news_sticky'] = '';
//NOT AVAIBLE MAKE A CUSTOM FIELD?
$data['_FIELD_TYPES']['news_sticky'] = 'int';
$data['data']['news_meta_keywords'] = $mt_keywords;
$data['_FIELD_TYPES']['news_meta_keywords'] = 'todb';
$data['data']['news_meta_description'] = '';
//NOT AVAIBLE MAKE A CUSTOM FIELD?
$data['_FIELD_TYPES']['news_meta_description'] = 'todb';
$postid = $sql->db_Update('news', $data);
return new xmlrpcresp(new xmlrpcval(true, 'boolean'));
} else {
return new xmlrpcresp(0, $xmlrpcerruser + 1, 'Login Failed');
}
}
示例7: class_add
/**
* Adds all users in list to a specified user class
* (Moved in from e_userclass class)
* @param integer $cid - user class ID
* @param $uinfoArray is array(uid=>user_class) - list of affected users
* @return none
*/
public function class_add($cid, $uinfoArray)
{
$e107 = e107::getInstance();
$uc_sql = new db();
foreach ($uinfoArray as $uid => $curclass) {
if ($curclass) {
$newarray = array_unique(array_merge(explode(',', $curclass), array($cid)));
$new_userclass = implode(',', $newarray);
} else {
$new_userclass = $cid;
}
$uc_sql->db_Update('user', "user_class='" . e107::getParser()->toDB($new_userclass, true) . "' WHERE user_id=" . intval($uid));
}
}
示例8: db
function view_subscribers($p_id)
{
$ns = e107::getRender();
$mes = e107::getMessage();
$frm = e107::getForm();
$nl_sql = new db();
$_nl_sanatized = '';
if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) {
$mes->addError(NLLAN_56);
$vs_text .= "<div class='buttons-bar center'>\n\t\t\t\t\t\t\t<input class='btn btn-default button' type=button value='" . LAN_BACK . "' onClick=\"window.location='" . e_SELF . "'\">\n\t\t\t\t\t\t</div>";
$ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text);
return;
} else {
$vs_text .= "\n\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table class='table adminlist'>\n\t\t\t<colgroup>\n\t\t\t\t<col style='width: 5%; text-align: center;' />\n\t\t\t\t<col style='width: 35%;' />\n\t\t\t\t<col style='width: 45%;' />\n\t\t\t\t<col style='width: 15%; text-align: center;' />\n\t\t\t</colgroup>\n\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . LAN_ID . "</td>\n\t\t\t\t\t<td>" . LAN_NAME . "</td>\n\t\t\t\t\t<td>" . LAN_EMAIL . "</td>\n\t\t\t\t\t<td>" . LAN_OPTIONS . "</td>\n\t\t\t\t</tr>";
if ($nl_row = $nl_sql->db_Fetch()) {
$subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
sort($subscriber_list);
$subscribers_total_count = count($subscribers_list) - 1;
// Get a null entry as well
}
if ($subscribers_total_count < 1) {
header("location:" . e_SELF);
exit;
}
// Loop through each user in the array subscribers_list & sanatize
$_last_subscriber = '';
foreach ($subscribers_list as $val) {
$val = trim($val);
if ($val) {
if ($val != $_last_subscriber) {
$nl_sql->db_Select("user", "*", "user_id=" . $val);
if ($nl_row = $nl_sql->db_Fetch()) {
$vs_text .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>" . $val . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a></td>\n\t\t\t\t\t\t\t\t<td>" . $nl_row['user_email'] . "</td>\n\t\t\t\t\t\t\t\t<td><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "</td>\n\t\t\t\t\t\t\t</tr>";
$_last_subscriber = $val;
}
} else {
// Duplicate user id found in the subscribers_list array!
newsletter::remove_subscribers($p_id, $val);
// removes all entries for this user id
$newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val;
// keep this single value in the list
$nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'");
$subscribers_total_count--;
$_nl_sanatized = 1;
}
}
}
}
$vs_text .= "\n\t\t<tr>\n\t\t\t<td colspan='4'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t</tr>\n\t\t </table>\n\t\t\t <div class='buttons-bar center'>\n\t\t\t \t" . $frm->admin_button('submit', LAN_BACK, 'submit') . "\n\t\t\t </div>\t\t\t\n\t\t </form>\n\t\t ";
if ($_nl_sanatized == 1) {
$mes->addInfo(NLLAN_66);
}
$ns->tablerender(NLLAN_65 . ' ' . $p_id, $mes->render() . $vs_text);
}
示例9: UpdateContentPref
function UpdateContentPref($id)
{
global $qs, $plugintable, $sql, $tp;
if (!is_object($sql)) {
$sql = new db();
}
//insert default preferences into core
if ($id == "0") {
$num_rows = $sql->db_Select("core", "*", "e107_name='{$plugintable}' ");
if ($num_rows == 0) {
$sql->db_Insert("core", "'{$plugintable}', '' ");
} else {
$row = $sql->db_Fetch();
}
//prepare custom tags: use the posted value
$cp = $_POST['content_custom_preset_key'];
//insert category preferences into plugintable
} else {
//first get the existing prefs and parent
$sql->db_Select($plugintable, "content_pref, content_parent", "content_id='" . intval($id) . "' ");
$row = $sql->db_Fetch();
$current = e107::unserialize($row['content_pref']);
//$current = $eArrayStorage->ReadxxxArray($row['content_pref']);
$currentparent = $row['content_parent'];
//if we are updating options
if (isset($qs[0]) && $qs[0] == 'options') {
//only use the manager prefs from the existing set
foreach ($current as $k => $v) {
if (strpos($k, "content_manager_") === 0 || strpos($k, "content_restrict_") === 0) {
$content_pref[$k] = $tp->toDB($v);
}
}
//prepare custom tags: use the posted values
$cp = $_POST['content_custom_preset_key'];
//if we are updating manager
} elseif (isset($qs[0]) && ($qs[0] == 'manager' || $qs[0] == 'restrict')) {
//if this is a top level category we need to keep all existing options
if ($currentparent == '0') {
$content_pref = $current;
}
//prepare custom tags: use the existing content_pref values
$cp = $content_pref['content_custom_preset_key'];
}
}
//parse custom tags and covert them in $_POST values ($cp is derived above)
$string = array();
foreach ($cp as $ck => $cv) {
if (!empty($cv)) {
$string[] = $cv;
}
}
if (is_array($string) && !empty($string[0])) {
$_POST['content_custom_preset_key'] = $string;
}
//convert all $_POST to $content_pref for storage, and renew the existing stored prefs
foreach ($_POST as $k => $v) {
if (strpos($k, "content_") === 0) {
$content_pref[$k] = $tp->toDB($v);
}
}
//create new array of preferences
$tmp = e107::serialize($content_pref, true);
//$tmp = $eArrayStorage->WritexxxArray($content_pref);
//update core table
if ($id == "0") {
$sql->db_Update("core", "e107_value = '{$tmp}' WHERE e107_name = '{$plugintable}' ");
//update plugin table
} else {
$sql->db_Update($plugintable, "content_pref='{$tmp}' WHERE content_id='" . intval($id) . "' ");
}
return $content_pref;
}
示例10: menuScanMenus
function menuScanMenus()
{
global $sql, $sql2;
$efile = new e_file();
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
$fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2);
foreach ($fileList as $file) {
list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path']));
$file['path'] = str_replace(e_PLUGIN, "", $file['path']);
$file['fname'] = str_replace(".php", "", $file['fname']);
$valid_menu = FALSE;
$existing_menu = $sql->db_Count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) {
if (e107::isInstalled($parent_dir)) {
// Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
$valid_menu = TRUE;
// Whether new or existing, include in list
// echo "Include {$parent_dir}:{$file['fname']}<br />";
}
} else {
$valid_menu = TRUE;
// echo "Default Include {$parent_dir}:{$file['fname']}<br />";
}
if ($valid_menu) {
$menustr .= "&" . str_replace(".php", "", $file['fname']);
if (!$existing_menu) {
$insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => '');
if ($sql->db_Insert("menus", $insert)) {
// Could do admin logging here - but probably not needed
$message .= MENLAN_10 . " - " . $file['fname'] . "<br />";
}
}
}
}
//Reorder all menus into 1...x order
if (!is_object($sql2)) {
$sql2 = new db();
}
// Shouldn't be needed
foreach ($this->menu_areas as $menu_act) {
if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC")) {
$c = 1;
while ($row = $sql->db_Fetch()) {
$sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']);
$c++;
}
}
}
$sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM)) {
if (stristr($menustr, $menu_name) === FALSE) {
$sql2->db_Delete("menus", "menu_name='{$menu_name}'");
$message .= MENLAN_11 . " - " . $menu_name . "<br />";
}
}
$this->menuAddMessage($message, E_MESSAGE_INFO);
}
示例11: db
// Change item active status
$sql2 = new db();
$sql2->db_Update(DB_TABLE_SHOP_ITEMS, "item_active_status='1'\n\t\t\tWHERE category_id='" . intval($tp->toDB($_POST['category_id'])) . "'");
foreach ($_POST['item_active_status'] as $value) {
$sql2->db_Update(DB_TABLE_SHOP_ITEMS, "item_active_status='2'\n\t\t\t\tWHERE item_id='" . intval($tp->toDB($value)) . "'");
}
// Change item 'Out Of Stock' status
$sql3 = new db();
$sql3->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock='1'\n\t \t WHERE category_id='" . intval($tp->toDB($_POST['category_id'])) . "'");
foreach ($_POST['item_out_of_stock'] as $value) {
$sql3->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock='2'\n WHERE item_id='" . intval($tp->toDB($value)) . "'");
}
// Change item 'Out Of Stock' explanation
$sql4 = new db();
foreach ($_POST['item_out_of_stock_explanation'] as $key => $value) {
$sql4->db_Update(DB_TABLE_SHOP_ITEMS, "item_out_of_stock_explanation='" . $tp->toDB($value) . "'\n WHERE item_id='" . intval($tp->toDB($key)) . "'");
}
header("Location: " . e_SELF);
exit;
} else {
if ($_POST['edit_item'] == '2') {
//-----------------------------------------------------------------------------+
//----------------------- Edit existing product -------------------------------+
//-----------------------------------------------------------------------------+
// Pushed 'Apply Changes' button on Edit Product
// Check: name is mandatory
if ($tp->toDB($_POST['item_name']) == "") {
$text .= EASYSHOP_CONFEDIT_ITM_10 . "<br />";
}
// First check on valid pricing
if (General::validateDecimal($tp->toDB($_POST['item_price']))) {
示例12: menuScanMenus
function menuScanMenus()
{
global $sql2;
$sql = e107::getDb();
$efile = new e_file();
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
$fileList = $efile->get_files(e_PLUGIN, "_menu\\.php\$", 'standard', 2);
$this->menuAddMessage('Scanning for new menus', E_MESSAGE_DEBUG);
$menuList = array();
// existing menus in table.
if ($result = $sql->retrieve('menus', 'menu_name', null, true)) {
foreach ($result as $mn) {
if ($mn['menu_name']) {
$menuList[] = $mn['menu_name'];
}
}
}
//v2.x Scan Custom Page Menus.
$pageMenus = $sql->retrieve('page', 'page_id, menu_name, menu_title', "menu_name !='' ", true);
foreach ($pageMenus as $row) {
if (!in_array($row['menu_name'], $menuList)) {
$insert = array('menu_id' => 0, 'menu_name' => $row['menu_name'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $row['page_id'], 'menu_layout' => '', 'menu_parms' => '');
if ($sql->insert("menus", $insert)) {
$this->menuAddMessage(MENLAN_10 . " - " . $row['menu_name'], E_MESSAGE_DEBUG);
}
}
}
foreach ($fileList as $file) {
list($parent_dir) = explode('/', str_replace(e_PLUGIN, "", $file['path']));
$file['path'] = str_replace(e_PLUGIN, "", $file['path']);
$file['fname'] = str_replace(".php", "", $file['fname']);
$valid_menu = FALSE;
$existing_menu = in_array($file['fname'], $menuList);
// $sql->count("menus", "(*)", "WHERE menu_name='{$file['fname']}'");
if (file_exists(e_PLUGIN . $parent_dir . '/plugin.xml') || file_exists(e_PLUGIN . $parent_dir . '/plugin.php')) {
if (e107::isInstalled($parent_dir)) {
// Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
$valid_menu = TRUE;
// Whether new or existing, include in list
// echo "Include {$parent_dir}:{$file['fname']}<br />";
}
} else {
$valid_menu = TRUE;
// echo "Default Include {$parent_dir}:{$file['fname']}<br />";
}
if ($valid_menu) {
$menustr .= "&" . str_replace(".php", "", $file['fname']);
if (!$existing_menu) {
$insert = array('menu_id' => 0, 'menu_name' => $file['fname'], 'menu_location' => 0, 'menu_order' => 0, 'menu_class' => 0, 'menu_pages' => '', 'menu_path' => $file['path'], 'menu_layout' => '', 'menu_parms' => '');
if ($sql->insert("menus", $insert)) {
// Could do admin logging here - but probably not needed
$message .= MENLAN_10 . " - " . $file['fname'] . "<br />";
//FIXME
} else {
$this->menuAddMessage("Couldn't add menu: " . $file['fname'] . " to table ", E_MESSAGE_DEBUG);
}
}
}
}
//Reorder all menus into 1...x order
if (!is_object($sql2)) {
$sql2 = new db();
}
// Shouldn't be needed
if (!is_object($sql3)) {
$sql3 = new db();
}
$location_count = $sql3->select("menus", "menu_location", "menu_location>0 GROUP BY menu_location");
while ($location_count) {
if ($sql->select("menus", "menu_id", "menu_location={$location_count} ORDER BY menu_order ASC")) {
$c = 1;
while ($row = $sql->fetch()) {
$sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=" . $row['menu_id']);
$c++;
}
}
$location_count--;
}
$sql->select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->fetch(MYSQL_NUM)) {
if (stristr($menustr, $menu_name) === FALSE) {
$sql2->db_Delete("menus", "menu_name='{$menu_name}'");
$message .= MENLAN_11 . " - " . $menu_name . "<br />";
}
}
$this->menuAddMessage(vartrue($message), E_MESSAGE_DEBUG);
}
示例13: update_stock
function update_stock($txn_id = NULL, $phpsessionid = NULL)
{
global $pref;
$sqlcheck = new db();
$trans_array = transaction($phpsessionid, 0, 0, "Completed");
$items_array = unserialize($trans_array['all_items']);
$count = 1;
$temp_array = "";
while ($items_array["db_id_" . $count]) {
if ($sqlcheck->db_Select("easyshop_items", "*", "item_id = '" . $items_array["db_id_" . $count] . "'")) {
while ($row = $sqlcheck->db_Fetch()) {
if ($row['item_track_stock'] == 2) {
// Is this a tracked stock item?
if ($row['item_instock'] >= $items_array["quantity" . $count]) {
$newstock = $row['item_instock'] - $items_array["quantity_" . $count];
if ($row['item_minimum'] == 0 || $row['item_minimum'] == NULL) {
// Minimum level is flexible, but with bottom-level 1.
$minimum_level = 1;
} else {
$minimum_level = $row['item_minimum'];
}
if ($newstock <= $minimum_level && $newstock != 0) {
// Minimum level is reached; send e-mail alert
ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 1);
// Alert-type = 1
}
if ($newstock == 0) {
$sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'");
ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 3);
// Alert-type = 3
} else {
$sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'");
}
} else {
// There is a problem; client has paid for more items than are in stock
// Raise out of stock flag and send email
$sqlcheck->db_Update("easyshop_items", "item_instock = '0', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'");
ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 2);
// Alert-type = 2
}
}
if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && $trans_array['ipn_user_id'] > 0) {
// Auto promotion of user
$sqlcheck2 = new db();
$sqlcheck3 = new db();
require_once e_HANDLER . 'userclass_class.php';
$promo_class_name = r_userclass_name($row['prod_promo_class']);
$sqlcheck2->db_Select("user", "*", "user_id='" . $trans_array['ipn_user_id'] . "'");
if ($row2 = $sqlcheck2->db_Fetch()) {
$user_name = $row2['user_name'];
$class_extant = explode(',', $row2['user_class']);
foreach ($class_extant as $key => $value) {
if (intval($value) == 0) {
unset($class_extant[$key]);
}
}
if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && !in_array($row['prod_promo_class'], $class_extant)) {
$class_extant[] = $row['prod_promo_class'];
}
$new_array = array_unique($class_extant);
sort($new_array);
$class_list = implode(',', $new_array);
$sqlcheck3->db_Update("user", "user_class='" . $class_list . "' where user_id='" . $trans_array['ipn_user_id'] . "'");
$mailto = !(isset($pref['siteadminemail']) && strlen($pref['siteadminemail']) == 0) ? $pref['replyto_email'] : $pref['siteadminemail'];
// Keep 0.7.8 compatible
$subject = $pref['sitename'] . ": " . EASYSHOP_IPN_30;
// [USERNAME] upgraded to class [PROMOCLASS]
$subject = str_replace("[USERNAME]", $user_name, $subject);
$subject = str_replace("[PROMOCLASS]", $promo_class_name, $subject);
$message = EASYSHOP_IPN_31 . "<br /><br />";
$message .= EASYSHOP_IPN_32 . "<br /><br />";
$message .= EASYSHOP_IPN_33 . "<br />";
$message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl'];
$message .= "<br /><br />© " . date("Y") . " EasyShop";
$message = str_replace("[USERNAME]", $row2['user_name'], $message);
$message = str_replace("[USERLINK]", SITEURL . "user.php?id." . $trans_array['ipn_user_id'], $message);
$message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $message);
$message = str_replace("[TRANSACTIONID]", $trans_array['txn_id'], $message);
$message = str_replace("[PRODUCTPRICE]", $items_array["amount_" . $count], $message);
$message = str_replace("[PRODUCTQTY]", $items_array["quantity_" . $count], $message);
$message = str_replace("[CURRENCY]", $trans_array['mc_currency'], $message);
$message = str_replace("[GROSSAMOUNT]", $trans_array['mc_gross'], $message);
$message = str_replace("[PAYMENTDATE]", $trans_array['payment_date'], $message);
$message = str_replace("[PRODLINK]", SITEURL . e_PLUGIN . "easyshop/easyshop.php?prod." . $items_array["db_id_" . $count], $message);
$message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $message);
$user_message = EASYSHOP_IPN_35;
$user_message .= "<br />" . EASYSHOP_IPN_36;
$user_message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl'];
$user_message .= "<br /><br />© " . date("Y") . " EasyShop";
$user_message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $user_message);
$user_message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $user_message);
//ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name);
if ($row2['user_class'] != $class_list) {
// Only send an e-mail if the user_class array actually changed
ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name);
// Mail to admin
ShopMail::easyshop_sendemail($row2['user_email'], $subject, $user_message, $headers2, $attachment_name);
// Mail to user
}
}
//.........这里部分代码省略.........
示例14: displayPersonalManager
function displayPersonalManager()
{
global $qs, $sql, $sql2, $lc, $link_shortcodes, $cobj, $row, $from, $tp, $ns, $linkspage_pref;
global $LINK_TABLE_MANAGE_START, $LINK_TABLE_MANAGE, $LINK_TABLE_MANAGE_END;
if (!(isset($linkspage_pref['link_manager']) && $linkspage_pref['link_manager'])) {
js_location(e_SELF);
}
//delete link
if (isset($linkspage_pref['link_directdelete']) && $linkspage_pref['link_directdelete']) {
if (isset($_POST['delete'])) {
$tmp = array_pop(array_flip($_POST['delete']));
list($delete, $del_id) = explode("_", $tmp);
}
if (isset($delete) && $delete == 'main') {
$sql->db_Select("links_page", "link_category, link_order, link_author", "link_id='" . intval($del_id) . "'");
// Get the position of target in the order
$row = $sql->db_Fetch();
if ($row['link_author'] != USERID) {
header('Location: ' . SITEURL);
exit;
}
if (!is_object($sql2)) {
$sql2 = new db();
}
$sql->db_Select("links_page", "link_id", "link_order>'" . $row['link_order'] . "' && link_category='" . intval($row['link_category']) . "'");
while ($row = $sql->db_Fetch()) {
$sql2->db_Update("links_page", "link_order=link_order-1 WHERE link_id='" . $row['link_id'] . "'");
}
if ($sql->db_Delete("links_page", "link_id='" . intval($del_id) . "'")) {
$lc->show_message(LCLAN_ADMIN_10 . " #" . $del_id . " " . LCLAN_ADMIN_11);
}
}
}
//upload link icon
if (isset($_POST['uploadlinkicon'])) {
$lc->uploadLinkIcon();
}
//show existing links
if (!check_class($linkspage_pref['link_manager_class'])) {
js_location(e_SELF);
} else {
$qry = "\n\t\tSELECT l.*, lc.*\n\t\tFROM #links_page AS l\n\t\tLEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category\n\t\tWHERE l.link_author = '" . USERID . "'\n\t\tORDER BY l.link_name\n\t\t";
$link_table_manage = "";
if (!($manager_total = $sql->db_Select_gen($qry))) {
$text = LAN_LINKS_MANAGER_4;
} else {
$link_table_manage_start = $tp->parseTemplate($LINK_TABLE_MANAGE_START, FALSE, $link_shortcodes);
while ($row = $sql->db_Fetch()) {
$link_table_manage .= $tp->parseTemplate($LINK_TABLE_MANAGE, FALSE, $link_shortcodes);
}
$link_table_manage_end = $tp->parseTemplate($LINK_TABLE_MANAGE_END, FALSE, $link_shortcodes);
$text = $link_table_manage_start . $link_table_manage . $link_table_manage_end;
}
$ns->tablerender(LAN_LINKS_35, $text);
//show link create
$lc->show_link_create();
}
return;
}
示例15: db
function view_subscribers($p_id)
{
$nl_sql = new db();
$_nl_sanatized = '';
if (!$nl_sql->db_Select('newsletter', '*', 'newsletter_id=' . $p_id)) {
// Check if newsletter id is available
$vs_text .= "<br /><br /><span style='text-align:center'>" . NLLAN_56 . "<br /><br/>\n\t\t\t\t\t <input class='button' type=button value='" . NLLAN_57 . "' onClick=\"window.location='" . e_SELF . "'\"></span>";
$ns->tablerender(NLLAN_58, $vs_text);
return;
} else {
$vs_text .= "\n\t\t\t\t<form action='" . e_SELF . "' id='newsletterform' method='post'>\n\t\t\t<table style='" . ADMIN_WIDTH . "' class='fborder'>\n\t\t\t\t<tr>\n\t\t\t\t<td style='width:5%; text-align: center;' class='forumheader'>" . NLLAN_55 . "</td>\n\t\t\t\t<td style='width:35%' class='forumheader'>" . NLLAN_59 . "</td>\n\t\t\t\t<td style='width:45%;' class='forumheader'>" . NLLAN_60 . "</td>\n\t\t\t\t<td style='width:15%; text-align: center;' class='forumheader'>" . NLLAN_61 . "</td>\n\t\t\t\t</tr>";
if ($nl_row = $nl_sql->db_Fetch()) {
$subscribers_list = explode(chr(1), trim($nl_row['newsletter_subscribers']));
sort($subscriber_list);
$subscribers_total_count = count($subscribers_list) - 1;
// Get a null entry as well
}
if ($subscribers_total_count < 1) {
header("location:" . e_SELF);
exit;
}
// Loop through each user in the array subscribers_list & sanatize
$_last_subscriber = '';
foreach ($subscribers_list as $val) {
$val = trim($val);
if ($val) {
if ($val != $_last_subscriber) {
$nl_sql->db_Select("user", "*", "user_id=" . $val);
if ($nl_row = $nl_sql->db_Fetch()) {
$vs_text .= "<tr>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'>{$val}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'><a href='" . e_BASE . "user.php?id.{$val}'>" . $nl_row['user_name'] . "</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $nl_row['user_email'] . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td style='text-align: center;' class='forumheader3'><a href='" . e_SELF . "?remove.{$p_id}.{$val}'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t\t\t\t\t" . ($nl_row['user_ban'] > 0 ? NLLAN_62 : "") . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>";
$_last_subscriber = $val;
}
} else {
// Duplicate user id found in the subscribers_list array!
newsletter::remove_subscribers($p_id, $val);
// removes all entries for this user id
$newsletterArray[$p_id]['newsletter_subscribers'] = chr(1) . $val;
// keep this single value in the list
$nl_sql->db_Update("newsletter", "newsletter_subscribers='" . $newsletterArray[$p_id]['newsletter_subscribers'] . "' WHERE newsletter_id='" . intval($p_id) . "'");
$subscribers_total_count--;
$_nl_sanatized = 1;
}
}
}
}
$vs_text .= "\n\t\t <tr>\n\t\t <td colspan='4' class='forumheader'>" . NLLAN_63 . ": " . $subscribers_total_count . "</td>\n\t\t </tr>\n\t\t <tr><td colspan='4' style='text-align:center;'><br /><input class='button' type='submit' value='" . NLLAN_64 . "' /></td></tr>\n\t\t </table></form>\n\t\t ";
if ($_nl_sanatized == 1) {
$vs_text .= "<br /><div style='text-align:center;'>" . NLLAN_66 . "</div>";
}
$this->e107->ns->tablerender(NLLAN_65 . ' ' . $p_id, $vs_text);
}