Exemple #1
0
 public function cacheQuery($query, $name = false, $expiration = -1)
 {
     // $expiration = time it expires from when created.
     // $name = optional file name
     // Setup the file name
     if ($name === false) {
         $name = md5($query);
     }
     $name = YAKBB_CACHE . "sql/" . $name . ".php";
     // See if the cache currently exists
     if (file_exists($name) && ($expiration == -1 || filemtime($name) + $expiration >= time())) {
         include $name;
         return $return_value;
     }
     // Cache doesn't exist yet or expired. Create it.
     $this->query($query);
     $dat = array();
     while ($x = $this->fetch()) {
         $dat[] = $x;
     }
     $s = "<" . "?php\n/*\nQuery: " . $query . "\nGenerated: " . makeDate() . "\n*/\n\ndefined(\"YAKBB\") or die(\"Security breach.\");\n";
     $s .= "\$return_value = " . var_export($dat, true);
     $s .= "\n?" . ">";
     if (!isset($this->ff)) {
         $this->ff = new FlatFile();
     }
     $this->ff->updateFile($name, $s);
     return $dat;
 }
Exemple #2
0
 public function init()
 {
     global $yakbb;
     $yakbb->loadLanguageFile("viewboard");
     // Get and validate board ID
     $this->boardid = intval($_GET["board"]);
     // Force integer value
     if ($this->boardid == 0) {
         $yakbb->error(2, "invalid_board_id");
     }
     // Need to check if board is in the database and load data if so.
     $yakbb->db->query("\r\n\t\t\tSELECT\r\n\t\t\t\t*\r\n\t\t\tFROM\r\n\t\t\t\tyakbb_boards\r\n\t\t\tWHERE\r\n\t\t\t\tid='" . $this->boardid . "'\r\n\t\t\tLIMIT\r\n\t\t\t\t1\r\n\t\t");
     if ($yakbb->db->numRows() == 0) {
         $yakbb->error(2, "board_doesnt_exist");
     }
     $this->bdata = $yakbb->db->fetch();
     // Check some permissions
     $perms = boardPermissions($this->boardid);
     if ($perms["view"] == false) {
         $yakbb->error(2, "perms_cant_view_board");
     }
     // Calculate pagination and then load threads
     $showpagination = false;
     $totalpages = 1;
     if ($this->bdata["threads"] > 0) {
         // Don't load threads if no posts/threads. We'll still load announcements
         // Load pagination
         $currentpage = isset($_GET["page"]) && intval($_GET["page"]) > 0 ? intval($_GET["page"]) : 1;
         if ($this->bdata["threads"] > $yakbb->config["threads_per_page"]) {
             $showpagination = true;
             $totalpages = ceil($this->bdata["threads"] / $yakbb->config["threads_per_page"]);
             if ($currentpage > $totalpages) {
                 $yakbb->error(2, "viewboard_page_doesnt_exist");
             }
         } else {
             $totalpages = 1;
         }
         $yakbb->db->query("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tt.*,\r\n\t\t\t\t\tu.username, u.displayname, u.group,\r\n\t\t\t\t\tlpu.username AS lpusername, lpu.displayname AS lpdisplay, lpu.group AS lpgroup\r\n\t\t\t\tFROM\r\n\t\t\t\t\tyakbb_threads t\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\tyakbb_users u\r\n\t\t\t\t\tON (u.id = t.creatorid)\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\tyakbb_users lpu\r\n\t\t\t\t\tON (u.id = lastpostuser)\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tt.parentid = '" . $this->boardid . "'\r\n\t\t\t\tORDER BY\r\n\t\t\t\t\tt.lastposttime DESC,\r\n\t\t\t\t\tt.id DESC\r\n\t\t\t\tLIMIT\r\n\t\t\t\t\t" . ($currentpage - 1) * $yakbb->config["threads_per_page"] . ", " . $yakbb->config["threads_per_page"] . "\r\n\t\t\t");
         $this->threads = array();
         while ($t = $yakbb->db->fetch()) {
             $t["url"] = url_thread($t["id"], $t["name"]);
             $t["link"] = link_thread($t["id"], $t["name"]);
             $t["starterlink"] = link_user($t["creatorid"], $t["username"], $t["displayname"], $t["group"]);
             $t["lpuserlink"] = link_user($t["lastpostuser"], $t["lpusername"], $t["lpdisplay"], $t["lpgroup"]);
             $t["lpdate"] = makeDate($t["lastposttime"]);
             $this->threads[] = $t;
         }
     }
     // Template stuff
     $yakbb->smarty->assign("showpagination", $showpagination);
     $yakbb->smarty->assign("totalpages", $totalpages);
     $yakbb->smarty->assign("boardid", $this->boardid);
     $yakbb->smarty->assign("page_title", $this->bdata["name"]);
     $yakbb->smarty->assign("threads", $this->threads);
     $yakbb->loadTemplate("viewboard.tpl");
 }
Exemple #3
0
 private function loadBoards()
 {
     global $yakbb;
     // Assemble category ids list
     $catids = array(0 => 0);
     // Can view null category always
     foreach ($this->cats as $k => $v) {
         $catsids[] = $v["id"];
     }
     $boards = $yakbb->db->query("\r\n\t\t\tSELECT\r\n\t\t\t\tb.*,\r\n\t\t\t\tv.id AS viewid,\r\n\t\t\t\tu.username AS lpusername, u.displayname AS lpdisplay, u.group AS lpgroup,\r\n\t\t\t\tt.name AS lpthreadname\r\n\t\t\tFROM\r\n\t\t\t\tyakbb_boards b\r\n\t\t\tLEFT JOIN\r\n\t\t\t\tyakbb_boards_views v\r\n\t\t\t\tON (b.id = v.boardid AND v.userid = '" . $yakbb->user["id"] . "')\r\n\t\t\tLEFT JOIN\r\n\t\t\t\tyakbb_users u\r\n\t\t\t\tON (u.id = b.lastpostuserid)\r\n\t\t\tLEFT JOIN\r\n\t\t\t\tyakbb_threads t\r\n\t\t\t\tON (t.id = b.lastpostthreadid)\r\n\t\t\tWHERE\r\n\t\t\t\tb.parenttype = 'c'\r\n\t\t\t\tAND b.hidden = '0'\r\n\t\t\t\tAND b.parentid IN (" . implode($catsids, ",") . ")\r\n\t\t\tORDER BY\r\n\t\t\t\tb.parentorder ASC\r\n\t\t");
     while ($b = $yakbb->db->fetch()) {
         $bperms = unserialize($b["permissions"]);
         if (!isset($bperms[$yakbb->user["group"]]) || $bperms[$yakbb->user["group"]]["view"] == false) {
             continue;
         }
         $b["link"] = link_board($b["id"], $b["name"]);
         $b["url"] = url_board($b["id"], $b["name"]);
         $b["permissions"] = $bperms[$yakbb->user["group"]];
         $b["lpdate"] = makeDate($b["lastposttime"]);
         $b["lplink"] = link_thread($b["lastpostthreadid"], $b["lpthreadname"]);
         $b["lpuserlink"] = link_user($b["lastpostuserid"], $b["lpusername"], $b["lpdisplay"], $b["lpgroup"]);
         $this->cats[$b["parentid"]]["boards"][] = $b;
     }
 }
    return $formatted_date;
}
$pagename = $_SERVER['REQUEST_URI'];
$where = "";
$groupby = "xourpo, xinv ";
$orderby = "xdate, xourpo, xinv";
$oInvoiceList = new PaInvoiceByPOandInv();
$data = $oInvoiceList->getData($where, $groupby, $orderby);
$errors = $oInvoiceList->getErrors();
if (!empty($errors)) {
    // deal with error message(s)
}
$oInvoiceParts = new PaInvoice();
if ($_POST) {
    $date_from = makeDate($_POST['date-from']);
    $date_to = makeDate($_POST['date-to']);
    $orderId = $_POST['orderId'];
    //TODO: make sure to is not before from - can be jquery validation
    $where = "xdate between '" . $date_from . "' AND '" . $date_to . "'";
    //header("Location: http://localhost/var/etl/bin/categories/tool/assign1.html");
    //echo "submitted.";
    $data = $oInvoiceList->getData($where, $groupby, $orderby);
    $errors = $oInvoiceList->getErrors();
    if (!empty($errors)) {
        // deal with error message(s)
    }
}
if ($_GET) {
    echo "yo mama: " . $_GET['po'];
    $where = "xourpo = '" . $_GET['po'] . "'";
    $groupby = "";
    <fieldset>
    <legend><?php 
    print $PMF_LANG['ad_entry_changelog'];
    ?>
</legend>

    <label class="lefteditor"><?php 
    print $PMF_LANG["ad_entry_date"];
    ?>
</label>
    <?php 
    if (isset($date)) {
        print makeDate($date);
    } else {
        print makeDate(date("YmdHis"));
    }
    ?>
<br />

    <label class="lefteditor" for="changed"><?php 
    print $PMF_LANG["ad_entry_changed"];
    ?>
</label>
	<textarea name="changed" id="changed" style="width: 390px; height: 50px;" cols="40" rows="4"><?php 
    if (isset($changed)) {
        print $changed;
    }
    ?>
</textarea><br />
Exemple #6
0
/**
 * printOpenQuestions()
 *
 * Gives the HTML output code for the Open Questions
 *
 * @return  string
 * @access  public
 * @since   2002-09-17
 * @author  Thorsten Rinne <*****@*****.**>
 */
function printOpenQuestions()
{
    global $db, $sids, $tree, $PMF_LANG;
    $query = "SELECT id, ask_username, ask_usermail, ask_rubrik, ask_content, ask_date FROM " . SQLPREFIX . "faqfragen ORDER BY ask_date ASC";
    $result = $db->query($query);
    $output = "";
    if ($db->num_rows($result) > 0) {
        while ($row = $db->fetch_object($result)) {
            $output .= "\t<tr class=\"openquestions\">\n";
            $output .= "\t\t<td valign=\"top\" nowrap=\"nowrap\"><a name=\"openq_" . $row->id . "\">" . makeDate($row->ask_date) . "</a><br /><a href=\"mailto:" . safeEmail($row->ask_usermail) . "\">" . $row->ask_username . "</a></td>\n";
            $output .= "\t\t<td valign=\"top\"><strong>" . $tree->categoryName[$row->ask_rubrik]["name"] . ":</strong><br />" . strip_tags($row->ask_content) . "</td>\n";
            $output .= "\t\t<td valign=\"top\"><a href=\"" . $_SERVER["PHP_SELF"] . "?" . $sids . "action=add&amp;question=" . rawurlencode($row->ask_content) . "&amp;cat=" . $row->ask_rubrik . "\">" . $PMF_LANG["msg2answer"] . "</a></td>\n";
            $output .= "\t</tr>\n";
        }
    } else {
        $output = "\t<tr>\n\t\t<td colspan=\"3\">" . $PMF_LANG["msgNoQuestionsAvailable"] . "</td>\n\t</tr>\n";
    }
    return $output;
}
Exemple #7
0
<?php

if (@$_GET['delete'] == 1) {
    $db->delete($tbl, "`calendarid`=" . $calendarid);
    $notify->add($lang->get('calendar'), $lang->get('deleted'));
    writeExport();
} else {
    $menu->addSubElement($mod, $lang->get('delete_term'), 'edit', array('calendarid' => $calendarid, 'delete' => 1));
    // get current entry
    $entry = $db->selectOneRow($tbl, "*", "`calendarid`=" . $calendarid);
    // add breadcrumbs
    $breadcrumbs->addElement(makeDate($day), makeURL($mod, array('day' => $day, 'view' => $view)));
    $breadcrumbs->addElement($entry['title'], makeURL($mod, array('mode' => 'view', 'day' => $day, 'view' => $view, 'calendarid' => $calendarid)));
    $breadcrumbs->addElement($lang->get('edit_calendar_entry'), makeURL($mod, array('mode' => 'edit', 'day' => $day, 'view' => $view, 'calendarid' => $calendarid)));
    // prepare date and time
    $entry['start_date'] = date("m/d/Y", $entry['start']);
    $entry['end_date'] = date("m/d/Y", $entry['end']);
    // save button pressed?
    if (isset($_POST['save'])) {
        // save new data
        $start_date = @explode("/", $_POST['start_date']);
        $end_date = @explode("/", $_POST['end_date']);
        $start = mktime((int) $_POST['start_Hour'], (int) $_POST['start_Minute'], 0, (int) $start_date[0], (int) $start_date[1], (int) $start_date[2]);
        $end = mktime((int) $_POST['end_Hour'], (int) $_POST['end_Minute'], 0, (int) $end_date[0], (int) $end_date[1], (int) $end_date[2]);
        $fifteen_min = 15 * 60;
        if ($end - $start < $fifteen_min) {
            $end = $end + $fifteen_min;
        }
        if (count($start_date) == 3 && count($end_date) == 3 && trim($_POST['title']) != '') {
            if ($start >= $end) {
                $tmp = $start;
Exemple #8
0
<?php

$entry = $db->selectOneRow($tbl, "*", "`calendarid`=" . $calendarid);
$breadcrumbs->addElement(makeDate($day), makeURL($mod, array('day' => $day, 'view' => $view)));
$breadcrumbs->addElement($entry['title'], makeURL($mod, array('mode' => 'view', 'day' => $day, 'view' => $view, 'calendarid' => $calendarid)));
$entry['start'] = makeDate($entry['start']) . " " . makeTime($entry['start']);
$entry['end'] = makeDate($entry['end']) . " " . makeTime($entry['end']);
$entry['visible'] = visibilityToString($entry['visible']);
$entry['description'] = $bbcode->parse($entry['description']);
$smarty->assign('entry', $entry);
$smarty->assign('path', $template_dir . "/view_entry.tpl");
if ($entry['userid'] == $login->currentUserID() or $isallowed) {
    $menu->addSubElement($mod, $lang->get('edit_calendar_entry'), 'edit', array('calendarid' => $calendarid));
}
Exemple #9
0
<?php

global $current_language;
$range = isset($_GET['range']) ? (int) $_GET['range'] : 14;
if ($login->currentUser() !== false) {
    $list = $db->selectList($tbl, "*", "`end`>" . $day . " AND ( (`visible` = 2 ) OR (`visible` = 0 AND `userid` = " . $login->currentUserID() . ") OR ( `visible` = 1) )\r\n\t\t\tAND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", $range);
} else {
    $list = $db->selectList($tbl, "*", "(`end`>" . $day . " AND `visible` = 2)\r\n\t\t\t AND (`language` = '' OR `language` = '" . $current_language . "')", "`start` ASC", "{$range}");
}
if (count($list) > 0) {
    foreach ($list as $i => $l) {
        $list[$i]['day'] = makeDate($l['start']);
        $list[$i]['time'] = makeTime($l['start']);
        $list[$i]['url'] = makeURL($mod, array('day' => $day, 'calendarid' => $l['calendarid'], 'mode' => 'view'));
        if (date('j', $l['start']) != date('j', $l['end'])) {
            $list[$i]['day_end'] = makeDate($l['end']);
        }
        $list[$i]['time_end'] = makeTime($l['end']);
    }
}
$smarty->assign('entries', $list);
$smarty->assign('path', $template_dir . "/view_next.tpl");
Exemple #10
0
        $id = $row->id;
        $solution_id = $row->solution_id;
        $revision_id = $row->revision_id;
        $comment = $row->comment;
        $content = $row->content;
        $writeDateMsg = makeDate($row->datum);
        $writeAuthor = $row->author;
        $categoryName = $tree->getPath($currentCategory, ' &raquo; ', true);
        logViews($id, $lang);
    } else {
        $id = $row->id;
        $solution_id = '';
        $revision_id = '';
        $comment = 'n';
        $content = $PMF_LANG['err_inactiveArticle'];
        $writeDateMsg = makeDate($row->datum);
        $writeAuthor = $row->author;
        $categoryName = $tree->getPath($currentCategory, ' &raquo; ', true);
    }
} else {
    $id = 0;
    $solution_id = '0000';
    $revision_id = '0';
    $comment = 'n';
    $content = $PMF_LANG['err_inactiveArticle'];
    $writeDateMsg = 'n/a';
    $writeAuthor = 'n/a';
    $categoryName = $tree->getPath($currentCategory, ' &raquo; ', true);
}
$printMsg = sprintf('<a href="#" onclick="javascript:window.print();">%s</a>', $PMF_LANG['msgPrintArticle']);
$writePDF = sprintf('<a target="_blank" href="pdf.php?cat=%d&amp;id=%d&amp;lang=%s">%s</a>', $currentCategory, $id, $lang, $PMF_LANG['msgPDF']);
{
    if (!is_array($elem)) {
        $elem = htmlentities($elem, ENT_QUOTES, "UTF-8");
    } else {
        foreach ($elem as $key => $value) {
            $elem[$key] = $this->clean($value);
        }
    }
    return $elem;
}
$where = "";
$orderby = "xdate";
if ($_GET) {
    $_CLEAN['GET'] = clean($_GET);
    $date_from = htmlspecialchars(makeDate($_CLEAN['GET']['date-from']));
    $date_to = htmlspecialchars(makeDate($_CLEAN['GET']['date-to']));
    $orderId = htmlspecialchars($_CLEAN['GET']['orderId']);
    //TODO: make sure to is not before from - can be jquery validation
    $where = "xdate between '" . $date_from . "' AND '" . $date_to . "'";
    if ($orderId) {
        $where = "xourpo = '" . $orderId . "'";
    }
    //header("Location: http://localhost/var/etl/bin/categories/tool/assign1.html");
    //echo "submitted.";
}
echo $where;
include '../classes/PaInvoice.class.inc';
$dbobject = new PaInvoice();
$data = $dbobject->getData($where, $orderby);
$errors = $dbobject->getErrors();
if (!empty($errors)) {
Exemple #12
0
 function mapEvent($event)
 {
     return array('summary' => $event->getSummary(), 'start' => makeDate($event->getStart()), 'end' => makeDate($event->getEnd()), 'description' => $event->getDescription(), 'link' => $event->getHtmlLink());
 }
Exemple #13
0
        print $PMF_LANG["ad_news_headline"];
        ?>
</th>
            <th class="list"><?php 
        print $PMF_LANG["ad_news_date"];
        ?>
</th>
            <th class="list">&nbsp;</th>
        </tr>
    </thead>
    <tbody>
<?php 
        $result = $db->query("select id, datum, header from " . SQLPREFIX . "faqnews order by datum desc");
        if ($db->num_rows($result) > 0) {
            while ($row = $db->fetch_object($result)) {
                $datum = makeDate($row->datum);
                ?>
        <tr>
            <td class="list"><?php 
                print $row->header;
                ?>
</td>
            <td class="list"><?php 
                print $datum;
                ?>
</td>
            <td class="list"><a href="<?php 
                print $_SERVER["PHP_SELF"] . $linkext;
                ?>
&amp;aktion=news&amp;do=edit&amp;id=<?php 
                print $row->id;
Exemple #14
0
$pdf->SetCreator($PMF_CONF["title"]);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont("Arial", "", 12);
$pdf->SetDisplayMode("real");
$pdf->WriteHTML(str_replace("../", "", $content));
$pdf->Ln();
$pdf->Ln();
$pdf->SetStyle('I', true);
$pdf->Write(5, unhtmlentities($PMF_LANG['ad_entry_solution_id']) . ': #' . $solution_id);
$pdf->SetAuthor($author);
$pdf->Ln();
$pdf->Write(5, unhtmlentities($PMF_LANG["msgAuthor"]) . $author);
$pdf->SetAuthor($author);
$pdf->Ln();
$pdf->Write(5, unhtmlentities($PMF_LANG["msgLastUpdateArticle"]) . makeDate($date));
$pdf->SetStyle('I', false);
$pdfFile = "pdf/" . $id . ".pdf";
$pdf->Output($pdfFile);
$file = basename($pdfFile);
$size = filesize($pdfFile);
session_cache_limiter('private');
header("Pragma: public");
header("Expires: 0");
// set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])) {
    header("Content-type: application/pdf");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . filesize($pdfFile));
    header("Content-Disposition: Attachment; filename=" . $id . ".pdf");
Exemple #15
0
        }
        $content = $_POST['content'];
        ?>
    <h3><strong><em><?php 
        print $categorylist;
        ?>
</em>
    <?php 
        print $_POST["thema"];
        ?>
</strong></h3>
    <?php 
        print $content;
        ?>
    <p class="little"><?php 
        print $PMF_LANG["msgLastUpdateArticle"] . makeDate(date("YmdHis"));
        ?>
<br />
    <?php 
        print $PMF_LANG["msgAuthor"] . ' ' . $_REQUEST["author"];
        ?>
</p>

    <form action="<?php 
        print $_SERVER["PHP_SELF"] . $linkext;
        ?>
&amp;aktion=editpreview" method="post">
    <input type="hidden" name="id"       value="<?php 
        print $id;
        ?>
" />
Exemple #16
0
function makeDateRange($ts_start, $ts_end)
{
    global $lang;
    return makeDate($ts_start) . ' ' . $lang->get('to') . ' ' . makeDate($ts_end);
}
            print $PMF_LANG["ad_entry_theme"];
            ?>
</th>
            <th class="list"><?php 
            print $PMF_LANG["ad_gen_delete"];
            ?>
?</th>
        </tr>
    </thead>
    <tbody>
<?php 
            while ($row = $db->fetch_object($result)) {
                ?>
        <tr>
            <td class="list"><?php 
                print makeDate($row->ask_date);
                ?>
<br /><a href="mailto:<?php 
                print $row->ask_usermail;
                ?>
"><?php 
                print $row->ask_username;
                ?>
</a></td>
            <td class="list"><?php 
                print $tree->categoryName[$row->ask_rubrik]["name"] . ":<br />" . $row->ask_content;
                ?>
</td>
            <td class="list"><a href="<?php 
                print $_SERVER["PHP_SELF"] . $linkext;
                ?>