$myrow = DB_fetchArray($result); $secGroup = DB_getItem($_TABLES['groups'], "grp_name", "grp_id='{$myrow['grp_access']}'"); if (SEC_inGroup($secGroup)) { $p->set_var('cid', $myrow['cid']); $p->set_var('category_name', $myts->makeTboxData4Show($myrow['title'])); if ($mydownloads_useshots && $myrow['imgurl'] && $myrow['imgurl'] != "http://") { $imgurl = $myts->makeTboxData4Edit($myrow['imgurl']); $category_image_link = '<a href="' . $_CONF[site_url] . '/filemgmt/viewcat.php?cid=' . $myrow['cid'] . '">' . '<img src="' . $filemgmt_SnapCatURL . $imgurl . '" width="' . $mydownloads_shotwidth . '" style="border:none;" alt=""' . XHTML . '></a>'; $p->set_var('category_link', $category_image_link); } else { $p->set_var('category_link', ''); } $downloadsWaitingSubmission = getTotalItems($myrow['cid'], 0); $p->set_var('num_files', getTotalItems($myrow['cid'], 1)); if ($downloadsWaitingSubmission > 0) { $p->set_var('files_waiting_submission', '(' . getTotalItems($myrow['cid'], 0) . ')'); } else { $p->set_var('files_waiting_submission', ''); } // get child category objects $subcategories = ''; $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], 'title'); $space = 0; $chcount = 0; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['title']); if ($chcount >= $numSubCategories2Show) { $subcategories .= "..."; break; }
// ------------------------------------------------------------------------ // include "header.php"; $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object include_once XOOPS_ROOT_PATH . "/class/xoopstree.php"; $mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"), "cid", "pid"); $xoopsOption['template_main'] = 'mylinks_index.html'; include XOOPS_ROOT_PATH . "/header.php"; $result = $xoopsDB->query("SELECT cid, title, imgurl FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE pid = 0 ORDER BY title") or exit("Error"); $count = 1; while ($myrow = $xoopsDB->fetchArray($result)) { $imgurl = ''; if ($myrow['imgurl'] && $myrow['imgurl'] != "http://") { $imgurl = $myts->makeTboxData4Edit($myrow['imgurl']); } $totallink = getTotalItems($myrow['cid'], 1); // get child category objects $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "title"); $space = 0; $chcount = 0; $subcategories = ''; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['title']); if ($chcount > 5) { $subcategories .= "..."; break; } if ($space > 0) { $subcategories .= ", "; }
$orderby = convertorderbyin($orderby); $pathstring = '<a href="index.php">' . _MD_MAIN . '</a> : '; $nicepath = $mytree->getNicePathFromId($cid, "title", "{$_CONF['site_url']}/filemgmt/viewcat.php"); $pathstring .= $nicepath; $p->set_var('category_path_link', $pathstring); $p->set_var('cid', $cid); // get child category objects $subcategories = ''; $arr = array(); $arr = $mytree->getFirstChild($cid, 'title'); if (count($arr) > 0) { $count = 1; foreach ($arr as $ele) { $totalfiles = 0; $chtitle = $myts->makeTboxData4Show($ele['title']); $totalfiles = $totalfiles + getTotalItems($ele['cid'], 1); $subcategories = '<a href="' . $_CONF[site_url] . '/filemgmt/viewcat.php?cid=' . $ele['cid'] . '">' . $chtitle . '</a> (' . $totalfiles . ') '; $p->set_var('subcategories', $subcategories); $p->set_var('new_table_row', $count == 1 ? '<tr>' : ''); $p->set_var('end_of_row', $count == $numCategoriesPerRow ? '</tr>' : ''); $count = $count == $numCategoriesPerRow ? 1 : $count + 1; $p->parse('category_records', 'category', true); } } else { $p->set_var('subcategories', ''); $p->set_var('new_table_row', '<tr>'); $p->set_var('end_of_row', '</tr>'); $p->parse('category_records', 'category'); } $sql = "SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_filedetail']} a "; $sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON a.cid=b.cid ";
redirect_header("singlefile.php?cid={$cid}&lid={$lid}", 0, "Jump to download"); } } } // redirect end $sql = "SELECT cid, title, imgurl FROM " . $xoopsDB->prefix("mydownloads_cat") . " WHERE pid = 0 ORDER BY title"; $result = $xoopsDB->query($sql); $count = 1; while ($myrow = $xoopsDB->fetchArray($result)) { $title = $myts->makeTboxData4Show($myrow['title']); if ($myrow['imgurl'] && $myrow['imgurl'] != "http://") { $imgurl = $myts->makeTboxData4Edit($myrow['imgurl']); } else { $imgurl = ''; } $totaldownload = getTotalItems($myrow['cid'], 1); // get child category objects $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "title"); $space = 0; $chcount = 0; $subcategories = ""; $subcat = array(); foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['title']); if ($chcount <= 5) { if ($space > 0) { $subcategories .= ", "; } $subcategories .= "<a href=\"" . XOOPS_URL . "/modules/mydownloads/viewcat.php?cid=" . $ele['cid'] . "\">" . $chtitle . "</a>"; $space++;
OpenTable(); $result = $xoopsDB->query("select cid, cname, cdesc, cimg, cimgwidth, cimgheight from " . $xoopsDB->prefix("tutorials_categorys") . " where scid=0 order by cname"); $catcount = $xoopsDB->getRowsNum($result); echo "<center><img src=\"images/tutorials.gif\" border=\"0\" Alt=\"Tutorials\"><br /><br />"; if ($heading == "") { printf(_MD_WELCOMETOTUTS, $xoopsConfig['sitename']); } else { echo $heading; } echo "<br /><br />"; echo "<table width=80% cellspacing=4 cellpadding=0 border=0 valign=top><tr>"; while ($myrow = $xoopsDB->fetchArray($result)) { $cname = $myts->makeTboxData4Show($myrow['cname']); $cdesc = $myts->makeTboxData4Show($myrow['cdesc']); $cimg = $myts->makeTboxData4Show($myrow['cimg']); $number = getTotalItems($myrow['cid'], 1, 3); if ($category_visdefault == 1) { $show = $category_visualize; } else { $show = $category_default; } $arr = array(); $arr = $mytree->getFirstChild($myrow['cid'], "cname"); $space = 0; $chcount = 0; $subcats = ""; foreach ($arr as $ele) { $chtitle = $myts->makeTboxData4Show($ele['cname']); if ($chcount > $maxsubcatshow) { $subcats .= "..."; break;
$gchildCategories = ''; $subCatCount = count($gchildCatObjs); $lpLimit = min(array($subCatLimit, $subCatCount)); $i = 0; foreach ($gchildCatObjs as $gchildCatObj) { $gchtitle = $myts->htmlSpecialChars($gchildCatObj->getVar('title')); $gchildCategories .= $i > 0 ? ', ' : ''; $gchildCategories .= "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid=" . $gchildCatObj->getVar('cid') . "'>{$gchtitle}</a>"; if ($i < $lpLimit) { $i++; } else { break; } } $gchildCategories = $subCatCount > $subCatLimit ? $gchildCategories . '...' : $gchildCategories; $totalLinks = getTotalItems($subCatObj->getVar('cid'), 1); $xoopsTpl->append('subcategories', array('image' => '', 'id' => $subCatObj->getVar('cid'), 'title' => $myts->htmlSpecialChars($subCatObj->getVar('title')), 'infercategories' => $gchildCategories, 'totallinks' => $totalLinks, 'count' => $count)); $count++; } $LinkCountResult = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE cid='{$cid}' AND status>0"); } else { $list = $_GET['list']; $orderby = "title ASC"; $xoopsTpl->assign('list_mode', true); //TODO: need to filter $_GET['list'] input var $categoryPath = sprintf(_MD_MYLINKS_LINKS_LIST, $myts->htmlSpecialChars($_GET['list'])); $thisPageTitle = $categoryPath; $xoopsTpl->assign('category_path', $categoryPath); $LinkCountResult = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE title LIKE '" . $myts->addSlashes($_GET['list']) . "%' AND status>0"); } if (1 == $xoopsModuleConfig['useshots']) {
$childCount = intval($mylinksCatHandler->getCount($criteria)); //now retrieve the info for the first 'subcatLimit' categories $criteria->setLimit($subcatLimit); $criteria->setSort('title'); $childFields = array('pid', 'title'); $childTitleArray = $mylinksCatHandler->getAll($criteria, $childFields, false, false); $lpLimit = min(array($subcatLimit, count($childTitleArray))); $subcategories = ''; for ($i = 0; $i < $lpLimit; $i++) { $chtitle = $myts->htmlSpecialChars($childTitleArray[$i]['title']); $subcategories .= $i > 0 ? ', ' : ''; $subcategories .= "<a href='" . XOOPSMYLINKURL . "/viewcat.php?cid=" . $childTitleArray[$i]['cid'] . "'>{$chtitle}</a>"; } $subcategories = $childCount > $subcatLimit ? $subcategories . '...' : $subcategories; // get number of links in each subcategory $totalLink = getTotalItems($catObj->getVar('cid'), 1); $xoopsTpl->append('categories', array('image' => $imgurl, 'id' => $catObj->getVar('cid'), 'title' => $myts->htmlSpecialChars($catObj->getVar('title')), 'subcategories' => $subcategories, 'totallink' => $totalLink, 'count' => $count)); $count++; } $sql = "SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE status>0"; list($numActiveLinks) = $xoopsDB->fetchRow($xoopsDB->query($sql)); $xoopsTpl->assign('lang_thereare', sprintf(_MD_MYLINKS_THEREARE, $numActiveLinks)); if (1 == $xoopsModuleConfig['useshots']) { $xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']); $xoopsTpl->assign('tablewidth', $xoopsModuleConfig['shotwidth'] + 10); $xoopsTpl->assign('show_screenshot', true); $xoopsTpl->assign('lang_noscreenshot', _MD_MYLINKS_NOSHOTS); } $xoopsTpl->assign('lang_description', _MD_MYLINKS_DESCRIPTIONC); $xoopsTpl->assign('lang_lastupdate', _MD_MYLINKS_LASTUPDATEC); $xoopsTpl->assign('lang_hits', _MD_MYLINKS_HITSC);
$chcount = 0; $infercategories = ""; foreach ($sub_arr as $sub_ele) { $chtitle = $myts->makeTboxData4Show($sub_ele['title']); if ($chcount > 5) { $infercategories .= "..."; break; } if ($space > 0) { $infercategories .= ", "; } $infercategories .= "<a href=\"" . XOOPS_URL . "/modules/mydownloads/viewcat.php?cid=" . $sub_ele['cid'] . "\">" . $chtitle . "</a>"; $space++; $chcount++; } $xoopsTpl->append('subcategories', array('title' => $myts->makeTboxData4Show($ele['title']), 'id' => $ele['cid'], 'infercategories' => $infercategories, 'totallinks' => getTotalItems($ele['cid'], 1), 'count' => $scount)); $scount++; } } if ($xoopsModuleConfig['useshots'] == 1) { $xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']); $xoopsTpl->assign('tablewidth', $xoopsModuleConfig['shotwidth'] + 10); $xoopsTpl->assign('show_screenshot', true); $xoopsTpl->assign('lang_noscreenshot', _MD_NOSHOTS); } if (!empty($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { $isadmin = true; } else { $isadmin = false; } $fullcountresult = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mydownloads_downloads") . " WHERE cid={$cid} AND status>0");
function makeCategoryPart($cid) { global $_CONF, $_DLM_CONF, $LANG_DLM, $mytree; $T = new Template($_DLM_CONF['path_layout']); $T->set_file(array('categorypart' => 'filelisting_category.thtml', 'categoryrow' => 'filelisting_category_row.thtml', 'categoryitem' => 'filelisting_category_item.thtml')); DLM_setDefaultTemplateVars($T); $arr = $mytree->getFirstChild($cid, 'corder'); // all child ID are listed (Affected by the language mode) if (count($arr) == 0) { return ''; } // if ($_DLM_CONF['numCategoriesPerRow'] < 1) $_DLM_CONF['numCategoriesPerRow'] = 1; // probably no longer necessary // if ($_DLM_CONF['numCategoriesPerRow'] > 6) $_DLM_CONF['numCategoriesPerRow'] = 6; // probably no longer necessary $count = 0; foreach ($arr as $ele) { // Each category $chtitle = DLM_htmlspecialchars($ele['title']); $T->set_var('cid', $ele['cid']); $T->set_var('chtitle', $chtitle); $T->set_var('totaldownload', getTotalItems($ele['cid'])); $category_image_link = ' '; if ($_DLM_CONF['download_useshots']) { if ($ele['imgurl'] && $ele['imgurl'] != "http://") { $imgurl = $_DLM_CONF['snapcat_url'] . '/' . DLM_htmlspecialchars($ele['imgurl']); } else { $imgurl = $_CONF['site_url'] . '/downloads/images/download.png'; } $category_image_link = COM_createImage($imgurl, $chtitle, array('width' => $_DLM_CONF['download_shotwidth'])); $category_image_link = COM_createLink($category_image_link, $_CONF['site_url'] . '/downloads/index.php?cid=' . $ele['cid']); } $T->set_var('category_link', $category_image_link); $T->parse('category_row', 'categoryitem', true); $count++; if ($count == $_DLM_CONF['numCategoriesPerRow']) { $T->parse('category_records', 'categoryrow', true); $T->set_var('category_row', ''); $count = 0; } } if ($count > 0) { $T->parse('category_records', 'categoryrow', true); } return $T->finish($T->parse('category_part', 'categorypart')); }