From: <txm...@us...> - 2012-05-01 14:06:39
|
Revision: 9418 http://xoops.svn.sourceforge.net/xoops/?rev=9418&view=rev Author: txmodxoops Date: 2012-05-01 14:06:30 +0000 (Tue, 01 May 2012) Log Message: ----------- working version alpha 1 only for testing Updated categories.php Rss files Viewcat.php Modified Paths: -------------- XoopsModules/xpdf/trunk/modules/xpdf/admin/categories.php XoopsModules/xpdf/trunk/modules/xpdf/admin/documents.php XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_cat.php XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_doc.php XoopsModules/xpdf/trunk/modules/xpdf/include/functions.php XoopsModules/xpdf/trunk/modules/xpdf/include/install.php XoopsModules/xpdf/trunk/modules/xpdf/index.php XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_doclist.html XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_header.html XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_index.html XoopsModules/xpdf/trunk/modules/xpdf/viewcat.php XoopsModules/xpdf/trunk/modules/xpdf/xoops_version.php Added Paths: ----------- XoopsModules/xpdf/trunk/modules/xpdf/rss.php XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_rss.html Modified: XoopsModules/xpdf/trunk/modules/xpdf/admin/categories.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/admin/categories.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/admin/categories.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -28,7 +28,7 @@ include "admin_header.php"; xoops_cp_header(); -global $pathImageIcon; +global $pathImageIcon, $xoopsModuleConfig; // We recovered the value of the argument op in the URL$ $op = xpdf_CleanVars($_REQUEST, 'op', 'list', 'string'); @@ -77,7 +77,7 @@ $class = ($class == "even") ? "odd" : "even"; echo "<td class='center'>".$i."</td>"; echo "<td class='center'>".$cat_arr[$i]->getVar("cat_title")."</td>"; - echo "<td class='center'><img src='".XOOPS_UPLOAD_URL."/xpdf/images/cat/".$cat_arr[$i]->getVar("cat_image")."' height='30px' title='cat_image' alt='cat_image'></td>"; + echo "<td class='center'><img src='".XPDF_UPLOAD_CAT_URL."/".$cat_arr[$i]->getVar("cat_image")."' height='30px' title='cat_image' alt='cat_image'></td>"; echo "<td class='center'>".$cat_arr[$i]->getVar("cat_description")."</td>"; echo "<td class='center'>".$cat_arr[$i]->getVar("cat_weight")."</td>"; @@ -127,11 +127,10 @@ $obj->setVar("cat_pid", $_REQUEST["cat_pid"]); //Form cat_title $obj->setVar("cat_title", $_REQUEST["cat_title"]); - //Form cat_image + //Form cat_image include_once XOOPS_ROOT_PATH."/class/uploader.php"; - $uploaddir = XOOPS_UPLOAD_PATH."/xpdf/images/cat/"; - $uploader = new XoopsMediaUploader($uploaddir, $GLOBALS['xoopsModuleConfig']['mimetypes'], - $GLOBALS['xoopsModuleConfig']['maxsize'], null, null); + $uploaddir = XPDF_UPLOAD_CAT_PATH."/"; + $uploader = new XoopsMediaUploader($uploaddir, $GLOBALS['xoopsModuleConfig']['mimetypes'], 104857600, null, null); if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { $uploader->setPrefix("cat_image_") ; $uploader->fetchMedia($_POST['xoops_upload_file'][0]); Modified: XoopsModules/xpdf/trunk/modules/xpdf/admin/documents.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/admin/documents.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/admin/documents.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -96,9 +96,9 @@ echo "<td class='center'>".formatTimeStamp($doc_arr[$i]->getVar("doc_published"),"S")."</td>"; if ( $doc_arr[$i]->getVar("doc_status") == 1 ) { - echo "<td class='center'><img src=".$pathImageIcon."/green_ball.png border='0' alt='"._AM_XPDF_DELETEPDF."' /></td>"; + echo "<td class='center'><img src='../images/16/green_ball.png' border='0' alt='"._AM_XPDF_DELETEPDF."' /></td>"; } else { - echo "<td class='center'><img src=".$pathImageIcon."/red_ball.png border='0' alt='"._AM_XPDF_CREATEPDF."' /></td>"; + echo "<td class='center'><img src='../images/16/red_ball.png' border='0' alt='"._AM_XPDF_CREATEPDF."' /></td>"; } echo "<td class='center'>".$doc_arr[$i]->getVar("doc_weight")."</td>"; Modified: XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_cat.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_cat.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_cat.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -62,18 +62,18 @@ include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php"); $form = new XoopsThemeForm($title, "form_cat", $action, "post", true); $form->setExtra('enctype="multipart/form-data"'); - + // Title $form->addElement(new XoopsFormText(_AM_XPDF_CAT_TITLE, "cat_title", 50, 255, $this->getVar("cat_title")), true); // Subcategories include_once(XOOPS_ROOT_PATH."/class/tree.php"); $catHandler =& xoops_getModuleHandler("xpdf_cat", XPDF_DIRNAME); $criteria = new CriteriaCompo(); - $criteria->setSort('cat_id'); + $criteria->setSort('cat_weight ASC, cat_title'); $criteria->setOrder('ASC'); $cat_arr = $catHandler->getall(); $mytree = new XoopsObjectTree($cat_arr, "cat_id", "cat_pid"); - $form->addElement(new XoopsFormLabel(_AM_XPDF_CAT_PID, $mytree->makeSelBox("cat_pid", "cat_title","--", $this->getVar("cat_pid"),false))); - + $form->addElement(new XoopsFormLabel(_AM_XPDF_CAT_PID, $mytree->makeSelBox("cat_pid", "cat_title","--", $this->getVar("cat_pid"),true))); + // Image $cat_image = $this->getVar("cat_image") ? $this->getVar("cat_image") : 'blank.gif'; $uploadirectory = '/uploads/xpdf/images/cat'; $imgtray = new XoopsFormElementTray(_AM_XPDF_CAT_IMAGE,'<br />'); @@ -91,7 +91,7 @@ $fileseltray->addElement(new XoopsFormLabel(''), false); $imgtray->addElement($fileseltray); $form->addElement($imgtray); - + // Description $editor_configs=array(); $editor_configs["name"] = "cat_description"; $editor_configs["value"] = $this->getVar("cat_description", "e"); @@ -101,7 +101,7 @@ $editor_configs["height"] = "400px"; $editor_configs["editor"] = $GLOBALS["xoopsModuleConfig"]["xpdf_editor"]; $form->addElement( new XoopsFormEditor(_AM_XPDF_CAT_DESCRIPTION, "cat_description", $editor_configs), false ); - + // Weight $form->addElement(new XoopsFormText(_AM_XPDF_CAT_WEIGHT, "cat_weight", 10, 25, $this->getVar("cat_weight")), true); $form->addElement(new XoopsFormHidden("op", "save_cat")); Modified: XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_doc.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_doc.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/class/xpdf_doc.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -50,7 +50,7 @@ $this->initVar("doc_submitter", XOBJ_DTYPE_INT, null, false, 10); $this->initVar("doc_published", XOBJ_DTYPE_INT, null, false, 10); $this->initVar("doc_hits", XOBJ_DTYPE_INT, null, false, 11); - $this->initVar("doc_weight", XOBJ_DTYPE_INT, null, false, 11); + $this->initVar("doc_weight", XOBJ_DTYPE_INT, 0, false, 11); $this->initVar("doc_status", XOBJ_DTYPE_INT, null, false, 1); $this->initVar("doc_online", XOBJ_DTYPE_INT, null, false, 1); $this->initVar("doc_dohtml", XOBJ_DTYPE_INT, null, false, 1); Modified: XoopsModules/xpdf/trunk/modules/xpdf/include/functions.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/include/functions.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/include/functions.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -222,4 +222,51 @@ $Path .= $first_category; return $Path; } + +function xpdf_PathTreeUrl($mytree, $key, $category_array, $title, $prefix = '', $link = false, $order = 'ASC', $lasturl = false) +{ + global $xoopsModule; + $category_parent = $mytree->getAllParent($key); + if ($order == 'ASC'){ + $category_parent = array_reverse($category_parent); + if ($link == true) { + $Path = '<a href="index.php">' . $xoopsModule->name() . '</a>' . $prefix; + }else{ + $Path = $xoopsModule->name() . $prefix; + } + }else{ + if (array_key_exists($key, $category_array)){ + $first_category = $category_array[$key]->getVar($title); + }else{ + $first_category = ''; + } + $Path = $first_category . $prefix; + } + foreach (array_keys($category_parent) as $j) { + if ($link == true) { + $Path .= '<a href="viewcat.php?cid=' . $category_parent[$j]->getVar('cat_cid') . '">' . $category_parent[$j]->getVar($title) . '</a>' . $prefix; + }else{ + $Path .= $category_parent[$j]->getVar($title) . $prefix; + } + } + if ($order == 'ASC'){ + if (array_key_exists($key, $category_array)){ + if ($lasturl == true){ + $first_category = '<a href="viewcat.php?cid=' . $category_array[$key]->getVar('cat_cid') . '">' . $category_array[$key]->getVar($title) . '</a>'; + }else{ + $first_category = $category_array[$key]->getVar($title); + } + }else{ + $first_category = ''; + } + $Path .= $first_category; + }else{ + if ($link == true) { + $Path .= '<a href="index.php">' . $xoopsModule->name() . '</a>'; + }else{ + $Path .= $xoopsModule->name(); + } + } + return $Path; +} ?> \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/include/install.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/include/install.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/include/install.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -24,25 +24,15 @@ * * Version : 1.01 Mon 2012/04/30 15:11:55 : timgno Exp $ * **************************************************************************** - */ - + */ $indexFile = XOOPS_UPLOAD_PATH."/index.html"; $blankFile = XOOPS_UPLOAD_PATH."/blank.gif"; - //Creation of folder "uploads" for the module to the site root $module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); -copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/index.html"); - -//Creation of the file cat in uploads directory -$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/cat"; -if(!is_dir($module_uploads)) - mkdir($module_uploads, 0777); - chmod($module_uploads, 0777); -copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/cat/index.html"); - +copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/index.html"); //Creation of the folder cat_image in uploads directory for images $module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/images"; if(!is_dir($module_uploads)) @@ -50,20 +40,23 @@ chmod($module_uploads, 0777); copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/index.html"); copy($blankFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/blank.gif"); - +//Creation of the file cat in uploads directory +$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/images/cat"; +if(!is_dir($module_uploads)) + mkdir($module_uploads, 0777); + chmod($module_uploads, 0777); +copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/cat/index.html"); +copy($blankFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/cat/blank.gif"); //Creation of the file doc in uploads directory -$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/doc"; +$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/images/doc"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); -copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/doc/index.html"); - +copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/doc/index.html"); +copy($blankFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/doc/blank.gif"); //Creation of the folder doc_image in uploads directory for images -$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/images"; +$module_uploads = XOOPS_ROOT_PATH."/uploads/xpdf/files"; if(!is_dir($module_uploads)) mkdir($module_uploads, 0777); chmod($module_uploads, 0777); -copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/index.html"); -copy($blankFile, XOOPS_ROOT_PATH."/uploads/xpdf/images/blank.gif"); - -?> \ No newline at end of file +copy($indexFile, XOOPS_ROOT_PATH."/uploads/xpdf/files/index.html"); \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/index.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/index.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/index.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -31,13 +31,14 @@ $xoTheme->addStylesheet( $style, null ); $xoTheme->addScript( $script, null ); +//$cid = xpdf_CleanVars($_REQUEST, 'cat_id', 0, 'int'); // For permissions $categories = xpdf_MygetItemIds('xpdf_view', XPDF_DIRNAME); // Documents table $criteria = new CriteriaCompo(); $criteria->add(new Criteria('doc_status', 0, '!=')); -//$criteria->add(new Criteria('doc_cid', '(' . implode(',', $categories) . ')','IN')); +$criteria->add(new Criteria('doc_cid', $_REQUEST['doc_cid'])); $docArray = $docHandler->getall($criteria); $docCount = $docHandler->getCount($criteria); $xoopsTpl->assign('lang_thereare', sprintf(_MA_XPDF_INDEX_THEREARE, $docCount)); @@ -46,7 +47,7 @@ $criteria = new CriteriaCompo(); $criteria->setSort('cat_weight ASC, cat_title'); $criteria->setOrder('ASC'); -$criteria->add(new Criteria('cat_id', '(' . implode(',', $categories) . ')','IN')); +$criteria->add(new Criteria('cat_id', $_REQUEST['cat_id'])); $catArray = $catHandler->getall($criteria); $totalcategories = $catHandler->getCount($criteria); $mytree = new XoopsObjectTree($catArray, 'cat_id', 'cat_pid'); @@ -96,7 +97,7 @@ } $criteria = new CriteriaCompo(); $criteria->add(new Criteria('doc_status', 0, '!=')); - //$criteria->add(new Criteria('doc_cid', '(' . implode(',', $categories) . ')','IN')); + $criteria->add(new Criteria('doc_cid', $_REQUEST['doc_cid'])); $criteria->setLimit($GLOBALS['xoopsModuleConfig']['newdocuments']); $criteria->setSort('doc_published DESC, doc_title'); $criteria->setOrder('DESC'); @@ -120,7 +121,7 @@ $new = xpdf_NewOrUpdate($docArray[$i]->getVar('doc_published'), $docArray[$i]->getVar('doc_status')); $pop = xpdf_Popular($docArray[$i]->getVar('doc_hits')); - // Set if the person is an admin. + // Set if the user is an admin. if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { $adminlink = '<a href="' . XPDF_URL . '/admin/documents.php?op=edit_doc&doc_id=' . $docArray[$i]->getVar('doc_id') . '" title="' . _EDIT . '"><img src="images/editicon.png" border="0" alt="' . _EDIT . '" /></a>'; } else { @@ -136,7 +137,7 @@ $did = $docArray[$i]->getVar('doc_id'); $cid = $docArray[$i]->getVar('doc_cid'); $title = $docArray[$i]->getVar('doc_title'); - $pdfdoc = "<a href='" . XPDF_URL . "/viewdoc.php?cid=".$cid."&did=".$did."' title='"._MA_XPDF_VIEWPDF."' target='_blank'>"; + $pdfdoc = "<a href='" . XPDF_URL . "/viewdoc.php?did=".$did."' title='"._MA_XPDF_IMG_VIEWPDF."' target='_blank'>"; $pdfdoc .= "<img src='" . XPDF_URL . "/images/22/view_pdf.png' width='22px' height='22px' border='0' alt='".$title."'/></a>"; // Render Display $xoopsTpl->append('file', array('did' => $did, 'cid' => $cid, 'title' => $title, 'new' => $new, 'pop' => $pop, 'image' => $doc_image, 'updated' => $datetime, 'slogan' => $slogan_short, 'adminlink' => $adminlink, 'submitter' => $submitter, 'online' => $online, 'count' => $count, 'pdfdoc' => $pdfdoc)); Added: XoopsModules/xpdf/trunk/modules/xpdf/rss.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/rss.php (rev 0) +++ XoopsModules/xpdf/trunk/modules/xpdf/rss.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -0,0 +1,102 @@ +<?php +/** + * **************************************************************************** + * - A project for the Xoops CMS - (http://www.xoops.org) + * **************************************************************************** + * XPDF - MODULE FOR XOOPS + * Copyright (c) 2007 - 2012 + * TXMod Xoops (http://www.txmodxoops.org) + * + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * @copyright TXMod Xoops (http://www.txmodxoops.org) + * @license GPL see LICENSE + * @package xpdf + * @author TXMod Xoops (in...@tx...) + * + * Version : 1.01 Sun 2012/02/05 1:04:25 : Timgno Exp $ + * **************************************************************************** + */ +include_once dirname(__FILE__) . '/header.php'; +$cid = isset($_GET['doc_cid']) ? intval($_GET['doc_cid']) : 0; +include_once XOOPS_ROOT_PATH.'/class/template.php'; +$items_count = $GLOBALS['xoopsModuleConfig']['rssperpage']; + +if (function_exists('mb_http_output')) { + mb_http_output('pass'); +} +//header ('Content-Type:text/xml; charset=UTF-8'); +$GLOBALS['xoopsModuleConfig']["utf8"] = false; + +$tpl = new XoopsTpl(); +$tpl->xoops_setCaching(2); //1 = Cache global, 2 = Cache individual (for template) +$tpl->xoops_setCacheTime($GLOBALS['xoopsModuleConfig']['timecacherss']*60); // Time of cache on seconds +$cats = xpdf_MygetItemIds('xpdf_view', XPDF_DIRNAME); +$criteria = new CriteriaCompo(); +$criteria->add(new Criteria('doc_status', 0, '!=')); +$criteria->add(new Criteria('doc_cid', '(' . implode(',', $cats) . ')','IN')); +if ($cid != 0){ + $criteria->add(new Criteria('doc_cid', $cid)); + $cat = $docscat_Handler->get($cid); + $title = $GLOBALS['xoopsConfig']['sitename'] . ' - ' . $GLOBALS['xoopsModule']->getVar('name') . ' - ' . $cat->getVar('cat_title'); +}else{ + $title = $GLOBALS['xoopsConfig']['sitename'] . ' - ' . $GLOBALS['xoopsModule']->getVar('name'); +} +$docHandler =& xoops_getModuleHandler("xpdf_doc", XPDF_DIRNAME); +$criteria->setLimit($GLOBALS['xoopsModuleConfig']['rssperpage']); +$criteria->setSort('doc_published'); +$criteria->setOrder('DESC'); +$docs_arr = $docHandler->getall($criteria); + +if (!$tpl->is_cached('db:xpdf_rss.html', $cid)) { + $tpl->assign('channel_title', htmlspecialchars($title, ENT_QUOTES)); + $tpl->assign('channel_link', XOOPS_URL.'/'); + $tpl->assign('channel_desc', htmlspecialchars($GLOBALS['xoopsConfig']['slogan'], ENT_QUOTES)); + $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss')); + $tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail']); + $tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail']); + $tpl->assign('channel_category', 'Event'); + $tpl->assign('channel_generator', 'XOOPS - ' . htmlspecialchars($GLOBALS['xoopsModule']->getVar('name'), ENT_QUOTES)); + $tpl->assign('channel_language', _LANGCODE); + if ( _LANGCODE == 'fr' ) { + $tpl->assign('docs', 'http://www.scriptol.fr/rss/RSS-2.0.html'); + } else { + $tpl->assign('docs', 'http://cyber.law.harvard.edu/rss/rss.html'); + } + $tpl->assign('image_url', XOOPS_URL . $GLOBALS['xoopsModuleConfig']['logorss']); + $dimention = getimagesize(XOOPS_ROOT_PATH . $GLOBALS['xoopsModuleConfig']['logorss']); + if (empty($dimention[0])) { + $width = 88; + } else { + $width = ($dimention[0] > 144) ? 144 : $dimention[0]; + } + if (empty($dimention[1])) { + $height = 31; + } else { + $height = ($dimention[1] > 400) ? 400 : $dimention[1]; + } + $tpl->assign('image_width', $width); + $tpl->assign('image_height', $height); + foreach (array_keys($docs_arr) as $i) { + $slogan = $docs_arr[$i]->getVar('doc_slogan'); + // To view only the short description + if (strpos($slogan,'[pagebreak]') == false){ + $slogan_short = $slogan; + }else{ + $slogan_short = substr($slogan,0,strpos($slogan,'[pagebreak]')); + } + $tpl->append('items', array('title' => htmlspecialchars($docs_arr[$i]->getVar('doc_title'), ENT_QUOTES), + 'link' => XOOPS_URL . '/modules/xpdf/singledoc.php?cid=' . $docs_arr[$i]->getVar('doc_cid') . '&did=' . $docs_arr[$i]->getVar('doc_id'), + 'guid' => XOOPS_URL . '/modules/xpdf/singledoc.php?cid=' . $docs_arr[$i]->getVar('doc_cid') . '&did=' . $docs_arr[$i]->getVar('doc_id'), + 'pubdate' => formatTimestamp($docs_arr[$i]->getVar('doc_published'), 'rss'), + 'description' => htmlspecialchars($slogan_short, ENT_QUOTES))); + } +} +header("Content-Type:text/xml; charset=" . _CHARSET); +$tpl->display('db:xpdf_rss.html', $cid); +?> \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_doclist.html =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_doclist.html 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_doclist.html 2012-05-01 14:06:30 UTC (rev 9418) @@ -23,11 +23,14 @@ <span class="x-itemPermaLink"><{$doc.slogan}> </span> </div> </div> - <div class="xpdf-itemViewImg"> - <a href="<{$xpdf_url}>/viewdoc.php?did=<{$doc.did}>" title="<{$smarty.const._MA_XPDF_IMG_VIEWPDF}>" rel="directory"><img src="<{$xpdf_url}>/images/22/view_pdf.png" border="0" alt="<{$smarty.const._MA_XPDF_IMG_VIEWPDF}>" /></a> + <div class=""> + </div> <div class="clear"></div> <div class="xpdf-itemBottom"><span><{$doc.adminlink}></span> - <span class="bold"><{$smarty.const._MA_XPDF_INDEX_SUBMITTER}></span>:<span class="itemPoster"><{$doc.submitter}></span> - <span class="bold"><{$smarty.const._MA_XPDF_INDEX_SUBMITDATE}></span>:<span class="itemPostDate"><{$doc.updated}></span></div> + <span class="bold"><{$smarty.const._MA_XPDF_INDEX_SUBMITTER}></span>:<span class="itemPoster"><{$doc.submitter}></span> - <span class="bold"><{$smarty.const._MA_XPDF_INDEX_SUBMITDATE}></span>:<span class="itemPostDate"><{$doc.updated}></span> + <span class="floatright"><{$doc.pdfdoc}></span> + <div class="clear"></div> + </div> </div> <{/if}> \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_header.html =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_header.html 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_header.html 2012-05-01 14:06:30 UTC (rev 9418) @@ -1,6 +1,6 @@ -<div class="box-header"> +<div class="xpdf-header"> <span class="left"><b>Title</b>: <{$smarty.const._MA_XPDF_TITLE}></span><br /> - <span class="left">Description: <{$smarty.const._MA_XPDF_DESC}></span> + <span class="left"><b>Description</b>: <{$smarty.const._MA_XPDF_DESC}></span> </div> <br /> <{if $adv != ''}> Modified: XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_index.html =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_index.html 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_index.html 2012-05-01 14:06:30 UTC (rev 9418) @@ -36,7 +36,7 @@ <!-- End Show categories information --> <!-- RSS logo --> <div class="xpdf-rss right"> - <a title="<{$smarty.const._MA_XPDF_RSS}>" href="<{$xpdf_url}>/rss.php?cid=<{$cid}>"><img src="<{$xpdf_url}>/images/rss.gif" alt="<{$smarty.const._MA_XPDF_RSS}>" /></a> + <a title="<{$smarty.const._MA_XPDF_RSS}>" href="<{$xpdf_url}>/rss.php?cid=0" rel="external"><img src="<{$xpdf_url}>/images/rss.gif" alt="<{$smarty.const._MA_XPDF_RSS}>" /></a> </div> <!-- End Summary informations --> <div class="xpdf-thereare"><{$lang_thereare}></div> Added: XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_rss.html =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_rss.html (rev 0) +++ XoopsModules/xpdf/trunk/modules/xpdf/templates/xpdf_rss.html 2012-05-01 14:06:30 UTC (rev 9418) @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="<{$smarty.const._CHARSET}>"?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title><{$channel_title}></title> + <link><{$channel_link}></link> + <description><{$channel_desc}></description> + <lastBuildDate><{$channel_lastbuild}></lastBuildDate> + <docs><{$docs}></docs> + <generator><{$channel_generator}></generator> + <category><{$channel_category}></category> + <managingEditor><{$channel_editor}></managingEditor> + <webMaster><{$channel_webmaster}></webMaster> + <language><{$channel_language}></language> + <atom:link href="<{$xoops_url}><{$smarty.server.REQUEST_URI}>" rel="self" type="application/rss+xml" /> + <{if $image_url != ""}> + <image> + <title><{$channel_title}></title> + <url><{$image_url}></url> + <link><{$channel_link}></link> + <width><{$image_width}></width> + <height><{$image_height}></height> + </image> + <{/if}> + <{foreach item=item from=$items}> + <item> + <title><{$item.title}></title> + <link><{$item.link}></link> + <description><{$item.description}></description> + <pubDate><{$item.pubdate}></pubDate> + <guid><{$item.guid}></guid> + </item> + <{/foreach}> + </channel> +</rss> \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/viewcat.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/viewcat.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/viewcat.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -1,126 +1,216 @@ <?php /** + * **************************************************************************** + * - A project for the Xoops CMS - (http://www.xoops.org) * **************************************************************************** - * - A Project by Developers TEAM For Xoops - ( http://www.xoops.org ) - * **************************************************************************** - * XPDF - MODULE FOR XOOPS - * Copyright (c) 2007 - 2012 - * TXMod Xoops ( http://www.txmodxoops.org ) + * XPDF - MODULE FOR XOOPS + * Copyright (c) 2007 - 2012 + * TXMod Xoops (http://www.txmodxoops.org) * - * You may not change or alter any portion of this comment or credits - * of supporting developers from this source code or any supporting - * source code which is considered copyrighted (c) material of the - * original comment or credit authors. + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * --------------------------------------------------------------------------- - * @copyright TXMod Xoops ( http://www.txmodxoops.org ) - * @license GNU GPL see License - * @package xpdf - * @author TXMod Xoops ( su...@tx... ) + * @copyright TXMod Xoops (http://www.txmodxoops.org) + * @license GPL see LICENSE + * @package xpdf + * @author TXMod Xoops (in...@tx...) * - * Version : 1.01 Mon 2012/04/30 15:11:55 : timgno Exp $ + * Version : 1.01 Sun 2012/02/05 1:04:25 : Timgno Exp $ * **************************************************************************** */ +include_once dirname(__FILE__) . '/header.php'; +global $xoopsModuleConfig; -include_once "header.php"; -$xoopsOption['template_main'] = 'xpdf_cat.html'; +$catHandler =& xoops_getModuleHandler('xpdf_cat', XPDF_DIRNAME); +$docHandler =& xoops_getModuleHandler('xpdf_doc', XPDF_DIRNAME); +$xoopsOption['template_main'] = 'xpdf_viewcat.html'; include_once XOOPS_ROOT_PATH."/header.php"; -$xoTheme->addStylesheet($style); -$xoTheme->addScript($script); -$xoopsTpl->assign('xpdf_url', XPDF_URL); -$op = xpdf_CleanVars($_REQUEST, 'op', 'list', 'string'); +$xoTheme->addStylesheet( $style, null ); +$xoTheme->addScript( $js, null ); -switch ($op) -{ - case "save_cat": - if ( !$GLOBALS["xoopsSecurity"]->check() ) { - redirect_header("cat.php", 3, implode(",", $GLOBALS["xoopsSecurity"]->getErrors())); +$cid = xpdf_CleanVars($_REQUEST, 'cid', 0, 'int'); +// For permissions +$categories = xpdf_MygetItemIds('xpdf_view', XPDF_DIRNAME); + +// Redirection if the category does not exist +$criteria = new CriteriaCompo(new Criteria('cat_id', intval($cid))); +/*if ($catHandler->getCount($criteria) == 0 || $cid == 0){ + redirect_header('index.php', 3, _MA_XPDF_CAT_NOTEXISTENT); + exit(); +} +// For permissions (if not in law, redirection) +if(!in_array(intval($cid), $categories)) { + redirect_header('index.php', 2, _NOPERM); + exit(); +}*/ + +// Category Table +$criteria = new CriteriaCompo(); +$criteria->setSort('cat_weight ASC, cat_title'); +$criteria->setOrder('ASC'); +$criteria->add(new Criteria('cat_id', $_REQUEST['cat_id'])); +$cat_arr = $catHandler->getall($criteria); +$mytree = new XoopsObjectTree($cat_arr, 'cat_id', 'cat_pid'); + +// Doocument table +$criteria = new CriteriaCompo(); +$criteria->add(new Criteria('doc_status', 0, '!=')); +$criteria->add(new Criteria('doc_cid', $_REQUEST['doc_cid'])); +$doc_arr = $docHandler->getall($criteria); +$xoopsTpl->assign('lang_thereare', sprintf(_MA_XPDF_INDEX_THEREARE, count($doc_arr))); + +// Navigation +$nav_category = xpdf_PathTreeUrl($mytree, $cid, $cat_arr, 'cat_title', $prefix = ' <img src="images/icons/arrow.gif" alt="arrow" /> ', true, 'ASC'); +$xoopsTpl->assign('category_path', $nav_category); + +// Info category +$xoopsTpl->assign('cid', $cid); +$cat_info = $catHandler->get($cid); +$xoopsTpl->assign('cat_description', $cat_info->getVar('cat_description')); + +// Category View +$xoopsTpl->assign('nb_colcat', $GLOBALS['xoopsModuleConfig']['nb_colcat']); +$count = 1; +$keywords = ''; +foreach (array_keys($cat_arr) as $i) { + if ($cat_arr[$i]->getVar('cat_pid') == $cid) + { + $cat_id = $cat_arr[$i]->getVar('cat_id'); + $totaldocuments = xpdf_NumbersOfEntries($mytree, $categories, $doc_arr, $cat_id); + $subcategories_arr = $mytree->getFirstChild($cat_id); + $chcount = 0; + $subcategories = ''; + // For keywords + $keywords .= $cat_arr[$i]->getVar('cat_title') . ','; + foreach (array_keys($subcategories_arr) as $j) { + if ($chcount >= $GLOBALS['xoopsModuleConfig']['nb_subcat']) { + $subcategories .= '<li>[<a href="'. XPDF_URL .'/viewcat.php?cid=' . $cat_id . '">+</a>]</li>'; + break; + } + $subcategories .= '<li><a href="'. XPDF_URL .'/viewcat.php?cid=' . $subcategories_arr[$j]->getVar('cat_id') . '">' . $subcategories_arr[$j]->getVar('cat_title') . '</a></li>'; + $keywords .= $cat_arr[$i]->getVar('cat_title') . ','; + $chcount++; } - if (isset($_REQUEST["cat_id"])) { - $obj =& $catHandler->get($_REQUEST["cat_id"]); - } else { - $obj =& $catHandler->create(); + $xoopsTpl->append('subcategories', array('image' => $cat_arr[$i]->getVar('cat_image'), 'cid' => $cat_id, 'title' => $cat_arr[$i]->getVar('cat_title'), 'description' => $cat_arr[$i]->getVar('cat_description'), 'infercategories' => $subcategories, 'totaldocuments' => $totaldocuments, 'count' => $count)); + $count++; + } +} + +// display des t\xE9l\xE9chargements +if ($GLOBALS['xoopsModuleConfig']['userperpage'] > 0){ + $xoopsTpl->assign('nb_coldoc', $GLOBALS['xoopsModuleConfig']['nb_coldoc']); + //Utilisation d'une copie d'\xE9cran avec la largeur selon les pr\xE9f\xE9rences + if ($GLOBALS['xoopsModuleConfig']['usedocshots'] == 1) { + $xoopsTpl->assign('shotwidth', $GLOBALS['xoopsModuleConfig']['shotwidth']); + $xoopsTpl->assign('show_screenshot', true); + $xoopsTpl->assign('img_float' , $GLOBALS['xoopsModuleConfig']['img_float']); + } + $criteria = new CriteriaCompo(); + $criteria->add(new Criteria('doc_status', 0, '!=')); + $criteria->add(new Criteria('doc_cid', $_REQUEST['doc_cid'])); + $criteria->add(new Criteria('doc_cid', intval($_REQUEST['cid']))); + $numrows = $docHandler->getCount($criteria); + $xoopsTpl->assign('lang_thereare', sprintf(_MA_XPDF_CAT_THEREARE, $numrows)); + + // Pour un display sur plusieurs pages + if (isset($_REQUEST['limit'])) { + $criteria->setLimit($_REQUEST['limit']); + $limit = $_REQUEST['limit']; + } else { + $criteria->setLimit($GLOBALS['xoopsModuleConfig']['userperpage']); + $limit = $GLOBALS['xoopsModuleConfig']['userperpage']; + } + if (isset($_REQUEST['start'])) { + $criteria->setStart($_REQUEST['start']); + $start = $_REQUEST['start']; + //$url = XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/start'.$start.'/cat,'.$cid.$GLOBALS['xoopsModuleConfig']['endofurl']; + } else { + $criteria->setStart(0); + $start = 0; + //$url = XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/cat,'.$cid.$GLOBALS['xoopsModuleConfig']['endofurl']; + } + if (isset($_REQUEST['sort'])) { + $criteria->setSort($_REQUEST['sort']); + $sort = $_REQUEST['sort']; + }else{ + $criteria->setSort('doc_published'); + $sort = 'date'; + } + if (isset($_REQUEST['order'])) { + $criteria->setOrder($_REQUEST['order']); + $order = $_REQUEST['order']; + }else{ + $criteria->setOrder('DESC'); + $order = 'DESC'; + } + //$url = XOOPS_URL.'/'.$GLOBALS['xoopsModuleConfig']['baseurl'].'/cat,'.$cid.'/start,'.$start.$GLOBALS['xoopsModuleConfig']['endofurl']; + $doc_arr = $docHandler->getall($criteria); + if ( $numrows > $limit ) { + include_once XOOPS_ROOT_PATH . "/class/pagenav.php"; + $pagenav = new XoopsPageNav($numrows, $limit, $start, 'start', 'limit=' . $limit . '&cid=' . intval($cid) . '&sort=' . $sort . '&order=' . $order); + $pagenav = $pagenav->renderNav(4); + + } else { + $pagenav = ''; + // + } + $xoopsTpl->assign('pagenav', $pagenav); + + $summary = ''; + $cpt = 0; + $categories = xpdf_MygetItemIds('xpdf_download', XPDF_DIRNAME); + $item = xpdf_MygetItemIds('xpdf_download_item', XPDF_DIRNAME); + foreach (array_keys($doc_arr) as $i) { + if ($doc_arr[$i]->getVar('doc_image') == 'blank.gif'){ + $doc_image = ''; + }else{ + $doc_image = XPDF_UPLOAD_DOC_PATH ."/". $doc_arr[$i]->getVar('doc_image'); } - - //Form cat_pid - $obj->setVar("cat_pid", $_REQUEST["cat_pid"]); - //Form cat_title - $obj->setVar("cat_title", $_REQUEST["cat_title"]); - //Form cat_image - include_once XOOPS_ROOT_PATH."/class/uploader.php"; - $uploaddir = XOOPS_UPLOAD_PATH."/xpdf/images/"; - $uploader = new XoopsMediaUploader($uploaddir, $GLOBALS['xoopsModuleConfig']['mimetypes'], - $GLOBALS['xoopsModuleConfig']['maxsize'], null, null); - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { - $uploader->setPrefix("cat_image_") ; - $uploader->fetchMedia($_POST['xoops_upload_file'][0]); - if (!$uploader->upload()) { - $errors = $uploader->getErrors(); - redirect_header("javascript:history.go(-1)",3, $errors); - } else { - $obj->setVar("cat_image", $uploader->getSavedFileName()); - } - } else { - $obj->setVar("cat_image", $_REQUEST["cat_image"]); - } - //Form cat_description - $obj->setVar("cat_description", $_REQUEST["cat_description"]); - //Form cat_weight - $obj->setVar("cat_weight", $_REQUEST["cat_weight"]); - //Form cat_submitter - $obj->setVar("cat_submitter", $_REQUEST["cat_submitter"]); - //Form cat_created - $obj->setVar("cat_created", xpdf_convertDate($_REQUEST["cat_created"])); - //Form cat_online - $verif_cat_online = ($_REQUEST["cat_online"] == 1) ? "1" : "0"; - $obj->setVar("cat_online", $verif_cat_online); - - - if ($catHandler->insert($obj)) { - redirect_header("cat.php?op=list", 2, _MA_XPDF_FORMOK); + $datetime = formatTimestamp($doc_arr[$i]->getVar('doc_published'),'s'); + $submitter = XoopsUser::getUnameFromId($doc_arr[$i]->getVar('doc_submitter')); + $description = $doc_arr[$i]->getVar('doc_slogan'); + //to view only the short description + if (strpos($description,'[pagebreak]')==false){ + $slogan = $description; + }else{ + $slogan = substr($description,0,strpos($description,'[pagebreak]')); } + // pour les vignettes "new" et "mis \xE0 jour" + $new = xpdf_NewOrUpdate($doc_arr[$i]->getVar('doc_published'), $doc_arr[$i]->getVar('doc_status')); + $pop = xpdf_Popular($doc_arr[$i]->getVar('doc_hits')); - echo $obj->getHtmlErrors(); - $form =& $obj->getForm(); - break; - - case "list": - default: - $criteria = new CriteriaCompo(); - $criteria->setSort("cat_id ASC, cat_pid"); - $criteria->setOrder("ASC"); - $numrows = $catHandler->getCount(); - $cat_arr = $catHandler->getall($criteria); - - // Table View - if ($numrows>0) - { - echo "<table width=\"100%\" cellspacing=\"1\" class=\"outer\"> - <tr> - <th class='center'>"._MA_XPDF_CAT_PID."</th> - <th class='center'>"._MA_XPDF_CAT_TITLE."</th> - <th class='center'>"._MA_XPDF_CAT_IMAGE."</th> - <th class='center'>"._MA_XPDF_CAT_DESCRIPTION."</th> - <th class='center'>"._MA_XPDF_CAT_WEIGHT."</th> - <th class='center'>"._MA_XPDF_CAT_SUBMITTER."</th> - <th class='center'>"._MA_XPDF_CAT_CREATED."</th> - <th class='center'>"._MA_XPDF_CAT_ONLINE."</th> - - </tr>"; - - $class = "odd"; - echo "</table><br /><br />"; - } - break; + // Set if the user is an admin. + if (is_object($xoopsUser) && $xoopsUser->isAdmin($xoopsModule->mid())) { + $adminlink = '<a href="' . XPDF_URL . '/admin/documents.php?op=edit_doc&did=' . $doc_arr[$i]->getVar('doc_id') . '" title="' . _EDIT . '"><img src="images/editicon.png" border="0" alt="' . _EDIT . '" /></a>'; + } else { + $adminlink = ''; + } + // utilisation du sommaire + $cpt++; + $xoopsTpl->append('file', array('id' => $doc_arr[$i]->getVar('doc_id'),'cid' => $doc_arr[$i]->getVar('doc_cid'), 'title' => $doc_arr[$i]->getVar('doc_title'), 'new' => $new, 'pop' => $pop, 'image' => $doc_image, 'updated' => $datetime, 'slogan' => $slogan, + 'adminlink' => $adminlink, 'submitter' => $submitter, 'count' => $cpt)); + //For keywords + $keywords .= $doc_arr[$i]->getVar('title') . ','; + } } -if($xoopsModuleConfig['social_active']== 1) { - $xoopsTpl->assign('social_active', $xoopsModuleConfig['social_active']); - $xoopsTpl->assign('social_code', $xoopsModuleConfig['social_code']); -} -include_once XOOPS_ROOT_PATH."/footer.php"; +$pagetitle = xpdf_PathTreeUrl($mytree, $cid, $cat_arr, 'cat_title', $prefix = ' - ', false, 'DESC'); +$xoopsTpl->assign('xoops_pagetitle', $pagetitle); +//description +$xoTheme->addMeta( 'meta', 'description', strip_tags($cat_arr[$cid]->getVar('cat_description'))); +//keywords +$keywords = substr($keywords,0,-1); +$xoTheme->addMeta( 'meta', 'keywords', $keywords); + +$xoopsTpl->assign('xpdf_url', XPDF_URL); + +if($GLOBALS['xoopsModuleConfig']['show_social']== 1){ +$social = $GLOBALS['xoopsModuleConfig']['code_social']; +$xoopsTpl->assign('social', $social); } + +include_once XOOPS_ROOT_PATH."/footer.php"; ?> \ No newline at end of file Modified: XoopsModules/xpdf/trunk/modules/xpdf/xoops_version.php =================================================================== --- XoopsModules/xpdf/trunk/modules/xpdf/xoops_version.php 2012-04-30 19:51:13 UTC (rev 9417) +++ XoopsModules/xpdf/trunk/modules/xpdf/xoops_version.php 2012-05-01 14:06:30 UTC (rev 9418) @@ -97,6 +97,9 @@ $modversion['templates'][$i]['file'] = "xpdf_doclist.html"; $modversion['templates'][$i]['description'] = "Xpdf doclist page"; $i++; +$modversion['templates'][$i]['file'] = "xpdf_rss.html"; +$modversion['templates'][$i]['description'] = "Xpdf rss page"; +$i++; $modversion['templates'][$i]['file'] = "xpdf_viewcat.html"; $modversion['templates'][$i]['description'] = "Xpdf cat page"; $i++; @@ -131,7 +134,7 @@ $modversion['config'][$i]['description'] = "_MI_XPDF_MAXSIZE_DESC"; $modversion['config'][$i]['formtype'] = "textbox"; $modversion['config'][$i]['valuetype'] = "int"; -$modversion['config'][$i]['default'] = "10485760"; +$modversion['config'][$i]['default'] = "104857600"; $i++; //Uploads : mimetypes cat_image $modversion['config'][$i]['name'] = "mimetypes"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |