diff --git a/include/functions.inc b/include/functions.inc
index 70ab363acedfc872f34830b1a1dd11b2ae7d51fc..ec1d945f9d081d7dddb91b0f38672d7e0eeb4ee5 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* Configuration file location */
-define ("CONFIG_DIR", "/etc/gosa");
-define ("CONFIG_FILE", "gosa.conf");
+/* Allow setting the config patih in the apache configuration
+ e.g. SetEnv CONFIG_FILE /etc/path
+ */
+if(!isset($_SERVER['CONFIG_DIR'])){
+ define ("CONFIG_DIR", "/etc/gosa");
+}else{
+ define ("CONFIG_DIR",$_SERVER['CONFIG_DIR']);
+}
+
+/* Allow setting the config file in the apache configuration
+ e.g. SetEnv CONFIG_FILE gosa.conf.2.5
+ */
+if(!isset($_SERVER['CONFIG_FILE'])){
+ define ("CONFIG_FILE", "gosa.conf");
+}else{
+ define ("CONFIG_FILE",$_SERVER['CONFIG_FILE']);
+}
+
define ("CONFIG_TEMPLATE_DIR", "../contrib/");
define ("HELP_BASEDIR", "/var/www/doc/");
$progress = (int)(($percentage /100)*$width);
- /* Abort printing out percentage, if divs are to small */
-
-
/* If theres a better solution for this, use it... */
- $str = "
- <div style=\" width:".($width)."px;
- height:".($height)."px;
- background-color:#000000;
-padding:1px;\">
+ $str = "\n <div style=\" width:".($width)."px; ";
+ $str.= "\n height:".($height)."px; ";
+ $str.= "\n background-color:#000000; ";
+ $str.= "\n padding:1px;\" > ";
- <div style=\" width:".($width)."px;
- background-color:#$bgcolor;
-height:".($height)."px;\">
+ $str.= "\n <div style=\" width:".($width)."px; ";
+ $str.= "\n background-color:#$bgcolor; ";
+ $str.= "\n height:".($height)."px;\" > ";
- <div style=\" width:".$progress."px;
-height:".$height."px;
- background-color:#".$color2.$color2.$color."; \">";
+ if(($height >10)&&($showvalue)){
+ $str.= "\n <font style=\"font-size:".($height-2)."px; ";
+ $str.= "\n color:#FF0000; align:middle; ";
+ $str.= "\n padding-left:".((int)(($width*0.4)))."px; \"> ";
+ $str.= "\n <b>".$percentage."%</b> ";
+ $str.= "\n </font> ";
+ }
- if(($height >10)&&($showvalue)){
- $str.= "<font style=\"font-size:".($height-2)."px;color:#FF0000;align:middle;padding-left:".((int)(($width*0.4)))."px;\">
- <b>".$percentage."%</b>
- </font>";
- }
-
- $str.= "</div></div></div>";
+ $str.= "\n <div style=\" width:".$progress."px; ";
+ $str.= "\n height:".$height."px; ";
+ $str.= "\n background-color:#".$color2.$color2.$color."; \" >";
+ $str.= "\n </div>";
+ $str.= "\n </div>";
+ $str.= "\n </div>";
- return($str);
+ return($str);
}
$command= $config->current['BASE_HOOK'];
if ($command != ""){
- $command.= " '".LDAP::fix($dn)."' $attrib";
+ $command.= " '".@LDAP::fix($dn)."' $attrib";
if (check_command($command)){
@DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
exec($command, $output);
}
+function cred_encrypt($input, $password) {
+
+ $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+ $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
+
+ return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $password, $input, MCRYPT_MODE_ECB, $iv));
+}
+
+
+function cred_decrypt($input,$password) {
+ $size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
+ $iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
+
+ return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $password, pack("H*", $input), MCRYPT_MODE_ECB, $iv);
+}
+
+
/* Returns contents of the given POST variable and check magic quotes settings */
function get_post($name)
{