示例#1
0
文件: app.php 项目: pshreez/PHP
 function test()
 {
     echo $_SERVER['SERVER_PORT'];
     $user = new Axon('tbl_user');
     $user->load(array("id=:id", array(":id" => 1537994726)));
     $this->set('SESSION.user', $user);
     $this->set('SESSION.sid', Snippets::_getRN());
 }
示例#2
0
文件: user.php 项目: pshreez/PHP
 function toggleActive()
 {
     $id = F3::get("PARAMS.id");
     $user = new Axon('tbl_user');
     $user->load(array("id=:id", array(":id" => $id)));
     $user->active = $user->active == 'y' ? 'n' : 'y';
     $user->save();
     F3::reroute('/admin/user');
 }
示例#3
0
文件: AdminLog.php 项目: pshreez/PHP
 public static function add($vehicle, $form_type, $status)
 {
     $log = new Axon('admin_log');
     $log->date = date("Y-m-d H:i:s");
     $log->admin_username = F3::get('SESSION.username');
     //admin id
     $log->vehicle_no = $vehicle;
     $log->status = $status;
     $log->form_type = $form_type;
     $log->save();
 }
示例#4
0
文件: report.php 项目: pshreez/PHP
 function lst()
 {
     $user = new Axon('tbl_user');
     $report = array();
     $user->def("hits", "SELECT COUNT(date) FROM tbl_vote, tbl_poll WHERE date between '" . F3::get("POST.from") . "' and '" . F3::get("POST.to") . "'" . (F3::get("POST.telco") ? " and telco='" . F3::get("POST.telco") . "'" : "") . " and tbl_poll.id=tbl_vote.poll_id and tbl_poll.user_id=tbl_user.id group by tbl_user.id");
     if ($user->found() > 0) {
         $report_list = $user->find();
         foreach ($report_list as $rl) {
             $report[] = array('<img src="' . $rl->image . '" width="20px" height="20px" /> ' . $rl->fullname, $rl->hits ? $rl->hits : 0);
         }
     }
     $this->set('report', $report);
     echo Template::serve("template/admin/report_list.htm");
 }
示例#5
0
文件: feedback.php 项目: pshreez/PHP
 function transfer_feedback()
 {
     $id = F3::get("PARAMS.id");
     $vehicle = new Axon("vehicle");
     $vehicle->load(array('id=:id', array(':id' => $id)));
     $zone_id = $vehicle->zone_id;
     $wheeler = $vehicle->wheeler;
     $dates = $vehicle->date;
     $date = DB::sql("SELECT DATE_ADD( date, INTERVAL 15 DAY ) AS ds FROM vehicle WHERE id='{$id}' and date='{$dates}'");
     $dt = new Form_elements();
     $nepDate = $dt->dateConvertEn($date[0]["ds"]);
     // var_dump($date[0]["ds"]);die;
     //echo $nepDate;die;
     $zone = Admin::getZone($vehicle->zone_id);
     $symbol = Admin::getSymbolType($vehicle->vehicle_symbol_type);
     $vehicleNo = $zone . $vehicle->lot_number . $symbol . $vehicle->number;
     $zone = new Axon("zonal_office");
     if ($zone->found(array('zone_id=:id and wheeler=:vid', array(':id' => $zone_id, ':vid' => $wheeler))) > 0) {
         $zone->load(array('zone_id=:id and wheeler=:vid', array(':id' => $zone_id, ':vid' => $wheeler)));
         $photos = new Axon("owner_photo");
         if ($photos->found(array('vehicle_id =:id', array(':id' => $id)))) {
             $photos->load(array('vehicle_id =:id', array(':id' => $id)));
             F3::set('pic', $photos);
         } else {
             F3::set('pic', 'no photo available');
         }
         F3::set('date', $nepDate);
         F3::set('refer', $id);
         F3::set('vehicle', $vehicleNo);
         F3::set('value', $zone->name);
         F3::set('navUser', 'userNav');
         F3::set('template', 'feedbacktransfer');
         echo Template::serve("template/layout.html");
     } else {
         $photos = new Axon("owner_photo");
         if ($photos->found(array('vehicle_id =:id', array(':id' => $id)))) {
             $photos->load(array('vehicle_id =:id', array(':id' => $id)));
             F3::set('pic', $photos);
         } else {
             F3::set('pic', 'no photo available');
         }
         F3::set('date', $nepDate);
         F3::set('refer', $id);
         F3::set('navUser', 'userNav');
         F3::set('value', 'no office available');
         F3::set('template', 'feedbacktransfer');
         echo Template::serve("template/layout.html");
     }
 }
示例#6
0
文件: picture.php 项目: pshreez/PHP
 function pictureFolder($id = 4)
 {
     echo 123;
     //var_dump($_FILES);die;
     $filename = $id;
     // die(F3::get('FILES.uploadfile.tmp_name'));
     $path = "photo/";
     if (move_uploaded_file(F3::get('FILES.uploadfile.tmp_name'), $path . $filename . ".jpg")) {
         $picture = new Axon("owner_photo");
         $picture->picture = $filename;
         $picture->save();
     } else {
         echo "there weas an error";
     }
 }
示例#7
0
文件: auth.php 项目: eeejayg/F5UXP
 /**
 		Authenticate against SQL database;
 			AUTH global array elements:
 				db:<database-id> (default:'DB'),
 				table:<table-name>,
 				id:<userID-field>,
 				pw:<password-field>
 			@return mixed
 			@param $id string
 			@param $pw string
 			@public
 	**/
 static function sql($id, $pw)
 {
     $auth =& self::$vars['AUTH'];
     foreach (array('table', 'id', 'pw') as $param) {
         if (!isset($auth[$param])) {
             trigger_error(self::TEXT_AuthSetup);
             return FALSE;
         }
     }
     if (!isset($auth['db'])) {
         $auth['db'] = self::ref('DB');
     }
     $axon = new Axon($auth['table'], self::ref('AUTH.db'));
     $axon->load(array(self::ref('AUTH.id') . '=:id AND ' . self::ref('AUTH.pw') . '=:pw', array(':id' => $id, ':pw' => $pw)));
     return $axon->dry() ? FALSE : $axon;
 }
示例#8
0
 /**
 		Authenticate against SQL database;
 			AUTH global array elements:
 				db:<SQL-database> (default:'DB'),
 				table:<table-name>,
 				id:<userID-field>,
 				pw:<password-field>
 			@return mixed
 			@param $id string
 			@param $pw string
 			@public
 	**/
 static function sql($id, $pw)
 {
     $auth = self::$vars['AUTH'];
     foreach (array('table', 'id', 'pw') as $param) {
         if (!isset($auth[$param])) {
             trigger_error(self::TEXT_AuthSetup);
             return FALSE;
         }
     }
     if (!isset($auth['db'])) {
         $auth['db'] = self::ref('DB');
     }
     $axon = new Axon($auth['table'], $auth['db']);
     $axon->load('{{@AUTH.id}}="' . $id . '" AND {{@AUTH.pw}}="' . $pw . '"');
     return $axon->dry() ? FALSE : $axon;
 }
示例#9
0
 function register_approve()
 {
     $username = F3::get("POST.username");
     $password = F3::get("POST.password");
     $fullname = F3::get("POST.fullname");
     $user = new Axon('online_user');
     if (!$user->found(array('username=:username', array(':username' => $username))) == 1) {
         $sql[] = "INSERT into online_user (username,password,fullname) VALUES('{$username}','{$password}','{$fullname}')";
         DB::SQL($sql);
         F3::set('registered', 'You have been registered ,log into your account' . "  " . "<a href='{{@BASE}}' style='color:red;text-decoration:none'>login</a>");
         $this->register();
     } else {
         F3::set('userExist', 'User already exist');
         $this->register();
     }
 }
示例#10
0
文件: zone.php 项目: pshreez/PHP
 function getVdc()
 {
     //die(var_dump($this->get('PARAMS')));
     $district_name = $this->get('PARAMS.district_id');
     $content = $this->get('PARAMS.term');
     $district = new Axon('district');
     $district->load(array('name=:n', array(':n' => $district_name)));
     $district_id = $district->id;
     $vdc = new Axon('vdc_list');
     $vdc_list = $vdc->find(array("district_id=:did and name regexp '{$content}'", array(':did' => $district_id)));
     $return_vdcs = array();
     foreach ($vdc_list as $vl) {
         $return_vdcs[] = $vl->name;
     }
     echo json_encode($return_vdcs);
 }
示例#11
0
文件: infoPoll.php 项目: pshreez/PHP
 function all()
 {
     $poll = new Axon('tbl_poll');
     //  echo 123;die;
     // $this->set('title', 'Quizzes');
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find('published_date IS NOT NULL AND is_archive="n" AND expiry_date>now() AND private="n"');
     $polls = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" /> ' . $qu->fullname);
     }
     $this->set('title', 'All polls');
     $this->set('pollList', $polls);
     $this->set('template', 'all');
     echo Template::serve("template/layout.htm");
 }
示例#12
0
文件: admin.php 项目: pshreez/PHP
 function allPoll()
 {
     if (!F3::get('SESSION.asid')) {
         F3:
         reroute('/admin');
     }
     $poll = new Axon("tbl_poll");
     $poll->def('fullname', 'SELECT fullname FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('image', 'SELECT image FROM tbl_user WHERE tbl_poll.user_id=tbl_user.id');
     $poll->def('hits', 'SELECT COUNT(date) FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id');
     $q = $poll->find();
     $users = array();
     foreach ($q as $qu) {
         $polls[$qu->id] = array(strtoupper($qu->keyword), $qu->question, '<img src="' . $qu->image . '" width="20px" height="20px" />' . $qu->fullname, date_create("now") >= date_create($qu->expiry_date) ? "Yes" : "No", $qu->published_date ? "Yes" : "No", $qu->published_date && date_create("now") < date_create($qu->expiry_date) && $qu->is_archive == "n" ? "Yes" : "No", $qu->private == 'y' ? "Private" : "Public", $qu->hits);
         if (!in_array($qu->fullname, $users)) {
             $users[] = $qu->fullname;
         }
     }
     F3::set('pollList', $polls);
     F3::set('users', $users);
     F3::set('template', 'poll');
     echo Template::Serve('template/admin/layout.htm');
 }
示例#13
0
<?php

// Reset previous error message, if any
F3::clear('message');
// Form field validation
F3::call(':common');
if (!F3::exists('message')) {
    // No input errors; add record to database
    $blog = new Axon('kul');
    $blog->copyFrom('REQUEST');
    $blog->save();
    // Return to home page; new blog entry should now be there
    F3::reroute('/');
    /*$payload = json_encode(array(F3::get('REQUEST.title'), F3::get('REQUEST.entry')));
    	F3::reroute('http://192.168.140.86/receiver.php?payload=' . $payload );*/
}
// Display the blog form again
F3::call(':createkul');
示例#14
0
文件: cikti.php 项目: seyyah/uzkay
        $pdf->Cell(0, 5, $kesim, 0, 1, 'L');
        $pdf->SetFont('dejavusans', '', 10);
        foreach ($bilgi as $alan => $baslik) {
            $deger = $kul->{$alan};
            $pdf->MultiCell(30, 1, $baslik . ':', 0, 'L', 0, 0, '25', '', true);
            $pdf->MultiCell(180, 1, $deger, 0, 'L', 0, 0, '', '', true);
            $pdf->Ln(5);
        }
        $pdf->Ln(5);
    }
    $pdf->Ln(15);
    $pdf->Cell(0, 5, "Yukarıda vermiş olduğum bilgilerin doğruluğunu kabul ediyorum.", 0, 1, 'T');
    $pdf->Ln(5);
    $pdf->MultiCell(50, 1, 'Tarih:', 0, 'L', 0, 1, '120', '', true);
    $pdf->MultiCell(50, 1, 'Ad Soyad:', 0, 'L', 0, 1, '120', '', true);
    $pdf->MultiCell(50, 1, 'İmza:', 0, 'L', 0, 1, '120', '', true);
    $pdf->Output();
}
//$tc = F3::get('PARAMS.tc');
$tc = F3::get('SESSION.tc');
if (preg_match('/^\\d{11}$/', $tc)) {
    $kul = new Axon('kul');
    $kul->load("tc={$tc}");
    if (!$kul->dry()) {
        pdf($kul);
    } else {
        F3::set('error', "{$tc} nolu bir kayıt yok");
    }
} else {
    echo "hatali istek";
}
示例#15
0
文件: kaydet.php 项目: seyyah/uzkay
                        F3::set('error', 'Dosya yükleme hatası');
                    }
                }
            }
        }
        // yok başka bir ihtimal!
    } else {
        // bu aslında bir atak işareti
        F3::set('error', 'Dosya geçerli bir yükleme değil');
    }
    return false;
}
// denetleme sırasında hata oluşmamışsa kayıt yapacağız
// hata olmadığını nereden anlıyoruz?  "error"a bakarak
if (!F3::exists('error')) {
    $kul = new Axon('kul');
    $kul->copyFrom('REQUEST');
    $kul->tarih = date("d-m-Y H:i");
    // artık elimizde temiz bir tc no var, resmi kaydedelim
    // ilk kurulum sırasında bu <uploaddir> dizinini oluştur
    // php prosesi yazacağına göre izinleri doğru ayarla
    // 	chgrp -R www-data <uploaddir> && chmod g+w <uploaddir>
    $tc = $kul->tc;
    F3::set('tc', $tc);
    if (!empty($tc)) {
        $resim = F3::get('uploaddir') . $kul->tc . '.jpg';
        yukle($resim);
    }
    if (!F3::exists('error')) {
        // here we go!
        $kul->save();
示例#16
0
文件: user.php 项目: pshreez/PHP
 function pictureFolder($id)
 {
     $path = "photo/";
     if (move_uploaded_file(F3::get('FILES.uploadfile.tmp_name'), $path . $id . ".jpg")) {
         $picture = new Axon("owner_photo");
         $picture->vehicle_id = $id;
         $picture->picture = $id . ".jpg";
         $picture->save();
     } else {
         $id = 0;
     }
 }
示例#17
0
    if (isset($_SESSION['message'])) {
        F3::set('message', $_SESSION['message']);
        F3::set('extra_js', array('bootstrap-alert.js'));
        unset($_SESSION['message']);
    }
    F3::set('extra_css', array('settings.css'));
    echo Template::serve('templates/header.html');
    F3::set('page', 'general_settings');
    echo Template::serve('templates/settings.html');
    echo Template::serve('templates/footer.html');
    die;
});
F3::route('POST /settings/save', function () {
    $facebook = F3::get('Facebook');
    $uid = $facebook->getUser();
    if (!$uid) {
        _force_logout();
    }
    $user = new Axon('user');
    $user->load(array('fb_id=:fb_id', array(':fb_id' => $uid)));
    if ($user->dry()) {
        _force_logout();
    }
    $email_opt = F3::get('POST.email_opt') == 'on' ? TRUE : False;
    $user->email_opt = $email_opt;
    $user->save();
    $_SESSION['message'] = _create_alert_message('alert-success', 'Settings updated successfully!');
    F3::reroute('/settings/');
});
/****************************************************************************/
F3::run();
示例#18
0
文件: print.php 项目: pshreez/PHP
 function namsari($id)
 {
     $namsari = new Axon("namsari");
     if ($namsari->found(array("vehicle_id=:id", array(":id" => $id)))) {
         $namsari->load(array("vehicle_id=:id", array(":id" => $id)));
         echo 123;
         die;
     }
 }
示例#19
0
<?php

// Retrieve blog entries
$kul = new Axon('kul');
F3::set('entries', $kul->find());
// Use the home.htm template
F3::set('pagetitle', 'ana sayfa');
F3::set('template', 'home');
F3::call('render');
示例#20
0
<?php

// Reset previous error message, if any
F3::clear('message');
// Form field validation
F3::call(':common');
if (!F3::exists('message')) {
    // No input errors; update record
    $blog = new Axon('kul');
    $blog->load('tc="{@PARAMS.tc}"');
    $blog->copyFrom('REQUEST');
    $blog->save();
    // Return to home page
    F3::reroute('/');
}
// Display the blog form again
F3::call(':editkul');
示例#21
0
文件: db.php 项目: simonfork/phpmark
 /**
 		Custom session handler
 			@param $table string
 			@public
 	**/
 function session($table = 'sessions')
 {
     $self = $this;
     session_set_save_handler(function ($path, $name) use($self, $table) {
         // Support these engines
         $cmd = array('sqlite2?' => 'SELECT name FROM sqlite_master ' . 'WHERE type=\'table\' AND name=\'' . $table . '\';', 'mysql|mssql|sybase|dblib|pgsql' => 'SELECT table_name FROM information_schema.tables ' . 'WHERE ' . (preg_match('/pgsql/', $self->backend) ? 'table_catalog' : 'table_schema') . '=\'' . $self->dbname . '\' AND ' . 'table_name=\'' . $table . '\'');
         foreach ($cmd as $backend => $val) {
             if (preg_match('/' . $backend . '/', $self->backend)) {
                 break;
             }
         }
         $result = $self->exec($val, NULL);
         if (!$result) {
             // Create SQL table
             $self->exec('CREATE TABLE ' . (preg_match('/sqlite2?/', $self->backend) ? '' : $self->dbname . '.') . $table . ' (' . 'id VARCHAR(40),' . 'data LONGTEXT,' . 'stamp INTEGER' . ');');
         }
         register_shutdown_function('session_commit');
         return TRUE;
     }, function () {
         return TRUE;
     }, function ($id) use($table) {
         $axon = new Axon($table);
         $axon->load(array('id=:id', array(':id' => $id)));
         return $axon->dry() ? FALSE : $axon->data;
     }, function ($id, $data) use($table) {
         $axon = new Axon($table);
         $axon->load(array('id=:id', array(':id' => $id)));
         $axon->id = $id;
         $axon->data = $data;
         $axon->stamp = time();
         $axon->save();
         return TRUE;
     }, function ($id) use($table) {
         $axon = new Axon($table);
         $axon->erase(array('id=:id', array(':id' => $id)));
         return TRUE;
     }, function ($max) use($table) {
         $axon = new Axon($table);
         $axon->erase('stamp+' . $max . '<' . time());
         return TRUE;
     });
 }
示例#22
0
<?php

// Retrieve matching record
$kul = new Axon('kul');
$kul->load('tc="{@PARAMS.tc}"');
if (!$kul->dry()) {
    // Populate REQUEST global with retrieved values
    $kul->copyTo('REQUEST');
    // Render blog.htm template
    F3::set('pagetitle', 'Kullanıcıyı güncelle');
    F3::set('template', 'kul');
    F3::call('render');
} else {
    // Invalid blog entry; display our 404 page
    F3::http404();
}
示例#23
0
文件: operator.php 项目: pshreez/PHP
 function dismissNamsari()
 {
     if (!F3::get('SESSION.asid')) {
         F3::reroute("/admin");
     }
     $id = F3::get("PARAMS.id");
     $vrs = new Axon("vehicle");
     $vrs->load(array("id=:id", array(":id" => $id)));
     $zone = Admin::getZone($vrs->zone_id);
     $symbol = Admin::getSymbolType($vrs->vehicle_symbol_type);
     $vehicleNo = $zone . $vrs->lot_number . $symbol . $vrs->number;
     AdminLog::add($vehicleNo, $vrs->form_type, "dismissed");
     $vrs->erase();
     F3::reroute("/admin/ownershipTransfer/s");
 }
示例#24
0
文件: SavedForm.php 项目: pshreez/PHP
 function deleteForm()
 {
     if (!F3::get('SESSION.onlineUser')) {
         F3::reroute("/");
     }
     $id = F3::get("PARAMS.id");
     $vehicle = new Axon('vehicle');
     if ($vehicle->found(array('id =:id', array(':id' => $id)))) {
         $vehicle->load(array('id =:id', array(':id' => $id)));
         $vehicle->erase();
         F3::reroute('/');
     } else {
         F3::reroute('/');
     }
 }
示例#25
0
 function symbol_view($id)
 {
     $symbol = new Axon('type_symbol');
     $symbol->load(array('id=:id', array(':id' => $id)));
     F3::set('symbol', $symbol->name);
     // F3::set('zonecode',$color->code);
 }
示例#26
0
文件: sorguyap.php 项目: seyyah/uzkay
    $ne = "Tc No";
    if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'esit' => array(11, "{$ne} 11 haneli olmalıdır"), 'tamsayi' => array(true, "{$ne} sadece rakam içermeli"), 'ozel' => array(function ($value) {
        return !is_tc($value);
    }, "Geçerli bir {$ne} değil")))) {
        F3::set('error', $hata);
        return;
    }
});
F3::input($alan = 'kizliksoyad', function ($value) use($alan) {
    $ne = "Kızlık Soyadı";
    if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz")))) {
        F3::set('error', $hata);
        return;
    }
});
if (!F3::exists('error')) {
    $tc = F3::get('REQUEST.tc');
    $kizliksoyad = F3::get('REQUEST.kizliksoyad');
    $kul = new Axon('kul');
    $kul->load("tc={$tc}");
    if (!$kul->dry() && streq_turkish($kul->kizliksoyad, $kizliksoyad)) {
        // tc no'yu oturuma gömelim ve oradan alalım
        F3::set('SESSION.sorgutc', $tc);
        F3::set('SESSION.sorgukizliksoyad', $kizliksoyad);
        return F3::call(':sorguok');
    }
    F3::set('error', "Girdiğiniz bilgilere uygun bir kayıt bulunamadı.  Lütfen verdiğiniz bilgileri kontrol edin.");
}
// hata var, dön başa ve tekrar sorgu al.
// error alanı dolu ve layout.htm'de görüntülenecek
F3::call(':sorgual');
示例#27
0
文件: denetle.php 项目: seyyah/uzkay
    if ($hata = denetle(strtolower($value), array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'enaz' => array(strlen($captcha), "{$ne} çok kısa"), 'degeri' => array(strtolower($captcha), "Yanlış {$ne}")))) {
        F3::set('error', $hata);
        return;
    }
});
// ad ve soyad şart
foreach (array('ad', 'soyad') as $alan) {
    F3::input($alan, function ($value) use($alan) {
        $ne = ucfirst($alan);
        if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'enaz' => array(2, "{$ne} çok kısa"), 'enfazla' => array(127, "{$ne} çok uzun")))) {
            F3::set('error', $hata);
            return;
        }
        F3::set("REQUEST.{$alan}", ucfirst($value));
    });
}
// tc numara geçerli olmalı
F3::input($alan = 'tc', function ($value) use($alan) {
    $ne = "Tc No";
    if ($hata = denetle($value, array('dolu' => array(true, "{$ne} boş bırakılamaz"), 'esit' => array(11, "{$ne} 11 haneli olmalıdır"), 'tamsayi' => array(true, "{$ne} sadece rakam içermeli"), 'ozel' => array(function ($value) {
        return !is_tc($value);
    }, "Geçerli bir {$ne} değil")))) {
        F3::set('error', $hata);
        return;
    }
    $kul = new Axon('kul');
    if ($kul->found("tc={$value}")) {
        F3::set('error', "{$ne} {$value} daha önceden eklendi");
        return;
    }
});
示例#28
0
<?php

if (F3::get('SESSION.user')) {
    $kul = new Axon('kul');
    // Delete record from database
    $kul->load('tc="{@PARAMS.tc}"');
    $kul->erase();
    // Return to home page
    F3::reroute('/');
} else {
    // Render blog.htm template
    F3::set('pagetitle', 'Kullanıcıyı sil');
    F3::set('template', 'kul');
    F3::call('render');
}
示例#29
0
文件: printDoc.php 项目: pshreez/PHP
 function register_print()
 {
     $id = F3::get("PARAMS.id");
     $vehicle = F3::get("PARAMS.id");
     $data = new Axon("vehicle");
     $owner = new Axon("owner");
     if ($data->found(array('id=:id', array(':id' => $id))) && $owner->found(array('vehicleid =:id', array(':id' => $id)))) {
         // echo 123;
         $data->load(array('id=:id', array(':id' => $vehicle)));
         $owner->load(array('vehicleid =:id', array(':id' => $vehicle)));
         //  $namsari->load(array('vehicle_id =:id', array(':id' => $vehicle)));
         $zone_code = $id->zone_view($data->zone_id);
         // F3::set('code', $zone_code);
         $symbol_view = $id->symbol_view($data->vehicle_symbol_type);
         $owner_view = $id->owner_view($owner->owner_type);
         $p_zone_id = $id->zone_view($owner->p_zone_id);
         $temp_zone_id = $id->zone_view($owner->temp_zone_id);
         //  F3::set('zone', $p_zone_id);
         //$p_district_id = $id->district_view($data->p_district_id);
         // $temp_district_id = $id->district_view($data->temp_district_id);
         $nabalik_district = $id->district_view($data->nabalik_district);
         $creditor_district = $id->district_view($data->creditor_district);
         $per_district = $id->district_view($data->per_district);
         $owner->copyTo("POST");
         $data->copyTo("POST");
         $namsari->copyTo("POST");
         F3::set('date', $date);
         //  F3::set('nav', 'navigation');
         echo Template::serve("template/admin/registration_print.htm");
     }
 }
示例#30
0
文件: main.php 项目: nian2go/fatfree
 function axon()
 {
     $this->set('title', 'SQL/Axon');
     $this->expect(is_null($this->get('ERROR')), 'No errors expected at this point', 'ERROR variable is set: ' . $this->get('ERROR.text'));
     $this->set('DB', new DB('sqlite::memory:'));
     $this->expect(extension_loaded('pdo_sqlite'), 'SQLite PDO available', 'SQLite PDO is not active - unable to continue');
     if (extension_loaded('pdo_sqlite')) {
         DB::sql(array('DROP TABLE IF EXISTS products;', 'CREATE TABLE products (' . 'item INTEGER,' . 'description VARCHAR(255),' . 'quantity INTEGER,' . 'PRIMARY KEY (item)' . ');'));
         $product = new Axon('products');
         $this->expect(is_object($product), 'Axon created', 'Unable to instantiate Axon');
         unset($product);
         $product = Axon::instance('products');
         $this->expect(is_a($product, 'Axon'), 'Axon instance created', 'Unable to instantiate Axon');
         unset($product);
         $product = new axon('products');
         $this->expect(is_object($product), 'Axon created (case-insensitive)', 'Unable to instantiate Axon (case-insensitive)');
         $this->expect($product->dry(), 'Axon in dry state', 'Axon is in hydrated state');
         $product->item = 111;
         $product->description = 'Coca Cola';
         $product->quantity = 3;
         $this->expect(!$product->dry(), 'Axon hydrated manually', 'Axon should be hydrated by now');
         $product->save();
         $this->expect(!$product->dry(), 'Axon expected to remain hydrated', 'Axon should be dry');
         // MySQL always reports an _id of 0 if primary key
         // is not an auto-increment field
         $this->expect($product->_id, 'Last insert ID available; SQLite returns ' . $product->_id, 'No last insert ID available');
         $product->load(array('item=:item', array(':item' => 111)));
         $this->expect($product->item == 111 && $product->description == 'Coca Cola' && $product->quantity == 3, 'Auto-hydration succeeded (SQLite converts numbers to strings)', 'Auto-hydration failed');
         $result = $product->findOne(array('item=:item', array(':item' => 111)));
         $this->expect($result->item == 111 && $result->description == 'Coca Cola' && $result->quantity == 3, 'findOne returned the correct record', 'findOne return value is incorrect');
         $result = $product->find(array('item=:item', array(':item' => 111)));
         $this->expect(get_class($result[0]) == 'Axon' && $result[0]->item == 111 && $result[0]->description == 'Coca Cola' && $result[0]->quantity == 3, 'find returned an array of Axon objects', 'find return type is incorrect');
         $product->quantity++;
         $product->save();
         $product->load(array('item=:item', array(':item' => 111)));
         $this->expect($product->item == 111 && $product->description == 'Coca Cola' && $product->quantity == 4, 'Axon saved - database update succeeded', 'Database update failed');
         $product->copyTo('POST');
         $this->expect($this->get('POST.item') == 111 && $this->get('POST.description') == 'Coca Cola' && $this->get('POST.quantity') == 4, 'Axon properties copied to framework variable', 'Unable to copy Axon properties to framework variable');
         $_POST['description'] = 'Pepsi';
         $product->copyFrom('POST');
         $this->expect($product->item == 111 && $product->description == 'Pepsi' && $product->quantity == 4, 'Axon properties populated by framework variable', 'Unable to fill Axon properties with contents of framework variable');
         $this->set('POST.item', 999);
         $this->set('POST.description', 'Pepsi');
         $this->set('POST.quantity', 11);
         $product->copyFrom('POST', 'item|quantity');
         $this->expect($product->item == 999 && $product->description == 'Pepsi' && $product->quantity == 11, 'Axon properties populated by selected fields in framework variable', 'Unable to fill Axon properties with contents of framework variable');
         $product->reset();
         $this->expect($product->dry(), 'Axon reset completed', 'Axon should be dry');
         $product->item = 222;
         $product->description = 'Mobile Phone';
         $product->quantity = 9;
         $this->expect(!$product->dry(), 'Axon rehydrated manually', 'Axon should hydrated by now');
         $product->save();
         $this->expect(!$product->dry(), 'Axon expected to remain hydrated', 'Axon should not be dry');
         $product->load('item=111');
         $this->expect($product->item == 111 && $product->description == 'Coca Cola' && $product->quantity == 4, 'First record still there', 'First record is missing');
         $product->load('item=222');
         $this->expect($product->item == 222 && $product->description == 'Mobile Phone' && $product->quantity == 9, 'Second record found', 'Second record is missing');
         $product->def('total', 'SUM(quantity)');
         $this->expect($product->isdef('total') === TRUE, 'Virtual field created', 'Problem creating virtual field');
         $product->load();
         $this->expect($product->total == 13, 'Computed value of aggregate value using a virtual field works', 'Virtual field implementation faulty');
         $product->undef('total');
         $this->expect($product->isdef('total') === FALSE, 'Virtual field destroyed', 'Problem destroying virtual field');
         $product->load('item=111');
         $product->erase();
         $product->load('item=111');
         $this->expect($product->dry(), 'First record deleted', 'First record still exists');
         $product->load('item=222');
         $this->expect($product->item == 222 && $product->description == 'Mobile Phone' && $product->quantity == 9, 'Second record still there', 'Second record is missing');
         $product->reset();
         $product->item = 111;
         $product->description = 'Lots of dough';
         $product->quantity = 666;
         $product->save();
         $product->load('quantity>0');
         $this->expect($product->found() == 2, 'New record added - multirecord criteria specified for loading', 'New record was not added');
         $product->skip(1);
         $this->expect(!$product->dry(), 'One more record expected to be retrieved', 'Axon is dry');
         $this->expect($product->item == 222 && $product->description == 'Mobile Phone' && $product->quantity == 9, 'Forward navigation', 'Forward navigation failed');
         $product->skip(-1);
         $this->expect($product->item == 111 && $product->description == 'Lots of dough' && $product->quantity == 666, 'Backward navigation', 'Backward navigation failed');
         $product->skip(-1);
         $this->expect($product->dry(), 'Axon is dry when navigating before the start of the record set', 'Navigation failure');
         $this->set('QUIET', TRUE);
         $product->skip(-1);
         $this->expect(!is_null($this->get('ERROR')), 'Navigating past dry state triggers an error', 'Navigation error handling issue');
         $this->set('QUIET', FALSE);
         $this->clear('ERROR');
         $product->load('quantity>0');
         $product->skip(2);
         $this->expect($product->dry(), 'Axon is dry when navigating beyond the end of the record set', 'Navigation failure');
         $this->set('QUIET', TRUE);
         $product->skip();
         $this->expect(!is_null($this->get('ERROR')), 'Navigating past dry state triggers an error', 'Navigation error handling issue');
         $this->set('QUIET', FALSE);
         $this->clear('ERROR');
         $db = $this->get('DB');
         $result = $db->exec('SELECT * FROM products WHERE item=:item', array(':item' => 111));
         $this->expect($result[0]['item'] == 111 && $result[0]['description'] == 'Lots of dough' && $result[0]['quantity'] == 666, 'Late-binding of parameters to values in SQL statements', 'Late-binding issue encountered');
         $product->load('item=111');
         $product->description = 'quoted "string"';
         $product->save();
         $result = $product->findOne('item=111');
         $this->expect($result->description == 'quoted "string"', 'Double-quoted strings are left untouched', 'Double-quoted strings altered');
     }
     echo $this->render('basic/results.htm');
 }