mambax7/waiting

View on GitHub
plugins/xfsection.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php declare(strict_types=1);
//
// xf-section ext waiting plugin
// author: Mel Bezos <xoops@bezos.cc, www.bezoops.net> 14-Oct-2005
//
/**
 * @return array
 */
function b_waiting_xfsection()
{
    /** @var \XoopsMySQLDatabase $xoopsDB */
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
    $ret     = [];

    // xf-section articles - waiting
    $block  = [];
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xfs_article') . ' WHERE published=0');
    if ($result) {
        $block['adminlink'] = XOOPS_URL . '/modules/xfsection/admin/allarticles.php?action=submitted';
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
    }
    $ret[] = $block;

    // xf-section articles - attach broken
    $block  = [];
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('xfs_broken') . '');
    if ($result) {
        $block['adminlink'] = XOOPS_URL . '/modules/xfsection/admin/brokendown.php?op=listBrokenDownloads';
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
        $block['lang_linkname'] = _PI_WAITING_FILES . '&nbsp;' . _PI_WAITING_BROKENS;
    }
    $ret[] = $block;

    return $ret;
}