diff --git a/include/functions.inc b/include/functions.inc
index 5f31e35bda9b34809f796c730760e97b7eaf0da4..d628de47a0033dcd92f7e7f1376d9a0c7bf9f2f7 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
define("GL_SIZELIMIT", 2);
define("GL_CONVERT" , 4);
define("GL_SIZELIMIT", 2);
define("GL_CONVERT" , 4);
+/* Heimdal stuff */
+define('UNIVERSAL',0x00);
+define('INTEGER',0x02);
+define('OCTET_STRING',0x04);
+define('OBJECT_IDENTIFIER ',0x06);
+define('SEQUENCE',0x10);
+define('SEQUENCE_OF',0x10);
+define('SET',0x11);
+define('SET_OF',0x11);
+define('DEBUG',false);
+define('HDB_KU_MKEY',0x484442);
+define('TWO_BIT_SHIFTS',0x7efc);
+define('DES_CBC_CRC',1);
+define('DES_CBC_MD4',2);
+define('DES_CBC_MD5',3);
+define('DES3_CBC_MD5',5);
+define('DES3_CBC_SHA1',16);
+
/* Define globals for revision comparing */
$svn_path = '$HeadURL$';
$svn_revision = '$Revision$';
/* Include required files */
/* Define globals for revision comparing */
$svn_path = '$HeadURL$';
$svn_revision = '$Revision$';
/* Include required files */
-require_once ("class_ldap.inc");
-require_once ("class_config.inc");
-require_once ("class_plugin.inc");
-require_once ("class_acl.inc");
-require_once ("class_pluglist.inc");
-require_once ("class_userinfo.inc");
-require_once ("class_tabs.inc");
-require_once ("class_mail-methods.inc");
-require_once ("class_password-methods.inc");
+require_once("class_location.inc");
require_once ("functions_debug.inc");
require_once ("functions_dns.inc");
require_once ("accept-to-gettext.inc");
require_once ("functions_debug.inc");
require_once ("functions_dns.inc");
require_once ("accept-to-gettext.inc");
-require_once ("class_MultiSelectWindow.inc");
/* Define constants for debugging */
define ("DEBUG_TRACE", 1);
/* Define constants for debugging */
define ("DEBUG_TRACE", 1);
"Ñ" => "Ny" );
"Ñ" => "Ny" );
-/* Function to include all class_ files starting at a
- given directory base */
-function get_dir_list($folder= ".")
-{
- $currdir=getcwd();
- if ($folder){
- chdir("$folder");
- }
-
- $dh = opendir(".");
- while(false !== ($file = readdir($dh))){
-
- // Smarty is included by include/php_setup.inc require("smarty/Smarty.class.php");
- // Skip all files and dirs in "./.svn/" we don't need any information from them
- // Skip all Template, so they won't be checked twice in the following preg_matches
- // Skip . / ..
-
- // Result : from 1023 ms to 490 ms i think thats great...
- if(preg_match("/.*\.svn.*/",$file)||preg_match("/.*smarty.*/i",$file)||preg_match("/.*\.tpl.*/",$file)||($file==".")||($file==".."))
- continue;
-
-
- /* Recurse through all "common" directories */
- if(is_dir($file) &&$file!="CVS"){
- get_dir_list($file);
- continue;
- }
-
- /* Include existing class_ files */
- if (preg_match("/^class_.*\.inc$/", $file)) {
- require_once($file);
+/* Class autoloader */
+function __autoload($class_name) {
+ global $class_mapping, $BASE_DIR;
+ if (isset($class_mapping[$class_name])){
+ require_once($BASE_DIR."/".$class_mapping[$class_name]);
+ } else {
+ echo _("Fatal: cannot load class \"$class_name\" - execution aborted");
}
}
- }
-
- closedir($dh);
- chdir($currdir);
}
}
-
/* Create seed with microseconds */
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
/* Create seed with microseconds */
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
/* Debug level action */
function DEBUG($level, $line, $function, $file, $data, $info="")
{
/* Debug level action */
function DEBUG($level, $line, $function, $file, $data, $info="")
{
- if ($_SESSION['DEBUGLEVEL'] & $level){
+ if (get_global('DEBUGLEVEL') & $level){
$output= "DEBUG[$level] ";
if ($function != ""){
$output.= "($file:$function():$line) - $info: ";
$output= "DEBUG[$level] ";
if ($function != ""){
$output.= "($file:$function():$line) - $info: ";
/* Try to use users primary language */
global $config;
$ui= get_userinfo();
/* Try to use users primary language */
global $config;
$ui= get_userinfo();
- if ($ui != NULL){
+ if (isset($ui) && $ui !== NULL){
if ($ui->language != ""){
return ($ui->language.".UTF-8");
}
if ($ui->language != ""){
return ($ui->language.".UTF-8");
}
/* Rewrite ui object to another dn */
function change_ui_dn($dn, $newdn)
{
/* Rewrite ui object to another dn */
function change_ui_dn($dn, $newdn)
{
- $ui= $_SESSION['ui'];
+ $ui= get_global('ui');
if ($ui->dn == $dn){
$ui->dn= $newdn;
if ($ui->dn == $dn){
$ui->dn= $newdn;
- $_SESSION['ui']= $ui;
+ register_global('ui',$ui);
}
}
}
}
/* Return plugin dir or root directory? */
if ($plugin){
if ($path == ""){
/* Return plugin dir or root directory? */
if ($plugin){
if ($path == ""){
- $nf= preg_replace("!^".$BASE_DIR."/!", "", $_SESSION['plugin_dir']);
+ $nf= preg_replace("!^".$BASE_DIR."/!", "", get_global('plugin_dir'));
} else {
$nf= preg_replace("!^".$BASE_DIR."/!", "", $path);
}
} else {
$nf= preg_replace("!^".$BASE_DIR."/!", "", $path);
}
return ("$BASE_DIR/ihtml/themes/default/$nf/$filename");
}
if ($path == ""){
return ("$BASE_DIR/ihtml/themes/default/$nf/$filename");
}
if ($path == ""){
- return ($_SESSION['plugin_dir']."/$filename");
+ return (get_global('plugin_dir')."/$filename");
} else {
return ($path."/$filename");
}
} else {
return ($path."/$filename");
}
print_red(sprintf(_("User login failed. LDAP server said '%s'."), $ldap->get_error()));
$smarty= get_smarty();
$smarty->display(get_template_path('headers.tpl'));
print_red(sprintf(_("User login failed. LDAP server said '%s'."), $ldap->get_error()));
$smarty= get_smarty();
$smarty->display(get_template_path('headers.tpl'));
- echo "<body>".$_SESSION['errors']."</body></html>";
+ echo "<body>".get_global('errors')."</body></html>";
exit();
}
$ldap->cd($config->current['BASE']);
exit();
}
$ldap->cd($config->current['BASE']);
- $ldap->search("(&(uid=$username)(objectClass=gosaAccount))", array("uid"));
+ $allowed_attributes = array("uid","mail");
+ $verify_attr = array();
+ if(isset($config->current['LOGIN_ATTRIBUTE'])){
+ $tmp = split(",",$config->current['LOGIN_ATTRIBUTE']);
+ foreach($tmp as $attr){
+ if(in_array($attr,$allowed_attributes)){
+ $verify_attr[] = $attr;
+ }
+ }
+ }
+ if(count($verify_attr) == 0){
+ $verify_attr = array("uid");
+ }
+ $tmp= $verify_attr;
+ $tmp[] = "uid";
+ $filter = "";
+ foreach($verify_attr as $attr) {
+ $filter.= "(".$attr."=".$username.")";
+ }
+ $filter = "(&(|".$filter.")(objectClass=gosaAccount))";
+ $ldap->search($filter,$tmp);
/* get results, only a count of 1 is valid */
switch ($ldap->count()){
/* get results, only a count of 1 is valid */
switch ($ldap->count()){
/* LDAP schema is not case sensitive. Perform additional check. */
$attrs= $ldap->fetch();
/* LDAP schema is not case sensitive. Perform additional check. */
$attrs= $ldap->fetch();
- if ($attrs['uid'][0] != $username){
- return(NULL);
+ $success = FALSE;
+ foreach($verify_attr as $attr){
+ if ($attrs[$attr][0] == $username){
+ $success = TRUE;
+ }
+ }
+ if(!$success){
+ return(FALSE);
}
/* got user dn, fill acl's */
$ui= new userinfo($config, $ldap->getDN());
}
/* got user dn, fill acl's */
$ui= new userinfo($config, $ldap->getDN());
- $ui->username= $username;
+ $ui->username= $attrs['uid'][0];
/* password check, bind as user with supplied password */
$ldap->disconnect();
/* password check, bind as user with supplied password */
$ldap->disconnect();
{
global $config;
{
global $config;
+ if(is_array($object)){
+ foreach($object as $obj){
+ add_lock($obj,$user);
+ }
+ return;
+ }
+
/* Just a sanity check... */
if ($object == "" || $user == ""){
print_red(_("Error while adding a lock. Parameters are not set correctly, please check the source!"));
/* Just a sanity check... */
if ($object == "" || $user == ""){
print_red(_("Error while adding a lock. Parameters are not set correctly, please check the source!"));
{
global $config;
{
global $config;
+ if(is_array($object)){
+ foreach($object as $obj){
+ del_lock($obj);
+ }
+ return;
+ }
+
/* Sanity check */
if ($object == ""){
return;
/* Sanity check */
if ($object == ""){
return;
$attrs = $ldap->fetch();
$user= $attrs['gosaUser'][0];
}
$attrs = $ldap->fetch();
$user= $attrs['gosaUser'][0];
}
-
return ($user);
}
return ($user);
}
+function get_multiple_locks($objects)
+{
+ global $config;
+
+ if(is_array($objects)){
+ $filter = "(&(objectClass=gosaLockEntry)(|";
+ foreach($objects as $obj){
+ $filter.="(gosaObject=".base64_encode($obj).")";
+ }
+ $filter.= "))";
+ }else{
+ $filter = "(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($objects)."))";
+ }
+
+ /* Get LDAP link, check for presence of the lock entry */
+ $user= "";
+ $ldap= $config->get_ldap_link();
+ $ldap->cd ($config->current['CONFIG']);
+ $ldap->search($filter, array("gosaUser","gosaObject"));
+ if (!preg_match("/Success/i", $ldap->error)){
+ print_red (_("Can't get locking information in LDAP database. Please check the 'config' entry in gosa.conf!"));
+ return("");
+ }
+
+ $users = array();
+ while($attrs = $ldap->fetch()){
+ $dn = base64_decode($attrs['gosaObject'][0]);
+ $user = $attrs['gosaUser'][0];
+ $users[] = array("dn"=> $dn,"user"=>$user);
+ }
+ return ($users);
+}
+
+
function get_list($filter, $category, $base= "", $attributes= array(), $flags= GL_SUBSEARCH)
{
global $config, $ui;
function get_list($filter, $category, $base= "", $attributes= array(), $flags= GL_SUBSEARCH)
{
global $config, $ui;
@@ -611,7 +664,7 @@ function get_list($filter, $category, $base= "", $attributes= array(), $flags= G
/* Check for size limit exceeded messages for GUI feedback */
if (preg_match("/size limit/i", $ldap->error)){
/* Check for size limit exceeded messages for GUI feedback */
if (preg_match("/size limit/i", $ldap->error)){
- $_SESSION['limit_exceeded']= TRUE;
+ register_global('limit_exceeded', TRUE);
}
/* Crawl through reslut entries and perform the migration to the
}
/* Crawl through reslut entries and perform the migration to the
@@ -656,16 +709,16 @@ function get_list($filter, $category, $base= "", $attributes= array(), $flags= G
function check_sizelimit()
{
/* Ignore dialog? */
function check_sizelimit()
{
/* Ignore dialog? */
- if (isset($_SESSION['size_ignore']) && $_SESSION['size_ignore']){
+ if (is_global('size_ignore') && get_global('size_ignore')){
return ("");
}
/* Eventually show dialog */
return ("");
}
/* Eventually show dialog */
- if (isset($_SESSION['limit_exceeded']) && $_SESSION['limit_exceeded']){
+ if (is_global('limit_exceeded') && get_global('limit_exceeded')){
$smarty= get_smarty();
$smarty->assign('warning', sprintf(_("The size limit of %d entries is exceed!"),
$smarty= get_smarty();
$smarty->assign('warning', sprintf(_("The size limit of %d entries is exceed!"),
- $_SESSION['size_limit']));
- $smarty->assign('limit_message', sprintf(_("Set the new size limit to %s and show me this message if the limit still exceeds"), '<input type="text" name="new_limit" maxlength="10" size="5" value="'.($_SESSION['size_limit']+100).'">'));
+ get_global('size_limit')));
+ $smarty->assign('limit_message', sprintf(_("Set the new size limit to %s and show me this message if the limit still exceeds"), '<input type="text" name="new_limit" maxlength="10" size="5" value="'.(get_global('size_limit') +100).'">'));
return($smarty->fetch(get_template_path('sizelimit.tpl')));
}
return($smarty->fetch(get_template_path('sizelimit.tpl')));
}
function print_sizelimit_warning()
{
function print_sizelimit_warning()
{
- if (isset($_SESSION['size_limit']) && $_SESSION['size_limit'] >= 10000000 ||
- (isset($_SESSION['limit_exceeded']) && $_SESSION['limit_exceeded'])){
+ if (is_global('size_limit') && get_global('size_limit') >= 10000000 ||
+ (is_global('limit_exceeded') && get_global('limit_exceeded'))){
$config= "<input type='submit' name='edit_sizelimit' value="._("Configure").">";
} else {
$config= "";
}
$config= "<input type='submit' name='edit_sizelimit' value="._("Configure").">";
} else {
$config= "";
}
- if (isset($_SESSION['limit_exceeded']) && $_SESSION['limit_exceeded']){
+ if (is_global('limit_exceeded') && get_global('limit_exceeded')){
return ("("._("incomplete").") $config");
}
return ("");
return ("("._("incomplete").") $config");
}
return ("");
if (is_id($_POST['new_limit']) &&
isset($_POST['action']) && $_POST['action']=="newlimit"){
if (is_id($_POST['new_limit']) &&
isset($_POST['action']) && $_POST['action']=="newlimit"){
- $_SESSION['size_limit']= validate($_POST['new_limit']);
- $_SESSION['size_ignore']= FALSE;
+ register_global('size_limit', validate($_POST['new_limit']));
+ register_global('size_ignore', FALSE);
}
/* User wants no limits? */
if (isset($_POST['action']) && $_POST['action']=="ignore"){
}
/* User wants no limits? */
if (isset($_POST['action']) && $_POST['action']=="ignore"){
- $_SESSION['size_limit']= 0;
- $_SESSION['size_ignore']= TRUE;
+ register_global('size_limit', 0);
+ register_global('size_ignore', TRUE);
}
/* User wants incomplete results */
if (isset($_POST['action']) && $_POST['action']=="limited"){
}
/* User wants incomplete results */
if (isset($_POST['action']) && $_POST['action']=="limited"){
- $_SESSION['size_ignore']= TRUE;
+ register_global('size_ignore', TRUE);
}
}
getMenuCache();
/* Allow fallback to dialog */
if (isset($_POST['edit_sizelimit'])){
}
}
getMenuCache();
/* Allow fallback to dialog */
if (isset($_POST['edit_sizelimit'])){
- $_SESSION['size_ignore']= FALSE;
+ register_global('size_ignore',FALSE);
}
}
}
}
$str.= chr($e+$n);
if(isset($_GET[$str])){
$str.= chr($e+$n);
if(isset($_GET[$str])){
- if(isset($_SESSION['maxC'])){
- $b= $_SESSION['maxC'];
+ if(is_global('maxC')){
+ $b= get_global('maxC');
$q= "";
for ($m=0;$m<strlen($b);$m++) {
$q.= $b[$m++];
$q= "";
for ($m=0;$m<strlen($b);$m++) {
$q.= $b[$m++];
return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
}
return preg_match ("/^[\/0-9 ()+*-]+$/", $nr);
}
+function is_dns_name($str)
+{
+ return(preg_match("/^[a-z0-9\.\-]*$/i",$str));
+}
function is_url($url)
{
function is_url($url)
{
$string= preg_replace ("/%s/", $array[$i], $string, 1);
}
$string= preg_replace ("/%s/", $array[$i], $string, 1);
}
- if((!isset($_SESSION['errorsAlreadyPosted'])) || !is_array($_SESSION['errorsAlreadyPosted'])){
- $_SESSION['errorsAlreadyPosted'] = array();
- }
-
/* If DEBUGLEVEL is set, we're in web mode, use textual output in
the other case... */
/* If DEBUGLEVEL is set, we're in web mode, use textual output in
the other case... */
-
- if (isset($_SESSION['DEBUGLEVEL'])){
-
- if($_SESSION['LastError'] == $string){
-
- if((!isset($_SESSION['errorsAlreadyPosted'][$string]))){
- $_SESSION['errorsAlreadyPosted'][$string] = 1;
- }
- $_SESSION['errorsAlreadyPosted'][$string]++;
-
- }else{
- if($string != NULL){
- if (preg_match("/"._("LDAP error:")."/", $string)){
- $addmsg= _("Problems with the LDAP server mean that you probably lost the last changes. Please check your LDAP setup for possible errors and try again.");
- $img= "images/error.png";
- } else {
- if (!preg_match('/[.!?]$/', $string)){
- $string.= ".";
- }
- $string= preg_replace('/<br>/', ' ', $string);
- $img= "images/warning.png";
- $addmsg= _("Please check your input and fix the error. Press 'OK' to close this message box.");
- }
-
- if(isset($_SESSION['errors']) && strlen($_SESSION['errors'])==0) {
-
- if(preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])){
-
- $_SESSION['errors'].= "
- <iframe id='e_layer3'
- style=\" position:absolute;
- width:100%;
- height:100%;
- top:0px;
- left:0px;
- border:none;
- border-style:none;
- border-width:0pt;
- display:block;
- allowtransparency='true';
- background-color: #FFFFFF;
- filter:chroma(color=#FFFFFF);
- z-index:0; \">
- </iframe>
- <div id='e_layer2'
- style=\"
- position: absolute;
- left: 0px;
- top: 0px;
- right:0px;
- bottom:0px;
- z-index:0;
- width:100%;
- height:100%;
- filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='images/opacity_black.png'); \">
- </div>";
- $hide = "hide(\"e_layer\");hide(\"e_layer2\");hide(\"e_layer3\");";
- }else{
-
- $_SESSION['errors'].= "
- <div id='e_layer2'
- style=\"
- position: absolute;
- left: 0px;
- top: 0px;
- right:0px;
- bottom:0px;
- z-index:0;
- background-image: url(images/opacity_black.png);\">
- </div>";
- $hide = "hide(\"e_layer\");hide(\"e_layer2\");";
- }
-
- $_SESSION['errors'].= "
- <div style='left:20%;right:20%;top:30%;".
- "background-color:white;padding:5px;border:5px solid red;z-index:150;".
- "position:absolute' id='e_layer'><table style='width:100%' summary='' border=0>".
- "<tr><td style='vertical-align:top;padding:10px'><img alt='' src='".
- get_template_path($img)."'></td>".
- "<td style='width:100%'><h1>"._("An error occurred while processing your request").
- "</h1><b>$string</b><br><br>$addmsg</td></tr><tr><td colspan='2' align='center'><br><button ".
- (($_SESSION['js']==FALSE)?"type='submit'":"type='button' name='error_accept'").
- " style='width:80px' onClick='".$hide."'>".
- _("OK")."</button></td></tr></table></div>";
-
+ if (is_global('DEBUGLEVEL')){
+ if($string !== NULL){
+ if (preg_match("/"._("LDAP error:")."/", $string)){
+ $addmsg= _("Problems with the LDAP server mean that you probably lost the last changes. Please check your LDAP setup for possible errors and try again.");
+ } else {
+ if (!preg_match('/[.!?]$/', $string)){
+ $string.= ".";
}
}
-
- }else{
- return;
+ $string= preg_replace('/<br>/', ' ', $string);
+ $addmsg= _("Please check your input and fix the error. Press 'OK' to close this message box.");
}
}
- $_SESSION['errorsAlreadyPosted'][$string] = 1;
-
+ msg_dialog::display($addmsg, $string,ERROR_DIALOG);
+ return;
+ }else{
+ return;
}
} else {
echo "Error: $string\n";
}
}
} else {
echo "Error: $string\n";
}
- $_SESSION['LastError'] = $string;
}
}
{
global $plug, $config;
{
global $plug, $config;
- $_SESSION['dn']= $dn;
- $ldap= $config->get_ldap_link();
- $ldap->cat ($user, array('uid', 'cn'));
- $attrs= $ldap->fetch();
-
- /* Stop if we have no user here... */
- if (count($attrs)){
- $uid= $attrs["uid"][0];
- $cn= $attrs["cn"][0];
- } else {
- $uid= $attrs["uid"][0];
- $cn= $attrs["cn"][0];
- }
-
+ register_global('dn', $dn);
$remove= false;
/* Save variables from LOCK_VARS_TO_USE in session - for further editing */
$remove= false;
/* Save variables from LOCK_VARS_TO_USE in session - for further editing */
- if((isset($_SESSION['LOCK_VARS_TO_USE']))&&(count($_SESSION['LOCK_VARS_TO_USE']))){
- $_SESSION['LOCK_VARS_USED'] =array();
- foreach($_SESSION['LOCK_VARS_TO_USE'] as $name){
+ if( is_global('LOCK_VARS_TO_USE') && count(get_global('LOCK_VARS_TO_USE'))){
+
+ $LOCK_VARS_USED = array();
+ $LOCK_VARS_TO_USE = get_global('LOCK_VARS_TO_USE');
+
+ foreach($LOCK_VARS_TO_USE as $name){
+
+ if(empty($name)){
+ continue;
+ }
- if(empty($name)) continue;
foreach($_POST as $Pname => $Pvalue){
if(preg_match($name,$Pname)){
foreach($_POST as $Pname => $Pvalue){
if(preg_match($name,$Pname)){
- $_SESSION['LOCK_VARS_USED'][$Pname] = $_POST[$Pname];
+ $LOCK_VARS_USED[$Pname] = $_POST[$Pname];
}
}
foreach($_GET as $Pname => $Pvalue){
if(preg_match($name,$Pname)){
}
}
foreach($_GET as $Pname => $Pvalue){
if(preg_match($name,$Pname)){
- $_SESSION['LOCK_VARS_USED'][$Pname] = $_GET[$Pname];
+ $LOCK_VARS_USED[$Pname] = $_GET[$Pname];
}
}
}
}
}
}
- $_SESSION['LOCK_VARS_TO_USE'] =array();
+ register_global('LOCK_VARS_TO_USE',array());
+ register_global('LOCK_VARS_USED' , $LOCK_VARS_USED);
}
/* Prepare and show template */
$smarty= get_smarty();
}
/* Prepare and show template */
$smarty= get_smarty();
- $smarty->assign ("dn", $dn);
+
+ if(is_array($dn)){
+ $msg = "<pre>";
+ foreach($dn as $sub_dn){
+ $msg .= "\n".$sub_dn.", ";
+ }
+ $msg = preg_replace("/, $/","</pre>",$msg);
+ }else{
+ $msg = $dn;
+ }
+
+ $smarty->assign ("dn", $msg);
if ($remove){
$smarty->assign ("action", _("Continue anyway"));
} else {
$smarty->assign ("action", _("Edit anyway"));
}
if ($remove){
$smarty->assign ("action", _("Continue anyway"));
} else {
$smarty->assign ("action", _("Edit anyway"));
}
- $smarty->assign ("message", sprintf(_("You're going to edit the LDAP entry '%s' which appears to be used by '%s'. Please contact the person in order to clarify proceedings."), "<b>".$dn."</b>", "<b><a href=\"main.php?plug=0&viewid=$uid\">$cn</a></b>"));
+ $smarty->assign ("message", sprintf(_("You're going to edit the LDAP entry/entries '%s'"), "<b>".$msg."</b>", ""));
return ($smarty->fetch (get_template_path('islocked.tpl')));
}
return ($smarty->fetch (get_template_path('islocked.tpl')));
}
function sess_del ($var)
{
/* New style */
function sess_del ($var)
{
/* New style */
- unset ($_SESSION[$var]);
+ unset($_SESSION[$var]);
/* ... work around, since the first one
doesn't seem to work all the time */
/* ... work around, since the first one
doesn't seem to work all the time */
{
if (!preg_match("/Success/i", $message)){
if ($addon == ""){
{
if (!preg_match("/Success/i", $message)){
if ($addon == ""){
- print_red (_("LDAP error: $message"));
+ msg_dialog::display(_("LDAP error:"),$message,ERROR_DIALOG);
+ #print_red (_("LDAP error:")." $message");
} else {
} else {
- print_red ("$addon<br><br><b>"._("LDAP error:")."</b> $message");
+ msg_dialog::display(sprintf(_("LDAP error in plugin '%s':"),"<i>".$addon."</i>"),$message,ERROR_DIALOG);
+ #print_red ("$addon<br><br><b>"._("LDAP error:")."</b> $message");
}
return TRUE;
} else {
}
return TRUE;
} else {
$display.= " ";
$display.= "</div>\n";
}
$display.= " ";
$display.= "</div>\n";
}
-# if (isset($_SESSION['errors'])){
-# $display.= $_SESSION['errors'];
-# }
-
return ($display);
}
return ($display);
}
}
foreach ($items as $item){
}
foreach ($items as $item){
- if (strtolower($item) == strtolower($value)) {
+ if (strcasecmp($item, $value) == 0) {
return (TRUE);
}
}
return (TRUE);
}
}
}
}
-function search_config(&$arr, $name, $return)
-{
- $lname= strtolower($name);
- if (is_array($arr)){
- foreach ($arr as $a){
- if (isset($a['CLASS']) && strtolower($a['CLASS']) == $lname){
-
- if (isset($a[$return])){
- return ($a[$return]);
- } else {
- return ("");
- }
- } else {
- $res= search_config ($a, $name, $return);
- if ($res != ""){
- return $res;
- }
- }
- }
- }
- return ("");
-}
-
-
function array_differs($src, $dst)
{
/* If the count is differing, the arrays differ */
function array_differs($src, $dst)
{
/* If the count is differing, the arrays differ */
$keep = ""; // save last failed parse string
/* Check each parsed dn in ldap ? */
$keep = ""; // save last failed parse string
/* Check each parsed dn in ldap ? */
- if($config!=NULL && $verify_in_ldap){
+ if($config!==NULL && $verify_in_ldap){
$ldap = $config->get_ldap_link();
}
$ldap = $config->get_ldap_link();
}
$called = true;
/* Check if current dn is valid */
$called = true;
/* Check if current dn is valid */
- if($ldap!=NULL){
+ if($ldap!==NULL){
$ldap->cd($dn);
$ldap->cat($dn,array("dn"));
if($ldap->count()){
$ldap->cd($dn);
$ldap->cat($dn,array("dn"));
if($ldap->count()){
return ($first < $curr&& $last > $curr);
}
return ($first < $curr&& $last > $curr);
}
+/* Return class name in correct case
+ * mailMethodkolab => mailMethodKolab ( k => K )
+ */
+function get_correct_class_name($cls)
+{
+ global $class_mapping;
+ if(isset($class_mapping) && is_array($class_mapping)){
+ foreach($class_mapping as $class => $file){
+ if(preg_match("/^".$cls."$/i",$class)){
+ return($class);
+ }
+ }
+ }
+ return(FALSE);
+}
+
+// change_password, changes the Password, of the given dn
+function change_password ($dn, $password, $mode=0, $hash= "")
+{
+ global $config;
+ $newpass= "";
+
+ /* Convert to lower. Methods are lowercase */
+ $hash= strtolower($hash);
+
+ // Get all available encryption Methods
+
+ // NON STATIC CALL :)
+ $tmp = new passwordMethod(get_global('config'));
+ $available = $tmp->get_available_methods();
+
+ // read current password entry for $dn, to detect the encryption Method
+ $ldap = $config->get_ldap_link();
+ $ldap->cat ($dn, array("shadowLastChange", "userPassword", "uid"));
+ $attrs = $ldap->fetch ();
+
+ // Check if user account was deactivated, indicated by ! after } ... {crypt}!###
+ if(isset($attrs['userPassword'][0]) && preg_match("/^[^\}]*+\}!/",$attrs['userPassword'][0])){
+ $deactivated = TRUE;
+ }else{
+ $deactivated = FALSE;
+ }
+
+ /* Is ensure that clear passwords will stay clear */
+ if($hash == "" && isset($attrs['userPassword'][0]) && !preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0])){
+ $hash = "clear";
+ }
+
+ // Detect the encryption Method
+ if ( (isset($attrs['userPassword'][0]) && preg_match ("/^{([^}]+)}(.+)/", $attrs['userPassword'][0], $matches)) || $hash != ""){
+
+ /* Check for supported algorithm */
+ mt_srand((double) microtime()*1000000);
+
+ /* Extract used hash */
+ if ($hash == ""){
+ $hash= strtolower($matches[1]);
+ }
+
+ $test = new $available[$hash]($config);
+
+ } else {
+ // User MD5 by default
+ $hash= "md5";
+ $test = new $available['md5']($config);
+ }
+
+ /* Feed password backends with information */
+ $test->dn= $dn;
+ $test->attrs= $attrs;
+ $newpass= $test->generate_hash($password);
+
+ // Update shadow timestamp?
+ if (isset($attrs["shadowLastChange"][0])){
+ $shadow= (int)(date("U") / 86400);
+ } else {
+ $shadow= 0;
+ }
+
+ // Write back modified entry
+ $ldap->cd($dn);
+ $attrs= array();
+ // Not for groups
+ if ($mode == 0){
+
+ if ($shadow != 0){
+ $attrs['shadowLastChange']= $shadow;
+ }
+
+ // Create SMB Password
+ $attrs= generate_smb_nt_hash($password);
+ }
+
+ /* Readd ! if user was deactivated */
+ if($deactivated){
+ $newpass = preg_replace("/(^[^\}]+\})(.*$)/","\\1!\\2",$newpass);
+ }
+
+ $attrs['userPassword']= array();
+ $attrs['userPassword']= $newpass;
+
+ $ldap->modify($attrs);
+
+ new log("modify","users/passwordMethod",$dn,array_keys($attrs),$ldap->get_error());
+
+ if ($ldap->error != 'Success') {
+ print_red(sprintf(_("Setting the password failed. LDAP server says '%s'."),
+ $ldap->get_error()));
+ } else {
+
+ /* Run backend method for change/create */
+ $test->set_password($password);
+
+ /* Find postmodify entries for this class */
+ $command= $config->search("password", "POSTMODIFY",array('menu'));
+
+ if ($command != ""){
+ /* Walk through attribute list */
+ $command= preg_replace("/%userPassword/", $password, $command);
+ $command= preg_replace("/%dn/", $dn, $command);
+
+ if (check_command($command)){
+ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute");
+ exec($command);
+ } else {
+ $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, "password");
+ print_red ($message);
+ }
+ }
+ }
+}
+// Return something like array['sambaLMPassword']= "lalla..."
+function generate_smb_nt_hash($password)
+{
+ global $config;
+ $tmp= $config->data['MAIN']['SMBHASH']." ".escapeshellarg($password);
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__, $tmp, "Execute");
+
+ exec($tmp, $ar);
+ flush();
+ reset($ar);
+ $hash= current($ar);
+ if ($hash == "")
+ {
+ print_red (_("Setting for SMBHASH in gosa.conf is incorrect! Can't change Samba password."));
+ }
+ else
+ {
+ list($lm,$nt)= split (":", trim($hash));
+
+ if ($config->current['SAMBAVERSION'] == 3)
+ {
+ $attrs['sambaLMPassword']= $lm;
+ $attrs['sambaNTPassword']= $nt;
+ $attrs['sambaPwdLastSet']= date('U');
+ $attrs['sambaBadPasswordCount']= "0";
+ $attrs['sambaBadPasswordTime']= "0";
+ } else {
+ $attrs['lmPassword']= $lm;
+ $attrs['ntPassword']= $nt;
+ $attrs['pwdLastSet']= date('U');
+ }
+ return($attrs);
+ }
+}
+
+function crypt_single($string,$enc_type )
+{
+ return( passwordMethod::crypt_single_str($string,$enc_type));
+}
+
+
+/* This function returns the offset for the default timezone.
+ * $stamp is used to detect summer or winter time.
+ * In case of PHP5, the integrated timezone functions are used.
+ * For PHP4 we query an array for offset and add summertime hour.
+ */
+function get_default_timezone($stamp = NULL)
+{
+ global $config;
+ $tz ="";
+
+ /* Default return value if zone could not be detected */
+ $zone = array("name" => "unconfigured", "value" => 0);
+
+ /* Use current timestamp if $stamp is not set */
+ if($stamp === NULL){
+ $stamp = time();
+ }
+
+ /* Is there a timezone configured in the gosa configuration (gosa.conf) */
+ if(isset($config->current['TIMEZONE']) || isset($config->data['MAIN']['TIMEZONE'])){
+
+ /* Get zonename */
+ if(isset($config->current['TIMEZONE'])){
+ $tz = $config->current['TIMEZONE'];
+ }else{
+ $tz = $config->data['MAIN']['TIMEZONE'];
+ }
+
+ if(!@date_default_timezone_set($tz)){
+ print_red(sprintf(_("The timezone setting \"".$tz."\" in your gosa.conf is not valid. Can not calculate correct timezone offest."),$tz));
+ }
+ $tz_delta = date("Z", $stamp);
+ $tz_delta = $tz_delta / 3600 ;
+ return(array("name" => $tz, "value" => $tz_delta));
+
+ }
+ return($zone);
+}
+
+
+/* Return zone informations */
+function _get_tz_zones()
+{
+ $timezones = array(
+ 'Africa/Abidjan' => 0,
+ 'Africa/Accra' => 0,
+ 'Africa/Addis_Ababa' => 10800,
+ 'Africa/Algiers' => 3600,
+ 'Africa/Asmera' => 10800,
+ 'Africa/Bamako' => 0,
+ 'Africa/Bangui' => 3600,
+ 'Africa/Banjul' => 0,
+ 'Africa/Bissau' => 0,
+ 'Africa/Blantyre' => 7200,
+ 'Africa/Brazzaville' => 3600,
+ 'Africa/Bujumbura' => 7200,
+ 'Africa/Cairo' => 7200,
+ 'Africa/Casablanca' => 0,
+ 'Africa/Ceuta' => 3600,
+ 'Africa/Conakry' => 0,
+ 'Africa/Dakar' => 0,
+ 'Africa/Dar_es_Salaam' => 10800,
+ 'Africa/Djibouti' => 10800,
+ 'Africa/Douala' => 3600,
+ 'Africa/El_Aaiun' => 0,
+ 'Africa/Freetown' => 0,
+ 'Africa/Gaborone' => 7200,
+ 'Africa/Harare' => 7200,
+ 'Africa/Johannesburg' => 7200,
+ 'Africa/Kampala' => 10800,
+ 'Africa/Khartoum' => 10800,
+ 'Africa/Kigali' => 7200,
+ 'Africa/Kinshasa' => 3600,
+ 'Africa/Lagos' => 3600,
+ 'Africa/Libreville' => 3600,
+ 'Africa/Lome' => 0,
+ 'Africa/Luanda' => 3600,
+ 'Africa/Lubumbashi' => 7200,
+ 'Africa/Lusaka' => 7200,
+ 'Africa/Malabo' => 3600,
+ 'Africa/Maputo' => 7200,
+ 'Africa/Maseru' => 7200,
+ 'Africa/Mbabane' => 7200,
+ 'Africa/Mogadishu' => 10800,
+ 'Africa/Monrovia' => 0,
+ 'Africa/Nairobi' => 10800,
+ 'Africa/Ndjamena' => 3600,
+ 'Africa/Niamey' => 3600,
+ 'Africa/Nouakchott' => 0,
+ 'Africa/Ouagadougou' => 0,
+ 'Africa/Porto-Novo' => 3600,
+ 'Africa/Sao_Tome' => 0,
+ 'Africa/Timbuktu' => 0,
+ 'Africa/Tripoli' => 7200,
+ 'Africa/Tunis' => 3600,
+ 'Africa/Windhoek' => 3600,
+ 'America/Adak' => -36000,
+ 'America/Anchorage' => -32400,
+ 'America/Anguilla' => -14400,
+ 'America/Antigua' => -14400,
+ 'America/Araguaina' => -10800,
+ 'America/Argentina/Buenos_Aires' => 0,
+ 'America/Argentina/Catamarca' => 0,
+ 'America/Argentina/ComodRivadavia' => 0,
+ 'America/Argentina/Cordoba' => 0,
+ 'America/Argentina/Jujuy' => 0,
+ 'America/Argentina/La_Rioja' => 0,
+ 'America/Argentina/Mendoza' => 0,
+ 'America/Argentina/Rio_Gallegos' => 0,
+ 'America/Argentina/San_Juan' => 0,
+ 'America/Argentina/Tucuman' => 0,
+ 'America/Argentina/Ushuaia' => 0,
+ 'America/Aruba' => -14400,
+ 'America/Asuncion' => -14400,
+ 'America/Atikokan' => 0,
+ 'America/Atka' => -36000,
+ 'America/Bahia' => 0,
+ 'America/Barbados' => -14400,
+ 'America/Belem' => -10800,
+ 'America/Belize' => -21600,
+ 'America/Blanc-Sablon' => 0,
+ 'America/Boa_Vista' => -14400,
+ 'America/Bogota' => -18000,
+ 'America/Boise' => -25200,
+ 'America/Buenos_Aires' => -10800,
+ 'America/Cambridge_Bay' => -25200,
+ 'America/Campo_Grande' => 0,
+ 'America/Cancun' => -21600,
+ 'America/Caracas' => -14400,
+ 'America/Catamarca' => -10800,
+ 'America/Cayenne' => -10800,
+ 'America/Cayman' => -18000,
+ 'America/Chicago' => -21600,
+ 'America/Chihuahua' => -25200,
+ 'America/Coral_Harbour' => 0,
+ 'America/Cordoba' => -10800,
+ 'America/Costa_Rica' => -21600,
+ 'America/Cuiaba' => -14400,
+ 'America/Curacao' => -14400,
+ 'America/Danmarkshavn' => 0,
+ 'America/Dawson' => -28800,
+ 'America/Dawson_Creek' => -25200,
+ 'America/Denver' => -25200,
+ 'America/Detroit' => -18000,
+ 'America/Dominica' => -14400,
+ 'America/Edmonton' => -25200,
+ 'America/Eirunepe' => -18000,
+ 'America/El_Salvador' => -21600,
+ 'America/Ensenada' => -28800,
+ 'America/Fort_Wayne' => -18000,
+ 'America/Fortaleza' => -10800,
+ 'America/Glace_Bay' => -14400,
+ 'America/Godthab' => -10800,
+ 'America/Goose_Bay' => -14400,
+ 'America/Grand_Turk' => -18000,
+ 'America/Grenada' => -14400,
+ 'America/Guadeloupe' => -14400,
+ 'America/Guatemala' => -21600,
+ 'America/Guayaquil' => -18000,
+ 'America/Guyana' => -14400,
+ 'America/Halifax' => -14400,
+ 'America/Havana' => -18000,
+ 'America/Hermosillo' => -25200,
+ 'America/Indiana/Indianapolis' => -18000,
+ 'America/Indiana/Knox' => -18000,
+ 'America/Indiana/Marengo' => -18000,
+ 'America/Indiana/Petersburg' => 0,
+ 'America/Indiana/Vevay' => -18000,
+ 'America/Indiana/Vincennes' => 0,
+ 'America/Indianapolis' => -18000,
+ 'America/Inuvik' => -25200,
+ 'America/Iqaluit' => -18000,
+ 'America/Jamaica' => -18000,
+ 'America/Jujuy' => -10800,
+ 'America/Juneau' => -32400,
+ 'America/Kentucky/Louisville' => -18000,
+ 'America/Kentucky/Monticello' => -18000,
+ 'America/Knox_IN' => -18000,
+ 'America/La_Paz' => -14400,
+ 'America/Lima' => -18000,
+ 'America/Los_Angeles' => -28800,
+ 'America/Louisville' => -18000,
+ 'America/Maceio' => -10800,
+ 'America/Managua' => -21600,
+ 'America/Manaus' => -14400,
+ 'America/Martinique' => -14400,
+ 'America/Mazatlan' => -25200,
+ 'America/Mendoza' => -10800,
+ 'America/Menominee' => -21600,
+ 'America/Merida' => -21600,
+ 'America/Mexico_City' => -21600,
+ 'America/Miquelon' => -10800,
+ 'America/Moncton' => 0,
+ 'America/Monterrey' => -21600,
+ 'America/Montevideo' => -10800,
+ 'America/Montreal' => -18000,
+ 'America/Montserrat' => -14400,
+ 'America/Nassau' => -18000,
+ 'America/New_York' => -18000,
+ 'America/Nipigon' => -18000,
+ 'America/Nome' => -32400,
+ 'America/Noronha' => -7200,
+ 'America/North_Dakota/Center' => -21600,
+ 'America/North_Dakota/New_Salem' => 0,
+ 'America/Panama' => -18000,
+ 'America/Pangnirtung' => -18000,
+ 'America/Paramaribo' => -10800,
+ 'America/Phoenix' => -25200,
+ 'America/Port-au-Prince' => -18000,
+ 'America/Port_of_Spain' => -14400,
+ 'America/Porto_Acre' => -18000,
+ 'America/Porto_Velho' => -14400,
+ 'America/Puerto_Rico' => -14400,
+ 'America/Rainy_River' => -21600,
+ 'America/Rankin_Inlet' => -21600,
+ 'America/Recife' => -10800,
+ 'America/Regina' => -21600,
+ 'America/Rio_Branco' => -18000,
+ 'America/Rosario' => -10800,
+ 'America/Santiago' => -14400,
+ 'America/Santo_Domingo' => -14400,
+ 'America/Sao_Paulo' => -10800,
+ 'America/Scoresbysund' => -3600,
+ 'America/Shiprock' => -25200,
+ 'America/St_Johns' => -12600,
+ 'America/St_Kitts' => -14400,
+ 'America/St_Lucia' => -14400,
+ 'America/St_Thomas' => -14400,
+ 'America/St_Vincent' => -14400,
+ 'America/Swift_Current' => -21600,
+ 'America/Tegucigalpa' => -21600,
+ 'America/Thule' => -14400,
+ 'America/Thunder_Bay' => -18000,
+ 'America/Tijuana' => -28800,
+ 'America/Toronto' => 0,
+ 'America/Tortola' => -14400,
+ 'America/Vancouver' => -28800,
+ 'America/Virgin' => -14400,
+ 'America/Whitehorse' => -28800,
+ 'America/Winnipeg' => -21600,
+ 'America/Yakutat' => -32400,
+ 'America/Yellowknife' => -25200,
+ 'Antarctica/Casey' => 28800,
+ 'Antarctica/Davis' => 25200,
+ 'Antarctica/DumontDUrville' => 36000,
+ 'Antarctica/Mawson' => 21600,
+ 'Antarctica/McMurdo' => 43200,
+ 'Antarctica/Palmer' => -14400,
+ 'Antarctica/Rothera' => 0,
+ 'Antarctica/South_Pole' => 43200,
+ 'Antarctica/Syowa' => 10800,
+ 'Antarctica/VostokArctic/Longyearbyen' => 0,
+ 'Asia/Aden' => 10800,
+ 'Asia/Almaty' => 21600,
+ 'Asia/Amman' => 7200,
+ 'Asia/Anadyr' => 43200,
+ 'Asia/Aqtau' => 14400,
+ 'Asia/Aqtobe' => 18000,
+ 'Asia/Ashgabat' => 18000,
+ 'Asia/Ashkhabad' => 18000,
+ 'Asia/Baghdad' => 10800,
+ 'Asia/Bahrain' => 10800,
+ 'Asia/Baku' => 14400,
+ 'Asia/Bangkok' => 25200,
+ 'Asia/Beirut' => 7200,
+ 'Asia/Bishkek' => 18000,
+ 'Asia/Brunei' => 28800,
+ 'Asia/Calcutta' => 19800,
+ 'Asia/Choibalsan' => 32400,
+ 'Asia/Chongqing' => 28800,
+ 'Asia/Chungking' => 28800,
+ 'Asia/Colombo' => 21600,
+ 'Asia/Dacca' => 21600,
+ 'Asia/Damascus' => 7200,
+ 'Asia/Dhaka' => 21600,
+ 'Asia/Dili' => 32400,
+ 'Asia/Dubai' => 14400,
+ 'Asia/Dushanbe' => 18000,
+ 'Asia/Gaza' => 7200,
+ 'Asia/Harbin' => 28800,
+ 'Asia/Hong_Kong' => 28800,
+ 'Asia/Hovd' => 25200,
+ 'Asia/Irkutsk' => 28800,
+ 'Asia/Istanbul' => 7200,
+ 'Asia/Jakarta' => 25200,
+ 'Asia/Jayapura' => 32400,
+ 'Asia/Jerusalem' => 7200,
+ 'Asia/Kabul' => 16200,
+ 'Asia/Kamchatka' => 43200,
+ 'Asia/Karachi' => 18000,
+ 'Asia/Kashgar' => 28800,
+ 'Asia/Katmandu' => 20700,
+ 'Asia/Krasnoyarsk' => 25200,
+ 'Asia/Kuala_Lumpur' => 28800,
+ 'Asia/Kuching' => 28800,
+ 'Asia/Kuwait' => 10800,
+ 'Asia/Macao' => 28800,
+ 'Asia/Macau' => 0,
+ 'Asia/Magadan' => 39600,
+ 'Asia/Makassar' => 0,
+ 'Asia/Manila' => 28800,
+ 'Asia/Muscat' => 14400,
+ 'Asia/Nicosia' => 7200,
+ 'Asia/Novosibirsk' => 21600,
+ 'Asia/Omsk' => 21600,
+ 'Asia/Oral' => 0,
+ 'Asia/Phnom_Penh' => 25200,
+ 'Asia/Pontianak' => 25200,
+ 'Asia/Pyongyang' => 32400,
+ 'Asia/Qatar' => 10800,
+ 'Asia/Qyzylorda' => 0,
+ 'Asia/Rangoon' => 23400,
+ 'Asia/Riyadh' => 10800,
+ 'Asia/Saigon' => 25200,
+ 'Asia/Sakhalin' => 36000,
+ 'Asia/Samarkand' => 18000,
+ 'Asia/Seoul' => 32400,
+ 'Asia/Shanghai' => 28800,
+ 'Asia/Singapore' => 28800,
+ 'Asia/Taipei' => 28800,
+ 'Asia/Tashkent' => 18000,
+ 'Asia/Tbilisi' => 14400,
+ 'Asia/Tehran' => 12600,
+ 'Asia/Tel_Aviv' => 7200,
+ 'Asia/Thimbu' => 21600,
+ 'Asia/Thimphu' => 21600,
+ 'Asia/Tokyo' => 32400,
+ 'Asia/Ujung_Pandang' => 28800,
+ 'Asia/Ulaanbaatar' => 28800,
+ 'Asia/Ulan_Bator' => 28800,
+ 'Asia/Urumqi' => 28800,
+ 'Asia/Vientiane' => 25200,
+ 'Asia/Vladivostok' => 36000,
+ 'Asia/Yakutsk' => 32400,
+ 'Asia/Yekaterinburg' => 18000,
+ 'Asia/YerevanAtlantic/Azores' => 0,
+ 'Atlantic/Bermuda' => -14400,
+ 'Atlantic/Canary' => 0,
+ 'Atlantic/Cape_Verde' => -3600,
+ 'Atlantic/Faeroe' => 0,
+ 'Atlantic/Jan_Mayen' => 3600,
+ 'Atlantic/Madeira' => 0,
+ 'Atlantic/Reykjavik' => 0,
+ 'Atlantic/South_Georgia' => -7200,
+ 'Atlantic/St_Helena' => 0,
+ 'Atlantic/Stanley' => -14400,
+ 'Australia/ACT' => 36000,
+ 'Australia/Adelaide' => 34200,
+ 'Australia/Brisbane' => 36000,
+ 'Australia/Broken_Hill' => 34200,
+ 'Australia/Canberra' => 36000,
+ 'Australia/Currie' => 0,
+ 'Australia/Darwin' => 34200,
+ 'Australia/Hobart' => 36000,
+ 'Australia/LHI' => 37800,
+ 'Australia/Lindeman' => 36000,
+ 'Australia/Lord_Howe' => 37800,
+ 'Australia/Melbourne' => 36000,
+ 'Australia/NSW' => 36000,
+ 'Australia/North' => 34200,
+ 'Australia/Perth' => 28800,
+ 'Australia/Queensland' => 36000,
+ 'Australia/South' => 34200,
+ 'Australia/Sydney' => 36000,
+ 'Australia/Tasmania' => 36000,
+ 'Australia/Victoria' => 36000,
+ 'Australia/West' => 28800,
+ 'Australia/Yancowinna' => 34200,
+ 'Europe/Amsterdam' => 3600,
+ 'Europe/Andorra' => 3600,
+ 'Europe/Athens' => 7200,
+ 'Europe/Belfast' => 0,
+ 'Europe/Belgrade' => 3600,
+ 'Europe/Berlin' => 3600,
+ 'Europe/Bratislava' => 3600,
+ 'Europe/Brussels' => 3600,
+ 'Europe/Bucharest' => 7200,
+ 'Europe/Budapest' => 3600,
+ 'Europe/Chisinau' => 7200,
+ 'Europe/Copenhagen' => 3600,
+ 'Europe/Dublin' => 0,
+ 'Europe/Gibraltar' => 3600,
+ 'Europe/Guernsey' => 0,
+ 'Europe/Helsinki' => 7200,
+ 'Europe/Isle_of_Man' => 0,
+ 'Europe/Istanbul' => 7200,
+ 'Europe/Jersey' => 0,
+ 'Europe/Kaliningrad' => 7200,
+ 'Europe/Kiev' => 7200,
+ 'Europe/Lisbon' => 0,
+ 'Europe/Ljubljana' => 3600,
+ 'Europe/London' => 0,
+ 'Europe/Luxembourg' => 3600,
+ 'Europe/Madrid' => 3600,
+ 'Europe/Malta' => 3600,
+ 'Europe/Mariehamn' => 0,
+ 'Europe/Minsk' => 7200,
+ 'Europe/Monaco' => 3600,
+ 'Europe/Moscow' => 10800,
+ 'Europe/Nicosia' => 7200,
+ 'Europe/Oslo' => 3600,
+ 'Europe/Paris' => 3600,
+ 'Europe/Prague' => 3600,
+ 'Europe/Riga' => 7200,
+ 'Europe/Rome' => 3600,
+ 'Europe/Samara' => 14400,
+ 'Europe/San_Marino' => 3600,
+ 'Europe/Sarajevo' => 3600,
+ 'Europe/Simferopol' => 7200,
+ 'Europe/Skopje' => 3600,
+ 'Europe/Sofia' => 7200,
+ 'Europe/Stockholm' => 3600,
+ 'Europe/Tallinn' => 7200,
+ 'Europe/Tirane' => 3600,
+ 'Europe/Tiraspol' => 7200,
+ 'Europe/Uzhgorod' => 7200,
+ 'Europe/Vaduz' => 3600,
+ 'Europe/Vatican' => 3600,
+ 'Europe/Vienna' => 3600,
+ 'Europe/Vilnius' => 7200,
+ 'Europe/Volgograd' => 0,
+ 'Europe/Warsaw' => 3600,
+ 'Europe/Zagreb' => 3600,
+ 'Europe/Zaporozhye' => 7200,
+ 'Europe/Zurich' => 3600,
+ 'Indian/Antananarivo' => 10800,
+ 'Indian/Chagos' => 21600,
+ 'Indian/Christmas' => 25200,
+ 'Indian/Cocos' => 23400,
+ 'Indian/Comoro' => 10800,
+ 'Indian/Kerguelen' => 18000,
+ 'Indian/Mahe' => 14400,
+ 'Indian/Maldives' => 18000,
+ 'Indian/Mauritius' => 14400,
+ 'Indian/Mayotte' => 10800,
+ 'Indian/Reunion' => 14400,
+ 'Pacific/Apia' => -39600,
+ 'Pacific/Auckland' => 43200,
+ 'Pacific/Chatham' => 45900,
+ 'Pacific/Easter' => -21600,
+ 'Pacific/Efate' => 39600,
+ 'Pacific/Enderbury' => 46800,
+ 'Pacific/Fakaofo' => -36000,
+ 'Pacific/Fiji' => 43200,
+ 'Pacific/Funafuti' => 43200,
+ 'Pacific/Galapagos' => -21600,
+ 'Pacific/Gambier' => -32400,
+ 'Pacific/Guadalcanal' => 39600,
+ 'Pacific/Guam' => 36000,
+ 'Pacific/Honolulu' => -36000,
+ 'Pacific/Johnston' => -36000,
+ 'Pacific/Kiritimati' => 50400,
+ 'Pacific/Kosrae' => 39600,
+ 'Pacific/Kwajalein' => 43200,
+ 'Pacific/Majuro' => 43200,
+ 'Pacific/Marquesas' => -34200,
+ 'Pacific/Midway' => -39600,
+ 'Pacific/Nauru' => 43200,
+ 'Pacific/Niue' => -39600,
+ 'Pacific/Norfolk' => 41400,
+ 'Pacific/Noumea' => 39600,
+ 'Pacific/Pago_Pago' => -39600,
+ 'Pacific/Palau' => 32400,
+ 'Pacific/Pitcairn' => -28800,
+ 'Pacific/Ponape' => 39600,
+ 'Pacific/Port_Moresby' => 36000,
+ 'Pacific/Rarotonga' => -36000,
+ 'Pacific/Saipan' => 36000,
+ 'Pacific/Samoa' => -39600,
+ 'Pacific/Tahiti' => -36000,
+ 'Pacific/Tarawa' => 43200,
+ 'Pacific/Tongatapu' => 46800,
+ 'Pacific/Truk' => 36000,
+ 'Pacific/Wake' => 43200,
+ 'Pacific/Wallis' => 43200,
+ 'Pacific/Yap' => 36000 );
+
+ $dst_timezones = array (
+ 'America/Adak' => 1,
+ 'America/Atka' => 1,
+ 'America/Anchorage' => 1,
+ 'America/Juneau' => 1,
+ 'America/Nome' => 1,
+ 'America/Yakutat' => 1,
+ 'America/Dawson' => 1,
+ 'America/Ensenada' => 1,
+ 'America/Los_Angeles' => 1,
+ 'America/Tijuana' => 1,
+ 'America/Vancouver' => 1,
+ 'America/Whitehorse' => 1,
+ 'America/Boise' => 1,
+ 'America/Cambridge_Bay' => 1,
+ 'America/Chihuahua' => 1,
+ 'America/Denver' => 1,
+ 'America/Edmonton' => 1,
+ 'America/Inuvik' => 1,
+ 'America/Mazatlan' => 1,
+ 'America/Shiprock' => 1,
+ 'America/Yellowknife' => 1,
+ 'America/Cancun' => 1,
+ 'America/Chicago' => 1,
+ 'America/Menominee' => 1,
+ 'America/Merida' => 1,
+ 'America/Monterrey' => 1,
+ 'America/North_Dakota/Center' => 1,
+ 'America/Rainy_River' => 1,
+ 'America/Rankin_Inlet' => 1,
+ 'America/Winnipeg' => 1,
+ 'Pacific/Easter' => 1,
+ 'America/Detroit' => 1,
+ 'America/Grand_Turk' => 1,
+ 'America/Havana' => 1,
+ 'America/Iqaluit' => 1,
+ 'America/Kentucky/Louisville' => 1,
+ 'America/Kentucky/Monticello' => 1,
+ 'America/Louisville' => 1,
+ 'America/Montreal' => 1,
+ 'America/Nassau' => 1,
+ 'America/New_York' => 1,
+ 'America/Nipigon' => 1,
+ 'America/Pangnirtung' => 1,
+ 'America/Thunder_Bay' => 1,
+ 'America/Asuncion' => 1,
+ 'America/Cuiaba' => 1,
+ 'America/Glace_Bay' => 1,
+ 'America/Goose_Bay' => 1,
+ 'America/Halifax' => 1,
+ 'America/Santiago' => 1,
+ 'Antarctica/Palmer' => 1,
+ 'Atlantic/Bermuda' => 1,
+ 'Atlantic/Stanley' => 1,
+ 'America/St_Johns' => 1,
+ 'America/Araguaina' => 1,
+ 'America/Fortaleza' => 1,
+ 'America/Godthab' => 1,
+ 'America/Maceio' => 1,
+ 'America/Miquelon' => 1,
+ 'America/Recife' => 1,
+ 'America/Sao_Paulo' => 1,
+ 'America/Scoresbysund' => 1,
+ 'Atlantic/Canary' => 1,
+ 'Atlantic/Faeroe' => 1,
+ 'Atlantic/Madeira' => 1,
+ 'Europe/Belfast' => 1,
+ 'Europe/Dublin' => 1,
+ 'Europe/Lisbon' => 1,
+ 'Europe/London' => 1,
+ 'Africa/Ceuta' => 1,
+ 'Africa/Windhoek' => 1,
+ 'Atlantic/Jan_Mayen' => 1,
+ 'Europe/Amsterdam' => 1,
+ 'Europe/Andorra' => 1,
+ 'Europe/Belgrade' => 1,
+ 'Europe/Berlin' => 1,
+ 'Europe/Bratislava' => 1,
+ 'Europe/Brussels' => 1,
+ 'Europe/Budapest' => 1,
+ 'Europe/Copenhagen' => 1,
+ 'Europe/Gibraltar' => 1,
+ 'Europe/Ljubljana' => 1,
+ 'Europe/Luxembourg' => 1,
+ 'Europe/Madrid' => 1,
+ 'Europe/Malta' => 1,
+ 'Europe/Monaco' => 1,
+ 'Europe/Oslo' => 1,
+ 'Europe/Paris' => 1,
+ 'Europe/Prague' => 1,
+ 'Europe/Rome' => 1,
+ 'Europe/San_Marino' => 1,
+ 'Europe/Sarajevo' => 1,
+ 'Europe/Skopje' => 1,
+ 'Europe/Stockholm' => 1,
+ 'Europe/Tirane' => 1,
+ 'Europe/Vaduz' => 1,
+ 'Europe/Vatican' => 1,
+ 'Europe/Vienna' => 1,
+ 'Europe/Warsaw' => 1,
+ 'Europe/Zagreb' => 1,
+ 'Europe/Zurich' => 1,
+ 'Africa/Cairo' => 1,
+ 'Asia/Amman' => 1,
+ 'Asia/Beirut' => 1,
+ 'Asia/Damascus' => 1,
+ 'Asia/Gaza' => 1,
+ 'Asia/Istanbul' => 1,
+ 'Asia/Jerusalem' => 1,
+ 'Asia/Nicosia' => 1,
+ 'Asia/Tel_Aviv' => 1,
+ 'Europe/Athens' => 1,
+ 'Europe/Bucharest' => 1,
+ 'Europe/Chisinau' => 1,
+ 'Europe/Helsinki' => 1,
+ 'Europe/Istanbul' => 1,
+ 'Europe/Kaliningrad' => 1,
+ 'Europe/Kiev' => 1,
+ 'Europe/Minsk' => 1,
+ 'Europe/Nicosia' => 1,
+ 'Europe/Riga' => 1,
+ 'Europe/Simferopol' => 1,
+ 'Europe/Sofia' => 1,
+ 'Europe/Tiraspol' => 1,
+ 'Europe/Uzhgorod' => 1,
+ 'Europe/Zaporozhye' => 1,
+ 'Asia/Baghdad' => 1,
+ 'Europe/Moscow' => 1,
+ 'Asia/Tehran' => 1,
+ 'Asia/Aqtau' => 1,
+ 'Asia/Baku' => 1,
+ 'Asia/Tbilisi' => 1,
+ 'Europe/Samara' => 1,
+ 'Asia/Aqtobe' => 1,
+ 'Asia/Bishkek' => 1,
+ 'Asia/Yekaterinburg' => 1,
+ 'Asia/Almaty' => 1,
+ 'Asia/Novosibirsk' => 1,
+ 'Asia/Omsk' => 1,
+ 'Asia/Krasnoyarsk' => 1,
+ 'Asia/Irkutsk' => 1,
+ 'Asia/Yakutsk' => 1,
+ 'Australia/Adelaide' => 1,
+ 'Australia/Broken_Hill' => 1,
+ 'Australia/South' => 1,
+ 'Australia/Yancowinna' => 1,
+ 'Asia/Sakhalin' => 1,
+ 'Asia/Vladivostok' => 1,
+ 'Australia/ACT' => 1,
+ 'Australia/Canberra' => 1,
+ 'Australia/Hobart' => 1,
+ 'Australia/Melbourne' => 1,
+ 'Australia/NSW' => 1,
+ 'Australia/Sydney' => 1,
+ 'Australia/Tasmania' => 1,
+ 'Australia/Victoria' => 1,
+ 'Australia/LHI' => 1,
+ 'Australia/Lord_Howe' => 1,
+ 'Asia/Magadan' => 1,
+ 'Antarctica/McMurdo' => 1,
+ 'Antarctica/South_Pole' => 1,
+ 'Asia/Anadyr' => 1,
+ 'Asia/Kamchatka' => 1,
+ 'Pacific/Auckland' => 1,
+ 'Pacific/Chatham' => 1,
+ );
+ return(array("TIMEZONES" => $timezones, "DST_ZONES" => $dst_timezones));
+}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>