diff --git a/e107_admin/links.php b/e107_admin/links.php
index 0311972e7..506a314f2 100644
--- a/e107_admin/links.php
+++ b/e107_admin/links.php
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/links.php,v $
-| $Revision: 1.7 $
-| $Date: 2007-09-29 20:20:36 $
+| $Revision: 1.8 $
+| $Date: 2007-10-13 19:08:37 $
| $Author: e107steved $
|
| links.php?debug shows stored data for each link after name (before constant conversion)
@@ -45,29 +45,41 @@ require_once(e_HANDLER."ren_help.php");
$rs = new form;
$linkpost = new links;
-if (e_QUERY) {
- $tmp = explode('.', e_QUERY);
- $action = $tmp[0];
- $sub_action = $tmp[1];
- $id = $tmp[2];
- unset($tmp);
+$action = '';
+if (e_QUERY)
+{
+ $tmp = explode('.', e_QUERY);
+ $action = $tmp[0];
+ $sub_action = $tmp[1];
+ $id = $tmp[2];
+ unset($tmp);
}
+define("URL_SEPARATOR",'X'); // Used in names of 'inc' and 'dec' fields
+
+$incdec_action = '';
foreach(array_keys($_POST) as $k)
{
- if (preg_match("#(.*?)_delete_(\d+)(.*)#", $k, $matches))
- {
- $delete = $matches[1];
- $del_id = $matches[2];
- }
+ if (preg_match("#(.*?)_delete_(\d+)(.*)#", $k, $matches))
+ {
+ $delete = $matches[1];
+ $del_id = $matches[2];
+ }
+ elseif (!$incdec_action && (preg_match("#^(inc|dec)".URL_SEPARATOR."(\d+)".URL_SEPARATOR."(\d+)_[x|y]#", $k, $matches)))
+ {
+ $incdec_action = $matches[1];
+ $linkid = intval($matches[2]);
+ $link_order = intval($matches[3]);
+ }
}
-if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST['sublink_parent'] !="" ){
-
+if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST['sublink_parent'] !="" )
+{
$subtype = $_POST['sublink_type'];
$sublink = $linkpost->sublink_list($subtype);
- if(!is_object($sql2)){
- $sql2 = new db;
+ if(!is_object($sql2))
+ {
+ $sql2 = new db;
}
$sql -> db_Select("links", "*", "link_id = '".$_POST['sublink_parent']."'");
@@ -98,22 +110,15 @@ if(isset($_POST['generate_sublinks']) && isset($_POST['sublink_type']) && $_POST
}
}
-if (isset($_POST['inc']))
+if ($incdec_action == 'inc')
{
- $qs = explode(".", $_POST['inc']);
- $linkid = $qs[0];
- $link_order = $qs[1];
- $sql->db_Update("links", "link_order=link_order+1 WHERE link_order='".intval($link_order-1)."'");
- $sql->db_Update("links", "link_order=link_order-1 WHERE link_id='".intval($linkid)."'");
+ $sql->db_Update("links", "link_order=link_order+1 WHERE link_order='".intval($link_order-1)."'");
+ $sql->db_Update("links", "link_order=link_order-1 WHERE link_id='".intval($linkid)."'");
}
-
-if (isset($_POST['dec']))
+elseif ($incdec_action =='dec')
{
- $qs = explode(".", $_POST['dec']);
- $linkid = $qs[0];
- $link_order = $qs[1];
- $sql->db_Update("links", "link_order=link_order-1 WHERE link_order='".intval($link_order+1)."'");
- $sql->db_Update("links", "link_order=link_order+1 WHERE link_id='".intval($linkid)."'");
+ $sql->db_Update("links", "link_order=link_order-1 WHERE link_order='".intval($link_order+1)."'");
+ $sql->db_Update("links", "link_order=link_order+1 WHERE link_id='".intval($linkid)."'");
}
if (isset($_POST['update']))
@@ -330,11 +335,11 @@ class links
$this->aIdOptPrep = $this->prepOpts($this->aIdOptData);
}
- function display_row($row2, $indent = FALSE) {
+ function display_row($row2, $indent = FALSE)
+ {
global $sql, $rs, $ns, $tp, $linkArray, $previous_cat, $imode;
extract($row2);
- //
if($link_category > 1 && $link_category != $previous_cat)
{
$text .= "
@@ -359,42 +364,43 @@ class links
$link_name.= ' ['.$link_url.']';
}
- if ($indent) {
- $subimage = "";
- $subspacer = ($indent > 1) ? " style='padding-left: ".(($indent - 1) * 16)."px'" : "";
- $subindent = "
".$link_name." |