aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/include/functions.php37
-rw-r--r--admin/remote_site.php2
-rw-r--r--admin/update.php37
3 files changed, 39 insertions, 37 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 987cddb9a..467a498f6 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1164,4 +1164,41 @@ SELECT image_id
'update' => array('representative_picture_id'));
mass_updates(CATEGORIES_TABLE, $fields, $datas);
}
+
+/**
+ * order categories (update categories.rank and global_rank database fields)
+ *
+ * the purpose of this function is to give a rank for all categories
+ * (insides its sub-category), even the newer that have none at te
+ * beginning. For this, ordering function selects all categories ordered by
+ * rank ASC then name ASC for each uppercat.
+ *
+ * @returns void
+ */
+function ordering()
+{
+ $current_rank = 0;
+ $current_uppercat = '';
+
+ $query = '
+SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat
+ FROM '.CATEGORIES_TABLE.'
+ ORDER BY id_uppercat,rank,name
+;';
+ $result = pwg_query($query);
+ $datas = array();
+ while ($row = mysql_fetch_array($result))
+ {
+ if ($row['id_uppercat'] != $current_uppercat)
+ {
+ $current_rank = 0;
+ $current_uppercat = $row['id_uppercat'];
+ }
+ $data = array('id' => $row['id'], 'rank' => ++$current_rank);
+ array_push($datas, $data);
+ }
+
+ $fields = array('primary' => array('id'), 'update' => array('rank'));
+ mass_updates(CATEGORIES_TABLE, $fields, $datas);
+}
?>
diff --git a/admin/remote_site.php b/admin/remote_site.php
index 19db458b4..6f0279f21 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -135,6 +135,8 @@ function update_remote_site($listing_file, $site_id)
$xml_content = getXmlCode($listing_file);
insert_remote_category($xml_content, $site_id, 'NULL', 0);
update_category();
+ ordering();
+ update_global_rank();
$template->assign_block_vars(
'update',
diff --git a/admin/update.php b/admin/update.php
index aca5307ea..e540065e2 100644
--- a/admin/update.php
+++ b/admin/update.php
@@ -36,43 +36,6 @@ define('CURRENT_DATE', date('Y-m-d'));
// | functions |
// +-----------------------------------------------------------------------+
-/**
- * order categories (update categories.rank and global_rank database fields)
- *
- * the purpose of this function is to give a rank for all categories
- * (insides its sub-category), even the newer that have none at te
- * beginning. For this, ordering function selects all categories ordered by
- * rank ASC then name ASC for each uppercat.
- *
- * @returns void
- */
-function ordering()
-{
- $current_rank = 0;
- $current_uppercat = '';
-
- $query = '
-SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat
- FROM '.CATEGORIES_TABLE.'
- ORDER BY id_uppercat,rank,name
-;';
- $result = pwg_query($query);
- $datas = array();
- while ($row = mysql_fetch_array($result))
- {
- if ($row['id_uppercat'] != $current_uppercat)
- {
- $current_rank = 0;
- $current_uppercat = $row['id_uppercat'];
- }
- $data = array('id' => $row['id'], 'rank' => ++$current_rank);
- array_push($datas, $data);
- }
-
- $fields = array('primary' => array('id'), 'update' => array('rank'));
- mass_updates(CATEGORIES_TABLE, $fields, $datas);
-}
-
function insert_local_category($id_uppercat)
{
global $conf, $page, $user, $lang, $counts;