Meerged revisions 2265-2278 from stable branch.
| | |
| | | function ispconfig_sysuser_update($params,$client_id){ |
| | | global $app; |
| | | $username = $app->db->quote($params["username"]); |
| | | $password = $app->db->quote($params["password"]); |
| | | $clear_password = $app->db->quote($params["password"]); |
| | | $client_id = intval($client_id); |
| | | $salt="$1$"; |
| | | $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| | |
| | | $salt.=$base64_alphabet[mt_rand(0,63)]; |
| | | } |
| | | $salt.="$"; |
| | | $password = crypt(stripslashes($password),$salt); |
| | | $sql = "UPDATE sys_user set username = '$username', passwort = '$password' WHERE client_id = $client_id"; |
| | | $password = crypt(stripslashes($clear_password),$salt); |
| | | if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ; |
| | | $sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | |
| | | $client_id = intval($client_id); |
| | | $sql = "DELETE FROM sys_user WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | $sql = "DELETE FROM sys_group WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | | function datalogSave($action,$primary_id, $record_old, $record_new) { |
| | |
| | | $active = 1; |
| | | $language = $app->db->quote($this->dataRecord["language"]); |
| | | |
| | | $salt="$1$"; |
| | | $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| | | for ($n=0;$n<8;$n++) { |
| | | $salt.=$base64_alphabet[mt_rand(0,63)]; |
| | | } |
| | | $salt.="$"; |
| | | $password = crypt(stripslashes($password),$salt); |
| | | |
| | | // Create the controlpaneluser for the client |
| | | //Generate ssh-rsa-keys |
| | | exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""'); |
| | | $app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$this->id; |
| | |
| | | |
| | | // Create the controlpaneluser for the client |
| | | $sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id) |
| | | VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")"; |
| | | VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")"; |
| | | $app->db->query($sql); |
| | | |
| | | //* If the user who inserted the client is a reseller (not admin), we will have to add this new client group |
| | |
| | | // password changed |
| | | if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') { |
| | | $password = $app->db->quote($this->dataRecord["password"]); |
| | | $salt="$1$"; |
| | | $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| | | for ($n=0;$n<8;$n++) { |
| | | $salt.=$base64_alphabet[mt_rand(0,63)]; |
| | | } |
| | | $salt.="$"; |
| | | $password = crypt(stripslashes($password),$salt); |
| | | $client_id = $this->id; |
| | | $sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id"; |
| | | $sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | |
| | | $active = 1; |
| | | $language = $app->db->quote($this->dataRecord["language"]); |
| | | |
| | | $salt="$1$"; |
| | | $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| | | for ($n=0;$n<8;$n++) { |
| | | $salt.=$base64_alphabet[mt_rand(0,63)]; |
| | | } |
| | | $salt.="$"; |
| | | $password = crypt(stripslashes($password),$salt); |
| | | |
| | | // Create the controlpaneluser for the reseller |
| | | $sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id) |
| | | VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")"; |
| | | VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")"; |
| | | $app->db->query($sql); |
| | | |
| | | //* set the number of clients to 1 |
| | |
| | | if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') { |
| | | $password = $app->db->quote($this->dataRecord["password"]); |
| | | $client_id = $this->id; |
| | | $sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id"; |
| | | $salt="$1$"; |
| | | $base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; |
| | | for ($n=0;$n<8;$n++) { |
| | | $salt.=$base64_alphabet[mt_rand(0,63)]; |
| | | } |
| | | $salt.="$"; |
| | | $password = crypt(stripslashes($password),$salt); |
| | | $sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id"; |
| | | $app->db->query($sql); |
| | | } |
| | | |
| | |
| | | |
| | | /* Which dashlets in which column */ |
| | | /******************************************************************************/ |
| | | $leftcol_dashlets = array('modules'); |
| | | $leftcol_dashlets = array('modules','invoices'); |
| | | $rightcol_dashlets = array('limits'); |
| | | /******************************************************************************/ |
| | | |
| | |
| | | {tmpl_var name='name'} NS {tmpl_var name='data'} |
| | | </tmpl_if> |
| | | <tmpl_if name="type" op='==' value='A'> |
| | | {tmpl_var name='name'} A {tmpl_var name='data'} |
| | | {tmpl_var name='name'} {tmpl_var name='ttl'} A {tmpl_var name='data'} |
| | | </tmpl_if> |
| | | <tmpl_if name="type" op='==' value='AAAA'> |
| | | {tmpl_var name='name'} AAAA {tmpl_var name='data'} |
| | |
| | | Register for the events |
| | | */ |
| | | |
| | | $app->plugins->registerEvent('mail_user_insert','maildeliver_plugin','update'); |
| | | $app->plugins->registerEvent('mail_user_update','maildeliver_plugin','update'); |
| | | $app->plugins->registerEvent('mail_user_delete','maildeliver_plugin','delete'); |
| | | |
| | |
| | | Register for the events |
| | | */ |
| | | |
| | | $app->plugins->registerEvent('mail_user_update','maildrop_plugin','insert'); |
| | | $app->plugins->registerEvent('mail_user_update','maildrop_plugin','update'); |
| | | $app->plugins->registerEvent('mail_user_delete','maildrop_plugin','delete'); |
| | | |