function prj_statuslog($pid, $uid, $tid, $comment, $date, $table) { if (empty($pid) || empty($uid) || empty($table)) { return false; } $comment = trim(prj_preparefordb($comment)); if ($comment != '') { if (empty($tid)) { DB_query("INSERT INTO {$table} (pid, description, uid, updated) VALUES ({$pid},'{$comment}',{$uid}, {$date})"); } else { DB_query("INSERT INTO {$table} (pid, description, uid, updated, tid) VALUES ({$pid},'{$comment}',{$uid}, {$date}, {$tid})"); } } return true; }
if (isset($_POST['pid'])) { $_CLEAN = array_merge($_CLEAN, ppGetData($myintvars, false, 'POST', 'int')); } elseif (isset($_GET['id'])) { $_CLEAN = array_merge($_CLEAN, ppGetData($myintvars, false, 'GET', 'int')); } else { $id = ''; } $uid = $_USER['uid']; $result = DB_query("SELECT create_date, last_updated_date, start_date, estimated_end_date, actual_end_date,planned_end_date, name, description, keywords, is_using_docmgmt_flag, is_using_forum_flag, is_private_project_flag, is_template_project_flag FROM {$_TABLES['prj_projects']} WHERE pid='{$id}'"); $comptListTasks = DB_numrows($result); if ($comptListTasks != "0") { $createdate = pm_getdate(); list($create_date, $last_updated_date, $start_date, $estimated_end_date, $actual_end_date, $planned_end_date, $name, $description, $keywords, $is_using_docmgmt_flag, $is_using_forum_flag, $is_private_project_flag, $is_template_project_flag) = DB_fetchArray($result); $description = prj_preparefordb($description); $name = prj_preparefordb($name); $keywords = prj_preparefordb($keywords); $name = "Copy of " . $name; $sql = "INSERT INTO {$_TABLES['prj_projects']} "; $sql .= "(name, description, keywords, create_date, last_updated_date, start_date, estimated_end_date, actual_end_date, "; $sql .= "planned_end_date, progress_id, status_id, priority_id, is_using_docmgmt_flag, is_using_forum_flag, is_private_project_flag, "; $sql .= "is_template_project_flag) VALUES ("; $sql .= "'{$name}', '{$description}', '{$keywords}', '{$create_date}', '{$last_updated_date}', '{$start_date}', '{$estimated_end_date}', '{$actual_end_date}','{$planned_end_date}', 0, 0, 0, '{$is_using_docmgmt_flag}', "; $sql .= " '{$is_using_forum_flag}', '{$is_private_project_flag}', '{$is_template_project_flag}' "; $sql .= ") "; DB_query($sql); $lastid = DB_insertId(); $uid = $_USER['uid']; DB_query("INSERT INTO {$_TABLES['prj_users']} (pid, uid,role) VALUES ({$lastid}, {$uid}, 'o')"); //copy all project permissions.. do the tasks later! $sql = "insert into {$_TABLES['prj_projPerms']} (pid, taskid, uid, gid, viewread, writechange, fullaccess, seedetails) "; $sql .= "(select '{$lastid}','0', uid, gid, viewread, writechange, fullaccess, seedetails from {$_TABLES['prj_projPerms']} ";