<?php
/************************************************************************/
/* 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");
}

    incoh();
    menunews();
    if ( $wysiwyg == 'fck' ) {
      include_once('FCKeditor/fckeditor.php');
    }
    if (is_file('kernel/tabs/tabwindow.php')) {
    include_once 'kernel/tabs/tabwindow.php';
    }
    $today = getdate();
    $tday = $today['mday'];
    if ($tday < 10){ $tday = "0$tday"; }
    $tmonth = $today['month'];
    $ttmon = $today['mon'];
    if ($ttmon < 10){ $ttmon = "0$ttmon"; }
    $tyear = $today['year'];
    $thour = $today['hours'];
    if ($thour < 10){ $thour = "0$thour"; }
    $tmin = $today['minutes'];
    if ($tmin < 10){ $tmin = "0$tmin"; }
    $tsec = $today['seconds'];
    if ($tsec < 10){ $tsec = "0$tsec"; }
    $date = "$tmonth $tday, $tyear @ $thour:$tmin:$tsec";
    $currentTabs=new Tabs('news1');
    $currentTabs->StartTabWindow();
    $currentTabs->AddTab('News');
    //Max_OpenTable();

    echo "<center><font class=\"option\"><b>"._ADDARTICLE."</b></font></center><br />"
            ."<form action=\"".$admin_file.".php\" method=\"post\">"
        ."<b>"._TITLE."</b><br />"
        ."<input type=\"text\" name=\"subject\" size=\"80\"><br /><br />"
        ."<b>"._TOPIC."</b> ";
    $toplist = $db->sql_query("select topicid, topictext from ".TABLE_TOPICS." order by topictext");
    echo "<select name=\"topic\">";
    echo "<option value=\"\">"._SELECTTOPIC."</option>\n";
    while(list($topicid, $topics) = $db->sql_fetchrow($toplist)) {
            $topicid = $db->XMFnum($topicid);
        if ($topicid == $topic) {
            $sel = "selected ";
        }
            echo "<option $sel value=\"$topicid\">$topics</option>\n";
        $sel = "";
    }
    echo "</select>";
    br('2');
    // Copyright (c) 2000-2005 by NukeScripts Network
    if($Version_Num >= 6.6) {
        echo "<table border='0' width='100%' cellspacing='0'><tr><td width='20%'><b>"._ASSOTOPIC."</b></td><td width='100%'>"
            ."<table border='1' cellspacing='3' cellpadding='8'><tr>";
        $sql = "SELECT topicid, topictext FROM ".TABLE_TOPICS." ORDER BY topictext";
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            if ($a == 3) {
                echo "</tr><tr>";
                $a = 0;
            }
            echo "<td><input type='checkbox' name='assotop[]' value='$row[topicid]'>$row[topictext]</td>";
            $a++;
        }
        echo "</tr></table></td></tr></table>";
	br('2');
    }
    // Copyright (c) 2000-2005 by NukeScripts Network
    $cat = 0;
    SelectCategory($cat);
    br('1');
    puthome($ihome, $acomm);
    if ($multilingual == 1) {
        echo "<br /><b>"._LANGUAGE.": </b>"
            ."<select name=\"alanguage\">";
        $handle=opendir('language');
        while ($file = readdir($handle)) {
            if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
                $langFound = $matches[1];
                $languageslist .= "$langFound ";
            }
        }
        closedir($handle);
        $languageslist = explode(" ", $languageslist);
        sort($languageslist);
        for ($i=0; $i < sizeof($languageslist); $i++) {
            if($languageslist[$i]!="") {
                echo "<option value=\"$languageslist[$i]\" ";
                if($languageslist[$i]==$language) echo "selected";
                echo ">".ucfirst($languageslist[$i])."</option>\n";
            }
        }
        echo "<option value=\"\">"._ALL."</option></select>";
    } else {
        echo "<input type=\"hidden\" name=\"alanguage\" value=\"$language\">";
    }
    br('2');
    echo "<b>"._STORYTEXT."</b><br />";
if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(hometext) ;
$oFCKeditor->InstanceName = "hometext" ;
$oFCKeditor->Create() ;
} else {
     echo "<textarea wrap=\"virtual\" cols=\"100\" rows=\"30\" name=\"hometext\"></textarea><br /><br />";
}
  echo "<b>"._EXTENDEDTEXT."</b><br />";
if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(bodytext) ;
$oFCKeditor->InstanceName = "bodytext" ;
$oFCKeditor->Create() ;
} else {
        echo "<textarea wrap=\"virtual\" cols=\"100\" rows=\"30\" name=\"bodytext\"></textarea><br />";
}
		echo"<font class=\"content\">"._ARESUREURL."</font>"
        ."<br /><br /><b>"._PROGRAMSTORY."</b>&nbsp;&nbsp;"
        ."<input type='radio' name='automated' value='1'>"._YES." &nbsp;&nbsp;"
        ."<input type='radio' name='automated' value='0' checked>"._NO."<br /><br />"
        .""._NOWIS.": $date<br /><br />";
    $day = 1;
    echo ""._DAY.": <select name=\"day\">";
    while ($day <= 31) {
        if ($tday==$day) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        echo "<option name=\"day\" $sel>$day</option>";
        $day++;
    }
    echo "</select>";
    $month = 1;
    echo ""._UMONTH.": <select name=\"month\">";
    while ($month <= 12) {
        if ($ttmon==$month) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        echo "<option name=\"month\" $sel>$month</option>";
        $month++;
    }
    echo "</select>";
    $date = getdate();
    $year = $date['year'];
    echo ""._YEAR.": <input type=\"text\" name=\"year\" value=\"$year\" size=\"5\" maxlength=\"4\">"
        ."<br />"._HOUR.": <select name=\"hour\">";
    $hour = 0;
    $cero = "0";
    while ($hour <= 23) {
        $dummy = $hour;
        if ($hour < 10) {
            $hour = "$cero$hour";
        }
        echo "<option name=\"hour\">$hour</option>";
        $hour = $dummy;
        $hour++;
    }
    echo "</select>"
        .": <select name=\"min\">";
    $min = 0;
    while ($min <= 59) {
        if (($min == 0) OR ($min == 5)) {
            $min = "0$min";
        }
        echo "<option name=\"min\">$min</option>";
        $min = $min + 5;
    }
    echo "</select>";
    echo ": 00<br /><br />"
        ."<select name=\"op\">"
        ."<option value=\"PreviewAdminStory\" selected>"._PREVIEWSTORY."</option>"
        ."<option value=\"PostAdminStory\">"._POSTSTORY."</option>"
        ."</select>"
        ."<input type=\"submit\" value=\""._OK."\">";
   // Max_CloseTable();
    $currentTabs->AddTab("Survey");
    br('1');
    putpoll($pollTitle, $optionText);
    echo "</form>";
    $currentTabs->EndTabWindow();
    incof();