Example #1
0
 /**
  * Register the new install with the LC API
  *  
  * @access private      
  * @return string
  */
 private function _doRegister($data)
 {
     global $lC_Database, $lC_Cache;
     if (isset($data['activation_email']) && $data['activation_email'] != NULL) {
         $storeEmail = $data['activation_email'];
     } else {
         $storeEmail = STORE_OWNER_EMAIL_ADDRESS;
     }
     if (isset($data['activation_serial']) && $data['activation_serial'] != NULL) {
         $storeSerial = $data['activation_serial'];
     } else {
         $storeSerial = '';
     }
     // register the install with LC API
     $registerArr = array('serial' => $storeSerial, 'storeName' => STORE_NAME, 'storeEmail' => $storeEmail, 'storeWWW' => HTTP_SERVER . DIR_WS_HTTP_CATALOG, 'storeSSL' => HTTPS_SERVER . DIR_WS_HTTPS_CATALOG, 'systemMetaData' => base64_encode(json_encode(lc_get_system_information())), 'serverMetaData' => isset($_SERVER) && is_array($_SERVER) ? base64_encode(json_encode($_SERVER)) : NULL, 'envMetaData' => isset($_ENV) && is_array($_ENV) ? base64_encode(json_encode($_ENV)) : NULL);
     $checksum = hash('sha256', json_encode($registerArr));
     $registerArr['checksum'] = $checksum;
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $registerArr['ver'] = utility::getVersion();
     $request_type = getRequestType();
     $resultXML = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/register/install/', 'method' => 'post', 'parameters' => $registerArr, 'timeout' => 10));
     $newInstallationID = preg_match("'<installationID[^>]*?>(.*?)</installationID>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
     $products = preg_match("'<products[^>]*?>(.*?)</products>'i", $resultXML, $regs) == 1 ? $regs[1] : NULL;
     if (lC_Server_info_Admin::updateInstallID($newInstallationID)) {
         return utility::arr2xml(array('error' => FALSE, 'installationID' => $newInstallationID, 'products' => $products));
     } else {
         return utility::arr2xml(array('error' => TRUE, 'message' => 'error processing the request'));
     }
 }
Example #2
0
        var url = "<?php 
echo lc_href_link_admin(FILENAME_DEFAULT, 'login');
?>
";
        $(location).attr('href',url);
      }
      if (data.rpcStatus != 1) {
        $.modal.alert('<?php 
echo $lC_Language->get('ms_error_action_not_performed');
?>
');
        return false;
      }
      $('#lastCheckedContainer').html(data.lastChecked);
      $('#version-table th.version').html('<?php 
echo utility::getVersion();
?>
');
      $('#version-table th.after').html('<?php 
echo sprintf($lC_Language->get('text_released'), utility::getVersionDate());
?>
');
      $('#version-table td.version').html('<?php 
echo $checkArr['toVersion'];
?>
');
      $('#version-table td.after').html('<?php 
echo sprintf($lC_Language->get('text_released'), $checkArr['toVersionDate']);
?>
');  
      if (data.hasUpdates == true) {
echo $lC_Language->get('text_lost_password_instructions');
?>
</p>
          <p class=" align-center mid-margin-bottom"><button type="submit" class="button glossy green-gradient full-width"><?php 
echo $lC_Language->get('button_back_to_login');
?>
</button></p>
        </form>
      </div>
    </div>
  </div>
  <div id="copyright-msg">
    <p class="anthracite" align="center" style="line-height:1.5;">Copyright &copy; <?php 
echo @date("Y");
?>
 <a class="anthracite" href="http://www.loaded7.com">Loaded Commerce</a><br /><?php 
echo $lC_Language->get('text_core') . ' ' . $lC_Language->get('text_version') . ' ' . utility::getVersion();
if (utility::isPro() === true) {
    echo '<small class="tag red-gradient mid-margin-left mid-margin-right">PRO</small>' . $lC_Language->get('text_version') . ' ' . utility::getProVersion();
}
?>
</p>
    <p class="anthracite" align="center"><a class="anthracite" href="http://loadedcommerce.com/support" target="_blank"><?php 
echo $lC_Language->get('text_get_support');
?>
</a> - <a class="anthracite" href="http://loadedcommerce.com" target="_blank"><?php 
echo $lC_Language->get('text_get_more_loaded');
?>
</a></p>
  </div>
</div>
Example #4
0
 public static function apiCheck()
 {
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     $request_type = getRequestType();
     $apiCheck = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'], 'method' => 'get', 'timeout' => 10));
     $versions = utility::xml2arr($apiCheck);
     $error = false;
     if (count($versions) == 0) {
         // there was an error with the api
         $error = true;
         $errorMsg = preg_match("'<title[^>]*?>.*?</title>'si", $versions, $regs);
         $errorMsg = is_array($regs) ? strip_tags(end($regs)) : NULL;
         if ($errorMsg == '') {
             $errorMsg = 'Resource Unavailable at ' . $request_type . '://api.loadedcommerce.com/' . $api_version . '/updates/available/?ver=' . utility::getVersion() . '&ref=' . $_SERVER['SCRIPT_FILENAME'];
         }
         $error = true;
         // log the error
         self::log('Error: ' . $errorMsg);
     }
     if ($versions == null || $error) {
         // set the error flag
         return -1;
     }
     return 1;
 }
Example #5
0
 /**
  * Create a zip archive of the entire fileset
  *  
  * @access public      
  * @return boolean
  */
 public static function fullBackup()
 {
     $ext = '.zip';
     $backup_file = 'full-backup-' . str_replace('.', '', utility::getVersion()) . $ext;
     // remove the old backup
     if (file_exists(DIR_FS_WORK . 'updates/' . $backup_file)) {
         unlink(DIR_FS_WORK . 'updates/' . $backup_file);
     }
     // create full file backup
     if (utility::execEnabled() === true && utility::isLinux() === true) {
         try {
             //exec(CFG_APP_ZIP . ' -r ' . DIR_FS_WORK . 'updates/' . $backup_file . ' ' . DIR_FS_CATALOG . '* -x \*.zip\*');
             exec(CFG_APP_ZIP . ' -r ' . DIR_FS_WORK . 'updates/' . $backup_file . ' ' . DIR_FS_CATALOG . '* -x "' . DIR_FS_CATALOG . DIR_WS_IMAGES . 'products/*" -x "*.cache" -x "*.zip" -x "php_error*" -x "*.gif" -x "*.jpg" -x "*.jpeg" -x "*.png" -x "*.sql" -x "*.tgz" -x "*.tar" -x "*.gz"');
         } catch (Exception $e) {
             return array('rpcStatus' => 0);
         }
         return array('rpcStatus' => 1);
     } else {
         if (extension_loaded('zip')) {
             try {
                 self::_makeZip(DIR_FS_CATALOG, DIR_FS_WORK . 'updates/' . $backup_file);
             } catch (Exception $e) {
                 return array('rpcStatus' => 0);
             }
             return array('rpcStatus' => 1);
         } else {
             return array('rpcStatus' => -1);
         }
     }
 }
Example #6
0
 public static function getAddonPhar($key, $type = 'addon')
 {
     // remove the old phar if it exists
     if (file_exists(DIR_FS_WORK . 'addons/' . $key . '.phar')) {
         unlink(DIR_FS_WORK . 'addons/' . $key . '.phar');
     }
     $api_version = defined('API_VERSION') && API_VERSION != NULL ? API_VERSION : '1_0';
     // add the pubkey
     $pubkey = file_get_contents(DIR_FS_WORK . 'addons/update.phar.pubkey');
     file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar.pubkey', $pubkey);
     $request_type = getRequestType();
     $response = transport::getResponse(array('url' => $request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']), 'method' => 'get', 'timeout' => 10));
     if (strlen($response) == 0) {
         $response = file_get_contents($request_type . '://api.loadedcommerce.com/' . $api_version . '/get/' . $key . '?type=addon&ver=' . utility::getVersion() . '&ref=' . urlencode($_SERVER['SCRIPT_FILENAME']));
     }
     return file_put_contents(DIR_FS_WORK . 'addons/' . $key . '.phar', $response);
 }