Advertisement
DrupalCustom

webDelegate

Feb 16th, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.95 KB | None | 0 0
  1. <?php
  2.  
  3. // Database connection.
  4. mysql_connect("localhost", "root", "admin");
  5. mysql_select_db("drupal7cms");
  6.  
  7. $curuname = trim($_GET['curentUser']);
  8.  
  9.  
  10.  
  11. $resultFindMode = mysql_query("SELECT mode_id FROM freeway_mode where sr_id = 1");
  12.  
  13. while ($recordUsPw = mysql_fetch_object($resultFindMode ))
  14.          {
  15.             $modeValueUsPw = $recordUsPw->mode_id;     
  16.          }
  17.          
  18.     if ($modeValueUsPw == '1'){
  19.     $globalResult = mysql_query("SELECT freeway_global_username,freeway_global_password FROM freeway_global_user where sr_id = 1");
  20.    
  21.      while ($recordUsPwGl  = mysql_fetch_object($globalResult)){
  22.      $fusername = $recordUsPwGl->freeway_global_username;
  23.      $fpassword = $recordUsPwGl->freeway_global_password;
  24.      
  25.         }
  26.  
  27.         }  
  28.        
  29.         if ($modeValueUsPw == '2'){
  30.         $nonGlobalResult = mysql_query("SELECT freeway_username ,freeway_password  FROM freeway_users  where drupal_username = '$curuname'");  
  31.        
  32.          while ($recordUsPwNonGl  = mysql_fetch_object($nonGlobalResult)){
  33.          
  34.          $fusername = $recordUsPwNonGl->freeway_global_username;
  35.          $fpassword = $recordUsPwNonGl->freeway_global_password;
  36.          
  37.          }
  38.        
  39.         }
  40.          
  41. $myid = trim($_GET['name']);
  42.  
  43. $arrayWebD = array();
  44. $LoginClient = new SoapClient("https://freeway.demo.lionbridge.com/vojo/FreewayAuth.asmx?wsdl", array("trace"=>1));
  45. $ServicesLink = new SoapClient("https://freeway.demo.lionbridge.com/vojo/Service.asmx?wsdl", array("trace"=>1));
  46.  
  47.       try{   
  48.       $arrResponse = $LoginClient->Logon(array ('Username'=>$fusername,'Password'=>$fpassword));
  49.       $ticket = ($arrResponse->LogonResult);
  50.       $getTarLang = $ServicesLink->GetTargetLanguages (array('Ticket'=>$ticket,'SourceLanguageID'=>$myid));
  51.                        
  52.         foreach($getTarLang->GetTargetLanguagesResult->Languages->Language as $languageT)  
  53.             {                  
  54.                 $arrayWebD[$languageT->ID] = $languageT->Description."_".$languageT->ID;
  55.                
  56.             }        
  57.       }
  58.       catch (SoapFault $exception){
  59.           return $exception;
  60.           }
  61.          
  62.          
  63. print json_encode($arrayWebD);
  64.  
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement