PATH:
home
/
letacommog
/
letaweb
/
protected
/
modules
/
profile
/
controllers
<?php class PageController extends PController { public $layout = 'admin_column'; public function actionIndex() { $model = new Site('search'); $model->unsetAttributes(); // clear any default values $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 = Yii::app()->getbaseUrl(true).'/'.$template_thumbnail_directory.'/'; $this->render('index', array( 'model' => $model, 'template_thumbnail_path' => $template_thumbnail_path, )); } public function actionView() { $id = $_REQUEST['id']; $model = Site::model()->findByPk((int) $id); $name = $model->page_template->name.'.jpg'; $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.'/'; $image_dir = $template_thumbnail_path.'/'.$name; $this->render('view', array('model' => $model, 'image_dir' => $image_dir)); } public function actionUpdate() { $url = $this->createUrl('index'); $model = new PageForm('update'); if (isset($_POST['PageForm'])) { $model->attributes = $_POST['PageForm']; if ($model->save()) { $this->redirect($url); } } if (!isset($_REQUEST['id'])) { $url = $this->createUrl('index'); $this->redirect($url); } $id = $_REQUEST['id']; $t = Page::model()->findByPk((int) $id); $name = $t->name.'.jpg'; $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.'/'; $image_dir = $template_thumbnail_path.'/'.$name; if ($t == null || $t->owner_id != Yii::app()->user->id) { $this->redirect($url); } $attributes = array(); foreach ($model->getAttributes() as $name => $value) { $model->$name = $t->$name; } $this->render('update', array('model' => $model, 'image_dir' => $image_dir)); } public function actionDelete() { $url = $this->createUrl('index'); if (!isset($_REQUEST['id'])) { $this->redirect($url); } $page = Site::model()->findByPk($_REQUEST['id']); if (!isset($page)) { $this->redirect($url); } if ($page->is_template || $page->owner_id != Yii::app()->user->id) { $this->redirect($url); } if (isset($_POST['step2'])) { $this->setPageState('step2', $_POST['id']); $model = new DeletePageForm('update'); $model->id = $_POST['id']; $this->render('deleteconfirmpassword', array('model' => $model)); } elseif (isset($_POST['step3'])) { $model = new DeletePageForm('update'); if (isset($_POST['DeletePageForm'])) { $model->attributes = $_POST['DeletePageForm']; if ($model->validate()) { $this->setPageState('step3', $_POST['DeletePageForm']); $this->render('delete', array('model' => $model)); } else { $this->render('deleteconfirmpassword', array('model' => $model)); } } } elseif (isset($_POST['finish'])) { $model = new DeletePage1Form('update'); $model->attributes = $this->getPageState('step2'); $model->attributes = $_POST['DeletePageForm']; if ($model->save()) { $this->redirect($url); } } else { if (!isset($_REQUEST['id'])) { $this->redirect($url); } $id = $_REQUEST['id']; $model = Site::model()->findByPk((int) $id); if ($model == null) { $this->redirect($url); } $this->render('deleteconfirm', array('model' => $model)); } } public function actionUpgrade() { $url = $this->createUrl('index'); if (!isset($_REQUEST['id'])) { $this->redirect($url); } $page = Site::model()->findByPk($_REQUEST['id']); if (!isset($page)) { $this->redirect($url); } if ($page->is_template || $page->owner_id != Yii::app()->user->id) { $this->redirect($url); } $this->render("upgrade", array("site_id"=>$page->id)); } public function actionCheckout() { $url = $this->createUrl('index'); if (!isset($_REQUEST['id'])) { $this->redirect($url); } $page = Site::model()->findByPk($_REQUEST['id']); if (!isset($page)) { $this->redirect($url); } if ($page->is_template || $page->owner_id != Yii::app()->user->id) { $this->redirect($url); } $planId = $_REQUEST['plan_id']; $plan = Plan::model()->findByPk($planId); $amount_monthly = $plan->monthly_amount; $amount_annually = $plan->yearly_amount; // $this->layout = 'column_checkout'; $this->render('checkout', array('plan' => $plan, 'amount_annually' => $amount_annually, 'amount_monthly' => $amount_monthly,"site_id"=>$page->id)); } public function actionExecute() { $type = $_POST["wwwpt"]; $payment = Yii::app()->payment->getPayment($type); if (isset($payment)) { $payment->processFormData(); } } public function actionReturn() { $payment_type = $_GET["payment_type"]; $payment = Yii::app()->payment->getPayment($payment_type); if(!isset($payment)) { return; } $payment->handleReturn(); } public function stripUnicode($str) { if (!$str) { return false; } $unicode = array( 'a' => 'á|à|ả|ã|ạ|ă|ắ|ặ|ằ|ẳ|ẵ|â|ấ|ầ|ẩ|ẫ|ậ', 'd' => 'đ', 'e' => 'é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ', 'i' => 'í|ì|ỉ|ĩ|ị', 'o' => 'ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ', 'u' => 'ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự', 'y' => 'ý|ỳ|ỷ|ỹ|ỵ', ); foreach ($unicode as $nonUnicode => $uni) { $str = preg_replace("/($uni)/i", $nonUnicode, $str); } return $str; } }
[+]
..
[-] PurchaseController.php
[edit]
[-] AccountController.php
[edit]
[-] CheckoutController.php
[edit]
[-] PageController.php
[edit]