@@ 23-36 (lines=14) @@ | ||
20 | * @param int $active is active or not |
|
21 | * @return boolean if success |
|
22 | */ |
|
23 | public static function add($url, $description, $active) |
|
24 | { |
|
25 | $tms = time(); |
|
26 | $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
27 | $sql = "INSERT INTO $table |
|
28 | SET url = '".Database::escape_string($url)."', |
|
29 | description = '".Database::escape_string($description)."', |
|
30 | active = '".intval($active)."', |
|
31 | created_by = '".api_get_user_id()."', |
|
32 | tms = FROM_UNIXTIME(".$tms.")"; |
|
33 | $result = Database::query($sql); |
|
34 | ||
35 | return $result; |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Updates an URL access |
|
@@ 48-63 (lines=16) @@ | ||
45 | * @param int $active is active or not |
|
46 | * @return boolean if success |
|
47 | */ |
|
48 | public static function update($url_id, $url, $description, $active) |
|
49 | { |
|
50 | $url_id = intval($url_id); |
|
51 | $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL); |
|
52 | $sql = "UPDATE $table |
|
53 | SET url = '".Database::escape_string($url)."', |
|
54 | description = '".Database::escape_string($description)."', |
|
55 | active = '".intval($active)."', |
|
56 | created_by = '".api_get_user_id()."', |
|
57 | tms = '".api_get_utc_datetime()."' |
|
58 | WHERE id = '$url_id'"; |
|
59 | ||
60 | $result = Database::query($sql); |
|
61 | ||
62 | return $result; |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * Deletes an url |