本文整理汇总了PHP中update_category函数的典型用法代码示例。如果您正苦于以下问题:PHP update_category函数的具体用法?PHP update_category怎么用?PHP update_category使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了update_category函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: category_info
<?php
include 'template/header.php';
include 'template/menu.php';
?>
<?php
if (!empty($_GET['category'])) {
$category_info = category_info($_GET['category']);
if (!empty($category_info)) {
/*************************category update***********************/
if (!empty($_POST['submit'])) {
$update_category = update_category($_GET['category'], $_POST['category_name'], $_POST['category_code_slug']);
if ($update_category == 1) {
$message = "Category has been updated.";
} else {
$errormessage = "Something wrong. Please Try Again!!";
}
}
/*************************end category update***********************/
$all_category = all_category();
//show all category
} else {
header("Location:category.php");
}
} else {
header("Location:category.php");
}
?>
示例2: action_update_category
function action_update_category($db)
{
$id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
$category = filter_input(INPUT_POST, 'category', FILTER_SANITIZE_STRING);
return json_encode(update_category($db, $id, $category));
}
示例3: delete_elements
}
if (count($to_delete_elements) > 0) {
if (!$simulate) {
delete_elements($to_delete_elements);
}
$counts['del_elements'] = count($to_delete_elements);
}
$template->append('footer_elements', '<!-- scanning files : ' . get_elapsed_time($start_files, get_moment()) . ' -->');
}
// +-----------------------------------------------------------------------+
// | synchronize files |
// +-----------------------------------------------------------------------+
if (isset($_POST['submit']) and ($_POST['sync'] == 'dirs' or $_POST['sync'] == 'files') and !$general_failure) {
if (!$simulate) {
$start = get_moment();
update_category('all');
$template->append('footer_elements', '<!-- update_category(all) : ' . get_elapsed_time($start, get_moment()) . ' -->');
$start = get_moment();
update_global_rank();
$template->append('footer_elements', '<!-- ordering categories : ' . get_elapsed_time($start, get_moment()) . ' -->');
}
if ($_POST['sync'] == 'files') {
$start = get_moment();
$opts['category_id'] = '';
$opts['recursive'] = true;
if (isset($_POST['cat'])) {
$opts['category_id'] = $_POST['cat'];
if (!isset($_POST['subcats-included']) or $_POST['subcats-included'] != 1) {
$opts['recursive'] = false;
}
}
示例4: connect_db
<?php
include_once 'config.php';
include_once 'func.php';
$connection = connect_db();
if (isset($_POST['id']) || isset($_POST['name'])) {
echo "success";
update_category($connection, $_POST['id'], $_POST['name']);
}
$result = get_category($connection);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Update Category</title>
</head>
<body>
<div>
<form action="" method="post">
<div>
<select name="id">
<?php
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php
echo $row['id'];
?>
"><?php
echo $row['name'];
?>
示例5: insert_category
$page_title = 'Categories';
// process post actions
// insert category
if (isset($_POST['add_category']) && $_POST['add_category'] == 'add') {
$insert_status = insert_category();
if (is_int($insert_status)) {
$reload = $_SERVER["PHP_SELF"] . '?page_name=categories&category_id=' . $insert_status;
header('Location: ' . $reload);
} else {
$insert_error = $insert_status;
}
}
// edit category
if (isset($_POST['edit_category']) && $_POST['edit_category'] == 'edit') {
$category_id = (int) $_GET['category_id'];
$update_status = update_category($category_id);
if ($update_status === true) {
header('Location: ' . $url);
} else {
$error = $update_status;
}
}
// delete category
if (isset($_POST['confirm_delete_category']) && $_POST['confirm_delete_category'] == 'Yes') {
$category_id = (int) $_GET['category_id'];
$delete_status = delete_category($category_id);
if ($delete_status === true) {
$reload = $_SERVER["PHP_SELF"] . '?page_name=categories';
header('Location: ' . $reload);
} else {
$error = $delete_status;
示例6: cache_delete
cache_delete($moduleid . '.part');
}
foreach ($setting as $k => $v) {
if (strpos($k, 'seo_') === false) {
continue;
}
seo_check($v) or msg('SEO信息包含非法字符');
}
update_setting($moduleid, $setting);
cache_module($moduleid);
if ($setting['php_list_urlid'] != $MOD['php_list_urlid'] || $setting['htm_list_urlid'] != $MOD['htm_list_urlid'] || $setting['htm_list_prefix'] != $MOD['htm_list_prefix'] || $setting['list_html'] != $MOD['list_html']) {
$_MOD = $MOD;
$MOD = $setting;
$result = $db->query("SELECT * FROM {$DT_PRE}category WHERE moduleid={$moduleid}");
while ($r = $db->fetch_array($result)) {
update_category($r);
}
cache_category($moduleid);
$MOD = $_MOD;
}
if ($setting['php_item_urlid'] != $MOD['php_item_urlid'] || $setting['htm_item_urlid'] != $MOD['htm_item_urlid'] || $setting['htm_item_prefix'] != $MOD['htm_item_prefix'] || $setting['show_html'] != $MOD['show_html']) {
msg('设置保存成功,开始更新地址', '?moduleid=' . $moduleid . '&file=html&action=show&update=1&num=1000');
}
dmsg('更新成功', '?moduleid=' . $moduleid . '&file=' . $file . '&tab=' . $tab);
} else {
$r = $db->get_one("SELECT MAX(itemid) AS maxid FROM {$table}");
$maxid = $r['maxid'];
extract(dhtmlspecialchars($MOD));
if ($kw) {
$all = 1;
ob_start();
示例7: associate_images_to_categories
/**
* Associate a list of images to a list of categories.
* The function will not duplicate links and will preserve ranks.
*
* @param int[] $images
* @param int[] $categories
*/
function associate_images_to_categories($images, $categories)
{
if (count($images) == 0 or count($categories) == 0) {
return false;
}
// get existing associations
$query = '
SELECT
image_id,
category_id
FROM ' . IMAGE_CATEGORY_TABLE . '
WHERE image_id IN (' . implode(',', $images) . ')
AND category_id IN (' . implode(',', $categories) . ')
;';
$result = pwg_query($query);
$existing = array();
while ($row = pwg_db_fetch_assoc($result)) {
$existing[$row['category_id']][] = $row['image_id'];
}
// get max rank of each categories
$query = '
SELECT
category_id,
MAX(rank) AS max_rank
FROM ' . IMAGE_CATEGORY_TABLE . '
WHERE rank IS NOT NULL
AND category_id IN (' . implode(',', $categories) . ')
GROUP BY category_id
;';
$current_rank_of = query2array($query, 'category_id', 'max_rank');
// associate only not already associated images
$inserts = array();
foreach ($categories as $category_id) {
if (!isset($current_rank_of[$category_id])) {
$current_rank_of[$category_id] = 0;
}
if (!isset($existing[$category_id])) {
$existing[$category_id] = array();
}
foreach ($images as $image_id) {
if (!in_array($image_id, $existing[$category_id])) {
$rank = ++$current_rank_of[$category_id];
$inserts[] = array('image_id' => $image_id, 'category_id' => $category_id, 'rank' => $rank);
}
}
}
if (count($inserts)) {
mass_inserts(IMAGE_CATEGORY_TABLE, array_keys($inserts[0]), $inserts);
update_category($categories);
}
}
示例8: msg
if ($catid) {
$catids = $catid;
}
$catids or msg();
$do->delete($catids);
$NUM > 200 ? $do->cache() : $do->repair();
dmsg('删除成功', $forward);
break;
case 'update':
if (!$category || !is_array($category)) {
msg();
}
$do->update($category);
foreach ($category as $catid => $v) {
$CATEGORY[$catid] = $db->get_one("SELECT * FROM {$table} WHERE catid={$catid}");
update_category($CATEGORY[$catid]);
}
$NUM > 200 ? $do->cache() : $do->repair();
dmsg('更新成功', $forward);
break;
case 'letters':
$update = false;
foreach ($CATEGORY as $k => $v) {
if (strlen($v['letter']) != 1) {
$letter = $do->get_letter($v['catname'], false);
if ($letter) {
$update = true;
$letter = substr($letter, 0, 1);
$db->query("UPDATE {$table} SET letter='{$letter}' WHERE catid='{$v['catid']}'");
}
}
示例9: update_category
} else {
update_category($category['id'], 'aot', 0);
}
if ($_POST['expanded'][$category['id']] == "on") {
update_category($category['id'], 'expanded', 1);
} else {
update_category($category['id'], 'expanded', 0);
}
}
// Update order
foreach ($_POST['order'] as $id => $order) {
update_category($id, 'order', $order);
}
// Update name
foreach ($_POST['name'] as $id => $name) {
update_category($id, 'name', $name);
}
$success = lang('success_edited_cat');
}
if (isset($_POST['add'])) {
// Convert checkboxes
if ($_POST['aop'] == "on") {
$_POST['aop'] = 1;
} else {
$_POST['aop'] = 0;
}
if ($_POST['aot'] == "on") {
$_POST['aot'] = 1;
} else {
$_POST['aot'] = 0;
}
示例10: session_start
<meta charset="utf-8">
<?php
session_start();
require_once "book_f.php";
?>
<?php
if (check_admin_user()) {
if (isset($_POST['updatecat'])) {
if (update_category($_POST['catid'], $_POST['catname'])) {
echo "Loại sách đã được cập nhật ok<br>";
} else {
echo "Có lỗi. Loại sách không được cập nhật. Error<br>";
}
} else {
echo "Bạn không click updatecat<br>";
}
do_html_url("index.php?dk=admin", "Trở lại trang quản trị");
} else {
echo "Bạn không là admin. Không xem trang này được";
}
?>
示例11: ufdbtables
//.........这里部分代码省略.........
$c = 0;
$FAILED = 0;
$updated = 0;
$GLOBALS["DOWNLOADED_SIZE"] = 0;
@mkdir("/var/lib/ufdbartica", 0755, true);
$CountOfPackages = count($MAIN_ARRAY);
while (list($tablename, $MAIN) = each($MAIN_ARRAY)) {
$c++;
$increment_text = " [{$c}/{$CountOfPackages}]";
$DOWNLOADED_SIZE = FormatBytes($GLOBALS["DOWNLOADED_SIZE"] / 1024);
$ROWS = $MAIN["ROWS"];
$ROWS_TEXT = FormatNumber($ROWS);
$TIME = $MAIN["TIME"];
$MD5SRC = $MAIN["MD5SRC"];
$MD5GZ = $MAIN["MD5GZ"];
$CurrentFile = "/var/lib/ufdbartica/{$tablename}/domains.ufdb";
$CURRENT_MD5 = md5_file($CurrentFile);
$prc = $c / $countDecategories;
$prc = round($prc * 100);
if ($prc > 10) {
if ($prc < 95) {
updatev2_progress($prc, "{checking} {$tablename} ({$ROWS_TEXT} {items}){$increment_text}");
}
}
if ($CURRENT_MD5 == $MD5SRC) {
updatev2_progress($prc, "{skipping} {$tablename} ({$ROWS_TEXT} {items}){$increment_text}");
$LOCAL_ARRAY[$tablename]["ROWS"] = $ROWS;
$LOCAL_ARRAY[$tablename]["TIME"] = $TIME;
$LOCAL_ARRAY[$tablename]["SUCCESS"] = true;
$LOCAL_ARRAY[$tablename]["MD5SRC"] = $CURRENT_MD5;
$LOCAL_ARRAY[$tablename]["SIZE"] = @filesize($CurrentFile);
@file_put_contents($CACHE_FILE, serialize($LOCAL_ARRAY));
continue;
}
updatev2_progress($prc, "{updating} {$tablename} ({$DOWNLOADED_SIZE}) ({$ROWS_TEXT} {items}){$increment_text}");
if (!update_category("{$URIBASE}/{$tablename}.gz", $tablename, $MD5GZ, $MD5SRC, $prc, $increment_text)) {
updatev2_progress($prc, "{update_failed} {$tablename}");
$LOCAL_ARRAY[$tablename]["SUCCESS"] = false;
$FAILED++;
if ($FAILED > 5) {
updatev2_progress(110, "{too_many_errors} {aborting}");
return;
}
continue;
}
$DOWNLOADED_SIZE = FormatBytes($GLOBALS["DOWNLOADED_SIZE"] / 1024);
updatev2_progress($prc, "{success} {$tablename} ({$DOWNLOADED_SIZE})");
$LOCAL_ARRAY[$tablename]["ROWS"] = $ROWS;
$LOCAL_ARRAY[$tablename]["TIME"] = $TIME;
$LOCAL_ARRAY[$tablename]["UPDATED"] = time();
$LOCAL_ARRAY[$tablename]["SUCCESS"] = true;
$LOCAL_ARRAY[$tablename]["MD5SRC"] = md5_file($CurrentFile);
$LOCAL_ARRAY[$tablename]["SIZE"] = @filesize($CurrentFile);
@file_put_contents($CACHE_FILE, serialize($LOCAL_ARRAY));
$updated++;
}
if ($updated > 0) {
artica_update_event(2, "Success update {$updated} Licensed Webfiltering databases", null, __FILE__, __LINE__);
squid_admin_mysql(2, "Success update {$updated} Licensed Webfiltering databases", null, __FILE__, __LINE__);
squid_admin_mysql(2, "Reloading Web filtering services", null, __FILE__, __LINE__);
shell_exec("/etc/init.d/ufdb reload");
shell_exec("/etc/init.d/ufdbcat reload");
}
updatev2_progress(96, "{verify}");
reset($MAIN_ARRAY);
while (list($tablename, $MAIN) = each($MAIN_ARRAY)) {
$ROWS = $MAIN["ROWS"];
$ROWS_TEXT = FormatNumber($ROWS);
$TIME = $MAIN["TIME"];
$MD5SRC = $MAIN["MD5SRC"];
$MD5GZ = $MAIN["MD5GZ"];
$CurrentFile = "/var/lib/ufdbartica/{$tablename}/domains.ufdb";
echo "{$tablename}\n";
$unix->events("Verify: {$tablename} [{$MD5SRC}]", "/var/log/artica-ufdb.log", false, __FUNCTION__, __LINE__, __FILE__);
if (!is_file($CurrentFile)) {
$unix->events("Verifiy: {$tablename} {$CurrentFile} no such file", "/var/log/artica-ufdb.log", false, __FUNCTION__, __LINE__, __FILE__);
echo "{$CurrentFile} no such file\n";
$LOCAL_ARRAY[$tablename]["SUCCESS"] = false;
updatev2_progress(96, "{$tablename} {failed}");
continue;
}
$md5db = md5_file($CurrentFile);
if ($md5db != $MD5SRC) {
$unix->events("Verifiy: {$tablename} {$CurrentFile} MD5 differ {$md5db}<>{$MD5SRC}", "/var/log/artica-ufdb.log", false, __FUNCTION__, __LINE__, __FILE__);
echo "{$CurrentFile} MD5 differ\n";
$LOCAL_ARRAY[$tablename]["SUCCESS"] = false;
updatev2_progress(96, "{$tablename} {failed}");
continue;
}
$unix->events("Verifiy: {$tablename} success...", "/var/log/artica-ufdb.log", false, __FUNCTION__, __LINE__, __FILE__);
$LOCAL_ARRAY[$tablename]["SUCCESS"] = true;
$LOCAL_ARRAY[$tablename]["MD5SRC"] = $md5db;
$LOCAL_ARRAY[$tablename]["SIZE"] = @filesize($CurrentFile);
$LOCAL_ARRAY[$tablename]["ROWS"] = $ROWS;
$LOCAL_ARRAY[$tablename]["TIME"] = $TIME;
$LOCAL_ARRAY[$tablename]["UPDATED"] = time();
}
@file_put_contents($CACHE_FILE, serialize($LOCAL_ARRAY));
updatev2_progress(99, "{done}");
}
示例12: implode
$query = '
ALTER TABLE ' . PREFIX_TABLE . $table . '
ADD ' . ($index['unique'] ? 'UNIQUE' : 'INDEX') . ' ' . $index_name . ' (' . implode(',', $index['columns']) . ')
;';
pwg_query($query);
}
}
}
//
// insert params in new configuration table
//
$params = array(array('param' => 'prefix_thumbnail', 'value' => $save['prefix_thumbnail'], 'comment' => 'thumbnails filename prefix'), array('param' => 'mail_webmaster', 'value' => $save['mail_webmaster'], 'comment' => 'webmaster mail'), array('param' => 'default_language', 'value' => 'en_UK.iso-8859-1', 'comment' => 'Default gallery language'), array('param' => 'default_template', 'value' => 'default', 'comment' => 'Default gallery style'), array('param' => 'default_maxwidth', 'value' => '', 'comment' => 'maximum width authorized for displaying images'), array('param' => 'default_maxheight', 'value' => '', 'comment' => 'maximum height authorized for the displaying images'), array('param' => 'nb_comment_page', 'value' => '10', 'comment' => 'number of comments to display on each page'), array('param' => 'upload_maxfilesize', 'value' => '150', 'comment' => 'maximum filesize for the uploaded pictures'), array('param' => 'upload_maxwidth', 'value' => '800', 'comment' => 'maximum width authorized for the uploaded images'), array('param' => 'upload_maxheight', 'value' => '600', 'comment' => 'maximum height authorized for the uploaded images'), array('param' => 'upload_maxwidth_thumbnail', 'value' => '150', 'comment' => 'maximum width authorized for the uploaded thumbnails'), array('param' => 'upload_maxheight_thumbnail', 'value' => '100', 'comment' => 'maximum height authorized for the uploaded thumbnails'), array('param' => 'log', 'value' => 'false', 'comment' => 'keep an history of visits on your website'), array('param' => 'comments_validation', 'value' => 'false', 'comment' => 'administrators validate users comments before becoming visible'), array('param' => 'comments_forall', 'value' => 'false', 'comment' => 'even guest not registered can post comments'), array('param' => 'mail_notification', 'value' => 'false', 'comment' => 'automated mail notification for adminsitrators'), array('param' => 'nb_image_line', 'value' => '5', 'comment' => 'Number of images displayed per row'), array('param' => 'nb_line_page', 'value' => '3', 'comment' => 'Number of rows displayed per page'), array('param' => 'recent_period', 'value' => '7', 'comment' => 'Period within which pictures are displayed as new (in days)'), array('param' => 'auto_expand', 'value' => 'false', 'comment' => 'Auto expand of the category tree'), array('param' => 'show_nb_comments', 'value' => 'false', 'comment' => 'Show the number of comments under the thumbnails'), array('param' => 'use_iptc', 'value' => 'false', 'comment' => 'Use IPTC data during database synchronization with files metadata'), array('param' => 'use_exif', 'value' => 'false', 'comment' => 'Use EXIF data during database synchronization with files metadata'), array('param' => 'show_iptc', 'value' => 'false', 'comment' => 'Show IPTC metadata on picture.php if asked by user'), array('param' => 'show_exif', 'value' => 'true', 'comment' => 'Show EXIF metadata on picture.php if asked by user'), array('param' => 'authorize_remembering', 'value' => 'true', 'comment' => 'Authorize users to be remembered, see $conf{remember_me_length}'), array('param' => 'gallery_locked', 'value' => 'false', 'comment' => 'Lock your gallery temporary for non admin users'));
mass_inserts(CONFIG_TABLE, array_keys($params[0]), $params);
// refresh calculated datas
update_global_rank();
update_category();
// update calculated field "images.path"
$cat_ids = array();
$query = '
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id
FROM ' . IMAGES_TABLE . '
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
array_push($cat_ids, $row['unique_storage_category_id']);
}
$fulldirs = get_fulldirs($cat_ids);
foreach ($cat_ids as $cat_id) {
$query = '
UPDATE ' . IMAGES_TABLE . '
SET path = CONCAT(\'' . $fulldirs[$cat_id] . '\',\'/\',file)
示例13: session_start
if (empty($category['ranking'])) {
$error_ranking = 'Ranking must be filled out';
$formValidation = false;
} else {
if (!is_numeric($category['ranking'])) {
$error_ranking = 'Ranking must be valid number';
$formValidation = false;
}
}
if ($formValidation) {
if (empty($category['categoryID'])) {
session_start();
$category['createdBy'] = $_SESSION['userId'];
add_category($category);
} else {
update_category($category);
}
$success_notification = 'Successfully saved';
}
} catch (Exception $e) {
$error_notification = $e->getMessage();
}
} else {
if (isset($_GET['categoryID'])) {
$categoryID = $_GET['categoryID'];
}
if (!empty($categoryID)) {
$category = get_category($categoryID);
}
}
?>
示例14: session_start
<?php
// include function files for this application
require_once 'book_sc_fns.php';
session_start();
do_html_header('Updating category');
if (check_admin_user()) {
if (filled_out($HTTP_POST_VARS)) {
if (update_category($HTTP_POST_VARS['catid'], $HTTP_POST_VARS['catname'])) {
echo 'Category was updated.<br />';
} else {
echo 'Category could not be updated.<br />';
}
} else {
echo 'You have not filled out the form. Please try again.';
}
do_html_url('admin.php', 'Back to administration menu');
} else {
echo 'You are not authorised to view this page.';
}
do_html_footer();
示例15: elseif
$_SESSION["token"] = $sessionToken;
}
elseif (($action == 2) && ($sessionToken == $formToken)) {
delete_category($categoryname);
echo "Category $categoryname deleted<br>";
$sessionToken = $sessionToken + 1;
$_SESSION["token"] = $sessionToken;
}
elseif (($action == 3) && ($sessionToken == $formToken)) {
$totalAppClass = trim ($totalAppClass, ",");
if (is_array($functions)) {
$functions = implode (" ", $functions);
}
update_category($categoryname, $totalAppClass, $categorydescription, $categorytype,$functions);
echo "Category $categoryname updated <br>";
$sessionToken = $sessionToken + 1;
$_SESSION["token"] = $sessionToken;
}
?>
<fieldset>
<legend>Available Categories</legend>
<p> To Change or Delete a category, select it</p>
<?
# Setting a session token