function store() { global $mainframe, $db, $user; $post = $_POST; $arr_team_table = Request::getVar('arr_team_table', null); $arr_team_table = json_decode($arr_team_table, true); $model = Tournament::getInstance(); global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to change Tournament"); $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament'))); } $tourID = Request::getVar('tourID', 0); $db = Yii::app()->db; foreach ($arr_team_table as $table_num => $team_tables) { if (count($team_tables)) { $stt = 1; foreach ($team_tables as $teamID => $team) { if ($team == null) { continue; } if ($team['ordering'] == null or $team['ordering'] == 0) { $team['ordering'] = $stt; } $query = "UPDATE " . TBL_GS_TEAM_REGISTER_TOUR . " SET table_num = {$table_num}" . " ,ordering = " . $team['ordering'] . " ,mdate = now()" . " ,modified_by = {$user->id}" . " WHERE tourID = {$tourID} AND teamID = {$teamID}"; $command = $db->createCommand($query); $command->execute(); $stt++; } } } return true; }
public function actionSave() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to modify setting"); $this->redirect(Router::buildLink("cpanel")); } $post = Request::get(); $db_info = $post['config']['database']; $connectionString = '\'mysql:dbname=' . $db_info['databasename'] . ';host=' . $db_info['hostname'] . '\''; $this->setConfig('main', 'connectionString', $connectionString, 'db', "\\s*\\,\\s*\\'errorHandler"); $this->setConfig('main', 'username', '\'' . $db_info['username'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler"); $this->setConfig('main', 'tablePrefix', '\'' . $db_info['prefix'] . '\'', 'db', "\\s*\\,\\s*\\'errorHandler"); $this->setConfig('main', 'adminEmail', '\'' . $post['config']['main']['adminEmail'] . '\'', 'params'); $this->setConfig('main', 'permission', '\'' . $post['config']['main']['permission'] . '\'', 'params'); $this->setConfig('main', 'copyright', '\'' . $post['config']['main']['copyright'] . '\'', 'params'); $this->writeConfig('main'); $this->setConfig('backend', 'timeout', '\'' . $post['config']['backend']['sessionlifetime'] . '\'', 'params'); $this->setConfig('backend', 'timeout2', '\'' . $post['config']['backend']['sessionlifetime2'] . '\'', 'params'); $this->setConfig('backend', 'sessionName', 'md5("' . $post['config']['backend']['sessionname'] . '")', 'session'); $this->writeConfig('backend'); $this->setConfig('frontend', 'timeout', '\'' . $post['config']['site']['sessionlifetime'] . '\'', 'params'); $this->setConfig('frontend', 'timeout2', '\'' . $post['config']['site']['sessionlifetime2'] . '\'', 'params'); $this->setConfig('frontend', 'offlineMessage', '\'' . $post['config']['site']['offlinemessage'] . '\'', 'params'); $this->setConfig('frontend', 'siteoffline', $post['config']['site']['offline'], 'params'); $this->setConfig('frontend', 'sessionName', 'md5("' . $post['config']['site']['sessionname'] . '")', 'session'); $this->setConfig('frontend', 'sef', '\'' . $post['config']['site']['sef'] . '\'', 'params'); $this->setConfig('frontend', 'sef_suffix', '\'' . $post['config']['site']['sef_suffix'] . '\'', 'params'); $this->setConfig('frontend', 'sef_urlsuffix', '\'' . $post['config']['site']['sef_urlsuffix'] . '\'', 'params'); $this->writeConfig('frontend'); YiiMessage::raseSuccess("Successfully saved changes config"); // $this->pageTitle = "Home page Display"; $this->redirect(Router::buildLink("cpanel", array("view" => "sysconfig"))); }
public function actionDisplay() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to visit page"); $this->redirect(Router::buildLink("cpanel")); } $this->addBarTitle("Resource <small>[manager]</small>", "user"); $this->render('default'); }
public function getExtensionById($id) { global $mainframe; $obj_row = YiiTables::getInstance(TBL_EXTENSIONS); $obj_row->load($id); $path = Yii::app()->basePath . '/extensions/modules/' . $obj_row->folder; $module_xml_file = $path . "/" . $obj_row->folder . ".xml"; if (!file_exists($module_xml_file)) { YiiMessage::raseWarning("Error! file xml module is not existing!."); $mainframe->redirect(Yii::app()->createUrl("/modules")); } $params = sysLoadXmlParam($module_xml_file, $obj_row->params); $obj_row->params = $params; return $obj_row; }
static function render($node, $value = null, $prefix_name = "params", $_w1 = 5, $_w2 = 7) { $node['type'] = isset($node['type']) ? $node['type'] : "text"; $node['default'] = isset($node['default']) ? $node['default'] : null; $node['label'] = isset($node['label']) ? $node['label'] : "label field"; $node['value'] = isset($node['value']) ? $node['value'] : ""; $node['name'] = isset($node['name']) ? $node['name'] : $node['type']; $node['description'] = isset($node['description']) ? $node['description'] : ""; $node['attr'] = isset($node['attr']) ? $node['attr'] : ""; $className = ucfirst($node['type']) . "Element"; if (!in_array(strtolower($node['type']), array("menutype", "list", 'radio', 'text', "textarea", "catid"))) { return ""; } if (!class_exists($className)) { YiiMessage::raseWarning("Element " . $node['type'] . " is not existing "); exit; } $element = new $className($node, $value); return $element->build($prefix_name, array($_w1, $_w2)); }
function store() { global $mainframe, $db, $user; $tourID = Request::getVar('tourID', 0); $post = $_POST; $model = Matches::getInstance(); global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to change Tournament"); $this->redirect(Router::buildLink("gamesport", array('view' => 'tournament'))); } $tourID = Request::getVar('tourID', 0); $db = Yii::app()->db; $matches_data_table = json_decode($post['matches_data_table']); $matches_make_first_data = $post['matches_make_first_data']; if ($matches_make_first_data == 1) { $model->make_matches($tourID, $matches_data_table); } return true; }
public function actionUploadext() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to install extension"); $this->redirect(Router::buildLink("cpanel")); } $pack_install = $_FILES['install_package']; if ($pack_install == null or $pack_install['error'] != 0) { YiiMessage::raseWarning("Unable to find install package"); $this->redirect(Router::buildLink("installer")); } // $YiiFile = new YiiFile; $path_file_pach_install = PATH_TMP . $pack_install['name']; YiiFile::upload($pack_install['tmp_name'], $path_file_pach_install); $file_info = pathinfo($path_file_pach_install); if (strtolower($file_info['extension']) != "zip") { YiiMessage::raseWarning("Invalid extension install package"); YiiFile::delete($path_file_pach_install); $this->redirect(Router::buildLink("installer")); } $filename = $file_info['filename']; $zip = new ZipArchive(); $res = $zip->open($path_file_pach_install); $path_extact = PATH_TMP . $filename; if ($res === TRUE) { $zip->extractTo($path_extact); $zip->close(); } else { YiiMessage::raseWarning("Invalid extract file install package"); YiiFile::delete($path_file_pach_install); $this->redirect(Router::buildLink("installer")); } $files_xml = YiiFolder::files($path_extact, "\\.xml", 1, true); if (count($files_xml) == 0) { YiiFile::delete($path_file_pach_install); YiiFolder::delete($path_extact); YiiMessage::raseWarning("Invalid extension install package"); $this->redirect(Router::buildLink("installer")); } $xml = null; foreach ($files_xml as $file_xml) { $xml = simplexml_load_file($file_xml); if (!$xml) { unset($xml); continue; } if ($xml->getName() != 'extension') { unset($xml); continue; } $type = (string) $xml->attributes()->type; if (!in_array($type, array("app", "module"))) { unset($xml); continue; } } $type = (string) $xml->attributes()->type; $row_ext = YiiTables::getInstance(TBL_EXTENSIONS); $arr_info = array(); $arr_info['title'] = (string) $xml->title; $arr_info['name'] = (string) $xml->name; $arr_info['alias'] = $this->convertalias($arr_info['title']); $arr_info['author'] = (string) $xml->author; $arr_info['version'] = (string) $xml->version; $arr_info['creationDate'] = (string) $xml->creationDate; $arr_info['description'] = (string) $xml->description; $arr_info['type'] = (string) $xml->attributes()->type; $arr_info['folder'] = trim(preg_replace('/[^\\w\\d]+/is', '', $row_ext->title)); $arr_info['client'] = (string) $xml->attributes()->client; if ($arr_info['client'] == "") { $arr_info['client'] = 1; } $row_ext->loadRow("*", "title = '" . $arr_info['title'] . "' OR alias = '" . $arr_info['alias'] . "'"); $ext_new = false; if ($row_ext->id == 0) { $row_ext->cdate = date("Y-m-d H:i:s"); $ext_new = true; } $row_ext->mdate = date("Y-m-d H:i:s"); $row_ext->bind($arr_info); $path_ext = PATH_MODULES . $row_ext->folder; if ($row_ext->type == "app" and $row_ext->client == 1) { $path_ext = PATH_APPS_FRONT . $row_ext->folder; } else { if ($row_ext->type == "app" and $row_ext->client == 0) { $path_ext = PATH_APPS_BACKEND . $row_ext->folder; } } if (!YiiFolder::create($path_ext, 0775)) { YiiMessage::raseWarning("FILESYSTEM ERROR Could not create directory"); YiiFile::delete($path_file_pach_install); YiiFolder::delete($path_extact); $this->redirect(Router::buildLink("installer")); } $bool = YiiFolder::copy($path_extact, $path_ext, '', 1); if ($row_ext->type == "module" and $ext_new == true) { $row_module = YiiTables::getInstance(TBL_MODULES); $row_module->title = $row_ext->title; $row_module->alias = $row_ext->alias; $row_module->cdate = date("Y-m-d H:i:s"); $row_module->mdate = date("Y-m-d H:i:s"); $row_module->module = $row_ext->folder; $row_module->status = 0; $row_module->store(); } YiiFile::delete($path_file_pach_install); YiiFolder::delete($path_extact); $this->redirect(Router::buildLink("installer"), "Succesfully install package"); }
function actionRemove() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to remove menu item"); $this->redirect(Router::buildLink("menus", array("view" => 'menutype'))); } $menuID = Request::getInt('menu', ""); $cids = Request::getVar("cid", 0); $table_menu = YiiTables::getInstance(TBL_MENU_ITEM); if (count($cids) > 0) { for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; //check item first $table_menu->remove($cid); } } YiiMessage::raseSuccess("Successfully remove Menuitem(s)"); $this->redirect(Router::buildLink('menus', array("view" => "menuitem", 'menu' => $menuID))); }
static function checking() { global $user, $mainframe; if ($user->isSuperAdmin()) { return true; } $backEnd = $mainframe->isBackEnd(); $string_url = CheckPerMission::get_fullurl(); $arr_url = CheckPerMission::get_arr_url(); $arr_resource = CheckPerMission::getResources($backEnd, $arr_url); $query_user = "******" . TBL_RSM_RESOURCE_XREF . " WHERE object_type = 1 AND objectID = {$user->id}"; $query_group = "SELECT * FROM " . TBL_RSM_RESOURCE_XREF . " WHERE object_type = 2 AND objectID = {$user->groupID}"; $arr_granted = CheckPerMission::getGranted($user->id, 1); $arr_Ggranted = CheckPerMission::getGranted($user->groupID, 2); $table_ext = YiiTables::getInstance(TBL_EXTENSIONS); $ext_default_1 = $table_ext->loadColumn("name", "allowall = 1 "); if (count($arr_resource)) { // step 1: check allow user // neu co cho phep thi return true // neu khong thay noi gi thi sang s2 foreach ($arr_resource as $resource) { if (in_array($resource->id, $arr_granted['allow'])) { return true; } } // step 2: check deny user // neu co bi cam thi redirect // neu khong thay noi gi thi sang s3 foreach ($arr_resource as $resource) { if (in_array($resource->id, $arr_granted['deny'])) { YiiMessage::raseNotice($resource->redirect_msg); Yii::app()->getRequest()->redirect($resource->redirect_url); return true; } } // step 3: check allow group // neu co cho phep thi return true // neu khong thay noi gi thi sang s4 foreach ($arr_resource as $resource) { if (in_array($resource->app, $arr_Ggranted)) { return true; } } } // kiem tra mac dinh $cur_app = Request::getVar('app'); if (in_array($cur_app, $ext_default_1)) { // neu app hien tai nam trong so app duoc phep thi return true return true; } else { // khong duoc truy cap if ($mainframe->isBackEnd()) { YiiMessage::raseNotice("Your account not have permissin to visit page"); if ($cur_app == "cpanel") { // ra trang chu froent-end Yii::app()->getRequest()->redirect("/"); } else { Yii::app()->getRequest()->redirect("?app=cpanel"); } } else { return true; } } }
function actionRemove() { global $user; $cids = Request::getVar("cid", 0); if (count($cids) > 0) { for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; $obj_article = YiiResource::getInstance(); $obj_article->remove($cid); } } YiiMessage::raseSuccess("Successfully delete Permission(s)"); $this->redirect(Router::buildLink("permission", array('view' => 'resource'))); }
function actionSave() { $cid = $this->store(); YiiMessage::raseSuccess("Successfully save Grant user"); $this->redirect(Router::buildLink("permission", array('view' => 'users'))); }
function deleteExt() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to modify extension"); $this->redirect(Router::buildLink("cpanel")); } $cid = Request::getVar('cid'); //$cid = 1; $obj_ext = YiiExtensions::getInstance(); $obj_tblExt = $obj_ext->loadExt($cid); if ($obj_tblExt->required == 1) { YiiMessage::raseNotice("System is require extention: {$obj_tblExt->name}"); $this->redirect(Router::buildLink("installer", array('view' => 'manager'))); } //neu ma app: kiem tra menu co dang su dung ext nay khong thi unpublish di if ($obj_tblExt->type == "app") { Yii::app()->db->createCommand()->update(TBL_MENU_ITEM, array('status' => 0), 'app = \'' . $obj_tblExt->folder . '\''); } //neu ma module: kiem tra co module nao duoc tao ra khong thi unpublish di if ($obj_tblExt->type == "module") { // $obj_module = YiiModule::getInstance(); // $items = $obj_module->loadItems(null, 'module = \''. $obj_tblExt->folder.'\''); Yii::app()->db->createCommand()->update(TBL_MODULES, array('status' => 0), 'module = \'' . $obj_tblExt->folder . '\''); } //neu ma theme: thi kiem tra xem co dang la theme default khong }
public function accessRules() { global $db, $user, $mainframe; $YiiApp = Yii::app(); $app = Request::getVar('app', 'cpanel'); $view = Request::getVar('view', 'cpanel'); $layout = Request::getVar('layout', 'cpanel'); if (is_object($user) and $user->isLogin()) { if (!$user->isAdmin()) { YiiMessage::raseWarning("Your account not have permission to visit backend page"); Yii::app()->session['userbackend'] = null; $this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'logout'))); // $this->redirect(array('users/logout')); return; } if ($app == "users" and $view == "user" and $layout == "login") { $this->redirect(Router::buildLink("cpanel")); // $this->redirect(array('/cpanel')); return; } return array(); $return = array(array('allow', 'actions' => array("templates"), 'users' => array('*'))); return $return; } else { if ($app == "users" and $view == "user" and $layout == "login") { return array(array('allow', 'actions' => array("login"), 'users' => array('*')), array('allow', 'users' => array('@')), array('deny', 'users' => array('*'))); } else { $this->redirect(Router::buildLink("users", array("view" => 'user', 'layout' => 'login'))); // return array(); } } }
function actionRemove() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission remove category"); $this->redirect(Router::buildLink("categories")); } $cids = Request::getVar("cid", 0); if (count($cids) > 0) { $obj_table = YiiTables::getInstance(TBL_CATEGORIES); for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; $obj_table->remove($cid); } } YiiMessage::raseSuccess("Successfully delete GroupUser(s)"); $this->redirect(Router::buildLink("categories")); }
function copyitem($cid) { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to modify menu item"); return false; } $obj_item = YiiCategory::getInstance(); $obj_item = $obj_item->loadItem($cid, "*", false); $obj_item->id = 0; $obj_item->name = $obj_item->name . " copy"; $obj_item->alias = $obj_item->alias . "-copy"; $obj_item->status = 0; $obj_item->store(); return $obj_item->id; }
function actionRemove() { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission remove location"); $this->redirect(Router::buildLink("cpanel")); } $cids = Request::getVar("cid", 0); if (count($cids) > 0) { for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; //check item first $item = $this->removeItem($cid); } } YiiMessage::raseSuccess("Successfully remove location(s)"); $this->redirect(Router::buildLink('locations')); }
public function actionChangepass() { global $mainframe, $user; if (!$mainframe->isLogin()) { YiiMessage::raseNotice('Please login before change password !!!'); $this->redirect(Router::buildLink('user', array('layout' => 'login'))); } if (isset($_POST['submitform'])) { $model = User::getInstance(); if ($model->changepass()) { YiiMessage::raseSuccess('Change pass successfully !!!'); $this->redirect(Router::buildLink('user')); } } $this->render('changepass'); }
protected function renderContent() { global $mainframe, $link_change_pass; $model = User::getInstance(); $total_resume = ""; $user = $mainframe->getUser(); $user_name = ""; $display_user = "******"; $display_userloged = "none"; if ($mainframe->isLogin()) { $user_name = (isset($user["first_name"]) and $user["first_name"] != "") ? ucwords($user["first_name"]) . " " . ucwords($user['last_name']) : $user["email"]; $display_user = "******"; $display_userloged = "block"; $total_resume = $model->getAccountInfo(); } $user_name = preg_replace('/\\@.*?$/is', "", $user_name); ?> <!-- HEADER --> <div class="header"> <div class="wrapper" > <div class="logo"><a href="/" title=""><img src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/logo.png" alt=""></a></div> <div class="nav_menu"> <ul class="menu-main" class="menu"> <li class="" class=""><a href="/" title="">home</a></li> <li class="" class=""><a rel="nofollow" href="<?php echo Yii::app()->controller->createUrl("/resume/addnew"); ?> " title="">create new resume</a></li> <li> <div class="user" style="display: <?php echo $display_user; ?> "> <p> <a rel="nofollow" href="" title="Login" id="user-login">Login</a> / <a href="<?php echo MASTER_DOMAIN; ?> /account/register" title="Register" id="user-register1">Register</a></p> </div> <div class="user-loged" style="display: <?php echo $display_userloged; ?> "> <a href="#"><p> Hi,<span class="user-name" ><?php echo $user_name; ?> </span> <img src="/templates/resume/css/img/dropdown-user.png"></p></a> <div class="sub-bg"> <span class="new_homedasdasd2" > </span> <ul class="sub-menu" style="display: block;"> <li><a rel="nofollow" id="my-resume" href="<?php echo Yii::app()->controller->createUrl("/my-resumes/"); ?> ">My Resume <span id="total-resume">(<?php echo $total_resume; ?> )</span></a></li> <li><a rel="nofollow" id="change-the-password" href="<?php echo $link_change_pass; ?> ">Change Password</a></li> <!-- <li><a rel="nofollow" id="change-the-password" href="<?php echo Yii::app()->controller->createUrl("/user/changepass"); ?> ">Change Password</a></li>--> <li><a rel="nofollow" id="btn-logout-page" href="<?php echo Yii::app()->controller->createUrl("/user/logout"); ?> ">Logout</a></li> </ul> </div> </div> </li> </ul> </div> </div> </div> <!-- pop LOGIn --> <div class="popup-login" id="popup-login"> <div class="wrapper" > <div class="popUpDiv" style=" "> <a href="" title="Close" class="btn-close-popup" relto="popup-login" rel="nofollow"><img alt="" src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/popup-close.png" /></a><br /> <div class="popup-header" > <h2>Log in</h2> </div> <div id="status-bar-login"><?php YiiMessage::showMessage(); ?> </div> <form name="login" action="" method="POST" id="form-login"> <div class="element"> <input id="LoginForm-username" name="LoginForm[username]" value="" placeholder="Email" class="el-form-login" /> </div> <div class="element"> <input type="password" id="LoginForm-password" name="LoginForm[password]" value="" placeholder="Pasword" class="el-form-login" /> </div> <div class="reg-forgot" > <button type="button" name="login" id="btn-form-login">Login</button> <p> <a class="btn-change-popup1" href="<?php echo MASTER_DOMAIN; ?> /account/register" rel="popup-login||popup-register||Register||/user/register"> Register </a> | <a href="<?php echo MASTER_DOMAIN . "/account/forgot"; ?> " class="btn-change-popup1" rel="popup-login||popup-forgot-password||Forgot Password||/user/forgot-password"> Forgot Password</a> </p> </div> <div class="lg-social" > <p>Or login with your social acount</p> <ul> <li><a rel="nofollow" href="<?php echo MASTER_DOMAIN . "/account/facebook"; ?> " title="" target="blank" class="openid"> <img src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/fb.png" alt="" /> </a></li> <li><a rel="nofollow" href="<?php echo MASTER_DOMAIN . "/account/twitter"; ?> " title="" target="blank" class="openid"> <img src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/tw.png" alt=""/> </a></li> <li><a rel="nofollow" href="<?php echo MASTER_DOMAIN . "/account/google"; ?> " title="" target="blank" class="openid"> <img src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/google.png" alt=""/> </a></li> <li><a rel="nofollow" href="<?php echo MASTER_DOMAIN . "/account/yahoo"; ?> " title="" target="blank" class="openid"> <img src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/yh.png" alt=""/> </a></li> </ul> </div> </form> </div> </div> </div> <!-- pop forgot password --> <div class="popup-forgot-password" id="popup-forgot-password"> <div class="wrapper" > <div class="popUpDiv" style=" "> <a href="" title="Close" class="btn-close-popup" relto="popup-forgot-password" rel="nofollow"><img alt="" src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/popup-close.png" /></a><br /> <div class="popup-header" > <h2>Forgot Password</h2> </div> <div id="status-bar-forgotpassword"><?php YiiMessage::showMessage(); ?> </div> <form name="login" action="" method="POST" id="form-forgot-password"> <div class="element"> <input id="forgotpassword-username" name="forgotpassword[username]" value="" placeholder="Email" /> </div> <div class="reg-forgot" > <button type="submit" name="login" id="btn-form-forgotpassword">Submit</button> <p> Or <a href="" title="" class="btn-change-popup" rel="popup-forgot-password||popup-register||Register||/user/register">   Register »</a> </p> </div> </form> </div> </div> </div> <!-- REGISTER --> <div class="popup-register" id="popup-register" > <div class="wrapper" > <div class="popUpDiv"> <a href="#" title="" class="btn-close-popup" relto="popup-register" rel="nofollow"><img alt="" src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/popup-close.png" /></a><br /> <div class="popup-header" > <h2>Register</h2> </div> <div id="status-bar-register"></div> <form name="register" action="" method="POST" id="form-register" > <div class="element"> <input id="registerForm-email" name="registerForm[email]" value="" placeholder="Email" /> <span class="red-error" >*</span> </div> <div class="element"> <input type="password" id="registerForm-password" name="registerForm[password]" value="" placeholder="Password" /> <span class="red-error" >*</span> </div> <div class="element"> <input type="password" id="registerForm-re-password" name="registerForm[re-password]" value="" placeholder="Re-Password" /> <span class="red-error" >*</span> </div> <div class="element"> <select id="registerForm-country" name="category" class="err"> <option value="0">Select country</option> <option value="us">United State</option> <option value="uk">United Kingdom</option> <option value="ca">Canada</option> <option value="in">India</option> <option value="au">Australia</option> <option value="vi">Việt Nam</option> </select> </div> <div class="reg-forgot" > <button type="submit" name="login" id="btn-form-register">Register</button> <p> Have an acount ? <a href="" title="" class="btn-change-popup" rel="popup-register||popup-login||Login||/user/login">Log in » </a></p> </div> </form> </div> </div> </div> <?php global $mainframe; $user = $mainframe->getUser(); ?> <div class="popup-changepass" id="popup-changepass" > <div class="wrapper" > <div class="popUpDiv"> <a href="#" title="" id="close-popup-changepass" rel="nofollow"><img alt="" src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/popup-close.png" /></a><br /> <div class="popup-header" > <h2>Change password</h2> </div> <div id="status-bar-chagnepass"></div> <form name="changepass" action="" method="POST" id="form-changepass" > <div class="element"> <input type="password" id="ChangepassForm-password" name="ChangepassForm[password]" value="" placeholder="Old Password" /> </div> <div class="element"> <input type="password" id="ChangepassForm-new-password" name="ChangepassForm[new-password]" value="" placeholder="New Password" /> </div> <div class="element"> <input type="password" id="ChangepassForm-re-password" name="ChangepassForm[re-password]" value="" placeholder="Verifi Password" /> </div> <div class="reg-forgot" > <button type="submit" name="login" id="btn-form-chagnepass" suppliers="<?php echo isset($user['suppliers']) ? $user['suppliers'] : ""; ?> " >Chagne</button> </div> </form> </div> </div> </div> <!-- Reset pass --> <div class="popup-resetpass" id="popup-resetpass" > <div class="wrapper" > <div class="popUpDiv"> <a href="#" title="" class="btn-close-popup" rel="popup-resetpass"><img alt="" src="<?php echo Yii::app()->request->baseUrl; ?> /templates/resume/css/img/popup-close.png" /></a><br /> <div class="popup-header" > <h2>Reset password</h2> </div> <div id="status-bar-resetpass"></div> <form name="changepass" action="" method="POST" id="form-resetpass" > <div class="element"> <input type="password" id="resetpass-new-password" name="resetpass[new-password]" value="" placeholder="New Password" /> </div> <div class="element"> <input type="password" id="resetpass-re-password" name="resetpass[re-password]" value="" placeholder="Verifi Password" /> </div> <div class="reg-forgot" > <button type="submit" name="login" id="btn-form-resetpass" >Chagne</button> <p> <a href="" title="" class="btn-change-popup" rel="popup-resetpass||popup-forgot-password||Forgot Password||user/forgot-password"> Forgot password</a> | <a href="" class="btn-change-popup" rel="popup-resetpass||popup-login||Login||/user/login" title=""> Login</a> </p> </div> </form> </div> </div> </div> <?php }
function actionTree() { global $user; $tmpl = Request::getVar('tmpl', null); $modelUser = new Users(); $modelGroup = new Group(); $this->addBarTitle("Users <small>[tree]</small>", "user"); $groupID = Request::getVar('groupID', $user->groupID); $group = $modelGroup->getItem($user->groupID); if ($group->parentID != 1) { if (!$user->groupChecking($groupID)) { $group = $modelGroup->getItem($user->groupID); YiiMessage::raseNotice("Your account not have permission to visit page"); $this->redirect(Router::buildLink("cpanel")); } } $group = $modelGroup->getItem($groupID); $list_user = $modelUser->getUsers($groupID, " leader DESC, id ASC "); $arr_group = $modelUser->getGroups($groupID); if ($tmpl == null) { $this->render('tree', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group)); } else { if ($tmpl == 'app') { $this->render('treegroup', array("objGroup" => $group, "list_user" => $list_user, 'arr_group' => $arr_group)); die; } } }
/** * Function progress get team by tour ID */ function actionList($id = 2) { $id = Request::getVar("tour_id", $id); $model = Teams::getInstance(); global $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit Team"); $this->redirect(Router::buildLink("gamesport", array('view' => 'teams'))); } $items = $model->ListTeam($id); echo json_encode($items); }
function actionRemove() { global $user; $model = new Group(); $mode_user = new Users(); if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to add/edit group"); $this->redirect(Router::buildLink("users", array('view' => 'group'))); } $cids = Request::getVar("cid", 0); if (count($cids) > 0) { $obj_table = YiiUser::getInstance(); for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; $list_user = $mode_user->getUsers($cid, null, true); $list_group = $model->getItems($cid); if (empty($list_user) and empty($list_group)) { $obj_table->removeGroup($cid); } else { YiiMessage::raseNotice("Group user have something account/sub group"); $this->redirect(Router::buildLink("users", array('view' => 'group'))); return false; } } } YiiMessage::raseSuccess("Successfully delete GroupUser(s)"); $this->redirect(Router::buildLink("users", array("view" => "group"))); }
function changeFeature($cid, $value) { $obj_table = YiiArticle::getInstance(); $obj_table = $obj_table->loadItem($cid); // check quyen so huu global $user; if (!($bool = $user->modifyChecking($obj_table->created_by))) { $obj_users = YiiUser::getInstance(); $item_user = $obj_users->getUser($obj_table->created_by); YiiMessage::raseNotice("Your account not have permission to modify resource of: {$item_user->username}"); $this->redirect(Router::buildLink("articles")); return false; } $obj_table->feature = $value; $obj_table->store(); }
public function getItem($cid) { global $mainframe; $obj_module = YiiModule::getInstance(); $obj_row = $obj_module->loadItem($cid); $path = Yii::app()->basePath . '/extensions/modules/' . $obj_row->module; $module_xml_file = $path . "/" . $obj_row->module . ".xml"; if (!file_exists($module_xml_file)) { YiiMessage::raseWarning("Error! file xml module is not existing!."); $mainframe->redirect(Yii::app()->createUrl("/modules")); } $params = sysLoadXmlParam($module_xml_file, $obj_row->params); $obj_row->params = $params; return $obj_row; }
function actionRemove() { global $user; $cids = Request::getVar("cid", 0); $obj_table = YiiTables::getInstance(TBL_VIDEOS); if (count($cids) > 0) { for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; $obj_table->load($cid); if (!($bool = $user->modifyChecking($obj_table->created_by))) { $obj_users = YiiUser::getInstance(); $item_user = $obj_users->getUser($obj_table->created_by); YiiMessage::raseNotice("Your account not have permission to delete video: {$obj_table->title}"); $this->redirect(Router::buildLink("videos")); return false; } //check item first $obj_table->remove($cid); } } YiiMessage::raseSuccess("Successfully remove Video(s)"); $this->redirect(Router::buildLink("videos")); }
<div id="wrapper" <?php if (getSysConfig("sidebar.display", 1) == 0) { echo 'style="padding:0; "'; } ?> > <!-- Sidebar --> <?php if ($tmpl !== "app") { ?> <?php echo $this->renderPartial('/block/sidebar'); ?> <?php YiiMessage::showMessage(); ?> <?php } ?> <div id="page-wrapper"> <?php if ($tmpl !== "app") { ?> <?php $this->showToolbar(); ?> <?php $mainframe->showSubMenu(); ?> <?php
static function raseSuccess($message) { YiiMessage::$message = $message; Yii::app()->session['message'] = $message; Yii::app()->session['rasestatuscode'] = "success"; }
function registration($data_post) { $tbl_user = YiiTables::getInstance(TBL_USERS, null, true); $cond = "mobile = '" . $data_post['mobile'] . "'"; $bool = $tbl_user->getTotal($cond); if ($bool) { YiiMessage::raseNotice("Your telephone number is already registered"); return false; } $cond = " username = '******'username'] . "'"; $bool = $tbl_user->getTotal($cond); if ($bool) { YiiMessage::raseNotice("username is already registered"); return false; } $data_post['password'] = md5($data_post['password']); $tbl_user->bind($data_post); $tbl_user->store(); $this->setLogin($tbl_user->id); }
function sysLoadXmlParam($xml_file, $values = null, $type = "Module") { global $mainframe; $obj_xml = simplexml_load_file($xml_file); $params_value = json_decode($values, true); if (!is_array($params_value)) { $params_value = array(); } if ($obj_xml == false) { $message = "Failed loading module: "; foreach (libxml_get_errors() as $error) { $message .= "<br>" . $error->message; } YiiMessage::raseSuccess($message); return false; } // print_r($obj_xml); die; $config = $obj_xml->config ? $obj_xml->config : false; if ($config == false) { return array(); } $array_param = array(); foreach ($config->param as $k => $param) { $obj_param = new stdClass(); $param_title = "{$type} Parameters(" . (count($array_param) + 1) . ")"; if (isset($param->attributes()->title)) { $param_title = (string) $param->attributes()->title; } $obj_param->title = $param_title; $obj_param->fields = array(); foreach ($param->field as $field) { $field_name = (string) $field['name']; $field_value = isset($params_value[$field_name]) ? $params_value[$field_name] : null; $obj_param->fields[] = YiiElement::render($field, $field_value); } $array_param[] = $obj_param; } return $array_param; }
function copyitem($cid) { global $mainframe, $user; if (!$user->isSuperAdmin()) { YiiMessage::raseNotice("Your account not have permission to modify menu item"); return false; } $obj_menu = YiiMenu::getInstance(); $tbl_menu = $obj_menu->loadItem($cid); $tbl_menu->id = 0; $tbl_menu->title = $tbl_menu->title . " copy"; $tbl_menu->alias = $tbl_menu->alias . "-copy"; $tbl_menu->status = 0; $tbl_menu->_ordering = $tbl_menu->ordering; $tbl_menu->_old_parent = $tbl_menu->parentID; $tbl_menu->store(); return array($tbl_menu->menuID, $tbl_menu->id); }
function changepass() { global $mainframe; $user = $mainframe->getUser(); $db = $this->db; $password = Request::getVar("password"); $newpassword = Request::getVar("new-password"); $renewpassword = Request::getVar("renew-password"); if ($password != "") { if (md5($password) != $user->password) { YiiMessage::raseNotice('Type old password !!!'); return FALSE; } } if ($newpassword == "") { YiiMessage::raseNotice('Type new password !!!'); return FALSE; } if ($newpassword !== $renewpassword) { YiiMessage::raseNotice('Type verifi password !!!'); return FALSE; } $tbl_user = YiiTables::getInstance(TBL_USERS, null, true); $tbl_user->load($user->id); $tbl_user->password = md5($newpassword); $tbl_user->store(); return true; }