XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
old_functions.php
Go to the documentation of this file.
1 <?php
20 defined('XOOPS_ROOT_PATH') or die('Restricted access');
21 
22 trigger_error("Functions in " . __FILE__ . " are deprecated, should not be used any more", E_USER_WARNING);
23 // #################### Block functions from here ##################
24 /*
25  * Purpose : Builds the blocks on both sides
26  * Input : $side = On wich side should the block are displayed?
27  * 0, l, left : On the left side
28  * 1, r, right: On the right side
29  * other: Only on one side (
30  * Call from theme.php makes all blocks on the left side
31  * and from theme.php for the right site)
32  */
33 function make_sidebar($side)
34 {
35  global $xoopsUser;
36  $xoopsblock = new XoopsBlock();
37  if ($side == "left") {
38  $side = XOOPS_SIDEBLOCK_LEFT;
39  } else if ($side == "right") {
40  $side = XOOPS_SIDEBLOCK_RIGHT;
41  } else {
42  $side = XOOPS_SIDEBLOCK_BOTH;
43  }
44  if (is_object($xoopsUser)) {
45  $block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, $side, XOOPS_BLOCK_VISIBLE);
46  } else {
47  $block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, $side, XOOPS_BLOCK_VISIBLE);
48  }
49 
50  $block_count = count($block_arr);
51  if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
52  include_once $GLOBALS['xoops']->path('class/template.php');
53  $xoopsTpl = new XoopsTpl();
54  } else {
55  $xoopsTpl =& $GLOBALS['xoopsTpl'];
56  }
58  for($i = 0; $i < $block_count; $i++) {
59  $bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
60  if (empty($bcachetime)) {
61  $xoopsTpl->caching = 0;
62  } else {
63  $xoopsTpl->caching = 2;
64  $xoopsTpl->cache_lifetime = $bcachetime;
65  }
66  $btpl = $block_arr[$i]->getVar('template');
67  if ($btpl != '') {
68  if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
69  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
70  $bresult =& $block_arr[$i]->buildBlock();
71  if (!$bresult) {
72  continue;
73  }
74  $xoopsTpl->assign_by_ref('block', $bresult);
75  $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
76  $xoopsTpl->clear_assign('block');
77  } else {
78  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
79  $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
80  }
81  } else {
82  $bid = $block_arr[$i]->getVar('bid');
83  if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
84  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
85  $bresult = & $block_arr[$i]->buildBlock();
86  if (!$bresult) {
87  continue;
88  }
89  $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
90  $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
91  $xoopsTpl->clear_assign('block');
92  } else {
93  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
94  $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
95  }
96  }
97  switch ($block_arr[$i]->getVar('side')) {
99  themesidebox($block_arr[$i]->getVar('title'), $bcontent);
100  break;
102  if (function_exists("themesidebox_right")) {
103  themesidebox_right($block_arr[$i]->getVar('title'), $bcontent);
104  } else {
105  themesidebox($block_arr[$i]->getVar('title'), $bcontent);
106  }
107  break;
108  }
109  unset($bcontent);
110  }
111 }
112 
113 /*
114  * Function to display center block
115  */
116 function make_cblock()
117 {
118  global $xoopsUser, $xoopsOption;
119  $xoopsblock = new XoopsBlock();
120  $cc_block = $cl_block = $cr_block = "";
121  $arr = array();
122  if ($xoopsOption['theme_use_smarty'] == 0) {
123  if (!isset($GLOBALS['xoopsTpl']) || ! is_object($GLOBALS['xoopsTpl'])) {
124  include_once $GLOBALS['xoops']->path('class/template.php');
125  $xoopsTpl = new XoopsTpl();
126  } else {
127  $xoopsTpl =& $GLOBALS['xoopsTpl'];
128  }
129  if (is_object($xoopsUser)) {
130  $block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
131  } else {
132  $block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
133  }
134  $block_count = count($block_arr);
136  for($i = 0; $i < $block_count; $i++) {
137  $bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
138  if (empty($bcachetime)) {
139  $xoopsTpl->caching = 0;
140  } else {
141  $xoopsTpl->caching = 2;
142  $xoopsTpl->cache_lifetime = $bcachetime;
143  }
144  $btpl = $block_arr[$i]->getVar('template');
145  if ($btpl != '') {
146  if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
147  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
148  $bresult =& $block_arr[$i]->buildBlock();
149  if (!$bresult) {
150  continue;
151  }
152  $xoopsTpl->assign_by_ref('block', $bresult);
153  $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
154  $xoopsTpl->clear_assign('block');
155  } else {
156  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
157  $bcontent =& $xoopsTpl->fetch('db:' . $btpl);
158  }
159  } else {
160  $bid = $block_arr[$i]->getVar('bid');
161  if (empty($bcachetime) || ! $xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
162  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
163  $bresult =& $block_arr[$i]->buildBlock();
164  if (!$bresult) {
165  continue;
166  }
167  $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
168  $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
169  $xoopsTpl->clear_assign('block');
170  } else {
171  $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
172  $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
173  }
174  }
175  $title = $block_arr[$i]->getVar('title');
176  switch ($block_arr[$i]->getVar('side')) {
178  if ($title != "") {
179  $cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br /><br /></td></tr>' . "\n";
180  } else {
181  $cc_block .= '<tr><td colspan="2">' . $bcontent . '<br /><br /></td></tr>' . "\n";
182  }
183  break;
185  if ($title != "") {
186  $cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
187  } else {
188  $cl_block .= '<p>' . $bcontent . '</p>' . "\n";
189  }
190  break;
192  if ($title != "") {
193  $cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
194  } else {
195  $cr_block .= '<p>' . $bcontent . '</p>' . "\n";
196  }
197  break;
198  default:
199  break;
200  }
201  unset($bcontent, $title);
202  }
203  echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n";
204  }
205 }
211 function openThread($width = "100%")
212 {
213  echo "<table border='0' cellpadding='0' cellspacing='0' align='center' width='$width'><tr><td class='bg2'><table border='0' cellpadding='4' cellspacing='1' width='100%'><tr class='bg3' align='left'><td class='bg3' width='20%'>" . _CM_POSTER . "</td><td class='bg3'>" . _CM_THREAD . "</td></tr>";
214 }
244 function showThread($color_number, $subject_image, $subject, $text, $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $username = "", $rank_title = "", $rank_image = "", $avatar_image = "", $reg_date = "", $posts = "", $user_from = "", $online_image = "", $profile_image = "", $pm_image = "", $email_image = "", $www_image = "", $icq_image = "", $aim_image = "", $yim_image = "", $msnm_image = "")
245 {
246  if ($color_number == 1) {
247  $bg = 'bg1';
248  } else {
249  $bg = 'bg3';
250  }
251  echo "<tr align='left'><td valign='top' class='$bg' nowrap='nowrap'><strong>$username</strong><br />$rank_title<br />$rank_image<br />$avatar_image<br /><br />$reg_date<br />$posts<br />$user_from<br /><br />$online_image</td>";
252  echo "<td valign='top' class='$bg'><table width='100%' border='0'><tr><td valign='top'>$subject_image&nbsp;<strong>$subject</strong></td><td align='right'>" . $ip_image . "" . $reply_image . "" . $edit_image . "" . $delete_image . "</td></tr>";
253  echo "<tr><td colspan='2'><p>$text</p></td></tr></table></td></tr>";
254  echo "<tr align='left'><td class='$bg' valign='middle'>$post_date</td><td class='$bg' valign='middle'>" . $profile_image . "" . $pm_image . "" . $email_image . "" . $www_image . "" . $icq_image . "" . $aim_image . "" . $yim_image . "" . $msnm_image . "</td></tr>";
255 }
260 function closeThread()
261 {
262  echo '</table></td></tr></table>';
263 }
264 ?>