本文整理汇总了PHP中CreateURL函数的典型用法代码示例。如果您正苦于以下问题:PHP CreateURL函数的具体用法?PHP CreateURL怎么用?PHP CreateURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CreateURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tpl_list_heading
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);
}
示例2: SPITFORM
function SPITFORM($project, $message, $errors)
{
global $this_user;
$message = CleanString($message);
if ($errors) {
echo "<table class=nogrid\n align=center border=0 cellpadding=6 cellspacing=0>\n <tr>\n <th align=center colspan=2>\n <font size=+1 color=red>\n Oops, please fix the following errors! \n </font>\n </td>\n </tr>\n";
while (list($name, $message) = each($errors)) {
# XSS prevention.
$message = CleanString($message);
echo "<tr>\n <td align=right>\n <font color=red>{$name}: </font></td>\n <td align=left>\n <font color=red>{$message}</font></td>\n </tr>\n";
}
echo "</table><br>\n";
}
#
# Show stuff
#
$project->Show();
$url = CreateURL("resendapproval", $project);
echo "<br>";
echo "<table align=center border=1>\n";
echo "<form action='{$url}' method='post'>\n";
echo "<tr>\n <td>Use the text box (70 columns wide) to add a message to the\n email notification. </td>\n </tr>\n";
echo "<tr>\n <td align=center class=left>\n <textarea name=message rows=15 cols=70></textarea>\n </td>\n </tr>\n";
echo "<tr>\n <td align=center>\n <b><input type='submit' value='Submit' name='submit'></td>\n </tr>\n </form>\n </table>\n";
}
示例3: SPITFORM
function SPITFORM($formfields, $errors)
{
global $instance, $runidx, $TBDB_ARCHIVE_TAGLEN, $referrer;
$iid = $instance->id();
$runid = $instance->GetRunID($runidx);
echo $instance->RunPageHeader($runidx);
echo "<br><br><center>\n Revise Record {$runid} in Instance {$iid} </center><br>\n";
if ($errors) {
echo "<table class=nogrid\n align=center border=0 cellpadding=6 cellspacing=0>\n <tr>\n <th align=center colspan=2>\n <font size=+1 color=red>\n Oops, please fix the following errors! \n </font>\n </td>\n </tr>\n";
while (list($name, $message) = each($errors)) {
# XSS prevention.
$message = CleanString($message);
echo "<tr>\n <td align=right>\n <font color=red>{$name}: </font></td>\n <td align=left>\n <font color=red>{$message}</font></td>\n </tr>\n";
}
echo "</table><br>\n";
}
# XSS prevention.
while (list($key, $val) = each($formfields)) {
$formfields[$key] = CleanString($val);
}
$url = CreateURL("record_revise", $instance, "runidx", $runidx);
echo "<table align=center border=1> \n <form action='{$url}' method=post>\n";
if (isset($referrer)) {
$url = urlencode($referrer);
echo "<input type=hidden name=referrer value='{$url}'>\n";
}
echo "<tr>\n <td align=center>\n <b>Please enter a message to be logged\n with the revision</b>\n </td>\n </tr>\n <tr>\n <td align=center class=left>\n <textarea name=\"formfields[message]\"\n rows=10 cols=70>" . str_replace("\r", "", $formfields["message"]) . "</textarea>\n </td>\n </tr>\n";
echo "<tr>\n <td align=center>\n <b><input type=submit name=submit value='Revise Record'></b>\n </td>\n </tr>\n";
echo "</form>\n </table>\n";
echo "<blockquote><blockquote>\n <ul>\n <li> This operation will update the end of run archive that was\n saved when the run originally completed. The original record\n will not be lost, and you can update as many times as you\n like.</li>\n </ul>\n </blockquote></blockquote>\n";
}
示例4: action_updateproject
function action_updateproject()
{
global $proj, $db, $baseurl;
if (Post::val('delete_project')) {
$url = Post::val('move_to') ? CreateURL(array('pm', 'proj' . Post::num('move_to'), 'prefs')) : $baseurl;
if (Backend::delete_project($proj->id, Post::val('move_to'))) {
return array(SUBMIT_OK, L('projectdeleted'), $url);
} else {
return array(ERROR_INPUT, L('projectnotdeleted'), $url);
}
}
if (!Post::val('project_title')) {
return array(ERROR_RECOVER, L('emptytitle'));
}
$cols = array('project_title', 'theme_style', 'lang_code', 'default_task', 'default_entry', 'intro_message', 'notify_email', 'notify_jabber', 'notify_subject', 'notify_reply', 'feed_description', 'feed_img_url', 'svn_user', 'svn_url', 'svn_password', 'mail_headers');
$args = array_map('Post_to0', $cols);
foreach (array('others_view', 'anon_open', 'send_digest', 'anon_view_tasks', 'anon_group', 'comment_closed', 'auto_assign', 'roadmap_field', 'override_user_lang') as $name) {
$cols[] = $name;
$args[] = Post::num($name);
}
foreach (array('notify_types', 'changelog_reso', 'syntax_plugins') as $name) {
$cols[] = $name;
$args[] = implode(' ', (array) Post::val($name));
}
// invalidate the cache if necessary
if (implode(' ', (array) Post::val('syntax_plugins')) != $proj->prefs['syntax_plugins']) {
$db->execParam('DELETE FROM {cache} WHERE project_id = ?', $proj->id);
}
// carefully check the project prefix...
$prefix = Post::val('project_prefix');
// already in use?
$use = $db->x->GetOne('SELECT project_id FROM {projects} WHERE project_prefix = ? AND project_id != ?', null, array($prefix, $proj->id));
if (Filters::isAlnum($prefix) && $prefix != 'FS' && !$use) {
$cols[] = 'project_prefix';
$args[] = $prefix;
} else {
return array(ERROR_RECOVER, L('badprefix'));
}
$cols[] = 'last_updated';
$args[] = time();
$cols[] = 'default_cat_owner';
$args[] = Flyspray::UserNameToId(Post::val('default_cat_owner'));
$db->x->autoExecute('{projects}', array_combine($cols, $args), MDB2_AUTOQUERY_UPDATE, sprintf('project_id = %d', $proj->id));
$db->x->execParam('UPDATE {projects} SET visible_columns = ? WHERE project_id = ?', array(trim(Post::val('visible_columns')), $proj->id));
return array(SUBMIT_OK, L('projectupdated'));
}
示例5: action_newtask
function action_newtask()
{
global $user;
list($task_id, $token, $ok) = Backend::create_task($_POST);
// Status and redirect
if ($ok) {
$url = CreateURL(array('details', 'task' . $task_id));
if ($user->isAnon()) {
$url = CreateURL(array('details', 'task' . $task_id), array('task_token' => $token));
}
if (Post::val('more_tasks')) {
$url = '';
}
return array(SUBMIT_OK, L('newtaskadded'), $url);
} else {
return array($task_id, $token);
// create_task will out error info there
}
}
示例6: foreach
foreach ($popups as $i => $popup) {
echo "{$popup}\n";
}
#
# Find all logs associated with this slice.
#
$query_result = DBQueryFatal("select m.logidx,l.logid,l.date_created,m2.metaval " . " from logfile_metadata as m " . "left join logfiles as l on l.logidx=m.logidx " . "left join logfile_metadata as m2 on " . " m2.logidx=m.logidx and m2.metakey='Method' " . "where m.metakey='slice_idx' and m.metaval='{$slice_idx}' " . "order by l.date_created asc");
if ($query_result && mysql_num_rows($query_result)) {
$table = array('#id' => 'logfiles', '#title' => "Log Files", '#headings' => array("idx" => "ID", "method" => "Op", "created" => "Created", "log" => "Link"));
$rows = array();
$img = "<img border='0' src='greenball.gif' />";
while ($row = mysql_fetch_array($query_result)) {
$logidx = $row["logidx"];
$logid = $row["logid"];
$op = $row["metaval"];
$date = $row["date_created"];
$url = CreateURL("spewlogfile", "logfile", $logid);
$row = array("idx" => $logidx, "method" => $op, "created" => $date, "log" => "<a href='{$url}'>{$img}</a>");
$rows[] = $row;
}
list($html, $button) = TableRender($table, $rows);
echo $html;
echo "<center>\n <a href='showslicelogs.php?slice_idx={$slice_idx}&download=1'>\n Download All Logs</a></center>";
}
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
示例7: Show
function Show($short = 0, $sortby = "")
{
global $TBDBNAME, $TBDOCBASE, $WIKIDOCURL;
$pid = $this->pid();
$eid = $this->eid();
$nodecounts = array();
# Node counts, by class.
$query_result = DBQueryFatal("select nt.class,count(*) from reserved as r " . "left join nodes as n on n.node_id=r.node_id " . "left join node_types as nt on n.type=nt.type " . "where pid='{$pid}' and eid='{$eid}' group by nt.class");
while ($row = mysql_fetch_array($query_result)) {
$class = $row[0];
$count = $row[1];
$nodecounts[$class] = $count;
}
$query_result = DBQueryFatal("select e.*, s.archive_idx, pl.slicename, " . "round(e.minimum_nodes+.1,0) as min_nodes, " . "round(e.maximum_nodes+.1,0) as max_nodes " . " from experiments as e " . "left join experiment_stats as s on s.exptidx=e.idx " . "left join plab_slices as pl" . " on e.pid = pl.pid and e.eid = pl.eid " . "where e.pid='{$pid}' and e.eid='{$eid}'");
if (($exprow = mysql_fetch_array($query_result)) == 0) {
TBERROR("Experiment {$eid} in project {$pid} is gone!\n", 1);
}
$exp_gid = $exprow["gid"];
$exp_name = $exprow["expt_name"];
$exp_swapped = $exprow["expt_swapped"];
$exp_swapuid = $exprow["expt_swap_uid"];
$exp_end = $exprow["expt_end"];
$exp_created = $exprow["expt_created"];
$exp_head = $exprow["expt_head_uid"];
$exp_swapper = $exprow["swapper_idx"];
$exp_state = $exprow["state"];
$exp_shared = $exprow["shared"];
$exp_path = $exprow["path"];
$batchmode = $exprow["batchmode"];
$canceled = $exprow["canceled"];
$attempts = $exprow["attempts"];
$expt_locked = $exprow["expt_locked"];
$priority = $exprow["priority"];
$swappable = $exprow["swappable"];
$noswap_reason = $exprow["noswap_reason"];
$idleswap = $exprow["idleswap"];
$idleswap_timeout = $exprow["idleswap_timeout"];
$noidleswap_reason = $exprow["noidleswap_reason"];
$autoswap = $exprow["autoswap"];
$autoswap_timeout = $exprow["autoswap_timeout"];
$idle_ignore = $exprow["idle_ignore"];
$savedisk = $exprow["savedisk"];
$swapreqs = $exprow["swap_requests"];
$lastswapreq = $exprow["last_swap_req"];
$minnodes = $exprow["min_nodes"];
$maxnodes = $exprow["max_nodes"];
$virtnodes = $exprow["virtnode_count"];
$syncserver = $exprow["sync_server"];
$mem_usage = $exprow["mem_usage"];
$cpu_usage = $exprow["cpu_usage"];
$exp_slice = $exprow["slicename"];
$linktest_level = $exprow["linktest_level"];
$linktest_pid = $exprow["linktest_pid"];
$usemodelnet = $exprow["usemodelnet"];
$mnet_cores = $exprow["modelnet_cores"];
$mnet_edges = $exprow["modelnet_edges"];
$lockdown = $exprow["lockdown"];
$skipvlans = $exprow["skipvlans"];
$exptidx = $exprow["idx"];
$archive_idx = $exprow["archive_idx"];
$dpdb = $exprow["dpdb"];
$dpdbname = $exprow["dpdbname"];
$dpdbpassword = $exprow["dpdbpassword"];
$uuid = $exprow["eid_uuid"];
$paniced = $exprow["paniced"];
$panic_date = $exprow["panic_date"];
$autoswap_hrs = $autoswap_timeout / 60.0;
$idleswap_hrs = $idleswap_timeout / 60.0;
$noswap = "({$noswap_reason})";
$noidleswap = "({$noidleswap_reason})";
$autoswap_str = $autoswap_hrs . " hour" . ($autoswap_hrs == 1 ? "" : "s");
$idleswap_str = $idleswap_hrs . " hour" . ($idleswap_hrs == 1 ? "" : "s");
if (!($head_user = User::Lookup($exp_head))) {
TBERROR("Error getting object for user {$exp_head}", 1);
}
$showuser_url = CreateURL("showuser", $head_user);
if (!($swapper = User::Lookup($exp_swapper))) {
TBERROR("Error getting object for user {$exp_swapper}", 1);
}
$swapper_uid = $swapper->uid();
$swapper_url = CreateURL("showuser", $swapper);
if ($swappable) {
$swappable = "Yes";
} else {
$swappable = "<b>No</b> {$noswap}";
}
if ($idleswap) {
$idleswap = "Yes (after {$idleswap_str})";
} else {
$idleswap = "<b>No</b> {$noidleswap}";
}
if ($autoswap) {
$autoswap = "<b>Yes</b> (after {$autoswap_str})";
} else {
$autoswap = "No";
}
if ($idle_ignore) {
$idle_ignore = "<b>Yes</b>";
} else {
$idle_ignore = "No";
//.........这里部分代码省略.........
示例8: SPITFORM
function SPITFORM($formfields, $errors)
{
global $form, $fields, $root, $template, $prevsearch, $this_user;
if ($savedsearches = $root->SavedSearches($this_user)) {
$action = CreateURL("template_search", $template);
echo "<script language=JavaScript>\n function PreviousSearch() {\n var index = document.prevsearch.prevselect.selectedIndex;\n document.prevsearch.target='_self';\n document.prevsearch.action='{$action}' + '&prevsearch=' +\n document.prevsearch.prevselect.options[index].value;\n document.prevsearch.submit();\n }\n </script>\n";
echo "<form name=prevsearch onsubmit=\"return false;\"\n action=foo method=post>\n";
echo FormRenderSelect("savedsearches", array('#type' => 'select', '#default' => 'Choose a Previous Search', '#options' => $savedsearches, '#name' => 'prevselect', '#javascript' => "onchange=\"PreviousSearch();\""));
echo "</form>\n";
}
if (isset($prevsearch)) {
#
# Lets add a primitive mechanism to allow saved search deletion.
# Add a delete button to the saved search row.
#
$fields['save']['#elements']['deletesearch'] = array('#type' => 'image', '#value' => "{$prevsearch}", '#image' => "trash.jpg");
}
$fields['submits'] = array('#type' => 'list', '#colspan' => TRUE, '#elements' => array('addclause' => array('#type' => 'submit', '#value' => "Add Clause"), 'search' => array('#type' => 'submit', '#value' => "Search")));
echo "<center>";
FormRender($form, $errors, $fields, $formfields);
echo "</center>";
}
示例9: create_task
//.........这里部分代码省略.........
#array_unshift($sql_values, $task_id);
$sql_keys_string = join(', ', $sql_keys);
$sql_placeholder = $db->fill_placeholders($sql_values);
$result = $db->Query("INSERT INTO {tasks}\n ({$sql_keys_string})\n VALUES ({$sql_placeholder})", $sql_values);
$task_id = $db->Insert_ID();
Backend::upload_links($task_id);
// create tags
if (isset($args['tags'])) {
$tagList = explode(';', $args['tags']);
$tagList = array_map('strip_tags', $tagList);
$tagList = array_map('trim', $tagList);
$tagList = array_unique($tagList);
# avoid duplicates for inputs like: "tag1;tag1" or "tag1; tag1<p></p>"
foreach ($tagList as $tag) {
if ($tag == '') {
continue;
}
# old tag feature
#$result2 = $db->Query("INSERT INTO {tags} (task_id, tag) VALUES (?,?)",array($task_id,$tag));
# new tag feature. let's do it in 2 steps, it is getting too complicated to make it cross database compatible, drawback is possible (rare) race condition (use transaction?)
$res = $db->Query("SELECT tag_id FROM {list_tag} WHERE (project_id=0 OR project_id=?) AND tag_name LIKE ? ORDER BY project_id", array($proj->id, $tag));
if ($t = $db->FetchRow($res)) {
$tag_id = $t['tag_id'];
} else {
if ($proj->prefs['freetagging'] == 1) {
# add to taglist of the project
$db->Query("INSERT INTO {list_tag} (project_id,tag_name) VALUES (?,?)", array($proj->id, $tag));
$tag_id = $db->Insert_ID();
} else {
continue;
}
}
$db->Query("INSERT INTO {task_tag}(task_id,tag_id) VALUES(?,?)", array($task_id, $tag_id));
}
}
// Log the assignments and send notifications to the assignees
if (isset($args['rassigned_to']) && is_array($args['rassigned_to'])) {
// Convert assigned_to and store them in the 'assigned' table
foreach ($args['rassigned_to'] as $val) {
$db->Replace('{assigned}', array('user_id' => $val, 'task_id' => $task_id), array('user_id', 'task_id'));
}
// Log to task history
Flyspray::logEvent($task_id, 14, implode(' ', $args['rassigned_to']));
// Notify the new assignees what happened. This obviously won't happen if the task is now assigned to no-one.
$notify->Create(NOTIFY_NEW_ASSIGNEE, $task_id, null, $notify->SpecificAddresses($args['rassigned_to']), NOTIFY_BOTH, $proj->prefs['lang_code']);
}
// Log that the task was opened
Flyspray::logEvent($task_id, 1);
$result = $db->Query('SELECT *
FROM {list_category}
WHERE category_id = ?', array($args['product_category']));
$cat_details = $db->FetchRow($result);
// We need to figure out who is the category owner for this task
if (!empty($cat_details['category_owner'])) {
$owner = $cat_details['category_owner'];
} else {
// check parent categories
$result = $db->Query('SELECT *
FROM {list_category}
WHERE lft < ? AND rgt > ? AND project_id = ?
ORDER BY lft DESC', array($cat_details['lft'], $cat_details['rgt'], $cat_details['project_id']));
while ($row = $db->FetchRow($result)) {
// If there's a parent category owner, send to them
if (!empty($row['category_owner'])) {
$owner = $row['category_owner'];
break;
}
}
}
if (!isset($owner)) {
$owner = $proj->prefs['default_cat_owner'];
}
if ($owner) {
if ($proj->prefs['auto_assign'] && ($args['item_status'] == STATUS_UNCONFIRMED || $args['item_status'] == STATUS_NEW)) {
Backend::add_to_assignees($owner, $task_id, true);
}
Backend::add_notification($owner, $task_id, true);
}
// Reminder for due_date field
if (!empty($sql_args['due_date'])) {
Backend::add_reminder($task_id, L('defaultreminder') . "\n\n" . CreateURL('details', $task_id), 2 * 24 * 60 * 60, time());
}
// Create the Notification
if (Backend::upload_files($task_id)) {
$notify->Create(NOTIFY_TASK_OPENED, $task_id, 'files', null, NOTIFY_BOTH, $proj->prefs['lang_code']);
} else {
$notify->Create(NOTIFY_TASK_OPENED, $task_id, null, null, NOTIFY_BOTH, $proj->prefs['lang_code']);
}
// If the reporter wanted to be added to the notification list
if (isset($args['notifyme']) && $args['notifyme'] == '1' && $user->id != $owner) {
Backend::add_notification($user->id, $task_id, true);
}
if ($user->isAnon()) {
$anonuser = array();
$anonuser[$email] = array('recipient' => $args['anon_email'], 'lang' => $fs->prefs['lang_code']);
$recipients = array($anonuser);
$notify->Create(NOTIFY_ANON_TASK, $task_id, $token, $recipients, NOTIFY_EMAIL, $proj->prefs['lang_code']);
}
return array($task_id, $token);
}
示例10: pagenums
function pagenums($pagenum, $perpage, $totalcount)
{
global $proj;
$pagenum = intval($pagenum);
$perpage = intval($perpage);
$totalcount = intval($totalcount);
// Just in case $perpage is something weird, like 0, fix it here:
if ($perpage < 1) {
$perpage = $totalcount > 0 ? $totalcount : 1;
}
$pages = ceil($totalcount / $perpage);
$output = sprintf(eL('page'), $pagenum, $pages);
if ($totalcount / $perpage > 1) {
$params = $_GET;
# unset unneeded params for shorter urls
unset($params['do']);
unset($params['project']);
unset($params['switch']);
$output .= '<span class="pagenums DoNotPrint">';
$start = max(1, $pagenum - 4 + min(2, $pages - $pagenum));
$finish = min($start + 4, $pages);
if ($start > 1) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => 1))));
$output .= sprintf('<a href="%s"><<%s </a>', $url, eL('first'));
}
if ($pagenum > 1) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagenum - 1))));
$output .= sprintf('<a id="previous" accesskey="p" href="%s">< %s</a> - ', $url, eL('previous'));
}
for ($pagelink = $start; $pagelink <= $finish; $pagelink++) {
if ($pagelink != $start) {
$output .= ' - ';
}
if ($pagelink == $pagenum) {
$output .= sprintf('<strong>%d</strong>', $pagelink);
} else {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagelink))));
$output .= sprintf('<a href="%s">%d</a>', $url, $pagelink);
}
}
if ($pagenum < $pages) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pagenum + 1))));
$output .= sprintf(' - <a id="next" accesskey="n" href="%s">%s ></a>', $url, eL('next'));
}
if ($finish < $pages) {
$url = Filters::noXSS(CreateURL('tasklist', $proj->id, null, array_merge($params, array('pagenum' => $pages))));
$output .= sprintf('<a href="%s"> %s >></a>', $url, eL('last'));
}
$output .= '</span>';
}
return $output;
}
示例11: create_task
//.........这里部分代码省略.........
foreach ($param_names as $param_name) {
if (isset($args[$param_name])) {
$sql_params[] = $param_name;
$sql_values[] = $args[$param_name];
}
}
// Process the due_date
if (isset($args['due_date']) && ($due_date = $args['due_date']) || ($due_date = 0)) {
$due_date = Flyspray::strtotime($due_date);
}
$sql_params[] = 'mark_private';
$sql_values[] = intval($user->perms('manage_project') && isset($args['mark_private']) && $args['mark_private'] == '1');
$sql_params[] = 'due_date';
$sql_values[] = $due_date;
$sql_params[] = 'closure_comment';
$sql_values[] = '';
// Token for anonymous users
$token = '';
if ($user->isAnon()) {
$token = md5(function_exists('openssl_random_pseudo_bytes') ? openssl_random_pseudo_bytes(32) : uniqid(mt_rand(), true));
$sql_params[] = 'task_token';
$sql_values[] = $token;
$sql_params[] = 'anon_email';
$sql_values[] = $args['anon_email'];
} else {
$sql_params[] = 'anon_email';
$sql_values[] = '';
}
$sql_params = join(', ', $sql_params);
// +1 for the task_id column;
$sql_placeholder = $db->fill_placeholders($sql_values, 1);
$result = $db->Query('SELECT MAX(task_id)+1
FROM {tasks}');
$task_id = $db->FetchOne($result);
$task_id = $task_id ? $task_id : 1;
//now, $task_id is always the first element of $sql_values
array_unshift($sql_values, $task_id);
$result = $db->Query("INSERT INTO {tasks}\n ( task_id, date_opened, last_edited_time,\n project_id, item_summary,\n detailed_desc, opened_by,\n percent_complete, {$sql_params} )\n VALUES ({$sql_placeholder})", $sql_values);
// Log the assignments and send notifications to the assignees
if (isset($args['rassigned_to']) && is_array($args['rassigned_to'])) {
// Convert assigned_to and store them in the 'assigned' table
foreach ($args['rassigned_to'] as $val) {
$db->Replace('{assigned}', array('user_id' => $val, 'task_id' => $task_id), array('user_id', 'task_id'));
}
// Log to task history
Flyspray::logEvent($task_id, 14, implode(' ', $args['rassigned_to']));
// Notify the new assignees what happened. This obviously won't happen if the task is now assigned to no-one.
$notify->Create(NOTIFY_NEW_ASSIGNEE, $task_id, null, $notify->SpecificAddresses($args['rassigned_to']));
}
// Log that the task was opened
Flyspray::logEvent($task_id, 1);
$result = $db->Query('SELECT *
FROM {list_category}
WHERE category_id = ?', array($args['product_category']));
$cat_details = $db->FetchRow($result);
// We need to figure out who is the category owner for this task
if (!empty($cat_details['category_owner'])) {
$owner = $cat_details['category_owner'];
} else {
// check parent categories
$result = $db->Query('SELECT *
FROM {list_category}
WHERE lft < ? AND rgt > ? AND project_id = ?
ORDER BY lft DESC', array($cat_details['lft'], $cat_details['rgt'], $cat_details['project_id']));
while ($row = $db->FetchRow($result)) {
// If there's a parent category owner, send to them
if (!empty($row['category_owner'])) {
$owner = $row['category_owner'];
break;
}
}
}
if (!isset($owner)) {
$owner = $proj->prefs['default_cat_owner'];
}
if ($owner) {
if ($proj->prefs['auto_assign'] && ($args['item_status'] == STATUS_UNCONFIRMED || $args['item_status'] == STATUS_NEW)) {
Backend::add_to_assignees($owner, $task_id, true);
}
Backend::add_notification($owner, $task_id, true);
}
// Reminder for due_date field
if ($due_date) {
Backend::add_reminder($task_id, L('defaultreminder') . "\n\n" . CreateURL('details', $task_id), 2 * 24 * 60 * 60, time());
}
// Create the Notification
if (Backend::upload_files($task_id)) {
$notify->Create(NOTIFY_TASK_OPENED, $task_id, 'files');
} else {
$notify->Create(NOTIFY_TASK_OPENED, $task_id);
}
// If the reporter wanted to be added to the notification list
if (isset($args['notifyme']) && $args['notifyme'] == '1' && $user->id != $owner) {
Backend::add_notification($user->id, $task_id, true);
}
if ($user->isAnon()) {
$notify->Create(NOTIFY_ANON_TASK, $task_id, $token, $args['anon_email'], NOTIFY_EMAIL);
}
return array($task_id, $token);
}
示例12: ob_start
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
if (!Post::has('csrftoken')) {
die('missingtoken');
} elseif (Post::val('csrftoken') == $_SESSION['csrftoken']) {
示例13: array
}
$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');
} else {
Flyspray::show_error(L('erroronform'));
}
//redirect the user back to the right task
Flyspray::Redirect(CreateURL('details', Get::val('task_id')));
break;
// ##################
// user requesting a password change
// ##################
// ##################
// user requesting a password change
// ##################
case 'lostpw.sendmagic':
// Check that the username exists
$sql = $db->Query('SELECT * FROM {users} WHERE user_name = ?', array(Post::val('user_name')));
// If the username doesn't exist, throw an error
if (!$db->CountRows($sql)) {
Flyspray::show_error(L('usernotexist'));
break;
}
示例14: USERERROR
# Check permission.
#
if (!$template->AccessCheck($this_user, $TB_EXPT_MODIFY)) {
USERERROR("You do not have permission to commit experiment template " . "{$guid}/{$vers}!", 1);
}
#
# Confirm
#
if (!isset($confirmed)) {
PAGEHEADER("Create Template from Instance");
echo $instance->ExpPageHeader();
echo "<center><br><font size=+1>\n Create new Template from instance {$eid} \n in Template {$guid}/{$vers}?</font>\n";
$template->Show();
echo "<br>";
$instance->Show(0);
$url = CreateURL("template_commit", $instance);
echo "<form action='{$url}' method=post>\n";
echo "<br>\n";
echo "<br>\n";
echo "<b><input type=submit name=confirmed value=Confirm></b>\n";
echo "<b><input type=submit name=canceled value=Cancel></b>\n";
echo "</form>\n";
echo "</center>\n";
PAGEFOOTER();
return;
}
#
# Avoid SIGPROF in child.
#
set_time_limit(0);
PAGEHEADER("Create Template from Instance");
示例15: SPITFORM
function SPITFORM($action, $formfields, $errors)
{
global $template, $metadata, $referrer;
global $metadata_type;
$template_guid = $template->guid();
$template_vers = $template->vers();
PAGEHEADER("Manage Template Metadata");
if ($action == "add") {
echo "<center>";
echo "<font size=+1>\n Attach metadata[<b>1</b>] to your template.</font>";
echo "</center><br>\n";
} elseif ($action == "delete") {
echo "<center>";
echo "<h3>Are you sure you want to delete this item?</h3>";
echo "</center><br>\n";
}
if ($errors) {
echo "<table class=nogrid\n align=center border=0 cellpadding=6 cellspacing=0>\n <tr>\n <th align=center colspan=2>\n <font size=+1 color=red>\n Oops, please fix the following errors! \n </font>\n </td>\n </tr>\n";
while (list($name, $message) = each($errors)) {
echo "<tr>\n <td align=right>\n <font color=red>{$name}: </font></td>\n <td align=left>\n <font color=red>{$message}</font></td>\n </tr>\n";
}
echo "</table><br>\n";
}
if ($action == "modify" || $action == "delete") {
$url = CreateURL("template_metadata", $template, $metadata);
} else {
$url = CreateURL("template_metadata", $template);
}
if (isset($metadata_type) && $metadata_type != "") {
$url .= "&metadata_type={$metadata_type}";
}
echo "<form action='{$url}&action={$action}' method=post>\n";
echo "<table align=center border=1>\n";
if (isset($referrer) && $referrer != "") {
echo "<input type=hidden name=referrer value='{$referrer}'>";
}
#
# Template GUID and Version. These are read-only fields.
#
echo "<tr>\n <td class='pad4'>Template GUID:</td>\n <td class='pad4' class=left>\n {$template_guid}/{$template_vers}</td>\n";
echo "</tr>\n";
if ($action == "modify" || $action == "delete") {
$metadata_guid = $metadata->guid();
$metadata_vers = $metadata->vers();
echo "<tr>\n <td class='pad4'>Metadata GUID:</td>\n <td class='pad4' class=left>\n {$metadata_guid}/{$metadata_vers}</td>\n";
echo "</tr>\n";
}
$readonly_name = $action == "add" ? "" : "readonly";
$readonly_value = $action == "delete" ? "readonly" : "";
#
# Name of the item
#
echo "<tr>\n <td>*Name:<br>\n (something short and pithy)</td>\n <td class=pad4 class=left>\n\t <input type=text {$readonly_name}\n name=\"formfields[name]\"\n value=\"" . $formfields["name"] . "\"\n\t size=64>\n </td>\n </tr>\n";
echo "<tr>\n <td colspan=2>\n Value (use this area to enter the value of your metadata item).\n </td>\n </tr>\n <tr>\n <td colspan=2 align=center class=left>\n <textarea {$readonly_value} name=\"formfields[value]\"\n rows=10 cols=80>" . str_replace("\r", "", $formfields["value"]) . "</textarea>\n </td>\n </tr>\n";
if ($action == "modify") {
$tag = "Modify Metadata";
} elseif ($action == "delete") {
$tag = "Delete Metadata";
} else {
$tag = "Add Metadata";
}
echo "<tr>\n <td class='pad4' align=center colspan=2>\n <b><input type=submit name=submit value='{$tag}'></b>\n </td>\n </tr>\n </form>\n </table>\n";
echo "<blockquote><blockquote>\n <ol>\n <li> Metadata can be any arbitrary name/value pair that you want\n to associate with your template. The name can include\n any printable ascii character including spaces, but\n not newlines. The value can include any printable ascii\n character and my be multiline.\n </ol>\n </blockquote></blockquote>\n";
}