[ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // #################### Block functions from here ################## 3 4 /* 5 * Purpose : Builds the blocks on both sides 6 * Input : $side = On wich side should the block are displayed? 7 * 0, l, left : On the left side 8 * 1, r, right: On the right side 9 * other: Only on one side ( 10 * Call from theme.php makes all blocks on the left side 11 * and from theme.php for the right site) 12 */ 13 function make_sidebar($side) 14 { 15 global $xoopsUser; 16 $xoopsblock = new XoopsBlock(); 17 if ($side == "left") { 18 $side = XOOPS_SIDEBLOCK_LEFT; 19 } elseif ($side == "right") { 20 $side = XOOPS_SIDEBLOCK_RIGHT; 21 } else { 22 $side = XOOPS_SIDEBLOCK_BOTH; 23 } 24 if (is_object($xoopsUser)) { 25 $block_arr =& $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, $side, XOOPS_BLOCK_VISIBLE); 26 } else { 27 $block_arr =& $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, $side, XOOPS_BLOCK_VISIBLE); 28 } 29 30 $block_count = count($block_arr); 31 if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { 32 include_once XOOPS_ROOT_PATH.'/class/template.php'; 33 $xoopsTpl = new XoopsTpl(); 34 } else { 35 $xoopsTpl =& $GLOBALS['xoopsTpl']; 36 } 37 $xoopsLogger =& XoopsLogger::instance(); 38 for ($i = 0; $i < $block_count; $i++) { 39 $bcachetime = intval($block_arr[$i]->getVar('bcachetime')); 40 if (empty($bcachetime)) { 41 $xoopsTpl->xoops_setCaching(0); 42 } else { 43 $xoopsTpl->xoops_setCaching(2); 44 $xoopsTpl->xoops_setCacheTime($bcachetime); 45 } 46 $btpl = $block_arr[$i]->getVar('template'); 47 if ($btpl != '') { 48 if (empty($bcachetime) || !$xoopsTpl->is_cached('db:'.$btpl)) { 49 $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); 50 $bresult =& $block_arr[$i]->buildBlock(); 51 if (!$bresult) { 52 continue; 53 } 54 $xoopsTpl->assign_by_ref('block', $bresult); 55 $bcontent =& $xoopsTpl->fetch('db:'.$btpl); 56 $xoopsTpl->clear_assign('block'); 57 } else { 58 $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); 59 $bcontent =& $xoopsTpl->fetch('db:'.$btpl); 60 } 61 } else { 62 $bid = $block_arr[$i]->getVar('bid'); 63 if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_'.$bid)) { 64 $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); 65 $bresult =& $block_arr[$i]->buildBlock(); 66 if (!$bresult) { 67 continue; 68 } 69 $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']); 70 $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid); 71 $xoopsTpl->clear_assign('block'); 72 } else { 73 $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); 74 $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid); 75 } 76 } 77 switch ($block_arr[$i]->getVar('side')) { 78 case XOOPS_SIDEBLOCK_LEFT: 79 themesidebox($block_arr[$i]->getVar('title'), $bcontent); 80 break; 81 case XOOPS_SIDEBLOCK_RIGHT: 82 if (function_exists("themesidebox_right")) { 83 themesidebox_right($block_arr[$i]->getVar('title'), $bcontent); 84 } else { 85 themesidebox($block_arr[$i]->getVar('title'), $bcontent); 86 } 87 break; 88 } 89 unset($bcontent); 90 } 91 } 92 93 /* 94 * Function to display center block 95 */ 96 function make_cblock() 97 { 98 global $xoopsUser, $xoopsOption; 99 $xoopsblock = new XoopsBlock(); 100 $cc_block = $cl_block = $cr_block = ""; 101 $arr = array(); 102 if ($xoopsOption['theme_use_smarty'] == 0) { 103 if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) { 104 include_once XOOPS_ROOT_PATH.'/class/template.php'; 105 $xoopsTpl = new XoopsTpl(); 106 } else { 107 $xoopsTpl =& $GLOBALS['xoopsTpl']; 108 } 109 if (is_object($xoopsUser)) { 110 $block_arr =& $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE); 111 } else { 112 $block_arr =& $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE); 113 } 114 $block_count = count($block_arr); 115 $xoopsLogger =& XoopsLogger::instance(); 116 for ($i = 0; $i < $block_count; $i++) { 117 $bcachetime = intval($block_arr[$i]->getVar('bcachetime')); 118 if (empty($bcachetime)) { 119 $xoopsTpl->xoops_setCaching(0); 120 } else { 121 $xoopsTpl->xoops_setCaching(2); 122 $xoopsTpl->xoops_setCacheTime($bcachetime); 123 } 124 $btpl = $block_arr[$i]->getVar('template'); 125 if ($btpl != '') { 126 if (empty($bcachetime) || !$xoopsTpl->is_cached('db:'.$btpl)) { 127 $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); 128 $bresult =& $block_arr[$i]->buildBlock(); 129 if (!$bresult) { 130 continue; 131 } 132 $xoopsTpl->assign_by_ref('block', $bresult); 133 $bcontent =& $xoopsTpl->fetch('db:'.$btpl); 134 $xoopsTpl->clear_assign('block'); 135 } else { 136 $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); 137 $bcontent =& $xoopsTpl->fetch('db:'.$btpl); 138 } 139 } else { 140 $bid = $block_arr[$i]->getVar('bid'); 141 if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_'.$bid)) { 142 $xoopsLogger->addBlock($block_arr[$i]->getVar('name')); 143 $bresult =& $block_arr[$i]->buildBlock(); 144 if (!$bresult) { 145 continue; 146 } 147 $xoopsTpl->assign_by_ref('dummy_content', $bresult['content']); 148 $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid); 149 $xoopsTpl->clear_assign('block'); 150 } else { 151 $xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime); 152 $bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_'.$bid); 153 } 154 } 155 $title = $block_arr[$i]->getVar('title'); 156 switch ($block_arr[$i]->getVar('side')) { 157 case XOOPS_CENTERBLOCK_CENTER: 158 if ($title != "") { 159 $cc_block .= '<tr valign="top"><td colspan="2"><b>'.$title.'</b><hr />'.$bcontent.'<br /><br /></td></tr>'."\n"; 160 } else { 161 $cc_block .= '<tr><td colspan="2">'.$bcontent.'<br /><br /></td></tr>'."\n"; 162 } 163 break; 164 case XOOPS_CENTERBLOCK_LEFT: 165 if ($title != "") { 166 $cl_block .= '<p><b>'.$title.'</b><hr />'.$bcontent.'</p>'."\n"; 167 } else { 168 $cl_block .= '<p>'.$bcontent.'</p>'."\n"; 169 } 170 break; 171 case XOOPS_CENTERBLOCK_RIGHT: 172 if ($title != "") { 173 $cr_block .= '<p><b>'.$title.'</b><hr />'.$bcontent.'</p>'."\n"; 174 } else { 175 $cr_block .= '<p>'.$bcontent.'</p>'."\n"; 176 } 177 break; 178 default: 179 break; 180 } 181 unset($bcontent, $title); 182 } 183 echo '<table width="100%">'.$cc_block.'<tr valign="top"><td width="50%">'.$cl_block.'</td><td width="50%">'.$cr_block.'</td></tr></table>'."\n"; 184 } 185 } 186 187 function openThread($width="100%") 188 { 189 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>"; 190 } 191 192 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="") 193 { 194 if ( $color_number == 1 ) { 195 $bg = 'bg1'; 196 } else { 197 $bg = 'bg3'; 198 } 199 echo "<tr align='left'><td valign='top' class='$bg' nowrap='nowrap'><b>$username</b><br />$rank_title<br />$rank_image<br />$avatar_image<br /><br />$reg_date<br />$posts<br />$user_from<br /><br />$online_image</td>"; 200 echo "<td valign='top' class='$bg'><table width='100%' border='0'><tr><td valign='top'>$subject_image <b>$subject</b></td><td align='right'>".$ip_image."".$reply_image."".$edit_image."".$delete_image."</td></tr>"; 201 echo "<tr><td colspan='2'><p>$text</p></td></tr></table></td></tr>"; 202 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>"; 203 } 204 205 function closeThread() 206 { 207 echo '</table></td></tr></table>'; 208 } 209 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |