本文整理汇总了PHP中F3::set方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::set方法的具体用法?PHP F3::set怎么用?PHP F3::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F3
的用法示例。
在下文中一共展示了F3::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_venue_data_from_POST
function set_venue_data_from_POST()
{
F3::set('name', F3::scrub($_POST['name']));
F3::set('address', F3::scrub($_POST['address']));
F3::set('postcode', F3::scrub($_POST['postcode']));
F3::set('info', F3::scrub($_POST['info']));
}
示例2: login
function login()
{
$user = new Axon('tbl_user');
$id = F3::get('POST.id');
if ($user->found(array("id=:id", array(":id" => $id))) == 0) {
// Register user
$user->id = $id;
$user->username = F3::get('POST.username');
$user->email = F3::get('POST.email');
$user->fullname = F3::get('POST.fullname');
$user->image = F3::get('POST.image');
$user->save();
} else {
$user->load(array("id=:id", array(":id" => $id)));
if ($user->active == 'n') {
die(json_encode(array("message" => "hello world", "type" => "error")));
} else {
$user->username = F3::get('POST.username');
$user->email = F3::get('POST.email');
$user->fullname = F3::get('POST.fullname');
$user->image = F3::get('POST.image');
$user->save();
}
F3::set('SESSION.user', $user);
F3::set('SESSION.sid', Snippets::_getRN());
}
}
示例3: yukle
function yukle($hedef = NULL, $alan = 'file')
{
$yuklenen = F3::get("FILES.{$alan}.tmp_name");
// hedef ve yüklenen dosyanın boş olmasına izin veriyoruz
// herhangi biri boşsa mesele yok, çağırana dön
if (empty($hedef) || empty($yuklenen)) {
return true;
}
// bu bir uploaded dosya olmalı, fake dosyalara izin yok
if (is_uploaded_file($yuklenen)) {
// boyutu sınırla, değeri öylesine seçtim
if (filesize($yuklenen) > 600000) {
F3::set('error', 'Resim çok büyük');
} else {
if (exif_imagetype($yuklenen) != IMAGETYPE_JPEG) {
F3::set('error', 'Resim JPEG değil');
} else {
if (file_exists($hedef)) {
F3::set('error', 'Resim zaten kaydedilmiş');
} else {
if (!move_uploaded_file($yuklenen, $hedef)) {
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;
}
示例4: list_saved_form
public function list_saved_form()
{
F3::set('data', 'daved data on the row');
$user = F3::get("SESSION.onlineUser");
$datas = DB::sql("select v.id,v.form_type,v.date,u.username from vehicle v, user_form u where u.vehicle_id=v.id and v.status ='saved' and u.username='" . $user . "'");
F3::set('data', $datas);
}
示例5: get
public function get()
{
if ($this->flag['search']) {
if (isset($_GET['q']) && $_GET['q'] != '') {
// Fetch Search Query
$query = F3::scrub($_GET['q']);
$search = new SearchModel();
// Fetch Search Results
if ($this->results = $search->items($query)) {
// Reroute if one match
if (count($this->results) == 1 && $this->redirect) {
F3::reroute('/loot/' . $this->results[0]['urlname']);
}
$this->title = "Search: \"" . $query . "\" - Diablo 2 Database";
$this->heading = "Search: \"" . $query . "\"";
F3::set('NOTIFY.success', "Rejoice! " . count($this->results) . " matches found!");
$this->render('search.php');
} else {
$this->heading = "Search: \"" . $query . "\"";
F3::set('NOTIFY.warning', "Nothing found in the database. Try the <a href=/loot/>Loot Directory</a>.");
$this->render('blank.php');
}
} else {
F3::reroute('/');
}
} else {
F3::set('NOTIFY.warning', "Search is temporarily disabled. Please try again later.");
$this->render('blank.php');
}
}
示例6: myldap_bind
function myldap_bind()
{
$r = ldap_bind(F3::get('LDAP.conn'), F3::get('LDAP.admin'), F3::get('LDAP.passw'));
if (!$r) {
trigger_error("LDAP bind failed...", E_WARNING);
}
F3::set('LDAP.bind', $r);
return $r;
}
示例7: main
function main()
{
F3::set('name', 'world');
F3::set('buddy', array('Tom', 'Dick', 'Harry'));
F3::set('gender', 'M');
F3::set('loggedin', 'true');
F3::set('div', array('coffee' => array('arabica', 'barako', 'liberica', 'kopiluwak'), 'tea' => array('darjeeling', 'pekoe', 'samovar')));
F3::set('rows', array(1, 2, 3, 4, 5));
echo F3::serve('5template.htm');
}
示例8: relations
public function relations()
{
// Select magic + class + division
$division = "\n SELECT class, division\n FROM relate_loot_normal\n ";
foreach (F3::sql($division) as $row) {
F3::set('class', F3::get('DB.pdo')->quote($row['class']));
F3::set('division', F3::get('DB.pdo')->quote($row['division']));
$query = "\n UPDATE loot\n SET division = {@division}\n WHERE class = {@class}\n ";
F3::sql($query);
}
}
示例9: captcha
/**
Generate CAPTCHA image
@param $dimx integer
@param $dimy integer
@param $len integer
@param $ttfs string
@param $var string
@param $die boolean
@public
**/
static function captcha($dimx = 150, $dimy = 50, $len = 5, $ttfs = 'cube', $var = 'captcha', $die = TRUE)
{
$base = self::rgb(self::$vars['BGCOLOR']);
$trans = self::$vars['FGTRANS'];
// Specify Captcha seed
$seed = substr(md5(uniqid()), 0, $len);
F3::set('SESSION.' . $var, $seed);
// Font size
$size = 0.9 * min($dimx / $len, $dimy);
// Load TrueType fonts
$fonts = self::split($ttfs);
$file = self::$vars['FONTS'] . self::fixslashes($fonts[array_rand($fonts)]) . '.ttf';
$stats =& self::ref('STATS');
if (!isset($stats['FILES'])) {
$stats['FILES'] = array('fonts' => array());
}
$stats['FILES']['fonts'][basename($file)] = filesize($file);
$maxdeg = 12;
// Create blank image
$captcha = imagecreatetruecolor($dimx, $dimy);
list($r, $g, $b) = $base;
$bg = imagecolorallocate($captcha, $r, $g, $b);
imagefill($captcha, 0, 0, $bg);
$width = 0;
// Insert each Captcha character
for ($i = 0; $i < $len; $i++) {
// Random angle
$angle = $maxdeg - mt_rand(0, $maxdeg * 2);
// Get CAPTCHA character from session cookie
$char = $seed[$i];
$fg = imagecolorallocatealpha($captcha, mt_rand(0, 255 - $trans), mt_rand(0, 255 - $trans), mt_rand(0, 255 - $trans), $trans);
// Compute bounding box metrics
$bbox = imagettfbbox($size, 0, $file, $char);
$w = max($bbox[2], $bbox[4]) - max($bbox[0], $bbox[6]);
$h = max($bbox[1], $bbox[3]) - max($bbox[5], $bbox[7]);
$sin = sin(deg2rad($angle));
imagettftext($captcha, $size, $angle, 0.9 * $width + abs($h * $sin), $dimy - $h / 2 + abs($w * $sin), $fg, $file, $char);
$width += $w + abs($h * $sin);
imagecolordeallocate($captcha, $fg);
}
// Make the background transparent
imagecolortransparent($captcha, $bg);
// Send output as PNG image
if (PHP_SAPI != 'cli' && !headers_sent()) {
header(self::HTTP_Content . ': image/png');
header(self::HTTP_Powered . ': ' . self::TEXT_AppName . ' ' . '(' . self::TEXT_AppURL . ')');
}
imagepng($captcha, NULL, self::PNG_Compress, PNG_NO_FILTER);
if ($die) {
die;
}
}
示例10: captcha
function captcha()
{
// Validate CAPTCHA verification code; if any
F3::input('captcha', function ($value) {
if (!F3::exists('message') && F3::exists('SESSION.captcha')) {
$captcha = F3::get('SESSION.captcha');
if (empty($value)) {
F3::set('message', 'Verification code required');
} elseif (strlen($value) > strlen($captcha)) {
F3::set('message', 'Verification code is too long');
} elseif (strtolower($value) != $captcha) {
F3::set('message', 'Invalid verification code');
}
}
});
}
示例11: soyad
function soyad()
{
// Validate blog soyad
F3::input('soyad', function ($value) {
if (!F3::exists('message')) {
if (empty($value)) {
F3::set('message', 'Soyad should not be blank');
} elseif (strlen($value) > 127) {
F3::set('message', 'Soyad is too long');
} elseif (strlen($value) < 3) {
F3::set('message', 'Soyad is too short');
}
}
// Do post-processing of soyad here
F3::set('REQUEST.soyad', ucfirst($value));
});
}
示例12: get
public function get()
{
$loot = new LootModel();
// Check for JSON
if (isset($_GET['format'])) {
if ($_GET['format'] == "json") {
$this->json = true;
}
}
// URL Item Token
$urlname = F3::get('PARAMS.item');
// Fetch Item
$this->item = $this->json ? $loot->item($urlname) : json_decode($loot->item($urlname));
// Fetch Similar
if (!empty($this->item->similar)) {
foreach ($this->item->similar as $similar) {
$this->similar[] = json_decode($loot->item($similar->urlname, array("verbose" => false)));
}
}
// Fetch Variants
if (!empty($this->item->variants)) {
foreach ($this->item->variants as $variant) {
$this->variants[] = json_decode($loot->item($variant->urlname, array("verbose" => false)));
}
}
// Fetch Siblings
if (!empty($this->item->siblings)) {
foreach ($this->item->siblings as $sibling) {
$this->siblings[] = json_decode($loot->item($sibling->urlname, array("verbose" => false)));
}
}
$this->navigation['/loot/']['selected'] = true;
if ($this->item) {
if ($this->json) {
$this->title = $this->item['name'] . " - Diablo 2 Database";
$this->render('lootjson.php', false);
} else {
$this->title = $this->item->name . " - Diablo 2 Database";
$this->render('loot.php');
}
} else {
F3::set('NOTIFY.error', "Mysterious... this item doesn't seem to be in our database.");
$this->render('blank.php');
}
}
示例13: recentActivity
function recentActivity()
{
$poll = new Axon('tbl_poll');
$polls = array();
$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');
$poll->def('date', 'SELECT date FROM tbl_vote WHERE tbl_poll.id=tbl_vote.poll_id ORDER BY date DESC LIMIT 1');
$q = $poll->find('published_date IS NOT NULL AND is_archive="n" AND expiry_date>now() AND private="n"', 'date DESC');
foreach ($q as $pl) {
$polls[$pl->id] = array(strtoupper($pl->keyword), $pl->question, '<img src="' . $pl->image . '" width="20px" height="20px" /> ' . $pl->fullname);
}
$this->set('pollList', $polls);
$this->set('title', 'Recent Activity');
F3::set('heading', 'Recent Activity');
F3::set('template', 'polls');
echo Template::serve("template/layout.htm");
}
示例14: setDefault
/**
Auto-detect default locale; Override parent class
@return boolean
@param $_lang string
@public
**/
public static function setDefault($_lang = NULL)
{
if (!$_lang) {
$_header = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
if (F3::exists('LANGUAGE')) {
// Framework variable defined
$_lang = F3::get('LANGUAGE');
} elseif (isset($_header)) {
// Found in HTTP header
$_lang = self::acceptFromHttp($_header);
} else {
// Use default_locale
$_lang = self::getDefault();
}
}
// Set default language
$_ok = parent::setDefault($_lang);
if ($_ok) {
F3::set('LANGUAGE', $_lang);
self::$dict = array();
}
return $_ok;
}
示例15: allPoll
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');
}