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')); }
if(checkbox) checkbox.checked = true; var hidden = document.getElementById('id_hidden_' + id); if(hidden) hidden.disabled = false; var conf = document.getElementById('id_confirm'); if(conf) conf.disabled = true; } </script> <?php // Set current directory to where the language files are chdir("../lang"); $lang = @$_GET['lang']; $fail = ''; if (!$lang || !Filters::isAlnum($lang)) { $fail .= "Language code not supplied correctly<br/>\n"; } if (!file_exists('en.php')) { $fail .= "The english language file <code>en.php</code> is missing. Make sure this script is run from the same directory as the language files <code>.../flyspray/lang/</code><br/>\n"; } if ($fail) { die($fail . "<b>Usage:</b> <a href='.langedit.php?lang='>.langedit.php?lang=<lang code></a> where <lang code> should be replaced by your languge, e.g. <b>de</b> for German."); } // Read english language file in array $language (assumed to be UTF-8 encoded) require_once 'en.php'; if (!is_array(@$language)) { die("Invalid language file for english"); } $count = count($language); // Read the translation file in array $translation (assumed to be UTF-8 encoded)
function tpl_draw_cell($task, $colname, $format = "<td class='%s %s'>%s</td>") { global $fs, $proj, $page; $indexes = array('id' => 'task_id', 'project' => 'project_title', 'summary' => 'item_summary', 'dateopened' => 'date_opened', 'openedby' => 'opened_by_real_name', 'closedby' => 'closed_by_real_name', 'changedby' => 'last_changed_by_real_name', 'assignedto' => 'assigned_to_name', 'lastedit' => 'last_changed_time', 'comments' => 'comment_count', 'votes' => 'vote_count', 'attachments' => 'attachment_count', 'dateclosed' => 'date_closed', 'projectlevelid' => 'prefix_id', 'progress' => '', 'state' => '', 'private' => 'mark_private'); //must be an array , must contain elements and be alphanumeric (permitted "_") if (!is_array($task) || empty($task) || preg_match('![^A-Za-z0-9_]!', $colname)) { //run away.. return ''; } switch ($colname) { case 'id': $value = tpl_tasklink($task, $task['task_id']); break; case 'projectlevelid': $value = tpl_tasklink($task, $task['project_prefix'] . '#' . $task['prefix_id']); break; case 'summary': $value = tpl_tasklink($task, utf8_substr($task['item_summary'], 0, 55), false, array(), array('state', 'age', 'percent_complete')); if (utf8_strlen($task['item_summary']) > 55) { $value .= '...'; } break; case 'lastedit': case 'dateopened': case 'dateclosed': $value = formatDate($task[$indexes[$colname]]); break; case 'progress': $value = '<div class="taskpercent"><div style="width:' . $task['percent_complete'] . '%"> </div></div>'; break; case 'assignedto': $value = Filters::noXSS($task[$indexes[$colname]]); if ($task['num_assigned'] > 1) { $value .= ', +' . ($task['num_assigned'] - 1); } break; case 'state': if ($task['is_closed']) { $value = L('closed'); } elseif ($task['closed_by']) { $value = L('reopened'); } else { $value = L('open'); } break; case 'private': $value = $task[$indexes[$colname]] ? L('yes') : L('no'); break; default: if (isset($indexes[$colname])) { $value = $task[$indexes[$colname]]; } elseif (isset($task[$colname . '_name'])) { $value = $task[$colname . '_name']; } else { if (isset($proj->fields[$colname])) { $value = $proj->fields[$colname]->view($task, array(), true); } else { $value = $task[$colname]; } } $value = Filters::noXSS($value); break; } $wsvalue = str_replace(' ', '', $value); return sprintf($format, 'task_' . $colname, Filters::isAlnum($wsvalue) ? $colname . '_' . $wsvalue : '', $value); }
function isAlnum($key) { return Filters::isAlnum(Post::val($key)); }
/** * GetColumnNames * * @param mixed $table * @param mixed $alt * @param mixed $prefix * @access public * @return void */ function GetColumnNames($table, $alt, $prefix) { global $conf, $db; if (strcasecmp($conf['database']['dbtype'], 'pgsql') || !Filters::isAlnum($prefix)) { return $alt; } $db->loadModule('Manager'); $col_names = $db->manager->listTableFields($table); return implode(', ', array_map(create_function('$x', 'return "' . $prefix . '.' . '" . $x;'), $col_names)); }