public function actionChangePassword($id, $time)
 {
     $model = CmsSetting::model()->findByPk(1);
     if ($id == 0 && $time == 0) {
         if (CmsUser::sendPas()) {
             Yii::app()->user->setFlash('success', 'На ваш email отправлено письмо. Для смены пароля перейдите по ссылке в письме');
         } else {
             Yii::app()->user->setFlash('error', 'Письмо не отправленно');
         }
         $flag = false;
     } else {
         if ($id == Yii::app()->user->id) {
             $flag = true;
             if ($model->time < time() - $time) {
                 if (isset($_POST['password'])) {
                     if (CmsUser::model()->updateByPk(Yii::app()->user->id, array('password' => md5('lkjhgfd' . $_POST['password'])))) {
                         $flag = false;
                         Yii::app()->user->setFlash('success', 'Ваш пароль изменён');
                     } else {
                         Yii::app()->user->setFlash('error', 'пароль не изменён');
                     }
                     $this->render('ChangePassword', array('flag' => $flag));
                     Yii::app()->end();
                 }
             }
         }
     }
     $this->render('ChangePassword', array('flag' => $flag));
 }
 public function actionIndex($id)
 {
     $this->processPageRequest('page');
     if ($dataStr = Yii::app()->request->getParam('data')) {
         if (!empty($dataStr)) {
             if ($id == null) {
                 $id = 1;
             }
             $data = strtotime($dataStr);
             $criteria = new CDbCriteria();
             $criteria->condition = 'category_id =:id AND status=2 AND DATE_FORMAT(FROM_UNIXTIME(created), "%Y%m%d")=:data';
             $criteria->params = array(':data' => date('Ymd', $data), ':id' => $id);
             $model = CmsSetting::model()->findByPk(1);
             $prow = new CActiveDataProvider('CmsPage', array('criteria' => $criteria, 'pagination' => array('pageSize' => $model->ct_page, 'pageVar' => 'page')));
         }
     } else {
         $category = CmsCategory::model()->findByPk($id);
         $criteria = new CDbCriteria();
         $criteria->condition = 'status = 2 AND category_id =:id AND ' . 'created < :time';
         $criteria->params = array(':id' => $id, ':time' => time());
         $criteria->order = 'created DESC';
         $model = CmsSetting::model()->findByPk(1);
         $prow = new CActiveDataProvider('CmsPage', array('criteria' => $criteria, 'pagination' => array('pageSize' => $model->ct_page, 'pageVar' => 'page')));
     }
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial('widget_ajax', array('category' => $category, 'data' => $prow));
         Yii::app()->end();
     } else {
         $this->render('index', array('category' => $category, 'data' => $prow, 'val' => $dataStr));
     }
 }
 public function actionIndex()
 {
     $model = new CmsSetting();
     if (isset($_POST['CmsSetting'])) {
         $model->attributes = $_POST['CmsSetting'];
         $flag = CmsSetting::model()->updateByPk(1, array('ct_page' => $model->ct_page, 'time' => $model->time, 'podtv_email' => $model->podtv_email, 'poblicazia_com' => $model->poblicazia_com, 'publicazia_stat' => $model->publicazia_stat, 'gost_com' => $model->gost_com));
     }
     $model = CmsSetting::model()->findByPk(1);
     $this->render('index', array('model' => $model));
 }
 public static function vivod($id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'page_id=:id AND status=0 OR status=2';
     $criteria->params = array(':id' => $id);
     $model = CmsSetting::model()->findByPk(1);
     return new CActiveDataProvider('CmsComment', array('criteria' => $criteria));
 }
Example #5
0


    </div>

</div>

<div class="row">

    <div class="thumbnail textCom">
        <?php 
echo CmsComment::model()->countByAttributes(array('page_id' => $model->id, 'status' => 1));
?>
  &nbsp; коментариев
        <?php 
$flag = CmsSetting::model()->findByPk(1);
if (!Yii::app()->user->isGuest || Yii::app()->user->isGuest && $flag->gost_com) {
    ?>
        <a class="linkCom" id="linkComId"><i class="fa fa-pencil-square-o">&nbsp;Оставить Комментарий</i></a>
        <?php 
}
?>
    </div>
</div>

    <?php 
if ($model->status != 0 && $model->status != 1) {
    $this->renderPartial('_view', array('comments' => $comments));
    $this->renderPartial('newcomment', array('model' => $model1));
}
?>
Example #6
0
?>
		<?php 
echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'title');
?>
	</div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'image');
?>
        <?php 
if (!$model->isNewRecord) {
    echo CmsSetting::car_image($model->path_img, 200, 150, 'img-thumbnail', './images/pages/');
    echo "<br>";
    echo "<br>";
}
echo $form->fileField($model, 'image');
?>
        <?php 
echo $form->error($model, 'image');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'content');
?>
        <?php 
Example #7
0
/* @var $this UserPersonalController */
/* @var $model CmsUser */
?>


<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'cms-user-form', 'htmlOptions' => array('enctype' => 'multipart/form-data')));
?>

    <div class="row">
        <?php 
echo $form->fileFieldRow($model, 'image');
?>
 <!-- Вот наше поле загрузки картинки -->
        <br>

      </div>



<br>
<?php 
echo CmsSetting::carimage($model->picture, 200, 150, 'img-thumbnail bord', 0, Yii::app()->user->id);
?>

<br>
    <br>
    <br>
<?php 
echo CHtml::submitButton('Обновить', array('class' => 'save'));
$this->endWidget();
 public function actionEditPassword()
 {
     $model = CmsSetting::model()->findByPk(1);
     if (!Yii::app()->request->getParam('id') && !Yii::app()->request->getParam('time')) {
         if (CmsUser::sendPas()) {
             $this->sendResponse(self::STATUS_OK, "email отправлен");
         } else {
             $this->sendResponse(self::STATUS_INTERNAL_SERVER_ERROR, "email не отправлен");
         }
     } else {
         $id = Yii::app()->request->getParam('id');
         $time = Yii::app()->request->getParam('time');
         if ($id == Yii::app()->user->id) {
             if ($model->time < time() - $time) {
                 if (isset($_POST['password'])) {
                     if (CmsUser::model()->updateByPk(Yii::app()->user->id, array('password' => md5('lkjhgfd' . $_POST['password'])))) {
                         $this->actionResponse = array('user' => CmsUser::model()->findByPk(Yii::app()->user->id));
                     } else {
                         $this->sendResponse(self::STATUS_INTERNAL_SERVER_ERROR, "пароль изменён");
                     }
                 }
             }
         }
     }
 }
Example #9
0
?>

        </div>
        <div class="form-group">
            <?php 
if (CmsPage::model()->isNewRecord) {
    ?>
                <?php 
    echo CmsSetting::carimage('', 200, 150, 'img-thumbnail ImgDef', 1, $model->user_id);
    ?>
            <?php 
}
if (!CmsPage::model()->isNewRecord) {
    ?>
                <?php 
    echo CmsSetting::carimage($model->path_img, 200, 150, 'img-thumbnail ImgDef', 1, $model->user_id);
    ?>

            <?php 
}
?>

            <br>
            <br>

            <?php 
echo $form->fileField($model, 'image', array('id' => 'InputField'));
?>


Example #10
0
    ?>

        <li id="<?php 
    echo $comment->id;
    ?>
">

            <?php 
    if ($comment->status == 1) {
        ?>


                    <div class="row">
                        <div >
                            <div class="col-md-3"><?php 
        echo CmsSetting::carimage($comment->user->picture, 164, 164, 'img-thumbnail bord', 0, Yii::app()->user->id);
        ?>
</div>
                                <div class="col-md-9 container-fluid">
                                <table>
                                    <tr>
                                        <td style="width: 50%; text-align: center">
                                            <?php 
        if ($comment->user_id != null) {
            ?>
                                            <?php 
            echo CHtml::link(CmsUser::get_name($comment->user_id), array('UserPersonal/index', 'id' => $comment->user_id));
        }
        ?>
                                            <?php 
        if ($comment->user_id == null) {
<?php

/* @var $this UserPersonalController */
/* @var $data CmsPage */
?>
<div class="row panel panel-info text-center">
    <div class="panel-heading">
        <?php 
echo CHtml::link('<h4>' . $data->title . '</h4>', array('/page/view', 'id' => $data->id));
?>
    </div>
    <div class="container-fluid panel-body">
        <div class="col-md-6">
            <?php 
echo CmsSetting::carimage($data->path_img, 128, 128, 'img-thumbnail', 1, $data->user->id);
?>
        </div>
        <div class="col-md-6">
            <table>
                <tr class="StrTable">
                    <td>Статус:</td>
                    <td>
                        <?php 
if ($data->status == 0) {
    echo "Черновик";
} else {
    if ($data->status == 2) {
        echo "Опубликованая";
    }
}
?>
Example #12
0
echo Yii::app()->theme->baseUrl;
?>
/css/styles.css" />

	<title><?php 
echo CHtml::encode($this->pageTitle);
?>
</title>

	<?php 
Yii::app()->bootstrap->register();
Yii::app()->clientScript->registerCssFile('http://web/css/page.css');
Yii::app()->clientScript->registerCssFile('http://web/css/font-awesome.css');
Yii::app()->clientScript->registerCssFile('http://web/css/style.css');
Yii::app()->clientScript->registerScriptFile('http://web/js/page.js');
$brouzer = CmsSetting::user_browser($_SERVER['HTTP_USER_AGENT']);
if ($brouzer != 'Opera' && $brouzer != 'Chrome') {
    Yii::app()->clientScript->registerScriptFile('http://web/js/jquery.tools.min.js');
}
?>

</head>


<body>


<div class="container">
    <div class="col-md-offset-2">

    </div>
Example #13
0
            <br>
            <button  id='PageShow' class="btn btn-success btn-large btn-group-vertical" >Показать страницы пользователя</button>
            <button  id='PageClose' class="btn btn-success btn-large btn-group-vertical" style="display: none">Скрыть страницы пользователя</button>
            <br>
            <button  id='CommentShow' class="btn btn-success btn-large btn-group-vertical" >Показать комментарии пользователя</button>
            <button  id='CommentClose' class="btn btn-success btn-large btn-group-vertical" style="display: none">Скрыть комментарии пользователя</button>
        </div>


    </div>
</div>


    <div id="graph" style="display: none">
    <?php 
$this->Widget('ext.graph.highcharts.HighchartsWidget', array('options' => array('title' => array('text' => 'График активности пользователя'), 'xAxis' => array('categories' => array('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабырь')), 'yAxis' => array('title' => array('text' => 'Количество статей')), 'series' => array(array('name' => $model->username, 'data' => CmsSetting::ar_kol($id))))));
?>
    </div>


    <div id="MyPage">
    <?php 
if (Yii::app()->user->id == $id) {
    $a = array('created', 'status');
} else {
    $a = array('created');
}
$this->widget('zii.widgets.CListView', array('dataProvider' => CmsPage::MyPages($id), 'itemView' => '_view_pages', 'emptyText' => 'В данной категории нет статей', 'sorterHeader' => 'Сортировать по :', 'sortableAttributes' => $a));
?>
    </div>
Example #14
0
 public function getRecoveryPasswordToken($expires = 5, $time = null)
 {
     $set = CmsSetting::model()->findByPk(1);
     $expires = $set->time;
     $passHash = self::hashPassword($this->password);
     $time = is_null($time) ? time() : $time;
     $hash = sha1(Yii::app()->params['recoveryPasswordPrivateKey'] . $passHash . $this->username . $this->id . $time . $expires);
     return implode(':', array($time, $expires, $this->id, $hash));
 }
Example #15
0
 public static function vivod($id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'status = 2';
     $criteria->compare('category_id', $id);
     $model = CmsSetting::model()->findByPk(1);
     return new CActiveDataProvider('CmsPage', array('criteria' => $criteria, 'pagination' => array('pageSize' => $model->ct_page)));
 }
 /**
  * Displays the login page
  */
 public function actionLogin()
 {
     /**
      * Авторизация по токену для восстановления пароля
      */
     if ($recoveryPasswordToken = Yii::app()->request->getParam('token')) {
         if ($user = CmsUser::getByRecoveryPasswordToken($recoveryPasswordToken)) {
             $log = new LoginForm();
             $log->username = $user->username;
             $log->password = $user->password;
             $log->login();
             $this->redirect($this->createAbsoluteUrl('UserPersonal/index', array('id' => $user->id)));
         }
     }
     $service = Yii::app()->request->getQuery('service');
     if (isset($service)) {
         $authIdentity = Yii::app()->eauth->getIdentity($service);
         $authIdentity->redirectUrl = Yii::app()->user->returnUrl;
         $authIdentity->cancelUrl = $this->createAbsoluteUrl('site/login');
         if ($authIdentity->authenticate()) {
             $identity = new ServiceUserIdentity($authIdentity);
             // Успешный вход
             if ($identity->authenticate()) {
                 Yii::app()->user->login($identity);
                 // Специальный редирект с закрытием popup окна
                 $authIdentity->redirect();
             } else {
                 // Закрываем popup окно и перенаправляем на cancelUrl
                 $authIdentity->cancel();
             }
         }
         $this->redirect(array('site/login'));
     }
     //авторизация с помошью соц сетей
     $model = new LoginForm();
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         // validate user input and redirect to the previous page if valid
         // $model1=CmsUser::model()->findByAttributes(array('username'=>$model->username));
         $model_set = CmsSetting::model()->findByPk(1);
         if ($model_set->podtv_email == 1) {
             $user = CmsUser::model()->findByAttributes(array('username' => $model->username));
             $user->sendRecoveryPasswordMessage();
             $this->render('login', array('model' => $model, 'flag' => true));
             Yii::app()->end();
         } else {
             if ($model->validate() && $model->login()) {
                 $this->redirect(array('UserPersonal/index', 'id' => Yii::app()->user->id));
             }
         }
     }
     // display the login form
     $this->render('login', array('model' => $model));
 }
<?php

/**
 * Created by JetBrains PhpStorm.
 * User: дима
 * Date: 01.08.14
 * Time: 12:17
 * To change this template use File | Settings | File Templates.
 */
?>
<div class="row">

        <div class="thumbnail">
            <?php 
echo CmsSetting::carimage($data->path_img, 630, 150, 'img-thumbnail img-bord', 1, $data->user->id);
?>

            <div class="caption">

                <div class="hrd text-center">

                    <h2><?php 
echo strtoupper($data->title);
?>
</h2>
                    <h3></h3>

                </div>

                <hr/>