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


PHP Notification::subscribeUser方法代码示例

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


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

示例1: insertNote

 /**
  * Insert note to system, send out notification and log.
  *
  * @param int $usr_id The user ID
  * @param int $issue_id The issue ID
  * @param string $title Title of the note
  * @param string $note Note contents
  * @param array $options extra optional options:
  * - (array) cc: extra recipients to notify (usr_id list)
  * - (bool) add_extra_recipients: whether to add recipients in 'cc' to notification list
  * - (bool) closing: If The issue is being closed. Default false
  * - (bool) is_blocked: FIXME
  * - (bool) log: If adding this note should be logged. Default true
  * - (bool) send_notification: Whether to send a notification about this note or not. Default true
  * - (int) parent_id: FIXME
  * - (string) full_message: FIXME
  * - (string) message_id: FIXME
  * - (string) unknown_user: The email address of a user that sent the blocked email that was turned into this note
  * @return int the new note id if the insert worked, -1 or -2 otherwise
  */
 public static function insertNote($usr_id, $issue_id, $title, $note, $options = array())
 {
     if (Validation::isWhitespace($note)) {
         return -2;
     }
     $options = array_merge(array('unknown_user' => null, 'log' => true, 'closing' => false, 'send_notification' => true, 'is_blocked' => false, 'message_id' => null, 'cc' => null, 'full_message' => null, 'parent_id' => null), $options);
     $prj_id = Issue::getProjectID($issue_id);
     // NOTE: workflow may modify the parameters as $data is passed as reference
     $data = array('title' => &$title, 'note' => &$note, 'options' => $options);
     $workflow = Workflow::preNoteInsert($prj_id, $issue_id, $data);
     if ($workflow !== null) {
         // cancel insert of note
         return $workflow;
     }
     // add the poster to the list of people to be subscribed to the notification list
     // only if there is no 'unknown user' and the note is not blocked
     if (!$options['unknown_user'] && !$options['is_blocked']) {
         $note_cc = $options['add_extra_recipients'] ? $options['cc'] : array();
         // always add the current user to the note_cc list
         $note_cc[] = $usr_id;
         $actions = Notification::getDefaultActions($issue_id, User::getEmail($usr_id), 'note');
         foreach ($note_cc as $subscriber_usr_id) {
             Notification::subscribeUser($usr_id, $issue_id, $subscriber_usr_id, $actions);
         }
     }
     $params = array('not_iss_id' => $issue_id, 'not_usr_id' => $usr_id, 'not_created_date' => Date_Helper::getCurrentDateGMT(), 'not_note' => $note, 'not_title' => $title, 'not_message_id' => $options['message_id'] ?: Mail_Helper::generateMessageID());
     if ($options['full_message']) {
         $params['not_full_message'] = $options['full_message'];
     }
     if ($options['is_blocked']) {
         $params['not_is_blocked'] = '1';
     }
     if ($options['parent_id']) {
         $params['not_parent_id'] = $options['parent_id'];
     }
     if ($options['unknown_user']) {
         $params['not_unknown_user'] = $options['unknown_user'];
     }
     $stmt = 'INSERT INTO
                 {{%note}}
              SET ' . DB_Helper::buildSet($params);
     try {
         DB_Helper::getInstance()->query($stmt, $params);
     } catch (DbException $e) {
         return -1;
     }
     $note_id = DB_Helper::get_last_insert_id();
     Issue::markAsUpdated($issue_id, 'note');
     if ($options['log']) {
         // need to save a history entry for this
         History::add($issue_id, $usr_id, 'note_added', 'Note added by {subject}', array('subject' => User::getFullName($usr_id)));
     }
     // send notifications for the issue being updated
     if ($options['send_notification']) {
         $internal_only = true;
         Notification::notify($issue_id, 'notes', $note_id, $internal_only, $options['cc']);
         Workflow::handleNewNote($prj_id, $issue_id, $usr_id, $options['closing'], $note_id);
     }
     // need to return the new note id here so it can
     // be re-used to associate internal-only attachments
     return $note_id;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:82,代码来源:class.note.php

示例2: setAssignees

 /**
  * Sets the assignees for the issue
  *
  * @param   integer $issue_id
  * @param   array $assignees
  * @return  int 1 if success, -1 if error, 0 if no change was needed.
  */
 public static function setAssignees($issue_id, $assignees)
 {
     if (!is_array($assignees)) {
         $assignees = array();
     }
     // see if there is anything to change
     $old_assignees = self::getAssignedUserIDs($issue_id);
     if (count(array_diff($old_assignees, $assignees)) == 0 && count(array_diff($assignees, $old_assignees)) == 0) {
         return 0;
     }
     $old_assignee_names = self::getAssignedUsers($issue_id);
     Workflow::handleAssignmentChange(self::getProjectID($issue_id), $issue_id, Auth::getUserID(), self::getDetails($issue_id), $assignees, true);
     // clear up the assignments for this issue, and then assign it to the current user
     self::deleteUserAssociations($issue_id);
     $assignee_names = array();
     foreach ($assignees as $assignee) {
         $res = self::addUserAssociation(Auth::getUserID(), $issue_id, $assignee, false);
         if ($res == -1) {
             return -1;
         }
         $assignee_names[] = User::getFullName($assignee);
         Notification::subscribeUser(Auth::getUserID(), $issue_id, $assignee, Notification::getDefaultActions($issue_id, User::getEmail($assignee), 'set_assignees'), false);
     }
     Notification::notifyNewAssignment($assignees, $issue_id);
     $usr_id = Auth::getUserID();
     History::add($issue_id, $usr_id, 'user_associated', 'Issue assignment to changed ({changes}) by {user}', array('changes' => History::formatChanges(implode(', ', $old_assignee_names), implode(', ', $assignee_names)), 'user' => User::getFullName($usr_id)));
     return 1;
 }
开发者ID:dabielkabuto,项目名称:eventum,代码行数:35,代码来源:class.issue.php

示例3: dirname

// | 51 Franklin Street, Suite 330                                          |
// | Boston, MA 02110-1301, USA.                                          |
// +----------------------------------------------------------------------+
// | Authors: João Prado Maia <jpm@mysql.com>                             |
// +----------------------------------------------------------------------+
require_once dirname(__FILE__) . '/../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('self_assign.tpl.html');
Auth::checkAuthentication(APP_COOKIE, 'index.php?err=5', true);
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$issue_id = $_REQUEST['iss_id'];
$tpl->assign('issue_id', $issue_id);
// check if issue is assigned to someone else and if so, confirm change.
$assigned_user_ids = Issue::getAssignedUserIDs($issue_id);
if (count($assigned_user_ids) > 0 && empty($_REQUEST['target'])) {
    $tpl->assign(array('prompt_override' => 1, 'assigned_users' => Issue::getAssignedUsers($issue_id)));
} else {
    $issue_details = Issue::getDetails($issue_id);
    // force assignment change
    if (@$_REQUEST['target'] == 'replace') {
        // remove current user(s) first
        Issue::deleteUserAssociations($issue_id, $usr_id);
    }
    $res = Issue::addUserAssociation($usr_id, $issue_id, $usr_id);
    $tpl->assign('self_assign_result', $res);
    Notification::subscribeUser($usr_id, $issue_id, $usr_id, Notification::getDefaultActions($issue_id, User::getEmail($usr_id), 'self_assign'));
    Workflow::handleAssignmentChange($prj_id, $issue_id, $usr_id, $issue_details, Issue::getAssignedUserIDs($issue_id), false);
}
$tpl->assign('current_user_prefs', Prefs::get($usr_id));
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:self_assign.php

示例4: elseif

    $res = Support::removeEmails();
    $tpl->assign('remove_email_result', $res);
} elseif ($cat == 'clear_duplicate') {
    $res = Issue::clearDuplicateStatus($iss_id);
    $tpl->assign('clear_duplicate_result', $res);
} elseif ($cat == 'delete_phone') {
    $res = Phone_Support::remove($id);
    $tpl->assign('delete_phone_result', $res);
} elseif ($cat == 'new_status') {
    $res = Issue::setStatus($iss_id, $status_id, true);
    if ($res == 1) {
        History::add($iss_id, $usr_id, 'status_changed', "Issue manually set to status '{status}' by {user}", array('status' => Status::getStatusTitle($status_id), 'user' => User::getFullName($usr_id)));
    }
    $tpl->assign('new_status_result', $res);
} elseif ($cat == 'authorize_reply') {
    $res = Authorized_Replier::addUser($iss_id, $usr_id);
    $tpl->assign('authorize_reply_result', $res);
} elseif ($cat == 'remove_quarantine') {
    if (Auth::getCurrentRole() > User::getRoleID('Developer')) {
        $res = Issue::setQuarantine($iss_id, 0);
        $tpl->assign('remove_quarantine_result', $res);
    }
} elseif ($cat == 'selfnotify') {
    if (Issue::canAccess($iss_id, $usr_id)) {
        $res = Notification::subscribeUser($usr_id, $iss_id, $usr_id, Notification::getDefaultActions($iss_id));
        $tpl->assign('selfnotify_result', $res);
    }
}
$tpl->assign('current_user_prefs', Prefs::get($usr_id));
$tpl->assign('cat', $cat);
$tpl->displayTemplate();
开发者ID:korusdipl,项目名称:eventum,代码行数:31,代码来源:popup.php

示例5: insert

 /**
  * Method used to add a note using the user interface form
  * available in the application.
  *
  * @param   integer $usr_id The user ID
  * @param   integer $issue_id The issue ID
  * @param   string  $unknown_user The email address of a user that sent the blocked email that was turned into this note. Default is false.
  * @param   boolean $log If adding this note should be logged. Default true.
  * @param   boolean $closing If The issue is being closed. Default false
  * @param   boolean $send_notification Whether to send a notification about this note or not
  * @access  public
  * @return  integer the new note id if the insert worked, -1 or -2 otherwise
  */
 function insert($usr_id, $issue_id, $unknown_user = FALSE, $log = true, $closing = false, $send_notification = true)
 {
     global $HTTP_POST_VARS;
     $issue_id = Misc::escapeInteger($issue_id);
     if (@$HTTP_POST_VARS['add_extra_recipients'] != 'yes') {
         $note_cc = array();
     } else {
         $note_cc = $HTTP_POST_VARS['note_cc'];
     }
     // add the poster to the list of people to be subscribed to the notification list
     // only if there is no 'unknown user'.
     $note_cc[] = $usr_id;
     if ($unknown_user == false) {
         for ($i = 0; $i < count($note_cc); $i++) {
             Notification::subscribeUser($usr_id, $issue_id, $note_cc[$i], Notification::getDefaultActions());
         }
     }
     if (Validation::isWhitespace($HTTP_POST_VARS["note"])) {
         return -2;
     }
     if (empty($HTTP_POST_VARS['message_id'])) {
         $HTTP_POST_VARS['message_id'] = Mail_API::generateMessageID();
     }
     $stmt = "INSERT INTO\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "note\n                 (\n                    not_iss_id,\n                    not_usr_id,\n                    not_created_date,\n                    not_note,\n                    not_title";
     if (!@empty($HTTP_POST_VARS['blocked_msg'])) {
         $stmt .= ", not_blocked_message";
     }
     $stmt .= ", not_message_id";
     if (!@empty($HTTP_POST_VARS['parent_id'])) {
         $stmt .= ", not_parent_id";
     }
     if ($unknown_user != false) {
         $stmt .= ", not_unknown_user";
     }
     $stmt .= "\n                 ) VALUES (\n                    {$issue_id},\n                    {$usr_id},\n                    '" . Date_API::getCurrentDateGMT() . "',\n                    '" . Misc::escapeString($HTTP_POST_VARS["note"]) . "',\n                    '" . Misc::escapeString($HTTP_POST_VARS["title"]) . "'";
     if (!@empty($HTTP_POST_VARS['blocked_msg'])) {
         $stmt .= ", '" . Misc::escapeString($HTTP_POST_VARS['blocked_msg']) . "'";
     }
     $stmt .= ", '" . Misc::escapeString($HTTP_POST_VARS['message_id']) . "'";
     if (!@empty($HTTP_POST_VARS['parent_id'])) {
         $stmt .= ", " . Misc::escapeInteger($HTTP_POST_VARS['parent_id']) . "";
     }
     if ($unknown_user != false) {
         $stmt .= ", '" . Misc::escapeString($unknown_user) . "'";
     }
     $stmt .= "\n                 )";
     $res = $GLOBALS["db_api"]->dbh->query($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return -1;
     } else {
         $new_note_id = $GLOBALS["db_api"]->get_last_insert_id();
         Issue::markAsUpdated($issue_id, 'note');
         if ($log) {
             // need to save a history entry for this
             History::add($issue_id, $usr_id, History::getTypeID('note_added'), 'Note added by ' . User::getFullName($usr_id));
         }
         // send notifications for the issue being updated
         if ($send_notification) {
             $internal_only = true;
             if (@$HTTP_POST_VARS['add_extra_recipients'] != 'yes' && @count($HTTP_POST_VARS['note_cc']) > 0) {
                 Notification::notify($issue_id, 'notes', $new_note_id, $internal_only, $HTTP_POST_VARS['note_cc']);
             } else {
                 Notification::notify($issue_id, 'notes', $new_note_id, $internal_only);
             }
             Workflow::handleNewNote(Issue::getProjectID($issue_id), $issue_id, $usr_id, $closing);
         }
         // need to return the new note id here so it can
         // be re-used to associate internal-only attachments
         return $new_note_id;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:85,代码来源:class.note.php

示例6: bulkUpdate

 /**
  * Method used to bulk update a list of issues
  *
  * @access  public
  * @return  boolean
  */
 function bulkUpdate()
 {
     global $HTTP_POST_VARS;
     // check if user performing this chance has the proper role
     if (Auth::getCurrentRole() < User::getRoleID('Manager')) {
         return -1;
     }
     $items = Misc::escapeInteger($HTTP_POST_VARS['item']);
     $new_status_id = Misc::escapeInteger($_POST['status']);
     $new_release_id = Misc::escapeInteger($_POST['release']);
     $new_priority_id = Misc::escapeInteger($_POST['priority']);
     $new_category_id = Misc::escapeInteger($_POST['category']);
     $new_project_id = Misc::escapeInteger($_POST['project']);
     for ($i = 0; $i < count($items); $i++) {
         if (!Issue::canAccess($items[$i], Auth::getUserID())) {
             continue;
         } elseif (Issue::getProjectID($HTTP_POST_VARS['item'][$i]) != Auth::getCurrentProject()) {
             // make sure issue is not in another project
             continue;
         }
         $updated_fields = array();
         // update assignment
         if (count(@$HTTP_POST_VARS['users']) > 0) {
             $users = Misc::escapeInteger($HTTP_POST_VARS['users']);
             // get who this issue is currently assigned too
             $stmt = "SELECT\n                            isu_usr_id,\n                            CONCAT(en_firstname,' ', en_lastname) as usr_full_name\n                         FROM\n                            " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,\n                            " . ETEL_USER_TABLE_NOSUB . "\n                         WHERE\n                            isu_usr_id = en_ID AND\n                            isu_iss_id = " . $items[$i];
             $current_assignees = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
             if (PEAR::isError($current_assignees)) {
                 Error_Handler::logError(array($current_assignees->getMessage(), $current_assignees->getDebugInfo()), __FILE__, __LINE__);
                 return -1;
             }
             foreach ($current_assignees as $usr_id => $usr_name) {
                 if (!in_array($usr_id, $users)) {
                     Issue::deleteUserAssociation($items[$i], $usr_id, false);
                 }
             }
             $new_user_names = array();
             $new_assignees = array();
             foreach ($users as $usr_id) {
                 $new_user_names[$usr_id] = User::getFullName($usr_id);
                 // check if the issue is already assigned to this person
                 $stmt = "SELECT\n                                COUNT(*) AS total\n                             FROM\n                                " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user\n                             WHERE\n                                isu_iss_id=" . $items[$i] . " AND\n                                isu_usr_id=" . $usr_id;
                 $total = $GLOBALS["db_api"]->dbh->getOne($stmt);
                 if ($total > 0) {
                     continue;
                 } else {
                     $new_assignees[] = $usr_id;
                     // add the assignment
                     Issue::addUserAssociation(Auth::getUserID(), $items[$i], $usr_id, false);
                     Notification::subscribeUser(Auth::getUserID(), $items[$i], $usr_id, Notification::getAllActions());
                     Workflow::handleAssignment(Auth::getCurrentProject(), $items[$i], Auth::getUserID());
                 }
             }
             Notification::notifyNewAssignment($new_assignees, $items[$i]);
             $updated_fields['Assignment'] = History::formatChanges(join(', ', $current_assignees), join(', ', $new_user_names));
         }
         // update status
         if (!empty($new_status_id)) {
             $old_status_id = Issue::getStatusID($items[$i]);
             $res = Issue::setStatus($items[$i], $new_status_id, false);
             if ($res == 1) {
                 $updated_fields['Status'] = History::formatChanges(Status::getStatusTitle($old_status_id), Status::getStatusTitle($new_status_id));
             }
         }
         // update release
         if (!empty($new_release_id)) {
             $old_release_id = Issue::getRelease($items[$i]);
             $res = Issue::setRelease($items[$i], $new_release_id);
             if ($res == 1) {
                 $updated_fields['Release'] = History::formatChanges(Release::getTitle($old_release_id), Release::getTitle($new_release_id));
             }
         }
         // update priority
         if (!empty($new_priority_id)) {
             $old_priority_id = Issue::getPriority($items[$i]);
             $res = Issue::setPriority($items[$i], $new_priority_id);
             if ($res == 1) {
                 $updated_fields['Priority'] = History::formatChanges(Priority::getTitle($old_priority_id), Priority::getTitle($new_priority_id));
             }
         }
         // update category
         if (!empty($new_category_id)) {
             $old_category_id = Issue::getCategory($items[$i]);
             $res = Issue::setCategory($items[$i], $new_category_id);
             if ($res == 1) {
                 $updated_fields['Category'] = History::formatChanges(Category::getTitle($old_category_id), Category::getTitle($new_category_id));
             }
         }
         // update project
         if (!empty($new_project_id)) {
             $old_project_id = Issue::getProjectID($items[$i]);
             $res = Issue::setProject($items[$i], $new_project_id);
             if ($res == 1) {
                 $updated_fields['Project'] = History::formatChanges(Category::getTitle($old_project_id), Category::getTitle($new_project_id));
//.........这里部分代码省略.........
开发者ID:juliogallardo1326,项目名称:proc,代码行数:101,代码来源:class.issue.php

示例7:

        $info = $GLOBALS["db_api"]->dbh->getOne($stmt);
        if (PEAR::isError($info)) {
            Error_Handler::logError(array($info->getMessage(), $info->getDebugInfo()), __FILE__, __LINE__);
            return false;
        } else {
            $target_usr_id = $info;
            $newstatus = 8;
            $_REQUEST["target"] = "replace";
        }
    }
}
// check if issue is assigned to someone else and if so, confirm change.
$assigned_user_ids = Issue::getAssignedUserIDs($issue_id);
if (count($assigned_user_ids) > 0 && empty($_REQUEST["target"]) && !$_REQUEST['assigntomerc']) {
    $tpl->assign(array("prompt_override" => 1, "assigned_users" => Issue::getAssignedUsers($issue_id)));
} else {
    // force assignment change
    if (@$_REQUEST["target"] == "replace") {
        // remove current user(s) first
        Issue::deleteUserAssociations($issue_id, $usr_id);
    }
    $res = Issue::addUserAssociation($usr_id, $issue_id, $target_usr_id);
    $tpl->assign("self_assign_result", $res);
    if ($newstatus) {
        $res = Issue::setStatus($issue_id, $newstatus, true);
    }
    Notification::subscribeUser($usr_id, $issue_id, $target_usr_id, Notification::getDefaultActions());
    Workflow::handleAssignment($prj_id, $issue_id, $target_usr_id);
}
$tpl->assign("current_user_prefs", Prefs::get($usr_id));
$tpl->displayTemplate();
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:self_assign.php

示例8: subscribeEmail

 /**
  * Method used to add a new subscriber manually, by using the
  * email notification interface.
  *
  * @access  public
  * @param   integer $usr_id The user ID of the person performing this change
  * @param   integer $issue_id The issue ID
  * @param   string $form_email The email address to subscribe
  * @param   array $actions The actions to subcribe to
  * @return  integer 1 if the update worked, -1 otherwise
  */
 function subscribeEmail($usr_id, $issue_id, $form_email, $actions)
 {
     $form_email = strtolower(Mail_API::getEmailAddress($form_email));
     // first check if this is an actual user or just an email address
     $user_emails = User::getAssocEmailList();
     if (in_array($form_email, array_keys($user_emails))) {
         return Notification::subscribeUser($usr_id, $issue_id, $user_emails[$form_email], $actions);
     }
     $issue_id = Misc::escapeInteger($issue_id);
     $email = Misc::escapeString($form_email);
     $prj_id = Issue::getProjectID($issue_id);
     // call workflow to modify actions or cancel adding this user.
     $subscriber_usr_id = false;
     $workflow = Workflow::handleSubscription($prj_id, $issue_id, $subscriber_usr_id, $email, $actions);
     if ($workflow === false) {
         // cancel subscribing the user
         return -2;
     }
     // manual check to prevent duplicates
     if (!empty($email)) {
         $stmt = "SELECT\r\n                        COUNT(sub_id)\r\n                     FROM\r\n                        " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription\r\n                     WHERE\r\n                        sub_iss_id={$issue_id} AND\r\n                        sub_email='{$email}'";
         $total = $GLOBALS["db_api"]->dbh->getOne($stmt);
         if ($total > 0) {
             return -1;
         }
     }
     $stmt = "INSERT INTO\r\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription\r\n                 (\r\n                    sub_iss_id,\r\n                    sub_usr_id,\r\n                    sub_created_date,\r\n                    sub_level,\r\n                    sub_email\r\n                 ) VALUES (\r\n                    {$issue_id},\r\n                    0,\r\n                    '" . Date_API::getCurrentDateGMT() . "',\r\n                    'issue',\r\n                    '{$email}'\r\n                 )";
     $res = $GLOBALS["db_api"]->dbh->query($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return -1;
     } else {
         $sub_id = $GLOBALS["db_api"]->get_last_insert_id();
         for ($i = 0; $i < count($actions); $i++) {
             Notification::addType($sub_id, $actions[$i]);
         }
         // need to mark the issue as updated
         Issue::markAsUpdated($issue_id);
         // need to save a history entry for this
         History::add($issue_id, $usr_id, History::getTypeID('notification_added'), "Notification list entry ('{$email}') added by " . User::getFullName($usr_id));
         return 1;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:54,代码来源:class.notification.php


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