require_once('./includes/api_attachment.php');
require_once('./includes/api_comment.php');
-APIError(array(new API_Error_Handler($message), 'user_cumulative'));
-
if (isset($input->in['attachmentid']))
{
$attachment = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "attachment WHERE attachmentid = " . $input->inputClean('attachmentid', TYPE_UINT));
require_once('./includes/class_logging.php');
-$notif = new NotificationCenter;
+$notif = new NotificationCenter();
$notif->set_bug_data($bug);
// ###################################################################
BSApp::debug("max_allowed_packet = $var[Value]");
// create alias
- $FILE =& $_FILES['attachment'];
+ $FILE = &$_FILES['attachment'];
// PHP errors
switch ($FILE['error'])
{
$db->query("UPDATE " . TABLE_PREFIX . "attachment SET obsolete = 1 WHERE attachmentid IN (" . implode(',', $obsoletes) . ") AND !obsolete AND bugid = $bug[bugid]");
- foreach ($obsoletes AS $attachmentid)
+ foreach ($obsoletes as $attachmentid)
{
$log = new Logging;
$log->set_bugid($bug['bugid']);
$obsoletes .= "<div><input name=\"obsoletes[]\" type=\"checkbox\" value=\"$obsolete[attachmentid]\"" . (is_array($input->in['obsoletes']) AND in_array($obsolete['attachmentid'], $input->in['obsoletes']) ? ' checked="checked"' : '') . " /> $obsolete[filename]" . ($obsolete['description'] ? " [$obsolete[description]]" : '') . "</div>\n";
}
- eval('$template->flush("' . $template->fetch('newattach') . '");');
+ $tpl = new BSTemplate('newattach');
+ $tpl->vars = array(
+ 'bug' => $bug,
+ 'message' => $message,
+ 'MAXFILESIZE' => $MAXFILESIZE,
+ 'obsoletes' => $obsoletes,
+ 'input' => $input
+ );
+ $tpl->evaluate()->flush();
}
// ###################################################################
$attachapi = new AttachmentAPI();
$attachapi->set('attachmentid', $input->in['attachmentid']);
- $attachapi->dorelations = array();
- $attachapi->set_condition();
if ($input->in['__delete__'] != '')
{
}
else
{
- $log = new Logging;
+ $log = new Logging();
$log->set_bugid($bug['bugid']);
$log->set_attachmentid($input->in['attachmentid']);
$show['delete'] = (can_perform('caneditattach', $bug['product']) AND can_perform('candeletedata', $bug['productid']));
- eval('$template->flush("' . $template->fetch('editattach') . '");');
+ $tpl = new BSTemplate('editattach');
+ $tpl->vars = array(
+ 'attachment' => $attachment,
+ 'bug' => $bug
+ );
+ $tpl->evaluate()->flush();
}
/*=====================================================================*\
|| ###################################################################
\*=====================================================================*/
-$GLOBALS['isso:callback']->load('api', null);
+require_once ISSO . '/Api.php';
/**
* API: Attachment
* @package Bugdar
*
*/
-class AttachmentAPI extends API
+class AttachmentAPI extends BSApi
{
/**
* Fields
*/
function fetch_user_cache()
{
- $newbuggers = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "useremail WHERE relation = " . bugdar::$emailOptions['relations']['-notapplicable-'] . " AND mask & " . bugdar::$emailOptions['notifications']['newbug']);
+ $newbuggers = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "useremail WHERE relation = " . bugdar::$emailOptions['relations']['-notapplicable-'] . " AND mask & " . bugdar::$emailOptions['notifications']['newbug']);
foreach ($newbuggers as $newbug)
{
$this->roles['-notapplicable-']["$newbug[userid]"] = $newbug['userid'];
}
- $favorites = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT));
+ $favorites = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "favorite WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT));
foreach ($favorites as $fav)
{
$this->roles['favorite']["$fav[userid]"] = $fav['userid'];
}
- $voters = $this->registry->db->query_first("SELECT userids FROM " . TABLE_PREFIX . "vote WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT));
+ $voters = BSApp::$db->queryFirst("SELECT userids FROM " . TABLE_PREFIX . "vote WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT));
$this->roles['voter'] = preg_split('#,#', $voters['userids'], 0, PREG_SPLIT_NO_EMPTY);
- $commenters = $this->registry->db->query("SELECT userid FROM " . TABLE_PREFIX . "comment WHERE bugid = " . $this->registry->clean($this->bug['bugid'], TYPE_UINT));
+ $commenters = BSApp::$db->query("SELECT userid FROM " . TABLE_PREFIX . "comment WHERE bugid = " . BSApp::$input->clean($this->bug['bugid'], TYPE_UINT));
foreach ($commenters as $comment)
{
$this->roles['commenter']["$comment[userid]"] = $comment['userid'];
if (is_array($masterids) AND sizeof($masterids) > 0)
{
- $userinfo = $this->registry->db->query("
+ $userinfo = BSApp::$db->query("
SELECT user.*, useremail.*
FROM " . TABLE_PREFIX . "useremail AS useremail
LEFT JOIN " . TABLE_PREFIX . "user AS user
function finalize()
{
// get the current bug for permissions checks
- $bug = $this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $this->bug['bugid']);
+ $bug = BSApp::$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $this->bug['bugid']);
foreach ($this->notices AS $userid => $noticelist)
{
if ($userid == bugdar::$userinfo['userid'])
<div class="box">
<div class="box-head" style="text-align: <%- $stylevar['left'] %>">
- <lang 1="$attachment[attachmentid]" 2="$bug[bugid]" 3="$bug[summary]">{@"Attachment #%1$s for Bug #%2$s %3$s"}</lang>
+ <%- sprintf(T('Attachment #%1$s for Bug #%2$s %3$s'), $attachment['attachmentid'], $bug['bugid'], $bug['summary']) %>
</div>
<div class="box-mid box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>">
</form>
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file
<body>
-$header
+<%- $header %>
<% if ($show['errors']): %>
<div class="error" style="text-align: <%- $stylevar['left'] %>">
<input name="MAX_FILE_SIZE" type="hidden" value="<%- $MAXFILESIZE %>" />
<div class="box">
- <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><lang 1="$bug[bugid]" 2="$bug[summary]">{@"New Attachment for Bug #%1$s %2$s"}</lang></div>
+ <div class="box-head" style="text-align: <%- $stylevar['left'] %>"><%- sprintf(T('New Attachment for Bug #%1$s %2$s'), $bug['bugid'], $bug['summary']) %></div>
<div class="box-mid box-margmod-bottom" style="text-align: <%- $stylevar['left'] %>">
<div><input name="attachment" type="file" /></div>
<div id="submitrow">
<input name="submit" type="submit" value=" <%-T("Submit")%> " accesskey="s" />
<input name="reset" type="reset" value=" <%-T("Reset")%> " accesskey="r" />
- <script type="text/javascript"> draw_cancel("showreport.php?bugid=$bug[bugid]"); </script>
+ <script type="text/javascript"> draw_cancel("showreport.php?bugid=<%- $bug['bugid'] %>"); </script>
</div>
</form>
-$footer
\ No newline at end of file
+<%- $footer %>
\ No newline at end of file