当前位置: 首页>>代码示例>>PHP>>正文


PHP Error::ToString方法代码示例

本文整理汇总了PHP中Error::ToString方法的典型用法代码示例。如果您正苦于以下问题:PHP Error::ToString方法的具体用法?PHP Error::ToString怎么用?PHP Error::ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Error的用法示例。


在下文中一共展示了Error::ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ToString

 public static function ToString($err)
 {
     if (is_a($err, 'Error')) {
         return Error::ToString($err->id) . ': ' . $err->mesg;
     }
     switch ($err) {
         case self::no_translation:
             return Language::Word('no translation');
         case self::db_error:
             return Language::Word('internal database error');
         case self::arg_not_valid:
             return Language::Word('argument not valid');
         case self::ambiguously:
             return Language::Word('ambigiously');
         case self::not_found:
             return Language::Word('not found');
         case self::error:
             return Language::Word('error');
     }
 }
开发者ID:Gerold103,项目名称:lgmis,代码行数:20,代码来源:error.php

示例2: clear_tmp_images_dir

 clear_tmp_images_dir(Report::$type, $id);
 clear_tmp_files_dir(Report::$type, $id);
 $head_addition .= '<script type="text/javascript" src="js/files_upload.js"></script>';
 $ob_id = $_POST['id'];
 $ob = Report::FetchBy(['eq_conds' => ['id' => $ob_id], 'is_unique' => true]);
 $receivers = User::FetchBy(['select_list' => 'id, name, surname', 'where_addition' => '(received_reports LIKE ("%\\"' . $ob_id . '\\"%"))']);
 $users = '';
 foreach ($receivers as $key => $user) {
     $users .= '<div class="row">';
     $users .= '<div class="' . ColAllTypes(12) . '">';
     $users .= $user->LinkToThis();
     $users .= '</div>';
     $users .= '</div>';
 }
 if (Error::IsError($ob)) {
     $content = AlertMessage('alert-danger', 'Error occured during fetching: ' . Error::ToString($ob));
 } else {
     $path_to_file = $ob->GetPathToFile();
     $author_id = GetUserID();
     $head_addition .= MakeScript('files_type = "' . Report::$type . '"; files_action = "edit"; owner_id = ' . $ob->GetID() . '; max_files = 1; author_id = ' . $author_id . ';');
     $content .= '<form method="post" action="' . $link_to_utility_sql_worker . '" enctype="multipart/form-data">';
     $content .= PairLabelAndPanel(4, 5, Language::Word('current receivers'), $users);
     $content .= '<div class="row">';
     $content .= '<div class="' . ColAllTypes(4) . ' vcenter" align="right">';
     $content .= '<b>' . Language::Word('change receivers') . '</b>';
     $content .= '</div>';
     $content .= '<div class="' . ColAllTypes(5) . ' vcenter" align="center">';
     $content .= '<div class="dropdown">';
     $content .= '<input onkeyup="showUsers(this);" placeholder="' . Language::Word('start to insert name') . '" class="form-control margin-sm dropdown-toggle" type="text" id="recipient_input" name="recipient_input" aria-haspopup="true" value="">';
     $content .= '<ul class="dropdown-menu" id="users_list">';
     $content .= '</ul>';
开发者ID:Gerold103,项目名称:lgmis,代码行数:31,代码来源:admin_report.php

示例3: InsertToDB

 public static function InsertToDB($request)
 {
     global $db_connection;
     global $link_to_report_images;
     global $link_to_report_files;
     $author_id = $db_connection->real_escape_string($request->author_id);
     $name = $db_connection->real_escape_string($request->name);
     $res = $db_connection->query("INSERT INTO `" . self::$table . "` (`author_id`, `name`) VALUES ('" . $author_id . "', '" . $name . "')");
     if (!$res) {
         echo $db_connection->error;
         return false;
     }
     $id = $db_connection->insert_id;
     $request->text_block = preg_replace('/tmp_(\\d+)\\//', $id . '/', $request->text_block);
     $text_block = $db_connection->real_escape_string($request->text_block);
     $res = $db_connection->query("UPDATE `" . self::$table . "` SET `text_block`=\"" . $text_block . "\" WHERE `id`=" . $id);
     if (!$res) {
         echo $db_connection->error;
         $db_connection->query("DELETE FROM `" . self::$table . "` WHERE `id` = " . $id);
         return false;
     }
     $request->id = $id;
     $upload_path = '';
     recurse_copy($link_to_report_images . 'tmp_' . GetUserID(), $link_to_report_images . $id);
     recurse_copy($link_to_report_files . 'tmp_' . GetUserID(), $link_to_report_files . $id);
     $receiver_emails = [];
     foreach ($request->recipient_ids as $key => $aim) {
         $received = User::FetchBy(['select_list' => 'received_reports, email', 'is_unique' => true, 'eq_conds' => ['id' => $aim]]);
         if (Error::IsError($received)) {
             echo Error::ToString($received);
             return false;
         }
         $tmp = $received->GetReceivedReports();
         array_push($tmp, $id . '');
         $rc = $db_connection->query("UPDATE users SET received_reports = '" . $db_connection->real_escape_string(json_encode($tmp)) . "' WHERE id = " . $aim);
         if (!$rc) {
             echo $db_connection->error;
             return false;
         }
         array_push($receiver_emails, $received->GetEmail());
     }
     $sended = User::FetchBy(['select_list' => 'sended_reports', 'is_unique' => true, 'eq_conds' => ['id' => $request->GetAuthorID()]]);
     if (Error::IsError($sended)) {
         echo Error::ToString($sended);
         return false;
     }
     $tmp = $sended->GetSendedReports();
     array_push($tmp, $id . '');
     $rc = $db_connection->query("UPDATE users SET sended_reports = '" . $db_connection->real_escape_string(json_encode($tmp)) . "' WHERE id = " . $request->GetAuthorID());
     if (!$rc) {
         echo $db_connection->error;
         return false;
     }
     $receiver_emails = array_unique($receiver_emails);
     foreach ($receiver_emails as $key => $email) {
         $subject = 'New report on lgmis.cs.msu.ru';
         $message = '<html>';
         $message .= '<head><title>New report from on your name</title></head>';
         $message .= '<body>';
         $message .= '<table width="100%" align="center">';
         $message .= '<tr><td>You can see more information about this report: <a href="' . $request->ToHTMLFullVersLite() . '">go on site</a></td></tr>';
         $message .= '</table>';
         $message .= '</body>';
         $message .= '</html>';
         $headers = 'From: LGMIS Admin <no-reply@lgmis.cs.msu.ru>' . PHP_EOL . 'Reply-To: <no-reply@lgmis.cs.msu.ru>' . PHP_EOL . 'X-Mailer: PHP/' . phpversion() . 'MIME-Version: 1.0' . PHP_EOL . 'Content-type: text/html; charset=UTF-8' . PHP_EOL;
         if (!mail($email, $subject, $message, $headers, '-f no-reply@lgmis.cs.msu.ru')) {
             echo 'error:' . error_get_last();
             return false;
         }
     }
     return true;
 }
开发者ID:Gerold103,项目名称:lgmis,代码行数:72,代码来源:report.php

示例4: array

                $content .= 'allowedContent: true, });';
                $content .= 'CKEDITOR.config.height = 400;';
                $content .= '</script>';
                $content .= '<div class="row">';
                $content .= '<input type="submit" class="btn btn-primary btn-lg" name="add" value="' . Language::Word('save') . '">';
                $content .= '</div>';
                $content .= '</form>';
                $title = Language::Word('language adding');
                $header = $title;
            }
        } else {
            if (!isset($_REQUEST['id'])) {
                echo 'user id is unset';
                exit;
            }
            $ob_id = $_REQUEST['id'];
            $ob = Article::FetchBy(['eq_conds' => array('id' => $ob_id), 'is_unique' => true]);
            if (Error::IsError($ob)) {
                $content = AlertMessage('alert-danger', Error::ToString($ob));
            } else {
                $title = '';
                $header = '';
                $content = '';
                $title = Language::Word('article');
                $header = htmlspecialchars($ob->GetName());
                $content = $ob->ToHTMLAutoFull(GetUserPrivileges());
            }
        }
    }
}
include_once $link_to_admin_template;
开发者ID:Gerold103,项目名称:lgmis,代码行数:31,代码来源:admin_article.php

示例5: AlertMessage

             $content .= AlertMessage('alert-warning', Language::Word('cover was not uploaded'));
         }
     }
     break;
 case Report::$type:
     $ob = Report::FetchBy(['eq_conds' => ['id' => $_POST['id']], 'is_unique' => true]);
     if (Error::IsError($ob)) {
         $content .= AlertMessage('alert-danger', 'Error while receiving user: ' . Error::ToString($ob));
         break;
     }
     $assoc = $_POST;
     $assoc['recipient_ids'] = urldecode($assoc['recipient_ids']);
     $ob->FetchFromAssocEditing($assoc);
     $tmp = $ob->Save();
     if (Error::IsError($tmp)) {
         $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save') . ':error: ' . Error::ToString($tmp));
     } else {
         $content .= AlertMessage('alert-success', Language::Word('changes are saved'));
     }
     break;
 case Direction::$type:
     $direction = Direction::FetchByID($_POST['id']);
     if ($direction === NULL) {
         break;
     }
     $direction->FetchFromAssocEditing($_POST);
     if ($direction->Save() === false) {
         $content .= AlertMessage('alert-danger', Language::Word('it was not succeeded to save'));
     } else {
         $content .= AlertMessage('alert-success', Language::Word('changes are saved'));
         if ($direction->FetchCoverFromAssocEditing($_FILES) < 0) {
开发者ID:Gerold103,项目名称:lgmis,代码行数:31,代码来源:utility_sql_worker.php

示例6: GetIDByLogin

 public static function GetIDByLogin($login)
 {
     $user = self::FetchBy(['select_list' => 'id', 'eq_conds' => ['login' => $login], 'is_unique' => true]);
     if (Error::IsError($user)) {
         echo Error::ToString($user);
         return NULL;
     }
     return $user->id;
 }
开发者ID:Gerold103,项目名称:lgmis,代码行数:9,代码来源:user.php

示例7: AlertMessage

<?php

require_once 'utility_lgmis_lib.php';
require_once $link_to_utility_authorization;
if (isset($_POST['id']) && isset($_GET['id']) && $_POST['id'] !== $_GET['id']) {
    $content = AlertMessage('alert-danger', 'Неоднозначные id');
} else {
    $user = User::FetchBy(['eq_conds' => ['id' => $_REQUEST['id']], 'is_unique' => true]);
    if (Error::IsError($user)) {
        echo Error::ToString($user);
        exit;
    }
    $prev_page = '';
    if (isset($_REQUEST['edit'])) {
        $title = Language::Word('profile edit');
        $header = $title;
        $content = $user->ToHTMLEditing();
    } else {
        $title = $user->GetName();
        $header = htmlspecialchars(Language::Translit($user->GetName() . ' ' . $user->GetSurname() . ' ' . $user->GetFathername()));
        $content = $user->ToHTMLAutoFull(GetUserPrivileges());
        $no_content_center = true;
    }
}
require_once $link_to_admin_template;
开发者ID:Gerold103,项目名称:lgmis,代码行数:25,代码来源:admin_user.php

示例8: json_encode

                         $is_error = true;
                         $content = json_encode(['error' => 'File with name ' . $name . ' already exists']);
                         break;
                     }
                 }
                 if ($is_error) {
                     break;
                 }
                 $new_dir_it->next();
             }
             if ($is_error) {
                 break;
             }
             for ($i = 0; $i < $size; ++$i) {
                 if ($rc = Error::IsError(MyFile::InsertToDB($myfiles[$i]))) {
                     $content = json_encode(['error' => Error::ToString($rc)]);
                     $is_error = true;
                     break;
                 }
             }
             if ($is_error) {
                 break;
             }
             simple_copy($dir, $new_dir);
             clear_tmp_files_dir(MyFile::$type, 0);
             $content = json_encode(['ok' => true]);
             break;
         default:
             break;
     }
 }
开发者ID:Gerold103,项目名称:lgmis,代码行数:31,代码来源:admin_ajax_interceptor.php


注:本文中的Error::ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。