Example #1
0
 private function show_mails($mails, $column)
 {
     $this->output->open_tag("mailbox", array("column" => $column));
     foreach ($mails as $mail) {
         $mail["subject"] = truncate_text($mail["subject"], 55);
         if ($this->mobile) {
             $mail["timestamp"] = date_string("Y-m-d", $mail["timestamp"]);
         } else {
             $mail["timestamp"] = date_string("l, j F Y H:i:s", $mail["timestamp"]);
         }
         $mail["read"] = $mail["read"] == YES ? "read" : "unread";
         $this->output->record($mail, "mail");
     }
     $this->output->close_tag();
 }
Example #2
0
File: birth.php Project: nqv/eposys
--------------------------------------------------------------------------------
     File:  birth.php

   Module:  HAPPY BIRTHDAY
   Author:  Quoc Viet [aFeLiOn]
    Begin:  2006-04-02

  Comment:
--------------------------------------------------------------------------------
*/
if (!defined('IN_EPS')) {
    exit;
}
$cur_time = time();
$today_str = date_string($cur_time + $eps_user['timezone'], false);
$tomorrow_str = date_string($cur_time + $eps_user['timezone'] + 86400 * 2, false);
@(include EPS_CACHE_DIR . 'cache_birth.php');
if (empty($eps_births) || !isset($eps_births['date']) || $eps_births['date'] != $today_str) {
    $eps_births = array('date' => $today_str, 'today' => array(), 'tomor' => array());
    $result = $epsclass->db->query("SELECT name,DATE_FORMAT(birth,'%m%d') as date FROM " . TBL_K48HTD . " WHERE DATE_FORMAT(birth,'%m%d')='{$today_str}' OR DATE_FORMAT(birth,'%m%d')='{$tomorrow_str}'") or error('Unable to fetch student\'s birthday', __FILE__, __LINE__, $epsclass->db->error());
    if ($epsclass->db->num_rows($result)) {
        while ($cur_std = $epsclass->db->fetch_assoc($result)) {
            if ($cur_std['date'] == $today_str) {
                $eps_births['today'][] = $cur_std['name'];
            } else {
                $eps_births['tomor'][] = $cur_std['name'];
            }
        }
    }
    $epsclass->db->free_result($result);
    create_file('<?php' . "\n" . '$eps_births = ' . var_export($eps_births, true) . ';' . "\n" . '?>', 'cache_birth.php', EPS_CACHE_DIR);
Example #3
0
<?php

/*
--------------------------------------------------------------------------------
     File:  w_o_t_d.php

   Module:  WORD OF THE DAY
   Author:  Quoc Viet [aFeLiOn]
    Begin:  2006-03-11

  Comment:  Get From dictionary.com
--------------------------------------------------------------------------------
*/
if (!defined('IN_EPS')) {
    exit;
}
$wotd_link = 'http://dictionary.reference.com/wordoftheday/wotd.rss';
$wotd_diff = -36000;
@(include EPS_CACHE_DIR . 'cache_wotd.php');
$now_string = date_string(time() + $wotd_diff);
if (!isset($wotd) || empty($wotd['desc']) || $wotd['date'] != $now_string) {
    $epsclass->load_class('class_xml');
    $epsclass->xml->load_file($wotd_link);
    $wotd_rss = $epsclass->xml->get_rss();
    $wotd = empty($wotd_rss) ? array() : array('date' => $now_string, 'link' => $wotd_rss['item']['link'], 'title' => html_clean($wotd_rss['item']['title']), 'desc' => preg_replace('#^(.+?):#i', '<strong>$1</strong>:', html_clean($wotd_rss['item']['description'])));
    create_file('<?php' . "\n" . '$wotd = ' . var_export($wotd, true) . ';' . "\n" . '?>', 'cache_wotd.php', EPS_CACHE_DIR);
}
$smarty->assign('wotd', $wotd);
$smarty->display('module/w_o_t_d.tpl');
unset($wotd_link, $wotd_diff, $now_string, $wotd_rss, $wotd);
Example #4
0
 public function to_output()
 {
     $this->output->add_css("banshee/poll.css");
     if (($poll = $this->get_active_poll()) == false) {
         return false;
     }
     $today = strtotime("today 00:00:00");
     $poll_open = $poll["end"] >= $today && $this->user_may_vote($poll["id"]);
     $this->output->open_tag("active_poll", array("can_vote" => show_boolean($poll_open)));
     $this->output->add_tag("question", $poll["question"]);
     $this->output->add_tag("end_date", date_string("d F", $poll["end"]));
     $query = "select * from poll_answers where poll_id=%d order by answer";
     if (($answers = $this->db->execute($query, $poll["id"])) != false) {
         if ($poll_open == false) {
             $votes = 0;
             foreach ($answers as $answer) {
                 $votes += (int) $answer["votes"];
             }
         }
         $this->output->open_tag("answers", $poll_open ? array() : array("votes" => $votes));
         $poll_id = 0;
         foreach ($answers as $answer) {
             if ($poll_open) {
                 $this->output->add_tag("answer", $answer["answer"], array("id" => $poll_id++));
             } else {
                 unset($answer["poll_id"]);
                 $answer["percentage"] = $votes > 0 ? round(100 * (int) $answer["votes"] / $votes) : 0;
                 $this->output->record($answer, "answer");
             }
         }
         $this->output->close_tag();
     }
     $this->output->close_tag();
     return true;
 }
?>
			
			<!-- Display a list of pending bookings -->
			<h4 style="text-align:center"> Pending Bookings (and dates submitted)</h4>
			<form style="text-align:center" name="chooseBooking" action="viewBookings.php" target="_blank">
			<select name="bookingid">
			<?php 
// Grab a list of all pending bookings
$pendingBookings = retrieve_all_pending_dbBookings(date("y-m-d"));
if ($pendingBookings) {
    // Make each booking id a menu item
    foreach ($pendingBookings as $booking) {
        echo "<option value='" . $booking->get_id() . "'>";
        $person = retrieve_dbPersons(substr($booking->get_id(), 8));
        if ($person) {
            echo $person->get_first_name() . " " . $person->get_last_name() . " (" . date_string(substr($booking->get_id(), 0, 8)) . ")";
        } else {
            echo $booking->get_id();
        }
        echo "</option>";
    }
    // Then add a button
    echo "<input type=\"submit\" value=\"View Booking\"/>";
}
?>
			</select></form>
			
			<!-- Have an option for saving the room log -->
			<?php 
// This only appears if the room log is valid
if ($roomLog instanceof RoomLog && ("today" == $_GET['date'] || date("y-m-d") == $_GET['date'])) {
Example #6
0
// check version of php
if (substr(phpversion(), 0, 1) < 5) {
    die("Tests skipped (PHP version 5 required)\n");
}
$support_dir = "test/support_files";
$plugin_dir = "plugins";
require_once "lib/header.php";
// setup log dir
$date = date_string();
$log_directory = "test/logs/{$date}";
mkdir($log_directory);
@unlink("test/logs/latest");
symlink($date, "test/logs/latest");
print "Logs in:      {$log_directory}\n";
//setup working dir
$working_directory = "test/working/" . date_string();
mkdir($working_directory);
@unlink("test/working/latest");
symlink($working_directory, "test/working/latest");
mkdir("{$working_directory}/.libs");
// avoid 'File exists' errors
print "Working from: {$working_directory}\n";
require_once "lib/startup.php";
require_once "lib/autovars.php";
require_once "reduce/Reduce.php";
if ($opt_clean) {
    echo "rm -Rf ./test/logs/*\n";
    `rm -Rf ./test/logs/*`;
    echo "rm -Rf ./test/working/*\n";
    `rm -Rf ./test/working/*`;
    exit(0);
Example #7
0
         $counter[$row["Status"]] = 1;
     }
     $t->tro($cr);
     if ($row["Status"] == "reserved") {
         $t->td($cr, pp_button(NOR_PP_MODE_REGISTER, "Authors", "Title"));
     } elseif ($authClass->isAdmin()) {
         $t->td($cr, pp_button(NOR_PP_MODE_ACCEPT, "Authors", "Title"));
     } else {
         $t->td($cr, "");
     }
     $t->td($cr, pp_button(NOR_PP_MODE_EDIT));
     $t->td($cr, pp_button($authClass->isAdmin() ? NOR_PP_MODE_DELETE : NOR_PP_MODE_UNRESERVE) . "&nbsp;");
     $t->td($cr . " nowrap", $pp_id);
     $t->td($cr, $field);
     if ($tabs->active == PP_PENDING || $authClass->isAdmin()) {
         $t->td($cr, $gecos . "<br>(" . $row["Status"] . "&nbsp;" . date_string($row["Tm"]) . ")&nbsp;");
     }
     $t->td($cr, $title . "<br>&nbsp;" . x("i", $authors));
     $t->td($cr, $journal);
     $t->trc();
     break;
 case "free":
     if ($authClass->isAdmin() && $row["Status"] == "free") {
         if (isset($counter["unused"])) {
             $counter["unused"]++;
         } else {
             $counter["unused"] = 1;
         }
         $s = "class='unused'";
         $t->tro($s);
         $t->td($s);
Example #8
0
function filter_dates($field, $dates)
{
    $filter = null;
    foreach ($dates as $date) {
        if ($filter === null) {
            $filter = '';
        } else {
            $filter .= ' OR ';
        }
        if (is_array($date)) {
            // range of values
            $first = date_string($date[0]);
            $last = date_string($date[1]);
            $filter .= "({$field} BETWEEN '{$first}' AND '{$last}')";
        } else {
            // single value
            $date = date_string($date);
            $filter .= "({$field} = '{$date}')";
        }
    }
    return $filter;
}
Example #9
0
 echo '<br>&gt;&gt;&gt; ' . __('Order children...');
 $fam_qry = $dbh->query("SELECT * FROM humo_families WHERE fam_tree_id='" . $tree_id . "' AND fam_children!=''");
 //while ($famDb=$fam_qry->fetch()){
 while ($famDb = $fam_qry->fetch(PDO::FETCH_OBJ)) {
     $child_array = explode(";", $famDb->fam_children);
     $nr_children = count($child_array);
     if ($nr_children > 1) {
         unset($children_array);
         for ($i = 0; $i < $nr_children; $i++) {
             $child = $dbh->query("SELECT * FROM humo_persons\n\t\t\t\t\t\tWHERE pers_tree_id='" . $tree_id . "' AND pers_gedcomnumber='" . $child_array[$i] . "'");
             @($childDb = $child->fetch(PDO::FETCH_OBJ));
             $child_array_nr = $child_array[$i];
             if ($childDb->pers_birth_date) {
                 $children_array[$child_array_nr] = date_string($childDb->pers_birth_date);
             } elseif ($childDb->pers_bapt_date) {
                 $children_array[$child_array_nr] = date_string($childDb->pers_bapt_date);
             } else {
                 $children_array[$child_array_nr] = '';
             }
         }
         asort($children_array);
         $fam_children = '';
         foreach ($children_array as $key => $val) {
             if ($fam_children != '') {
                 $fam_children .= ';';
             }
             $fam_children .= $key;
         }
         if ($famDb->fam_children != $fam_children) {
             $sql = "UPDATE humo_families SET fam_children='" . $fam_children . "' WHERE fam_id='" . $famDb->fam_id . "'";
             $dbh->query($sql);
Example #10
0
function get_start_day($day, $start)
{
    global $days;
    for ($i = 0; $i < 7; $i++) {
        $date = add_js_timestamp(date_string($start), "D", $i);
        //Ad one day and see if it is the appropriate Day like MOnday , Tuesday etc...
        if ($days[$day] == date("l", $date)) {
            return $date;
        }
    }
}
                //prints the name of each primary guest as a
                //link to the corresponding viewPerson page
                $current_guest = retrieve_dbPersons($guest_id);
                //handles when no guest with the corresponding ID in databse
                if ($current_guest == false) {
                    echo "Error: This booking contains a guestID for a person not in the database";
                } else {
                    echo "<a href = viewPerson.php?id=" . $current_id . " >" . $current_guest->get_first_name() . " " . $current_guest->get_last_name() . " </a>";
                }
                //prints patient name
                echo '</td>' . '<td align="center" bgcolor=' . $color . '>' . $current_booking->get_patient() . '</td>';
                //pulls out date in
                $date = $current_booking->get_date_in();
                //formats date if not "Will Call"
                if ($date != "Will Call") {
                    $date = date_string($date);
                }
                //prints datein and flag
                echo '<td align="center" bgcolor=' . $color . '>' . $date . '</td>';
                echo '<td align="center" bgcolor=' . $color . '>' . $current_booking->get_flag() . '</td>';
                //prints links for viewing and editing
                echo '<td> <a href="viewBookings.php?id=update&bookingid=' . $current_booking->get_id() . '">view</a>
						 <a href="viewBookings.php?id=delete&bookingid=' . $current_booking->get_id() . '">delete</a></td>';
                echo "</tr>";
                echo "\n";
            }
        }
        //completes the table
        echo "</table></p>";
    }
}