Example #1
0
 function getLevel()
 {
     global $xoopsModuleConfig, $forumUrl;
     $level = newbb_calculateLevel($this->user->getVar("posts"), $this->user->getVar("user_regdate"));
     if ($xoopsModuleConfig['user_level'] == 2) {
         static $rpg_images;
         if (!isset($rpg_images)) {
             $icon_handler = newbb_getIconHandler();
             $rpg_path = $icon_handler->getPath("rpg");
             foreach (array("img_left", "img_backing", "img_right", "blue", "green", "orange") as $img) {
                 $rpg_images[$img] = XOOPS_URL . '/' . $rpg_path . '/' . $img . '.gif';
             }
         }
         $table = "<table class='userlevel'><tr><td class='end'><img src='" . $rpg_images['img_left'] . "' alt='' /></td><td class='center' background='" . $rpg_images['img_backing'] . "'><img src='%s' width='%d' alt='' /></td><td><img src='" . $rpg_images['img_right'] . "' alt='' /></td></tr></table>";
         $info = _MD_LEVEL . " " . $level['level'] . "<br />" . _MD_HP . " " . $level['hp'] . " / " . $level['hp_max'] . "<br />" . sprintf($table, $rpg_images["orange"], $level['hp_width']);
         $info .= _MD_MP . " " . $level['mp'] . " / " . $level['mp_max'] . "<br />" . sprintf($table, $rpg_images["green"], $level['mp_width']);
         $info .= _MD_EXP . " " . $level['exp'] . "<br />" . sprintf($table, $rpg_images["blue"], $level['exp_width']);
     } else {
         $info = _MD_LEVEL . " " . $level['level'] . "; " . _MD_EXP . " " . $level['exp'] . "<br />";
         $info .= _MD_HP . " " . $level['hp'] . " / " . $level['hp_max'] . "<br />";
         $info .= _MD_MP . " " . $level['mp'] . " / " . $level['mp_max'];
     }
     return $info;
 }
Example #2
0
$reported = $report_handler->getCount(new Criteria("report_result", 0));
if ($reported > 0) {
    $xoopsTpl->assign('report_post', sprintf(_MD_NEWBB_SEEWAITREPORT, $reported));
}
if (count($forums_array) > 0) {
    foreach ($forums_array[0] as $parent => $forum) {
        if (isset($forums_array[$forum['forum_id']])) {
            $forum['subforum'] =& $forums_array[$forum['forum_id']];
        }
        $forumsByCat[$forum['forum_cid']][] = $forum;
    }
}
$category_array = array();
//$toggles = newbb_getcookie('G', true);
$toggles = NULL;
$icon_handler = newbb_getIconHandler();
$category_icon = array("expand" => $icon_handler->getImageSource("minus"), "collapse" => $icon_handler->getImageSource("plus"));
foreach (array_keys($categories) as $id) {
    $forums = array();
    $onecat =& $categories[$id];
    $cat_element_id = "cat_" . $onecat['cat_id'];
    $expand = count($toggles) > 0 ? in_array($cat_element_id, $toggles) ? false : true : true;
    $cat_display = $expand ? 'block;' : 'none;';
    $cat_icon_display = $expand ? $category_icon["expand"] : $category_icon["collapse"];
    if (isset($forumsByCat[$onecat['cat_id']])) {
        $forums =& $forumsByCat[$onecat['cat_id']];
    }
    $cat_sponsor = array();
    @(list($url, $title) = array_map("trim", preg_split("/ /", $onecat['cat_url'], 2)));
    if (empty($title)) {
        $title = $url;
Example #3
0
 /** 
  * TODO: refactor
  */
 function displayAttachment($asSource = false)
 {
     global $xoopsModule, $xoopsModuleConfig;
     $post_attachment = '';
     $attachments = $this->getAttachment();
     if (is_array($attachments) && count($attachments) > 0) {
         $icon_handler = newbb_getIconHandler();
         $mime_path = $icon_handler->getPath("mime");
         include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar("dirname", "n") . '/include/functions.image.php';
         $image_extensions = array("jpg", "jpeg", "gif", "png", "bmp");
         // need improve !!!
         $post_attachment .= '<br /><strong>' . _MD_ATTACHMENT . '</strong>:';
         $post_attachment .= '<br /><hr size="1" noshade="noshade" /><br />';
         foreach ($attachments as $key => $att) {
             $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.');
             $filetype = $file_extension;
             if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) {
                 $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif';
             } else {
                 $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif';
             }
             $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']);
             $file_size = number_format($file_size / 1024, 2) . " KB";
             if (in_array(strtolower($file_extension), $image_extensions) && $xoopsModuleConfig['media_allowed']) {
                 $post_attachment .= '<br /><img src="' . $icon_filetype . '" alt="' . $filetype . '" /><strong>&nbsp; ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>';
                 $post_attachment .= '<br />' . newbb_attachmentImage($att['name_saved']);
                 $isDisplayed = true;
             } else {
                 global $xoopsUser;
                 if ($xoopsUser && $xoopsUser->uid() > 0 && $xoopsUser->isactive() || empty($xoopsModuleConfig['show_only_user_attach'])) {
                     $post_attachment .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname", "n") . '/dl_attachment.php?attachid=' . $key . '&amp;post_id=' . $this->getVar('post_id') . '"> <img src="' . $icon_filetype . '" alt="' . $filetype . '" /> ' . $att['name_display'] . '</a> ' . _MD_FILESIZE . ': ' . $file_size . '; ' . _MD_HITS . ': ' . $att['num_download'];
                 } else {
                     $post_attachment .= _MD_NEWBB_SEENOTGUEST;
                 }
             }
             $post_attachment .= '<br />';
         }
     }
     return $post_attachment;
 }
 /**
  * Display forrum images
  *
  * @param	string	$image		image name, without extension
  * @param	string	$alt		alt message
  * @param	boolean	$display	true for return image anchor; faulse for assign to $xoopsTpl
  * @param	string	$extra		extra attribute for the image
  * @return	mixed
  */
 function newbb_displayImage($image, $alt = "", $display = true, $extra = "class='forum_icon'")
 {
     $icon_handler = newbb_getIconHandler();
     if (empty($display)) {
         return $icon_handler->assignImage($image, $alt, $extra);
     } else {
         return $icon_handler->getImage($image, $alt, $extra);
     }
 }