XoopsModules25x /
soapbox
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | namespace XoopsModules\Soapbox; |
||
| 4 | |||
| 5 | /* |
||
| 6 | * You may not change or alter any portion of this comment or credits |
||
| 7 | * of supporting developers from this source code or any supporting source code |
||
| 8 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 9 | * |
||
| 10 | * This program is distributed in the hope that it will be useful, |
||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 13 | */ |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @copyright XOOPS Project https://xoops.org/ |
||
| 17 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 18 | * @package |
||
| 19 | * @since |
||
| 20 | * @author XOOPS Development Team, Kazumi Ono (AKA onokazu) |
||
| 21 | */ |
||
| 22 | |||
| 23 | use XoopsModules\Soapbox; |
||
| 24 | |||
| 25 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
||
| 26 | $moduleDirName = basename(dirname(__DIR__)); |
||
| 27 | if ('soapbox' !== $moduleDirName && '' !== $moduleDirName && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
||
| 28 | echo('invalid dirname: ' . htmlspecialchars($moduleDirName, ENT_QUOTES | ENT_HTML5)); |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Soapbox entrydata handler class. |
||
| 33 | * This class provides simple interface (a facade class) for handling sbarticles/sbcolumns/sbvotedata |
||
| 34 | * entrydata. |
||
| 35 | * |
||
| 36 | * |
||
| 37 | * @author domifara |
||
| 38 | * @package modules |
||
| 39 | */ |
||
| 40 | class EntrygetHandler extends \XoopsPersistableObjectHandler |
||
| 41 | { |
||
| 42 | /**#@+ |
||
| 43 | * holds reference to entry handler(DAO) class |
||
| 44 | * @access private |
||
| 45 | */ |
||
| 46 | protected $sbArticleHandler; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * holds reference to user handler(DAO) class |
||
| 50 | */ |
||
| 51 | protected $sbColumnHandler; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * holds reference to membership handler(DAO) class |
||
| 55 | */ |
||
| 56 | protected $sbVoteHandler; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * holds temporary module_id |
||
| 60 | */ |
||
| 61 | protected $moduleId; |
||
| 62 | protected $moduleDirName; |
||
| 63 | /**#@-*/ |
||
| 64 | |||
| 65 | public $total_getArticlesAllPermcheck; |
||
| 66 | public $total_getColumnsAllPermcheck; |
||
| 67 | |||
| 68 | public $total_getArticlesByColumnID; |
||
| 69 | public $total_getVotedatasByArticleID; |
||
| 70 | public $total_getColumnsByAuthor; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * constructor |
||
| 74 | * @param \XoopsDatabase|null $db |
||
| 75 | */ |
||
| 76 | public function __construct(\XoopsDatabase $db = null) |
||
| 77 | { |
||
| 78 | parent::__construct($db); |
||
| 79 | $moduleDirName = basename(dirname(__DIR__)); |
||
| 80 | if ('soapbox' !== $moduleDirName && '' !== $moduleDirName && !preg_match('/^(\D+)(\d*)$/', $moduleDirName)) { |
||
| 81 | echo('invalid dirname: ' . htmlspecialchars($moduleDirName, ENT_QUOTES | ENT_HTML5)); |
||
| 82 | } |
||
| 83 | $this->sbArticleHandler = new Soapbox\ArticlesHandler($db); |
||
| 84 | $this->sbColumnHandler = new Soapbox\ColumnsHandler($db); |
||
| 85 | $this->sbVoteHandler = new Soapbox\VotedataHandler($db); |
||
| 86 | $_mymoduleHandler = xoops_getHandler('module'); |
||
| 87 | $_mymodule = $_mymoduleHandler->getByDirname($moduleDirName); |
||
| 88 | if (!is_object($_mymodule)) { |
||
| 89 | exit('not found dirname'); |
||
| 90 | } |
||
| 91 | $this->moduleDirName = $moduleDirName; |
||
| 92 | $this->moduleId = $_mymodule->getVar('mid'); |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * retrieve a Article |
||
| 97 | * |
||
| 98 | * @param int $id ID for the Article |
||
| 99 | * @return Articles Articles reference to the Article |
||
| 100 | */ |
||
| 101 | public function getArticle($id) |
||
| 102 | { |
||
| 103 | $ret = $this->sbArticleHandler->get($id); |
||
| 104 | |||
| 105 | return $ret; |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * retrieve a Column |
||
| 110 | * |
||
| 111 | * @param int $id ID for the Article |
||
| 112 | * @return Articles Articles reference to the Column |
||
| 113 | */ |
||
| 114 | public function getColumn($id) |
||
| 115 | { |
||
| 116 | $ret = $this->sbColumnHandler->get($id); |
||
| 117 | |||
| 118 | return $ret; |
||
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * retrieve a Votedata |
||
| 123 | * |
||
| 124 | * @param int $id ID for the Article |
||
| 125 | * @return Votedata Votedata reference to the Votedata |
||
| 126 | */ |
||
| 127 | public function getVotedata($id) |
||
| 128 | { |
||
| 129 | $ret = $this->sbVoteHandler->get($id); |
||
| 130 | |||
| 131 | return $ret; |
||
| 132 | } |
||
| 133 | |||
| 134 | /** |
||
| 135 | * retrieve Articles from the database |
||
| 136 | * |
||
| 137 | * @param \CriteriaElement $criteria {@link CriteriaElement} |
||
| 138 | * @param bool $id_as_key use the Article's ID as key for the array? |
||
| 139 | * @return array array of {@link Articles} objects |
||
| 140 | */ |
||
| 141 | public function getArticles(\CriteriaElement $criteria = null, $id_as_key = false) |
||
| 142 | { |
||
| 143 | $ret = $this->sbArticleHandler->getObjects($criteria, $id_as_key); |
||
| 144 | |||
| 145 | return $ret; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * retrieve Columns from the database |
||
| 150 | * |
||
| 151 | * @param \CriteriaElement $criteria {@link \CriteriaElement} |
||
| 152 | * @param bool $id_as_key use the Column's ID as key for the array? |
||
| 153 | * @return array array of {@link Columns} objects |
||
| 154 | */ |
||
| 155 | public function getColumns(\CriteriaElement $criteria = null, $id_as_key = false) |
||
| 156 | { |
||
| 157 | $ret = $this->sbColumnHandler->getObjects($criteria, $id_as_key); |
||
| 158 | |||
| 159 | return $ret; |
||
| 160 | } |
||
| 161 | |||
| 162 | /** |
||
| 163 | * retrieve Votedatas from the database |
||
| 164 | * |
||
| 165 | * @param \CriteriaElement $criteria {@link \CriteriaElement} |
||
| 166 | * @param bool $id_as_key use the Votedata's ID as key for the array? |
||
| 167 | * @return array array of {@link Votedata} objects |
||
| 168 | */ |
||
| 169 | public function getVotedatas(\CriteriaElement $criteria = null, $id_as_key = false) |
||
| 170 | { |
||
| 171 | $ret = $this->sbVoteHandler->getObjects($criteria, $id_as_key); |
||
| 172 | |||
| 173 | return $ret; |
||
| 174 | } |
||
| 175 | |||
| 176 | /** |
||
| 177 | * count Article matching certain conditions |
||
| 178 | * |
||
| 179 | * @param \CriteriaElement $criteria {@link \CriteriaElement} object |
||
| 180 | * @return int |
||
| 181 | */ |
||
| 182 | public function getArticleCount(\CriteriaElement $criteria = null) |
||
| 183 | { |
||
| 184 | return $this->sbArticleHandler->getCount($criteria); |
||
| 185 | } |
||
| 186 | |||
| 187 | /** |
||
| 188 | * count Column matching certain conditions |
||
| 189 | * |
||
| 190 | * @param \CriteriaElement $criteria {@link \CriteriaElement} object |
||
| 191 | * @return int |
||
| 192 | */ |
||
| 193 | public function getColumnCount(\CriteriaElement $criteria = null) |
||
| 194 | { |
||
| 195 | return $this->sbColumnHandler->getCount($criteria); |
||
| 196 | } |
||
| 197 | |||
| 198 | /** |
||
| 199 | * count Votedata matching certain conditions |
||
| 200 | * |
||
| 201 | * @param \CriteriaElement $criteria {@link CriteriaElement} object |
||
| 202 | * @return int |
||
| 203 | */ |
||
| 204 | public function getVotedataCount(\CriteriaElement $criteria = null) |
||
| 205 | { |
||
| 206 | return $this->sbVoteHandler->getCount($criteria); |
||
| 207 | } |
||
| 208 | |||
| 209 | /** |
||
| 210 | * array return . from int or objects |
||
| 211 | * |
||
| 212 | * @param int|array|Columns $sbcolumns |
||
| 213 | * @return array ( int columnID's) |
||
| 214 | */ |
||
| 215 | public function getColumnsItemIDs($sbcolumns) |
||
| 216 | { |
||
| 217 | $ret = []; |
||
| 218 | $columnIDs = []; |
||
| 219 | if (!isset($sbcolumns) || empty($sbcolumns)) { |
||
| 220 | return $ret; |
||
| 221 | } |
||
| 222 | if (is_object($sbcolumns)) { |
||
| 223 | if (mb_strtolower(get_class($sbcolumns)) === mb_strtolower(Columns::class)) { |
||
| 224 | $columnIDs[] = $sbcolumns->getVar('columnID'); |
||
| 225 | } |
||
| 226 | } else { |
||
| 227 | if (is_array($sbcolumns)) { |
||
| 228 | if (0 === count($sbcolumns)) { |
||
| 229 | return $ret; |
||
| 230 | } |
||
| 231 | $sbcolumns = array_unique($sbcolumns); |
||
| 232 | foreach ($sbcolumns as $k => $v) { |
||
| 233 | if (is_object($v)) { |
||
| 234 | if (mb_strtolower(get_class($v)) === mb_strtolower(Columns::class)) { |
||
| 235 | $columnIDs[] = $v->getVar('columnID'); |
||
| 236 | } |
||
| 237 | } else { |
||
| 238 | $columnIDs[] = (int)$v; |
||
| 239 | } |
||
| 240 | } |
||
| 241 | } else { |
||
| 242 | $columnIDs[] = (int)$sbcolumns; |
||
| 243 | } |
||
| 244 | } |
||
| 245 | $ret = array_unique($columnIDs); |
||
| 246 | |||
| 247 | return $ret; |
||
| 248 | } |
||
| 249 | |||
| 250 | /** |
||
| 251 | * array return . from int or objects |
||
| 252 | * |
||
| 253 | * @param int|array|Articles $sbarticles |
||
| 254 | * @return array ( int articleID's) |
||
| 255 | */ |
||
| 256 | public function getArticlesItemIDs($sbarticles) |
||
| 257 | { |
||
| 258 | $ret = []; |
||
| 259 | $articleIDs = []; |
||
| 260 | if (!isset($sbarticles) || empty($sbarticles)) { |
||
| 261 | return $ret; |
||
| 262 | } |
||
| 263 | if (is_object($sbarticles)) { |
||
| 264 | if (mb_strtolower(get_class($sbarticles)) === mb_strtolower(Articles::class)) { |
||
| 265 | $articleIDs[] = $sbarticles->getVar('articleID'); |
||
| 266 | } |
||
| 267 | } else { |
||
| 268 | if (is_array($sbarticles)) { |
||
| 269 | if (0 === count($sbarticles)) { |
||
| 270 | return $ret; |
||
| 271 | } |
||
| 272 | $sbarticles = array_unique($sbarticles); |
||
| 273 | foreach ($sbarticles as $k => $v) { |
||
| 274 | if (is_object($v)) { |
||
| 275 | if (mb_strtolower(get_class($v)) === mb_strtolower(Articles::class)) { |
||
| 276 | $articleIDs[] = $v->getVar('articleID'); |
||
| 277 | } |
||
| 278 | } else { |
||
| 279 | $articleIDs[] = (int)$v; |
||
| 280 | } |
||
| 281 | } |
||
| 282 | } else { |
||
| 283 | $articleIDs[] = (int)$sbarticles; |
||
| 284 | } |
||
| 285 | } |
||
| 286 | $ret = array_unique($articleIDs); |
||
| 287 | |||
| 288 | return $ret; |
||
| 289 | } |
||
| 290 | |||
| 291 | /** |
||
| 292 | * get sbcolumns objects with pemission check , sort |
||
| 293 | * |
||
| 294 | * @param int $limit number of records to return |
||
| 295 | * @param int $start offset of first record to return |
||
| 296 | * @param bool $checkRight true is with pemission check |
||
| 297 | * @param string $sortname sort oder by filed name |
||
| 298 | * @param string $sortorder sort oder by option (one filed name) |
||
| 299 | * @param int|array $sbcolumns is select int columnID or array columnIDs ,object or objects |
||
| 300 | * @param int|array $NOTsbcolumns is no select columnID or array columnIDs ,object or objects |
||
| 301 | * @param bool $id_as_key use the Column's ID as key for the array? |
||
| 302 | * @set int total count of entrys to total_getColumnsAllPermcheck |
||
| 303 | * @return array array of {@link Columns} objects |
||
| 304 | */ |
||
| 305 | public function getColumnsAllPermcheck( |
||
| 306 | $limit = 0, |
||
| 307 | $start = 0, |
||
| 308 | $checkRight = true, |
||
| 309 | $sortname = 'weight', |
||
| 310 | $sortorder = 'ASC', |
||
| 311 | $sbcolumns = null, |
||
| 312 | $NOTsbcolumns = null, |
||
| 313 | $id_as_key = false) |
||
| 314 | { |
||
| 315 | global $xoopsUser; |
||
| 316 | $ret = []; |
||
| 317 | $this->total_getColumnsAllPermcheck = 0; |
||
| 318 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 319 | $columnIDs = []; |
||
| 320 | $notcolumnIDs = []; |
||
| 321 | $can_read_columnIDs = []; |
||
| 322 | //if obect -- change --> array |
||
| 323 | if (isset($sbcolumns)) { |
||
| 324 | $columnIDs = $this->getColumnsItemIDs($sbcolumns); |
||
| 325 | } |
||
| 326 | //if obect -- change --> array |
||
| 327 | if (isset($NOTsbcolumns)) { |
||
| 328 | $notcolumnIDs = $this->getColumnsItemIDs($NOTsbcolumns); |
||
| 329 | } |
||
| 330 | if ($checkRight) { |
||
| 331 | $gperm_name = 'Column Permissions'; |
||
| 332 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 333 | $can_read_columnIDs = $grouppermHandler->getItemIds($gperm_name, $groups, $this->moduleId); |
||
| 334 | } |
||
| 335 | //-------------------------- |
||
| 336 | $criteria = new \CriteriaCompo(); |
||
| 337 | $criteria_used = false; |
||
| 338 | if (!empty($columnIDs) && count($columnIDs) > 0) { |
||
| 339 | $criteria->add(new \Criteria('columnID', '(' . implode(',', array_unique($columnIDs)) . ')', 'IN')); |
||
| 340 | $criteria_used = true; |
||
| 341 | } |
||
| 342 | if (!empty($notcolumnIDs) && count($notcolumnIDs) > 0) { |
||
| 343 | $criteria->add(new \Criteria('columnID', '(' . implode(',', array_unique($notcolumnIDs)) . ')', 'NOT IN')); |
||
| 344 | $criteria_used = true; |
||
| 345 | } |
||
| 346 | if (!empty($can_read_columnIDs) && count($can_read_columnIDs) > 0) { |
||
| 347 | $criteria->add(new \Criteria('columnID', '(' . implode(',', array_unique($can_read_columnIDs)) . ')', 'IN')); |
||
| 348 | $criteria_used = true; |
||
| 349 | } |
||
| 350 | //------ hold all count |
||
| 351 | if ($criteria_used) { |
||
| 352 | $this->total_getColumnsAllPermcheck = $this->getColumnCount($criteria); |
||
| 353 | } else { |
||
| 354 | $this->total_getColumnsAllPermcheck = $this->getColumnCount(); |
||
| 355 | } |
||
| 356 | if (empty($this->total_getColumnsAllPermcheck)) { |
||
| 357 | return $ret; |
||
| 358 | } |
||
| 359 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 360 | $criteria->setSort($sortname); |
||
| 361 | } |
||
| 362 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 363 | $criteria->setOrder($sortorder); |
||
| 364 | } |
||
| 365 | $criteria->setLimit((int)$limit); |
||
| 366 | $criteria->setStart((int)$start); |
||
| 367 | $ret = $this->getColumns($criteria, $id_as_key); |
||
| 368 | |||
| 369 | unset($criteria); |
||
| 370 | |||
| 371 | return $ret; |
||
| 372 | //------------------------------------- |
||
| 373 | } |
||
| 374 | |||
| 375 | /** |
||
| 376 | * get sbcolumns objects with permission check , sort |
||
| 377 | * |
||
| 378 | * @param int $limit number of records to return |
||
| 379 | * @param int $start offset of first record to return |
||
| 380 | * @param bool $checkRight true is with pemission check |
||
| 381 | * @param bool $published true is with datesub check |
||
| 382 | * @param int $submit for submit check where submit = $submit |
||
| 383 | * @param int $offline for offline check where offline = $offline |
||
| 384 | * @param int $block for block check where block = $block |
||
| 385 | * @param string $sortname sort oder by filed name |
||
| 386 | * @param string $sortorder sort oder by option (one filed name) |
||
| 387 | * @param int|array|Columns $select_sbcolumns |
||
| 388 | * @param int|array|Articles $NOTsbarticles is no select articleID or array articleIDs ,object or objects |
||
| 389 | * @param bool $approve_submit with author articles of column non check else offline |
||
| 390 | * @param bool $id_as_key use the articleID's ID as key for the array? |
||
| 391 | * |
||
| 392 | * @set int total count of entrys to total_getArticlesAllPermcheck |
||
| 393 | * @return array array of {@link Articles} objects |
||
| 394 | */ |
||
| 395 | public function getArticlesAllPermcheck( |
||
| 396 | $limit = 0, |
||
| 397 | $start = 0, |
||
| 398 | $checkRight = true, |
||
| 399 | $published = true, |
||
| 400 | $submit = 0, |
||
| 401 | $offline = 0, |
||
| 402 | $block = null, |
||
| 403 | $sortname = 'datesub', |
||
| 404 | $sortorder = 'DESC', |
||
| 405 | $select_sbcolumns = null, |
||
| 406 | $NOTsbarticles = null, |
||
| 407 | $approve_submit = false, |
||
| 408 | $id_as_key = false) |
||
| 409 | { |
||
| 410 | global $xoopsUser; |
||
| 411 | $ret = []; |
||
| 412 | $this->total_getArticlesAllPermcheck = 0; |
||
| 413 | //get Columns |
||
| 414 | $can_read_columnIDs = []; |
||
| 415 | $can_read_column_authors = []; |
||
| 416 | $NOTarticleIDs = []; |
||
| 417 | if ($checkRight || isset($select_sbcolumns) || $approve_submit) { |
||
| 418 | //get category object |
||
| 419 | $_sbcolumns_arr = $this->getColumnsAllPermcheck(0, 0, $checkRight, null, null, $select_sbcolumns, null, true); |
||
| 420 | if (empty($_sbcolumns_arr) || 0 === count($_sbcolumns_arr)) { |
||
| 421 | return $ret; |
||
| 422 | } |
||
| 423 | foreach ($_sbcolumns_arr as $key => $_sbcolumn) { |
||
| 424 | $can_read_columnIDs[] = $_sbcolumn->getVar('columnID'); |
||
| 425 | if (is_object($xoopsUser)) { |
||
| 426 | if ($xoopsUser->isAdmin($this->moduleId) |
||
| 427 | || $xoopsUser->getVar('uid') === $_sbcolumn->getVar('author')) { |
||
| 428 | $can_read_column_authors[] = $_sbcolumn->getVar('columnID'); |
||
| 429 | } |
||
| 430 | } |
||
| 431 | } |
||
| 432 | if (empty($can_read_columnIDs)) { |
||
| 433 | return $ret; |
||
| 434 | } |
||
| 435 | } else { |
||
| 436 | //get category object all |
||
| 437 | $_sbcolumns_arr = $this->getColumns(null, true); |
||
| 438 | } |
||
| 439 | //getArticles |
||
| 440 | $criteria = new \CriteriaCompo(); |
||
| 441 | $criteria_used = false; |
||
| 442 | $criteria_public = new \CriteriaCompo(); |
||
| 443 | $criteria_public_used = false; |
||
| 444 | if (count($can_read_columnIDs) > 0) { |
||
| 445 | $criteria_public->add(new \Criteria('columnID', '(' . implode(',', array_unique($can_read_columnIDs)) . ')', 'IN')); |
||
| 446 | $criteria_public_used = true; |
||
| 447 | } |
||
| 448 | if ($checkRight) { |
||
| 449 | if ($published) { |
||
| 450 | $criteria_public->add(new \Criteria('datesub', time(), '<')); |
||
| 451 | $criteria_public->add(new \Criteria('datesub', 0, '>')); |
||
| 452 | $criteria_public_used = true; |
||
| 453 | } |
||
| 454 | } |
||
| 455 | //------ |
||
| 456 | if (isset($submit)) { |
||
| 457 | $criteria_public->add(new \Criteria('submit', (int)$submit)); |
||
| 458 | $criteria_public_used = true; |
||
| 459 | } |
||
| 460 | if (isset($offline)) { |
||
| 461 | $criteria_public->add(new \Criteria('offline', (int)$offline)); |
||
| 462 | $criteria_public_used = true; |
||
| 463 | } |
||
| 464 | if (isset($block)) { |
||
| 465 | $criteria_public->add(new \Criteria('block', (int)$block)); |
||
| 466 | $criteria_public_used = true; |
||
| 467 | } |
||
| 468 | if (isset($NOTsbarticles)) { |
||
| 469 | $notarticleIDs = $this->getColumnsItemIDs($NOTsbarticles); |
||
| 470 | $criteria_public->add(new \Criteria('articleID', '(' . implode(',', array_unique($notarticleIDs)) . ')', 'NOT IN')); |
||
| 471 | $criteria_public_used = true; |
||
| 472 | } |
||
| 473 | |||
| 474 | if ($criteria_public_used) { |
||
| 475 | $criteria = new \CriteriaCompo($criteria_public); |
||
| 476 | $criteria_used = true; |
||
| 477 | } |
||
| 478 | unset($criteria_public); |
||
| 479 | |||
| 480 | // approve submit for column_authors |
||
| 481 | if ($approve_submit && count($can_read_column_authors) > 0) { |
||
| 482 | $crit_approve_submit = new \CriteriaCompo(); |
||
| 483 | $crit_approve_submit->add(new \Criteria('columnID', '(' . implode(',', array_unique($can_read_column_authors)) . ')', 'IN')); |
||
| 484 | if (isset($NOTsbarticles)) { |
||
| 485 | $notarticleIDs = $this->getColumnsItemIDs($NOTsbarticles); |
||
| 486 | if (count($notarticleIDs) > 0) { |
||
| 487 | $crit_approve_submit->add(new \Criteria('articleID', '(' . implode(',', array_unique($notarticleIDs)) . ')', 'NOT IN')); |
||
| 488 | } |
||
| 489 | } |
||
| 490 | // $crit_approve_submit->add(new \Criteria( 'submit', 1 )); |
||
| 491 | $crit_approve_submit->add(new \Criteria('offline', 0)); |
||
| 492 | $criteria->add($crit_approve_submit, 'OR'); |
||
| 493 | $criteria_used = true; |
||
| 494 | unset($crit_approve_submit); |
||
| 495 | } |
||
| 496 | //------ |
||
| 497 | if ($criteria_public_used) { |
||
| 498 | $this->total_getArticlesAllPermcheck = $this->getArticleCount($criteria); |
||
| 499 | } else { |
||
| 500 | $this->total_getArticlesAllPermcheck = $this->getArticleCount(); |
||
| 501 | } |
||
| 502 | if (empty($this->total_getArticlesAllPermcheck)) { |
||
| 503 | return $ret; |
||
| 504 | } |
||
| 505 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 506 | $criteria->setSort($sortname); |
||
| 507 | } |
||
| 508 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 509 | $criteria->setOrder($sortorder); |
||
| 510 | } |
||
| 511 | $criteria->setLimit((int)$limit); |
||
| 512 | $criteria->setStart((int)$start); |
||
| 513 | $sbarticle_arr = $this->getArticles($criteria, $id_as_key); |
||
| 514 | foreach ($sbarticle_arr as $k => $sbarticle) { |
||
| 515 | $sbarticle_arr[$k]->_sbcolumns = $_sbcolumns_arr[$sbarticle->getVar('columnID')]; |
||
| 516 | } |
||
| 517 | |||
| 518 | unset($criteria); |
||
| 519 | |||
| 520 | return $sbarticle_arr; |
||
| 521 | //------------------------------------- |
||
| 522 | } |
||
| 523 | |||
| 524 | /** |
||
| 525 | * get object with check Perm a entry |
||
| 526 | * |
||
| 527 | * @param $id |
||
| 528 | * @param bool $checkRight |
||
| 529 | * @param bool $approve_submit |
||
| 530 | * @return mixed reference to the {@link Articles} object, FALSE if failed |
||
| 531 | * object, FALSE if failed |
||
| 532 | * @internal param int $articleID articleID of the entry |
||
| 533 | * @internal param bool $force |
||
| 534 | */ |
||
| 535 | public function getArticleOnePermcheck($id, $checkRight = true, $approve_submit = false) |
||
| 536 | { |
||
| 537 | global $xoopsUser; |
||
| 538 | $ret = false; |
||
| 539 | $sbarticle = $this->getArticle($id); |
||
| 540 | if (!is_object($sbarticle)) { |
||
| 541 | return $ret; |
||
| 542 | } |
||
| 543 | // $gperm_name = 'Column Permissions'; |
||
| 544 | // $groups = ( is_object($xoopsUser) ) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 545 | // $grouppermHandler = xoops_getHandler( 'groupperm' ); |
||
| 546 | // if ( !$grouppermHandler -> checkRight( $gperm_name,$sbarticle->getVar('columnID'), $groups, $this->moduleId ) ) { |
||
| 547 | // return $ret; |
||
| 548 | // } |
||
| 549 | //get category object |
||
| 550 | $_sbcolumns_arr = $this->getColumnsAllPermcheck(1, 0, $checkRight, null, null, $sbarticle->getVar('columnID'), null, true); |
||
| 551 | if ($checkRight) { |
||
| 552 | if (empty($_sbcolumns_arr) || 0 === count($_sbcolumns_arr)) { |
||
| 553 | return $ret; |
||
| 554 | } |
||
| 555 | $sbarticle->_sbcolumns = $_sbcolumns_arr[$sbarticle->getVar('columnID')]; |
||
| 556 | if (0 !== $sbarticle->getVar('offline')) { |
||
| 557 | return $ret; |
||
| 558 | } |
||
| 559 | if (is_object($xoopsUser)) { |
||
| 560 | if ($approve_submit) { |
||
| 561 | if ($xoopsUser->isAdmin($this->moduleId) |
||
| 562 | || $xoopsUser->getVar('uid') === $sbarticle->_sbcolumns->getVar('author')) { |
||
| 563 | //true |
||
| 564 | $ret = $sbarticle; |
||
| 565 | |||
| 566 | return $ret; |
||
| 567 | } |
||
| 568 | } |
||
| 569 | } |
||
| 570 | if (0 === $sbarticle->getVar('datesub')) { |
||
| 571 | return $ret; |
||
| 572 | } |
||
| 573 | if ($sbarticle->getVar('datesub') > time()) { |
||
| 574 | return $ret; |
||
| 575 | } |
||
| 576 | if (0 !== $sbarticle->getVar('submit')) { |
||
| 577 | return $ret; |
||
| 578 | } |
||
| 579 | } |
||
| 580 | //true |
||
| 581 | $ret = $sbarticle; |
||
| 582 | |||
| 583 | return $ret; |
||
| 584 | } |
||
| 585 | |||
| 586 | //---------------------------------------------------------------------- |
||
| 587 | |||
| 588 | /** |
||
| 589 | * get a list of Articles belonging to a column |
||
| 590 | * |
||
| 591 | * @param int $columnID ID of the Column |
||
| 592 | * @param bool $asobject return the users as objects? |
||
| 593 | * @param int $limit number of users to return |
||
| 594 | * @param int $start index of the first user to return |
||
| 595 | * @param null $sortname |
||
| 596 | * @param null $sortorder |
||
| 597 | * @return array Array of {@link Articles} objects (if $asobject is TRUE) |
||
| 598 | * objects (if $asobject is TRUE) |
||
| 599 | */ |
||
| 600 | public function getArticlesByColumnID( |
||
| 601 | $columnID, |
||
| 602 | $asobject = false, |
||
| 603 | $limit = 0, |
||
| 604 | $start = 0, |
||
| 605 | $sortname = null, |
||
| 606 | $sortorder = null) |
||
| 607 | { |
||
| 608 | $ret = []; |
||
| 609 | $this->total_getArticlesByColumnID = 0; |
||
| 610 | |||
| 611 | $criteria = new \CriteriaCompo(); |
||
| 612 | $criteria->add(new \Criteria('columnID', $columnID)); |
||
| 613 | $this->total_getArticlesByColumnID = $this->getArticleCount($criteria); |
||
| 614 | if (empty($this->total_getArticlesByColumnID) || 0 === $this->total_getArticlesByColumnID) { |
||
| 615 | return $ret; |
||
| 616 | } |
||
| 617 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 618 | $criteria->setSort($sortname); |
||
| 619 | } |
||
| 620 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 621 | $criteria->setOrder($sortorder); |
||
| 622 | } |
||
| 623 | $criteria->setLimit((int)$limit); |
||
| 624 | $criteria->setStart((int)$start); |
||
| 625 | $sbarticle_arr = $this->getArticles($criteria, true); |
||
| 626 | unset($criteria); |
||
| 627 | if (empty($sbarticle_arr) || 0 === count($sbarticle_arr)) { |
||
| 628 | return $ret; |
||
| 629 | } |
||
| 630 | if ($asobject) { |
||
| 631 | $ret = $sbarticle_arr; |
||
| 632 | } else { |
||
| 633 | foreach ($sbarticle_arr as $key => $sbarticle) { |
||
| 634 | $ret[] = $key; |
||
| 635 | } |
||
| 636 | } |
||
| 637 | |||
| 638 | return $ret; |
||
| 639 | } |
||
| 640 | |||
| 641 | /** |
||
| 642 | * get a list of Votedatas belonging to a Article |
||
| 643 | * |
||
| 644 | * @param int $articleID ID of the Article |
||
| 645 | * @param bool $asobject return the users as objects? |
||
| 646 | * @param int $limit number of users to return |
||
| 647 | * @param int $start index of the first user to return |
||
| 648 | * @param null $sortname |
||
| 649 | * @param null $sortorder |
||
| 650 | * @return array Array of {@link Votedata} objects (if $asobject is TRUE) |
||
| 651 | * objects (if $asobject is TRUE) |
||
| 652 | */ |
||
| 653 | public function getVotedatasByArticleID( |
||
| 654 | $articleID, |
||
| 655 | $asobject = false, |
||
| 656 | $limit = 0, |
||
| 657 | $start = 0, |
||
| 658 | $sortname = null, |
||
| 659 | $sortorder = null) |
||
| 660 | { |
||
| 661 | $ret = []; |
||
| 662 | $this->total_getVotedatasByArticleID = 0; |
||
| 663 | $criteria = new \CriteriaCompo(); |
||
| 664 | $criteria->add(new \Criteria('lid', $articleID)); |
||
| 665 | $this->total_getVotedatasByArticleID = $this->getVotedataCount($criteria); |
||
| 666 | if (empty($this->total_getVotedatasByArticleID) || 0 === $this->total_getVotedatasByArticleID) { |
||
| 667 | return $ret; |
||
| 668 | } |
||
| 669 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 670 | $criteria->setSort($sortname); |
||
| 671 | } |
||
| 672 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 673 | $criteria->setOrder($sortorder); |
||
| 674 | } |
||
| 675 | $criteria->setLimit((int)$limit); |
||
| 676 | $criteria->setStart((int)$start); |
||
| 677 | $sbvotedata_arr = $this->getVotedatas($criteria, true); |
||
| 678 | unset($criteria); |
||
| 679 | if (empty($sbvotedata_arr) || 0 === count($sbvotedata_arr)) { |
||
| 680 | return $ret; |
||
| 681 | } |
||
| 682 | if ($asobject) { |
||
| 683 | $ret = $sbvotedata_arr; |
||
| 684 | } else { |
||
| 685 | foreach ($sbvotedata_arr as $key => $sbvotedata) { |
||
| 686 | $ret[] = $key; |
||
| 687 | } |
||
| 688 | } |
||
| 689 | |||
| 690 | return $ret; |
||
| 691 | } |
||
| 692 | |||
| 693 | /** |
||
| 694 | * get a list of columns that a user is author of |
||
| 695 | * |
||
| 696 | * @param int $user_id ID of the user |
||
| 697 | * @param bool $asobject return groups as {@link Columns} objects or arrays? |
||
| 698 | * @param int $limit |
||
| 699 | * @param int $start |
||
| 700 | * @param null $sortname |
||
| 701 | * @param null $sortorder |
||
| 702 | * @return array array of objects or arrays |
||
| 703 | */ |
||
| 704 | public function getColumnsByAuthor( |
||
| 705 | $user_id, |
||
| 706 | $asobject = false, |
||
| 707 | $limit = 0, |
||
| 708 | $start = 0, |
||
| 709 | $sortname = null, |
||
| 710 | $sortorder = null) |
||
| 711 | { |
||
| 712 | $ret = []; |
||
| 713 | $this->total_getColumnsByAuthor = 0; |
||
| 714 | $criteria = new \CriteriaCompo(); |
||
| 715 | $criteria->add(new \Criteria('author', $user_id)); |
||
| 716 | $this->total_getColumnsByAuthor = $this->getColumnCount($criteria); |
||
| 717 | if (empty($this->total_getColumnsByAuthor) || 0 === $this->total_getColumnsByAuthor) { |
||
| 718 | return $ret; |
||
| 719 | } |
||
| 720 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 721 | $criteria->setSort($sortname); |
||
| 722 | } |
||
| 723 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 724 | $criteria->setOrder($sortorder); |
||
| 725 | } |
||
| 726 | $criteria->setLimit((int)$limit); |
||
| 727 | $criteria->setStart((int)$start); |
||
| 728 | $sbcolumns_arr = $this->getColumns($criteria, true); |
||
| 729 | unset($criteria); |
||
| 730 | if (empty($sbcolumns_arr) || 0 === count($sbcolumns_arr)) { |
||
| 731 | return $ret; |
||
| 732 | } |
||
| 733 | if ($asobject) { |
||
| 734 | $ret = $sbcolumns_arr; |
||
| 735 | } else { |
||
| 736 | foreach ($sbcolumns_arr as $key => $sbcolumns) { |
||
| 737 | $ret[] = $key; |
||
| 738 | } |
||
| 739 | } |
||
| 740 | |||
| 741 | return $ret; |
||
| 742 | } |
||
| 743 | |||
| 744 | /** |
||
| 745 | * get a list of columns that article objects |
||
| 746 | * |
||
| 747 | * @param $_sbarticle_arr |
||
| 748 | * @param bool $asobject |
||
| 749 | * @param int $limit |
||
| 750 | * @param int $start |
||
| 751 | * @param null $sortname |
||
| 752 | * @param null $sortorder |
||
| 753 | * @return array array of {@link Columns} objects |
||
| 754 | * objects |
||
| 755 | * @internal param object $sbarticle reference to the {@link Articles} object object |
||
| 756 | * @internal param bool $id_as_key use the columnID as key for the array? |
||
| 757 | */ |
||
| 758 | public function getColumnsByArticles( |
||
| 759 | $_sbarticle_arr, |
||
| 760 | $asobject = false, |
||
| 761 | $limit = 0, |
||
| 762 | $start = 0, |
||
| 763 | $sortname = null, |
||
| 764 | $sortorder = null) |
||
| 765 | { |
||
| 766 | $ret = []; |
||
| 767 | $columnIDs = []; |
||
| 768 | if (is_array($_sbarticle_arr)) { |
||
| 769 | foreach ($_sbarticle_arr as $sbarticle) { |
||
| 770 | if (mb_strtolower(get_class($sbarticle)) !== mb_strtolower(Articles::class)) { |
||
| 771 | $columnIDs[] = $sbarticle->getVar('columnID'); |
||
| 772 | } |
||
| 773 | } |
||
| 774 | } else { |
||
| 775 | if (mb_strtolower(get_class($sbarticle)) !== mb_strtolower(Articles::class)) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 776 | $columnIDs[] = $_sbarticle_arr->getVar('columnID'); |
||
| 777 | } |
||
| 778 | } |
||
| 779 | if (!empty($columnIDs) && count($columnIDs) > 0) { |
||
| 780 | return $ret; |
||
| 781 | } |
||
| 782 | $columnIDs = array_unique($columnIDs); |
||
| 783 | |||
| 784 | $criteria = new \CriteriaCompo(); |
||
| 785 | $criteria->add(new \Criteria('columnID', '(' . implode(',', array_unique($columnIDs)) . ')', 'IN')); |
||
| 786 | if (isset($sortname) && '' !== trim($sortname)) { |
||
| 787 | $criteria->setSort($sortname); |
||
| 788 | } |
||
| 789 | if (isset($sortorder) && '' !== trim($sortorder)) { |
||
| 790 | $criteria->setOrder($sortorder); |
||
| 791 | } |
||
| 792 | $criteria->setLimit((int)$limit); |
||
| 793 | $criteria->setStart((int)$start); |
||
| 794 | $sbcolumns_arr = $this->getColumns($criteria, true); |
||
| 795 | unset($criteria); |
||
| 796 | if (empty($sbcolumns_arr) || 0 === count($sbcolumns_arr)) { |
||
| 797 | return $ret; |
||
| 798 | } |
||
| 799 | if ($asobject) { |
||
| 800 | $ret = $sbcolumns_arr; |
||
| 801 | } else { |
||
| 802 | foreach ($sbcolumns_arr as $key => $sbcolumns) { |
||
| 803 | $ret[] = $key; |
||
| 804 | } |
||
| 805 | } |
||
| 806 | |||
| 807 | return $ret; |
||
| 808 | } |
||
| 809 | |||
| 810 | /** |
||
| 811 | * count Votedata belonging to a articleID |
||
| 812 | * |
||
| 813 | * @param int $articleID ID of the group |
||
| 814 | * @return int |
||
| 815 | */ |
||
| 816 | public function getVotedataCountByArticleID($articleID) |
||
| 817 | { |
||
| 818 | $criteria = new \CriteriaCompo(); |
||
| 819 | $criteria->add(new \Criteria('lid', $articleID)); |
||
| 820 | |||
| 821 | return $this->getVotedataCount($criteria); |
||
| 822 | } |
||
| 823 | |||
| 824 | /** |
||
| 825 | * count Article belonging to a columnID |
||
| 826 | * |
||
| 827 | * @param $columnID |
||
| 828 | * @return int |
||
| 829 | * @internal param int $articleID ID of the group |
||
| 830 | */ |
||
| 831 | public function getArticleCountByColumnID($columnID) |
||
| 832 | { |
||
| 833 | $criteria = new \CriteriaCompo(); |
||
| 834 | $criteria->add(new \Criteria('columnID', $columnID)); |
||
| 835 | |||
| 836 | return $this->getArticleCount($criteria); |
||
| 837 | } |
||
| 838 | |||
| 839 | /** |
||
| 840 | * update count up hit's counter of sbarticles obects ,with author user check |
||
| 841 | * |
||
| 842 | * @param Articles $sbarticle reference to the {@link Articles} object |
||
| 843 | * @param bool $force |
||
| 844 | * @return bool FALSE if failed, TRUE |
||
| 845 | */ |
||
| 846 | public function getUpArticlecount(Articles $sbarticle, $force = false) |
||
| 847 | { |
||
| 848 | global $xoopsUser; |
||
| 849 | /** @var Soapbox\Helper $helper */ |
||
| 850 | $helper = Soapbox\Helper::getInstance(); |
||
| 851 | |||
| 852 | if (mb_strtolower(get_class($sbarticle)) !== mb_strtolower(Articles::class)) { |
||
| 853 | return false; |
||
| 854 | } |
||
| 855 | $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
||
| 856 | //update count |
||
| 857 | $hitcount_update = false; |
||
| 858 | if (XOOPS_GROUP_ANONYMOUS === $groups) { |
||
| 859 | $hitcount_update = true; |
||
| 860 | } else { |
||
| 861 | if (1 === $helper->getConfig('adminhits')) { |
||
| 862 | $hitcount_update = true; |
||
| 863 | } else { |
||
| 864 | if ($xoopsUser->isAdmin($this->moduleId)) { |
||
| 865 | $hitcount_update = false; |
||
| 866 | } else { |
||
| 867 | $hitcount_update = false; |
||
| 868 | if ($sbarticle->getVar('uid') !== $xoopsUser->uid()) { |
||
| 869 | $hitcount_update = true; |
||
| 870 | } |
||
| 871 | } |
||
| 872 | } |
||
| 873 | } |
||
| 874 | if ($hitcount_update) { |
||
| 875 | $hitcount = $sbarticle->getVar('counter') + 1; |
||
| 876 | |||
| 877 | return $this->sbArticleHandler->updateByField($sbarticle, 'counter', $hitcount, $force); |
||
| 878 | } |
||
| 879 | |||
| 880 | return false; |
||
| 881 | } |
||
| 882 | |||
| 883 | /** |
||
| 884 | * get edit icon display html layout for admin or author |
||
| 885 | * |
||
| 886 | * @param Articles $sbarticle reference to the {@link Articles} object |
||
| 887 | * @param $sbcolumns |
||
| 888 | * @return string (html tags) |
||
| 889 | */ |
||
| 890 | public function getadminlinks(Articles $sbarticle, &$sbcolumns) |
||
| 891 | { |
||
| 892 | global $xoopsUser, $xoopsModule; |
||
| 893 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||
| 894 | $myts = \MyTextSanitizer:: getInstance(); |
||
| 895 | // Functional links |
||
| 896 | $ret = ''; |
||
| 897 | if (is_object($xoopsUser)) { |
||
| 898 | if ($xoopsUser->isAdmin($this->moduleId)) { |
||
| 899 | if (0 !== $sbarticle->getVar('submit')) { |
||
| 900 | $ret = '<a href="' |
||
| 901 | . XOOPS_URL |
||
| 902 | . '/modules/' |
||
| 903 | . $this->moduleDirName |
||
| 904 | . '/admin/submissions.php?op=mod&articleID=' |
||
| 905 | . $sbarticle->getVar('articleID') |
||
| 906 | . '" target="_blank">' |
||
| 907 | . "<img src='" |
||
| 908 | . $pathIcon16 |
||
| 909 | . "/edit.png' border=\"0\" alt=\"" |
||
| 910 | . _MD_SOAPBOX_EDITART |
||
| 911 | . '" width="16" height="16">' |
||
| 912 | . '</a> '; |
||
| 913 | } else { |
||
| 914 | $ret = '<a href="' |
||
| 915 | . XOOPS_URL |
||
| 916 | . '/modules/' |
||
| 917 | . $this->moduleDirName |
||
| 918 | . '/admin/article.php?op=mod&articleID=' |
||
| 919 | . $sbarticle->getVar('articleID') |
||
| 920 | . '" target="_blank">' |
||
| 921 | . "<img src='" |
||
| 922 | . $pathIcon16 |
||
| 923 | . "/edit.png' border=\"0\" alt=\"" |
||
| 924 | . _MD_SOAPBOX_EDITART |
||
| 925 | . '" width="16" height="16">' |
||
| 926 | . '</a> '; |
||
| 927 | } |
||
| 928 | $ret .= '<a href="' |
||
| 929 | . XOOPS_URL |
||
| 930 | . '/modules/' |
||
| 931 | . $this->moduleDirName |
||
| 932 | . '/admin/article.php?op=del&articleID=' |
||
| 933 | . $sbarticle->getVar('articleID') |
||
| 934 | . '" target="_blank">' |
||
| 935 | . "<img src='" |
||
| 936 | . $pathIcon16 |
||
| 937 | . "/delete.png' border=\"0\" alt=\"" |
||
| 938 | . _MD_SOAPBOX_DELART |
||
| 939 | . '" width="16" height="16">' |
||
| 940 | . '</a> '; |
||
| 941 | } elseif ($xoopsUser->uid() === $sbcolumns->getVar('author')) { |
||
| 942 | $ret = '<a href="' |
||
| 943 | . XOOPS_URL |
||
| 944 | . '/modules/' |
||
| 945 | . $this->moduleDirName |
||
| 946 | . '/submit.php?op=edit&articleID=' |
||
| 947 | . $sbarticle->getVar('articleID') |
||
| 948 | . '" target="_blank">' |
||
| 949 | . "<img src='" |
||
| 950 | . $pathIcon16 |
||
| 951 | . "/edit.png' border=\"0\" alt=\"" |
||
| 952 | . _MD_SOAPBOX_EDITART |
||
| 953 | . '" width="16" height="16">' |
||
| 954 | . '</a> '; |
||
| 955 | } else { |
||
| 956 | $ret = ''; |
||
| 957 | } |
||
| 958 | } |
||
| 959 | |||
| 960 | return $ret; |
||
| 961 | } |
||
| 962 | |||
| 963 | /** |
||
| 964 | * get print ,mail icon html layout for guest or nomal user |
||
| 965 | * |
||
| 966 | * @param Articles $sbarticle reference to the {@link Articles} object |
||
| 967 | * @return string (html tags) |
||
| 968 | */ |
||
| 969 | public function getuserlinks(Articles $sbarticle) |
||
| 970 | { |
||
| 971 | global $xoopsConfig, $xoopsModule; |
||
| 972 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||
| 973 | |||
| 974 | $myts = \MyTextSanitizer:: getInstance(); |
||
| 975 | // Functional links |
||
| 976 | $ret = ''; |
||
| 977 | $mbmail_subject = sprintf(_MD_SOAPBOX_INTART, $xoopsConfig['sitename']); |
||
| 978 | $mbmail_body = sprintf(_MD_SOAPBOX_INTARTFOUND, $xoopsConfig['sitename']); |
||
| 979 | $al = Soapbox\Utility::getAcceptLang(); |
||
| 980 | if ('ja' === $al) { |
||
| 981 | if (function_exists('mb_convert_encoding') && function_exists('mb_encode_mimeheader') |
||
| 982 | && @mb_internal_encoding(_CHARSET)) { |
||
| 983 | $mbmail_subject = mb_convert_encoding($mbmail_subject, 'SJIS', _CHARSET); |
||
| 984 | $mbmail_body = mb_convert_encoding($mbmail_body, 'SJIS', _CHARSET); |
||
| 985 | } |
||
| 986 | } |
||
| 987 | $mbmail_subject = rawurlencode($mbmail_subject); |
||
| 988 | $mbmail_body = rawurlencode($mbmail_body); |
||
| 989 | $ret = '<a href="' |
||
| 990 | . XOOPS_URL |
||
| 991 | . '/modules/' |
||
| 992 | . $this->moduleDirName |
||
| 993 | . '/print.php?articleID=' |
||
| 994 | . $sbarticle->getVar('articleID') |
||
| 995 | . '" target="_blank">' |
||
| 996 | . "<img src='" |
||
| 997 | . $pathIcon16 |
||
| 998 | . "/printer.png' border=\"0\" alt=\"" |
||
| 999 | . _MD_SOAPBOX_PRINTART |
||
| 1000 | . '" width="16" height="16">' |
||
| 1001 | . '</a> ' |
||
| 1002 | . '<a href="mailto:?subject=' |
||
| 1003 | . $myts->htmlSpecialChars($mbmail_subject) |
||
| 1004 | . '&body=' |
||
| 1005 | . $myts->htmlSpecialChars($mbmail_body) |
||
| 1006 | . ': ' |
||
| 1007 | . XOOPS_URL |
||
| 1008 | . '/modules/' |
||
| 1009 | . $this->moduleDirName |
||
| 1010 | . '/article.php?articleID=' |
||
| 1011 | . $sbarticle->getVar('articleID') |
||
| 1012 | . ' " target="_blank">' |
||
| 1013 | . "<img src='" |
||
| 1014 | . $pathIcon16 |
||
| 1015 | . "/mail_forward.png' border=\"0\" alt=\"" |
||
| 1016 | . _MD_SOAPBOX_SENDTOFRIEND |
||
| 1017 | . '" width="16" height="16">' |
||
| 1018 | . '</a> '; |
||
| 1019 | |||
| 1020 | return $ret; |
||
| 1021 | } |
||
| 1022 | } |
||
| 1023 |