<?php
/**
 * $Source: /home/cvs/nukescripts/News/admin/includes/ChangeStory.php,v $
 * $Revision: 1.1.6 $
 * $Author: cyril $
 * $Date: 2006/08/18 13:53:09 $
 * Bug 137
 */
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
    Header("Location: index.php");
}

    for ($i=0; $i<sizeof($assotop); $i++) { $associated .= "$assotop[$i]-"; }
    $sid = $db->XMFnum($sid);
    $aid = substr("$aid", 0,25);
    $result = $db->sql_query("SELECT `radminsuper` FROM `".TABLE_AUTHORS."` WHERE `aid`='$aid'");
    list($radminsuper) = $db->sql_fetchrow($result);
    $radminsuper = $db->XMFbin($radminsuper);
        $result = $db->sql_query("SELECT `admins` FROM `".TABLE_MODULES."` WHERE `title`='News'");
        $row2 = $db->sql_fetchrow($db->sql_query("SELECT `name` FROM `".TABLE_AUTHORS."` WHERE `aid`='$aid'"));
        while ($row = $db->sql_fetchrow($result)) {
            $admins = explode(",", $row['admins']);
            $auth_user = 0;
            for ($i=0; $i < sizeof($admins); $i++) { if ($row2['name'] == "$admins[$i]") { $auth_user = 1; } }
            if ($auth_user == 1) { $radminarticle = 1; }
        }
    $result2 = $db->sql_query("SELECT `aid` FROM `".TABLE_STORIES."` WHERE `sid`='$sid'");
    list($aaid) = $db->sql_fetchrow($result2);
    $aaid = substr("$aaid", 0,25);
    if (($radminarticle == 1) AND ($aaid == $aid) OR ($radminsuper == 1)) {
        $subject  = stripslashes(FixQuotes($subject));
        $hometext = stripslashes(FixQuotes($hometext));
        $bodytext = stripslashes(FixQuotes($bodytext));
        $notes    = stripslashes(FixQuotes($notes));
        // Copyright (c) 2000-2005 by NukeScripts Network
        $db->sql_query("UPDATE `".TABLE_STORIES."` SET `catid`='$catid', `title`='$subject', `hometext`='$hometext', `bodytext`='$bodytext', `topic`='$topic', `notes`='$notes', `ihome`='$ihome', `alanguage`='$alanguage', `acomm`='$acomm' WHERE `sid`='$sid'");
        $db->sql_query("update `".TABLE_STORIES."` SET `associated`='$associated' WHERE `sid`='$sid'");
        // Copyright (c) 2000-2005 by NukeScripts Network
        if ($ultramode) { ultramode(); }
        redirect_url("".$admin_file.".php?op=homenews");
    }