function msgGrantCreate($DATA, &$subject, &$body) { $subject = T_("[dl] upload grant link"); $body = !empty($DATA['cmt']) ? $DATA['cmt'] . "\n\n" : ""; if (!isset($DATA['pass'])) { $body .= grantUrl($DATA); } else { $body .= T_("URL:") . " " . grantUrl($DATA) . "\n" . T_("Password:"******" " . $DATA['pass'] . "\n"; } }
function newgrant($msg, $params = null) { global $grantRestParams; // handle the request $DATA = false; if ($validated = validateParams($grantRestParams, $msg)) { $DATA = handleGrant($msg); } if ($DATA === false) { // grant creation unsucessfull if ($validated) { logError('invalid grant parameters'); return array('httpInternalError', 'internal error'); } else { // errors already generated in handleGrant return array('httpBadRequest', 'bad parameters'); } } // return grant instance return array(false, array("id" => $DATA['id'], "url" => grantUrl($DATA))); }
<tbody> <?php foreach ($db->query($sql) as $DATA) { if (isGrantExpired($DATA)) { continue; } $our = $DATA["user_id"] == $auth["id"]; $class = "file expanded " . $DATA['id']; if ($our) { $class .= " our"; } echo "<tr class=\"{$class}\">"; // selection echo "<td><input class=\"element checkbox\" type=\"checkbox\" name=\"sel[]\" value=\"" . $DATA['id'] . "\"/></td>"; // upload echo '<td><a href="' . grantUrl($DATA) . '">' . '<img title="' . T_("Upload") . "\" src=\"{$style}/static/upload.png\"/></a></td>"; // delete echo "<td><a href=\"" . pageLinkAct(array('purge' => null, 'sel' => $DATA['id'])) . "\">" . "<img title=\"" . T_("Purge") . "\" src=\"{$style}/static/cross.png\"/></a></td>"; // name echo '<td class="ticketid">' . htmlEntUTF8($DATA['id']) . '</td>'; // user echo "<td>" . htmlEntUTF8($DATA["user"]) . "</td>"; // date echo '<td data-sort-value="' . $DATA["time"] . '">' . date($dateFmtShort, $DATA["time"]) . '</td>'; // expire $expStr = grantExpiration($DATA, $expVal); echo "<td data-sort-value=\"{$expVal}\">{$expStr}</td>"; echo "</tr>"; } ?> </tbody>
<?php require_once "pages.php"; $act = false; pageHeader(array('title' => T_("Grant result"))); // final url msgGrantCreate($DATA, $subject, $body); $url = grantUrl($DATA); $mailto = "mailto:?subject=" . rawurlencode($subject) . "&body=" . rawurlencode($body); ?> <div> <label class="description"> <?php printf(T_("Your grant %s"), htmlEntUTF8(grantStr($DATA))); ?> </label> <p><span class="ticketid"><?php echo htmlentities($url); ?> </span></p> <?php if ($DATA['pass']) { echo "<p>" . T_("The required password is:") . " <tt>" . htmlEntUTF8($DATA['pass']) . "</tt></p>"; } if ($DATA['sent_email']) { echo "<p>" . T_("A grant link has been sent to:") . " "; $addrs = getEMailAddrs($DATA['sent_email']); foreach ($addrs as &$addr) { $addr = '<a href="mailto:' . urlencode($addr) . '">' . htmlentities($addr) . '</a>'; }