diff --git a/.gitattributes b/.gitattributes index ab40dca5..402df2f5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -348,11 +348,6 @@ bureau/class/m_hooks.php -text bureau/class/m_hta.php -text bureau/class/m_log.php -text bureau/class/m_mail.php -text -bureau/class/m_mail_alias.php -text -bureau/class/m_mail_jabber.php -text -bureau/class/m_mail_localbox.php -text -bureau/class/m_mail_redirection.php -text -bureau/class/m_mail_squirrelmail.php -text bureau/class/m_mem.php -text bureau/class/m_mysql.php -text bureau/class/m_piwik.php -text diff --git a/bureau/class/m_mail_alias.php b/bureau/class/m_mail_alias.php deleted file mode 100644 index 77bfac11..00000000 --- a/bureau/class/m_mail_alias.php +++ /dev/null @@ -1,151 +0,0 @@ -enabled=variable_get('mail_alias_enabled',null); - if (is_null($this->enabled)) { // if not configuration var, setup one (with a default value) - variable_set('mail_alias_enabled',true,'To enable or disable the alias module in the mail edit page'); - $this->enabled=true; - } - - $this->advanced=variable_get('mail_alias_advanced',null); - if (is_null($this->advanced)) { // if not configuration var, setup one (with a default value) - variable_set('mail_alias_advanced',true,'To place the alias option in the advanced area'); - $this->advanced=true; - } - } - - /* - * function used to list every aliases ( aka local redirections ) of a given mail address - * param: mail address aliased. - * return : an array containing every alias of a given mail on every domain related to the current user. - * - */ - - function list_alias($mail_address) { - global $db, $mail, $cuid,$err; - $err->log("mail_alias","list_alias"); - $db->query("SELECT r.id as id, r.address_id from recipient r,address a, domaines d where r.recipients REGEXP '^[[:space:]]*".mysql_real_escape_string($mail_address)."[[:space:]]*$'and r.address_id=a.id and a.domain_id=d.id and d.compte = $cuid;"); - $rcp = Array(); - while ($db->next_record()) { - $rcp[$db->f("id")] = $db->f("address_id"); - } - foreach ($rcp as $k => $v) { - $rcp[$k] = $mail->mail_get_details($v, false); - } - return $rcp; - } - - function form($mail_id, $edit_id) { - global $mail,$err; - if ($edit_id) { - //echo "";__("Edit");echo ""; - echo "";__("Edit");echo ""; - } else { - include('mail_alias_create.inc.php'); - } - } - - - /** - *hooks called to list a given mail properties - *@param: the id of the mail in question - *@return: an hashtable of every information usefull to edit the mail if it is part of the class - *including a url to the edition page of the propertie in question ( here local hosting of a mail) - *if the mail cannot be a localbox because of some of it's properties the return is NULL, thus not *displayed in the properties listing page. - */ - function hooks_mail_properties_list($mail_id){ - global $db, $mail, $err; - $err->log("mail","mail_properties_list"); - $val = array ( - "label" => "alias", - "short_desc" => _("Alias"), - "human_desc" => _("To add an alias to this mail address.
You must have the domain's alias setup in your AlternC account."), - "url" => "mail_alias_create.php?mail_id=$mail_id", - "class" => "mail_alias", - "form_param" => Array($mail_id,false), - "advanced" => $this->advanced, - "pass_required" => false - ); - - if (!$details = $mail->mail_get_details($mail_id, true)) return Array(); - $return=Array(); - $return[]=$val; // To be able to add a new alias - foreach ($details['alias'] as $k => $v ) { - $tmp = $val; - $tmp['url'] = "mail_redirection_edit.php?mail_id=".$v['address_id']; - $tmp["form_param"] = Array($mail_id,$v['address_id']); - $tmp['short_desc'] = sprintf(_("Alias of %s"),$v['address_full']); - $tmp['human_desc'] = sprintf(_("All the mails sent to %s will be received here."),$v['address_full']); - $return[] = $tmp; - } - - - return $return; - - } - - /* - * Function inserting an alias in the recipient table - * @param integer alias_id : unique id of the alias just inserted in address table. - * @param string mail_arg : the mail being aliased. - * @return true if the alias was inserted ,false if there is an error or if alias al* ready in the base - */ - function setalias($alias_id,$mail_arg){ - global $db, $err; - $err->log("mail","setalias"); - - $compare=$this->list_alias($mail_arg); - $db->query("select address from address where id=$alias_id;"); - $db->next_record(); - $mail_left=$db->f('address'); - foreach($compare as $k => $v){ - if($v['address'] === $mail_left) - return false; - } - $db->query("INSERT INTO recipient (address_id, recipients) VALUES ($alias_id,'$mail_arg');"); - return true; - - - - } - -} - -?> diff --git a/bureau/class/m_mail_jabber.php b/bureau/class/m_mail_jabber.php deleted file mode 100644 index 2f09662b..00000000 --- a/bureau/class/m_mail_jabber.php +++ /dev/null @@ -1,88 +0,0 @@ -enabled=variable_get('mail_jabber_enabled',null); - $this->advanced=variable_get('mail_jabber_advanced',null); - - // Setup the vars if there aren't any - if (is_null($this->enabled)) { - variable_set('mail_jabber_enabled',true,'To enable or disable the Jabber module in the mail edit page'); - $this->enabled=true; - } - - if (is_null($this->advanced)) { - variable_set('mail_jabber_advanced',true,'To choose the category of Jabber in the mail edit page'); - $this->advanced=true; - } - - } - - /** - * Hooks called by the mail class, it's - * used to verify that a given mail is - * allowed to be created by all the class friends of mail - * - * @param dom_id integer domain id of the target mail - * @param mail_arg string left part of '@' of the target mail - * @return array a hashtable contening the statei (boolean) and an error message - * - */ - function hooks_mail_cancreate($dom_id, $mail_arg){ - global $db, $err, $cuid; - $err->log("m_mail_jabber","hooks_mail_cancreate"); - $return = array ( - "state" => true, // Do we allow this creation ? - "error" => ""); // Error message (txt) - - // Return our informations - return $return; - } - - /** - * Hooks called to list a given mail properties - * @param mail_id the id of the mail being processed - * @return false, or an hashtable of the usefull information - * - **/ - function hooks_mail_properties_list($mail_id){ - global $db, $err; - $err->log("mail_jabber","mail_properties_list"); - - // Return if this feature isn't enabled - if (!$this->enabled) return false; - - // Setup the object - $return = array ( - "label" => "jabberdemo", // an internal label - "short_desc" => _("Jabber Demo"), // A human short description - "class" => "mail_jabber", - "human_desc" => _("This is just a demo.
Look at m_mail_jabber.php"), // A human long description - "form_param" => Array($mail_id), - "url" => "javascript:alert('Ici un renvoie vers le formulaire adequat de cette entrée.');", // The URL to go - "pass_required" => true, // This feature require the mail to have a global password ? - "advanced" => $this->advanced, // Is this an advanced feature ? - ); - - /* We can return many array merged to have many - * entry (with different informations, for example - * different description or target URL), to list many - * action directly in the page - **/ - // To view an example, uncomment next line - // $return=Array($return,$return,$return); - return $return; - } - -} - -?> diff --git a/bureau/class/m_mail_localbox.php b/bureau/class/m_mail_localbox.php deleted file mode 100644 index 993aeaca..00000000 --- a/bureau/class/m_mail_localbox.php +++ /dev/null @@ -1,183 +0,0 @@ -enabled=variable_get('mail_localbox_enabled',null); - if (is_null($this->enabled)) { // if not configuration var, setup one (with a default value) - variable_set('mail_localbox_enabled',true,'To enable or disable the alias module in the mail edit page'); - $this->enabled=true; - } - - $this->advanced=variable_get('mail_localbox_advanced',null); - if (is_null($this->advanced)) { // if not configuration var, setup one (with a default value) - variable_set('mail_localbox_advanced',false,'To place the alias option in the advanced area'); - $this->advanced=false; - } - } - - /* - * Set a localbox - * @param integer $mail_id - */ - function set_localbox($mail_id){ - global $db, $err, $hooks; - $err->log("localbox","set_localbox!!!!!!!!"); - $path="mail/"; - if(!$db->query("select distinct left(ad.address,1) as letter,ad.address ,d.domaine from address ad, domaines d where ad.domain_id = d.id and ad.id = $mail_id order by letter;")); - - if(! $db->next_record()){ - return null; - } - //FIXME passer par un hooks pour squirel - $hooks->invoke('hooks_squirrelmail_init',(array($db->f('address'),$db->f('domaine') ))); - $path="/var/alternc/mail/".$db->f('letter')."/".$db->f('address')."_".$db->f('domaine'); - if(!$db->query("INSERT into mailbox (address_id,path,quota) values ($mail_id,'$path',50);")); - - } - - /* - * Unset a localbox - * @param integer $mail_id - */ - function unset_localbox($mail_id){ - global $db, $err,$hooks; - $err->log("localbox","unset_localbox"); - if(!$db->query("select address,domaine from address,domaines where address.domain_id=domaines.id and address.id=$mail_id ;")); - - if(! $db->next_record()){ - return null; - } - $hooks->invoke('hooks_squirrelmail_delete',(array($db->f('address'),$db->f('domaine') ))); - if(!$db->query("DELETE from mailbox where address_id=$mail_id;")); - - } - - - /* - hooks called by the mail class, it is used to verify that a given mail is not already in the adress table - in wich case we can create it so the - @param: dom_id=domain in use, mail_arg= mail address waiting to be created - @result: an hashtable contening the state ( success /failure, un case of success) the id of the created mail, and an error message if something went wrong. - */ - function hooks_mail_cancreate($dom_id, $mail_arg){ - global $db, $err, $cuid; - $err->log("m_mail_localbox","hooks_mail_cancreate"); - $return = array ( - "state" => true, - "mail_id" => null, - "error" => ""); - - return $return; - } - - - function form($mail_id) { - global $mail, $err; - include('mail_localbox_edit.inc.php'); - } - - /* hooks called to list a given mail properties - * @param: the id of the mail being processed - * @return: an hashtable of every information usefull to edit the mail if it is part of the class - * including a url to the edition page of the propertie in question ( here local hosting of a mail) - * if the mail cannot be a localbox because of some of it's properties the return is NULL, thus not displayed in the properties listing page. - */ - function hooks_mail_properties_list($mail_id){ - global $db, $err; - $err->log("mail_localbox","mail_properties_list"); - $return = array ( - "label" => "localbox", - "short_desc" => _("Local mailbox"), - "human_desc" => _("Actually disabled.
To have your mail stored on the server.
You can access them remotely with the webmail, IMAP or POP"), - "url" => "mail_localbox_edit.php", - "form_param" => Array($mail_id), - "class" => 'mail_localbox', - "pass_required" => true, - "advanced" => $this->advanced - ); - - - // on recherche si la boite est deja presente en tant que boite locale - $db->query("select address_id from mailbox where address_id=$mail_id;"); - - // Si pas d'entrée dans mailbox, on retourne directement le Array - if(! $db->next_record()){ - $return['url'] .= "?mail_id=$mail_id"; - return $return; - } - // Sinon, on le met à jour avant - $return["is_local"]= true; - $return["object_id"]= $db->f('address_id'); - $return["human_desc"] = _("Actually enabled.
Your mails are stored on the server.
You can access them remotely with the webmail, IMAP or POP"); - - // On met à jour l'URL - $return['url'] .= "?mail_id=$mail_id"; - - return $return; - } - - - /* Function testing if a given mail id is hosted as a localbox on the domain or not - * @param: mail_id - * @return: an indexed array of localbox usefull informations - */ - function details($mail_id){ - global $db,$err; - $err->log("mail_localbox","details"); - $mail_local = array ( - "path" => "", - "quota" => null, - "delivery" => ""); - - $db->query("select path, quota, delivery from mailbox where address_id=$mail_id;"); - if (! $db->next_record()) return false; - - $mail_local["path"]=$db->f("path"); - $mail_local["quota"]=$db->f("quota"); - $mail_local["delivery"]=$db->f("delivery"); - return $mail_local; - } - - -} - -?> diff --git a/bureau/class/m_mail_redirection.php b/bureau/class/m_mail_redirection.php deleted file mode 100644 index 1ee1cc09..00000000 --- a/bureau/class/m_mail_redirection.php +++ /dev/null @@ -1,161 +0,0 @@ -enabled=variable_get('mail_redirection_enabled',null); - if (is_null($this->enabled)) { // if not configuration var, setup one (with a default value) - variable_set('mail_redirection_enabled',true,'To enable or disable the alias module in the mail edit page'); - $this->enabled=true; - } - - $this->advanced=variable_get('mail_redirection_advanced',null); - if (is_null($this->advanced)) { // if not configuration var, setup one (with a default value) - variable_set('mail_redirection_advanced',true,'To place the redirection option in the advanced area'); - $this->advanced=true; - } - } - - - /** - * function listing each redirections associated with a mail on th ecurrent domain - * @param integer mail_id - * @return ani indexed array of all the recipients of a mail address - */ - function list_recipients($mail_id) { - global $db,$err; - $err->log("mail_redirection","list_recipient"); - $db->query("SELECT r.id, r.recipients from recipient r where address_id = ".intval($mail_id)." order by r.recipients ;"); - $recipients = Array(); - while ($db->next_record()) { - $recipients[$db->f("id")] = $db->f("recipients"); - } - return $recipients; - } - - /** - * Fonction used to insert the redirections specified by te panel - * @param integer $mail_id - * @param array $recipients : an array contening each and every domain specific mail redirection for a given mail. - * @return: true if everything went ok, false if one are more recipients could not be added - */ - function setredirection($mail_id, $recipients){ - global $db,$err; - $err->log("mail_redirection","setredirection"); - - $all_correct=true; - - $recipients=array_unique($recipients); - foreach($recipients as $k => $v){ - if(checkmail($recipients[$k]) != 0){ - unset($recipients[$k]); - $all_correct=false; - } - } - - $recip_clean=array_values($recipients); - - $rec_tmp=implode("\n",$recip_clean); - $db->query("INSERT INTO recipient (address_id,recipients) values ($mail_id,'$rec_tmp') ON DUPLICATE KEY UPDATE recipients='$rec_tmp' ;"); - if($all_correct == false){ - return false; - }else{ - return true; - } - } - - - /* - * Function using list_recipient() to get the list of recipient of a mail and turning it into an array - * @param integer $mail_id : mail unique identifier. - * @return array - */ - function recipients_get_array($mail_id) { - global $mail,$err; - $err->log("mail_redirection","recipient_get_array"); - $r = $this->list_recipients($mail_id); - - foreach ($r as $b) {$v = explode("\n", $b);} // Only one pass, this array is a 1 row array - if (empty($v)) $v=Array(); - foreach ($v as $k => $f) { if (empty($f)) unset($v[$k]); } // clear empty entry - sort($v); - - return $v; - } - - function recipients_set_array($mail_id, $recipients){ - global $db,$err,$mail; - } - - - function form($mail_id) { - global $mail, $err, $mail_redirection; - include('mail_redirection_edit.inc.php'); - } - - /* - * hooks called to list a given mail properties - * @param: the id of the mail in question - * @return: an hashtable of every information usefull to edit the mail if it is part of the class - * including a url to the edition page of the propertie in question ( here local hosting of a mail) - * if the mail cannot be a localbox because of some of it's properties the return is NULL, thus not - * displayed in the properties listing page. - */ - function hooks_mail_properties_list($mail_id){ - global $db, $mail, $err; - $err->log("mail_redirection","mail_properties_list"); - $return = array ( - "label" => "redirection", - "short_desc" => _("Redirection"), - "human_desc" => _("Send a copy of incoming emails to another mail address"), - "url" => "mail_redirection_edit.php?mail_id=$mail_id", - "form_param" => Array($mail_id), - "class" => "mail_redirection", - "advanced" => $this->advanced, - "pass_required" => false - ); - - return $return; - } - - //FIXME fonction de suppresion. - -} - -?> diff --git a/bureau/class/m_mail_squirrelmail.php b/bureau/class/m_mail_squirrelmail.php deleted file mode 100644 index b548b68a..00000000 --- a/bureau/class/m_mail_squirrelmail.php +++ /dev/null @@ -1,58 +0,0 @@ -log("mail_squirrelmail","squirrelmail_init",$mail."@".$dom); - $m=substr($mail,0,1); - $gecos=$mail; - if (!$mail) { - // Cas du CATCH-ALL - $gecos="Catch-All"; - $m="_"; - } - - - $f=fopen("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","wb"); - $g=0; $g=@fopen("/etc/squirrelmail/default_pref","rb"); - fputs($f,"email_address=$mail@$dom\nchosen_theme=default_theme.php\n"); - if ($g) { - while ($s=fgets($g,1024)) { - if (substr($s,0,14)!="email_address=" && substr($s,0,13)!="chosen_theme=") { - fputs($f,$s); - } - } - fclose($g); - } - fclose($f); - @copy("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref","/var/lib/squirrelmail/data/".$mail."@".$dom.".pref"); - return true; - } - - function hooks_squirrelmail_delete($mail,$dom){ - global $err,$cuid,$db; - $err->log("mail_squirrelmail","squirrelmail_delete",$mail."@".$dom); - - @unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".pref"); - @unlink("/var/lib/squirrelmail/data/".$mail."_".$dom.".abook"); - @unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".pref"); - @unlink("/var/lib/squirrelmail/data/".$mail."@".$dom.".abook"); - return true; - - } - -} - -?>