Exemplo n.º 1
0
//init
if ($privs == 9) {
    //admin
    if (isset($_POST['uploadFile'])) {
        $msg = processUpload();
    }
    if (isset($_POST['uploadFile']) and !$msg or isset($_POST['addEvents'])) {
        $errors = processEvtFields($_POST['sDate'], $_POST['eDate'], $_POST['sTime'], $_POST['eTime'], $_POST['title'], $_POST['catID']);
    }
    if (isset($_POST['addEvents']) and !$errors) {
        $msg = addEvents();
        //add events to calendar
    }
    echo "<p class='error'>{$msg}</p>\n";
    echo "<div class='scrollBoxAd'>\n";
    if (!isset($_POST['uploadFile']) and !isset($_POST['addEvents']) or isset($_POST['uploadFile']) and $msg) {
        instructions();
    }
    echo "<div class='centerBox'>\n";
    if (!isset($_POST['uploadFile']) and !isset($_POST['addEvents']) or isset($_POST['uploadFile']) and $msg) {
        uploadFile();
    } elseif (!isset($_POST['addEvents']) or $errors) {
        displayEvents($errors);
        //file uploaded or errors, display events
    } else {
        echo "<button type='button' onclick=\"window.location.href='index.php?lc&amp;cP=96'\">{$ax['back']}</button>\n";
    }
    echo "</div>\n</div>\n";
} else {
    echo "<p class='error'>{$ax['no_way']}</p>\n";
}
Exemplo n.º 2
0
function searchMailEvents()
{
    global $oAdminButton;
    xoops_cp_header();
    echo $oAdminButton->renderButtons('mailEvents');
    if (!isset($_POST['searchEvents'])) {
        $stylePath = (include_once XHELP_INCLUDE_PATH . '/calendar/calendarjs.php');
        echo '<link rel="stylesheet" type="text/css" media="all" href="' . $stylePath . '" /><!--[if gte IE 5.5000]><script src="iepngfix.js" language="JavaScript" type="text/javascript"></script><![endif]-->';
        echo "<form method='post' action='" . XHELP_ADMIN_URL . "/index.php?op=searchMailEvents'>";
        echo "<table width='100%' cellspacing='1' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_XHELP_SEARCH_EVENTS . "</th></tr>";
        echo "<tr><td width='20%' class='head'>" . _AM_XHELP_TEXT_MAILBOX . "</td>\r\n                  <td class='even'><input type='text' size='55' name='email' class='formButton'></td></tr>";
        echo "<tr><td class='head'>" . _AM_XHELP_TEXT_DESCRIPTION . "</td>\r\n                  <td class='even'><input type='text' size='55' name='description' class='formButton'></td></tr>";
        echo "<tr><td class='head'>" . _AM_XHELP_SEARCH_BEGINEGINDATE . "</td>\r\n                  <td class='even'><input type='text' name='begin_date' id='begin_date' size='10' maxlength='10' value='" . formatTimestamp(time(), 'mysql') . "' />\r\n                                  <a href='' onclick='return showCalendar(\"begin_date\");'><img src='" . XHELP_IMAGE_URL . "/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent' /></a>&nbsp;";
        xhelpDrawHourSelect("begin_hour", 12);
        xhelpDrawMinuteSelect("begin_minute");
        xhelpDrawModeSelect("begin_mode");
        echo "<tr><td class='head'>" . _AM_XHELP_SEARCH_ENDDATE . "</td>\r\n                  <td class='even'><input type='text' name='end_date' id='end_date' size='10' maxlength='10' value='" . formatTimestamp(time(), 'mysql') . "' />\r\n                                  <a href='' onclick='return showCalendar(\"end_date\");'><img src='" . XHELP_IMAGE_URL . "/calendar.png' alt='Calendar image' name='calendar' style='vertical-align:bottom;border:0;background:transparent' /></a>&nbsp;";
        xhelpDrawHourSelect("end_hour", 12);
        xhelpDrawMinuteSelect("end_minute");
        xhelpDrawModeSelect("end_mode");
        echo "<tr><td class='foot' colspan='2'><input type='submit' name='searchEvents' value='" . _AM_XHELP_BUTTON_SEARCH . "' /></td></tr>";
        echo "</table>";
        echo "</form>";
        xhelpAdminFooter();
        xoops_cp_footer();
    } else {
        $hMailEvent =& xhelpGetHandler('mailEvent');
        $hDeptMbox =& xhelpGetHandler('departmentMailBox');
        $mailboxes =& $hDeptMbox->getObjects(null, true);
        $begin_date = explode('-', $_POST['begin_date']);
        $end_date = explode('-', $_POST['end_date']);
        $begin_hour = xhelpChangeHour($_POST['begin_mode'], $_POST['begin_hour']);
        $end_hour = xhelpChangeHour($_POST['end_mode'], $_POST['end_hour']);
        // Get timestamps to search by
        $begin_time = mktime($begin_hour, $_POST['begin_minute'], 0, $begin_date[1], $begin_date[2], $begin_date[0]);
        $end_time = mktime($end_hour, $_POST['end_minute'], 0, $end_date[1], $end_date[2], $end_date[0]);
        $crit = new CriteriaCompo(new Criteria('posted', $begin_time, '>='));
        $crit->add(new Criteria('posted', $end_time, '<='));
        if ($_POST['email'] != '') {
            $email = $_POST['email'];
            $crit->add(new Criteria('emailaddress', "%{$email}%", "LIKE", "d"));
        }
        if ($_POST['description'] != '') {
            $description = $_POST['description'];
            $crit->add(new Criteria('event_desc', "%{$description}%", "LIKE"));
        }
        $crit->setOrder('DESC');
        $crit->setSort('posted');
        if (isset($email)) {
            $mailEvents =& $hMailEvent->getObjectsJoin($crit);
        } else {
            $mailEvents =& $hMailEvent->getObjects($crit);
        }
        displayEvents($mailEvents, $mailboxes);
        xhelpAdminFooter();
        xoops_cp_footer();
    }
}
Exemplo n.º 3
0
function generateCalendar($range, $events, $class)
{
    for ($k = -$range / 2; $k < 1 + $range / 2; $k++) {
        $date = strtotime($k . ' months');
        $strdate = explode("-", date('m-Y', $date));
        $days = daysInMonth($date);
        $decalage = date('w', strtotime($strdate[1] . "-" . $strdate[0] . "-01")) == "0" ? 6 : date('w', strtotime($strdate[1] . "-" . $strdate[0] . "-01")) - 1;
        $taille = ceil(($decalage + $days) / 7) * 7;
        $day = 1;
        ?>
    <div class="cal <?php 
        echo $class;
        ?>
" id="<?php 
        echo ltrim($strdate[0], 0);
        ?>
">
      <h2><?php 
        echo ucfirst(strftime('%B', $date));
        ?>
 <?php 
        echo $strdate[1];
        ?>
</h2>
      <button class="nav" id="next" onclick="changeCal(1)">〉</button>
      <button class="nav" id="previous" onclick="changeCal(-1)">〈</button>
      <table>
        <thead>
          <tr>
            <td><?php 
        lang('Lundi');
        ?>
</td>
            <td><?php 
        lang('Mardi');
        ?>
</td>
            <td><?php 
        lang('Mercredi');
        ?>
</td>
            <td><?php 
        lang('Jeudi');
        ?>
</td>
            <td><?php 
        lang('Vendredi');
        ?>
</td>
            <td><?php 
        lang('Samedi');
        ?>
</td>
            <td><?php 
        lang('Dimanche');
        ?>
</td>
          </tr>
        </thead>
        <tr>
      <?php 
        for ($i = 0; $i < $taille; $i++) {
            ?>
        <?php 
            if (date('Ymd') == date('Ym', $date) . sprintf('%02d', $day)) {
                $today = "today";
            } else {
                $today = "";
            }
            ?>
        <?php 
            if ($i % 7 == 0 && $i != $taille) {
                ?>
        </tr>
        <tr>
        <?php 
            }
            ?>
        <?php 
            if ($i < $decalage || $i > $days + $decalage - 1) {
                ?>
          <td class="disabled">
          </td>
        <?php 
            } else {
                ?>
          <td>
            <h2 class="<?php 
                echo $today;
                ?>
"><?php 
                echo $i < $days + $decalage + 1 ? $day : null;
                ?>
</h2>
            <div class="event-list">
              <?php 
                displayEvents($day, $strdate, $events);
                ?>
            </div>
            <?php 
                displayModals($day, $strdate, $events);
                ?>
          </td>
          <?php 
                $day++;
                ?>
        <?php 
            }
            ?>
      <?php 
        }
        ?>
        </tr>
      </table>
    </div>
    <?php 
        // echo $taille."<br>";
        // echo $decalage."<br>";
        // echo "mois: ".$strdate[0]."<br>";
        // echo "année: ".$strdate[1]."<br><br>";
    }
}
Exemplo n.º 4
0
function displayHillclimbInfo()
{
    // Display Info
    echo "<table class=\"default\" width=\"100%\">\n";
    echo "<tr><th>Hillclimb Info:</th></tr>\n";
    echo "<tr><td>\n";
    echo file_get_contents("html/hillclimbinfo.html");
    echo "</td></tr>\n";
    echo "</table>\n";
}
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
////////////BEGIN SCRIPT EXECUTION BELOW//////////////////////
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
if (!isSSL()) {
    header("Location: logout.php");
} else {
    validateSession();
    $query = "SELECT * FROM users WHERE sha256_user = '******'ID') . "'";
    $check = mysql_query($query) or die(mysql_error());
    $info = mysql_fetch_array($check);
    echoFrameHeader();
    //  displayHillclimbInfo();
    //  displayAutoXInfo();
    echo "<br /><br />";
    displayEvents($info);
    echoFrameFooter();
    die;
    // attempt to guard against any code insertion at the end of the file
}
function searchAdEventsByCategory()
{
    $eventCode = $_POST['eventCode'];
    $eventName = $_POST['name'];
    $startDateUnformatted = $_POST['startDate'];
    $endDateUnformatted = $_POST['endDate'];
    $description = $_POST['description'];
    $eventType = $_POST['eventType'];
    $temp = "";
    $startDates = explode("/", $startDateUnformatted);
    //[10], [28], [2015]
    $startDatesReversed = array_reverse($startDates);
    //[2015], [28], [10]
    $temp = $startDatesReversed[1];
    //[2015], [28], [10] t:[28]
    $startDatesReversed[1] = $startDatesReversed[2];
    //[2015], [10], [10] t:[28]
    $startDatesReversed[2] = $temp;
    //[2015], [10], [28]
    $startDate = implode("-", $startDatesReversed);
    //2015-10-28
    $endDates = explode("/", $endDateUnformatted);
    $endDatesReversed = array_reverse($endDates);
    $temp = $endDatesReversed[1];
    $endDatesReversed[1] = $endDatesReversed[2];
    $endDatesReversed[2] = $temp;
    $endDate = implode("-", $endDatesReversed);
    $cond1 = "";
    $cond2 = "";
    $cond3 = "";
    $cond4 = "";
    $cond5 = "";
    $cond6 = "";
    $whereCondition = "";
    if (isset($eventCode) && $eventCode != "") {
        $cond1 = "EventCode LIKE '%" . $eventCode . "%'";
    }
    if (isset($description) && $description != "") {
        $cond2 = "Description LIKE '%" . $description . "%'";
    }
    if (isset($eventName) && $eventName != "") {
        $cond3 = "Name LIKE '%" . $eventName . "%'";
    }
    if (isset($startDate) && $startDate != "--") {
        $cond4 = "StartDate = '" . $startDate . "'";
    }
    if (isset($endDate) && $endDate != "--") {
        $cond5 = "EndDate = '" . $endDate . "'";
    }
    if (isset($eventType) && $eventType != "---") {
        $cond6 = "AdType = '" . $eventType . "'";
    }
    if ($cond1 != "") {
        $whereCondition = $whereCondition . $cond1;
    }
    if ($cond2 != "") {
        if (strlen($whereCondition) > 1) {
            $whereCondition = $whereCondition . " AND " . $cond2;
        } else {
            $whereCondition = $whereCondition . $cond2;
        }
    }
    if ($cond3 != "") {
        if (strlen($whereCondition) > 1) {
            $whereCondition = $whereCondition . " AND " . $cond3;
        } else {
            $whereCondition = $whereCondition . $cond3;
        }
    }
    if ($cond4 != "") {
        if (strlen($whereCondition) > 1) {
            $whereCondition = $whereCondition . " AND " . $cond4;
        } else {
            $whereCondition = $whereCondition . $cond4;
        }
    }
    if ($cond5 != "") {
        if (strlen($whereCondition) > 1) {
            $whereCondition = $whereCondition . " AND " . $cond5;
        } else {
            $whereCondition = $whereCondition . $cond5;
        }
    }
    if ($cond6 != "") {
        if (strlen($whereCondition) > 1) {
            $whereCondition = $whereCondition . " AND " . $cond6;
        } else {
            $whereCondition = $whereCondition . $cond6;
        }
    }
    $ad_event_search_sql = "SELECT * FROM AdEvent WHERE {$whereCondition}";
    $eventResult = mysql_query($ad_event_search_sql);
    //Test whether the queries were successful
    if (!$eventResult) {
        $event_search_message = "The retrieval of ad events was unsuccessful: ";
    }
    $number_event_rows = mysql_num_rows($eventResult);
    // Check if results turned out empty
    $event_search_message = "";
    if ($number_event_rows == 0) {
        $event_search_message = "No ad events found in database";
    }
    //Display the results
    displayEvents($event_search_message, $eventResult);
    //Free the result sets
    mysql_free_result($eventResult);
}