Esempio n. 1
0
 /**
  * Initialize the soap client and store in the $GLOBALS object for use
  * 
  * @param login    designates whether we want to try to login after we initialize or not
  */
 function initialize($login = true)
 {
     if (empty($GLOBALS['SugarDepot'])) {
         $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
         $soap_client = new nusoapclient(HTTPS_URL, false);
         $ping = $soap_client->call('sugarPing', array());
         $GLOBALS['SugarDepot'] = $soap_client;
     }
     //if we do not have a session, then try to login
     if ($login && empty($_SESSION['SugarDepotSessionID'])) {
         PackageManagerComm::login();
     }
 }
 function getHeader()
 {
     global $current_language;
     $mod_strings = return_module_language($current_language, "Administration");
     $header_text = '';
     $isAlive = false;
     $show_login = false;
     if (!function_exists('curl_init') && $show_login) {
         $header_text = "<font color='red'><b>" . $mod_strings['ERR_ENABLE_CURL'] . "</b></font>";
         $show_login = false;
     } else {
         $credentials = PackageManager::getCredentials();
         if (empty($credentials['username']) || empty($credentials['password'])) {
             //$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
         } else {
             $result = PackageManagerComm::login();
             if (is_array($result) && !empty($result['faultcode']) || $result == false) {
                 $header_text = "<font color='red'><b>" . $result['faultstring'] . "</b></font>";
             } else {
                 $header_text = PackageManager::getPromotion();
                 $isAlive = true;
             }
         }
     }
     return array('text' => $header_text, 'isAlive' => $isAlive, 'show_login' => $show_login);
 }
 /**
  * Given the Mambo username, password, and download key attempt to authenticate, if
  * successful then store these credentials
  *
  * @param username      Mambo username
  * @param password      Mambo password
  * @param systemname   the user's download key
  * @return              true if successful, false otherwise
  */
 function authenticate($username, $password, $systemname = '', $terms_checked = true)
 {
     PackageManager::setCredentials($username, $password, $systemname);
     PackageManagerComm::clearSession();
     $result = PackageManagerComm::login($terms_checked);
     if (is_array($result)) {
         return $result;
     } else {
         return true;
     }
 }