}
# replace every character in $str with " "
-function tonbsp($matches) {
+function to_nbsp($matches) {
return str_repeat(' ', strlen($matches[0]) * 2);
}
# encode as html, make it display newlines and leading spaces
function enc_htmlbrtab($str) {
$str = enc_htmlbr($str);
- $str = preg_replace_callback("|^ *|m", tonbsp, $str);
+ $str = preg_replace_callback("|^ *|m", to_nbsp, $str);
return $str;
}
if(isset($_REQUEST['tasks_approve_price_id'])) {
$id = $_REQUEST['tasks_approve_price_id'];
- $owner = db_get_value('tasks', 'client_id', 'where id=%i', $id);;
+ $owner = db_get_value('tasks', 'client_id', 'where id=%i', $id);
if(logged_in() != $owner) {
message("Error: can't approve a task entered by/for another client.");
return './';
}
}
- if("you're happy with the POSTed values") {
+ if("you're happy with the POSTed values") { # if you change this change the one above
if($edit_id) {
if(isset($_REQUEST['price']) && logged_in_as_contractor()) {
db_update('tasks', 'title,url,description,state,price', $title, $url, $description, $state, $price, 'where id=%i', $edit_id);
# new task
$paid = 0;
$client_id = logged_in();
+ if(logged_in_as_contractor() && $_REQUEST['client_id']) {
+ $client_id = format_int($_REQUEST['client_id']);
+ }
db_insert('tasks', 'client_id,title,url,description,state,paid', $client_id, $title, $url, $description, $state, $paid);
message('Task saved.');
}
tem_show('bug_msg');
} else {
tem_show('new_msg');
+ if(logged_in_as_contractor()) {
+ pulldown('client_id', db_get_rows('people', 'id,name', 'where id > 1'), PULLDOWN_2D);
+ tem_set('client_id', format_int($_REQUEST['client_id']));
+ tem_show('client_row');
+ }
}
# display instructions