XoopsModules25x /
soapbox
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Module: Soapbox |
||||||
| 4 | * Version: v 1.5 |
||||||
| 5 | * Release Date: 23 August 2004 |
||||||
| 6 | * Author: hsalazar |
||||||
| 7 | * Licence: GNU |
||||||
| 8 | */ |
||||||
| 9 | |||||||
| 10 | use Xmf\Request; |
||||||
| 11 | use XoopsModules\Soapbox; |
||||||
| 12 | |||||||
| 13 | require_once __DIR__ . '/header.php'; |
||||||
| 14 | |||||||
| 15 | /** @var Soapbox\Helper $helper */ |
||||||
| 16 | $helper = Soapbox\Helper::getInstance(); |
||||||
| 17 | |||||||
| 18 | $cleantags = new Soapbox\Cleantags(); |
||||||
| 19 | |||||||
| 20 | $xoopsConfig['module_cache'] = 0; //disable caching since the URL will be the same, but content different from one user to another |
||||||
| 21 | $GLOBALS['xoopsOption']['template_main'] = 'sb_article.tpl'; |
||||||
| 22 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||||||
| 23 | global $xoopsModule; |
||||||
| 24 | //$pathIcon16 = $xoopsModule->getInfo('sysicons16'); |
||||||
| 25 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||||||
| 26 | |||||||
| 27 | $moduleDirName = $myts->htmlSpecialChars(basename(__DIR__)); |
||||||
| 28 | if ('soapbox' !== $moduleDirName && '' !== $moduleDirName && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
||||||
| 29 | echo('invalid dirname: ' . htmlspecialchars($moduleDirName, ENT_QUOTES)); |
||||||
| 30 | } |
||||||
| 31 | //---GET view sort -- |
||||||
| 32 | $sortname = isset($_GET['sortname']) ? mb_strtolower(trim(strip_tags($myts->stripSlashesGPC($_GET['sortname'])))) : 'datesub'; |
||||||
| 33 | if (!in_array($sortname, ['datesub', 'weight', 'counter', 'rating', 'headline'], true)) { |
||||||
| 34 | $sortname = 'datesub'; |
||||||
| 35 | } |
||||||
| 36 | $sortorder = isset($_GET['sortorder']) ? mb_strtoupper(trim(strip_tags($myts->stripSlashesGPC($_GET['sortorder'])))) : 'DESC'; |
||||||
| 37 | if (!in_array($sortorder, ['ASC', 'DESC'], true)) { |
||||||
| 38 | $sortorder = 'DESC'; |
||||||
| 39 | } |
||||||
| 40 | //--------------- |
||||||
| 41 | //require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/cleantags.php'; |
||||||
| 42 | //for ratefile update by domifara |
||||||
| 43 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||
| 44 | //require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/gtickets.php'; |
||||||
| 45 | |||||||
| 46 | $articleID = Request::getInt('articleID', 0, 'GET'); //isset($_GET['articleID']) ? (int)($_GET['articleID']) : 0; |
||||||
| 47 | $startpage = Request::getInt('page', 0, 'GET'); //isset($_GET['page']) ? (int)($_GET['page']) : 0; |
||||||
| 48 | //------------------------------------- |
||||||
| 49 | //move here form ratefile.php |
||||||
| 50 | if (\Xmf\Request::hasVar('submit', 'POST') && !empty($_POST['lid'])) { |
||||||
| 51 | if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/ratefile.inc.php')) { |
||||||
| 52 | require XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/ratefile.inc.php'; |
||||||
| 53 | } |
||||||
| 54 | trigger_error('not updated rate :'); |
||||||
| 55 | exit(); |
||||||
| 56 | } |
||||||
| 57 | //------------------------------------- |
||||||
| 58 | //view start |
||||||
| 59 | $articles = []; |
||||||
| 60 | $category = []; |
||||||
| 61 | //module entry data handler |
||||||
| 62 | /** @var \XoopsModules\Soapbox\EntrygetHandler $entrydataHandler */ |
||||||
| 63 | $entrydataHandler = new \XoopsModules\Soapbox\EntrygetHandler(); |
||||||
| 64 | if (empty($articleID)) { |
||||||
| 65 | //get entry object |
||||||
| 66 | $entryobArray = $entrydataHandler->getArticlesAllPermcheck(1, 0, true, true, 0, 0, null, $sortname, $sortorder, null, null, true, false); |
||||||
| 67 | // $totalarts = $entrydataHandler->total_getArticlesAllPermcheck; |
||||||
| 68 | if (empty($entryobArray) || 0 === count($entryobArray)) { |
||||||
| 69 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/index.php', 1, _MD_SOAPBOX_NOTHING); |
||||||
| 70 | } |
||||||
| 71 | $_entryob = $entryobArray[0]; |
||||||
| 72 | } else { |
||||||
| 73 | //get entry object |
||||||
| 74 | $_entryob = $entrydataHandler->getArticleOnePermcheck($articleID, true, true); |
||||||
| 75 | if (!is_object($_entryob)) { |
||||||
| 76 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/index.php', 1, 'Not Found'); |
||||||
| 77 | } |
||||||
| 78 | } |
||||||
| 79 | //------------------------------------- |
||||||
| 80 | $articles = $_entryob->toArray(); |
||||||
| 81 | //get category object |
||||||
| 82 | $_categoryob = $_entryob->_sbcolumns; |
||||||
| 83 | //get vars |
||||||
| 84 | $category = $_categoryob->toArray(); |
||||||
| 85 | //------------------------------------- |
||||||
| 86 | //update count |
||||||
| 87 | $entrydataHandler->getUpArticlecount($_entryob, true); |
||||||
| 88 | |||||||
| 89 | //assign |
||||||
| 90 | $articles['id'] = $articles['articleID']; |
||||||
| 91 | $articles['posted'] = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $helper->getConfig('dateformat'))); |
||||||
| 92 | |||||||
| 93 | // includes code by toshimitsu |
||||||
| 94 | if ('' !== trim($articles['bodytext'])) { |
||||||
| 95 | $articletext = explode('[pagebreak]', $_entryob->getVar('bodytext', 'none')); |
||||||
| 96 | $articles_pages = count($articletext); |
||||||
| 97 | if ($articles_pages > 1) { |
||||||
| 98 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||||||
| 99 | $pagenav = new \XoopsPageNav($articles_pages, 1, $startpage, 'page', 'articleID=' . $articles['articleID']); |
||||||
| 100 | $xoopsTpl->assign('pagenav', $pagenav->renderNav()); |
||||||
| 101 | if (0 === $startpage) { |
||||||
| 102 | $articles['bodytext'] = $articles['lead'] . '<br><br>' . $myts->displayTarea($articletext[$startpage], $articles['html'], $articles['smiley'], $articles['xcodes'], 1, $articles['breaks']); |
||||||
| 103 | } else { |
||||||
| 104 | $articles['bodytext'] = &$myts->displayTarea($articletext[$startpage], $articles['html'], $articles['smiley'], $articles['xcodes'], 1, $articles['breaks']); |
||||||
| 105 | } |
||||||
| 106 | } else { |
||||||
| 107 | $articles['bodytext'] = $articles['lead'] . '<br><br>' . $myts->displayTarea($_entryob->getVar('bodytext', 'none'), $articles['html'], $articles['smiley'], $articles['xcodes'], 1, $articles['breaks']); |
||||||
| 108 | } |
||||||
| 109 | } |
||||||
| 110 | //Cleantags |
||||||
| 111 | $articles['bodytext'] = $cleantags->cleanTags($articles['bodytext']); |
||||||
| 112 | |||||||
| 113 | if (1 === $helper->getConfig('includerating')) { |
||||||
| 114 | $xoopsTpl->assign('showrating', '1'); |
||||||
| 115 | //------------------------------------- |
||||||
| 116 | //for ratefile update by domifara |
||||||
| 117 | $xoopsTpl->assign('rate_gtickets', $GLOBALS['xoopsSecurity']->getTokenHTML()); |
||||||
| 118 | //------------------------------------- |
||||||
| 119 | if (0.0000 != $articles['rating']) { |
||||||
| 120 | $articles['rating'] = '' . _MD_SOAPBOX_RATING . ': ' . $myts->htmlSpecialChars(number_format($articles['rating'], 2)); |
||||||
| 121 | $articles['votes'] = '' . _MD_SOAPBOX_VOTES . ': ' . $myts->htmlSpecialChars($articles['votes']); |
||||||
| 122 | } else { |
||||||
| 123 | $articles['rating'] = _MD_SOAPBOX_NOTRATED; |
||||||
| 124 | } |
||||||
| 125 | } |
||||||
| 126 | |||||||
| 127 | if (is_object($xoopsUser)) { |
||||||
| 128 | $xoopsTpl->assign('authorpm_link', "<a href=\"javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $category['author'] . "', 'pmlite', 450, 380);\"><img src='" . $pathIcon16 . "/mail_new.png' alt=\"" . _MD_SOAPBOX_WRITEAUTHOR . '"></a>'); |
||||||
| 129 | } else { |
||||||
| 130 | $xoopsTpl->assign('user_pmlink', ''); |
||||||
| 131 | } |
||||||
| 132 | // Теги |
||||||
| 133 | if (xoops_getModuleOption('usetag', 'soapbox')) { |
||||||
|
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||||||
| 134 | $moduleHandler = xoops_getHandler('module'); |
||||||
| 135 | $tagsModule = $moduleHandler->getByDirname('tag'); |
||||||
|
0 ignored issues
–
show
The method
getByDirname() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 136 | if (is_object($tagsModule)) { |
||||||
| 137 | require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php'; |
||||||
| 138 | |||||||
| 139 | $itemid = \Xmf\Request::getInt('articleID', 0, 'GET'); |
||||||
| 140 | $catid = 0; |
||||||
| 141 | $tagbar = tagBar($itemid, $catid); |
||||||
| 142 | if ($tagbar) { |
||||||
| 143 | $xoopsTpl->assign('tagbar', $tagbar); |
||||||
| 144 | $tagsmeta = implode(' ', $tagbar['tags']); |
||||||
| 145 | } else { |
||||||
| 146 | $tagsmeta = ''; |
||||||
| 147 | } |
||||||
| 148 | } else { |
||||||
| 149 | $xoopsTpl->assign('tagbar', false); |
||||||
| 150 | $tagsmeta = ''; |
||||||
| 151 | } |
||||||
| 152 | } |
||||||
| 153 | //if ( xoops_getModuleOption( 'usetag', 'soapbox') ){ |
||||||
| 154 | // require_once XOOPS_ROOT_PATH . '/modules/tag/include/tagbar.php'; |
||||||
| 155 | // $xoopsTpl->assign( 'tags', true ); |
||||||
| 156 | // $xoopsTpl->assign( 'tagbar', tagBar( $_REQUEST['articleID'], 0 ) ); |
||||||
| 157 | //} else { |
||||||
| 158 | // $xoopsTpl->assign( 'tags', false ); |
||||||
| 159 | //} |
||||||
| 160 | |||||||
| 161 | // Functional links |
||||||
| 162 | $articles['adminlinks'] = $entrydataHandler->getadminlinks($_entryob, $_categoryob); |
||||||
| 163 | $articles['userlinks'] = $entrydataHandler->getuserlinks($_entryob); |
||||||
| 164 | |||||||
| 165 | $articles['author'] = Soapbox\Utility::getLinkedUnameFromId($category['author'], 0); |
||||||
| 166 | $articles['authorname'] = Soapbox\Utility::getAuthorName($category['author']); |
||||||
| 167 | $articles['colname'] = $category['name']; |
||||||
| 168 | $articles['coldesc'] = $category['description']; |
||||||
| 169 | $articles['colimage'] = $category['colimage']; |
||||||
| 170 | |||||||
| 171 | $xoopsTpl->assign('xoops_pagetitle', $articles['headline']); |
||||||
| 172 | $xoopsTpl->assign('story', $articles); |
||||||
| 173 | //----------------------------- |
||||||
| 174 | $mbmail_subject = sprintf(_MD_SOAPBOX_INTART, $xoopsConfig['sitename']); |
||||||
| 175 | $mbmail_body = sprintf(_MD_SOAPBOX_INTARTFOUND, $xoopsConfig['sitename']); |
||||||
| 176 | $al = Soapbox\Utility::getAcceptLang(); |
||||||
| 177 | if ('ja' === $al) { |
||||||
| 178 | if (function_exists('mb_convert_encoding') && function_exists('mb_encode_mimeheader') |
||||||
| 179 | && @mb_internal_encoding(_CHARSET)) { |
||||||
| 180 | $mbmail_subject = mb_convert_encoding($mbmail_subject, 'SJIS', _CHARSET); |
||||||
| 181 | $mbmail_body = mb_convert_encoding($mbmail_body, 'SJIS', _CHARSET); |
||||||
| 182 | } |
||||||
| 183 | } |
||||||
| 184 | $mbmail_subject = rawurlencode($mbmail_subject); |
||||||
| 185 | $mbmail_body = rawurlencode($mbmail_body); |
||||||
| 186 | //----------------------------- |
||||||
| 187 | $xoopsTpl->assign('mail_link', 'mailto:?subject=' . $myts->htmlSpecialChars($mbmail_subject) . '&body=' . $myts->htmlSpecialChars($mbmail_body) . ': ' . XOOPS_URL . '/modules/' . $moduleDirName . '/article.php?articleID=' . $articles['articleID']); |
||||||
| 188 | $xoopsTpl->assign('articleID', $articles['articleID']); |
||||||
| 189 | $xoopsTpl->assign('lang_ratethis', _MD_SOAPBOX_RATETHIS); |
||||||
| 190 | $xoopsTpl->assign('lang_modulename', $xoopsModule->name()); |
||||||
| 191 | $xoopsTpl->assign('lang_moduledirname', $moduleDirName); |
||||||
| 192 | $xoopsTpl->assign('imgdir', $myts->htmlSpecialChars($helper->getConfig('sbimgdir'))); |
||||||
| 193 | $xoopsTpl->assign('uploaddir', $myts->htmlSpecialChars($helper->getConfig('sbuploaddir'))); |
||||||
| 194 | |||||||
| 195 | //------------------------------------- |
||||||
| 196 | //box view |
||||||
| 197 | $listarts = []; |
||||||
| 198 | //------------------------------------- |
||||||
| 199 | $_other_entryob_arr = $entrydataHandler->getArticlesAllPermcheck((int)$helper->getConfig('morearts'), 0, true, true, 0, 0, null, $sortname, $sortorder, $_categoryob, $articles['articleID'], true, false); |
||||||
| 200 | $totalartsbyauthor = (int)$entrydataHandler->total_getArticlesAllPermcheck + 1; |
||||||
| 201 | |||||||
| 202 | if (!empty($_other_entryob_arr)) { |
||||||
| 203 | foreach ($_other_entryob_arr as $_other_entryob) { |
||||||
| 204 | $link = []; |
||||||
| 205 | $link = $_other_entryob->toArray(); |
||||||
| 206 | //-------------------- |
||||||
| 207 | $link['id'] = $link['articleID']; |
||||||
| 208 | $link['arttitle'] = $_other_entryob->getVar('headline'); |
||||||
| 209 | $link['published'] = $myts->htmlSpecialChars(formatTimestamp($_other_entryob->getVar('datesub'), $helper->getConfig('dateformat'))); |
||||||
| 210 | // $link['poster'] = XoopsUserUtility::getUnameFromId( $link['uid'] ); |
||||||
| 211 | $link['poster'] = Soapbox\Utility::getLinkedUnameFromId($category['author']); |
||||||
| 212 | $link['bodytext'] = xoops_substr($link['bodytext'], 0, 255); |
||||||
| 213 | $listarts['links'][] = $link; |
||||||
| 214 | } |
||||||
| 215 | $xoopsTpl->assign('listarts', $listarts); |
||||||
| 216 | $xoopsTpl->assign('readmore', "<a style='font-size: 9px;' href=" . XOOPS_URL . '/modules/' . $moduleDirName . '/column.php?columnID=' . $articles['columnID'] . '>' . _MD_SOAPBOX_READMORE . '[' . $totalartsbyauthor . ']</a> '); |
||||||
| 217 | } |
||||||
| 218 | |||||||
| 219 | if (isset($GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) |
||||||
| 220 | && 1 === $GLOBALS['xoopsModuleConfig']['globaldisplaycomments']) { |
||||||
| 221 | if (1 === $articles['commentable']) { |
||||||
| 222 | require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||||
| 223 | } |
||||||
| 224 | } else { |
||||||
| 225 | require XOOPS_ROOT_PATH . '/include/comment_view.php'; |
||||||
| 226 | } |
||||||
| 227 | $xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/assets/css/style.css">'); |
||||||
| 228 | |||||||
| 229 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||||
| 230 |