Exemple #1
0
function delete_file($id, $key)
{
    $conf = configurations();
    $con = new Mongo();
    $db = $con->{$conf}['base']->{$conf}['project'];
    $project = check_projects(array('_id' => new MongoId($id)));
    if (isset($project['files'][$key])) {
        try {
            $db->update(array('_id' => new MongoID($id)), array('$unset' => array('files.' . $key => array())), array('safe' => true, 'upsert' => true));
        } catch (MongoCursorException $e) {
            trigger_error("Remove failed " . $e->getMessage() . $sha1);
            return 'db_error';
        }
        //remove file
        rrmdir('files/' . file_name($project['name']) . '/' . file_name($project['version']));
        return 'filedeleted';
    }
}
Exemple #2
0
function html5_user_bug($lang, $mod = null)
{
    global $text_cont;
    if (is_array($mod)) {
        return redirect($lang, '?action=' . $mod[0] . $mod[1] . '&mod=' . $mod[2]);
    } elseif (is_string($mod)) {
        $cb = 'html5_' . $mod;
        $mod = $cb($lang);
    }
    $id = myfilter($_GET['id'], '_id');
    $bug = list_bugs(array('_id' => new MongoId($id)), true);
    if (is_null($bug)) {
        $cb = 'html5_' . $_SESSION['db_data']['lvl'] . '_project';
        return $cb($lang, 'bugerror');
    }
    $author = getvalue(check_user(array('_id' => new MongoId($bug['userid']))), 'user');
    if (is_null($author)) {
        $author = 'Anonymous';
    }
    $project = getvalue(check_projects(array('_id' => new MongoId($bug['projectid']))), 'name');
    if (is_null($project)) {
        $project = $text_cont[92][$lang];
    }
    $html_var = '<div id="message">' . $mod . '</div><div id="bug"><h2>' . $text_cont[88][$lang] . ' #' . $bug['#'] . ' - ' . html($bug['title']) . '</h2>

<div id="bug_date">' . date('d M Y', $bug['date']->sec) . '</div>
<div id="bug_sender">' . $text_cont[89][$lang] . ' ' . html($author) . '</div>
<div id="bug_project"><a href="?action=project&project_id=' . $bug['projectid'] . '">' . html($project) . '</a></div>
<div id="bug_status">' . $text_cont[84][$lang] . ': <span class="status ' . $bug['status'] . '">' . $bug['status'] . '</span></div>
<div id="bug_version">' . $text_cont[49][$lang] . ': ' . html($bug['version']) . ' - ' . $text_cont[100][$lang] . ' ' . $bug['os'] . ' ' . $bug['arch'] . '</div>
<div id="bug_content">' . nl2br(html($bug['descript'])) . '</div></div>';
    //comments
    $html_var .= list_bugs_comments($lang, $bug['comments']) . '<div id="bug_comments_box"><form id="comment" action="?action=bug&id=' . $id . '" method="post">
<textarea placeholder="' . $text_cont[95][$lang] . '" name="comment_bug"></textarea>
<input type="submit" id="sub_button" value="' . $text_cont[96][$lang] . '" /></form></div></div>';
    return $html_var;
}