function actionSave()
 {
     $tourID = Request::getVar('tourID', 0);
     $this->store();
     YiiMessage::raseSuccess("Tournament save succesfully");
     $this->redirect(Router::buildLink("gamesport", array('view' => 'matches', "tourID" => $tourID)));
 }
 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")));
 }
 function actionSave()
 {
     $tourID = Request::getVar('tourID', 0);
     $cur_table = Request::getVar('cur_table', 1);
     $this->store();
     YiiMessage::raseSuccess("Round table save succesfully");
     $this->redirect(Router::buildLink("gamesport", array('view' => 'roundtable', "tourID" => $tourID, 'cur_table' => $cur_table)));
 }
 public function actionDisplay()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to manager extension");
         $this->redirect(Router::buildLink("cpanel"));
     }
     $task = Request::getVar('task', "");
     $task = Request::getVar('task', "");
     if ($task == "hidden" or $task == 'publish' or $task == "unpublish") {
         $cids = Request::getVar('cid');
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             if ($task == "publish") {
                 $this->changeState($cid, 1);
             } else {
                 if ($task == "hidden") {
                     $this->changeState($cid, 2);
                 } else {
                     $this->changeState($cid, 0);
                 }
             }
         }
         YiiMessage::raseSuccess("Successfully saved changes status for extention");
     } else {
         if ($task == "allowall.on" or $task == "allowall.off") {
             $cids = Request::getVar('cid');
             $type = "On";
             for ($i = 0; $i < count($cids); $i++) {
                 $cid = $cids[$i];
                 if ($task == "allowall.on") {
                     $this->changeState($cid, 1, "allowall");
                 } else {
                     $type = "Off";
                     $this->changeState($cid, 0, "allowall");
                 }
             }
             YiiMessage::raseSuccess("Successfully saved changes extention for allowall: {$type}");
         } else {
             if ($task == "delete") {
                 $this->deleteExt();
             }
         }
     }
     $obj_ext = YiiExtensions::getInstance();
     $extension = $obj_ext->loadExts();
     $this->addIconToolbarDelete("Uninstall", 'Uninstall');
     $this->addBarTitle("Extension Manager <small>[Manage]</small>", "user");
     $this->render('default', array("extentions" => $extension));
 }
Example #5
0
 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 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)));
 }
Example #7
0
 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"));
 }
Example #8
0
 function actionRemove()
 {
     global $user;
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         $obj_users = YiiUser::getInstance();
         for ($i = 0; $i < count($cids); $i++) {
             $cid = $cids[$i];
             $item_user = $obj_users->getUser($cid);
             if (!$user->isSuperAdmin()) {
                 // neu khong phai super admin
                 if ($item_user->status != -1) {
                     // neu != -1 thi khong duoc xoa
                     YiiMessage::raseNotice("Please contact your administrator,\"{$item_user->username}\" is active");
                     $this->redirect(Router::buildLink("users", array('view' => 'user')));
                     return false;
                 } elseif (!($bool = $user->modifyChecking($cid))) {
                     // neu =-1 thi user leader nhom cha duoc xoa user con
                     YiiMessage::raseNotice("Your account not have permission to remove user: {$item_user->username}");
                     $this->redirect(Router::buildLink("users", array('view' => 'user')));
                     return false;
                 }
             }
             $obj_users->removeUser($cid);
         }
     }
     YiiMessage::raseSuccess("Successfully delete User(s)");
     $this->redirect(Router::buildLink("users", array("view" => "user")));
 }
Example #9
0
 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"));
 }
 function actionRemove()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission remove tournament");
         $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, TBL_GS_PLAYERS);
         }
     }
     YiiMessage::raseSuccess("Successfully remove playist(s)");
     $this->redirect(Router::buildLink('gamesport', array('view' => 'Players')));
 }
 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')));
 }
Example #12
0
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;
}
Example #13
0
 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');
 }
Example #14
0
 function actionUnpublish()
 {
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         foreach ($cids as $cid) {
             $this->changeStatus($cid, 0);
         }
     }
     YiiMessage::raseSuccess("Successfully unpublish Module(s)");
     $this->redirect(Router::buildLink("modules"));
 }
Example #15
0
 public function storeItem()
 {
     global $mainframe, $user;
     $cid = Request::getVar("id", 0);
     $obj_table = YiiArticle::getInstance();
     $obj_table = $obj_table->loadItem($cid);
     $obj_table->bind($_POST);
     if ($obj_table->id == 0) {
         $obj_table->created_by = $user->id;
     } else {
         // 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->modified_by = $user->id;
     $obj_table->store();
     YiiMessage::raseSuccess("Successfully save Article");
     return $obj_table->id;
 }
Example #16
0
 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'));
 }
Example #17
0
 function actionSave()
 {
     $cid = $this->store();
     YiiMessage::raseSuccess("Successfully save Grant user");
     $this->redirect(Router::buildLink("permission", array('view' => 'users')));
 }
Example #18
0
 function storeItem()
 {
     global $mainframe, $user;
     if (!$user->isSuperAdmin()) {
         YiiMessage::raseNotice("Your account not have permission to modify category");
         $this->redirect(Router::buildLink("categories"));
     }
     $cid = Request::getVar("id", 0);
     $obj_item = YiiCategory::getInstance();
     $obj_item = $obj_item->loadItem($cid, "*", false);
     $obj_item->bind($_POST);
     if ($obj_item->id == 0) {
         $obj_item->created_by = $user->id;
     }
     $obj_item->modified_by = $user->id;
     $obj_item->store();
     YiiMessage::raseSuccess("Successfully save Category");
     return $obj_item->id;
 }
Example #19
0
 function getParamView($app_name, $view_name)
 {
     $file_xml = PATH_APPS_FRONT . "/" . $app_name . "/" . $app_name . ".xml";
     if (!file_exists($file_xml)) {
         YiiMessage::raseSuccess("Invalid xml: " . $app_name);
         return null;
     }
     $xml = simplexml_load_file($file_xml);
     $views = array();
     foreach ($xml->views->view as $view) {
         $_view = (string) $view->attributes()->name;
         if ($_view == $view_name) {
             return $view;
         }
     }
 }
 function actionUnpublish()
 {
     $cids = Request::getVar("cid", 0);
     if (count($cids) > 0) {
         foreach ($cids as $cid) {
             $this->changeStatus($cid, 0);
         }
     }
     YiiMessage::raseSuccess("Successfully unpublish Menutype(s)");
     $this->redirect(Router::buildLink('menus', array("view" => "menutype")));
 }