Example #1
0
 public function run($do = false)
 {
     $updater = new cmsUpdater();
     $update = $updater->checkUpdate();
     if ($update == cmsUpdater::UPDATE_NOT_AVAILABLE) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_NOT_AVAILABLE);
         $this->redirectToAction('update');
     }
     if ($update == cmsUpdater::UPDATE_CHECK_ERROR || empty($update['version'])) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_CHECK_FAIL, 'error');
         $this->redirectToAction('update');
     }
     if (!function_exists('curl_init')) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $url = $update['url'];
     $package_name = basename($url);
     $destination = cmsConfig::get('upload_path') . 'installer/' . $package_name;
     $result = file_save_from_url($url, $destination);
     if ($result === false) {
         cmsUser::addSessionMessage(LANG_CP_UPDATE_DOWNLOAD_FAIL, 'error');
         $this->redirectToAction('update');
     }
     $this->redirectToAction('install', false, array('package_name' => $package_name));
 }
Example #2
0
 public function run($user)
 {
     if (!$user['is_admin']) {
         return $user;
     }
     if (!cmsConfig::get('is_check_updates')) {
         return $user;
     }
     $updater = new cmsUpdater();
     $update = $updater->checkUpdate();
     if (!empty($update['version'])) {
         $message = sprintf(LANG_CP_UPDATE_AVAILABLE, $update['version']);
         $message .= '&mdash; <a href="' . href_to('admin', 'update') . '">' . LANG_INSTALL . '</a>';
         cmsUser::addSessionMessage($message);
     }
     return $user;
 }
Example #3
0
<?php

$config = cmsConfig::getInstance();
$user = cmsUser::getInstance();
$updater = new cmsUpdater();
$update = $updater->checkUpdate(true);
?>
<!DOCTYPE html>
<html>
<head>
	<title><?php 
$this->title();
?>
</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <?php 
$this->addMainCSS("templates/{$this->name}/css/theme-modal.css");
?>
    <?php 
$this->addMainJS("templates/{$this->name}/js/jquery.js");
?>
    <?php 
$this->addMainJS("templates/{$this->name}/js/jquery-modal.js");
?>
    <?php 
$this->addMainJS("templates/{$this->name}/js/core.js");
?>
    <?php 
$this->addMainJS("templates/{$this->name}/js/modal.js");
?>