예제 #1
0
function updateLastLogIn($user_id)
{
    global $db;
    $date = make_date();
    $sql = "UPDATE users SET last_login='******' WHERE id ='{$user_id}' LIMIT 1";
    $result = $db->query($sql);
    return $result && $db->affected_rows() === 1 ? true : false;
}
예제 #2
0
<?php

require_once 'includes/load.php';
if (isset($_POST['custnr'])) {
    $req_fields = array('s_id', 'quantity', 'price', 'total');
    if (empty($errors)) {
        $max = count($_POST['s_id']);
        for ($i = 0; $i < $max; $i++) {
            $s_total = floatval($_POST['quantity'][$i] * $_POST['price'][$i]);
            $p_id = $db->escape((int) $_POST['s_id'][$i]);
            $s_qty = $db->escape((int) $_POST['quantity'][$i]);
            $date = $db->escape($_POST['date']);
            $custnr = $db->escape($_POST['custnr']);
            $comment = $db->escape($_POST['comment']);
            $s_date = make_date();
            $s_userID = $_SESSION['user_id'];
            $s_mac = $db->escape($_POST['mac'][$i]);
            $productCategory = find_by_id('products', $p_id);
            $sql = "INSERT INTO entre_sales (";
            $sql .= " product_id, qty, price, date, custnr, comment, FK_userID, mac";
            $sql .= ") VALUES (";
            $sql .= "'{$p_id}', '{$s_qty}', '{$s_total}', '{$s_date}', '{$custnr}', '{$comment}','{$s_userID}', '{$s_mac}'";
            $sql .= ")";
            if ($s_qty > 0) {
                if ($db->query($sql)) {
                    update_entre_qty($s_qty, $p_id);
                    //                    $session->msg('s', "Sale added. ");
                } else {
                    //                    $session->msg('d', ' Sorry failed to add!');
                }
            }
예제 #3
0
 private function set_order_data()
 {
     $this->request_data['order'] = array();
     $date_array = array();
     $date_array = $this->request_param('booking_date');
     //Order Details
     $this->request_data['booking']['pickup_type'] = $this->request_param('pickup_type') ? $this->request_param('pickup_type') : 1;
     if ($date_array) {
         foreach ($date_array as $key => $date) {
             $order = array('pickup_address' => $this->request_param('pickup_address', "Please give the pickup address."), 'requested_pickup_time' => $this->request_param('booking_time'), 'pickup_lat' => $this->request_param('pickup_lat', "Please give the pickup latitude."), 'pickup_long' => $this->request_param('pickup_long', "Please give the pickup longitude."), 'drop_address' => $this->request_param('drop_address', "Please give drop adddress."), 'pin' => $this->request_param('pin'), 'drop_lat' => $this->request_param('drop_lat', "Please give the drop latitude."), 'drop_long' => $this->request_param('drop_long', "Please give the drop longitude."), 'pickup_date' => make_date($date), 'is_flexible' => $this->request_data['booking']['pickup_type'] == 2 ? 1 : 0, 'flexible_time_id' => $this->request_param('flexible_timeslot'));
             if ($order['is_flexible'] == 2) {
                 $order['flexible_time_id'] = $this->request_param('flexible_timeslot');
             }
             if ($this->update) {
                 $order['order_id'] = $key;
                 $order['flexible_time_id'] = $this->request_data['booking']['flexible_timeslot'] = $this->request_data['booking']['pickup_type'] == 1 ? 0 : $this->request_param('flexible_timeslot');
             }
             $this->request_data['order'][] = $order;
         }
         $order_count = count($this->request_data['order']);
         $this->request_data['booking']['no_of_order'] = $order_count;
         $this->request_data['booking']['booking_type'] = $order_count > 1 ? 2 : 1;
     }
 }
예제 #4
0
    $sarr = explode(" ", $event->StartTime);
    $earr = explode(" ", $event->EndTime);
}
// echo $event->StartTime;
?>
                    
              <input MaxLength="10" class="required date" id="stpartdate" name="stpartdate" style="padding-left:2px;width:90px;" type="text" value="<?php 
echo isset($event) ? make_date($sarr[0]) : "";
?>
" />                       
              <input MaxLength="5" class="required time" id="stparttime" name="stparttime" style="width:40px;" type="text" value="<?php 
echo isset($event) ? make_time($sarr[1]) : "";
?>
" /> Jusqu'au                       
              <input MaxLength="10" class="required date" id="etpartdate" name="etpartdate" style="padding-left:2px;width:90px;" type="text" value="<?php 
echo isset($event) ? make_date($earr[0]) : "";
?>
" />                       
              <input MaxLength="50" class="required time" id="etparttime" name="etparttime" style="width:40px;" type="text" value="<?php 
echo isset($event) ? make_time($earr[1]) : "";
?>
" />                                            
              <label class="checkp"> 
                <input id="IsAllDayEvent" name="IsAllDayEvent" type="checkbox" value="1" <?php 
if (isset($event) && $event->IsAllDayEvent != 0) {
    echo "checked";
}
?>
/>          Toute la journée                      
              </label>                    
            </div>                
예제 #5
0
function module_articles_frontpage()
{
    echo "<!-- start articles frontpage -->";
    global $article_author;
    global $no_articles_text;
    global $jokes, $layout, $chars_showing_articles, $chars_showing_first_article;
    $query = "select * from articles WHERE is_deleted IS NULL AND comment_to IS NULL AND is_draft IS NULL ORDER BY date_posted DESC, time_posted DESC LIMIT 8";
    $result = DB_get_table($query);
    ?>
	
	<!-- start articles frontpage -->

	
	<?php 
    if ($layout == "newspaper") {
        echo '<table class="frontpage_table_2columns">';
    } else {
        echo '<table class="frontpage_table">';
    }
    if (!$result || DB_rows_affected($result) < 1) {
        // hvis noe er feil, vis en vits.
        echo '<tr>';
        echo '<td colspan="2" class=\\"articles_frontpage\\">';
        echo $no_articles_text . ' Vi presenterer i stedet en vits.<br/><br/>';
        echo $jokes[array_rand($jokes, 1)];
        echo '</td>';
        echo '</tr>';
    } else {
        $num_results = DB_rows_affected();
        // øverste artikkel, spenner over begge kolonnene.
        echo "<tr>";
        echo '<td colspan="2" class="articles_frontpage">';
        $row = DB_next_row($result);
        echo '<div class="header2 articletitlefront"><a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '">' . stripslashes($row['title']) . '</a></div>';
        echo '<div class="metatext">' . $article_author;
        echo '<span class="author">: ';
        if (isset($row['author_username'])) {
            echo '<a href="index.php?m_c=mvp&amp;username='******'author_username'] . '">' . stripslashes($row['author']) . '</a>';
        } else {
            echo stripslashes($row['author']);
        }
        echo '</span>';
        echo ', postet <span class="date">' . make_date($row['date_posted']) . ' </span><span class="time">' . make_time($row['time_posted']) . '</span></div>';
        echo '<div class="textbody">';
        if (strlen($row['body']) < $chars_showing_first_article * 2) {
            echo stripslashes(nl2br($row['body']));
        } else {
            echo closeUnclosedTags(stripslashes(substr(nl2br($row['body']), 0, $chars_showing_first_article)));
            echo " ...";
            $chars_left = strlen($row['body']) - $chars_showing_first_article;
        }
        echo '</div>';
        $number_of_comments = number_of_comments($row['articleid']);
        echo '<div class="showarticlelink">';
        if (strlen($row['body']) < $chars_showing_first_article * 2) {
            echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '">Vis artikkelside</a>&nbsp;&nbsp;';
        } else {
            echo '<a  href="index.php?c=' . $chars_showing_first_article . '&amp;m_c=m_va&amp;articleid=' . $row['articleid'] . '#continue">Les hele artikkelen <span class="notice">(' . $chars_left . ' flere tegn)</span></a>&nbsp;&nbsp;';
        }
        // Give link to comments if any, else link to the commenting form
        if ($number_of_comments > 0) {
            echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '#comments">Les kommentarer (' . $number_of_comments . ')</a>&nbsp;&nbsp;';
        } else {
            global $anyone_comments;
            if ($anyone_comments || isset($_SESSION['valid_user'])) {
                echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '#commentform">Skriv kommentar</a>&nbsp;&nbsp;';
            } else {
                echo "<span id='loginlink'><a href=\"javascript:showDiv('loginform', 'errorandlogout')\">Logg inn og kommenter</a></span>";
            }
        }
        echo '</div>';
        echo '</td>';
        echo '</tr>';
        // resten av artiklene
        if ($layout == "newspaper") {
            $chars_showing_first_article = $chars_showing_first_article / 4;
        }
        for ($i = 1; $i < $num_results; $i++) {
            // sjekker layout og hvilken 'side' man er på, siden man kan velge mellom 1 eller 2 kolonner.
            if (!($i % 2 == 0) || $layout == "weblog") {
                echo "<tr>";
                if ($layout == "weblog") {
                    echo '<td colspan="2" class="articles_frontpage">';
                } else {
                    echo '<td class="articles_frontpage_2column">';
                }
            } else {
                if ($layout == "weblog") {
                    echo '<td colspan="2" class="articles_frontpage">';
                } else {
                    echo '<td class="articles_frontpage_2column">';
                }
            }
            $row = DB_next_row($result);
            echo '<div class="header2 articletitlefront"><a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '">' . stripslashes($row['title']) . '</a></div>';
            echo '<div class="metatext">' . $article_author;
            echo '<span class="author">: ';
            if (isset($row['author_username'])) {
                echo '<a href="index.php?m_c=mvp&amp;username='******'author_username'] . '">' . stripslashes($row['author']) . '</a>';
            } else {
                echo stripslashes($row['author']);
            }
            echo '</span>';
            echo ', postet <span class="date">' . make_date($row['date_posted']) . ' </span><span class="time">' . make_time($row['time_posted']) . '</span></div>';
            echo '<div class="textbody">';
            if (strlen($row['body']) < $chars_showing_first_article * 2) {
                echo stripslashes(nl2br($row['body']));
            } else {
                echo stripslashes(substr(nl2br($row['body']), 0, $chars_showing_first_article));
                echo " ...";
                $chars_left = strlen($row['body']) - $chars_showing_first_article;
            }
            echo '</div>';
            $number_of_comments = number_of_comments($row['articleid']);
            echo "<div class=\"showarticlelink\">";
            if (strlen($row['body']) < $chars_showing_first_article * 2) {
                echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '">Vis artikkelside</a>&nbsp;&nbsp;';
            } else {
                echo '<a  href="index.php?c=' . $chars_showing_first_article . '&amp;m_c=m_va&amp;articleid=' . $row['articleid'] . '#continue">Les hele artikkelen <span class="notice">(' . $chars_left . ' flere tegn)</span></a>&nbsp;&nbsp;';
            }
            if ($number_of_comments > 0) {
                echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '#comments">Les kommentarer (' . $number_of_comments . ')</a>&nbsp;&nbsp;';
            } else {
                echo '<a href="index.php?m_c=m_va&amp;articleid=' . $row['articleid'] . '#commentform">Skriv kommentar</a>&nbsp;&nbsp;';
            }
            echo '</div>';
            echo '</td>';
            if (!($i % 2 != 0) || $layout == "weblog") {
                echo "</tr>";
            }
        }
        // slutt for-løkke
        // helt til slutt, hvis antall artikler på forsiden er et partall,
        // og dette ikke er weblog (en artikkel pr rad)
        // vil vi bare ha en artikkel på slutten, og må huske å avslutte raden.
        if ($num_results % 2 == 0 && $layout != "weblog") {
            echo "</tr>";
        }
    }
    echo "</table>";
}
$week_number = end($week_text) + 0;
print $prev_month_button;
print $next_month_button;
print_r($month_buttons);
// Initialisation
require 'scraperwiki/simple_html_dom.php';
$html_content = scraperwiki::scrape("http://etrinex.evok.ch/degresjours/Default.aspx");
$html = str_get_html($html_content);
$dates = array();
$temperatures = array();
foreach ($html->find("table#Table1 tr") as $i => $row) {
    if ($i == 1) {
        // row of dates (2nd row)
        foreach ($row->find("td") as $j => $cell) {
            if ($j > 0 && $j < 8) {
                $dates[] = make_date(date_parse_from_format("d-m-Y", $cell->innertext));
                //$dates[] = $cell->innertext;
            }
        }
    }
    if ($i == 7) {
        // row for Fribourg data (8th row)
        foreach ($row->find("td") as $j => $cell) {
            if ($j > 0 && $j < 14 && $j % 2 == 1) {
                if ($cell->innertext == "-") {
                    $temperatures[] = "";
                } else {
                    $temperatures[] = str_replace(",", ".", $cell->innertext) + 0;
                }
            }
        }
예제 #7
0
    if ($bday_year > 0) {
        $a_birthdays[intval(substr($user['userbday'], 8, 2)) - 1][] = "<a href=\"" . build_link("v_profile.php?userid={$user['userid']}") . "\">{$user['username']}</a> ({$bday_year})";
    }
}
// Fetching all events...
$a_events = array();
$r_events = thwb_query("SELECT * FROM " . $pref . "calendar\n    WHERE eventtime>='{$year}-{$month}-01' AND eventtime<='{$year}-{$month}-{$lastday}'\n    AND eventactive='1'\n    ORDER BY eventtime, eventtext");
while ($event = mysql_fetch_array($r_events)) {
    $a_events[intval(substr($event['eventtime'], 8, 2)) - 1][] = $event;
}
// Creating Eventbox
$eventbox = '';
$r_calendar = mysql_query("SELECT eventid, eventtime, eventsubject FROM " . $pref . "calendar WHERE eventtime >= '{$a_current['year']}-{$a_current['month']}-{$a_current['day']}' ORDER BY eventtime LIMIT 1");
if (mysql_num_rows($r_calendar) > 0) {
    $calendar = mysql_fetch_array($r_calendar);
    $calendar['eventtime'] = make_date($calendar['eventtime']);
    $calendar['eventsubject'] = parse_code($calendar['eventsubject']);
    eval($Tcaleventbox->GetTemplate('eventbox'));
}
$boxcount = $lastday + $firstday - 1;
if ($boxcount % 7 > 0) {
    $boxcount += 7 - $boxcount % 7;
}
$calendar = '<tr>';
for ($i = 1; $i <= $boxcount; $i++) {
    $userbday = '';
    $events = '';
    if ($i < $firstday || $i >= $lastday + $firstday) {
        eval($Tcalrow_empty->GetTemplate('calendar'));
    } else {
        $thisday = $i + 1 - $firstday;
예제 #8
0
function previewArticle($article)
{
    if (!$article) {
        h3("Fant ikke artikkelen.");
    } else {
        table_open();
        tr_open();
        td_open(1);
        h1_link($article['title'], url_to_article($article['articleid']));
        articleMetaInfo($article['author'], $article['author_username'], make_date($article['date_posted']), make_time($article['time_posted']), $article['language']);
        div_open("textbody", "");
        $paragraph = makeReadyForPrint(nl2br($article['body']));
        echo $paragraph;
        div_close();
        td_close();
        tr_close();
        table_close();
    }
}
예제 #9
0
<?php

require_once '../lib/flip.php';
session_start();
check_valid_user();
if (!is_admin()) {
    display_warning('Musisz mieæ uprawnienia administratora!');
    exit;
}
$readable_start = make_date($_POST['start']);
$readable_end = make_date($_POST['end']);
if (!my_check_date($_POST['start']) || !my_check_date($_POST['end'])) {
    display_warning('Z³a data!');
    exit;
}
$stats = get_project_stats($_POST['projects'], $readable_start, $readable_end);
display_html_header();
display_document_header();
display_menu();
echo '<table width="90%">' . "\n";
echo '<tr><td align="center" class="naglowek">Statystyki projektów od ' . $readable_start . ' do ' . $readable_end . '<hr></td></tr>';
echo '<tr><td align="center"><table cellpadding="5" cellspacing="0" border="1" bgcolor="#fefffe"><tr>';
foreach (array('Projekt', 'Telefonów', 'Spotkañ', 'Ogó³em') as $label) {
    echo '<th>' . $label . '</th>';
}
echo '</tr>';
$suma_telefonow = 0;
$suma_spotkan = 0;
foreach ($stats as $project_id => $details) {
    $telefon = (int) $details['telefon'];
    $spotkanie = (int) $details['spotkanie'];
예제 #10
0
function list_articles($result, $num_results)
{
    global $article_author;
    for ($i = 0; $i < $num_results; $i++) {
        echo "<tr><td colspan=2>";
        $row = DB_next_row($result);
        echo "<div class=\"default_header\">" . stripslashes($row['title']) . "</div><div class=\"metatext\">";
        echo "<span class=\"author\">" . $article_author . ": ";
        echo stripslashes($row['author']) . ' (' . $row['author_username'] . ')';
        echo ',</span> <span class="time">postet ';
        echo make_date($row['date_posted']) . " ";
        echo make_time($row['time_posted']);
        echo '</span><div> ';
        echo substr(nl2br(stripslashes($row['body'])), 0, 240);
        if (strlen($row['body']) > 240) {
            echo "...";
        }
        echo '</div><div class="editarticle">';
        if (isset($_SESSION['valid_user']) || isset($_SESSION['valid_admin'])) {
            if ($row['author_username'] == $_SESSION['valid_user']) {
                echo '<a href="index.php?articleid=' . $row['articleid'] . '&m_c=module_delete_article">Slett</a>';
                echo ' <a href="index.php?articleid=' . $row['articleid'] . '&m_c=module_enter_article&edit=1">Rediger</a>';
            }
        }
        if ($row['comment_to'] > 0) {
            echo ' <a href="index.php?articleid=' . $row['comment_to'] . '&m_c=m_va">Vis artikkelen denne kommentaren tilhører</a></div>';
        } else {
            echo ' <a href="index.php?articleid=' . $row['articleid'] . '&m_c=m_va">Vis</a></div>';
        }
        echo '</td></tr>';
    }
}
예제 #11
0
            $sql = "UPDATE  " . TMPINTER . " SET date = '" . $date . "' , am = '" . $am . "' , pm = '" . $pm . "' , intervenantid = '" . $lstagent . "',evtidam = '" . $evtam . "',evtidpm = '" . $evtpm . "' WHERE idtmpintervention='" . $id . "'";
            if (!$db->query($sql)) {
                message(ERROR, 'Impossible de mettre à jour la base de données', __FILE__, __LINE__, $sql);
            }
            $meta = '<meta http-equiv="Refresh" content="2;url=' . $_SERVER["PHP_SELF"] . '">';
            $message = 'Evénement planning modifié avec succès';
            $message .= '<br /><br />' . sprintf($lang['update']['retour'], '<a href="' . $_SERVER["PHP_SELF"] . '">', '</a>');
            message(INFO, $message);
        }
        include $header;
        //mode affichage du formulaire
        $template->set_filenames(array('body' => 'insert_pla_body.tpl'));
        // Sélection de l'enregistrement
        $sql = "SELECT * FROM " . TMPINTER . "," . EVENT . "," . AGENT . "  WHERE " . AGENT . ".idintervenant = " . TMPINTER . ".intervenantid AND " . EVENT . ".idevenement = " . TMPINTER . ".evenementid AND idtmpintervention = '" . $id . "' ";
        if (!($result = $db->query($sql))) {
            message(ERROR, 'Impossible de selectionner les dates d\'interventions', __FILE__, __LINE__, $sql);
        }
        if ($db->num_rows($result)) {
            $row = $db->fetch_array($result);
            //selection des categories
            $check = $row['am'] == '1' && $row['pm'] == '0' ? 'checked' : '';
            $nockeck = $row['pm'] == '1' && $row['am'] == '0' ? 'checked' : '';
            $nockeck2 = $row['pm'] == '1' && $row['am'] == '1' ? 'checked' : '';
            $template->assign_vars(array('L_ENTETE' => 'Modifier un événement planning', 'L_EXPLAIN' => 'Tous les champs suivis d\'une étoile sont obligatoires', 'L_AJOUT' => $lang['Button']['update'], 'L_RESET' => $lang['Button']['reset2'], 'L_DATE' => $lang['insert']['date2'], 'L_AMPM' => $lang['insert']['ampm'], 'L_AGENT' => $lang['insert']['agent'], 'L_EVENT' => $lang['insert']['event'], 'LSTAGENT' => create_list("lstagent", AGENT, 'idintervenant', 'nom', 'prenom', $row['intervenantid'], 'code'), 'LSTEVENT' => create_list("lstevent", EVENT, 'idevenement', 'libevent', '', $row['evenementid'], 'libevent'), 'DATE' => make_date($row['date'], 'date'), 'TRAITCHECK' => $check, 'TRAITNOCHECK' => $nockeck, 'TRAITNOCHECK2' => $nockeck2, 'F_ACTION' => $_SERVER["PHP_SELF"] . '?mode=update&id=' . $id, 'F_ENCTYPE' => 'enctype="multipart/form-data"'));
        }
        break;
}
$template->pparse('body');
include $footer;
$db->free_result();
$db->close_connexion();
$html = str_get_html($html_content);
// initialize empty array to store the data array from each row
$tabledata = array();
// loop over rows
foreach ($html->find("table#Table1 tr") as $row) {
    // initialize array to store the cell data from each row
    $rowdata = array();
    foreach ($row->find('td') as $cell) {
        // change separator and type of temperature value
        // and format date
        $value = str_replace(",", ".", $cell->innertext);
        if (strpos($value, ".")) {
            $value += 0;
        } else {
            if (preg_match("/\\d-\\d/", $value)) {
                $value = make_date(date_parse_from_format("d-m-Y", $value));
            }
        }
        // push the cell's text to the array
        $rowdata[] = $value;
        // duplicate cell if colspan present
        if (isset($cell->colspan)) {
            $rowdata[] = $value;
        }
    }
    // push the row's data array to the 'big' array
    $tabledata[] = $rowdata;
}
$html->__destruct();
// delete unused row 0 and 2
unset($tabledata[0]);
예제 #13
0
 private function set_order_data()
 {
     $this->request_data['order'] = array();
     $date_array = array();
     //Order Details
     if ($this->request_data['booking']['booking_type'] == 2) {
         $this->request_data['booking']['booking_date'] = date('Y-m-d H:i:s');
         $date_json = $this->request('booking_date');
         $date_array = json_decode(stripcslashes($date_json));
     } else {
         $date_array[] = $this->request('booking_date');
     }
     if ($date_array) {
         foreach ($date_array as $date) {
             $order = array('pickup_address' => $this->request('pickup_address', true), 'requested_pickup_time' => $this->request('booking_time'), 'pickup_lat' => $this->request('pickup_lat', true), 'pickup_long' => $this->request('pickup_long', true), 'drop_address' => $this->request('drop_address', true), 'pin' => $this->request('pin', true), 'drop_lat' => $this->request('drop_lat', true), 'drop_long' => $this->request('drop_long', true), 'pickup_date' => make_date($date), 'is_flexible' => $this->request_data['booking']['pickup_type'] == 2 ? 1 : 0, 'flexible_time_id' => $this->request('flexible_timeshot'));
             if ($order['is_flexible'] == 2) {
                 $order['flexible_time_id'] = $this->request('flexible_timeshot');
             }
             $this->request_data['order'][] = $order;
         }
         $this->request_data['booking']['no_of_order'] = count($this->request_data['order']);
     }
 }