Example #1
0
function create_user_photos($user_id)
{
    foreach (range(0, 10) as $i) {
        $p = Photo::_create(array('user_id' => $user_id, 'title' => 'title' . $i));
        create_comment($p->id);
    }
}
Example #2
0
function render_page($params)
{
    if (sizeof($params) > 0 && $_POST['commenting'] == 'true') {
        create_comment(Entry::find_by_name(urldecode($params[0])), $_POST);
    } else {
        if (sizeof($params) > 0) {
            render_entry(Entry::find_by_name(urldecode($params[0])));
        } else {
            echo '<ul id="entries">';
            foreach (Entry::find_all() as $entry) {
                render_summary($entry);
            }
            echo '</ul>';
        }
    }
}
Example #3
0
{
    return array("comment_id" => 0, "bug_id" => "@bug_id", "who" => $name, "bug_when" => $time, "work_time" => 0, "thetext" => $body, "isprivate" => 0, "already_wrapped" => 0, "type" => 0);
}
//------------------------------------------------------------
// Script Starts Here
//------------------------------------------------------------
if (count($argv) < 2) {
    echo "Usage: php {$argv[0]} file\n";
    exit;
}
$bugs = json_decode(file_get_contents($argv[1]), true);
foreach ($bugs as $bug) {
    $creation_ts = m_time($bug["created_at"]);
    $delta_ts = m_time($bug["created_at"]);
    $version = m_milestone($bug["milestone_title"]);
    $priority = m_priority($bug["priority"]);
    $assigned_to = m_name($bug["assigned_user_name"]);
    $reporter = m_name($bug["creator_name"]);
    $state = m_state($bug["state"]);
    $short_desc = $bug["title"];
    $latest_body = $bug["latest_body"];
    $data = array('bug_id' => 0, 'assigned_to' => $assigned_to, 'bug_severity' => BUG_SEVERITY, 'bug_status' => $state, 'creation_ts' => $creation_ts, 'delta_ts' => $delta_ts, 'short_desc' => $short_desc, 'op_sys' => OP_SYS, 'priority' => $priority, 'product_id' => PRODUCT_ID, 'rep_platform' => REP_PLATFORM, 'reporter' => $reporter, 'version' => $version, 'component_id' => COMPONENT_ID, 'resolution' => "", 'target_milestone' => "---", 'status_whiteboard' => "", 'keywords' => "", 'everconfirmed' => 1, 'reporter_accessible' => 1, 'cclist_accessible' => 1, 'estimated_time' => 0, 'remaining_time' => 0);
    $comments = array();
    // the bug description is comment #1
    $comments[] = create_comment($reporter, $creation_ts, $latest_body);
    foreach ($bug["comments"] as $c) {
        $comments[] = create_comment(m_name($c["user_name"]), m_time($c["updated_at"]), $c["body"]);
    }
    $sql = insert_bug($data, $latest_body, $comments);
    echo join("\n", $sql);
}
Example #4
0
<?php

//Create comment
require_once '../includes/functions.inc.php';
$pid = isset($_POST['pid']) ? $_POST['pid'] : '';
$uid = isset($_POST['uid']) ? $_POST['uid'] : '';
$body = isset($_POST['body']) ? $_POST['body'] : '';
$hide = isset($_POST['hide']) ? $_POST['hide'] : '0';
$user = user_load($uid);
create_comment($pid, $uid, $body, $hide);
follow_notify($pid, $hide == 1 ? 'Anonymous' : $user['User_Fullname'], $body);
//unfollow_post($uid,$pid);
//follow_post($uid,$pid);
Example #5
0
 }
 if (array_key_exists('id', $_POST) && array_key_exists('type', $_POST)) {
     // make sure user can access general_content entity
     if (!abet_is_admin_authenticated() && !check_assessment_access($_SESSION['id'], $_POST['id'], 'general_content')) {
         page_fail(UNAUTHORIZED);
     }
     // create new content (single entity)
     if ($_POST['type'] == 'file' && array_key_exists('file', $_FILES)) {
         // make sure file data was uploaded correctly
         if (!is_uploaded_file($_FILES['file']['tmp_name'])) {
             page_fail_with_reason(SERVER_ERROR, "file upload was unsuccessful");
         }
         echo create_file($_POST['id']);
     } else {
         if ($_POST['type'] == 'comment') {
             echo create_comment($_POST['id']);
         } else {
             page_fail(BAD_REQUEST);
         }
     }
 } else {
     if (array_key_exists('delete', $_POST) && array_key_exists('type', $_POST)) {
         // delete content (single entity)
         if ($_POST['type'] != 'file' && $_POST['type'] != 'comment') {
             page_fail(BAD_REQUEST);
         }
         // verify that the user can access the entity
         $kind = $_POST['type'] == 'file' ? 'file_upload' : 'user_comment';
         if (!abet_is_admin_authenticated() && !check_general_content_item_access($_SESSION['id'], $_POST['delete'], $kind, $found)) {
             page_fail($found ? UNAUTHORIZED : NOT_FOUND);
         }