PATH:
home
/
letacommog
/
letaweb
/
protected
/
controllers
<?php class SiteController extends PController { public $layout = 'column1'; public function actionIndex() { Yii::import('site_app.classes.ScreenShot'); $screenShoot = new ScreenShot(); $categories = WebsiteCategory::model()->findAll(array('order' => 'priority asc')); $criteria = new CDbCriteria(); $criteria->order = 'priority asc'; $criteria->condition = 'is_template=1'; if (isset($_REQUEST['cat'])) { $currentCategory = isset($_REQUEST['cat']) ? $_REQUEST['cat'] : 0; $criteria->condition .= ' and category=:category and is_template_active = 1'; $criteria->params = array(':category' => $currentCategory); } else { $criteria->condition .= ' and is_template_active = 1'; } $templates = Site::model()->findAll($criteria); $this->render('index', array('categories' => $categories, 'templates' => $templates, 'screenShoot' => $screenShoot)); } public function actionError() { if ($error = Yii::app()->errorHandler->error) { if (Yii::app()->request->isAjaxRequest) { echo $error['message']; } else { $this->render('error', $error); } } } public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); } public function actionCreate() { $categories = WebsiteCategory::model()->findAll(array('order' => 'priority asc')); $criteria = new CDbCriteria(); $criteria->order = 'priority asc'; $criteria->condition = 'is_template=1'; if (isset($_REQUEST['cat'])) { $currentCategory = isset($_REQUEST['cat']) ? $_REQUEST['cat'] : 0; $criteria->condition .= ' and category=:category and is_template_active = 1'; $criteria->params = array(':category' => $currentCategory); } else { $criteria->condition .= ' and is_template_active = 1'; } $templates = Site::model()->findAll($criteria); $template_thumbnail_directory = isset(Yii::app()->params['template_thumbnail_directory']) ? Yii::app()->params['template_thumbnail_directory'] : ''; $app_root = substr(Yii::app()->baseUrl, 1, strlen(Yii::app()->baseUrl) - 1); $template_thumbnail_path = '/'.$app_root.'/'.$template_thumbnail_directory.'/'; $this->render('create', array('categories' => $categories, 'templates' => $templates, 'template_thumbnail_path' => $template_thumbnail_path)); } public function actionCreate_Template() { $categories = WebsiteCategory::model()->findAll(array('order' => 'priority asc')); $criteria = new CDbCriteria(); if (isset($_POST['template_id'])) { $tempalte_id = $_POST['template_id']; $tempalte_name = $_POST['template_name']; $url = $this->createAbsoluteUrl('/template/create'); $this->redirect($url, true); } if (isset($_REQUEST['cat'])) { $currentCategory = isset($_REQUEST['cat']) ? $_REQUEST['cat'] : 0; $criteria->condition = 'category=:category and is_active = 1'; $criteria->params = array(':category' => $currentCategory); } else { $criteria->condition = 'is_active = 1'; } $templates = Template::model()->findAll($criteria); $criteria->order = 'priority asc'; $this->render('create_template', array('categories' => $categories, 'templates' => $templates)); } public function actionTemplate() { if (Yii::app()->user->isGuest) { Yii::app()->user->loginRequired(); } $templateid = 1; if (isset($_REQUEST['id'])) { $templateid = $_REQUEST['id']; } $lang = Yii::app()->language; $language = Language::model()->find('name=:name', array(':name' => $lang)); $template = Site::model()->find('id=:id and is_template_active = 1', array(':id' => $templateid)); if (!isset($template)) { $url = $this->createAbsoluteUrl('/site/create'); $this->redirect($url, true); } $template_directory = isset(Yii::app()->params['template_directory']) ? Yii::app()->params['template_directory'] : ''; $template_thumbnail_directory = isset(Yii::app()->params['template_thumbnail_directory']) ? Yii::app()->params['template_thumbnail_directory'] : ''; $app_root = substr(Yii::app()->baseUrl, 1, strlen(Yii::app()->baseUrl) - 1); $categories = WebsiteCategory::model()->findAll(array('order' => 'priority asc')); $template_thumbnail_path = '/'.$app_root.'/'.$template_thumbnail_directory.'/'; $templatedir = $app_root.'/'.$template_directory.'/'.$template->name; $model = new PageCreationForm(); $model->template_id = $template->id; if (isset($_POST['PageCreationForm'])) { $model->attributes = $_POST['PageCreationForm']; $installation = $model->save(); if ($installation !== false) { $url = $this->createUrl('page/create/inst_id/'.$installation->id); $this->redirect($url); } } $this->render('template', array('model' => $model, 'categories' => $categories, 'template' => $template, 'templatedir' => $templatedir, 'template_thumbnail_path' => $template_thumbnail_path)); } public function actionPrice() { $this->render('price'); } public function actionFeatures() { $this->render('features'); } public function actionHelp() { $lang = Yii::app()->language; $id = 0; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } $content = ''; $title = ''; if ($id != 0) { $menu_items = array(); $categories = HelpCategory::model()->findAll(); foreach ($categories as $category) { $menu_items[] = array( 'label' => $category['title'], 'url' => array('site/help/id/'.$category->id), ); } $help_category = HelpCategory::model()->findByPk($id); if (isset($help_category)) { $content = $help_category['content']; $title = $help_category['title']; } $help = Help::model()->findAll('category=:category', array(':category' => $id)); $this->render('help_category', array('lang' => $lang, 'menu_items' => $menu_items, 'title' => $title, 'content' => $content, 'help' => $help)); } else { $menu_items = array(); $categories = HelpCategory::model()->findAll(); foreach ($categories as $category) { $helps = Help::model()->findAll('category=:category limit 4', array(':category' => $category->id)); $hl = array(); foreach ($helps as $help) { $hl[] = array( 'label' => $help['title'], 'url' => array('site/help/id/'.$help->id), ); } $menu_items[] = array( 'label' => $category['title'], 'url' => array('site/help/id/'.$category->id), 'helps' => $hl, ); } $tickets = Ticket::model()->findAll(array('order' => 'date_added')); $this->render('help', array( 'tickets'=>$tickets, 'menu_items' => $menu_items, 'title' => $title, 'content' => $content/*, 'help' => $help*/)); } } public function actionHelpDetail() { $categories = HelpCategory::model()->findAll(); $lang = Yii::app()->language; $id = 0; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } else { $url = $this->createUrl('help'); $this->redirect($url); } $content = ''; $cat_id = 0; $cat_title = ''; if ($id != 0) { $help = Help::model()->findByPk($id); if (isset($help)) { $content = $help['content_'.$lang]; $cat_id = $help['category']; $help_category = HelpCategory::model()->findByPk($cat_id); if (isset($help_category)) { $cat_title = $help_category['title_'.$lang]; } } } foreach ($categories as $category) { $menu_items[] = array( 'label' => $category['title_'.$lang], 'url' => array('site/help/id/'.$cat_id), 'active' => $category['id'] == $cat_id, ); } $this->render('help', array('menu_items' => $menu_items, 'help' => $help, 'content' => $content, 'title' => $cat_title)); } public function actionResent_active_mail() { if (!Yii::app()->user->isGuest) { $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } $this->layout = 'column_login'; $form = new ResentActiveMailForm(); if (isset($_POST['ResentActiveMailForm'])) { $form->attributes = $_POST['ResentActiveMailForm']; if ($form->send()) { $this->render('active_mail_send_success', array()); return; } } $this->render('resent_active_mail', array('model' => $form)); } public function actionForgot() { if (!Yii::app()->user->isGuest) { $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } $this->layout = 'column_login'; $loginForm = new ForgotPasswordForm(); if (isset($_POST['ForgotPasswordForm'])) { $loginForm->attributes = $_POST['ForgotPasswordForm']; if ($loginForm->send()) { $this->render('forgot_password_email_sent', array()); return; } } $this->render('forgot', array('model' => $loginForm)); } public function actionActive() { if (!Yii::app()->user->isGuest) { $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } $this->layout = 'column_login'; $id = $_REQUEST['id']; $code = $_REQUEST['code']; $user = User::model()->findByPk($id, 'activation_key=:activation_key', array(':activation_key' => $code)); if (!isset($user)) { $this->render('active_fail', array()); } else { $user->activation_key = ''; $user->is_active = 1; $user->save(); $this->render('active_success', array()); } } public function actionRecover_password() { if (!isset($_REQUEST['id']) || !isset($_REQUEST['code'])) { $url = $this->createUrl('login'); $this->redirect($url); } $form = new RecoverPasswordForm(); $form->user_id = $_REQUEST['id']; $form->code = $_REQUEST['code']; $this->layout = 'column_login'; if (isset($_POST['RecoverPasswordForm'])) { $form->attributes = $_POST['RecoverPasswordForm']; if ($form->save()) { $this->render('recover_success', array()); //echo json_encode(array('success'=>true,'url'=>$url) ); return; } } $this->render('recover', array('model' => $form)); } public function actionLogin() { if (!Yii::app()->user->isGuest) { $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } $this->layout = 'column_login'; $loginForm = new LoginForm(); if (isset($_POST['LoginForm'])) { $loginForm->attributes = $_POST['LoginForm']; if ($loginForm->login()) { $url = Yii::app()->user->returnUrl; $this->redirect($url); return; } } $this->render('login', array('model' => $loginForm)); } public function actionSignup() { if (!Yii::app()->user->isGuest) { $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } $errors = array(); $this->layout = 'column_login'; $signupForm = new SignupForm(); if (isset($_POST['SignupForm'])) { $signupForm->attributes = $_POST['SignupForm']; if ($signupForm->save()) { $this->render('signup_complete', array()); return; } } $this->render('signup', array('model' => $signupForm)); } public function actionLogout() { Yii::app()->user->logout(); $url = $this->createAbsoluteUrl('/site/index'); $this->redirect($url, true); } public function actionPage() { if (isset($_REQUEST['name'])) { $name = $_REQUEST['name']; } $name = trim($name); if (strlen($name) == 0) { return; } $content = Content::model()->find('name=:name', array('name' => $name)); if (isset($content)) { $this->render('page', array('content' => $content)); } } }
[+]
..
[-] PageController.php
[edit]
[-] IpnController.php
[edit]
[-] SiteController.php
[edit]