當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Site::Error方法代碼示例

本文整理匯總了PHP中Site::Error方法的典型用法代碼示例。如果您正苦於以下問題:PHP Site::Error方法的具體用法?PHP Site::Error怎麽用?PHP Site::Error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Site的用法示例。


在下文中一共展示了Site::Error方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: SaveFile

 public function SaveFile($name)
 {
     if (move_uploaded_file($_FILES[$this->filename]["tmp_name"], ROOT . 'web/files/' . $name)) {
         Site::Message('Файл Успешно загружен');
     } else {
         Site::Error('Ошибка загрузки файла');
     }
 }
開發者ID:kekstlt,項目名稱:promspace,代碼行數:8,代碼來源:file.php

示例2: EditAction

 public function EditAction()
 {
     $id = intval(Request::GetPart(3));
     $product = ProductModel::GetObj()->where('id = ? AND company_id = ?', [0 => $id, 1 => $this->company->id]);
     if (Request::isposted('name')) {
         $product->name = Request::post('name');
         $product->about = Request::post('about');
         $product->company_id = $this->company->id;
         $file = new File('pic', 7);
         if ($file->isLoaded()) {
             if (!$file->checktype(['jpg', 'jpeg', 'bmp', 'gif', 'png'])) {
                 Site::Error('Неверный тип файла');
             } else {
                 $new_name = $file->getnewname();
                 $file->SaveResizedImage($new_name, 200, 0);
                 $file->SaveResizedImage('s_' . $new_name, 100, 0);
                 //Если файл лого уже существует
                 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);
                     }
                 }
                 $product->pic = $new_name;
             }
         }
         if ($product->name != '') {
             if ($product->id == 0) {
                 Site::Message('Продукция успешно добавлена в каталог');
             } else {
                 Site::Message('Продукция успешно отредактирована');
             }
             $product->save();
             $this->IndexAction();
         } else {
             Site::Message('Наименование продукции обязательно для заполения');
             $this->Render('edit', ['product' => $product, 'company' => $this->company]);
         }
     } else {
         $this->Render('edit', ['product' => $product, 'company' => $this->company]);
     }
 }
開發者ID:kekstlt,項目名稱:promspace,代碼行數:44,代碼來源:ProductController.php

示例3: IndexAction

 public function IndexAction()
 {
     if (User::isLogged()) {
         Site::Message('Вы уже вошли в систему');
         $this->Route();
     } elseif (Request::isPosted('loguser')) {
         User::LoginByPass(Request::post('loguser', '', 'mail'), Request::post('logpass', '', 'safe'));
         if (!User::isLogged()) {
             Site::Error('Неверный логин или пароль');
             $this->Render();
         } else {
             Site::Message('Вы успешно вошли в систему');
             if (!User::admin()) {
                 $this->Route('profile');
             } else {
                 $this->Route();
             }
         }
     } else {
         $this->Render();
     }
 }
開發者ID:kekstlt,項目名稱:promspace,代碼行數:22,代碼來源:LoginController.php

示例4: ConfirmlogoAction

 public function ConfirmlogoAction()
 {
     $company = CompanyModel::GetObj()->id(User::company());
     if ($company->id > 0) {
         $this->render('confirmlogo', ['logo' => $company->logo]);
     } else {
         Site::Error('Непредвиденная ошибка');
         $this->route();
     }
 }
開發者ID:kekstlt,項目名稱:promspace,代碼行數:10,代碼來源:NewcompanyController.php

示例5: SetlogoAction

 public function SetlogoAction()
 {
     $file = new File('logo', 7);
     if ($file->isLoaded()) {
         if (!$file->checktype(['jpg', 'jpeg', 'bmp', 'gif', 'png'])) {
             Site::Error('Неверный тип файла');
             $this->IndexAction();
         } else {
             $new_name = $file->getnewname();
             $file->SaveResizedImage($new_name, 200, 0);
             $file->SaveResizedImage('s_' . $new_name, 100, 0);
             if (file_exists(ROOT . '/web/files/' . $this->company->logo) and $this->company->logo != '') {
                 unlink(ROOT . '/web/files/' . $this->company->logo);
                 unlink(ROOT . '/web/files/s_' . $this->company->logo);
             }
             $this->company->logo = $new_name;
             $this->company->save();
             $this->IndexAction();
         }
     } else {
         Site::Message('Ошибка загрузки файла, попробуйте ещё раз');
         $this->IndexAction();
     }
 }
開發者ID:kekstlt,項目名稱:promspace,代碼行數:24,代碼來源:EditController.php


注:本文中的Site::Error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。