onokazu
onoka****@users*****
2005年 6月 11日 (土) 11:32:43 JST
Index: xoops2jp/html/modules/mydownloads/index.php diff -u xoops2jp/html/modules/mydownloads/index.php:1.2 xoops2jp/html/modules/mydownloads/index.php:1.3 --- xoops2jp/html/modules/mydownloads/index.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/modules/mydownloads/index.php Sat Jun 11 11:32:42 2005 @@ -1,5 +1,5 @@ <?php -// $Id: index.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: index.php,v 1.3 2005/06/11 02:32:42 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -38,48 +38,48 @@ $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 = ""; - foreach($arr as $ele){ - $chtitle=$myts->makeTboxData4Show($ele['title']); - if ($chcount>5){ - $subcategories .= "..."; - break; - } - if ($space>0) { - $subcategories .= ", "; - } - $subcategories .= "<a href=\"".XOOPS_URL."/modules/mydownloads/viewcat.php?cid=".$ele['cid']."\">".$chtitle."</a>"; - $space++; - $chcount++; - } - $xoopsTpl->append('categories', array('image' => $imgurl, 'id' => $myrow['cid'], 'title' => $myts->makeTboxData4Show($myrow['title']), 'subcategories' => $subcategories, 'totaldownloads' => $totaldownload, 'count' => $count)); - $count++; + $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 = ""; + foreach($arr as $ele){ + $chtitle=$myts->makeTboxData4Show($ele['title']); + if ($chcount>5){ + $subcategories .= "..."; + break; + } + if ($space>0) { + $subcategories .= ", "; + } + $subcategories .= "<a href=\"".XOOPS_URL."/modules/mydownloads/viewcat.php?cid=".$ele['cid']."\">".$chtitle."</a>"; + $space++; + $chcount++; + } + $xoopsTpl->append('categories', array('image' => $imgurl, 'id' => $myrow['cid'], 'title' => $myts->makeTboxData4Show($myrow['title']), 'subcategories' => $subcategories, 'totaldownloads' => $totaldownload, 'count' => $count)); + $count++; } list($numrows)=$xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE status>0")); $xoopsTpl->assign('lang_thereare', sprintf(_MD_THEREARE,$numrows)); 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); + $xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']); + $xoopsTpl->assign('tablewidth', $xoopsModuleConfig['shotwidth'] + 10); + $xoopsTpl->assign('show_screenshot', true); + $xoopsTpl->assign('lang_noscreenshot', _MD_NOSHOTS); } if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { - $isadmin = true; + $isadmin = true; } else { - $isadmin = false; + $isadmin = false; } $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); @@ -101,32 +101,32 @@ $xoopsTpl->assign('lang_comments' , _COMMENTS); $result = $xoopsDB->query("SELECT d.lid, d.cid, d.title, d.url, d.homepage, d.version, d.size, d.platform, d.logourl, d.status, d.date, d.hits, d.rating, d.votes, d.comments, t.description FROM ".$xoopsDB->prefix("mydownloads_downloads")." d, ".$xoopsDB->prefix("mydownloads_text")." t WHERE d.status>0 AND d.lid=t.lid ORDER BY date DESC", $xoopsModuleConfig['newdownloads'], 0); while(list($lid, $cid, $dtitle, $url, $homepage, $version, $size, $platform, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description)=$xoopsDB->fetchRow($result)) { - $path = $mytree->getPathFromId($cid, "title"); - $path = substr($path, 1); - $path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' board='0' alt=''> ",$path); - $rating = number_format($rating, 2); - $dtitle = $myts->makeTboxData4Show($dtitle); - $url = $myts->makeTboxData4Show($url); - $homepage = $myts->makeTboxData4Show($homepage); - $version = $myts->makeTboxData4Show($version); - $size = PrettySize($myts->makeTboxData4Show($size)); - $platform = $myts->makeTboxData4Show($platform); - $logourl = $myts->makeTboxData4Show($logourl); - $datetime = formatTimestamp($time,"s"); - $description = $myts->makeTareaData4Show($description,0); //no html - $new = newdownloadgraphic($time, $status); - $pop = popgraphic($hits); - if ($isadmin) { - $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; - } else { - $adminlink = ''; - } - if ($votes == 1) { - $votestring = _MD_ONEVOTE; - } else { - $votestring = sprintf(_MD_NUMVOTES,$votes); - } - $xoopsTpl->append('file', array('id' => $lid,'cid'=>$cid,'rating' => $rating,'title' => $dtitle.$new.$pop,'logourl' => $logourl,'updated' => $datetime,'description' => $description,'adminlink' => $adminlink,'hits' => $hits,'votes' => $votestring, 'comments' => $comments, 'platform' => $platform,'size' => $size,'homepage' => $homepage,'version' => $version,'category' => $path,'lang_dltimes' => sprintf(_MD_DLTIMES,$hits),'mail_subject' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename'])),'mail_body' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mydownloads/singlefile.php?cid='.$cid.'&lid='.$lid))); + $path = $mytree->getPathFromId($cid, "title"); + $path = substr($path, 1); + $path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' board='0' alt='' /> ",$path); + $rating = number_format($rating, 2); + $dtitle = $myts->makeTboxData4Show($dtitle); + $url = $myts->makeTboxData4Show($url); + $homepage = $myts->makeTboxData4Show($homepage); + $version = $myts->makeTboxData4Show($version); + $size = PrettySize($myts->makeTboxData4Show($size)); + $platform = $myts->makeTboxData4Show($platform); + $logourl = $myts->makeTboxData4Show($logourl); + $datetime = formatTimestamp($time,"s"); + $description = $myts->makeTareaData4Show($description,0); //no html + $new = newdownloadgraphic($time, $status); + $pop = popgraphic($hits); + if ($isadmin) { + $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; + } else { + $adminlink = ''; + } + if ($votes == 1) { + $votestring = _MD_ONEVOTE; + } else { + $votestring = sprintf(_MD_NUMVOTES,$votes); + } + $xoopsTpl->append('file', array('id' => $lid,'cid'=>$cid,'rating' => $rating,'title' => $dtitle.$new.$pop,'logourl' => $logourl,'updated' => $datetime,'description' => $description,'adminlink' => $adminlink,'hits' => $hits,'votes' => $votestring, 'comments' => $comments, 'platform' => $platform,'size' => $size,'homepage' => $homepage,'version' => $version,'category' => $path,'lang_dltimes' => sprintf(_MD_DLTIMES,$hits),'mail_subject' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename'])),'mail_body' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mydownloads/singlefile.php?cid='.$cid.'&lid='.$lid))); } include XOOPS_ROOT_PATH."/modules/mydownloads/footer.php"; Index: xoops2jp/html/modules/mydownloads/ratefile.php diff -u xoops2jp/html/modules/mydownloads/ratefile.php:1.2 xoops2jp/html/modules/mydownloads/ratefile.php:1.3 --- xoops2jp/html/modules/mydownloads/ratefile.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/modules/mydownloads/ratefile.php Sat Jun 11 11:32:42 2005 @@ -1,5 +1,5 @@ <?php -// $Id: ratefile.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: ratefile.php,v 1.3 2005/06/11 02:32:42 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -30,72 +30,72 @@ $myts =& MyTextSanitizer::getInstance(); // MyTextSanitizer object if(!empty($HTTP_POST_VARS['submit'])) { - $eh = new ErrorHandler; //ErrorHandler object - if(empty($xoopsUser)){ - $ratinguser = 0; - }else{ - $ratinguser = $xoopsUser->getVar('uid'); - } - - //Make sure only 1 anonymous from an IP in a single day. - $anonwaitdays = 1; - $ip = getenv("REMOTE_ADDR"); - $lid = intval($HTTP_POST_VARS['lid']); - $cid = intval($HTTP_POST_VARS['cid']); - $rating = intval($HTTP_POST_VARS['rating']); - - // Check if Rating is Null - if ($rating=="--") { - redirect_header("ratefile.php?cid=".$cid."&lid=".$lid."",4,_MD_NORATING); - exit(); - } - - // Check if Download POSTER is voting (UNLESS Anonymous users allowed to post) - if ($ratinguser != 0) { - $result=$xoopsDB->query("SELECT submitter FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid"); - while(list($ratinguserDB)=$xoopsDB->fetchRow($result)) { - if ($ratinguserDB==$ratinguser) { - redirect_header("index.php",4,_MD_CANTVOTEOWN); - exit(); - } - } - - // Check if REG user is trying to vote twice. - $result=$xoopsDB->query("SELECT ratinguser FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid=$lid"); - while(list($ratinguserDB)=$xoopsDB->fetchRow($result)) { - if ($ratinguserDB==$ratinguser) { - redirect_header("index.php",4,_MD_VOTEONCE); - exit(); - } - } - - } else { - - // Check if ANONYMOUS user is trying to vote more than once per day. - $yesterday = (time()-(86400 * $anonwaitdays)); - $result=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid=$lid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); - list($anonvotecount) = $xoopsDB->fetchRow($result); - if ($anonvotecount >= 1) { - redirect_header("index.php",4,_MD_VOTEONCE); - exit(); - } - } - - //All is well. Add to Line Item Rate to DB. - $newid = $xoopsDB->genId($xoopsDB->prefix("mydownloads_votedata")."_ratingid_seq"); - $datetime = time(); - $sql = sprintf("INSERT INTO %s (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix("mydownloads_votedata"), $newid, $lid, $ratinguser, $rating, $ip, $datetime); - $xoopsDB->query($sql) or $eh("0013"); - - //All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. - updaterating($lid); - $ratemessage = _MD_VOTEAPPRE."<br />".sprintf(_MD_THANKYOU,$xoopsConfig[sitename]); - redirect_header("index.php",4,$ratemessage); - exit(); + $eh = new ErrorHandler; //ErrorHandler object + if(empty($xoopsUser)){ + $ratinguser = 0; + }else{ + $ratinguser = $xoopsUser->getVar('uid'); + } + + //Make sure only 1 anonymous from an IP in a single day. + $anonwaitdays = 1; + $ip = getenv("REMOTE_ADDR"); + $lid = intval($HTTP_POST_VARS['lid']); + $cid = intval($HTTP_POST_VARS['cid']); + $rating = intval($HTTP_POST_VARS['rating']); + + // Check if Rating is Null + if ($rating=="--") { + redirect_header("ratefile.php?cid=".$cid."&lid=".$lid."",4,_MD_NORATING); + exit(); + } + + // Check if Download POSTER is voting (UNLESS Anonymous users allowed to post) + if ($ratinguser != 0) { + $result=$xoopsDB->query("SELECT submitter FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid"); + while(list($ratinguserDB)=$xoopsDB->fetchRow($result)) { + if ($ratinguserDB==$ratinguser) { + redirect_header("index.php",4,_MD_CANTVOTEOWN); + exit(); + } + } + + // Check if REG user is trying to vote twice. + $result=$xoopsDB->query("SELECT ratinguser FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid=$lid"); + while(list($ratinguserDB)=$xoopsDB->fetchRow($result)) { + if ($ratinguserDB==$ratinguser) { + redirect_header("index.php",4,_MD_VOTEONCE); + exit(); + } + } + + } else { + + // Check if ANONYMOUS user is trying to vote more than once per day. + $yesterday = (time()-(86400 * $anonwaitdays)); + $result=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_votedata")." WHERE lid=$lid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); + list($anonvotecount) = $xoopsDB->fetchRow($result); + if ($anonvotecount >= 1) { + redirect_header("index.php",4,_MD_VOTEONCE); + exit(); + } + } + + //All is well. Add to Line Item Rate to DB. + $newid = $xoopsDB->genId($xoopsDB->prefix("mydownloads_votedata")."_ratingid_seq"); + $datetime = time(); + $sql = sprintf("INSERT INTO %s (ratingid, lid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix("mydownloads_votedata"), $newid, $lid, $ratinguser, $rating, $ip, $datetime); + $xoopsDB->query($sql) or $eh("0013"); + + //All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. + updaterating($lid); + $ratemessage = _MD_VOTEAPPRE."<br />".sprintf(_MD_THANKYOU, htmlspecialchars($xoopsConfig['sitename'])); + redirect_header("index.php",4,$ratemessage); + exit(); } else { - $xoopsOption['template_main'] = 'mydownloads_ratefile.html'; + $xoopsOption['template_main'] = 'mydownloads_ratefile.html'; include XOOPS_ROOT_PATH."/header.php"; $lid = intval($HTTP_GET_VARS['lid']); $result=$xoopsDB->query("SELECT title FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE lid=$lid"); Index: xoops2jp/html/modules/mydownloads/singlefile.php diff -u xoops2jp/html/modules/mydownloads/singlefile.php:1.2 xoops2jp/html/modules/mydownloads/singlefile.php:1.3 --- xoops2jp/html/modules/mydownloads/singlefile.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/modules/mydownloads/singlefile.php Sat Jun 11 11:32:42 2005 @@ -1,5 +1,5 @@ <?php -// $Id: singlefile.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: singlefile.php,v 1.3 2005/06/11 02:32:42 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -44,7 +44,7 @@ $xoopsTpl->assign('category_path', $pathstring); $path = $mytree->getPathFromId($cid, "title"); $path = substr($path, 1); -$path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' board='0' alt=''> ",$path); +$path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' board='0' alt='' /> ",$path); $rating = number_format($rating, 2); $dtitle = $myts->makeTboxData4Show($title); $url = $myts->makeTboxData4Show($url); @@ -58,20 +58,20 @@ $new = newdownloadgraphic($time, $status); $pop = popgraphic($hits); if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { - $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; + $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; } else { - $adminlink = ''; + $adminlink = ''; } if ($votes == 1) { - $votestring = _MD_ONEVOTE; + $votestring = _MD_ONEVOTE; } else { - $votestring = sprintf(_MD_NUMVOTES,$votes); + $votestring = sprintf(_MD_NUMVOTES,$votes); } 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); + $xoopsTpl->assign('shotwidth', $xoopsModuleConfig['shotwidth']); + $xoopsTpl->assign('tablewidth', $xoopsModuleConfig['shotwidth'] + 10); + $xoopsTpl->assign('show_screenshot', true); + $xoopsTpl->assign('lang_noscreenshot', _MD_NOSHOTS); } $xoopsTpl->assign('file', array('id' => $lid, 'cid' => $cid,'rating' => $rating,'title' => $dtitle.$new.$pop,'logourl' => $logourl,'updated' => $datetime,'description' => $description,'adminlink' => $adminlink,'hits' => $hits,'votes' => $votestring, 'platform' => $platform, 'comments' => $comments, 'size' => $size,'homepage' => $homepage,'version' => $version,'category' => $path,'lang_dltimes' => sprintf(_MD_DLTIMES,$hits),'mail_subject' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename'])),'mail_body' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mydownloads/singlefile.php?cid='.$cid.'&lid='.$lid))); $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); Index: xoops2jp/html/modules/mydownloads/viewcat.php diff -u xoops2jp/html/modules/mydownloads/viewcat.php:1.2 xoops2jp/html/modules/mydownloads/viewcat.php:1.3 --- xoops2jp/html/modules/mydownloads/viewcat.php:1.2 Fri Mar 18 21:52:14 2005 +++ xoops2jp/html/modules/mydownloads/viewcat.php Sat Jun 11 11:32:42 2005 @@ -1,5 +1,5 @@ <?php -// $Id: viewcat.php,v 1.2 2005/03/18 12:52:14 onokazu Exp $ +// $Id: viewcat.php,v 1.3 2005/06/11 02:32:42 onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -35,18 +35,18 @@ include XOOPS_ROOT_PATH."/header.php"; if (isset($HTTP_GET_VARS['show']) && $HTTP_GET_VARS['show']!="") { - $show = intval($HTTP_GET_VARS['show']); + $show = intval($HTTP_GET_VARS['show']); } else { - $show = $xoopsModuleConfig['perpage']; + $show = $xoopsModuleConfig['perpage']; } $min = isset($HTTP_GET_VARS['min']) ? intval($HTTP_GET_VARS['min']) : 0; if (!isset($max)) { - $max = $min + $show; + $max = $min + $show; } if(isset($HTTP_GET_VARS['orderby'])) { - $orderby = convertorderbyin($HTTP_GET_VARS['orderby']); + $orderby = convertorderbyin($HTTP_GET_VARS['orderby']); } else { - $orderby = "title ASC"; + $orderby = "title ASC"; } @@ -58,132 +58,132 @@ $arr=array(); $arr=$mytree->getFirstChild($cid, "title"); if ( count($arr) > 0 ) { - $scount = 1; - foreach($arr as $ele){ - $sub_arr=array(); - $sub_arr=$mytree->getFirstChild($ele['cid'], "title"); - $space = 0; - $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++; - } + $scount = 1; + foreach($arr as $ele){ + $sub_arr=array(); + $sub_arr=$mytree->getFirstChild($ele['cid'], "title"); + $space = 0; + $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); + $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; + $isadmin = true; } else { - $isadmin = false; + $isadmin = false; } $fullcountresult=$xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mydownloads_downloads")." WHERE cid=$cid AND status>0"); list($numrows) = $xoopsDB->fetchRow($fullcountresult); $page_nav = ''; if($numrows>0){ - $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); - $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); - $xoopsTpl->assign('lang_hits', _MD_HITSC); - $xoopsTpl->assign('lang_ratingc', _MD_RATINGC); - $xoopsTpl->assign('lang_email', _MD_EMAILC); - $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISFILE); - $xoopsTpl->assign('lang_reportbroken', _MD_REPORTBROKEN); - $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); - $xoopsTpl->assign('lang_modify', _MD_MODIFY); - $xoopsTpl->assign('lang_version' , _MD_VERSION); - $xoopsTpl->assign('lang_subdate' , _MD_SUBMITDATE); - $xoopsTpl->assign('lang_dlnow' , _MD_DLNOW); - $xoopsTpl->assign('lang_category' , _MD_CATEGORYC); - $xoopsTpl->assign('lang_size' , _MD_FILESIZE); - $xoopsTpl->assign('lang_platform' , _MD_SUPPORTEDPLAT); - $xoopsTpl->assign('lang_homepage' , _MD_HOMEPAGE); - $xoopsTpl->assign('lang_comments' , _COMMENTS); - $xoopsTpl->assign('show_links', true); - $q = "SELECT d.lid, d.title, d.url, d.homepage, d.version, d.size, d.platform, d.logourl, d.status, d.date, d.hits, d.rating, d.votes, d.comments, t.description FROM ".$xoopsDB->prefix("mydownloads_downloads")." d, ".$xoopsDB->prefix("mydownloads_text")." t WHERE cid=".$cid." AND d.status>0 AND d.lid=t.lid ORDER BY ".$orderby.""; - $result = $xoopsDB->query($q,$show,$min); + $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); + $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); + $xoopsTpl->assign('lang_hits', _MD_HITSC); + $xoopsTpl->assign('lang_ratingc', _MD_RATINGC); + $xoopsTpl->assign('lang_email', _MD_EMAILC); + $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISFILE); + $xoopsTpl->assign('lang_reportbroken', _MD_REPORTBROKEN); + $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); + $xoopsTpl->assign('lang_modify', _MD_MODIFY); + $xoopsTpl->assign('lang_version' , _MD_VERSION); + $xoopsTpl->assign('lang_subdate' , _MD_SUBMITDATE); + $xoopsTpl->assign('lang_dlnow' , _MD_DLNOW); + $xoopsTpl->assign('lang_category' , _MD_CATEGORYC); + $xoopsTpl->assign('lang_size' , _MD_FILESIZE); + $xoopsTpl->assign('lang_platform' , _MD_SUPPORTEDPLAT); + $xoopsTpl->assign('lang_homepage' , _MD_HOMEPAGE); + $xoopsTpl->assign('lang_comments' , _COMMENTS); + $xoopsTpl->assign('show_links', true); + $q = "SELECT d.lid, d.title, d.url, d.homepage, d.version, d.size, d.platform, d.logourl, d.status, d.date, d.hits, d.rating, d.votes, d.comments, t.description FROM ".$xoopsDB->prefix("mydownloads_downloads")." d, ".$xoopsDB->prefix("mydownloads_text")." t WHERE cid=".$cid." AND d.status>0 AND d.lid=t.lid ORDER BY ".$orderby.""; + $result = $xoopsDB->query($q,$show,$min); //if 2 or more items in result, show the sort menu - if($numrows>1){ - $xoopsTpl->assign('show_nav', true); - $orderbyTrans = convertorderbytrans($orderby); - $xoopsTpl->assign('lang_sortby', _MD_SORTBY); - $xoopsTpl->assign('lang_title', _MD_TITLE); - $xoopsTpl->assign('lang_date', _MD_DATE); - $xoopsTpl->assign('lang_rating', _MD_RATING); - $xoopsTpl->assign('lang_popularity', _MD_POPULARITY); - $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_CURSORTBY, convertorderbytrans($orderby))); - } - while(list($lid, $dtitle, $url, $homepage, $version, $size, $platform, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description)=$xoopsDB->fetchRow($result)) { - $path = $mytree->getPathFromId($cid, "title"); - $path = substr($path, 1); - $path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' board='0' alt=''> ",$path); - $rating = number_format($rating, 2); - $dtitle = $myts->makeTboxData4Show($dtitle); - $url = $myts->makeTboxData4Show($url); - $homepage = $myts->makeTboxData4Show($homepage); - $version = $myts->makeTboxData4Show($version); - $size = PrettySize($myts->makeTboxData4Show($size)); - $platform = $myts->makeTboxData4Show($platform); - $logourl = $myts->makeTboxData4Show($logourl); - $datetime = formatTimestamp($time,"s"); - $description = $myts->makeTareaData4Show($description,0); //no html - $new = newdownloadgraphic($time, $status); - $pop = popgraphic($hits); - if ($isadmin) { - $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; - } else { - $adminlink = ''; - } - if ($votes == 1) { - $votestring = _MD_ONEVOTE; - } else { - $votestring = sprintf(_MD_NUMVOTES,$votes); - } - $xoopsTpl->append('file', array('id' => $lid, 'cid' => $cid, 'rating' => $rating,'title' => $dtitle.$new.$pop,'logourl' => $logourl,'updated' => $datetime,'description' => $description,'adminlink' => $adminlink,'hits' => $hits,'votes' => $votestring, 'comments' => $comments, 'platform' => $platform,'size' => $size,'homepage' => $homepage,'version' => $version,'category' => $path,'lang_dltimes' => sprintf(_MD_DLTIMES,$hits),'mail_subject' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename'])),'mail_body' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mydownloads/singlefile.php?cid='.$cid.'&lid='.$lid))); - } - $orderby = convertorderbyout($orderby); + if($numrows>1){ + $xoopsTpl->assign('show_nav', true); + $orderbyTrans = convertorderbytrans($orderby); + $xoopsTpl->assign('lang_sortby', _MD_SORTBY); + $xoopsTpl->assign('lang_title', _MD_TITLE); + $xoopsTpl->assign('lang_date', _MD_DATE); + $xoopsTpl->assign('lang_rating', _MD_RATING); + $xoopsTpl->assign('lang_popularity', _MD_POPULARITY); + $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_CURSORTBY, convertorderbytrans($orderby))); + } + while(list($lid, $dtitle, $url, $homepage, $version, $size, $platform, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description)=$xoopsDB->fetchRow($result)) { + $path = $mytree->getPathFromId($cid, "title"); + $path = substr($path, 1); + $path = str_replace("/"," <img src='".XOOPS_URL."/modules/mydownloads/images/arrow.gif' border='0' alt='' /> ",$path); + $rating = number_format($rating, 2); + $dtitle = $myts->makeTboxData4Show($dtitle); + $url = $myts->makeTboxData4Show($url); + $homepage = $myts->makeTboxData4Show($homepage); + $version = $myts->makeTboxData4Show($version); + $size = PrettySize($myts->makeTboxData4Show($size)); + $platform = $myts->makeTboxData4Show($platform); + $logourl = $myts->makeTboxData4Show($logourl); + $datetime = formatTimestamp($time,"s"); + $description = $myts->makeTareaData4Show($description,0); //no html + $new = newdownloadgraphic($time, $status); + $pop = popgraphic($hits); + if ($isadmin) { + $adminlink = '<a href="'.XOOPS_URL.'/modules/mydownloads/admin/index.php?lid='.$lid.'&fct=mydownloads&op=modDownload"><img src="'.XOOPS_URL.'/modules/mydownloads/images/editicon.gif" border="0" alt="'._MD_EDITTHISDL.'" /></a>'; + } else { + $adminlink = ''; + } + if ($votes == 1) { + $votestring = _MD_ONEVOTE; + } else { + $votestring = sprintf(_MD_NUMVOTES,$votes); + } + $xoopsTpl->append('file', array('id' => $lid, 'cid' => $cid, 'rating' => $rating,'title' => $dtitle.$new.$pop,'logourl' => $logourl,'updated' => $datetime,'description' => $description,'adminlink' => $adminlink,'hits' => $hits,'votes' => $votestring, 'comments' => $comments, 'platform' => $platform,'size' => $size,'homepage' => $homepage,'version' => $version,'category' => $path,'lang_dltimes' => sprintf(_MD_DLTIMES,$hits),'mail_subject' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename'])),'mail_body' => rawurlencode(sprintf(_MD_INTFILEFOUND,$xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/mydownloads/singlefile.php?cid='.$cid.'&lid='.$lid))); + } + $orderby = convertorderbyout($orderby); //Calculates how many pages exist. Which page one should be on, etc... - $downpages = ceil($numrows / $show); + $downpages = ceil($numrows / $show); //Page Numbering - if ($downpages!=1 && $downpages!=0) { - $prev = $min - $show; - if ($prev>=0) { - $page_nav .= "<a href='viewcat.php?cid=$cid&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; - } - $counter = 1; - $currentpage = ($max / $show); - while ( $counter<=$downpages ) { - $mintemp = ($show * $counter) - $show; - if ($counter == $currentpage) { - $page_nav .= "<b>($counter)</b> "; - } else { - $page_nav .= "<a href='viewcat.php?cid=$cid&min=$mintemp&orderby=$orderby&show=$show'>$counter</a> "; - } - $counter++; - } - if ( $numrows>$max ) { - $page_nav .= "<a href='viewcat.php?cid=$cid&min=$max&orderby=$orderby&show=$show'>"; - $page_nav .= "<b><u>»</u></b></a>"; - } - } + if ($downpages!=1 && $downpages!=0) { + $prev = $min - $show; + if ($prev>=0) { + $page_nav .= "<a href='viewcat.php?cid=$cid&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; + } + $counter = 1; + $currentpage = ($max / $show); + while ( $counter<=$downpages ) { + $mintemp = ($show * $counter) - $show; + if ($counter == $currentpage) { + $page_nav .= "<b>($counter)</b> "; + } else { + $page_nav .= "<a href='viewcat.php?cid=$cid&min=$mintemp&orderby=$orderby&show=$show'>$counter</a> "; + } + $counter++; + } + if ( $numrows>$max ) { + $page_nav .= "<a href='viewcat.php?cid=$cid&min=$max&orderby=$orderby&show=$show'>"; + $page_nav .= "<b><u>»</u></b></a>"; + } + } } $xoopsTpl->assign('page_nav', $page_nav); include XOOPS_ROOT_PATH."/modules/mydownloads/footer.php";