function start() { if (file_exists(ROOT . 'views/SiteController/' . Request::GetPart(0) . '.php')) { $this->Render(Request::GetPart(0)); } else { $this->Route(Request::GetPart(1, 'profile')); } }
public function DeleteAction() { $id = intval(Request::GetPart(3)); $contact = ContactsModel::GetObj()->where('id = ? AND company_id = ?', [0 => $id, 1 => $this->company->id]); if ($contact->id > 0) { ContactsModel::delete()->id($contact->id); } Site::Message('Контакт успешно удалён'); $this->route('profile'); }
public function NewrateAction() { $id = Request::GetPart(2, 0); $rate = intval(Request::post('rate', 0)); if ($id > 0) { $company = CompanyModel::GetObj()->id($id); $company->rate = $rate; $company->save(); Site::Message('Рейтинг компании ' . $company->name . ' успешно изменён'); $this->route(); } }
public function TagAction() { $this->page = intval(Request::GetPart(3, 1)); if ($this->page == 0) { $this->page = 1; } $tag = trim(Request::GetPart(2, '')); if ($tag != '') { $this->page_link_prefix = 'tag/' . $tag . '/'; $companys = $this->tag($tag); $this->ShowList($companys, SQL::Total()); } else { Site::Message('Ошибка поиска по тегу'); $this->IndexAction(); } }
public function DeleteAction() { $id = intval(Request::GetPart(3)); $product = ProductModel::GetObj()->where('id = ? AND company_id = ?', [0 => $id, 1 => $this->company->id]); if ($product->id > 0) { ProductModel::delete()->id($product->id); } if ($product->pic != '') { if (file_exists(ROOT . '/web/files/' . $product->pic)) { unlink(ROOT . '/web/files/' . $product->pic); } if (file_exists(ROOT . '/web/files/s_' . $product->pic)) { unlink(ROOT . '/web/files/s_' . $product->pic); } } Site::Message('Продукт успешно удалён'); $this->route('profile'); }
public function start() { $id = intval(Request::GetPart(0, User::company())); if ($id == 0) { $id = User::company(); } $this->company = CompanyModel::GetObj()->id($id); if ($this->company->id == 0) { Site::Message('Профиль не найден'); $this->Route(); } elseif ($this->company->id != User::company() and !User::admin()) { Site::Message('У Вас недостаточно прав для редактирования данного профиля'); $this->Route(); } else { switch (Request::GetPart(2, '')) { case 'adress': $this->AdressAction(); break; case 'region': $this->RegionAction(); break; case 'setregion': $this->SetregionAction(); break; case 'group': $this->GroupAction(); break; case 'setgroup': $this->SetgroupAction(); break; case 'newgroup': $this->NewgroupAction(); break; case 'setlogo': $this->SetLogoAction(); break; default: break; } } }
public function start() { $id = intval(Request::GetPart(0, User::company())); if ($id == 0) { $id = User::company(); } $this->company = CompanyModel::GetObj()->id($id); if (User::admin() and $this->company->id == 0) { $this->Route(); } elseif ($id == 0 and User::isLogged()) { Site::Message('Похоже Вы не завершили регистрацию своего профиля, вы можете продолжить её тут:'); $this->route('newcompany'); } elseif ($this->company->id == 0) { Site::Message('Профиль не найден'); $this->Route(); } else { $this->company->about = nl2br($this->company->about); if (Request::GetPart(2, '') == 'favorite') { $this->FavoriteSet($id); } } }
<?php #---Define-- mb_internal_encoding("UTF-8"); define('ROOT', dirname(__FILE__) . '/../'); #Default Page define('default_page', 'main'); #Admin_login define('admin_login', '*****@*****.**'); #Автозагрузчики include ROOT . 'classes/_autoload.php'; include ROOT . 'models/_autoload.php'; include ROOT . 'controllers/_autoload.php'; #Подключение библиотеки SQL SQL::connect(include ROOT . 'config/db.php'); #User Init User::LoginByCookie(Request::cookie('userid', '')); #QueryStringload Request::Load(); #WebSite Init $controller = mb_strtolower(Request::GetPart(0, default_page)); $action = Request::GetPart(1, 'index'); //if (!User::isLogged()) $controller = 'login'; #Загрузка шаблонизатора Site::$home = 'http://localhost/promspace/'; Site::$template = 'main'; Site::$title = 'PromSpace - Вся промышленность России'; Site::$keywords = 'Вся промышленность России, Предприятия России, Компании России'; Site::Show($controller, $action);
<?php $page = Request::GetPart(0, default_page); foreach ($arr as $key => $value) { $add = ''; if ($value == mb_strtolower($page)) { $add = ' id="selected"'; } echo '<a href="' . Site::link($value) . '"' . $add . '>' . $key . '</a>' . "\n"; }