Example #1
0
 public static function GetConfigByUserId($userId)
 {
     $userId = intval($userId);
     if ($userId > 0) {
         $viUser = new CVoxImplantUser();
         $userInfo = $viUser->GetUserInfo($userId);
         if ($userInfo['user_backphone'] == '') {
             $userInfo['user_backphone'] = CVoxImplantConfig::LINK_BASE_NUMBER;
         }
     } else {
         $userInfo = array();
         $userInfo['user_backphone'] = CVoxImplantConfig::GetPortalNumber();
         $userInfo['user_extranet'] = false;
     }
     if ($userInfo['user_extranet']) {
         $result = array('error' => array('code' => 'EXTRANAET', 'msg' => 'Extranet user can not use telephony'));
     } else {
         if ($userInfo['user_backphone'] == CVoxImplantPhone::GetLinkNumber() || $userInfo['user_backphone'] == CVoxImplantConfig::LINK_BASE_NUMBER) {
             $result = self::GetLinkConfig();
         } else {
             $result = CVoxImplantConfig::GetConfigBySearchId($userInfo['user_backphone']);
             if (isset($result['ERROR']) && strlen($result['ERROR']) > 0) {
                 $result = self::GetLinkConfig();
             }
         }
     }
     $result['USER_ID'] = $userId;
     return $result;
 }
Example #2
0
 public function GetOneTimeKey($key)
 {
     $ViAccount = new CVoxImplantAccount();
     $accountName = $ViAccount->GetAccountName();
     if (!$accountName) {
         $this->error = new CVoxImplantError(__METHOD__, $ViAccount->GetError()->code, GetMessage('VI_GET_ACCOUNT_INFO', array('#CODE#' => $ViAccount->GetError()->code)));
         return false;
     }
     $ViUser = new CVoxImplantUser();
     $userInfo = $ViUser->GetUserInfo($this->userId);
     if (!$userInfo) {
         $this->error = new CVoxImplantError(__METHOD__, $ViUser->GetError()->code, GetMessage('VI_GET_USER_INFO', array('#CODE#' => $ViUser->GetError()->code)));
         return false;
     }
     return md5($key . "|" . md5($userInfo['user_login'] . ":voximplant.com:" . $userInfo['user_password']));
 }