Completed
Push — master ( 692213...d4ec0d )
by Goffy
03:18 queued 01:37
created
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
 *  - A Project by Developers TEAM For Xoops - ( http://www.xoops.org )
5
 * ****************************************************************************
6
 *  XNEWSLETTER - MODULE FOR XOOPS
7
 *  Copyright (c) 2007 - 2012
8
 *  Goffy ( wedega.com )
9
 *
10
 *  You may not change or alter any portion of this comment or credits
11
 *  of supporting developers from this source code or any supporting
12
 *  source code which is considered copyrighted (c) material of the
13
 *  original comment or credit authors.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU General Public License for more details.
19
 *  ---------------------------------------------------------------------------
20
 *  @copyright  Goffy ( wedega.com )
21
 *  @license    GPL 2.0
22
 *  @package    xnewsletter
23
 *  @author     Goffy ( [email protected] )
24
 *
25
 *  Version : $Id $
26
 * ****************************************************************************
27
 */
28
29
$currentFile = basename(__FILE__);
30
include_once "header.php";
31
32
echo "<br/>start cron job<br/>";
33
34
require_once XOOPS_ROOT_PATH . "/modules/xnewsletter/include/task.inc.php";
35
$result_exec = xnewsletter_executeTasks($xnewsletter->getConfig('xn_send_in_packages'), 0);
36
37
if ($result_exec != '') {
38
    //you can enable the block for creating protocol for cron
39
    $protocolObj = $xnewsletter->getHandler('protocol')->create();
40
    $protocolObj->setVar("protocol_letter_id", "0");
41
    $protocolObj->setVar("protocol_subscriber_id", "0");
42
    $protocolObj->setVar("protocol_status", "Cron: ".$result_exec);
43
    $protocolObj->setVar("protocol_success", "1");
44
    $protocolObj->setVar("protocol_submitter", "0");
45
    $protocolObj->setVar("protocol_created", time());
46
47
    if ($xnewsletter->getHandler('protocol')->insert($protocolObj)) {
0 ignored issues
show
This if statement is empty and can be removed.

This check looks for the bodies of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These if bodies can be removed. If you have an empty if but statements in the else branch, consider inverting the condition.

if (rand(1, 6) > 3) {
//print "Check failed";
} else {
    print "Check succeeded";
}

could be turned into

if (rand(1, 6) <= 3) {
    print "Check succeeded";
}

This is much more concise to read.

Loading history...
48
        //create protocol is ok
49
    } else {
50
        echo $protocolObj->getHtmlErrors();
51
    }
52
}
53
echo "<br/>result cron: {$result_exec}";
54