function tpl_list_heading($colname, $format = "<th%s>%s</th>") { global $proj, $page; $imgbase = '<img src="%s" alt="%s" />'; $class = ''; $html = eL($colname); if ($colname == 'comments' || $colname == 'attachments') { $html = sprintf($imgbase, $page->get_image(substr($colname, 0, -1)), $html); } if (Get::val('order') == $colname) { $class = ' class="orderby"'; $sort1 = Get::safe('sort', 'desc') == 'desc' ? 'asc' : 'desc'; $sort2 = Get::safe('sort2', 'desc'); $order2 = Get::safe('order2'); $html .= ' ' . sprintf($imgbase, $page->get_image(Get::val('sort')), Get::safe('sort')); } else { $sort1 = 'desc'; if (in_array($colname, array('project', 'tasktype', 'category', 'openedby', 'assignedto'))) { $sort1 = 'asc'; } $sort2 = Get::safe('sort', 'desc'); $order2 = Get::safe('order'); } $new_order = array('order' => $colname, 'sort' => $sort1, 'order2' => $order2, 'sort2' => $sort2); $html = sprintf('<a title="%s" href="%s">%s</a>', eL('sortthiscolumn'), Filters::noXSS(CreateURL('index', $proj->id, null, array_merge($_GET, $new_order))), $html); return sprintf($format, $class, $html); }
function show() { global $page, $db, $user, $fs, $proj; $page->setTitle($fs->prefs['page_title'] . L('reports')); $events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted')); $user_events = array(30 => L('created'), 31 => L('deleted')); $page->assign('events', $events); $page->assign('user_events', $user_events); $sort = strtoupper(Get::enum('sort', array('desc', 'asc'))); $where = array(); $params = array(); $orderby = ''; switch (Get::val('order')) { case 'type': $orderby = "h.event_type {$sort}, h.event_date {$sort}"; break; case 'user': $orderby = "user_id {$sort}, h.event_date {$sort}"; break; case 'date': default: $orderby = "h.event_date {$sort}, h.event_type {$sort}"; } foreach (Get::val('events', array()) as $eventtype) { $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; } } } $histories = array(); if (count(Get::val('events'))) { if (Get::num('event_number') > 0) { $db->setLimit(Get::num('event_number')); } $histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n FROM {history} h\n LEFT JOIN {tasks} t ON h.task_id = t.task_id\n LEFT JOIN {projects} p ON t.project_id = p.project_id\n WHERE {$where}\n ORDER BY {$orderby}", null, $params); } $page->assign('histories', $histories); $page->assign('sort', $sort); $page->pushTpl('reports.tpl'); }
function show() { global $page, $db, $fs, $proj, $user; $page->setTitle($fs->prefs['page_title'] . L('roadmap')); // Get milestones $list_id = $db->x->GetOne('SELECT list_id FROM {fields} WHERE field_id = ?', null, $proj->prefs['roadmap_field']); $milestones = array(); if ($list_id) { $milestones = $db->x->getAll('SELECT list_item_id AS version_id, item_name AS version_name FROM {list_items} li WHERE list_id = ? AND version_tense = 3 ORDER BY list_position ASC', null, $list_id); } $data = array(); foreach ($milestones as $row) { // Get all tasks related to a milestone $all_tasks = $db->x->getAll('SELECT percent_complete, is_closed, t.* FROM {tasks} t LEFT JOIN {field_values} fv ON (fv.task_id = t.task_id AND field_id = ?) WHERE field_value = ? AND project_id = ?', null, array($proj->prefs['roadmap_field'], $row['version_id'], $proj->id)); $all_tasks = array_filter($all_tasks, array($user, 'can_view_task')); $percent_complete = 0; foreach ($all_tasks as $task) { if ($task['is_closed']) { $percent_complete += 100; } else { $percent_complete += $task['percent_complete']; } } $percent_complete = round($percent_complete / max(count($all_tasks), 1)); if (count($all_tasks)) { $tasks = $db->x->getAll('SELECT t.task_id, item_summary, detailed_desc, mark_private, fs.field_value AS field' . $fs->prefs['color_field'] . ', opened_by, content, task_token, t.project_id, prefix_id FROM {tasks} t LEFT JOIN {cache} ca ON (t.task_id = ca.topic AND ca.type = ? AND t.last_edited_time <= ca.last_updated) LEFT JOIN {field_values} f ON f.task_id = t.task_id LEFT JOIN {field_values} fs ON (fs.task_id = t.task_id AND fs.field_id = ?) WHERE f.field_value = ? AND f.field_id = ? AND t.project_id = ? AND is_closed = 0', null, array('rota', $fs->prefs['color_field'], $row['version_id'], $proj->prefs['roadmap_field'], $proj->id)); $count = count($tasks); for ($i = 0; $i < $count; $i++) { if (!$user->can_view_task($tasks[$i])) { unset($tasks[$i]); } } } $data[] = array('id' => $row['version_id'], 'open_tasks' => isset($tasks) ? $tasks : array(), 'percent_complete' => $percent_complete, 'all_tasks' => $all_tasks ? $all_tasks : array(), 'name' => $row['version_name']); unset($tasks); } if (Get::val('txt')) { $page = new FSTpl(); header('Content-Type: text/plain; charset=UTF-8'); $page->assign('data', $data); $page->display('roadmap.text.tpl'); exit; } else { $page->assign('data', $data); $page->pushTpl('roadmap.tpl'); } }
static function render($text, $type = null, $id = null, $instructions = null) { global $conf, $baseurl, $db; // Unfortunately dokuwiki also uses $conf $fs_conf = $conf; $conf = array(); // Dokuwiki generates some notices error_reporting(E_ALL ^ E_NOTICE); if (!$instructions) { include_once BASEDIR . '/plugins/dokuwiki/inc/parser/parser.php'; } require_once BASEDIR . '/plugins/dokuwiki/inc/common.php'; require_once BASEDIR . '/plugins/dokuwiki/inc/parser/xhtml.php'; // Create a renderer $Renderer = new Doku_Renderer_XHTML(); if (!is_string($instructions) || strlen($instructions) < 1) { $modes = p_get_parsermodes(); $Parser = new Doku_Parser(); // Add the Handler $Parser->Handler = new Doku_Handler(); // Add modes to parser foreach ($modes as $mode) { $Parser->addMode($mode['mode'], $mode['obj']); } $instructions = $Parser->parse($text); // Cache the parsed text if (!is_null($type) && !is_null($id)) { $fields = array('content' => serialize($instructions), 'type' => $type, 'topic' => $id, 'last_updated' => time()); $keys = array('type', 'topic'); //autoquote is always true on db class $db->Replace('{cache}', $fields, $keys); } } else { $instructions = unserialize($instructions); } $Renderer->smileys = getSmileys(); $Renderer->entities = getEntities(); $Renderer->acronyms = getAcronyms(); $Renderer->interwiki = getInterwiki(); $conf = $fs_conf; $conf['cachedir'] = FS_CACHE_DIR; // for dokuwiki $conf['fperm'] = 0600; $conf['dperm'] = 0700; // Loop through the instructions foreach ($instructions as $instruction) { // Execute the callback against the Renderer call_user_func_array(array(&$Renderer, $instruction[0]), $instruction[1]); } $return = $Renderer->doc; // Display the output if (Get::val('histring')) { $words = explode(' ', Get::val('histring')); foreach ($words as $word) { $return = html_hilight($return, $word); } } return $return; }
function _onsubmit() { global $proj; // only meant for global fields... if (!count(Get::val('ids', array()))) { return array(ERROR_RECOVER, L('notasksselected'), CreateUrl('index')); } $proj = new Project(0); $return = $this->handle('action', Req::val('action')); $proj = new Project(0); return $return; }
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); } }
function show($area = null) { global $page, $fs, $db, $proj, $user, $conf; $perpage = '20'; if (isset($user->infos['tasks_perpage'])) { $perpage = $user->infos['tasks_perpage']; } $pagenum = max(1, Get::num('pagenum', 1)); $offset = $perpage * ($pagenum - 1); // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); if (!is_array($visible) || !count($visible) || !$visible[0]) { $visible = array('id'); } list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage); $page->assign('tasks', $tasks); $page->assign('offset', $offset); $page->assign('perpage', $perpage); $page->assign('pagenum', $pagenum); $page->assign('visible', $visible); // List of task IDs for next/previous links $_SESSION['tasklist'] = $id_list; $page->assign('total', count($id_list)); // Javascript replacement if (Get::val('toggleadvanced')) { $advanced_search = intval(!Req::val('advancedsearch')); Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30); $_COOKIE['advancedsearch'] = $advanced_search; } // Update check {{{ if (Get::has('hideupdatemsg')) { unset($_SESSION['latest_version']); } else { if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) { if (!isset($_SESSION['latest_version'])) { $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS); //if for some silly reason we get and empty response, we use the actual version $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest; $db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check')); } } } if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) { $page->assign('updatemsg', true); } // }}} $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist')); $page->pushTpl('index.tpl'); }
function show() { global $page, $db, $fs, $proj, $user; $page->setTitle($fs->prefs['page_title'] . L('changelog')); // Get milestones $list_id = $db->x->GetOne('SELECT list_id FROM {fields} WHERE field_id = ?', null, $proj->prefs['roadmap_field']); if (!$list_id) { trigger_error('Roadmap / changelog has not been configured in the project management area.', E_USER_ERROR); } $milestones = $db->x->getAll('SELECT list_item_id AS version_id, item_name AS version_name FROM {list_items} li WHERE list_id = ? AND (version_tense = 1 OR version_tense = 2) AND show_in_list = 1 ORDER BY list_position ASC', null, $list_id); $data = array(); $reasons = implode(',', explode(' ', $proj->prefs['changelog_reso'])); while ((list(, $row) = each($milestones)) && $reasons) { $tasks = $db->x->getAll('SELECT t.task_id, percent_complete, item_summary, detailed_desc, mark_private, fs.field_value AS field' . $fs->prefs['color_field'] . ', opened_by, task_token, t.project_id, prefix_id, li.item_name AS res_name, li.list_item_id AS res_id FROM {tasks} t LEFT JOIN {field_values} f ON f.task_id = t.task_id LEFT JOIN {field_values} fs ON (fs.task_id = t.task_id AND fs.field_id = ?) LEFT JOIN {list_items} li ON t.resolution_reason = li.list_item_id WHERE f.field_value = ? AND f.field_id = ? AND t.project_id = ? AND is_closed = 1 AND t.resolution_reason IN (' . $reasons . ') ORDER BY t.resolution_reason DESC', null, array($fs->prefs['color_field'], $row['version_id'], $proj->prefs['roadmap_field'], $proj->id)); $tasks = array_filter($tasks, array($user, 'can_view_task')); if (count($tasks)) { $resolutions = array(); foreach ($tasks as $task) { $resolutions[$task['res_name']] = isset($resolutions[$task['res_name']]) ? $resolutions[$task['res_name']] + 1 : 1; } $data[] = array('tasks' => $tasks, 'name' => $row['version_name'], 'resolutions' => $resolutions); } } if (Get::val('txt')) { $page = new FSTpl(); header('Content-Type: text/plain; charset=UTF-8'); $page->assign('data', $data); $page->display('changelog.text.tpl'); exit; } else { $page->assign('data', $data); $page->pushTpl('changelog.tpl'); } }
/** * show * * @access public * @return void */ function show() { global $proj, $page, $fs; // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, 0); $page = new FSTpl(); $page->assign('tasks', $tasks); $page->assign('visible', $visible); if (Get::val('type') == 'iCal') { $datecols = array('dateopened' => 'date_opened', 'lastedit' => 'max_date', 'dateclosed' => 'date_closed'); header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: filename="export.ics"'); $page->assign('datecols', $datecols); $page->finish('icalexport.tpl'); } else { header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: filename="export.csv"'); $page->finish('csvexport.tpl'); } }
/** * @param PageBuilder $pageBuilder * @return MessageListTable */ function MessageListTable(&$pagebuilder) { $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $this->sortField = Get::val('s_fld', 0); $this->sortOrder = Get::val('s_ord', 0); $this->page = $this->_proc->sArray[PAGE]; $this->_proc->account->DefaultOrder = $this->sortField + $this->sortOrder; $this->folders =& $this->_proc->GetFolders(); if (isset($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) && strlen($this->_proc->sArray[SEARCH_ARRAY][S_TEXT]) > 0) { if ($this->_proc->sArray[SEARCH_ARRAY][S_FOLDER] > -2) { $this->folder =& $this->folders->GetFolderById((int) $this->_proc->sArray[FOLDER_ID]); $this->_proc->processor->GetFolderInfo($this->folder); $this->folders =& new FolderCollection(); $this->folders->Add($this->folder); } else { $this->folder = null; } $field = $this->_proc->sArray[SEARCH_ARRAY][S_MODE] == 'onlyheaders'; $condition = ConvertUtils::ConvertEncoding($this->_proc->sArray[SEARCH_ARRAY][S_TEXT], $this->_proc->account->GetUserCharset(), $this->_proc->account->DbCharset); $this->messCount = (int) $this->_proc->processor->SearchMessagesCount($condition, $this->folders, $field); $this->messageCollection =& $this->_proc->processor->SearchMessages($this->page, $condition, $this->folders, $field, $this->messCount); } else { $cfolder =& $this->_proc->GetCurrentFolder(); if ($cfolder) { $this->folder =& $cfolder; $this->messCount = (int) $this->folder->MessageCount; if ($this->_proc->account->MailsPerPage * ($this->page - 1) >= $this->messCount) { $this->page = (int) ceil($this->messCount / $this->_proc->account->MailsPerPage); } $this->page = $this->page < 1 ? $this->page = 1 : $this->page; $this->messageCollection =& $this->_proc->processor->GetMessageHeaders($this->page, $this->folder); } else { $this->folder = null; $this->messCount = 0; $this->page = 1; $this->messageCollection =& new WebMailMessageCollection(); } } if ($this->folder && $this->folders) { $this->folders->InitToFolder($this->folder); } if ($this->messageCollection === null) { $this->folder = null; $this->messCount = 0; $this->page = 1; $this->messageCollection =& new WebMailMessageCollection(); SetOnlineError(PROC_CANT_GET_MSG_LIST); } $jsTempString = $this->_proc->currentFolder && $this->_proc->currentFolder->Type == FOLDERTYPE_Drafts ? 'BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '";' : 'BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_FULLSCREEN . '";'; $flagjs = ' var line = InboxLines.GetLinesById(id); if (line.Flagged) { InboxLines.SetParams([id], "Flagged", false, false); } else { InboxLines.SetParams([id], "Flagged", true, false); } DoFlagOneMessage(line); '; if ($this->_proc->account->MailProtocol != MAILPROTOCOL_IMAP4 && $this->_proc->currentFolder && $this->_proc->currentFolder->SyncType == FOLDERSYNC_DirectMode) { $flagjs = ''; } $this->_pagebuilder->AddJSText(' function CheckThisLine(e, trobj) { var id = trobj.id; e = e ? e : window.event; if (e.ctrlKey) { InboxLines.CheckCtrlLine(id); } else if (e.shiftKey) { InboxLines.CheckShiftLine(id); } else { if (Browser.Mozilla) {var elem = e.target;} else {var elem = e.srcElement;} if (!elem || id == "" || elem.id == "none") { return false; } var loverTag = elem.tagName.toLowerCase(); if (loverTag == "a") { LoadMessageFull(id); } else if (loverTag == "input") { InboxLines.CheckCBox(id); } else if (loverTag == "img") { ' . $flagjs . ' } else if (isPreviewPane) { InboxLines.CheckLine(id); LoadMessage(id); } } } function CheckThisLineDb(e, trobj) { var id = trobj.id; e = e ? e : window.event; if (Browser.Mozilla) { var elem = e.target; } else { var elem = e.srcElement; } if (!elem || id == "" || elem.id == "none" || elem.tagName.toLowerCase() == "input") { return false; } LoadMessageFull(id); } function LoadMessageFull(lineid) { var parseObj = ParseLineId(lineid); var obj = InboxLines.GetLinesById(lineid); ' . $jsTempString . ' BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Form.submit(); } function LoadMessage(lineid) { if (tempReq != lineid){ InfoPanel._isError = false; InfoPanel.SetInfo(Lang.Loading); InfoPanel.Show(); tempReq = lineid; var parseObj = ParseLineId(lineid); var obj = InboxLines.GetLinesById(lineid); BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Form.submit(); } } function DoForwardButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "forward"; BaseForm.Form.submit(); } } function DoReplyButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "reply"; BaseForm.Form.submit(); } } function DoReplyAllButton() { var lineobjs = InboxLines.GetCheckedLinesObj(); if (lineobjs && lineobjs.length == 1) { var obj = lineobjs[0]; var parseObj = ParseLineId(obj.Id); BaseForm.Form.action = "' . BASEFILE . '?' . SCREEN . '=' . SCREEN_NEWOREDIT . '"; BaseForm.Form.target = "_self"; BaseForm.MessId.value = obj.MsgId; BaseForm.MessUid.value = obj.MsgUid; BaseForm.FolderId.value = obj.MsgFolderId; BaseForm.FolderName.value = obj.MsgFolderFullName; BaseForm.Charset.value = parseObj.charset; BaseForm.Plain.value = "-1"; BaseForm.Type.value = "replytoall"; BaseForm.Form.submit(); } } function ChangeCharset(newCharset) { var idline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + BaseForm.Charset.value + sep; var newidline = BaseForm.MessId.value + sep + BaseForm.MessUid.value + sep + BaseForm.FolderId.value + sep + newCharset + sep; BaseForm.Charset.value = newCharset; for (var i=0; i<InboxLines.length; i++) { if (InboxLines.lines[i].Id == idline) { InboxLines.lines[i].Id = newidline; InboxLines.lines[i]._tr.id = newidline; } } } function ParseLineId(lineid) { var IdArray = lineid.split(sep); if (IdArray.length > 3) { var objcharset = (IdArray[3]) ? IdArray[3] : -1; return {id: IdArray[0], uid: IdArray[1], folder_id: IdArray[2], charset: objcharset} } return null; } '); $this->_pagebuilder->AddInitText(' PageSwitcher.Show(' . $this->page . ', ' . $this->_proc->account->MailsPerPage . ', ' . $this->messCount . ', "document.location.replace(\'?s_ord=' . $this->sortOrder . '&s_fld=' . $this->sortField . '&page=", "\');"); tempReq = ""; function CBaseForm() { this.Form = document.getElementById("messform"); this.MessId = document.getElementById("m_id"); this.MessUid = document.getElementById("m_uid"); this.FolderId = document.getElementById("f_id"); this.FolderName = document.getElementById("f_name"); this.Charset = document.getElementById("charset"); this.Plain = document.getElementById("plain"); this.Type = document.getElementById("mtype"); } BaseForm = new CBaseForm(); '); }
// see http://www.w3.org/TR/html401/present/styles.html#h-14.2.1 header('Content-Style-Type: text/css'); header('Content-type: text/html; charset=utf-8'); if ($conf['general']['output_buffering'] == 'gzip' && extension_loaded('zlib')) { // Start Output Buffering and gzip encoding if setting is present. ob_start('ob_gzhandler'); } else { ob_start(); } $page = new FSTpl(); // make sure people are not attempting to manually fiddle with projects they are not allowed to play with if (Req::has('project') && Req::val('project') != 0 && !$user->can_view_project(Req::val('project'))) { Flyspray::show_error(L('nopermission')); exit; } if ($show_task = Get::val('show_task')) { // If someone used the 'show task' form, redirect them if (is_numeric($show_task)) { Flyspray::Redirect(CreateURL('details', $show_task)); } else { Flyspray::Redirect($baseurl . '?string=' . $show_task); } } if (Flyspray::requestDuplicated()) { // Check that this page isn't being submitted twice Flyspray::show_error(3); } # handle all forms request that modify data if (Req::has('action')) { # enforcing if the form sent the correct anti csrf token # only allow token by post
function tpl_list_heading($colname, $format = "<th%s>%s</th>") { global $proj, $page; $imgbase = '<img src="%s" alt="%s" />'; $class = $colname; $html = eL($colname); /* if ($colname == 'comments' || $colname == 'attachments') { $html = sprintf($imgbase, $page->get_image(substr($colname, 0, -1)), $html); } */ if ($colname == 'attachments') { $html = '<i class="fa fa-paperclip fa-lg" title="' . $html . '"></i>'; } if ($colname == 'comments') { $html = '<i class="fa fa-comments fa-lg" title="' . $html . '"></i>'; } if ($colname == 'votes') { $html = '<i class="fa fa-star-o fa-lg" title="' . $html . '"></i>'; } if (Get::val('order') == $colname) { $class .= ' orderby'; $sort1 = Get::safe('sort', 'desc') == 'desc' ? 'asc' : 'desc'; $sort2 = Get::safe('sort2', 'desc'); $order2 = Get::safe('order2'); $html .= ' ' . sprintf($imgbase, $page->get_image(Get::val('sort')), Get::safe('sort')); } else { $sort1 = 'desc'; if (in_array($colname, array('project', 'tasktype', 'category', 'openedby', 'assignedto'))) { $sort1 = 'asc'; } $sort2 = Get::safe('sort', 'desc'); $order2 = Get::safe('order'); } $new_order = array('order' => $colname, 'sort' => $sort1, 'order2' => $order2, 'sort2' => $sort2); # unneeded params from $_GET for the sort links $params = array_merge($_GET, $new_order); unset($params['do']); unset($params['project']); unset($params['switch']); $html = sprintf('<a title="%s" href="%s">%s</a>', eL('sortthiscolumn'), Filters::noXSS(CreateURL('tasklist', $proj->id, null, $params)), $html); return sprintf($format, ' class="' . $class . '"', $html); }
<?php /* * Run me once for every project that uses SVN */ # set the timezone date_default_timezone_set('Europe/Berlin'); set_time_limit(0); define('IN_FS', true); require_once '../../header.php'; if (!Get::val('project_id')) { die('No project ID specified (use ?project_id=X).'); } if (!$proj->prefs['svn_url']) { die('No URL to SVN repository entered in PM area.'); } $project_prefixes = $db->x->GetCol('SELECT project_prefix FROM {projects}'); $look = array('FS#', 'bug '); foreach ($project_prefixes as $prefix) { $look[] = preg_quote($prefix . '#', '/'); } $look = implode('|', $look); echo '<h2>' . $proj->prefs['project_title'] . '</h2>'; // use backward-compatible column name $cols = $db->x->getRow('SELECT * FROM {related}'); $col = isset($cols['is_duplicate']) ? 'is_duplicate' : 'related_type'; $revisions = $db->x->GetCol('SELECT topic FROM {cache} WHERE project_id = ? AND type = ?', null, $proj->id, 'svn'); $svninfo = new SVNinfo(); $svninfo->setRepository($proj->prefs['svn_url'], $proj->prefs['svn_user'], $proj->prefs['svn_password']); $currentRevision = $svninfo->getCurrentRevision(); // retrieve stuff in small portions
<?php /* This script is the AJAX callback that performs a search for users, and returns true if the user_name is not given. */ define('IN_FS', true); header('Content-type: text/html; charset=utf-8'); require_once '../../header.php'; $baseurl = dirname(dirname($baseurl)) . '/'; if (Get::has('name')) { $searchterm = strtolower(Get::val('name')); } // Get the list of users from the global groups above $get_users = $db->x->getRow(' SELECT count(u.user_name) AS anz_u_user, count(r.user_name) AS anz_r_user FROM {users} u LEFT JOIN {registrations} r ON u.user_name = r.user_name WHERE Lower(u.user_name) = ? OR Lower(r.user_name) = ?', null, array($searchterm, $searchterm)); if ($get_users) { if ($get_users['anz_u_user'] > '0' || $get_users['anz_r_user'] > '0') { $html = 'false|' . eL('usernametaken'); } else { $html = 'true'; } } echo $html;
$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 if (($project_id = Cookie::val('flyspray_project')) == '') { $project_id = $fs->prefs['default_project']; } $project_id = Req::val('project', Req::val('project_id', $project_id)); }
public function can_view_task($task) { if ($task['task_token'] && Get::val('task_token') == $task['task_token']) { return true; } // Split into several separate tests so I can keep track on whats happening. // Project managers and admins allowed always. if ($this->perms('manage_project', $task['project_id']) || $this->perms('is_admin', $task['project_id'])) { return true; } // Allow if "allow anyone to view this project" is checked // and task is not private. if ($this->perms('others_view', $task['project_id']) && !$task['mark_private']) { return true; } if ($this->isAnon()) { // Following checks need identified user. return false; } // Non-private task if (!$task['mark_private']) { // Can view tasks, always allow if ($this->perms('view_tasks', $task['project_id'])) { return true; } // User can view only own tasks if ($this->perms('view_own_tasks', $task['project_id']) && !$this->perms('view_groups_tasks', $task['project_id'])) { if ($task['opened_by'] == $this->id) { return true; } if (in_array($this->id, Flyspray::GetAssignees($task['task_id']))) { return true; } // No use to continue further. return false; } // Ok, user *must* have view_groups_tasks permission, // but do the check anyway just in case... there might // appear more in the future. if ($this->perms('view_groups_tasks', $task['project_id'])) { // Two first checks the same as with view_own_tasks permission. if ($task['opened_by'] == $this->id) { return true; } // Fetch only once, could be needed three times. $assignees = Flyspray::GetAssignees($task['task_id']); if (in_array($this->id, $assignees)) { return true; } // Must fetch other persons in the group now. Find out // how to detect the right group for project and the // other persons in it. Funny, found it in $perms. $group = $this->perms('project_group', $task['project_id']); $others = Project::listUsersIn($group); foreach ($others as $other) { if ($other['user_id'] == $task['opened_by']) { return true; } if (in_array($other['user_id'], $assignees)) { return true; } } // Check the global group next. Note that for users in that group to be included, // the has to be specified at global group level. So even if our permission system // works by OR'ing the permissions together, who is actually considered to be in // in the same group now depends on whether this permission has been given on global // or project level. if ($this->perms('view_groups_tasks', 0)) { $group = $this->perms('project_group', 0); $others = Project::listUsersIn($group); foreach ($others as $other) { if ($other['user_id'] == $task['opened_by']) { return true; } if (in_array($other['user_id'], $assignees)) { return true; } } } // No use to continue further. return false; } } // Private task, user must be either assigned to the task // or have opened it. if ($task['mark_private']) { if ($task['opened_by'] == $this->id) { return true; } if (in_array($this->id, Flyspray::GetAssignees($task['task_id']))) { return true; } // No use to continue further. return false; } // Could not find any permission for viewing the task. return false; }
public function addfrom($method = 'get', $vars = array()) { $append = ''; foreach ($vars as $key) { $append .= http_build_query($method == 'get' ? Get::val($key) : Post::val($key)) . '&'; } $append = substr($append, 0, -1); $separator = ini_get('arg_separator.output'); if (strlen($separator) != 0) { $append = str_replace($separator, '&', $append); } if ($this->getinfo('query')) { $this->parsed['query'] .= '&' . $append; } else { $this->parsed['query'] = $append; } }
ORDER BY t.task_id ASC', array($task_id)); $duplicates_cleaned = Flyspray::weedOutTasks($user, $db->fetchAllArray($sql)); $page->assign('duplicates', $duplicates_cleaned); $sql = $db->Query('SELECT * FROM {notifications} n LEFT JOIN {users} u ON n.user_id = u.user_id WHERE n.task_id = ?', array($task_id)); $page->assign('notifications', $db->fetchAllArray($sql)); $sql = $db->Query('SELECT * FROM {reminders} r LEFT JOIN {users} u ON r.to_user_id = u.user_id WHERE task_id = ? ORDER BY reminder_id', array($task_id)); $page->assign('reminders', $db->fetchAllArray($sql)); $page->pushTpl('details.tabs.tpl'); if ($user->perms('view_comments') || $proj->prefs['others_view'] || $user->isAnon() && $task_details['task_token'] && Get::val('task_token') == $task_details['task_token']) { $page->pushTpl('details.tabs.comment.tpl'); } $page->pushTpl('details.tabs.related.tpl'); if ($user->perms('manage_project')) { $page->pushTpl('details.tabs.notifs.tpl'); $page->pushTpl('details.tabs.remind.tpl'); } if ($proj->prefs['use_effort_tracking']) { $page->pushTpl('details.tabs.efforttracking.tpl'); } $page->pushTpl('details.tabs.history.tpl'); } # endif can_edit_task } # endif can_view_task
exit(PROC_CANT_LOAD_ACCT); } else { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=2");</script>'); } } $message = false; $isNull = true; $_rtl = in_array($account->DefaultLanguage, explode('|', RTL_ARRAY)); $fromString = $toString = $ccString = $dateString = $subjectString = $attachString = $fullBodyText = ''; $mes_id = Get::val('msg_id', ''); $mes_uid = Get::val('msg_uid', ''); $folder_id = Get::val('folder_id', ''); $folder_name = Get::val('folder_fname', ''); $mes_charset = Get::val('charset', -1); $bodytype = (int) Get::val('bodytype', 1); $tempNameFromGet = Get::val('tn', ''); switch ($viewType) { case MESSAGE_VIEW_TYPE_PRINT: $GLOBALS['PRINTFILE'] = true; if ($mes_uid || $mes_id) { $message = new GetMessageBase($account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); if ($message && $message->msg) { $isNull = false; } } if ($isNull) { exit(PROC_MSG_HAS_DELETED); } $fromString = $message->PrintFrom(true); $toString = $message->PrintTo(true); $ccString = $message->PrintCc(true);
break; } //Check that the supertask_id is a numeric value if (!is_integer((int) Post::val('supertask_id'))) { Flyspray::show_error(L('invalidsupertaskid')); break; } // check that supertask_id is a valid task id $sql = $db->Query('SELECT COUNT(*) FROM {tasks} WHERE task_id = ' . Post::val("supertask_id") . ';'); if (!$db->fetchOne($sql)) { Flyspray::show_error(L('invalidsupertaskid')); break; } // Log the event in the task history Flyspray::logEvent(Get::val('task_id'), 34, Get::val('subtaskid')); //finally looks like all the checks are valid so update the supertask_id for the current task $db->Query('UPDATE {tasks} SET supertask_id = ? WHERE task_id = ?', array(Post::val('supertask_id'), Post::val('task_id'))); // set success message $_SESSION['SUCCESS'] = L('supertaskmodified'); break; case 'task.bulkupdate': if (Post::val('updateselectedtasks') == "true") { //process quick actions switch (Post::val('bulk_quick_action')) { case 'bulk_take_ownership': Backend::assign_to_me(Post::val('user_id'), Post::val('ids')); break; case 'bulk_start_watching':
<?php /* Checks if a related tasks belongs to a different project. */ define('IN_FS', true); require_once '../../header.php'; $relatedproject = $db->x->GetOne('SELECT project_id FROM {tasks} WHERE task_id = ?', null, Get::val('related_task')); if (Get::val('project') == $relatedproject || !$relatedproject) { echo 'ok'; }
require_once WM_ROOTPATH . 'class_account.php'; require_once WM_ROOTPATH . 'classic/base_defines.php'; $log =& new Logger(); if (!Session::has(ACCOUNT_ID)) { echo '<script>parent.changeLocation("' . LOGINFILE . '?error=1");</script>'; exit; } $_SESSION['attachtempdir'] = Session::val('attachtempdir', md5(session_id())); $account =& Account::LoadFromDb(Session::val(ACCOUNT_ID), -1); if (!$account) { echo '<script>parent.changeLocation("' . LOGINFILE . '?error=2");</script>'; exit; } $isNull = false; $isError = false; switch (Get::val('mode', 'none')) { case 'preview': $mes_id = Post::val('m_id'); $mes_uid = Post::val('m_uid'); $folder_id = Post::val('f_id'); $folder_name = Post::val('f_name'); $folder_name = 'defaultname'; $mes_charset = Post::val('charset', -1); if (isset($_POST['m_id'])) { require_once WM_ROOTPATH . 'classic/class_getmessagebase.php'; $error = ''; $message =& new GetMessageBase($account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); if (!$message->msg) { $isNull = true; $isError = true; break;
// ################## case 'removesubtask': //check if the user has permissions to remove the subtask if (!$user->can_edit_task($task)) { Flyspray::show_error(L('nopermission')); //TODO: create a better error message break; } //set the subtask supertask_id to 0 removing parent child relationship $db->Query("UPDATE {tasks} SET supertask_id=0 WHERE task_id = ?", array(Post::val('subtaskid'))); //write event log Flyspray::logEvent(Get::val('task_id'), 33, Post::val('subtaskid')); //post success message to the user $_SESSION['SUCCESS'] = L('subtaskremovedmsg'); //redirect the user back to the right task Flyspray::Redirect(CreateURL('details', Get::val('task_id'))); break; // ################## // removing a dependency // ################## // ################## // removing a dependency // ################## case 'removedep': if (!$user->can_edit_task($task)) { Flyspray::show_error(L('nopermission')); //TODO: create a better error message break; } $result = $db->Query('SELECT * FROM {dependencies} WHERE depend_id = ?', array(Post::val('depend_id')));
$_SESSION['SUCCESS'] = L('dependadded'); break; // ################## // removing a dependency // ################## // ################## // removing a dependency // ################## case 'removedep': if (!$user->can_edit_task($task)) { break; } $result = $db->Query('SELECT * FROM {dependencies} WHERE depend_id = ?', array(Get::val('depend_id'))); $dep_info = $db->FetchRow($result); $db->Query('DELETE FROM {dependencies} WHERE depend_id = ? AND task_id = ?', array(Get::val('depend_id'), $task['task_id'])); if ($db->AffectedRows()) { $notify->Create(NOTIFY_DEP_REMOVED, $dep_info['task_id'], $dep_info['dep_task_id']); $notify->Create(NOTIFY_REV_DEP_REMOVED, $dep_info['dep_task_id'], $dep_info['task_id']); Flyspray::logEvent($dep_info['task_id'], 24, $dep_info['dep_task_id']); Flyspray::logEvent($dep_info['dep_task_id'], 25, $dep_info['task_id']); } $_SESSION['SUCCESS'] = L('depremovedmsg'); break; // ################## // user requesting a password change // ################## // ################## // user requesting a password change // ################## case 'lostpw.sendmagic':
if (!$user->id && Get::val('user_id') && Get::val('auth')) { $user = new User(Get::val('user_id')); if (Get::val('auth') != md5($user->infos['user_pass'] . $user->infos['register_date'])) { $user = new User(); } } $page = new FSTpl(); // Set up the basic XML head header('Content-type: text/html; charset=utf-8'); $max_items = Get::num('num', 10) == 10 ? 10 : 20; $sql_project = ' 1=1 '; if ($proj->id) { $sql_project = sprintf(' t.project_id = %d', $proj->id); } $feed_type = Get::enum('feed_type', array('rss1', 'rss2', 'atom'), 'rss2'); switch (Get::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; $title = 'Recently edited tasks'; break; default: $orderby = 'date_opened'; $closed = '1=1';
<?php /* This script is the AJAX callback that performs a search for users, and returns them in an ordered list. */ define('IN_FS', true); header('Content-type: text/html; charset=utf-8'); require_once '../../header.php'; if (!$user->can_view_userlist()) { exit; } $searchterm = '%' . Get::val('user') . '%'; // Get the list of users from the global groups above $join = $where = ''; if (Get::val('onlyassignees')) { $join = 'LEFT JOIN {users_in_groups} uig ON u.user_id = uig.user_id LEFT JOIN {groups} g ON uig.group_id = g.group_id'; $where = '(g.show_as_assignees = 1 OR g.is_admin = 1) AND '; } $db->setLimit(300); $users = $db->x->getAll("SELECT u.user_id, u.real_name, u.user_name\n FROM {users} u\n {$join}\n WHERE {$where} (u.user_name LIKE ? OR u.real_name LIKE ?)", null, array($searchterm, $searchterm)); header('Content-Type: text/xml'); echo '<?xml version="1.0" encoding="utf-8" ?><results>'; foreach ($users as $row) { $row = array_map(array('Filters', 'noXSS'), $row); echo sprintf('<rs id="%s" info="%s">%s</rs>', $row['user_id'], $row['real_name'], $row['user_name']); } echo '</results>';
/** * @param PageBuilder $pageBuilder * @return ContactsPanel */ function CNewMessagePanel(&$pagebuilder) { $this->Type = Post::val('mtype', 'mes'); $this->To = ''; $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $this->From = $this->_getFromEmail(); $this->_pagebuilder->_top->AddOnResize('ResizeElements(\'all\');'); if ($this->_proc->account->AllowDhtmlEditor) { $editorResize = 'HTMLEditor.Resize(width - 1, height - 2);'; $editorReplace = 'HTMLEditor.Replace();'; } else { $editorResize = ' plainEditor.style.height = (height - 1) + "px"; plainEditor.style.width = (width - 2) + "px"; '; $editorReplace = ''; } $this->inputs = ''; $contacts = null; if (Post::has('contacts') && is_array(Post::val('contacts'))) { $contactsArray = array_keys(Post::val('contacts')); $contacts =& $this->_proc->db->LoadContactsById($contactsArray); } if (Post::has('groupid')) { $group =& $this->_proc->db->SelectGroupById(Post::val('groupid', -1)); $contacts =& $this->_proc->db->SelectAddressGroupContacts(Post::val('groupid', -1)); } if ($contacts) { foreach ($contacts->Instance() as $contact) { if (!$contact->Email) { continue; } $this->To .= $contact->Name ? '"' . $contact->Name . '" <' . $contact->Email . '>, ' : $contact->Email . ','; } $this->To = trim(trim($this->To), ','); } if (Post::has('mailto')) { $this->To = Post::val('mailto', ''); } if (Get::has('to')) { $this->To = (string) trim(Get::val('to', '')); } $message = null; $isHtml = $this->_proc->account->AllowDhtmlEditor; $this->attacmentsHtml = ''; $this->_pagebuilder->AddJSText(' var bcc, bcc_mode, bcc_mode_switcher; var plainCont = null; var plainEditor = null; var HTMLEditor = null; var EditAreaUrl = "edit-area.php"; var prevWidth = 0; var prevHeight = 0; var rowIndex = 0; function ResizeElements(mode) { var width = GetWidth(); if (width < 684) width = 684; width = width - 40; var height = Math.ceil(width/3); if (prevWidth != width && prevHeight != height) { prevWidth = width; prevHeight = height; if (plainCont != null) { plainCont.style.height = height + "px"; plainCont.style.width = width + "px"; ' . $editorResize . ' } } } function WriteEmails(str, field) { var mailInput; if (field == 2) { mailInput = document.getElementById("toCC"); } else if (field == 3) { mailInput = document.getElementById("toBCC"); } else { mailInput = document.getElementById("toemail"); } if (mailInput) { mailInput.value = (mailInput.value == "") ? str : mailInput.value + ", " + str; mailInput.focus(); } } function LoadAttachmentHandler(attachObj) { var attachtable = document.getElementById("attachmentTable"); if (attachObj) { var imageLink = GetFileParams(attachObj.FileName); var tr = attachtable.insertRow(rowIndex++); tr.id = "tr_" + attachObj.TempName; var td = tr.insertCell(0); td.className = "wm_attachment"; var innerHtml = \'<img src="./images/icons/\' + imageLink.image + \'" />\'; innerHtml += \'<input type="hidden" name="attachments[\' + attachObj.TempName + \']" value="\' + attachObj.FileName + \'">\'; innerHtml += HtmlEncode(attachObj.FileName) + \' (\' + GetFriendlySize(attachObj.Size) + \') <a href="#" id="\' + attachObj.TempName + \'" onclick="return DeleteAttach(this.id);">' . JS_LANG_Delete . '</a>\'; td.innerHTML = innerHtml; } } function ChangeBCCMode() { if (bcc_mode == "hide") { bcc_mode = "show"; bcc.className = ""; bcc_mode_switcher.innerHTML = Lang.HideBCC; } else { bcc_mode = "hide"; bcc.className = "wm_hide"; bcc_mode_switcher.innerHTML = Lang.ShowBCC; } ' . $editorReplace . ' return false; } function UpdateIdUid(id, uid) { var idf = document.getElementById("m_id"); var uidf = document.getElementById("m_uid"); if (idf && uidf) { idf.value = id; uidf.value = uid; } } var Rep_m, Err_m; var hiddensaveiframe; var pop3Pr = ' . ($pagebuilder->_proc->account->MailProtocol == MAILPROTOCOL_POP3 ? 'true' : 'false') . '; function DoSaveButton() { if (pop3Pr) { if (!hiddensaveiframe) { hiddensaveiframe = CreateChildWithAttrs(document.body, "iframe", [["name", "hiddensaveiframe"], ["class", "wm_hide"]]); } } var form = document.getElementById("messageForm"); form.action = "' . ACTIONFILE . '?action=save&req=message"; form.target = (pop3Pr) ? "hiddensaveiframe" : ""; if (submitSaveMessage()) { form.submit(); } } function DoSendButton() { var toemail = document.getElementById("toemail"); var ccemail = document.getElementById("toCC"); var bccemail = document.getElementById("toBCC"); var subject = document.getElementById("subject"); var mailIsCorrect = false; if ((toemail && toemail.value.length > 3) || (ccemail && ccemail.value.length > 3) || (bccemail && bccemail.value.length > 3)) { mailIsCorrect = true; } if (mailIsCorrect) { if (subject && subject.value.length < 1 && !confirm(Lang.ConfirmEmptySubject)) { return false; } var form = document.getElementById("messageForm"); form.action = "' . ACTIONFILE . '?action=send&req=message"; form.target = ""; if (submitSaveMessage()) { form.submit(); } } else { alert(Lang.WarningToBlank); } } function DeleteAttach(idline) { var trtable = document.getElementById("tr_" + idline); if (trtable) { trtable.className = "wm_hide"; CleanNode(trtable); } return false; } function ShowPictures() { var showPictureTable = document.getElementById("showpicturestable"); if (HTMLEditor) { var temp = HTMLEditor.GetText().ReplaceStr("wmx_src", "src"); temp = temp.ReplaceStr("wmx_background", "background"); HTMLEditor.SetHtml(temp); if (showPictureTable) { showPictureTable.className = "wm_hide"; } HTMLEditor.Replace(); } } '); $this->_pagebuilder->AddInitText(' bcc_mode = "hide"; bcc = document.getElementById("bcc"); bcc_mode_switcher = document.getElementById("bcc_mode_switcher"); plainEditor = document.getElementById("editor_area"); plainCont = document.getElementById("editor_cont"); Rep_m = new CReport("Rep_m"); Rep_m.Build(); Err_m = new CError("Err_m", "' . ConvertUtils::ClearJavaScriptString($this->_pagebuilder->SkinName(), '"') . '"); Err_m.Build(); '); $m_id = -1; $m_uid = ''; if (Post::has('m_id')) { $mes_id = Post::val('m_id'); $mes_uid = Post::val('m_uid'); $folder_id = Post::val('f_id'); $folder_name = Post::val('f_name'); $folder_name = 'defaultname'; $mes_charset = Post::val('charset', -1); $message = new GetMessageBase($this->_proc->account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); $m_id = (int) $mes_id; $m_uid = $mes_uid; } $this->inputs = '<input type="hidden" id="m_id" name="m_id" value="' . ConvertUtils::AttributeQuote($m_id) . '"><input type="hidden" id="m_uid" name="m_uid" value="' . ConvertUtils::AttributeQuote($m_uid) . '">'; $withSignature = false; switch ($this->_proc->account->SignatureOptions) { case SIGNATURE_OPTION_AddToAll: $withSignature = true; break; case SIGNATURE_OPTION_AddToNewOnly: $withSignature = $this->Type == 'mes'; break; default: case SIGNATURE_OPTION_DontAdd: $withSignature = false; break; } if ($message) { if ($this->Type != 'forward' && $this->Type != 'reply' && $this->Type != 'replytoall') { $withSignature = false; } $this->_pagebuilder->AddInitText('SetPriority(' . $message->msg->GetPriorityStatus() . ');'); switch ($this->Type) { default: $this->To = $message->PrintTo(true); $this->CC = $message->PrintCC(true); $this->BCC = ''; $this->Subject = $message->PrintSubject(true); break; case 'forward': $this->To = ''; $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Fwd . ': ' . $message->PrintSubject(true); break; case 'reply': $replyto = trim($message->PrintReplyTo(true)); $this->To = strlen($replyto) > 0 ? $replyto : $message->PrintFrom(true); $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true); break; case 'replytoall': $emailCollection =& $message->msg->GetAllRecipients(false, true); $temp = ''; if ($emailCollection) { foreach ($emailCollection->Instance() as $value) { $email =& $value; if ($email->Email != $this->_proc->account->Email) { $temp .= $email->Email . ', '; } } } $this->To = trim(trim($temp), ','); $this->CC = ''; $this->BCC = ''; $this->Subject = JS_LANG_Re . ': ' . $message->PrintSubject(true); break; } if ($this->_proc->account->AllowDhtmlEditor) { switch ($this->Type) { case 'forward': case 'reply': case 'replytoall': if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $this->isSafety = false; } } else { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetRelpyAsHtml(true)); } break; default: if ($message->account->ViewMode == VIEW_MODE_PREVIEW_PANE_NO_IMG || $message->account->ViewMode == VIEW_MODE_WITHOUT_PREVIEW_PANE_NO_IMG) { if ($message->msg->HasHtmlText()) { $isHtml = true; $this->Body = ConvertUtils::HtmlBodyWithoutImages($message->msg->GetCensoredHtmlWithImageLinks(true)); if (isset($GLOBALS[GL_WITHIMG]) && $GLOBALS[GL_WITHIMG]) { $GLOBALS[GL_WITHIMG] = false; $this->isSafety = false; } } elseif ($message->msg->HasPlainText()) { $isHtml = false; $this->Body = $message->msg->GetNotCensoredTextBody(true); } } else { if ($message->msg->HasHtmlText()) { $isHtml = true; $this->Body = $message->msg->GetCensoredHtmlWithImageLinks(true); } elseif ($message->msg->HasPlainText()) { $isHtml = false; $this->Body = $message->msg->GetNotCensoredTextBody(true); } } break; } } else { $isHtml = false; switch ($this->Type) { case 'forward': case 'reply': case 'replytoall': $this->Body = $message->msg->GetRelpyAsPlain(true); break; default: $this->Body = $message->msg->GetNotCensoredTextBody(true); break; } } if ($message->HasAttachments() && $this->Type != 'reply' && $this->Type != 'replytoall') { $attachments =& $message->msg->Attachments; if ($attachments != null && $attachments->Count() > 0) { foreach (array_keys($attachments->Instance()) as $key) { $attachment =& $attachments->Get($key); $tempname = $message->msg->IdMsg . '-' . $key . '_' . $attachment->GetTempName(); //$filename = ConvertUtils::ConvertEncoding($attachment->GetFilenameFromMime(), $GLOBALS[MailInputCharset], $message->account->GetUserCharset()); $filename = ConvertUtils::WMHtmlSpecialChars($attachment->GetFilenameFromMime()); $filesize = GetFriendlySize(strlen($attachment->MimePart->GetBinaryBody())); $fs =& new FileSystem(INI_DIR . '/temp', $message->account->Email, $message->account->Id); $attfolder =& new Folder($message->account->Id, -1, Session::val('attachtempdir', md5(session_id()))); $fs->SaveAttach($attachment, $attfolder, $tempname); $this->attacmentsHtml .= ' <tr id="tr_' . ConvertUtils::AttributeQuote($tempname) . '"><td class="wm_attachment"><img src="./images/icons/' . GetAttachImg($filename) . '" /> <input type="hidden" name="attachments[' . ConvertUtils::AttributeQuote($tempname) . ']" value="' . ConvertUtils::AttributeQuote($filename) . '"> ' . $filename . ' (' . $filesize . ') <a href="#" id="' . ConvertUtils::AttributeQuote($tempname) . '" onClick="return DeleteAttach(this.id);">' . JS_LANG_Delete . '</a></td></tr>'; } } } } else { $this->_pagebuilder->AddInitText('SetPriority(3);'); } $signature = ''; if ($withSignature) { if ($this->_proc->account->AllowDhtmlEditor) { $signature = $this->_proc->account->SignatureType == 0 ? nl2br($this->_proc->account->Signature) : $this->_proc->account->Signature; $signature = $isHtml ? $signature : strip_tags(nl2br($signature)); } else { $signature = $this->_proc->account->SignatureType == 0 ? strip_tags($this->_proc->account->Signature) : strip_tags($this->_proc->account->Signature); } } $this->Body = $signature . $this->Body; if ($this->_proc->account->AllowDhtmlEditor) { $this->_pagebuilder->AddJSFile('class.html-editor.js'); $setText = $isHtml ? 'HTMLEditor.SetHtml(mess);' : 'HTMLEditor.SetText(mess);'; $this->_pagebuilder->AddJSText(' function submitSaveMessage() { var hiddenkey = document.getElementById("ishtml"); if (HTMLEditor._htmlMode) { plainEditor.value = HTMLEditor.GetText(); hiddenkey.value = "1"; } else { hiddenkey.value = "0"; } if (bcc_mode == "hide") { document.getElementById("toBCC").value = ""; } return true; } function EditAreaLoadHandler() { HTMLEditor.LoadEditArea(); } function CreateLinkHandler(url) { HTMLEditor.CreateLinkFromWindow(url); } function DesignModeOnHandler(rer) { HTMLEditor.Show(); var mess = "' . ConvertUtils::ReBuildStringToJavaScript($this->Body, '"') . '"; if (mess.length == 0) { mess = "<br />"; } ' . $setText . ' } '); $this->_pagebuilder->AddInitText(' HTMLEditor = new CHtmlEditorField(true); HTMLEditor.SetPlainEditor(plainEditor, document.getElementById("mode_switcher")); HTMLEditor.Show();'); } else { $this->_pagebuilder->AddJSText(' function submitSaveMessage() { var hiddenkey = document.getElementById("ishtml"); hiddenkey.value = "0"; if (bcc_mode == "hide") { document.getElementById("toBCC").value = ""; } return true; } '); } }
require_once WM_ROOTPATH . 'classic/class_getmessagebase.php'; $log =& CLog::CreateInstance(); if (!Session::has(ACCOUNT_ID)) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=1");</script>'); } $_SESSION['attachtempdir'] = Session::val('attachtempdir', md5(session_id())); $account =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1)); if (!$account) { exit('<script>parent.changeLocation("' . LOGINFILE . '?error=2");</script>'); } $isNull = false; $mes_id = Get::val('msg_id', ''); $mes_uid = Get::val('msg_uid', ''); $folder_id = Get::val('folder_id', ''); $folder_name = Get::val('folder_fname', ''); $mes_charset = Get::val('charset', -1); if ($mes_uid) { $message =& new GetMessageBase($account, $mes_id, $mes_uid, $folder_id, $folder_name, $mes_charset); if (!$message->msg) { $isNull = true; } } else { $isNull = true; } if ($isNull) { exit('Null Message'); } $fullBodyText = $message->msg->HasHtmlText() ? ConvertUtils::ReplaceJSMethod($message->PrintHtmlBody(true)) : nl2br($message->PrintPlainBody()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> <html>
//PROJECT GRAPH if (Get::has('project_id') && Get::val('graph', 'project') == 'project') { $today = date('Y-m-d'); $thirtyone_days = date('U', strtotime("-31 day", strtotime($today))); $sixtyone_days = date('U', strtotime("-61 day", strtotime($today))); //look 30 + days and if found scale $projectCheck = Project::getActivityProjectCount($sixtyone_days, $thirtyone_days, Get::num('project_id')); if ($projectCheck > 0) { $data = Project::getDayActivityByProject($sixtyone_days, date('U', strtotime(date('Y-m-d'))), Get::num('project_id')); } else { $data = Project::getDayActivityByProject($thirtyone_days, date('U', strtotime(date('Y-m-d'))), Get::num('project_id')); } $data = implode(',', $data); //User Graph } else { if (Get::has('user_id') && Get::has('project_id') && Get::val('graph') == 'user') { $today = date('Y-m-d'); $thirtyone_days = date('U', strtotime("-31 day", strtotime($today))); $sixtyone_days = date('U', strtotime("-61 day", strtotime($today))); //look 30 + days and if found scale $projectCheck = Project::getActivityProjectCount($sixtyone_days, $thirtyone_days, Get::num('project_id')); if ($projectCheck > 0) { $data = User::getDayActivityByUser($sixtyone_days, date('U', strtotime(date('Y-m-d'))), Get::num('project_id'), Get::num('user_id')); } else { $data = User::getDayActivityByUser($thirtyone_days, date('U', strtotime(date('Y-m-d'))), Get::num('project_id'), Get::num('user_id')); } $data = implode(',', $data); } else { $data = ''; } }
/** * @return BaseProcessor */ function BaseProcessor() { if (!Session::has(ACCOUNT_ID)) { $this->SetError(1); } $accountId = Session::val(ACCOUNT_ID); $this->sArray = Session::val(SARRAY, array()); $this->settings =& Settings::CreateInstance(); if (!$this->settings || !$this->settings->isLoad) { $this->SetError(3); } if ($accountId) { if (Get::has(CHANGE_ACCID)) { $oldaccount =& Account::LoadFromDb(Session::val(ACCOUNT_ID, -1)); $accountId = Get::val(CHANGE_ACCID); if (!isset($_SESSION['attachtempdir'])) { $_SESSION['attachtempdir'] = md5(session_id()); } $fs =& new FileSystem(INI_DIR . '/temp', $oldaccount->Email, $oldaccount->Id); $attfolder =& new Folder($oldaccount->Id, -1, $_SESSION['attachtempdir']); $fs->DeleteDir($attfolder); unset($fs, $attfolder); $this->sArray[ACCOUNT_ID] = $accountId; $this->account =& Account::LoadFromDb($accountId); if (!$this->account || $this->account->IdUser != $oldaccount->IdUser) { $this->account = null; } else { $_SESSION[ACCOUNT_ID] = $accountId; unset($_SESSION[SARRAY]); $this->sArray = array(); } } else { $this->sArray[ACCOUNT_ID] = $accountId; $this->account =& Account::LoadFromDb($accountId); } if (!$this->account) { $this->SetError(2); } } else { $this->SetError(1); } if (!isset($this->sArray[ACCOUNT_ID]) || $this->sArray[ACCOUNT_ID] != $accountId) { $this->sArray[EDIT_ACCOUNT_ID] = $accountId; } $this->processor =& new MailProcessor($this->account); if (!$this->processor->DbStorage || !$this->processor->DbStorage->Connect()) { $this->SetError(5); } $this->db =& $this->processor->DbStorage; $this->accounts =& $this->GetAccounts(); $skins =& FileSystem::GetSkinsList(); $hasDefSettingsSkin = false; $normalSkin = false; foreach ($skins as $skinName) { if ($skinName == $this->settings->DefaultSkin) { $hasDefSettingsSkin = true; } if ($skinName == $this->account->DefaultSkin) { $normalSkin = true; break; } } if (!$normalSkin) { $this->account->DefaultSkin = $hasDefSettingsSkin ? $this->settings->DefaultSkin : ($this->account->DefaultSkin = $skins[0]); } $_SESSION[ATTACH_DIR] = Session::val(ATTACH_DIR, md5(session_id())); if (isset($this->sArray[SCREEN])) { $screen = Get::val(SCREEN, $this->sArray[SCREEN]); $this->sArray[SCREEN] = $screen; if ($this->account->AllowChangeSettings == false && ($screen == SET_ACCOUNT_PROF || $screen == SET_ACCOUNT_ADDACC)) { $this->sArray[SCREEN] = SCREEN_MAILBOX; } if (!$this->settings->AllowContacts && $screen == SCREEN_CONTACTS) { $this->sArray[SCREEN] = SCREEN_MAILBOX; } } else { $this->sArray[SCREEN] = Get::val(SCREEN, SCREEN_MAILBOX); } if (isset($this->sArray[FOLDER_ID])) { $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, $this->sArray[FOLDER_ID]); } else { $this->sArray[FOLDER_ID] = Get::val(FOLDER_ID, -1); } if (Get::has(FOLDER_ID) || Get::has(SCREEN)) { if (isset($this->sArray[SEARCH_ARRAY])) { unset($this->sArray[SEARCH_ARRAY]); } } if (Session::has(GOTOFOLDER)) { $this->sArray[GOTOFOLDER] = Session::val(GOTOFOLDER, ''); unset($_SESSION[GOTOFOLDER]); } if (isset($this->sArray[PAGE])) { $this->sArray[PAGE] = Get::val(PAGE, $this->sArray[PAGE]); } else { $this->sArray[PAGE] = 1; } if (Get::has(S_GETMODE)) { $this->sArray[SEARCH_ARRAY][S_TEXT] = Get::val(S_GETMODE, 'mini') == 'mini' ? Post::val('smallLookFor', '') : Post::val('bigLookFor', ''); if (!empty($this->sArray[SEARCH_ARRAY][S_TEXT])) { $this->sArray[SEARCH_ARRAY][S_FOLDER] = Post::val('qfolder', -2); $this->sArray[SEARCH_ARRAY][S_MODE] = Post::val('qmmode', 'onlyheaders'); $this->sArray[FOLDER_ID] = $this->sArray[SEARCH_ARRAY][S_FOLDER]; $this->sArray[PAGE] = 1; } else { if (Post::val('qfolder', -2) < 1) { $this->sArray[FOLDER_ID] = -1; } unset($this->sArray[SEARCH_ARRAY]); $this->sArray[PAGE] = 1; } } if (Get::has(S_GETMODECONTACT)) { $this->sArray[SEARCH_ARRAY][S_TEXT] = Get::val(S_GETMODECONTACT, 'mini') == 'mini' ? Post::val('smallLookFor', '') : Post::val('bigLookFor', ''); $this->sArray[CONTACT_ID] = Post::val(CONTACT_ID, -1); $this->sArray[CONTACT_PAGE] = 1; } if (isset($this->sArray[SEARCH_ARRAY][S_FOLDER])) { $this->sArray[FOLDER_ID] = $this->sArray[SEARCH_ARRAY][S_FOLDER]; } if (isset($this->sArray[EDIT_ACCOUNT_ID])) { $this->sArray[EDIT_ACCOUNT_ID] = Get::val(EDIT_ACCOUNT_ID, $this->sArray[EDIT_ACCOUNT_ID]); } else { $this->sArray[EDIT_ACCOUNT_ID] = $accountId; } if (Get::has(EDIT_ACCOUNT_ID)) { $this->sArray[SCREEN] = $this->sArray[SCREEN] == SET_ACCOUNT_ADDACC ? SET_ACCOUNT_PROF : $this->sArray[SCREEN]; } $this->sArray[CONTACT_PAGE] = isset($this->sArray[CONTACT_PAGE]) ? Get::val(CONTACT_PAGE, $this->sArray[CONTACT_PAGE]) : Get::val(CONTACT_PAGE, 1); $this->sArray[CONTACT_ORD] = isset($this->sArray[CONTACT_ORD]) ? Get::val(CONTACT_ORD, $this->sArray[CONTACT_ORD]) : Get::val(CONTACT_ORD, 0); if (isset($this->sArray[CONTACT_FLD])) { if (Get::val(CONTACT_FLD, $this->sArray[CONTACT_FLD]) != $this->sArray[CONTACT_FLD]) { $this->sArray[CONTACT_ORD] = 0; } $this->sArray[CONTACT_FLD] = Get::val(CONTACT_FLD, $this->sArray[CONTACT_FLD]); } else { $this->sArray[CONTACT_FLD] = Get::val(CONTACT_FLD, 0); } if (isset($_COOKIE['wm_vert_resizer']) || isset($_COOKIE['wm_horiz_resizer']) || isset($_COOKIE['wm_hide_folders'])) { if (isset($_COOKIE['wm_vert_resizer']) && strlen($_COOKIE['wm_vert_resizer']) > 0) { $this->account->VertResizer = (int) $_COOKIE['wm_vert_resizer']; setcookie('wm_vert_resizer', '0', time() - 24 * 3600); } if (isset($_COOKIE['wm_horiz_resizer']) && strlen($_COOKIE['wm_horiz_resizer']) > 0) { $this->account->HorizResizer = (int) $_COOKIE['wm_horiz_resizer']; setcookie('wm_horiz_resizer', '0', time() - 24 * 3600); } if (isset($_COOKIE['wm_hide_folders']) && strlen($_COOKIE['wm_hide_folders']) > 0) { $this->account->HideFolders = (bool) $_COOKIE['wm_hide_folders']; setcookie('wm_hide_folders', '0', time() - 24 * 3600); } $this->account->Update(); } $this->FillData(); $this->UpdateSession(); }