1 | <?php |
---|
2 | if (!defined('DC_RC_PATH')) { return; } |
---|
3 | |
---|
4 | require dirname(__FILE__).'/_widgets.php'; |
---|
5 | |
---|
6 | l10n::set(dirname(__FILE__).'/locales/'.$_lang.'/public'); |
---|
7 | |
---|
8 | $core->url->register('switchblog','switchblog','^switchblog$',array('switchurl','switchblog')); |
---|
9 | |
---|
10 | class switchurl extends dcUrlHandlers |
---|
11 | { |
---|
12 | public static function switchblog($args) |
---|
13 | { |
---|
14 | global $core; |
---|
15 | $url = $_POST['switchblog']; |
---|
16 | header('location:'.$url.''); |
---|
17 | |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | class publicAllBlogs |
---|
22 | { |
---|
23 | public static function allBlogs(&$w) |
---|
24 | { |
---|
25 | global $core; |
---|
26 | if ($w->homeonly && $core->url->type != 'default') { |
---|
27 | return; |
---|
28 | } |
---|
29 | if ($w->combo == '1') { |
---|
30 | $display = 'combo'; |
---|
31 | } |
---|
32 | $excluded = explode(",",$w->excluded); |
---|
33 | |
---|
34 | $res ='<div id="allblogs">'; |
---|
35 | //liste des blogs |
---|
36 | |
---|
37 | $thisblog = $core->blog->id; |
---|
38 | |
---|
39 | $rs_blogs = $core->getBlogs(array('order'=>'LOWER(blog_name)','limit'=>20)); |
---|
40 | $blogs = array(); |
---|
41 | |
---|
42 | //liste des blogs |
---|
43 | if (isset($display) != 'combo') { |
---|
44 | $res .= ($w->title ? '<h2>'.html::escapeHTML($w->title).'</h2>' : ''); |
---|
45 | $res.= '<ul id=\'allblogs\'>'; |
---|
46 | while ($rs_blogs->fetch()) { |
---|
47 | $blog = $core->getBlog($rs_blogs->blog_id); |
---|
48 | $k = $rs_blogs->blog_id; |
---|
49 | if($blog->blog_status==1 && !$w->$k && !in_array($blog->blog_id,$excluded)) { |
---|
50 | if ($blog->blog_id != $thisblog) { |
---|
51 | $res .= '<li><a href="'.$blog->blog_url.'" title="'.__('Visit blog:').' '.$blog->blog_name.'">'.$blog->blog_name.'</a></li>'; |
---|
52 | } else { |
---|
53 | $res .= '<li><strong>'.$blog->blog_name.'</strong></li>'; |
---|
54 | } |
---|
55 | } |
---|
56 | } |
---|
57 | $res.='</ul>'; |
---|
58 | } else { |
---|
59 | $thisblogurl = $core->blog->url; |
---|
60 | $res.= '<form action="'.$thisblogurl.'switchblog" method="post"><h2><label for="switchblog">'.html::escapeHTML($w->title).'</label></h2>'. |
---|
61 | '<p><select name="switchblog" id="switchblog">'; |
---|
62 | while ($rs_blogs->fetch()) { |
---|
63 | $blog = $core->getBlog($rs_blogs->blog_id); |
---|
64 | $k = $rs_blogs->blog_id; |
---|
65 | if($blog->blog_status==1 && !$w->$k && !in_array($blog->blog_id,$excluded)) { |
---|
66 | if ($blog->blog_id != $thisblog) { |
---|
67 | $res .= '<option value="'.$blog->blog_url.'">'.$blog->blog_name.'</option>'; |
---|
68 | } else { |
---|
69 | $res .= '<option value="'.$blog->blog_url.'" selected="selected">'.$blog->blog_name.'</option>'; |
---|
70 | } |
---|
71 | } |
---|
72 | } |
---|
73 | $res.='</select></p><p><input type="submit" value="'.__('hop').'" /></p></form>'; |
---|
74 | // |
---|
75 | } |
---|
76 | $res .= '</div>'; |
---|
77 | return $res; |
---|
78 | } |
---|
79 | } |
---|
80 | ?> |
---|