Code

Backport from trunk
[gosa.git] / gosa-plugins / squid / personal / connectivity / squid / class_proxyAccount.inc
index 72741f8978ae50e8e389018a11477b42cb522e60..8251a37232fbad280343c4445b805f5027b27849 100644 (file)
@@ -3,7 +3,7 @@ class proxyAccount extends plugin
 {
   /* Definitions */
   var $plHeadline   = "Proxy";
-  var $plDescription= "This does something";
+  var $plDescription= "Manage Proxy user settings";
 
   /* Proxy attributes */
   var $gosaProxyAcctFlags   = "[N    ]";
@@ -91,9 +91,9 @@ class proxyAccount extends plugin
     /* Assign quota values */
     $smarty->assign("quota_unit", array("k" => _("KB"), "m" => _("MB"), "g" => _("GB")));
     $smarty->assign("quota_time", array("h" => _("hour"), "d" => _("day"), "w" => _("week"), "m" => _("month")));
-    $smarty->assign("gosaProxyQuotaPeriod", $this->gosaProxyQuotaPeriod);
-    $smarty->assign("quota_size", preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota));
-    $smarty->assign("quota_u", preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota));
+    $smarty->assign("gosaProxyQuotaPeriod", set_post($this->gosaProxyQuotaPeriod));
+    $smarty->assign("quota_size", set_post(preg_replace("/[a-z]$/i", "", $this->gosaProxyQuota)));
+    $smarty->assign("quota_u", set_post(preg_replace("/^[0-9]+/", "", $this->gosaProxyQuota)));
     if ($this->is_account){
       $smarty->assign("proxyState", "checked");
     } else {
@@ -141,7 +141,7 @@ class proxyAccount extends plugin
     /* Assign filter settings */
     $smarty->assign("changeB",$changeB);
     foreach(array("T","B","F") as $attr){
-      if(in_array("filter".$attr,$this->multi_boxes)){
+      if(in_array_strict("filter".$attr,$this->multi_boxes)){
         $smarty->assign("use_filter".$attr,TRUE);
       }else{
         $smarty->assign("use_filter".$attr,FALSE);
@@ -156,7 +156,7 @@ class proxyAccount extends plugin
       $smarty->assign('proxyAccountACL', $this->getacl("",$this->ReadOnly));
     }
 
-    $smarty->assign("use_proxy",in_array("proxy",$this->multi_boxes));
+    $smarty->assign("use_proxy",in_array_strict("proxy",$this->multi_boxes));
     $smarty->assign("multiple_support",$this->multiple_support_active);
     $display.= $smarty->fetch(get_template_path('proxy.tpl', TRUE, dirname(__FILE__)));
     return($display);
@@ -203,7 +203,7 @@ class proxyAccount extends plugin
         if ($_POST["quota_size"] == "gosaProxyQuota"){
           $message[]= msgPool::invalid(_("Quota Setting"));
         }elseif ($_POST["quota_size"] <= 0){
-          $message[]= msgPool::invalid(_("Quota Setting"),$_POST["quota_size"],"/^[0-9]/");
+          $message[]= msgPool::invalid(_("Quota Setting"),get_post("quota_size"),"/^[0-9]/");
         }
       }
     }
@@ -258,13 +258,13 @@ class proxyAccount extends plugin
       if ($this->acl_is_writeable("gosaProxyFlagT")){
         if(isset($_POST['startMinute'])){
           $old= $this->gosaProxyWorkingStart;
-          $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
+          $this->gosaProxyWorkingStart= get_post('startHour') * 60 + get_post('startMinute');
           $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified;
         }
 
         if (isset($_POST['stopMinute'])){
           $old= $this->gosaProxyWorkingStop;
-          $this->gosaProxyWorkingStop = $_POST["stopHour"]  * 60 + $_POST["stopMinute"];
+          $this->gosaProxyWorkingStop = get_post('stopHour')  * 60 + get_post('stopMinute');
           $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified;
         }
       }
@@ -272,14 +272,14 @@ class proxyAccount extends plugin
       /* Save quota values */
       if ($this->acl_is_writeable("gosaProxyFlagB")){
         if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
-          $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
+          $this->gosaProxyQuota= get_post("quota_size").get_post("quota_unit");
         }
       }
   
       /*Save quota period */
       if($this->acl_is_writeable("gosaProxyFlagB")){
         if(isset($_POST["gosaProxyQuotaPeriod"])){
-          $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
+          $this->gosaProxyQuotaPeriod = get_post("gosaProxyQuotaPeriod");
         }
       }
     }
@@ -328,7 +328,7 @@ class proxyAccount extends plugin
   {
     return (array(
           "plShortName"     => _("Proxy"),
-          "plDescription"   => _("Proxy account")."&nbsp;("._("Connectivity addon").")",
+          "plDescription"   => _("Proxy account")."&nbsp;("._("Connectivity add-on").")",
           "plSelfModify"    => TRUE,
           "plDepends"       => array("user"),
           "plPriority"      => 21,                                 // Position in tabs
@@ -341,6 +341,7 @@ class proxyAccount extends plugin
               ),
 
           "plProvidedAcls"  => array(
+            "gosaProxyQuota"       => _("Quota"), 
             "gosaProxyFlagF"       => _("Filter unwanted content"), 
             "gosaProxyFlagT"       => _("Limit proxy access"),
             "gosaProxyFlagB"       => _("Restrict proxy usage by quota"))
@@ -375,22 +376,22 @@ class proxyAccount extends plugin
   public function get_multi_edit_values()
   {
     $ret = plugin::get_multi_edit_values();
-    if(in_array("proxy",$this->multi_boxes)){
+    if(in_array_strict("proxy",$this->multi_boxes)){
       $ret['is_account'] = $this->is_account;
     }
 
-    if(in_array("filterT",$this->multi_boxes)){
+    if(in_array_strict("filterT",$this->multi_boxes)){
       $ret['gosaProxyWorkingStart']  = $this->gosaProxyWorkingStart;
       $ret['gosaProxyWorkingStop']   = $this->gosaProxyWorkingStop;
     }
-    if(in_array("filterB",$this->multi_boxes)){
+    if(in_array_strict("filterB",$this->multi_boxes)){
       $ret['gosaProxyQuota']        = $this->gosaProxyQuota;
       $ret['gosaProxyQuotaPeriod']  = $this->gosaProxyQuotaPeriod;
     }
 
     foreach(array("B","T","F") as $attr){
       $name = "filter".$attr;
-      if(in_array($name,$this->multi_boxes)){
+      if(in_array_strict($name,$this->multi_boxes)){
         $ret[$name] = preg_match("/".$attr."/",$this->gosaProxyAcctFlags);
       }
     }
@@ -431,7 +432,7 @@ class proxyAccount extends plugin
   public function init_multiple_support($attrs,$all)
   {
     plugin::init_multiple_support($attrs,$all);
-    if(isset($attrs['objectClass']) && in_array("gosaProxyAccount",$attrs['objectClass'])){
+    if(isset($attrs['objectClass']) && in_array_strict("gosaProxyAccount",$attrs['objectClass'])){
       $this->is_account = TRUE;
     }
   }