forked from atutor/ATutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapprove_note.php
59 lines (47 loc) · 1.62 KB
/
approve_note.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require(dirname(__FILE__) .'/common/vitals.inc.php');
if (!isset($_SESSION['handbook_admin']) || !$_SESSION['handbook_admin'] || !isset($_GET['id'])) {
exit;
}
function my_add_null_slashes( $string ) {
return ( $string );
}
if ( get_magic_quotes_gpc() == 1 ) {
$addslashes = 'my_add_null_slashes';
} else {
$addslashes = 'mysql_real_escape_string';
}
$_GET['id'] = intval($_GET['id']);
$config_location = '../include/config.inc.php';
if (is_file($config_location) && is_readable($config_location)) {
require($config_location);
$db = mysql_connect(DB_HOST . ':' . DB_PORT, DB_USER, DB_PASSWORD);
mysql_select_db(DB_NAME, $db);
// check atutor config table to see if handbook notes is enabled.
$sql = "SELECT value FROM ".TABLE_PREFIX."config WHERE name='user_notes'";
$result = @mysql_query($sql, $db);
if (($row = mysql_fetch_assoc($result)) && $row['value']) {
define('AT_HANDBOOK_ENABLE', true);
$enable_user_notes = true;
}
define('AT_HANDBOOK_DB_TABLE_PREFIX', TABLE_PREFIX);
define('AT_HANDBOOK_ENABLE', true);
}
if (!defined('AT_HANDBOOK_ENABLE')) {
// use local config file
require('./config.inc.php');
}
if (!$db && defined('AT_HANDBOOK_ENABLE') && AT_HANDBOOK_ENABLE) {
$db = @mysql_connect(AT_HANDBOOK_DB_HOST . ':' . AT_HANDBOOK_DB_PORT, AT_HANDBOOK_DB_USER, AT_HANDBOOK_DB_PASSWORD);
if (@mysql_select_db(AT_HANDBOOK_DB_DATABASE, $db)) {
$enable_user_notes = true;
}
}
if ($enable_user_notes) {
// insert into DB
$sql = "UPDATE ".AT_HANDBOOK_DB_TABLE_PREFIX."handbook_notes SET approved=1, date=date WHERE note_id=$_GET[id]";
mysql_query($sql, $db);
}
header('Location: index_list.php');
exit;
?>