Completed
Push — master ( 6452b0...d576ea )
by Michael
05:58 queued 03:02
created

blocks/news_bigstory.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
// 
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                  Copyright (c) 2000-2016 XOOPS.org                        //
6
//                       <http://xoops.org/>                             //
7
// ------------------------------------------------------------------------- //
8
//  This program is free software; you can redistribute it and/or modify     //
9
//  it under the terms of the GNU General Public License as published by     //
10
//  the Free Software Foundation; either version 2 of the License, or        //
11
//  (at your option) any later version.                                      //
12
//                                                                           //
13
//  You may not change or alter any portion of this comment or credits       //
14
//  of supporting developers from this source code or any supporting         //
15
//  source code which is considered copyrighted (c) material of the          //
16
//  original comment or credit authors.                                      //
17
//                                                                           //
18
//  This program is distributed in the hope that it will be useful,          //
19
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
//  GNU General Public License for more details.                             //
22
//                                                                           //
23
//  You should have received a copy of the GNU General Public License        //
24
//  along with this program; if not, write to the Free Software              //
25
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
//  ------------------------------------------------------------------------ //
27
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
28
29
/**
30
 * @return array
31
 */
32
function b_news_bigstory_show()
33
{
34
    include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php';
35
    include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
36
    $myts       = MyTextSanitizer::getInstance();
37
    $restricted = news_getmoduleoption('restrictindex');
38
    $dateformat = news_getmoduleoption('dateformat');
39
    $infotips   = news_getmoduleoption('infotips');
40
41
    $block    = array();
42
    $onestory = new NewsStory();
43
    $stories  = $onestory->getBigStory(1, 0, $restricted, 0, 1, true, 'counter');
44
    if (count($stories) == 0) {
45
        $block['message'] = _MB_NEWS_NOTYET;
46
    } else {
47
        foreach ($stories as $key => $story) {
48
            $htmltitle = '';
49 View Code Duplication
            if ($infotips > 0) {
50
                $block['infotips'] = news_make_infotips($story->hometext());
0 ignored issues
show
Are you sure the assignment to $block['infotips'] is correct as news_make_infotips($story->hometext()) (which targets news_make_infotips()) seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
51
                $htmltitle         = ' title="' . $block['infotips'] . '"';
52
            } else {
53
                $htmltitle = ' title="' . $story->title('Show') . '"';
54
            }
55
            $block['htmltitle']         = $htmltitle;
56
            $block['message']           = _MB_NEWS_TMRSI;
57
            $block['story_title']       = $story->title('Show');
58
            $block['story_id']          = $story->storyid();
59
            $block['story_date']        = formatTimestamp($story->published(), $dateformat);
60
            $block['story_hits']        = $story->counter();
61
            $block['story_rating']      = $story->rating();
62
            $block['story_votes']       = $story->votes();
63
            $block['story_author']      = $story->uname();
64
            $block['story_text']        = $story->hometext();
65
            $block['story_topic_title'] = $story->topic_title();
66
            $block['story_topic_color'] = '#' . $myts->displayTarea($story->topic_color);
67
            $block['story_picture']     = XOOPS_URL . '/uploads/news/image/' . $story->picture();
68
            $block['story_pictureinfo'] = $story->pictureinfo();
69
        }
70
    }
71
72
    return $block;
73
}
74
75
/**
76
 * @param $options
77
 */
78 View Code Duplication
function b_news_bigstory_onthefly($options)
79
{
80
    $options = explode('|', $options);
81
    $block   = &b_news_bigstory_show($options);
82
83
    $tpl = new XoopsTpl();
84
    $tpl->assign('block', $block);
85
    $tpl->display('db:news_block_bigstory.tpl');
86
}
87