Changeset 5227
- Timestamp:
- 11/07/07 19:20:17 (1 year ago)
- Files:
-
- modules/branches/2.3/core/functions.inc.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.3/core/functions.inc.php
r5225 r5227 770 770 } 771 771 } 772 //if (empty($dial) && strtolower($tech) == "zap")773 // $dial = "ZAP/".($_REQUEST['channel'] != '' ? $_REQUEST['channel'] : $_REQUEST['devinfo_channel']);774 //if (empty($dial))775 // $dial = strtoupper($tech)."/".$id;776 772 777 773 //check to see if we are requesting a new user … … 809 805 $astman->database_put("DEVICE",$id."/type",$devicetype); 810 806 $astman->database_put("DEVICE",$id."/default_user",$user); 811 if(!empty($emergency_cid)) 807 if(!empty($emergency_cid)) { 812 808 $astman->database_put("DEVICE",$id."/emergency_cid","\"".$emergency_cid."\""); 813 if($user != "none") { 809 } 810 811 if ($user != "none") { 814 812 $existingdevices = $astman->database_get("AMPUSER",$user."/device"); 815 813 if (empty($existingdevices)) { 816 814 $astman->database_put("AMPUSER",$user."/device",$id); 817 815 } else { 818 $existingdevices .= "&"; 819 //only append device value if this id doesn't exist in it already 820 if(strpos($existingdevices,$id."&") === false) // if not containing $id 821 $astman->database_put("AMPUSER",$user."/device",$existingdevices.$id); 822 } 823 } 816 $existingdevices_array = explode('&',$existingdevices); 817 if (!in_array($id, $existingdevices_array)) { 818 $existingdevices_array[]=$id; 819 $existingdevices = implode('&',$existingdevices_array); 820 $astman->database_put("AMPUSER",$user."/device",$existingdevices); 821 } 822 } 823 } 824 824 825 } else { 825 826 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); … … 871 872 // Remove the device record from the user's device list 872 873 $userdevices = $astman->database_get("AMPUSER",$deviceuser."/device"); 873 /*$userdevices = str_replace($account."&", "", $userdevices."&"); 874 875 // If there was more than one device, remove the extra "&" at the end. 876 if (substr($userdevices, -1, 1) == "&") { 877 $userdevices = substr($userdevices, 0, -1); 878 }*/ 874 875 // We need to remove just this user and leave the rest alone 879 876 $userdevicesarr = explode("&", $userdevices); 880 array_splice($userdevicesarr, array_search($account, $userdevicesarr), 1); 877 $userdevicesarr_hash = array_flip($userdevicesarr); 878 unset($userdevicesarr_hash[$account]); 879 $userdevicesarr = array_flip($userdevicesarr_hash); 881 880 $userdevices = implode("&", $userdevicesarr); 882 881 … … 2123 2122 2124 2123 2124 //TODO: This needs to be yanked, should be in the upgrade script somewhere not here 2125 // 2125 2126 if (count($results) == 0) { 2126 2127 // see if they're still using the old dialprefix method
