function getVersion()
 {
     $page = '';
     $new_version = 'none';
     $session_var = cmsFramework::getSessionVar('new_version', 'jreviews');
     if (empty($session_var)) {
         if (function_exists('curl_init')) {
             // Version checker
             $curl_handle = curl_init('http://www.reviewsforjoomla.com/updates_server/files.php');
             curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
             // return instead of echo
             @curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1);
             curl_setopt($curl_handle, CURLOPT_HEADER, 0);
             $data = curl_exec($curl_handle);
             curl_close($curl_handle);
             $current_versions = json_decode($data, true);
             $this->Config->updater_betas and isset($current_versions['jreviews']['beta']) and $current_versions['jreviews'] = array_merge($current_versions['jreviews'], $current_versions['jreviews']['beta']);
             $remoteVersion = $current_versions['components']['jreviews']['version'];
             $remoteVersion = (int) str_replace('.', '', $remoteVersion);
             $localVersion = (int) str_replace('.', '', strip_tags($this->Config->version));
             if ($remoteVersion > $localVersion) {
                 $new_version = 'new';
             }
         } else {
             $new_version = 'curl';
         }
         cmsFramework::setSessionVar('new_version', $new_version, 'jreviews');
     } else {
         $new_version = $session_var;
     }
     switch ($new_version) {
         case 'new':
             $page = '<a style="font-weight:normal;font-size:13px;color:red;" href="#updater_version_check" id="updater_notification">' . __a("New version available", true) . '</a>';
             break;
         case 'curl':
             $page = '<span style="font-weight:normal;font-size:13px;color:red;">Version checker requires curl</span>';
             break;
         default:
             $page = '';
             break;
     }
     return $this->ajaxResponse(array(), false, compact('page'));
 }
Example #2
0
 function cacheSessionGetCount($queryData)
 {
     $conditions = array_filter(array_merge($this->conditions, $queryData['conditions']));
     $findCount = cmsFramework::getSessionVar($this->name, 'findCount');
     if (isset($findCount[md5($this->name . implode('', $conditions))])) {
         return $findCount[md5($this->name . implode('', $conditions))];
     }
     return false;
 }