summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3422af2)
raw | patch | inline | side by side (parent: 3422af2)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Sep 2005 12:53:15 +0000 (12:53 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Sep 2005 12:53:15 +0000 (12:53 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1288 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/gofon/phoneaccount/class_phoneAccount.inc | patch | blob | history | |
plugins/gofon/phoneaccount/generic.tpl | patch | blob | history |
diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc
index 819b5b2da46c90e7cf98e978c41d8d63e0d55bd8..814d890268a70951b60b7566e3ba5d17e02c54a9 100644 (file)
var $goFonHardware = "";
var $goFonFormat = "";
var $goFonPIN = "";
- var $goFonVoicePIN = "";
+ var $goFonVoicemailPIN = "";
var $goFonDeliveryMode = "";
var $phoneNumbers = array();
var $mail = "";
/* attribute list for save action */
var $attributes = array("goFonDeliveryMode", "goFonFormat","uid","cn","mail",
- "goFonHardware","goFonPIN", "telephoneNumber", "goFonMacro","macro");
+ "goFonHardware","goFonPIN","goFonVoicemailPIN","telephoneNumber", "goFonMacro","macro");
var $objectclasses= array("goFonAccount");
function phoneAccount ($config, $dn= NULL)
}
}
- $attrs = @mysql_fetch_row(@mysql_query("SELECT * FROM ".$a_SETUP['VOICE_TABLE']." WHERE customer_id=".$this->phoneNumbers[$first].";"));
- if($attrs){
- $this->goFonPINVoice = $attrs[4];
- }else{
- $this->goFonPINVoice = false;
- }
-
/* Load hardware list */
$ldap= $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$this->is_modified = true;
}
- /* Set PINs to false,
- * to avoid setting them before we explicitly
- * pressed set voicemail PIN or Phone PIN
- */
-
- if(count(split("\|",$this->goFonPIN))==2){
- $tmp = split("\|",$this->goFonPIN);
- $this->goFonPIN = $tmp[0];
- $this->goFonVoicePIN = $tmp[1];
- }else{
- $this->goFonVoicePIN = $this->goFonPIN;
- }
-
- // Unset goFonPIN, to avoid save_object for this attribute
- foreach($this->attributes as $key=>$val){
- if($val == "goFonPIN"){
- unset($this->attributes[$key]);
- }
- }
-
}
return false;
}
- $existence = @mysql_fetch_row(@mysql_query( "SELECT * FROM ".$a_SETUP['SIP_TABLE']." WHERE name='".$this->uid."';"));
-
- if(!$existence&&((empty($this->goFonPIN))||(empty($this->goFonVoicePIN)))){
- $this->generate_error = _("You are currently creating a new phone account, please specify a value for phone PIN and voice PIN.");
- return(false);
- }
-
- if((empty($this->goFonPIN))&&(empty($existence[27]))){
- $this->generate_error = _("The PIN attribute is missing in database entry. Please assign a valid phone PIN.");
- return(false);
- }
-
- if(isset($existence[15])){
- $voice = @mysql_fetch_row(@mysql_query("SELECT password FROM ".$a_SETUP['VOICE_TABLE']." where customer_id='".$existence[15]."'"));
- if((empty($this->goFonVoicePIN))&&(empty($voice[0]))){
- $this->generate_error = _("The voice PIN attribute is missing in database entry. Please assign a valid voice PIN.");
- return(false);
- }
- }
-
/* If Save == true, we should save something.
* Generate SQL, for drop of old entries
* Generate SQL, for insert new entries
*/
if($save == true){
- /* Get old voice passwword if no new isset */
- if($this->goFonPIN==false){
- $pin = @mysql_fetch_row(@mysql_query("SELECT secret FROM ".$a_SETUP['SIP_TABLE']." where name='".$this->uid."'"));
- $this->goFonPIN = $pin[0];
- }
-
// Attribute GoFonDefaultIP set ?
if(((isset($a_ldap_attrs['goFonDefaultIP'][0]))&&($a_ldap_attrs['goFonDefaultIP'][0] != "dynamic"))){
$s_ip = $a_ldap_attrs['goFonDefaultIP'][0];
$sip_data_array['restrictcid'] = "n";
$sip_data_array['rtptimeout'] = NULL;
$sip_data_array['rtpholdtimeout']=NULL;
- $sip_data_array['secret'] = $s_pin;
+ $sip_data_array['secret'] = $this->goFonPIN;
$sip_data_array['type'] = $s_type ;
$sip_data_array['username'] = $this->uid;
$sip_data_array['disallow'] = NULL;
}
- /* Get old voice passwword if no new isset */
- if($this->goFonVoicePIN==false){
- $voice = @mysql_fetch_row(@mysql_query("SELECT password FROM ".$a_SETUP['VOICE_TABLE']." where customer_id=".$this->phoneNumbers[$i_new_key].""));
- $this->goFonVoicePIN = $voice[0];
- }
-
- /* Get old voice passwword if no new isset */
- if($this->goFonPIN==false){
- $pin = @mysql_fetch_row(@mysql_query("SELECT secret FROM ".$a_SETUP['SIP_TABLE']." where name='".$this->uid."'"));
- $this->goFonPIN = $pin[0];
- }
-
// $SQL contains all queries
$SQL = array();
$SQL[] = "DELETE FROM ".$a_SETUP['EXT_TABLE']." WHERE exten='".$this->uid."';\n";
}
}
- if(empty($this->goFonPINVoice)){
- $this->goFonPINVoice = $this->goFonPIN;
- }
-
/* If deletion starts from userslist, cn uid are not set */
if((isset($this->parent->by_object['user']->uid))&&(!empty($this->parent->by_object['user']->uid))){
$this->uid = $this->parent->by_object['user']->uid;
VALUES ('".$this->phoneNumbers[$i_new_key]."',
'default',
'".$this->phoneNumbers[$i_new_key]."',
- '".$this->goFonVoicePIN."',
+ '".$this->goFonVoicemailPIN."',
'".$CNname."',
'".$s_mail."',
'');";
$this->macro ="none";
}
- if(isset($_POST['goFonVoicePINSet'])){
- if((strlen($_POST['goFonVoicePIN'])==0)||(strlen($_POST['goFonVoicePIN'])>4)){
- print_red(_("Voicemail PIN must be between 1-4 characters."));
- }else{
- if(preg_match("/[^0-9]/",$_POST['goFonVoicePIN'])){
- print_red(_("The specified Voicemail PIN contains invalid characters, only numeric values are allowed here."));
- }else{
- $this->goFonVoicePIN=$_POST['goFonVoicePIN'];
- }
- }
- }
-
- if(isset($_POST['goFonPINSet'])){
- if((strlen($_POST['goFonPIN'])!=4)){
- print_red(_("Phone PIN must be 4 characters long."));
- }else{
- if(preg_match("/[^0-9]/",$_POST['goFonVoicePIN'])){
- print_red(_("The specified phone PIN contains invalid characters, only numeric values are allowed here."));
- }else{
- $this->goFonPIN=$_POST['goFonPIN'];
- }
- }
- }
-
/* tell user that the pluging selected is no longer available*/
if((!$this->macrostillavailable)&&($this->macro!="none")){
print_red(_("The macro you selected, is no longer available for you, please choose another one."));
/* Show main page */
- foreach(array("goFonVoicePIN","goFonPIN") as $attrs ){
- $smarty->assign($attrs,$this->$attrs);
- $smarty->assign($attrs."ACL",chkacl($this->acl,$attrs));
- }
-
-
$display.= $smarty->fetch(get_template_path('generic.tpl', TRUE, dirname(__FILE__)));
return($display);
}
/* Reset message array */
$message= array();
+ if((strlen($this->goFonVoicemailPIN)==0)||(strlen($this->goFonVoicemailPIN)>4)){
+ $message[]=(_("Voicemail PIN must be between 1-4 characters."));
+ }else{
+ if(preg_match("/[^0-9]/",$this->goFonVoicemailPIN)){
+ $message[]=(_("The specified oicemail PIN contains invalid characters, only numeric values are allowed here."));
+ }
+ }
+
+
+ if((strlen($this->goFonPIN)!=4)){
+ $message[]=(_("Phone PIN must be 4 characters long."));
+ }else{
+ if(preg_match("/[^0-9]/",$this->goFonPIN)){
+ $message[]=(_("The specified phone PIN contains invalid characters, only numeric values are allowed here."));
+ }
+ }
+
if(!$this->generate_mysql_entension_entries()){
$message[] = $this->generate_error;
}
$this->attrs['goFonMacro']=array();
}
- /* Cahnged behavior for goFonPIN */
- $this->attrs['goFonPIN'] = $this->goFonPIN."|".$this->goFonVoicePIN;
-
unset($this->attrs['cn']);
/* Write back to ldap */
}
}
- $this->attributes[]="goFonPIN";
-
// Get Configuration for Mysql database Server
$a_SETUP = $_SESSION['config']->data['SERVERS']['FON'];
$s_parameter ="";
index 40de9a79bf8bb632c56bf935a4be4ac23d5a1725..8ebe06f8bee1b085a846d482e2123a1dbad65866 100644 (file)
</tr>
<tr>
<td>
- <LABEL for="goFonPIN">{t}Voicemail PIN{/t}{$must}</LABEL>
+ <LABEL for="goFonVoicemailPIN">{t}Voicemail PIN{/t}{$must}</LABEL>
</td>
<td>
- <input type="password" id="goFonVoicePIN" name="goFonVoicePIN" value="{$goFonVoicePIN}" {$goFonPINACL}>
- <input type="submit" name="goFonVoicePINSet" value="{t}Set phone password{/t}" {$goFonPINACL}>
+ <input type="password" id="goFonVoicemailPIN" name="goFonVoicemailPIN" value="{$goFonVoicemailPIN}" {$goFonVoicemailPINACL}>
</td>
</tr>
<tr>
</td>
<td>
<input type="password" id="goFonPIN" name="goFonPIN" value="{$goFonPIN}" {$goFonPINACL}>
- <input type="submit" name="goFonPINSet" value="{t}Set voicemail password{/t}" {$goFonPINACL}>
</td>
</tr>
</table>