Ejemplo n.º 1
0
 function area_notes()
 {
     global $user, $fs, $page, $db;
     $page->assign('saved_notes', $db->x->getAll('SELECT * FROM {notes} WHERE user_id = ?', null, $user->id));
     if (Req::num('note_id') && Get::val('action') != 'deletenote') {
         $note = $db->x->getRow('SELECT note_id, message_subject, message_body, n.last_updated, content, n.syntax_plugins
                                FROM {notes} n
                           LEFT JOIN {cache} c ON note_id = topic AND type = ? AND n.last_updated < c.last_updated
                               WHERE user_id = ? AND note_id = ?', null, array('note', $user->id, Req::num('note_id')));
         $page->assign('show_note', $note);
     }
 }
Ejemplo n.º 2
0
 /**
  * area_editgroup
  *
  * @access public
  * @return void
  */
 function area_editgroup()
 {
     global $db, $page, $proj, $fs;
     $group = Flyspray::getGroupDetails(Req::num('group_id'));
     if (!$group || $group['project_id'] != $proj->id) {
         FlysprayDo::error(array(ERROR_RECOVER, L('groupnotexist'), CreateURL(array('pm', 'proj' . $proj->id, 'groups'))));
     }
     $newparams = array();
     foreach ($fs->perms as $perm) {
         $newparams[$perm] = $group[$perm];
     }
     $page->assign('newparams', $newparams);
     $page->assign('group', $group);
     $page->assign('groups', Flyspray::listGroups());
 }
Ejemplo n.º 3
0
box-shadow: 0 1px 1px #ddd;
color: #565656;
cursor: pointer;
display: inline-block;
font-family: sans-serif;
font-size: 100%;
font-weight: bold;
line-height: 130%;
padding: 8px 13px 8px 10px;
text-decoration: none;
">Remove the folder ' . DIRECTORY_SEPARATOR . 'setup</a> before you start using Flyspray</p>
');
}
// Any "do" mode that accepts a task_id or id field should be added here.
if (in_array(Req::val('do'), array('details', 'depends', 'editcomment'))) {
    if (Req::num('task_id')) {
        $result = $db->Query('SELECT  project_id
                                FROM  {tasks} WHERE task_id = ?', array(Req::num('task_id')));
        $project_id = $db->FetchOne($result);
    }
}
if (!isset($project_id)) {
    // Determine which project we want to see
    if (($project_id = Cookie::val('flyspray_project')) == '') {
        $project_id = $fs->prefs['default_project'];
    }
    $project_id = Req::val('project', Req::val('project_id', $project_id));
}
$proj = new Project($project_id);
# no more project cookie!
#$proj->setCookie();
Ejemplo n.º 4
0
                imageGif($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
            case IMAGETYPE_PNG:
                imagePng($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
            default:
                imagePng($resizedImage, BASEDIR . '/avatars/' . $file);
                break;
        }
    } else {
        imagePng($resizedImage, BASEDIR . '/avatars/' . $file . '.png');
    }
    return;
}
if (Req::num('task_id')) {
    $task = Flyspray::GetTaskDetails(Req::num('task_id'));
}
if (isset($_SESSION)) {
    unset($_SESSION['SUCCESS'], $_SESSION['ERROR']);
}
switch ($action = Req::val('action')) {
    // ##################
    // Adding a new task
    // ##################
    case 'newtask.newtask':
        if (!Post::val('item_summary') || trim(Post::val('item_summary')) == '') {
            //description not required
            #Flyspray::show_error(L('summaryanddetails'));
            Flyspray::show_error(L('summaryrequired'));
            break;
        }
Ejemplo n.º 5
0
<?php

/*************************************************************\
  | Details a task (and edit it)                                |
  | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                |
  | This script displays task details when in view mode,        |
  | and allows the user to edit task details when in edit mode. |
  | It also shows comments, attachments, notifications etc.     |
  \*************************************************************/
if (!defined('IN_FS')) {
    die('Do not access this file directly.');
}
$task_id = Req::num('task_id');
if (!($task_details = Flyspray::GetTaskDetails($task_id))) {
    Flyspray::show_error(10);
}
if (!$user->can_view_task($task_details)) {
    Flyspray::show_error($user->isAnon() ? 102 : 101, false);
} else {
    require_once BASEDIR . '/includes/events.inc.php';
    if ($proj->prefs['use_effort_tracking']) {
        require_once BASEDIR . '/includes/class.effort.php';
        $effort = new effort($task_id, $user->id);
        $effort->populateDetails();
        $page->assign('effort', $effort);
    }
    $page->uses('task_details');
    // Send user variables to the template
    $page->assign('assigned_users', $task_details['assigned_to']);
    $page->assign('old_assigned', implode(' ', $task_details['assigned_to']));
    $page->assign('tags', $task_details['tags']);
Ejemplo n.º 6
0
switch ($area = Req::val('area', 'prefs')) {
    case 'users':
        $id = Flyspray::UserNameToId(Req::val('user_name'));
        if (!$id) {
            $id = Req::val('user_id');
        }
        $theuser = new User($id, $proj);
        if ($theuser->isAnon()) {
            Flyspray::show_error(5, true, null, $_SESSION['prev_page']);
        }
        $page->assign('theuser', $theuser);
    case 'cat':
    case 'editgroup':
        // yeah, utterly stupid, is changed in 1.0 already
        if (Req::val('area') == 'editgroup') {
            $group_details = Flyspray::getGroupDetails(Req::num('id'));
            if (!$group_details || $group_details['project_id'] != $proj->id) {
                Flyspray::show_error(L('groupnotexist'));
                Flyspray::Redirect(CreateURL('pm', 'groups', $proj->id));
            }
            $page->uses('group_details');
        }
    case 'groups':
    case 'newuser':
    case 'newuserbulk':
    case 'editallusers':
        $page->assign('groups', Flyspray::ListGroups());
    case 'userrequest':
        $sql = $db->Query("SELECT  *\n                             FROM  {admin_requests}\n                            WHERE  request_type = 3 AND project_id = 0 AND resolved_by = 0\n                         ORDER BY  time_submitted ASC");
        $page->assign('pendings', $db->fetchAllArray($sql));
    case 'newproject':
Ejemplo n.º 7
0
<?php

// We can't include this script as part of index.php?do= etc,
// as that would introduce html code into it.  HTML != Valid XML
// So, include the headerfile to set up database access etc
define('IN_FS', true);
define('IN_FEED', true);
require_once dirname(__FILE__) . '/header.php';
$page = new FSTpl();
// Set up the basic XML head
header('Content-type: text/html; charset=utf-8');
$max_items = Req::num('num', 10) == 10 ? 10 : 20;
$sql_project = ' 1=1 ';
if ($proj->id) {
    $sql_project = sprintf(' p.project_id = %d', $proj->id);
}
$feed_type = Req::val('feed_type', 'rss2');
if ($feed_type != 'rss1' && $feed_type != 'rss2') {
    $feed_type = 'atom';
}
switch (Req::val('topic')) {
    case 'clo':
        $orderby = 'date_closed';
        $closed = 't.is_closed = 1 ';
        $topic = 1;
        $title = 'Recently closed tasks';
        break;
    case 'edit':
        $orderby = 'last_edited_time';
        $closed = '1=1';
        $topic = 2;
Ejemplo n.º 8
0
line-height: 130%;
padding: 8px 13px 8px 10px;
text-decoration: none;
">Remove the folder ' . DIRECTORY_SEPARATOR . 'setup</a> before you start using Flyspray</p>
');
}
# load the correct $proj early also for checks on quickedit.php taskediting calls
if (BASEDIR . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'callbacks' . DIRECTORY_SEPARATOR . 'quickedit.php' == $_SERVER['SCRIPT_FILENAME'] && Post::num('task_id')) {
    $result = $db->Query('SELECT project_id FROM {tasks} WHERE task_id = ?', array(Post::num('task_id')));
    $project_id = $db->FetchOne($result);
} elseif (in_array(Req::val('do'), array('details', 'depends', 'editcomment'))) {
    if (Req::num('task_id')) {
        $result = $db->Query('SELECT project_id FROM {tasks} WHERE task_id = ?', array(Req::num('task_id')));
        $project_id = $db->FetchOne($result);
    }
}
if (Req::val('do') == 'pm' && Req::val('area') == 'editgroup') {
    if (Req::num('id')) {
        $result = $db->Query('SELECT project_id FROM {groups} WHERE group_id = ?', array(Req::num('id')));
        $project_id = $db->FetchOne($result);
    }
}
if (!isset($project_id)) {
    $project_id = $fs->prefs['default_project'];
    # Force default value if input format is not allowed
    if (is_array(Req::val('project'))) {
        Req::set('project', $fs->prefs['default_project']);
    }
    $project_id = Req::val('project', Req::val('project_id', $project_id));
}
$proj = new Project($project_id);
Ejemplo n.º 9
0
/********************************************************\
  | Task Dependancy Graph                                  |
  | ~~~~~~~~~~~~~~~~~~~~~                                  |
  \********************************************************/
/**
 * XXX: This stuff looks incredible ugly, rewrite me for 1.0
 */
if (!defined('IN_FS')) {
    die('Do not access this file directly.');
}
if (!($task_details = Flyspray::GetTaskDetails(Req::num('task_id'))) || !$user->can_view_task($task_details)) {
    Flyspray::show_error(9);
}
$id = Req::num('task_id');
$page->assign('task_id', $id);
$prunemode = Req::num('prune', 0);
$selfurl = CreateURL('depends', $id);
$pmodes = array(L('none'), L('pruneclosedlinks'), L('pruneclosedtasks'));
foreach ($pmodes as $mode => $desc) {
    if ($mode == $prunemode) {
        $strlist[] = $desc;
    } else {
        $strlist[] = "<a href='" . htmlspecialchars($selfurl, ENT_QUOTES, 'utf-8') . ($mode != 0 ? "&amp;prune={$mode}" : "") . "'>{$desc}</a>\n";
    }
}
$page->uses('strlist');
$starttime = microtime();
$sql = 'SELECT t1.task_id AS id1, t1.item_summary AS sum1,
             t1.percent_complete AS pct1, t1.is_closed AS clsd1,
             lst1.status_name AS stat1, t1.task_severity AS sev1,
             t1.task_priority AS pri1,
Ejemplo n.º 10
0
}
if (is_readable(BASEDIR . '/setup/index.php') && strpos($fs->version, 'dev') === false) {
    die('Please empty the folder "' . BASEDIR . DIRECTORY_SEPARATOR . "setup\"  before you start using Flyspray.\n" . "If you are upgrading, please go to the setup directory and launch upgrade.php");
}
// Get available do-modes and include the classes
$modes = str_replace('.php', '', array_map('basename', glob_compat(BASEDIR . "/scripts/*.php")));
// yes, we need all of them for now
foreach ($modes as $mode) {
    require_once BASEDIR . '/scripts/' . $mode . '.php';
}
$do = Req::val('do');
// Any "do" mode that accepts a task_id or id field should be added here.
if (Req::num('task_id')) {
    $project_id = $db->x->GetOne('SELECT  project_id
                                 FROM  {tasks}
                                WHERE task_id = ?', null, Req::num('task_id'));
    $do = Filters::enum($do, array('details', 'depends', 'editcomment'));
} else {
    if ($do == 'admin' && Get::has('switch') && Get::val('project') != '0') {
        $do = 'pm';
    } elseif ($do == 'pm' && Get::has('switch') && Get::val('project') == '0') {
        $do = 'admin';
    } elseif (Get::has('switch') && $do == 'details') {
        $do = 'index';
    }
    if ($do && class_exists('FlysprayDo' . ucfirst($do)) && !call_user_func(array('FlysprayDo' . ucfirst($do), 'is_projectlevel'))) {
        $project_id = 0;
    }
}
if (!isset($project_id)) {
    // Determine which project we want to see
Ejemplo n.º 11
0
    $where[] = 'h.event_type = ?';
    $params[] = $eventtype;
}
$where = '(' . implode(' OR ', $where) . ')';
if ($proj->id) {
    $where = $where . 'AND (t.project_id = ?  OR h.event_type > 29) ';
    $params[] = $proj->id;
}
if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
    $where .= ' AND ';
    $todate = Req::val('todate');
    if ($fromdate) {
        $where .= ' h.event_date > ?';
        $params[] = Flyspray::strtotime($fromdate) + 0;
    }
    if ($todate && $fromdate) {
        $where .= ' AND h.event_date < ?';
        $params[] = Flyspray::strtotime($todate) + 86400;
    } else {
        if ($todate) {
            $where .= ' h.event_date < ?';
            $params[] = Flyspray::strtotime($todate) + 86400;
        }
    }
}
if (count(Req::val('events'))) {
    $histories = $db->Query("SELECT h.*\n                        FROM  {history} h\n                   LEFT JOIN {tasks} t ON h.task_id = t.task_id\n                        WHERE {$where}\n                     ORDER BY {$orderby}", $params, Req::num('event_number', -1));
    $histories = $db->FetchAllArray($histories);
}
$page->uses('histories', 'sort');
$page->pushTpl('reports.tpl');
Ejemplo n.º 12
0
 function _onsubmit()
 {
     $action = Req::val('action');
     list($type, $msg, $url) = $this->handle('action', $action, $this->task);
     if ($type != NO_SUBMIT) {
         $this->task = Flyspray::GetTaskDetails(Req::num('task_id'));
     }
     return array($type, $msg, $url);
 }