831 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
4 |
// //
|
|
|
5 |
// Copyright (C) 2006 Phorum Development Team //
|
|
|
6 |
// http://www.phorum.org //
|
|
|
7 |
// //
|
|
|
8 |
// This program is free software. You can redistribute it and/or modify //
|
|
|
9 |
// it under the terms of either the current Phorum License (viewable at //
|
|
|
10 |
// phorum.org) or the Phorum License that was distributed with this file //
|
|
|
11 |
// //
|
|
|
12 |
// This program is distributed in the hope that it will be useful, //
|
|
|
13 |
// but WITHOUT ANY WARRANTY, without even the implied warranty of //
|
|
|
14 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
|
|
|
15 |
// //
|
|
|
16 |
// You should have received a copy of the Phorum License //
|
|
|
17 |
// along with this program. //
|
|
|
18 |
////////////////////////////////////////////////////////////////////////////////
|
|
|
19 |
|
|
|
20 |
if(!defined("PHORUM")) return;
|
|
|
21 |
|
|
|
22 |
include_once("./include/thread_info.php");
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* just returns to the list and exits the program
|
|
|
26 |
*/
|
|
|
27 |
function phorum_return_to_list()
|
|
|
28 |
{
|
|
|
29 |
$PHORUM=$GLOBALS["PHORUM"];
|
|
|
30 |
if(!empty($PHORUM["forum_id"])){
|
|
|
31 |
phorum_redirect_by_url(phorum_get_url(PHORUM_LIST_URL));
|
|
|
32 |
}else{
|
|
|
33 |
phorum_redirect_by_url(phorum_get_url(PHORUM_INDEX_URL));
|
|
|
34 |
}
|
|
|
35 |
exit();
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/* A function to get moderator_data from the user's profile.
|
|
|
39 |
* Without an argument, all moderator_data is returned. With a key as
|
|
|
40 |
* argument, the data for that key is returned or NULL in case the
|
|
|
41 |
* key does not exist.
|
|
|
42 |
*/
|
|
|
43 |
function phorum_moderator_data_get($key = null)
|
|
|
44 |
{
|
|
|
45 |
$PHORUM = $GLOBALS['PHORUM'];
|
|
|
46 |
|
|
|
47 |
$user_data =phorum_user_get($PHORUM['DATA']['USERINFO']['user_id'], false);
|
|
|
48 |
if( $user_data['moderator_data'] ) {
|
|
|
49 |
$moderator_data =unserialize($user_data['moderator_data']);
|
|
|
50 |
} else {
|
|
|
51 |
$moderator_data =array();
|
|
|
52 |
}
|
|
|
53 |
if (is_null($key)) {
|
|
|
54 |
return $moderator_data;
|
|
|
55 |
} else {
|
|
|
56 |
return isset($moderator_data[$key]) ? $moderator_data[$key] : NULL;
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
/* A function to save moderator_data in the user's profile. */
|
|
|
61 |
function phorum_moderator_data_save($moderator_data)
|
|
|
62 |
{
|
|
|
63 |
$PHORUM = $GLOBALS["PHORUM"];
|
|
|
64 |
|
|
|
65 |
// Clear value in case no data is left in $moderator_data.
|
|
|
66 |
$value = count($moderator_data) ? serialize($moderator_data) : '';
|
|
|
67 |
|
|
|
68 |
phorum_user_save_simple(array(
|
|
|
69 |
"user_id" => $PHORUM['user']['user_id'],
|
|
|
70 |
"moderator_data" => $value,
|
|
|
71 |
));
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
/* A function to place a key/value pair in the moderator_data. */
|
|
|
75 |
function phorum_moderator_data_put($key, $val)
|
|
|
76 |
{
|
|
|
77 |
$moderator_data = phorum_moderator_data_get();
|
|
|
78 |
$moderator_data[$key] = $val;
|
|
|
79 |
phorum_moderator_data_save($moderator_data);
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
/* A function to remove a key/value pair from the moderator_data. */
|
|
|
83 |
function phorum_moderator_data_remove($key)
|
|
|
84 |
{
|
|
|
85 |
$moderator_data = phorum_moderator_data_get();
|
|
|
86 |
unset($moderator_data[$key]);
|
|
|
87 |
phorum_moderator_data_save($moderator_data);
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
?>
|