summaryrefslogtreecommitdiff
path: root/module_controls_inc.php
diff options
context:
space:
mode:
authorbitweaver.org <bitweaver@users.sourceforge.net>2005-06-19 05:12:24 +0000
committerbitweaver.org <bitweaver@users.sourceforge.net>2005-06-19 05:12:24 +0000
commit657b3b2cb4d1ecb68c78320bdc03151590a9e6cd (patch)
treec88e26bedb5f01d457e28d07d6b7aa08ed13cdd1 /module_controls_inc.php
downloadusers-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.tar.gz
users-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.tar.bz2
users-657b3b2cb4d1ecb68c78320bdc03151590a9e6cd.zip
IMPORT TikiPro CLYDE FINAL
Diffstat (limited to 'module_controls_inc.php')
-rw-r--r--module_controls_inc.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/module_controls_inc.php b/module_controls_inc.php
new file mode 100644
index 0000000..6433db4
--- /dev/null
+++ b/module_controls_inc.php
@@ -0,0 +1,50 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/module_controls_inc.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+$check_req = (isset($_REQUEST["mc_unassign"])
+ || isset($_REQUEST["mc_up"])
+ || isset($_REQUEST["mc_down"])
+ || isset($_REQUEST["mc_move"]));
+if (!$gBitUser->hasPermission( 'bit_p_configure_modules' ) && $check_req) {
+ $smarty->assign('msg', tra("You dont have permission to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ($user_assigned_modules != 'y' && $check_req) {
+ $smarty->assign('msg', tra("This feature is disabled").": user_assigned_modules");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ( !$gBitUser->isRegistered() && $check_req) {
+ $smarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+$url = $_SERVER["REQUEST_URI"];
+if ($check_req) {
+// global $debugger;
+// $debugger->msg('Module control clicked: '.$check_req);
+ // Make defaults if user still ot configure modules for himself
+ if (!$usermoduleslib->user_has_assigned_modules($user))
+ $usermoduleslib->create_user_assigned_modules($user);
+ // Handle control icon click
+ if (isset($_REQUEST["mc_up"]))
+ $usermoduleslib->swap_up_user_module($_REQUEST["mc_up"], $user);
+ elseif (isset($_REQUEST["mc_down"]))
+ $usermoduleslib->swap_down_user_module($_REQUEST["mc_down"], $user);
+ elseif (isset($_REQUEST["mc_move"]))
+ $usermoduleslib->move_module($_REQUEST["mc_move"], $user);
+ else
+ $usermoduleslib->unassign_user_module($_REQUEST["mc_unassign"], $user);
+ // Remove module movemet paramaters from an URL
+ // \todo What if 'mc_xxx' arg was not at the end? (if smbd fix URL by hands...)
+ // should I handle this very special (hack?) case?
+ $url = preg_replace('/(.*)(\?|&){1}(mc_up|mc_down|mc_move|mc_unassign)=[^&]*/','\1', $url);
+}
+// Fix locaton if parameter was removed...
+if ($url != $_SERVER["REQUEST_URI"]) header('location: '.$url);
+$smarty->assign('current_location', $url);
+$smarty->assign('mpchar', (strpos($url, '?') ? '&' : '?'));
+?>