/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionEnv() { $privates = array(); $privates['cache'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../caches"); $privates['upload'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../uploads"); $privates['asset'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../assets"); $privates['protected'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../protected"); $privates['theme'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../themes"); $privates['css'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../css"); $privates['js'] = DxdUtil::isWriteable(Yii::app()->basePath . "/../js"); $exts = array(); $exts['curl'] = function_exists('curl_init'); $exts['gd'] = function_exists('gd_info'); $exts['pdo_mysql'] = extension_loaded('pdo_mysql'); $exts['mysqli'] = extension_loaded('mysqli'); $exts['dom'] = extension_loaded('dom'); $phpVersion = substr(PHP_VERSION, 0, 3) >= 5.2; $maxFileSize = floor(min(DxdUtil::return_bytes(ini_get('post_max_size')), DxdUtil::return_bytes(ini_get('upload_max_filesize')), DxdUtil::return_bytes(ini_get('memory_limit'))) / 1024 / 1024); $pass = true; foreach ($exts as $ext) { if (!$ext) { $pass = false; } } foreach ($privates as $item) { if (!$item) { $pass = false; } } if (!$phpVersion) { $pass = false; } if ($maxFileSize < 2) { $pass = false; } $this->render('env', array('privates' => $privates, 'exts' => $exts, 'pass' => $pass, 'phpVersion' => $phpVersion, 'maxFileSize' => $maxFileSize)); }
<?php /* @var $this NewsController */ /* @var $model News */ /* @var $form CActiveForm */ $maxFileSize = floor(min(DxdUtil::return_bytes(ini_get('post_max_size')), DxdUtil::return_bytes(ini_get('upload_max_filesize')), DxdUtil::return_bytes(ini_get('memory_limit'))) / 1024 / 1024); $cloudStorageForm = new CloudStorageForm(); $cloudStorageForm->getSetting(); $storage = $cloudStorageForm->storage; ?> <div class="form"> <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'news-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data'))); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->textFieldRow($model, 'title', array('class' => 'input-block-level')); ?> <?php echo $form->radioButtonListInlineRow($model, 'isFree', array('1' => '是', '0' => '否')); ?> <?php echo $form->textAreaRow($model, 'introduction', array('class' => 'input-block-level', 'style' => 'min-height:90px;')); ?> <?php