예제 #1
0
 /**
  * поиск персонажа али чара
  */
 public function action_search()
 {
     if (!empty($_POST["typesearch"]) && !empty($_POST["charoracc"])) {
         $type = (int) $_POST["typesearch"];
         if ($type == 1) {
             $charInfo = $this->model->getChar($_POST["charoracc"]);
             if (!empty($charInfo)) {
                 if ($charInfo["ConnectStat"] < 1) {
                     $charInfo["ConnectStat"] = "<b style='color:red'>Offline</b>";
                     $charInfo["ServerName"] .= " " . date_::transDate($charInfo["DisConnectTM"], true);
                 } else {
                     $charInfo["ConnectStat"] = "<b style='color:green'>Online</b>";
                     $charInfo["ServerName"] .= " " . date_::transDate($charInfo["ConnectTM"], true);
                 }
                 $this->view->add_dict($charInfo)->set("classlist", html_::select($this->model->class, 'Class', $charInfo['Class'], "style='width:100px;'"))->out("character", "editchars");
             }
         } else {
             $account = $this->model->getAccIfo($_POST["charoracc"]);
             if (!empty($account["Characters"])) {
                 $chars = "";
                 foreach ($account["Characters"] as $names) {
                     if (!empty($chars)) {
                         $chars .= ", ";
                     }
                     $chars .= "<span style='cursor: pointer;' onclick=\"document.getElementById('charoracc').value='{$names}';document.getElementById('typesearch').selectedIndex = 0;searchObject();\">{$names}</span>";
                 }
                 $account["Characters"] = $chars;
             }
             $this->view->add_dict($account)->out("account", "editchars");
         }
     } else {
         echo " 0o?";
     }
 }
예제 #2
0
 public function getPrize($array)
 {
     $configs = Configs::readCfg("plugin_mmovote", tbuild);
     $q = "";
     $contis = 0;
     $ai = new ArrayIterator($array);
     foreach ($ai as $ar) {
         if (!empty($ar) && isset($ar["vote"]) && isset($ar["acc"]) && isset($ar["date"]) && strlen(trim($ar["acc"])) <= 10) {
             $ar["vote"] = str_replace("\n", "", trim($ar["vote"]));
             $credist = str_replace(array("(votes)", "(account)"), array("{$ar["vote"]}", "'{$ar["acc"]}'"), $configs["mmo_price"]);
             $ar["date"] = date_::intransDate($ar["date"], true);
             $q .= "IF EXISTS (SELECT * FROM [MWC_MMO_TOP] WHERE col_memb_id = '{$ar["acc"]}')\r\nBEGIN\r\n  IF EXISTS (SELECT * FROM [MWC_MMO_TOP] WHERE col_memb_id = '{$ar["acc"]}' AND DATEDIFF(HOUR,col_LastVote,'" . $ar["date"] . "')>=1)\r\n  BEGIN\r\n    UPDATE [MWC_MMO_TOP] SET col_votes = col_votes + {$ar["vote"]},col_LastVote='" . $ar["date"] . "' WHERE col_memb_id = '{$ar["acc"]}';\r\n    INSERT INTO MWC_logs(col_ErrNum,col_msg,col_mname,col_createTime) VALUES(42,'Account {$ar["acc"]} add 1 vote from mmo top','vote',GETDATE());\r\n    {$credist};\r\n  END\r\nEND\r\nELSE\r\nBEGIN\r\n  INSERT INTO [MWC_MMO_TOP] (col_memb_id, col_LastVote,col_votes) VALUES('{$ar["acc"]}','" . $ar["date"] . "',{$ar["vote"]});\r\n  INSERT INTO mwce_settings.dbo.MWC_logs(col_ErrNum,col_msg,col_mname,col_createTime,tbuild) VALUES(15,'Account {$ar["acc"]} add {$ar["vote"]} vote from mmo top ','vote',GETDATE(),'" . tbuild . "');\r\n  {$credist};\r\nEND ";
             $contis++;
             if ($contis > 99) {
                 $this->db->query($q);
                 $q = "";
                 $contis = 0;
             }
         }
     }
     if ($contis > 0) {
         $this->db->query($q);
     }
     $this->db->SQLog("Check mmo top complete... ", "mmovote", 42);
 }
예제 #3
0
 public function action_bglist()
 {
     $allnews = $this->model->getList();
     $iter = new ArrayIterator($allnews);
     foreach ($iter as $news) {
         $news["indate"] = date_::transDate($news["indate"]);
         $this->view->set($news)->out("main_c", get_class($this));
         //сохраняем результат по каждой строке с шаблоном main_c.html с папки anews
     }
 }
예제 #4
0
 public function action_index()
 {
     $this->view->replace("title", "keywords");
     $this->view->replace("title", "description");
     $nar = $this->model->getNewsList($this->configs["cntPerPage"]);
     //выборка новостей
     if (count($nar) > 0) {
         $ai = new ArrayIterator($nar);
         foreach ($ai as $i_ => $values) {
             $values["indate"] = date_::transDate($values["indate"]);
             $values["news"] = Tools::unhtmlentities($values["news"]);
             $this->view->add_dict($values)->out("center", "news");
         }
     }
     $this->view->setFContainer("newscontent", 1)->out("main", "news");
 }
예제 #5
0
 /**
  * контент логов из базы
  */
 public function action_getlist()
 {
     $top = !empty($_POST["topst"]) ? (int) $_POST["topst"] : 100;
     $event = !empty($_POST["eventnum"]) ? (int) $_POST["eventnum"] : NULL;
     $file = !empty($_POST["lilesc"]) && $_POST["lilesc"] != "-1" ? $_POST["lilesc"] : 0;
     $msg = !empty($_POST["inevmsg"]) ? $_POST["inevmsg"] : NULL;
     if (!empty($_POST["dbegin"]) && !empty($_POST["dend"])) {
         $begin = date_::intransDate($_POST["dbegin"]);
         $end = date_::intransDate($_POST["dend"]);
         if ($begin == "-/-" || $end == "-/-") {
             return;
         }
     } else {
         return;
     }
     $logs = $this->model->showLogsArr($top, $event, $file, $begin, $end, $msg);
     $ai = new ArrayIterator($logs);
     foreach ($ai as $id => $val) {
         $val["col_createTime"] = date_::transDate($val["col_createTime"], true);
         $this->view->add_dict($val)->set("id", $id + 1)->out("center", "logs");
     }
 }
예제 #6
0
 /**
  * приведение типов по парамету
  * @param number|string $param
  * @param string $type
  * @return bool|float|int|string
  */
 protected function paramsControl($param, $type)
 {
     switch ($type) {
         case "double":
         case "float":
             $param = floatval($param);
             break;
         case "int":
         case "integer":
             $param = intval($param);
             break;
         case "str":
         case "string":
             $param = htmlspecialchars(self::checkText($param), ENT_QUOTES);
             break;
         case "bool":
         case "boolean":
             $param = boolval($param);
             break;
         case "array":
             break;
         case "date":
             $param = date_::intransDate($param);
             break;
         case "datetime":
             $param = date_::intransDate($param, true);
             break;
         default:
             $param = htmlspecialchars(self::checkText($param), ENT_QUOTES);
             break;
     }
     return $param;
 }