getByDirname('content'); ($xoopsUser) ? $groups = $xoopsUser->getGroups() : $groups = XOOPS_GROUP_ANONYMOUS; $allowedItems = $groupPermHandler->getItemIds("content_page_view", $groups, $module->getVar("mid")); if (!in_array($id, $allowedItems) && $id!=0) { redirect_header(XOOPS_URL, 2, _NOPERM, true); } if (file_exists("language/".$xoopsConfig['language']."/modinfo.php")) { include("language/".$xoopsConfig['language']."/modinfo.php"); } else { include("language/english/modinfo.php"); } $result = $xoopsDB->query("SELECT storyid, title, parent_id FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)); while ($item = $xoopsDB->fetchArray($result)){ $allItems[] = $item; } //print_r($allItems); if ($id != 0) { $result = $xoopsDB->queryF("SELECT storyid, ptitle, title, keywords,page_description,text, visible, nohtml, nosmiley, nobreaks, nocomments, link, address, date, header_img FROM " . $xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE storyid=".$id); }else { $result = $xoopsDB->queryF("SELECT storyid, ptitle, title, keywords,page_description, text, visible, nohtml, nosmiley, nobreaks, nocomments, link, address, date, header_img FROM " . $xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE homepage=1"); } $showerror= isset($_GET["showerror"])?intval($_GET["showerror"]):0; if ($xoopsDB->getRowsNum($result) == 0 || $showerror == 1) { $result = $xoopsDB->queryF("SELECT storyid, ptitle, title, keywords,page_description, text, visible, nohtml, nosmiley, nobreaks, nocomments, link, address, date, header_img FROM ".$xoopsDB->prefix(_MIC_CONTENT_PREFIX)." WHERE epage=1"); list($myid, $ptitle, $title,$keywords,$description, $text, $visible, $nohtml, $nosmiley, $nobreaks, $nocomments, $link, $address, $date, $header) = $xoopsDB->fetchRow($result); $id = $myid; } else{ list($storyid, $ptitle, $title, $keywords,$description,$text, $visible, $nohtml, $nosmiley, $nobreaks, $nocomments, $link, $address, $date, $header) = $xoopsDB->fetchRow($result); $id = $storyid; } if ($link == 1) { $includeContent = XOOPS_ROOT_PATH."/modules/"._MIC_DIR_NAME."/content/".$address; if (file_exists($includeContent)){ ob_start(); include($includeContent); $content = ob_get_contents(); ob_end_clean(); $xoopsTpl->assign('xoops_pagetitle', $title); if ($xoopsModuleConfig['cont_title'] == 1){ if (isset($ptitle)) $xoopsTpl->assign('title', $ptitle); else $xoopsTpl->assign('title', $title); } $xoopsTpl->assign('content', $content); $xoopsTpl->assign('nocomments', $nocomments); $xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_C_INTARTIGO,$xoopsConfig['sitename']).'&body='.sprintf(_C_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/content/index.php?id='.$id); $xoopsTpl->assign('lang_printerpage', _C_PRINTERFRIENDLY); $xoopsTpl->assign('lang_sendstory', _C_SENDSTORY); $xoopsTpl->assign('date', $date); $xoopsTpl->assign('pagewrap',1); } else{ redirect_header("index.php",1,_C_FILENOTFOUND); } } else { //Should we show crumbs if ($xoopsModuleConfig['cont_crumbs'] == 1){ //echo $id; $xoopsTpl->assign('breadcrumbs', array_reverse(backOneLevel($allItems, $id))); } //Should we redirect or continue with this page if(isset($address) && strlen($address) > 0){ echo $address; //header("location: " . $address); exit; } $xoopsOption['template_main'] = 'ct_index.html'; (isset($nohtml) && $nohtml == 1) ? $html = 0 : $html = 1; (isset($nosmiley) && $nosmiley == 1) ? $smiley = 0 : $smiley = 1; (isset($nobreaks) && $nobreaks == 1) ? $breaks = 0 : $breaks = 1; $myts =& MyTextSanitizer::getInstance(); $contentPages = explode("[pagebreak]", $text); $pageCount = count($contentPages); //split up the pages if ($pageCount > 1) { include_once XOOPS_ROOT_PATH . "/class/pagenav.php"; $nav = new XoopsPageNav($pageCount, 1, $currentPage, "page", "id=$id"); $xoopsTpl->assign('nav', $nav->renderNav()); $xoopsTpl->assign('content', $contentPages[$currentPage]); } else { $xoopsTpl->assign('content', stripslashes($text)); } $xoopsTpl->assign('xoops_pagetitle', $title); if ($xoopsModuleConfig['cont_title'] == 1){ if (isset($ptitle)) $xoopsTpl->assign('title', $ptitle); else $xoopsTpl->assign('title', $title); } if (isset($header)){ $xoopsTpl->assign('header_image', $header); } $xoopsTpl->assign('edit_width', $xoopsModuleConfig['cont_edit_width']); $xoopsTpl->assign('edit_height', $xoopsModuleConfig['cont_edit_height']); if ($xoopsModuleConfig['cont_edit_width'] == 0 || $xoopsModuleConfig['cont_edit_height'] == 0){ $xoopsTpl->assign('editpopup', '0'); }else{ $xoopsTpl->assign('editpopup', '1'); } $xoopsTpl->assign('nocomments', $nocomments); $xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_C_INTARTIGO,$xoopsConfig['sitename']).'&body='.sprintf(_C_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/content/index.php?id='.$id); $xoopsTpl->assign('lang_printerpage', _C_PRINTERFRIENDLY); $xoopsTpl->assign('lang_sendstory', _C_SENDSTORY); $xoopsTpl->assign('date', $date); } $xoopsTpl->assign('local_admin', ($groupPermHandler->checkRight("content_page_write", $id, $groups, $module->getVar("mid")) || $groupPermHandler->checkRight("content_page_add", $id, $groups, $module->getVar("mid")) || $groupPermHandler->checkRight("content_admin", NULL, $groups, $module->getVar("mid")))); $xoopsTpl->assign('permit_edit', $groupPermHandler->checkRight("content_page_write", $id, $groups, $module->getVar("mid"))); $xoopsTpl->assign('permit_add', $groupPermHandler->checkRight("content_page_add", $id, $groups, $module->getVar("mid"))); $xoopsTpl->assign('permit_admin', $groupPermHandler->checkRight("content_admin", NULL, $groups, $module->getVar("mid"))); $xoopsTpl->assign( 'xoops_pagetitle' , $ptitle ) ; if (is_object($xoTheme)) { $xoTheme->addMeta( 'meta', 'keywords',$keywords); $xoTheme->addMeta( 'meta', 'description',$description); //$xoTheme->addMeta( 'meta', 'xoops_pagetitle',$this->_title); } else { $xoopsTpl->assign('xoops_meta_keywords','keywords',$keywords); $xoopsTpl->assign('xoops_meta_description',$description); } $xoopsTpl->assign('id', $id); include XOOPS_ROOT_PATH.'/include/comment_view.php'; include_once XOOPS_ROOT_PATH.'/footer.php'; function backOneLevel($items, $ctid){ foreach ($items as $item){ if ($item["storyid"] == $ctid){ $crumbsout[] = $item; if($item["parent_id"]!=0) $crumbsout = array_merge($crumbsout, backOneLevel($items, $item["parent_id"])); return $crumbsout; } } } ?>