X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Ffunctions.inc;h=48cb40e9289dac6a85d39f773678cac81834e353;hb=7ce564d554053c9ff7ae13d00df50f5a1961357d;hp=d7921871bec4b6ff74053fbdc5b294c326fde589;hpb=19f2fdb5874e52464cd525ff8b021ad8cc248163;p=gosa.git
diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc
index d7921871b..48cb40e92 100644
--- a/gosa-core/include/functions.inc
+++ b/gosa-core/include/functions.inc
@@ -120,7 +120,7 @@ $REWRITE= array( "ä" => "ae",
*
* \param string 'class_name' The currently requested class
*/
-function __autoload($class_name) {
+function __gosa_autoload($class_name) {
global $class_mapping, $BASE_DIR;
if ($class_mapping === NULL){
@@ -135,6 +135,7 @@ function __autoload($class_name) {
exit;
}
}
+spl_autoload_register('__gosa_autoload');
/*! \brief Checks if a class is available.
@@ -320,7 +321,7 @@ function get_template_path($filename= '', $plugin= FALSE, $path= "")
/* Return plugin dir or root directory? */
if ($plugin){
if ($path == ""){
- $nf= preg_replace("!^".$BASE_DIR."/!", "", session::global_get('plugin_dir'));
+ $nf= preg_replace("!^".$BASE_DIR."/!", "", preg_replace('/^\.\.\//', '', session::global_get('plugin_dir')));
} else {
$nf= preg_replace("!^".$BASE_DIR."/!", "", $path);
}
@@ -527,6 +528,7 @@ function ldap_login_user_htaccess ($username)
/* Bail out if we have login restrictions set, for security reasons
the message is the same than failed user/pw */
if (!$ui->loginAllowed()){
+ new log("security","login","",array(),"Login restriction for user \"$username\", login not permitted");
return (NULL);
}
@@ -569,7 +571,7 @@ function ldap_login_user ($username, $password)
$allowed_attributes = array("uid","mail");
$verify_attr = array();
if($config->get_cfg_value("loginAttribute") != ""){
- $tmp = split(",", $config->get_cfg_value("loginAttribute"));
+ $tmp = explode(",", $config->get_cfg_value("loginAttribute"));
foreach($tmp as $attr){
if(in_array($attr,$allowed_attributes)){
$verify_attr[] = $attr;
@@ -623,6 +625,7 @@ function ldap_login_user ($username, $password)
/* Bail out if we have login restrictions set, for security reasons
the message is the same than failed user/pw */
if (!$ui->loginAllowed()){
+ new log("security","login","",array(),"Login restriction for user \"$username\", login not permitted");
return (NULL);
}
@@ -1243,7 +1246,7 @@ function print_sizelimit_warning()
{
if (session::global_is_set('size_limit') && session::global_get('size_limit') >= 10000000 ||
(session::is_set('limit_exceeded') && session::get('limit_exceeded'))){
- $config= "";
+ $config= "";
} else {
$config= "";
}
@@ -1357,7 +1360,7 @@ function convert_department_dn($dn, $base = NULL)
$dep= "";
- foreach (split(',', $dn) as $rdn){
+ foreach (explode(',', $dn) as $rdn){
$dep = preg_replace("/^[^=]+=/","",$rdn)."/".$dep;
}
@@ -1978,7 +1981,7 @@ function normalize_netmask($netmask)
*/
function netmask_to_bits($netmask)
{
- list($nm0, $nm1, $nm2, $nm3)= split('\.', $netmask);
+ list($nm0, $nm1, $nm2, $nm3)= explode('.', $netmask);
$res= 0;
for ($n= 0; $n<4; $n++){
@@ -2439,11 +2442,64 @@ function compare_revision($revision_file, $revision)
* \param int 'percentage' Value to display
* \param int 'width' width of the resulting output
* \param int 'height' height of the resulting output
- * \param boolean 'showvalue' weither to show the percentage in the progressbar or not
+ * \param boolean 'showtext' weither to show the percentage in the progressbar or not
* */
-function progressbar($percentage,$width=100,$height=15,$showvalue=false)
+function progressbar($percentage, $width= 200, $height= 14, $showText= false, $colorize= true, $id= "")
{
- return("");
+ $text= "";
+ $class= "";
+ $style= "width:${width}px;height:${height}px;";
+
+ // Fix percentage range
+ $percentage= floor($percentage);
+ if ($percentage > 100) {
+ $percentage= 100;
+ }
+ if ($percentage < 0) {
+ $percentage= 0;
+ }
+
+ // Only show text if we're above 10px height
+ if ($showText && $height>10){
+ $text= $percentage."%";
+ }
+
+ // Set font size
+ $style.= "font-size:".($height-3)."px;";
+
+ // Set color
+ if ($colorize){
+ if ($percentage < 70) {
+ $class= " progress-low";
+ } elseif ($percentage < 80) {
+ $class= " progress-mid";
+ } elseif ($percentage < 90) {
+ $class= " progress-high";
+ } else {
+ $class= " progress-full";
+ }
+ }
+
+ // Apply gradients
+ $hoffset= floor($height / 2) + 4;
+ $woffset= floor(($width+5) * (100-$percentage) / 100);
+ foreach (array("-moz-box-shadow", "-webkit-box-shadow", "box-shadow") as $type) {
+ $style.="$type:
+ 0 0 2px rgba(255, 255, 255, 0.4) inset,
+ 0 4px 6px rgba(255, 255, 255, 0.4) inset,
+ 0 ".$hoffset."px 0 -2px rgba(255, 255, 255, 0.2) inset,
+ -".$woffset."px 0 0 -2px rgba(255, 255, 255, 0.2) inset,
+ -".($woffset+1)."px 0 0 -2px rgba(0, 0, 0, 0.6) inset,
+ 0pt ".($hoffset+1)."px 8px rgba(0, 0, 0, 0.3) inset,
+ 0pt 1px 0px rgba(0, 0, 0, 0.2);";
+ }
+
+ // Set ID
+ if ($id != ""){
+ $id= "id='$id'";
+ }
+
+ return "