예제 #1
0
 /**
  * Retrieves any issues with the present CiiMS instance.
  *
  * This checks several things
  * 1) The current CiiMS version as compared to the installed version
  * 2) Whether or there are missing migrations
  * 3) If there are any permissions problems
  */
 public function actionGetIssues()
 {
     $issues = array();
     // Check CiiMS version
     $curl = curl_init();
     curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://raw.github.com/charlesportwoodii/CiiMS/latest-version/protected/extensions/cii/ciims.json'));
     $json = CJSON::decode(curl_exec($curl));
     if ($json['version'] > Cii::getVersion()) {
         $issues[] = array('issue' => 'version', 'message' => Yii::t('Dashboard.main', 'CiiMS is out of date. Please update to the latest version ({{version}})', array('{{version}}' => CHtml::link($json['version'], 'https://github.com/charlesportwoodii/CiiMS/tree/latest-version/', array('target' => '_blank')))));
     }
     // Check if migrations have been run
     $migrations = Yii::app()->db->createCommand('SELECT COUNT(*) as count FROM tbl_migration')->queryScalar();
     $fileHelper = new CFileHelper();
     $files = count($fileHelper->findFiles(Yii::getPathOfAlias('application.migrations'), array('fileTypes' => array('php'), 'level' => 1)));
     if ($migrations < $files) {
         $issues[] = array('issue' => 'migrations', 'message' => Yii::t('Dashboard.main', "CiiMS' database is out of date. Please run yiic migrate up to migrate your database to the latest version."));
     }
     // Check common permission problems
     if (!is_writable(Yii::getPathOfAlias('webroot.uploads'))) {
         $issues[] = array('issue' => 'permssions', 'message' => Yii::t('Dashboard.main', 'Your uploads folder ({{folder}}) is not writable. Please change the permissions on the folder to be writable', array('{{folder}}' => Yii::getPathOfAlias('webroot.uploads'))));
     }
     if (!is_writable(Yii::getPathOfAlias('application.runtime'))) {
         $issues[] = array('issue' => 'permssions', 'message' => Yii::t('Dashboard.main', 'Your runtime folder ({{folder}}) is not writable. Please change the permissions on the folder to be writable', array('{{folder}}' => Yii::getPathOfAlias('application.runtime'))));
     }
     if (count($issues) == 0) {
         echo CHtml::tag('div', array('class' => 'alert in alert-block fade alert-success'), Yii::t('Dashboard.main', 'There are no issues with your system. =)'));
     } else {
         echo CHtml::tag('div', array('class' => 'alert in alert-block fade alert-error'), Yii::t('Dashboard.main', 'Please address the following issues.'));
     }
     foreach ($issues as $issue) {
         echo CHtml::openTag('div', array('class' => 'pure-control-group'));
         echo CHtml::tag('label', array(), Cii::titleize($issue['issue']));
         echo CHtml::tag('span', array('class' => 'inline'), $issue['message']);
         echo CHtml::closeTag('div');
     }
     return;
 }
예제 #2
0
 /**
  * Loads the user information
  */
 public static function loadUserInfo()
 {
     if (defined('CIIMS_INSTALL')) {
         return;
     }
     if (isset(Yii::app()->user)) {
         // Load some specific CiiMS JS here
         $json = CJSON::encode(array('email' => Cii::get(Yii::app()->user, 'email'), 'token' => Cii::getUserConfig('api_key', false), 'role' => Cii::get(Yii::app()->user, 'role'), 'isAuthenticated' => isset(Yii::app()->user->id), 'debug' => YII_DEBUG, 'time' => time(), 'version' => YII_DEBUG ? Cii::getVersion() : null, 'language' => Cii::setApplicationLanguage(), 'hosted' => defined('CII_CONFIG'), 'api' => Yii::app()->getBaseUrl(true) . '/api'));
         Yii::app()->clientScript->registerScript('ciims', "\n                localStorage.setItem('ciims', '{$json}');\n            ", CClientScript::POS_HEAD);
     }
 }
예제 #3
0
						<label><?php 
echo Yii::t('Dashboard.views', 'Yii Version');
?>
</label>
						<span class="inline"><?php 
echo Yii::getVersion();
?>
</span>
					</div>
					<div class="pure-control-group">
						<label><?php 
echo Yii::t('Dashboard.views', 'CiiMS Version');
?>
</label>
						<span class="inline"><?php 
echo Cii::getVersion();
?>
</span>
					</div>
					<div class="pure-control-group">
						<label><?php 
echo Yii::t('Dashboard.views', 'Cache');
?>
</label>
						<span class="inline"><?php 
echo get_class(Yii::app()->cache);
?>
</span>
					</div>
				</div>
				<div class="clearfix"></div>