本文整理汇总了PHP中sql::table方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::table方法的具体用法?PHP sql::table怎么用?PHP sql::table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installSlots
public function installSlots($update = false)
{
$slots = sql::factory();
$slots->setTable('slots');
$modul = sql::factory();
$modul->setTable('module');
foreach ($this->get('slots', []) as $name => $slot) {
$slotExists = $slots->num('SELECT id FROM ' . sql::table('slots') . ' WHERE `name` = "' . $name . '" AND `template` = "' . $this->name . '"');
if (!$update && $slotExists) {
continue;
}
$modul->addPost('name', $name);
$modul->addPost('input', $slot['input']);
$modul->addPost('output', $slot['output']);
if (!$slotExists) {
$modul->save();
$modul_id = $modul->insertId();
} else {
$modul->setWhere('name="' . $name . '"');
$modul->update();
$modul->result('SELECT id FROM ' . sql::table('module') . ' WHERE name = "' . $name . '"');
$modul_id = $modul->get('id');
}
$slots->addPost('name', $name);
$slots->addPost('description', $slot['description']);
$slots->addPost('template', $this->name);
$slots->addPost('modul', $modul_id);
if (!$slotExists) {
$slots->save();
} else {
$slots->setWhere('name="' . $name . '" AND template="' . $this->name . '"');
$slots->update();
}
}
}
示例2: __construct
function __construct($id)
{
$sql = new sql();
$sql->result("SELECT * FROM " . sql::table('server') . " WHERE id = '" . $id . "'");
$this->sql = $sql;
$this->id = $this->sql->get('id');
}
示例3: getByStructureId
public static function getByStructureId($id)
{
$return = [];
$classname = __CLASS__;
$sql = sql::factory();
$sql->query('
SELECT
a.*, m.output
FROM
' . sql::table('structure_area') . ' AS a
LEFT JOIN
' . sql::table('module') . ' AS m
ON
m.id = a.modul
WHERE
a.structure_id=' . $id . '
AND
a.online = 1
ORDER BY
a.sort')->result();
while ($sql->isNext()) {
$sql2 = clone $sql;
$return[] = new $classname($sql2);
$sql->next();
}
return $return;
}
示例4: registerUser
public static function registerUser()
{
$sql = sql::factory();
$sql->setTable('community_user');
$sql->getPosts(['username' => 'string', 'password' => 'string', 'email' => 'string']);
$validator = new validator();
$email = $sql->getPost('email');
$username = $sql->getPost('username');
$password = $sql->getPost('password');
$validUsername = $validator->costum($username, function () {
preg_match('/\\w{4,}/', $username, $match);
return $match[0] == $username;
});
if (!$validUsername) {
return 'Username darf nur aus Buchstaben Zahlen und Unterstrich bestehen und muss mindestens 4 Zeichen lang sein.';
}
if ($sql->num('SELECT id FROM ' . sql::table('community_user') . ' WHERE `username`= "' . $sql->escape($username) . '"')) {
return 'Benutzername schon vorhanden';
}
if (!$validator->email($email)) {
return 'Bitte geben Sie eine E-Mail Adresse an';
}
$salt = userLogin::generateSalt();
$sql->addDatePost('registerdate', 'now');
$sql->addPost('salt', $salt);
extension::get('COMMUNITY_USER_REGISTER', $sql);
$password = userLogin::hash($password, $salt);
$sql->addPost('password', $password);
$sql->save();
//Mail send
return true;
}
示例5: __construct
public function __construct($id)
{
$sql = sql::factory();
$sql->query('SELECT * FROM ' . sql::table('user') . ' WHERE id=' . $id)->result();
$this->entrys = $sql->result;
$this->entrys['perms'] = explode('|', $this->get('perms'));
}
示例6: loginPost
protected static function loginPost()
{
$email = type::post('email', 'string');
$password = type::post('password', 'string');
// Formular ganz abgesendet?
if (is_null($email) || is_null($password) || $email == '' || $password == '') {
echo message::info(lang::get('login_form_notfull'), true);
return;
}
$sql = sql::factory();
$sql->query('SELECT password, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
// Username mit E-Mail vorhanden?
if (!$sql->num()) {
echo message::danger(sprintf(lang::get('login_no_user'), $email), true);
return;
}
$sql->result();
// Password nicht gleich?
if (!self::checkPassword($password, $sql->get('password'))) {
echo message::danger(lang::get('login_pwd_false'), true);
return;
}
self::loginSession();
self::$userID = $sql->get('id');
$_SESSION['login'] = $sql->get('id') . '||' . self::hash($password);
}
示例7: loginPost
protected static function loginPost()
{
$email = type::post('email', 'string');
$password = type::post('password', 'string');
$remember = type::post('remember', 'int');
if (is_null($email) || is_null($password) || $email == '' || $password == '') {
echo message::info(lang::get('fill_out_both'));
return;
}
$sql = new sql();
$sql->query('SELECT password, salt, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
if (!$sql->num()) {
echo message::danger(sprintf(lang::get('email_not_found'), htmlspecialchars($email)), true);
$shake = 1;
return;
}
$sql->result();
if (!self::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
echo message::danger(lang::get('wrong_pw'));
$shake = 1;
return;
}
self::loginSession();
self::$userID = $sql->get('id');
$_SESSION['login'] = $sql->get('id');
if ($remember) {
setcookie("remember", $sql->get('id'), time() + 3600 * 24 * 7);
}
}
示例8: delete
public static function delete($id)
{
$sql = sql::factory();
$sql->query('SELECT `structure_id`, `sort` FROM ' . sql::table('structure_area') . ' WHERE id=' . $id)->result();
$delete = sql::factory();
$delete->setTable('structure_area');
$delete->setWhere('id=' . $id);
$delete->delete();
self::saveSortUp($sql->get('structure_id'), $sql->get('sort'));
return $sql->get('structure_id');
}
示例9: __construct
public function __construct($addon, $config = true)
{
$this->name = $addon;
if ($config) {
$configfile = dir::addon($addon, 'config.json');
$this->config = json_decode(file_get_contents($configfile), true);
}
addonConfig::isSaved($addon);
$this->sql = new sql();
$this->sql->query('SELECT * FROM ' . sql::table('addons') . ' WHERE `name` = "' . $addon . '"')->result();
}
示例10: getAll
public static function getAll()
{
if (!count(self::$all)) {
$sql = sql::factory();
$sql->query('SELECT name FROM ' . sql::table('addons') . ' WHERE `install` = 1 AND `active` = 1')->result();
while ($sql->isNext()) {
self::$all[] = $sql->get('name');
$sql->next();
}
}
return self::$all;
}
示例11: getMediaByExtension
public static function getMediaByExtension($extension)
{
$returnArray = [];
$class = __CLASS__;
$sql = sql::factory();
$sql->result('SELECT * FROM ' . sql::table('media') . ' WHERE filename LIKE "%.' . $extension . '"');
while ($sql->isNext()) {
$returnArray[] = new $class($sql);
$sql->next();
}
return $returnArray;
}
示例12: moduleList
public static function moduleList($active = false)
{
if (empty(self::$modulList)) {
$sql = sql::factory();
$sql->result('SELECT id, name FROM ' . sql::table('module') . ' ORDER BY `sort`');
while ($sql->isNext()) {
$selected = $active && $active == $sql->get('id') ? 'selected="selected"' : '';
self::$modulList[] = '<option value="' . $sql->get('id') . '" ' . $selected . '>' . $sql->get('name') . '</option>';
$sql->next();
}
}
return implode(PHP_EOL, self::$modulList);
}
示例13: getOptions
protected function getOptions()
{
$return = [];
if (empty($this->value)) {
return '';
}
$sql = sql::factory();
$sql->result('SELECT * FROM ' . sql::table('media') . ' WHERE id IN (' . implode(',', (array) $this->value) . ') ORDER BY FIND_IN_SET(id, "' . implode(',', (array) $this->value) . '")');
while ($sql->isNext()) {
$return[] = '<option value="' . $sql->get('id') . '">' . $sql->get('filename') . '</option>';
$sql->next();
}
return implode(PHP_EOL, $return);
}
示例14: getMetaInfos
public static function getMetaInfos($form, $type)
{
$sql = sql::factory();
$sql->query('SELECT * FROM ' . sql::table('metainfos') . ' WHERE `type` = "' . $type . '" ORDER BY `sort`')->result();
while ($sql->isNext()) {
$prefix = substr($type, 0, 3) . '_';
$attributes = $sql->getRow();
$attributes['name'] = $prefix . $attributes['name'];
$element = self::getElement($attributes, $form->get($prefix . $sql->get('name')));
$form->addElement($prefix . $sql->get('name'), $element);
$sql->next();
}
return $form;
}
示例15: getBlock
public static function getBlock($name)
{
$sql = sql::factory();
$sql->query("SELECT * FROM " . sql::table('blocks') . " WHERE name = '" . $name . "'")->result();
if (!self::isInCategory($sql->get('is-structure'), $sql->getArray('structure'))) {
return '';
} else {
if (!pageCache::exist($sql->get('id'), false, 'block')) {
pageCache::generateArticle($sql->get('id'), true);
}
$content = pageCache::read($sql->get('id'), 'block');
return pageArea::getEval($content);
}
}