Beispiel #1
0
<?php

/*-----------------------------------------------------*\

                  YOUR WEBSITE HERE

\*-----------------------------------------------------*/
// This website uses phpBF
require_once './core/lib/phpbf/framework.php';
BF::init();
$page = BF::gg(0);
if (!$page || $page == "index.php") {
    BF::gr(BF::gc('page_default'))->redirect();
    // try loading a template
} elseif (BF::gr("/tpl/" . $page . '.tpl')->exists()) {
    BF::load_module("BF_output_template");
    $tpl = new BF_output_template($page);
    $tpl->disp();
} else {
    throw new BF_not_found();
}
Beispiel #2
0
<?php

require_once './core/lib/phpbf/framework.php';
BF::init();
BF::load_model("car");
$id = BF::gg(0);
$action = BF::gg(1);
if ($action == "view") {
    $car = new car($id);
    if (!$car->exists()) {
        throw new BF_not_found();
    }
    BF::load_module("BF_output_template");
    $tpl = new BF_output_template("view_car");
    $tpl->assign('car', $car);
    $tpl->disp();
} elseif ($action == "save") {
    BF::load_module("BF_form");
    $form = new BF_form('edit_car');
    $car = new car($id);
    if (!$car->exists()) {
        throw new BF_not_found();
    }
    // check
    if (!$form->check()) {
        $form->show_error();
    }
    // process
    $car->name = $form->gval("name");
    $car->price = $form->gval("price");
    $car->save();
Beispiel #3
0
 /**
  * Get value from query string (either using GET or /-separated parameters)
  * @param	mixed	$key : Either string key of get param or int position of /-separated parameter
  * @param	mixed	$key2 : Second option if first key is not set
  * @return	mixed	Value at key or null if not set
  */
 public static function gg($key, $key2 = null)
 {
     if (is_int($key) && $key < 0) {
         $key = count(BF::$path_info_array) + $key;
     }
     if (is_int($key) && isset(BF::$path_info_array[$key])) {
         return BF::$path_info_array[$key];
     } elseif (is_string($key) && isset($_GET[$key])) {
         return $_GET[$key];
     } else {
         return $key2 === null ? null : BF::gg($key2);
     }
 }