/** * @param $xoopsModule * * @return bool|string */ function xoops_module_install_publisher(XoopsModule $xoopsModule) { include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; xoops_loadLanguage('admin', $xoopsModule->getVar('dirname')); xoops_loadLanguage('modinfo', $xoopsModule->getVar('dirname')); $moduleDirName = $xoopsModule->getVar('dirname'); include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/config.php'); foreach (array_keys($uploadFolders) as $i) { PublisherUtilities::createFolder($uploadFolders[$i]); } $file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; foreach (array_keys($copyFiles) as $i) { $dest = $copyFiles[$i] . '/blank.png'; PublisherUtilities::copyFile($file, $dest); } return true; /* include_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.php'); $ret = true; $msg = ''; // Create content directory $dir = $GLOBALS['xoops']->path('uploads/' . $xoopsModule->getVar('dirname') . '/content'); if (!publisherMkdir($dir)) { $msg .= sprintf(_AM_PUBLISHER_DIRNOTCREATED, $dir); } if (empty($msg)) { return $ret; } else { return $msg; } */ }
$cond = ' WHERE status = ' . PublisherConstants::PUBLISHER_STATUS_REJECTED . ' '; $status_explaination = _AM_PUBLISHER_REJECTED_ITEM_EXP; break; } /* -- Code to show selected terms -- */ echo "<form name='pick' id='pick' action='" . XoopsRequest::getString('PHP_SELF', '', 'SERVER') . "' method='POST' style='margin: 0;'>"; echo "\n <table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'>\n <tr>\n <td><span style='font-weight: bold; font-variant: small-caps;'>" . _AM_PUBLISHER_SHOWING . ' ' . $caption . "</span></td>\n <td align='right'>" . _AM_PUBLISHER_SELECT_SORT . "\n <select name='sortsel' onchange='submit()'>\n <option value='itemid' {$sorttxtitemid}>" . _AM_PUBLISHER_ID . "</option>\n <option value='title' {$sorttxttitle}>" . _AM_PUBLISHER_TITLE . "</option>\n <option value='datesub' {$sorttxtcreated}>" . _AM_PUBLISHER_CREATED . "</option>\n <option value='weight' {$sorttxtweight}>" . _CO_PUBLISHER_WEIGHT . "</option>\n\n <option value='counter' {$sorttxthits}>" . _AM_PUBLISHER_HITS . "</option>\n <option value='rating' {$sorttxtrating}>" . _AM_PUBLISHER_RATE . "</option>\n <option value='votes' {$sorttxtvotes}>" . _AM_PUBLISHER_VOTES . "</option>\n <option value='comments' {$sorttxtcomments}>" . _AM_PUBLISHER_COMMENTS_COUNT . "</option>\n\n </select>\n <select name='ordersel' onchange='submit()'>\n <option value='ASC' {$ordertxtasc}>" . _AM_PUBLISHER_ASC . "</option>\n <option value='DESC' {$ordertxtdesc}>" . _AM_PUBLISHER_DESC . '</option> </select> ' . _AM_PUBLISHER_SELECT_STATUS . " :\n <select name='statussel' onchange='submit()'>\n <option value='0' {$selectedtxt0}>" . _AM_PUBLISHER_ALL . " [{$totalitems}]</option>\n <option value='1' {$selectedtxt1}>" . _CO_PUBLISHER_SUBMITTED . " [{$totalsubmitted}]</option>\n <option value='2' {$selectedtxt2}>" . _CO_PUBLISHER_PUBLISHED . " [{$totalpublished}]</option>\n <option value='3' {$selectedtxt3}>" . _CO_PUBLISHER_OFFLINE . " [{$totaloffline}]</option>\n <option value='4' {$selectedtxt4}>" . _CO_PUBLISHER_REJECTED . " [{$totalrejected}]</option>\n </select>\n </td>\n </tr>\n </table>\n </form>"; // Get number of entries in the selected state $statusSelected = $statussel == 0 ? -1 : $statussel; $numrows =& $publisher->getHandler('item')->getItemsCount(-1, $statusSelected); // creating the Q&As objects $itemsObj =& $publisher->getHandler('item')->getItems($publisher->getConfig('idxcat_perpage'), $startentry, $statusSelected, -1, $sortsel, $ordersel); $totalItemsOnPage = count($itemsObj); PublisherUtilities::buildTableItemTitleRow(); if ($numrows > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { // Creating the category object to which this item is linked $categoryObj = $itemsObj[$i]->getCategory(); $approve = ''; switch ($itemsObj[$i]->status()) { case PublisherConstants::PUBLISHER_STATUS_SUBMITTED: $statustxt = _CO_PUBLISHER_SUBMITTED; $approve = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/approve.gif' title='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "' alt='" . _AM_PUBLISHER_SUBMISSION_MODERATE . "' /></a> "; $clone = ''; $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . '/modules/' . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "' /></a>"; $modify = ''; break; case PublisherConstants::PUBLISHER_STATUS_PUBLISHED: $statustxt = _CO_PUBLISHER_PUBLISHED;
/* 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. */ /** * Publisher * * @copyright The XOOPS Project (http://www.xoops.org) * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) * @package Publisher * @since 1.0 * @author Mage, Mamba * @version $Id: index.php 10374 2012-12-12 23:39:48Z trabis $ */ include_once __DIR__ . '/admin_header.php'; include_once dirname(__DIR__) . '/class/utilities.php'; xoops_cp_header(); $indexAdmin = new ModuleAdmin(); foreach (array_keys($GLOBALS['uploadFolders']) as $i) { PublisherUtilities::createFolder($uploadFolders[$i]); $indexAdmin->addConfigBoxLine($uploadFolders[$i], 'folder'); // $indexAdmin->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); } echo $indexAdmin->addNavigation('index.php'); echo $indexAdmin->renderIndex(); include_once __DIR__ . '/admin_footer.php';
$image->setVar('imgcat_id', $newid );//$imgcat_id); if (!$imageHandler->insert($image)) { $err[] = sprintf(_FAILSAVEIMG, $image->getVar('image_nicename')); } */ //============================ } } if (!$publisher->getHandler('category')->insert($categoryObj)) { echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . '<br/>'; continue; } //copy all images to Image Manager $src = $GLOBALS['xoops']->path('uploads/AMS/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); PublisherUtilities::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('image') . "(`image_name`, `image_nicename`, `image_mimetype`, `image_display`, `image_weight`, `imgcat_id`)\n SELECT\n s.picture,\n RIGHT(s.picture,13) AS nicename,\n CONCAT('image/', RIGHT(s.picture,3)) AS `mimetype`,\n 1 AS image_display,\n 0 AS image_weight,\n c.imgcat_id\n FROM " . $GLOBALS['xoopsDB']->prefix('ams_article') . ' s, ' . $GLOBALS['xoopsDB']->prefix('imagecategory') . " c\n WHERE s.picture <> ''\n AND c.imgcat_name = '" . PUBLISHER_DIRNAME . "'"; $resultPictures = $GLOBALS['xoopsDB']->query($sql); $newCat['newid'] = $categoryObj->categoryid(); ++$cnt_imported_cat; echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . '<br/>'; $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('ams_article') . ' WHERE topicid=' . $arrCat['topic_id']; $resultArticles = $GLOBALS['xoopsDB']->query($sql); while (($arrArticle = $GLOBALS['xoopsDB']->fetchArray($resultArticles)) !== false) { // insert article $itemObj =& $publisher->getHandler('item')->create(); $itemObj->setVar('categoryid', $categoryObj->categoryid()); $itemObj->setVar('title', $arrArticle['title']); $itemObj->setVar('uid', $arrArticle['uid']); $itemObj->setVar('summary', $arrArticle['hometext']);
//echo "<input type='button' name='button' onclick=\"location='item.php?op=mod'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; echo '</div></form>'; // Creating the objects for top categories $categoriesObj =& $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); publisherOpenCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; echo '<tr>'; echo "<th width='20' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMCATEGORY_ID . '</strong></td>'; echo "<th class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCATEGORYNAME . '</strong></td>'; echo "<th width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . '</strong></td>'; echo "<th width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . '</strong></td>'; echo '</tr>'; $totalCategories =& $publisher->getHandler('category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { PublisherUtilities::displayCategory($thiscat); } unset($key, $thiscat); } else { echo '<tr>'; echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . '</td>'; echo '</tr>'; $categoryid = '0'; } echo "</table>\n"; include_once $GLOBALS['xoops']->path('class/pagenav.php'); $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; echo '<br />'; publisherCloseCollapsableBar('createdcategories', 'createdcategoriesicon'); echo '<br>';
/** * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author trabis <*****@*****.**> * @version $Id: onupdate.php 10374 2012-12-12 23:39:48Z trabis $ * * @param $module * @param null $oldversion * * @return */ function xoops_module_update_publisher(XoopsModule $module, $oldversion = null) { global $xoopsDB; if ($oldversion < 102) { // delete old html template files $templateDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/templates/'); $templateList = array_diff(scandir($templateDirectory), array('..', '.')); foreach ($templateList as $k => $v) { $fileInfo = new SplFileInfo($templateDirectory . $v); if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') { if (file_exists($templateDirectory . $v)) { unlink($templateDirectory . $v); } } } // delete old block html template files $templateDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/templates/blocks/'); $templateList = array_diff(scandir($templateDirectory), array('..', '.')); foreach ($templateList as $k => $v) { $fileInfo = new SplFileInfo($templateDirectory . $v); if ($fileInfo->getExtension() === 'html' && $fileInfo->getFilename() !== 'index.html') { if (file_exists($templateDirectory . $v)) { unlink($templateDirectory . $v); } } } //delete old files: $oldFiles = array('/class/request.php', '/class/registry.php', '/include/constants.php', '/ajaxrating.txt'); foreach (array_keys($oldFiles) as $i) { unlink($GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . $oldFiles[$i])); } //delete .html entries from the tpl table $sql = "DELETE FROM " . $xoopsDB->prefix("tplfile") . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; $xoopsDB->queryF($sql); // Load class XoopsFile xoops_load('XoopsFile'); //delete /images directory $imagesDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/images/'); $folderHandler = XoopsFile::getHandler('folder', $imagesDirectory); $folderHandler->delete($imagesDirectory); //delete /css directory $cssDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/css/'); $folderHandler = XoopsFile::getHandler('folder', $cssDirectory); $folderHandler->delete($cssDirectory); //delete /js directory $jsDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/js/'); $folderHandler = XoopsFile::getHandler('folder', $jsDirectory); $folderHandler->delete($jsDirectory); //delete /tcpdf directory $tcpdfDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/tcpdf/'); $folderHandler = XoopsFile::getHandler('folder', $tcpdfDirectory); $folderHandler->delete($tcpdfDirectory); //delete /templates/style.css file // $cssFile = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/templates/style.css'); // $folderHandler = XoopsFile::getHandler('file', $cssFile); // $folderHandler->delete($cssFile); //create upload directories, if needed $moduleDirName = $module->getVar('dirname'); include $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/config.php'); foreach (array_keys($uploadFolders) as $i) { PublisherUtilities::createFolder($uploadFolders[$i]); } //copy blank.png files, if needed $file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; foreach (array_keys($copyFiles) as $i) { $dest = $copyFiles[$i] . '/blank.png'; PublisherUtilities::copyFile($file, $dest); } } $gpermHandler =& xoops_getHandler('groupperm'); return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read'); }