/** * \brief Lê a URLs (em modo re-write) e transforma em variáveis $_GET * * \note Este método não retorna valor */ public static function parse_uri($UriString = NULL) { // $_GET['_rw_'] é definida no .htaccess e contém a url em modo ReWrite if (NULL === $UriString) { $UriString = !empty($_GET['_rw_']) ? $_GET['_rw_'] : ''; //unset($_GET['_rw_']); } // [pt-br] Processa a URI $Segments = array(); self::$segments = array(); //foreach(explode("/", preg_replace("|/*(.+?)/*$|", "\\1", $UriString)) as $val) { preg_match('/^([A-Za-z0-9_.\\-\\/]+)*[&]?/', $UriString, $UriString); if (isset($UriString[1])) { $UriString = $UriString[1]; foreach (explode('/', $UriString) as $val) { $val = trim($val); if ($val != '') { self::$segments[] = $val; } } } if (empty(self::$segments)) { self::$segments[] = 'index'; } //Se suspeita de Big int > 8, Index foreach (self::$segments as $teste => $value) { if (is_numeric($value)) { $value = strlen($value); $valueLTRIM = strlen(ltrim($value, '0')); if ($value > 14 or $valueLTRIM > 16) { Messages::getInstance()->error('URL inválida.'); URI::redirect(URI::build_url(array('.'))); } } } // [pt-br] Guarda os parâmetros passados por GET na URL foreach ($_GET as $key => $value) { if ($key == '_rw_') { continue; } self::$get_params[$key] = $value; unset($_GET[$key]); } //Se suspeita de Big int > 8 , Index foreach (self::$get_params as $teste => $value) { if (is_numeric($value)) { $value = strlen($value); $valueLTRIM = strlen(ltrim($value, '0')); if ($value > 16 or $valueLTRIM > 16) { Messages::getInstance()->error('Parâmetro inválido.'); URI::redirect(URI::build_url(array('.'))); } } } }
public function Delete() { Factory::getUser()->authorise("admin", ResponseRegistery::getInstance()->site_id); try { $this->db->delete("ge_ads", $this->input->getInt("id")); Messages::getInstance()->logSuccess('تبلیغ مورد نظر با موفقیت حذف شد'); } catch (Exception $ex) { Messages::getInstance()->logError('هیچ تبلیغی حذف شد'); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/admin/ads/show"); }
public function saveStatus() { Factory::getUser()->authorise("admin", ResponseRegistery::getInstance()->site_id); fb($this->input->getInt('RequestID')); if ($this->input->getInt('RequestID') != 0) { $data->id = $this->input->getInt('RequestID'); $data->status = $this->input->getString('status'); try { $this->db->StoreObject("sh_requests", $data); Messages::getInstance()->logSuccess('تغییر مورد نظر با موفقیت انجام شد'); } catch (Exception $ex) { Messages::getInstance()->logError('در انجام عملیات خطایی رخ داده است'); } } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/shopRequest/showrequest"); }
public function saveCode() { Factory::getUser()->authorise("template", ResponseRegistery::getInstance()->site_id); $db = Factory::getDBO(); $data->main = $this->input->getString('main'); $data->id = $this->getWebLogTemplateId(); $db->StoreObject("ge_templates", $data); //Messages::getInstance()->logSuccess('قالب با موفقیت ذخیره و اعمال شد'); $msg = Messages::getInstance(); $msg->logSuccess('قالب با موفقیت ذخیره شد'); if ($this->compile($data->main, $data->id)) { $msg->logSuccess('قالب با موفقیت اعمال شد'); } else { $msg->logError('در ساختار قالب خطا وجود دارد لطفا قبل از نمایش وبلاگ این خطاها را بررسی کنید'); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/template/show"); }
function save() { if (Session::getInstance()->Captcha && Session::getInstance()->Captcha == $_POST["captcha"]) { Session::getInstance()->Captcha = null; $ob->article_id = $this->input->getInt('article_id'); $ob->name = $this->input->getString('name'); $ob->email = $this->input->getString('email'); $ob->website = "http://" + $this->input->getString('website'); $ob->content = nl2br($this->input->getString('content')); $ob->private = $this->input->getInt('private'); $ob->ip = $_SERVER['REMOTE_ADDR']; $this->db->StoreObject("wb_comment", $ob); Messages::getInstance()->logSuccess('نظر شما ذخیره شد'); fb($ob); } else { Messages::getInstance()->logError('عکس امنیتی اشتباه است'); } $this->show(); }
public function deleteSubgroup() { Factory::getUser()->authorise("group", ResponseRegistery::getInstance()->site_id); try { $this->db->delete("sh_subgroups", $this->input->getInt('id')); Messages::getInstance()->logSuccess("زیر گروه مورد نظر با موفقیت حذف شد"); } catch (Exception $e) { Messages::getInstance()->logError("هیچ زیر گروهی حذف نشد"); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/shopGroup/showGroups"); }
public function savePassword() { $user = Factory::getUser(); $user->authorise('edituser', Session::getInstance()->weblog_id); $message = Messages::getInstance(); if ($this->input->getString('newpass') == $this->input->getString('newpass2') && $this->input->getString('newpass')) { if ($user->changePassword($this->input->getString('oldpass'), $this->input->getString('newpass'))) { $message->logSuccess('پسورد با موفقیت عوض شد'); } else { $message->logWarning('کلمه عبور قدیمی اشتباه است'); } } else { $message->logWarning('کلمه عبور و تکرار آن برابر نیست'); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . '/user/changePassword'); }
public function delete() { Factory::getUser()->authorise("item", ResponseRegistery::getInstance()->site_id); try { $item_id = $this->input->getInt('id'); $query = "DELETE FROM sh_subgroups_items WHERE item_id = {$item_id}"; $this->db->execute($query); $query = "DELETE FROM sh_images WHERE item_id = {$item_id}"; $this->db->execute($query); $query = "DELETE FROM sh_items WHERE id = {$item_id}"; $this->db->execute($query); // [FIXIT] images file not delete Messages::getInstance()->logSuccess("کالای مورد نظر با موفقیت حذف شد"); } catch (Exception $e) { Messages::getInstance()->logError("هیچ کالایی حذف نشد"); Messages::getInstance()->logError($e); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/shopItem/showItem"); }
public function disban() { Factory::getUser()->authorise("admin", ResponseRegistery::getInstance()->site_id); $site_id = $this->input->getInt('id'); $tmp->id = $site_id; $tmp->active = 1; Factory::getDBO()->StoreObject("ge_sites", $tmp); Messages::getInstance()->logSuccess('سایت مورد نظر با موفقیت فعال شد'); $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/admin/blog/show"); }
public function commentDelete() { Factory::getUser()->authorise("comment", ResponseRegistery::getInstance()->site_id); try { $sql = 'DELETE FROM wb_comment WHERE id=' . $this->input->getInt('id'); //FIXME. ' and weblog_id=' . Session::getInstance()->weblog_id; $this->db->execute($sql); } catch (MySQLException $e) { if ($e->getCode() == 1451) { fb($e); Messages::getInstance()->logWarning('یک یا چند پست با این موضع وجود دارد ابتدا انها را ویرایش کنید'); } else { throw $e; } } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/post/comment"); }
public function staticDelete() { $query = 'DELETE FROM wb_links WHERE weblog_id=' . Session::getInstance()->weblog_id . ' AND id=' . $this->input->getInt("id"); fb($query); try { $this->db->execute($query); Messages::getInstance()->logSuccess('لینک مورد نطر با موفقیت حذف شد'); } catch (Exception $ex) { Messages::getInstance()->logError('هیچ لینکی حذف نشد'); } $this->reponse->redirect(ResponseRegistery::getInstance()->baseURL . "/dashboard/link/staticLinks"); }
public function __construct($messageSystem, $databaseSystem) { $this->messageSystem = Messages::getInstance(); $this->databaseSystem = Database::getInstance(); }