registration permission fix
[mirrors/Kyberia-bloodline.git] / trash / mail_rss.inc
CommitLineData
570ab4b6
H
1<?php
2//Celej tenhle soubor je totalni haluz... bud opravit nebo neresit... ~harvie
3
4/*
5// mail rss
6if ($template_id=='rss') //XXX WHAT?
7{
8 $_feedType = "RSS0.91";
9 if (!is_numeric($_SESSION['user_id']))
10 {
11 if (!isset($_SERVER['PHP_AUTH_USER'])) {
12 header('WWW-Authenticate: Basic realm="Kyberia"');
13 header('HTTP/1.0 401 Unauthorized');
14 echo 'Cancel button';
15 exit;
16 }
17 else
18 {
19 require_once(EVENT_DIR.'/login.inc');
20 $_POST['login'] = $_SERVER['PHP_AUTH_USER'];
21 $_POST['password'] = $_SERVER['PHP_AUTH_PW'];
22 $_POST['login_type'] = "name";
23 if (!login())
24 {
25 echo "Zle meno/heslo.";
26 exit();
27 }
28 }
29 }
30
31 _checkPermissions();
32
33 // Mail
34 if ($_GET['node_id']==='24' && $permissions['r'])
35 {
36 require_once(INCLUDE_DIR.'/feedcreator.class.php');
37
38 $rss = new UniversalFeedCreator();
39 $rss->title = "Kyberia mail";
40 $rss->description = "";
41 $rss->link = "https://". SYSTEM_URL . "/id/24";
42
43 //XXX into function
44 $query = "select date_format(mail.mail_timestamp,\"%e.%c. %k:%i:%s\") as cas,
45 userfrom.user_action as locationfrom_action,
46 userfrom.user_action_id as locationfrom_action_id,
47 userto.user_action as locationto_action,
48 userto.user_action_id as locationto_action_id,
49 userto.login as mail_to_name, userfrom.login as mail_from_name,
50 mail.* from mail left join users as userfrom on
51 mail_from=userfrom.user_id left join users as userto on mail_to=userto.user_id
52 where mail_user='$_SESSION[user_id]' and mail_to='$_SESSION[user_id]' order by mail_id desc limit 0,10";
53
54 $set = $db->query($query);
55
56 while($set->next()) {
57 $m = $set->getRecord();
58 if ($m['mail_to'] != $_SESSION['user_id'])
59 continue;
60 $item = new FeedItem();
61 $item->title = $m['mail_from_name'];
62 $item->link = "https://".SYSTEM_URL."/id/24";
63 $item->description = $m['mail_text'];
64 $rss->addItem($item);
65 }
66 }
67 // bookmarks
68 elseif ($_GET['node_id']=='19' && $permissions['r'])
69 {
70 require_once(INCLUDE_DIR.'/feedcreator.class.php');
71
72 $rss = new UniversalFeedCreator();
73 $rss->title = "Kyberia bookmarks";
74 $rss->link = "http://".SYSTEM_URL."/id/19"; //XXX https ?
75
76 require_once(SMARTY_PLUGIN_DIR.'/function.get_bookmarks.php');
77 smarty_function_get_bookmarks(array(), $smarty);
78 $_items = $smarty->get_template_vars('get_bookmarks');
79 foreach ($_items as $_item)
80 {
81 if (is_array($_item['children']))
82 foreach ($_item['children'] as $_b)
83 {
84 $item = new FeedItem();
85 $item->title = $_b['node_name'];
86 $item->link = "http://".SYSTEM_URL."/id/".$_b['node_id']."/rss";
87 $rss->addItem($item);
88 }
89 }
90 $_feedType = 'OPML';
91 }
92 elseif ($permissions['r'])
93 {
94 require_once(INCLUDE_DIR.'/feedcreator.class.php');
95
96 $rss = new UniversalFeedCreator();
97 $rss->title = $node['node_name'];
98 $rss->description = "";
99 $rss->link = "http://".SYSTEM_URL."/id/".$node['node_id'];
100
101 // K list
102 if ($_GET['node_id']=='15')
103 {
104 require_once(SMARTY_PLUGIN_DIR.'/function.get_k.php');
105 smarty_function_get_k(array(), $smarty);
106 $_items = $smarty->get_template_vars('get_k');
107 }
108 else
109 {
110 require_once(SMARTY_PLUGIN_DIR.'/function.get_children.php');
111 smarty_function_get_children(
112 array('orderby' => 'desc', 'orderby_type' => 'time'), $smarty);
113 $_items = $smarty->get_template_vars('get_children');
114 }
115
116 foreach ($_items as $_item)
117 {
118 $item = new FeedItem();
119 $item->title = $_item['node_name'];
120 $item->link = "http://".SYSTEM_URL."/id/".$_item['node_id'];
121 $item->description = $_item['node_content'];
122 $rss->addItem($item);
123 }
124 }
125
126 if ($permissions['r']) $rss->showFeed($_feedType);
127 exit();
128}
129
130*/
This page took 0.274401 seconds and 4 git commands to generate.