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


PHP Backend::add_comment方法代码示例

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


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

示例1: array

                        SET  resolved_by = ?, time_resolved = ?
                      WHERE  request_id = ?', array($user->id, time(), $request['request_id']));
     }
     Flyspray::logEvent($task['task_id'], 13);
     $_SESSION['SUCCESS'] = L('taskreopenedmsg');
     # FIXME there are several pages using this form, details and pendingreq at least
     #Flyspray::Redirect(CreateURL('details', $task['task_id']));
     break;
     // ##################
     // adding a comment
     // ##################
 // ##################
 // adding a comment
 // ##################
 case 'details.addcomment':
     if (!Backend::add_comment($task, Post::val('comment_text'))) {
         Flyspray::show_error(L('nocommententered'));
         break;
     }
     if (Post::val('notifyme') == '1') {
         // If the user wanted to watch this task for changes
         Backend::add_notification($user->id, $task['task_id']);
     }
     $_SESSION['SUCCESS'] = L('commentaddedmsg');
     Flyspray::Redirect(CreateURL('details', $task['task_id']));
     break;
     // ##################
     // Tracking
     // ##################
 // ##################
 // Tracking
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:modify.inc.php

示例2: edit_task

 /**
  * Edits the task in $task using the parameters in $args
  * @param array $task a task array
  * @param array $args usually $_POST
  * @access public
  * @return array array(STATUS_CODE, msg)
  */
 function edit_task($task, $args)
 {
     global $user, $db, $fs, $proj;
     if ($proj->id != Post::val('project_id', $task['project_id'])) {
         $proj = new Project(Post::val('project_id', $task['project_id']));
     }
     if (!$proj->id) {
         return array(ERROR_INPUT, L('cannotedittaskglobally'));
     }
     if (!$user->can_edit_task($task) && !$user->can_correct_task($task)) {
         return array(ERROR_PERMS);
     }
     // check missing fields
     if (!array_get($args, 'item_summary') || !array_get($args, 'detailed_desc')) {
         return array(ERROR_RECOVER, L('summaryanddetails'));
     }
     foreach ($proj->fields as $field) {
         if ($field->prefs['value_required'] && !array_get($args, 'field' . $field->id) && !($field->prefs['force_default'] && !$user->perms('modify_all_tasks'))) {
             return array(ERROR_RECOVER, L('missingrequired') . ' (' . $field->prefs['field_name'] . ')');
         }
     }
     $time = time();
     $plugins = trim(implode(' ', array_get($args, 'detailed_desc_syntax_plugins', array())));
     if (!$plugins) {
         $plugins = $proj->prefs['syntax_plugins'];
     }
     $db->x->autoExecute('{tasks}', array('project_id' => $proj->id, 'item_summary' => array_get($args, 'item_summary'), 'detailed_desc' => array_get($args, 'detailed_desc'), 'mark_private' => intval($user->can_change_private($task) && array_get($args, 'mark_private')), 'last_edited_by' => intval($user->id), 'last_edited_time' => $time, 'syntax_plugins' => $plugins, 'percent_complete' => array_get($args, 'percent_complete')), MDB2_AUTOQUERY_UPDATE, sprintf('task_id = %d', $task['task_id']));
     // Now the custom fields
     foreach ($proj->fields as $field) {
         $field_value = $field->read(array_get($args, 'field' . $field->id));
         $fields = array('field_id' => array('value' => $field->id, 'key' => true), 'task_id' => array('value' => $task['task_id'], 'key' => true), 'field_value' => array('value' => $field_value));
         $db->Replace('{field_values}', $fields);
     }
     // [RED] Update last changed date and user
     $db->x->execParam('UPDATE {redundant} SET last_changed_time = ?,
                               last_changed_by_real_name = ?, last_changed_by_user_name = ?,
                               last_edited_by_real_name = ?, last_edited_by_user_name = ?
                         WHERE task_id = ?', array($time, $user->infos['real_name'], $user->infos['user_name'], $user->infos['real_name'], $user->infos['user_name'], $task['task_id']));
     // Prepare assignee list
     $assignees = explode(';', trim(array_get($args, 'assigned_to')));
     $assignees = array_map(array('Flyspray', 'UserNameToId'), $assignees);
     $assignees = array_filter($assignees, create_function('$x', 'return ($x > 0);'));
     // Update the list of users assigned this task, if changed
     if ($user->perms('edit_assignments') && count(array_diff($task['assigned_to'], $assignees)) + count(array_diff($assignees, $task['assigned_to']))) {
         // Delete the current assignees for this task
         $db->x->execParam('DELETE FROM {assigned}
                             WHERE task_id = ?', $task['task_id']);
         // Store them in the 'assigned' table
         foreach ($assignees as $val) {
             $fields = array('user_id' => array('value' => $val, 'key' => true), 'task_id' => array('value' => $task['task_id'], 'key' => true));
             $db->Replace('{assigned}', $fields);
         }
         // Log to task history
         Flyspray::logEvent($task['task_id'], 14, implode(' ', $assignees), implode(' ', $task['assigned_to']), '', $time);
         // Notify the new assignees what happened.  This obviously won't happen if the task is now assigned to no-one.
         if (count($assignees)) {
             $new_assignees = array_diff($assignees, $task['assigned_to']);
             // Remove current user from notification list
             if (!$user->infos['notify_own']) {
                 $new_assignees = array_filter($new_assignees, create_function('$u', 'global $user; return $user->id != $u;'));
             }
             if (count($new_assignees)) {
                 Notifications::send($new_assignees, ADDRESS_USER, NOTIFY_NEW_ASSIGNEE, array('task_id' => $task['task_id']));
             }
         }
     }
     // Get the details of the task we just updated
     // To generate the changed-task message
     $new_details_full = Flyspray::GetTaskDetails($task['task_id']);
     $changes = Flyspray::compare_tasks($task, $new_details_full);
     foreach ($changes as $change) {
         if ($change[4] == 'assigned_to_name') {
             continue;
         }
         Flyspray::logEvent($task['task_id'], 3, $change[6], $change[5], $change[4], $time);
     }
     if (count($changes) > 0) {
         Notifications::send($task['task_id'], ADDRESS_TASK, NOTIFY_TASK_CHANGED, array('changes' => $changes));
     }
     Backend::add_comment($task, array_get($args, 'comment_text'), $time);
     Backend::delete_files(array_get($args, 'delete_att'));
     Backend::upload_files($task['task_id'], '0', 'usertaskfile');
     return array(SUBMIT_OK, L('taskupdated'));
 }
开发者ID:negram,项目名称:flyspray,代码行数:91,代码来源:class.backend.php

示例3: sleep

        $this->msql->Insert("comm", $obj);
        sleep(2);
        header("Location: index.php");
    }
}
$obj = new Backend();
$user_name = $_COOKIE["username"];
$res_arr = $obj->get_comment($user_name);
$users_online = $obj->get_user_online();
if (isset($_POST["hide_add_comm"])) {
    $name = $_POST["hide_name"];
    if ($_POST["hide_recipient"] == "") {
        $recipient = $_POST["hide_user"];
    } else {
        $recipient = $_POST["hide_recipient"];
    }
    $status = $_POST["hide_type"];
    $comment = $_POST["hide_comment"];
    $comment = trim($comment);
    $comment = mysql_real_escape_string($comment);
    $comment = strip_tags($comment);
    $obj->add_comment($name, $recipient, $comment, $status);
}
if (isset($_POST["hide-publick"])) {
    $users = $obj->get_user();
    $comment_type = "public";
}
if (isset($_POST["hide-private"])) {
    $users = $obj->get_user_online();
    $comment_type = "private";
}
开发者ID:vortex52,项目名称:chat,代码行数:31,代码来源:backend.php

示例4: time

    $project = $task['project_id'];
    $added = time() - rand(1, 315360000);
    // Find someone who is allowed to add comment, do not use global groups
    $sqltext = "SELECT uig.user_id\n                         FROM {users_in_groups} uig\n                         JOIN {groups} g ON g.group_id = uig.group_id AND g.add_comments = 1\n                          AND (g.project_id = 0 OR g.project_id = ?)\n                        WHERE g.group_id NOT IN (1, 2, 7, 8, 9)\n                     ORDER BY {$RANDOP} ";
    $sql = $db->Query($sqltext, array($project));
    $row = $db->FetchRow($sql);
    $reporter = new User($row['user_id']);
    // User might still not be able to add a comment, if he can not see the task...
    // Just try again until a suitable one comes out from the query. It will finally.
    // Try to enhance the query also to return fewer unsuitable ones.
    while (!$reporter->can_view_task($task)) {
        $row = $db->FetchRow($sql);
        $reporter = new User($row['user_id']);
    }
    $comment = 'Comment.';
    Backend::add_comment($task, $comment);
    $sql = $db->Query('SELECT MAX(comment_id) FROM {comments}');
    $comment_id = $db->FetchOne($sql);
    $db->Query('UPDATE {comments} SET user_id = ?, date_added = ? WHERE comment_id = ?', array($reporter->id, $added, $comment_id));
}
// And 5000000 attachments total, either to task or comment
for ($i = 1; $i <= $maxattachments; $i++) {
    $sql = $db->Query("SELECT comment_id, task_id, user_id, date_added FROM {comments} ORDER BY {$RANDOP} LIMIT 1");
    list($comment_id, $task_id, $user_id, $date_added) = $db->FetchRow($sql);
    $fname = "Attachment {$i}";
    if (rand(1, 100) == 1) {
        $comment_id = 0;
    }
    $origname = GetAttachmentDescription() . " {$i}";
    $db->Query("INSERT INTO  {attachments}\n                                     ( task_id, comment_id, file_name,\n                                       file_type, file_size, orig_name,\n                                       added_by, date_added)\n                             VALUES  (?, ?, ?, ?, ?, ?, ?, ?)", array($task_id, $comment_id, $fname, 'application/octet-stream', 1024, $origname, $user_id, $date_added));
}
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:CreateTestData.php

示例5: createTestData


//.........这里部分代码省略.........
        $pdlimit = $pdlimit < 1 ? 1 : $pdlimit;
        $sql = $db->Query("SELECT user_id FROM {users_in_groups} WHERE group_id in (7, 8, 9) ORDER BY {$RANDOP} limit {$pmlimit}");
        $pms = $db->fetchCol($sql);
        $sql = $db->Query("SELECT user_id FROM {users_in_groups} WHERE group_id in (8, 9) ORDER BY {$RANDOP} limit {$pdlimit}");
        $pds = $db->fetchCol($sql);
        foreach ($pms as $pm) {
            $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) values (?, ?)', array($pm, $pmgroup));
        }
        foreach ($pds as $pd) {
            $check = $db->Query('SELECT * FROM {users_in_groups} WHERE user_id = ? AND group_id = ?', array($pd, $pmgroup));
            if (!$db->CountRows($check)) {
                $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) values (?, ?)', array($pd, $pdgroup));
            }
        }
    }
    // Create corporate users.
    for ($i = 1; $i <= $maxcorporateusers; $i++) {
        $user_name = "cu{$i}";
        $real_name = "Corporate user {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
        $email = null;
        // $user_name . '@example.com';
        $group = 10;
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
    }
    // Now, create corporate user groups for some of our projects.
    // Just %5 change of getting added.
    for ($i = 1; $i <= $maxcorporates; $i++) {
        for ($j = 1; $j <= $maxproducts; $j++) {
            if (rand(1, 20) == 1) {
                $projid = $j + 1;
                $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,add_comments,create_attachments,group_open,view_comments) " . "VALUES('Corporate {$i}', 'Corporate {$i} Users', {$projid}, 0, 0, 1, 1, 1, 1, 1,1,1)");
                $sql = $db->Query('SELECT MAX(group_id) FROM {groups}');
                $group_id = $db->FetchOne($sql);
                // Then, add users
                for ($k = $i; $k <= $maxcorporateusers; $k += $maxcorporates) {
                    $username = "cu{$k}";
                    $sql = $db->Query('SELECT user_id FROM {users} WHERE user_name = ?', array($username));
                    $user_id = $db->FetchOne($sql);
                    $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) VALUES (?, ?)', array($user_id, $group_id));
                }
            }
        }
    }
    // And also those individual users...
    for ($i = 1; $i <= $maxindividualusers; $i++) {
        $user_name = "iu{$i}";
        $real_name = "Individual user {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
        $email = null;
        // $user_name . '@example.com';
        $group = rand(11, 12);
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
    }
    // That's why we need some more global groups with different viewing rights
    // And 100 users just viewing our progress
    for ($i = 1; $i <= $maxindividualusers; $i++) {
        $user_name = "basic{$i}";
        $real_name = "Basic {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
开发者ID:krayon,项目名称:flyspray,代码行数:67,代码来源:CreateTestData.php

示例6: action_addcomment

 function action_addcomment($task)
 {
     global $user, $db, $fs, $proj;
     if (!Backend::add_comment($task, Post::val('comment_text'), null, Post::val('comment_text_syntax_plugins'))) {
         return array(ERROR_RECOVER, L('nocommententered'));
     }
     if (Post::val('notifyme') == '1') {
         // If the user wanted to watch this task for changes
         Backend::add_notification($user->id, $task['task_id']);
     }
     return array(SUBMIT_OK, L('commentaddedmsg'));
 }
开发者ID:negram,项目名称:flyspray,代码行数:12,代码来源:details.php

示例7: createTestData


//.........这里部分代码省略.........
        $pdlimit = $pdlimit < 1 ? 1 : $pdlimit;
        $sql = $db->Query("SELECT user_id FROM {users_in_groups} WHERE group_id in (7, 8, 9) ORDER BY {$RANDOP} limit {$pmlimit}");
        $pms = $db->fetchCol($sql);
        $sql = $db->Query("SELECT user_id FROM {users_in_groups} WHERE group_id in (8, 9) ORDER BY {$RANDOP} limit {$pdlimit}");
        $pds = $db->fetchCol($sql);
        foreach ($pms as $pm) {
            $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) values (?, ?)', array($pm, $pmgroup));
        }
        foreach ($pds as $pd) {
            $check = $db->Query('SELECT * FROM {users_in_groups} WHERE user_id = ? AND group_id = ?', array($pd, $pmgroup));
            if (!$db->CountRows($check)) {
                $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) values (?, ?)', array($pd, $pdgroup));
            }
        }
    }
    // Create corporate users.
    for ($i = 1; $i <= $maxcorporateusers; $i++) {
        $user_name = "cu{$i}";
        $real_name = "Corporate user {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
        $email = $email = null;
        $user_name . '@foo.bar.baz.org';
        $group = 10;
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
    }
    // Now, create corporate user groups for some of our projects.
    // Just %5 change of getting added.
    for ($i = 1; $i <= $maxcorporates; $i++) {
        for ($j = 1; $j <= $maxproducts; $j++) {
            if (rand(1, 20) == 1) {
                $projid = $j + 1;
                $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,add_comments,create_attachments,group_open,view_comments) " . "VALUES('Corporate {$i}', 'Corporate {$i} Users', {$projid}, 0, 0, 1, 1, 1, 1, 1,1,1)");
                $sql = $db->Query('SELECT MAX(group_id) FROM {groups}');
                $group_id = $db->FetchOne($sql);
                // Then, add users
                for ($k = $i; $k <= $maxcorporateusers; $k += $maxcorporates) {
                    $username = "cu{$k}";
                    $sql = $db->Query('SELECT user_id FROM {users} WHERE user_name = ?', array($username));
                    $user_id = $db->FetchOne($sql);
                    $db->Query('INSERT INTO {users_in_groups} (user_id, group_id) VALUES (?, ?)', array($user_id, $group_id));
                }
            }
        }
    }
    // And also those individual users...
    for ($i = 1; $i <= $maxindividualusers; $i++) {
        $user_name = "iu{$i}";
        $real_name = "Individual user {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
        $email = $email = null;
        $user_name . '@foo.bar.baz.org';
        $group = rand(11, 12);
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
    }
    // That's why we need some more global groups with different viewing rights
    // And 100000 users just viewing our progress
    for ($i = 1; $i <= $maxindividualusers; $i++) {
        $user_name = "basic{$i}";
        $real_name = "Basic {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
开发者ID:canneverbe,项目名称:flyspray,代码行数:67,代码来源:CreateTestData.php


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