Example #1
0
function automatednews()
{
    global $gmt;
    global $NPDS_Prefix;
    $today = getdate(time() + $gmt * 3600);
    $day = $today['mday'];
    if ($day < 10) {
        $day = "0{$day}";
    }
    $month = $today['mon'];
    if ($month < 10) {
        $month = "0{$month}";
    }
    $year = $today['year'];
    $hour = $today['hours'];
    $min = $today['minutes'];
    $result = sql_query("select anid, date_debval from " . $NPDS_Prefix . "autonews where date_debval like '{$year}-{$month}%'");
    while (list($anid, $date_debval) = sql_fetch_row($result)) {
        preg_match('#^(\\d{4})-(\\d{1,2})-(\\d{1,2}) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})$#', $date_debval, $date);
        if ($date[1] <= $year and $date[2] <= $month and $date[3] <= $day) {
            if ($date[4] < $hour and $date[5] >= $min or $date[4] <= $hour and $date[5] <= $min or $day - $date[3] >= 1) {
                $result2 = sql_query("select catid, aid, title, hometext, bodytext, topic, informant, notes, ihome, date_finval, auto_epur from " . $NPDS_Prefix . "autonews where anid='{$anid}'");
                while (list($catid, $aid, $title, $hometext, $bodytext, $topic, $author, $notes, $ihome, $date_finval, $epur) = sql_fetch_row($result2)) {
                    $subject = stripslashes(FixQuotes($title));
                    $hometext = stripslashes(FixQuotes($hometext));
                    $bodytext = stripslashes(FixQuotes($bodytext));
                    $notes = stripslashes(FixQuotes($notes));
                    sql_query("insert into " . $NPDS_Prefix . "stories values (NULL, '{$catid}', '{$aid}', '{$subject}', now(), '{$hometext}', '{$bodytext}', '0', '0', '{$topic}', '{$author}', '{$notes}', '{$ihome}', '0', '{$date_finval}', '{$epur}')");
                    sql_query("delete from " . $NPDS_Prefix . "autonews where anid='{$anid}'");
                    global $subscribe;
                    if ($subscribe) {
                        subscribe_mail("topic", $topic, "", $subject, "");
                    }
                    // Réseaux sociaux
                    if (file_exists('modules/npds_twi/npds_to_twi.php')) {
                        include 'modules/npds_twi/npds_to_twi.php';
                    }
                    if (file_exists('modules/npds_fbk/npds_to_fbk.php')) {
                        include 'modules/npds_twi/npds_to_fbk.php';
                    }
                    // Réseaux sociaux
                }
            }
        }
    }
    // Purge automatique
    $result = sql_query("select sid, date_finval, auto_epur from " . $NPDS_Prefix . "stories where date_finval like '{$year}-{$month}%'");
    while (list($sid, $date_finval, $epur) = sql_fetch_row($result)) {
        preg_match('#^(\\d{4})-(\\d{1,2})-(\\d{1,2}) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})$#', $date_finval, $date);
        if ($date[1] <= $year and $date[2] <= $month and $date[3] <= $day) {
            if ($date[4] < $hour and $date[5] >= $min or $date[4] <= $hour and $date[5] <= $min) {
                if ($epur == 1) {
                    sql_query("delete from " . $NPDS_Prefix . "stories where sid='{$sid}'");
                } else {
                    sql_query("update " . $NPDS_Prefix . "stories set archive='1' where sid='{$sid}'");
                }
            }
        }
    }
}
Example #2
0
function postStory($type_pub, $qid, $uid, $author, $subject, $hometext, $bodytext, $topic, $notes, $catid, $ihome, $members, $Mmembers, $date_debval, $date_finval, $epur)
{
    global $NPDS_Prefix;
    global $aid, $ultramode;
    if ($uid == 1) {
        $author = "";
    }
    if ($hometext == $bodytext) {
        $bodytext = "";
    }
    $subject = stripslashes(FixQuotes(str_replace('"', '&quot;', $subject)));
    $hometext = stripslashes(FixQuotes($hometext));
    $bodytext = stripslashes(FixQuotes($bodytext));
    $notes = stripslashes(FixQuotes($notes));
    if ($members == 1 and $Mmembers == "") {
        $ihome = "-127";
    }
    if ($members == 1 and ($Mmembers > 1 and $Mmembers <= 127)) {
        $ihome = $Mmembers;
    }
    if ($type_pub == 'pub_immediate') {
        $result = sql_query("INSERT INTO " . $NPDS_Prefix . "stories VALUES (NULL, '{$catid}', '{$aid}', '{$subject}', now(), '{$hometext}', '{$bodytext}', '0', '0', '{$topic}','{$author}', '{$notes}', '{$ihome}', '0', '{$date_finval}','{$epur}')");
        Ecr_Log("security", "postStory (pub_immediate, {$subject}) by AID : {$aid}", "");
    } else {
        $result = sql_query("INSERT INTO " . $NPDS_Prefix . "autonews VALUES (NULL, '{$catid}', '{$aid}', '{$subject}', now(), '{$hometext}', '{$bodytext}', '{$topic}', '{$author}', '{$notes}', '{$ihome}','{$date_debval}','{$date_finval}','{$epur}')");
        Ecr_Log("security", "postStory (autonews, {$subject}) by AID : {$aid}", "");
    }
    if ($uid != 1 and $uid != '') {
        sql_query("UPDATE " . $NPDS_Prefix . "users SET counter=counter+1 WHERE uid='{$uid}'");
    }
    sql_query("UPDATE " . $NPDS_Prefix . "authors SET counter=counter+1 WHERE aid='{$aid}'");
    if ($ultramode) {
        ultramode();
    }
    deleteStory($qid);
    if ($type_pub == 'pub_immediate') {
        global $subscribe;
        if ($subscribe) {
            subscribe_mail("topic", $topic, '', $subject, '');
        }
        // Cluster Paradise
        if (file_exists("modules/cluster-paradise/cluster-activate.php")) {
            include "modules/cluster-paradise/cluster-activate.php";
        }
        if (file_exists("modules/cluster-paradise/cluster-M.php")) {
            include "modules/cluster-paradise/cluster-M.php";
        }
        // Cluster Paradise
        // Réseaux sociaux
        if (file_exists('modules/npds_twi/npds_to_twi.php')) {
            include 'modules/npds_twi/npds_to_twi.php';
        }
        if (file_exists('modules/npds_fbk/npds_to_fbk.php')) {
            include 'modules/npds_twi/npds_to_fbk.php';
        }
        // Réseaux sociaux
    }
    redirect_url("admin.php?op=submissions");
}
Example #3
0
            $message = $m['uname'] . "\n\n";
            $message .= translate_ml($m['user_langue'], "Vous recevez ce Mail car vous avez demandé à être informé lors de la publication d'une réponse.") . "\n";
            $message .= translate_ml($m['user_langue'], "Pour lire la réponse") . " : ";
            $message .= "<a href=\"{$nuke_url}/viewtopic.php?topic={$topic}&forum={$forum}&start=9999#last-post\">{$nuke_url}/viewtopic.php?topic={$topic}&forum={$forum}&start=9999</a>\n\n";
            include "signat.php";
            if (!$system) {
                send_email($m['email'], $subject, $message, "", true, "html");
                $sauf = $m['uid'];
            }
        }
        global $subscribe;
        if ($subscribe) {
            if (subscribe_query($userdata['uid'], "forum", $forum)) {
                $sauf = $userdata['uid'];
            }
            subscribe_mail("forum", $topic, $forum, "", $sauf);
        }
        if (isset($upload)) {
            include "modules/upload/upload_forum.php";
            win_upload("forum_npds", $IdPost, $forum, $topic, "win");
            redirect_url("viewtopic.php?forum={$forum}&topic={$topic}&start=9999#last-post");
            die;
        }
        redirect_url("viewforum.php?forum={$forum}");
    } else {
        echo '<p class="text-xs-center">' . translate("You must type a message to post.") . '<br /><br />';
        echo "[ <a href=\"javascript:history.go(-1)\" class=\"noir\">" . translate("Go Back") . "</a> ]</p>";
    }
} else {
    include 'header.php';
    if ($allow_bbcode == 1) {
Example #4
0
            $message = $m['uname'] . "\n\n";
            $message .= translate_ml($m['user_langue'], "Vous recevez ce Mail car vous avez demandé à être informé lors de la publication d'une réponse.") . "\n";
            $message .= translate_ml($m['user_langue'], "Pour lire la réponse") . " : ";
            $message .= "<a href=\"{$nuke_url}/viewtopicH.php?topic={$topic}&forum={$forum}\">{$nuke_url}/viewtopicH.php?topic={$topic}&forum={$forum}</a>\n\n";
            include "signat.php";
            if (!$system) {
                send_email($m['email'], $subject, $message, '', true, 'html');
                $sauf = $m['uid'];
            }
        }
        global $subscribe;
        if ($subscribe) {
            if (subscribe_query($userdata['uid'], "forum", $forum)) {
                $sauf = $userdata['uid'];
            }
            subscribe_mail('forum', $topic, $forum, '', $sauf);
        }
        if (isset($upload)) {
            include "modules/upload/upload_forum.php";
            win_upload("forum_npds", $IdPost, $forum, $topic, "win");
        }
        redirect_url("viewtopicH.php?forum={$forum}&topic={$topic}");
    } else {
        opentable();
        echo "<p align=\"center\">" . translate("You must type a message to post.") . "<br /><br />";
        echo "[ <a href=\"javascript:history.go(-1)\" class=\"noir\">" . translate("Go Back") . "</a> ]</p>";
        closetable();
    }
} else {
    include 'header.php';
    if ($allow_bbcode == 1) {
Example #5
0
        $topic_id = sql_last_id();
        $sql = "INSERT INTO " . $NPDS_Prefix . "posts (topic_id, image, forum_id, poster_id, post_text, post_time, poster_ip, poster_dns) VALUES ('{$topic_id}', '{$image_subject}', '{$forum}', '" . $userdata['uid'] . "', '{$message}', '{$time}', '{$poster_ip}', '{$hostname}')";
        if (!($result = sql_query($sql))) {
            forumerror('0020');
        } else {
            $IdPost = sql_last_id();
        }
        $sql = "UPDATE " . $NPDS_Prefix . "users_status SET posts=posts+1 WHERE (uid='" . $userdata['uid'] . "')";
        $result = sql_query($sql);
        if (!$result) {
            forumerror('0029');
        }
        $topic = $topic_id;
        global $subscribe;
        if ($subscribe) {
            subscribe_mail("forum", $topic, stripslashes($forum), stripslashes($Msubject), $userdata['uid']);
        }
        if (isset($upload)) {
            include "modules/upload/upload_forum.php";
            win_upload("forum_npds", $IdPost, $forum, $topic, "win");
        }
        redirect_url($hrefX . "?forum={$forum}&topic={$topic}");
    } else {
        echo '
      <div class="alert alert-danger lead" role="alert">
         <i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;
         ' . translate("You must provide subject and message to post your topic.") . '
      </div>';
    }
} else {
    include 'header.php';