Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/js/callbacks/searchtask.php
blob: 47b0241508efe807177d53bd46bcf7b0b50958e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
define('IN_FS', true);
require_once('../../header.php');


// Require inputs
if(!Post::has('detail') || !Post::has('summary') || !Post::has('project_id'))
{
  return;
}


// Load user profile
if (Cookie::has('flyspray_userid') && Cookie::has('flyspray_passhash')){
  $user = new User(Cookie::val('flyspray_userid'));
  $user->check_account_ok();
} else {
  $user = new User(0, $proj);
}

// Require right to open a task on current project
if(!$user->can_open_task($proj)){
  return;
}


// Prepare SQL params
$params = array(
  'project_id' => Post::num('project_id'),
  'summary' => "%" . trim(Post::val('summary')) . "%",
  'details' => "%" . trim(Post::val('detail')) . "%"
);

$sql = $db->query('SELECT count(*) 
		   FROM {tasks} t
		   WHERE t.project_id = ? 
		   	AND t.item_summary like ? 
		   	AND t.detailed_desc like ?',
		   $params);
$sametask = $db->fetchOne($sql);
echo $sametask;

?>