PATH:
home
/
letacommog
/
letaweb
/
admin
/
controllers
<?php //controller for site builder class BuilderController extends PController { public $layout = 'column1'; var $popups, $libraries,$editors, $modules, $module_categories; // render home page for site builder public function actionIndex() { if (Yii::app()->site->model->isExpired()) { $this->render('/site/expired'); return; } if (Yii::app()->user->isGuest) { Yii::app()->user->loginRequired(); } $editors = array( 'content' => array( 'label' => ('LBL_CONTENT'), 'visible' => Yii::app()->user->checkAccess('Administrator'), ), 'blog' => array( 'label' => ('LBL_BLOG_NEWS'), 'visible' => Yii::app()->user->checkAccess('Author'), ), 'settings' => array( 'label' => ('LBL_SETTING'), 'visible' => Yii::app()->user->checkAccess('Billing'), ), 'customize' => array( 'label' => ('LBL_THEMES'), 'visible' => Yii::app()->user->checkAccess('Administrator'), ), ); $popups = Popup_Script::model()->findAll(array('order' => 'priority asc')); $libraries = Library_Script::model()->findAll(array('order' => 'id asc, priority asc')); $module_categories = ModuleCategory::model()->findAll(array('order' => 'id asc, priority asc')); $modules = ModuleList::model()->findAll(); Yii::app()->runComponent('getEditorList', $editors); Yii::app()->runComponent('getModuleCategoryList', $module_categories); Yii::app()->runComponent('getPopupList', $popups); Yii::app()->runComponent('getLibraryList', $libraries); Yii::app()->runComponent('getModuleList', $modules); $this->popups = $popups; $this->modules = $modules; $this->module_categories = $module_categories; $this->libraries = $libraries; $this->editors = $editors; $this->layout = 'admin_column'; $site = Yii::app()->site; $this->render('index', array('site' => $site, 'popups'=>$popups,'libraries'=>$libraries, 'editors' => $editors,'modules' => $modules,'module_categories' => $module_categories)); } // function to load api function and execute it // then load class file name and check if class has method name // if method exists then call this method public function actionApi() { if (Yii::app()->user->isGuest) { throw new CHttpException(401, Yii::t('yii', 'Login Required')); } $path = ''; if (isset($_REQUEST['path'])) { $path = $_REQUEST['path']; } $path = str_replace('/', '.', $path); $path = explode('.', $path); $ppath = 'application.api';//path to folder ROOT/api $type = 'Base'; $len = sizeof($path); if ($len > 1) { // step over the path, import all file nessesary for ($i = 0; $i < sizeof($path) - 1; ++$i) { $ppath .= '.'.strtolower($path[$i]); Yii::import($ppath.'.*'); } $type = $path[ $len - 1 ]; } elseif ($len == 1) { $type = $path[ $len - 1 ]; } $type = strtoupper(substr($type, 0, 1)).substr($type, 1); if ($type == '') { $type = 'Base'; } $s = $type.'Manager'; for ($i = sizeof($path) - 1; $i >=0; $i--) { $s = strtoupper(substr($path[$i], 0, 1)).substr($path[$i], 1).'Manager'; if (class_exists($s)) { $mp = new $s($type, $this); break; } } if(!isset($mp)) { $mp = new BaseManager('base', $this); } $action = $_REQUEST['action']; $mp->run($action); } // function to get value from an array protected function getIndex($a, $i) { return isset($a[$i]) ? $a[$i] : ''; } //function to get page component protected function getPageObject() { return Yii::app()->site; } // function to check if request is ajax public function checkAjaxRequest($user_id, $action) { if (Yii::app()->user->isGuest) { Yii::app()->user->logout(); $url = $this->createAbsoluteUrl('/site/login'); $this->redirect($url, true); } return true; } // function to get widget html and send to client public function actionModule() { Yii::app()->builderMode = false; $type = $_REQUEST[('type')]; $script = getIndex($_REQUEST, 'script', false, 'boolean'); $id = isset($_REQUEST[('id')]) ? $_REQUEST[('id')] : 0; $page_id = $_REQUEST[('page_id')]; $skin = isset($_REQUEST[('skin')]) ? $_REQUEST[('skin')] : ''; $data = isset($_REQUEST['data']) ? $_REQUEST['data'] : array(); $module = array(); // $data['layout_type'] = $skin; $module['type'] = $type; $module['data'] = $data; $module['page_id'] = $page_id; $module['id'] = $id; $module['data'] = $data; $className = 'CWidget'.ucwords($module['type']); require_once Yii::getPathofAlias('application.classes').'/general.php'; Yii::app()->controller->widget('application.widgets.modules.'.$className, array( 'page_id' => $page_id, 'script' => $script, 'data' => $module, )); } // render html structure for inline iframe in site builder public function actionZone() { $zone = $_REQUEST["name"]; $page = BPages::getHomePage(); if (isset($page) && $page != false) { $this->layout = 'edit_column'; require_once Yii::getPathofAlias('application.classes').'/general.php'; Yii::app()->context->page = $page; $renderMethod = "renderPartial"; $this->$renderMethod('/site/zone', array('page'=>$page, 'zone' => $zone)); } } // render html structure for inline iframe in site builder public function actionView() { if (isset($_REQUEST['page_id'])) { $page_id = $_REQUEST['page_id']; $page = BPages::model()->findByPk($page_id); } else { $page = BPages::getHomePage(); } if (isset($page) && $page != false) { $this->layout = 'edit_column'; require_once Yii::getPathofAlias('application.classes').'/general.php'; Yii::app()->context->page = $page; $renderMethod = isset($_REQUEST["body"]) ? "renderPartial" : "render"; $this->$renderMethod('/site/view', array('page' => $page)); } } // action to view the website public function actionFview() { $this->layout = 'column_view_page'; $this->render('/site/fview'); } // compile all skin presets to css standard public function actionThemes() { $this->renderPartial('themes', array('css')); } // function to process ajax request call by a widget on page public function actionAjax() { $id = $_GET[('module_id')]; $module_data = $_REQUEST[('module_data')]; module($id, $module_data); } public function actionError() { if ($error = Yii::app()->errorHandler->error) { $this->render('error', $error); } } public function actionStat() { if (Yii::app()->user->isGuest) { Yii::app()->user->loginRequired(); } Yii::app()->site; // define("_BBC_PAGE_NAME", $page->name); define("_BBCLONE_DIR",Yii::getPathofAlias('bbclone_app').'/'); define("_BBC_CACHE_PATH", Yii::getPathofAlias('application_site').'/stats/'); //define("COUNTER", _BBCLONE_DIR."mark_page.php"); require(_BBCLONE_DIR."/index.php"); } protected function renderPopupBackendTemplate($data) { $html = ''; if(isset($data)) { $html = @$this->renderPartial('popup/___custom', array('name'=>$data['name'], 'type'=>$data['type'],'title'=>$data['title']), true); } return $html; } protected function renderModuleBackendTemplate($data) { $html = ''; if(isset($data)) { $html = @$this->renderPartial('modules/___custom', array('name'=>$data['name'],'title'=>$data['display_name']), true); } return $html; } public static function startsWith($haystack, $needle) { $length = strlen($needle); return (substr($haystack, 0, $length) === $needle); } public function actiongetHover() { $ihoverPath = Yii::getPathofAlias('application_root.css'). DIRECTORY_SEPARATOR . 'ihover.min.css'; $content = file_get_contents($ihoverPath); $effects = array(); $shapes = array('square', 'circle'); $directions = array('left_to_right', 'right_to_left', 'left_and_right', 'right_and_left', 'from_left_and_right', 'from_right_and_left', 'top_to_bottom', 'bottom_to_top','from_top_and_bottom'); $s = '{'; for($i=1;$i <= 15;$i++) { $effect = 'effect'.$i; $s.= $effect.':'; foreach($shapes as $shape) { $s .= '<br>{'.''.$shape.':[<br>'; foreach($directions as $direction) { if(strpos($content, '.ih-item.'.$shape.'.'.$effect.'.'.$direction)) { $s.= '\''.$direction.'\','; } } $s .= '],'; $s .= '},'; } } $s .= '}'; echo $s; } public function actionViewzone() { $name = $_GET['name']; $this->renderPartial('zone_templates/'.$name, array()); } public function actionRenderzone() { $name = $_GET['name']; $this->render('zone_templates/'.$name, array()); } public function actionTest() { $table_prefix = 'tbla_'; $query = 'SHOW TABLES '.(strlen($table_prefix) ? (" LIKE '".$table_prefix."%'") : ''); $query_tables = Yii::app()->db->createCommand()->setText($query)->queryAll(); foreach ($query_tables as $key => $value) { foreach ($value as $k => $v) { if (self::startsWith($k, 'Tables_in')) { $tables[] = $v; } } } foreach ($tables as $table) { echo "ALTER TABLE `".$table."` ADD `inline_id` INT NOT NULL AFTER `id`;<br> UPDATE `".$table."` set `inline_id`=`id`;<br> ALTER TABLE `".$table."` ADD UNIQUE( `inline_id`, `site_id`);<br>"; } } }
[+]
..
[-] AjaxController.php
[edit]
[-] SiteController.php
[edit]
[-] IpnController.php
[edit]
[-] StatController.php
[edit]
[-] BuilderController.php
[edit]
[-] BlogController.php
[edit]
[-] UserController.php
[edit]
[-] CheckoutController.php
[edit]
[-] PaypalController.php
[edit]