Kyberia v2.3 - 1st revision from SVN (Without patches of kyberia.sk team)
[mirrors/Kyberia-bloodline.git] / inc / eventz / moodlist.inc
1 <?php
2 function moodlist() {
3 global $db,$error,$node;
4 $moods_expl = explode(";",$_POST['moodlist']);
5 $moodlist[0] = '';
6
7 if (empty($moods_expl[count($moods_expl)-1])) $moods_sw = 1;
8 else $moods_sw = 0;
9
10 $moods_cn = 0;
11 for ($i = 0;$i < count($moods_expl)-$moods_sw;$i++) {
12 $set = $db->query(sprintf('select node_id from nodes where node_id = %d', $moods_expl[$i]));
13 $set->next();
14 if ($set->getString('node_id')) {
15 if (!in_array($moods_expl[$i],$moodlist)) {
16 $moodlist[$moods_cn] = $moods_expl[$i];
17 $moods_cn++;
18 }
19 }
20 else {
21 $error = sprintf('%d does not exist, ', $moods_expl[$i]);
22 }
23 }
24
25 sort($moodlist);
26 $moods_impl = implode(";",$moodlist);
27 $moods_impl .= ';';
28 if (!empty($_SESSION['mood_id'])) $moods_impls .= $_SESSION['mood_id'];
29
30 $db->query(sprintf('update users set moods = "%s" where user_id = %d', $moods_impl, $_SESSION['user_id']));
31
32 return true;
33 }
34 ?>
This page took 0.267367 seconds and 4 git commands to generate.