本文整理汇总了PHP中database::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP database::delete方法的具体用法?PHP database::delete怎么用?PHP database::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drop_command
public static function drop_command($nick, $ircdata = array())
{
$chan = core::get_chan(&$ircdata, 0);
// get the channel.
if (self::_drop_check($nick, $chan) === false) {
return false;
}
// do nessicary checks
if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) {
if ($channel->suspended == 1) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_1, array('chan' => $chan));
return false;
}
}
// is the channel suspended?
database::delete('chans', array('channel', '=', $chan));
database::delete('chans_levels', array('channel', '=', $chan));
// delete all associated records
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_CHAN_DROPPED, array('chan' => $chan));
// let the user know
if (isset(core::$chans[$chan])) {
ircd::part_chan(core::$config->chanserv->nick, $chan);
// now lets leave the channel if we're in it
}
// is the channel in existance? if so unregister mode
// remember we DON'T unset the channel record, because the channel
// is still there, just isnt registered, completely different things
core::alog(core::$config->chanserv->nick . ': ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick));
// logchan it
core::alog('drop_command(): ' . $chan . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
}
示例2: update_list
public static function update_list()
{
database::delete("permission");
foreach (self::list_of_existing_permissions() as $perm => $descr) {
database::insert("permission", array("permission" => $perm, "description" => $descr));
}
}
示例3: delete
function delete()
{
$this->onDelete();
if (!$this->validate($errors)) {
return false;
}
$db = new database();
$db->table = $this->__table;
$db->drop($this);
return $db->delete();
}
示例4: drop_command
public static function drop_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
$password = $ircdata[1];
// get the nick.
if (trim($unick) == '' || trim($password) == '' && (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'DROP'));
return false;
}
// invalid syntax
if (services::is_root($unick) && !services::is_root($nick)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// is a non-root trying to drop a root?
if ($user = services::user_exists($unick, false, array('id', 'display', 'pass', 'salt', 'suspended'))) {
if ($user->suspended == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $user->display));
return false;
}
// are they suspended?
if ($user->pass == sha1($password . $user->salt) || core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false) {
database::delete('users', array('display', '=', $user->display));
database::delete('users_flags', array('nickname', '=', $user->display));
// delete the users record
database::delete('chans_levels', array('target', '=', $user->display));
// also delete this users channel access.
core::alog(core::$config->nickserv->nick . ': ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick));
// logchan it
core::alog('drop_command(): ' . $user->display . ' has been dropped by ' . core::get_full_hostname($nick), 'BASIC');
// log what we need to log.
if (isset(core::$nicks[$user->display])) {
ircd::on_user_logout($nick->display);
}
// if the nick is being used unregister it, even though it shouldn't be?
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_DROPPED, array('nick' => $user->display));
// let the nick know the account has been dropped.
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
// password isn't correct
}
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ISNT_REGISTERED, array('nick' => $unick));
return false;
// doesn't even exist..
}
}
示例5: delete
public function delete()
{
// for admin only
// needs:
// 1. record id (WHERE condition) in $_GET['id']
// 2. id column name (in $this->id_column, through set_id_column method
// 3. table (in $this->table_name, through set_table_name method
$security_handler = new security();
$security_handler->check_token();
$_SESSION['log'] .= new timestamp("Deleting record {$_GET['id']} on table {$this->table_name}");
if (isset($_GET['id'])) {
if (is_numeric($_GET['id'])) {
if (isset($this->id_column)) {
$id = $_GET['id'];
$sql = "DELETE FROM {$this->table_name} WHERE {$this->id_column}=?";
$data = array($id);
$connection = new database();
if ($connection->delete($sql, $data)) {
$_SESSION['log'] .= new timestamp("Record deleted");
} else {
$_SESSION['log'] .= new timestamp("Error: record could not be deleted!!");
}
//header("Location: http://localhost/css/index.php?controller={$_GET['controller']}&action=index");
} else {
$_SESSION['log'] .= new timestamp("Error: id_column property not set when deleting record. Cannot delete!");
}
} else {
$_SESSION['log'] .= new timestamp("Error: id value is not numeric. Aborting operation!");
header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index");
}
} else {
$_SESSION['log'] .= new timestamp("Error: id is not set. Aborting operation!");
header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index");
}
}
示例6: delete
function delete()
{
//create the database object
$database = new database();
//start the transaction
//$count = $database->db->exec("BEGIN;");
//delete the fax
if (strlen($this->fax_uuid) > 0) {
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->fax_uuid);
}
//delete the fax
if (strlen($this->fax_uuid) == 0) {
//select the dialplan entries
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$result = $database->find();
foreach ($result as $row) {
$this->dialplan_uuid = $row['dialplan_uuid'];
//delete the child dialplan information
$database->table = "v_dialplan_details";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
//delete the dialplan information
$database->table = "v_dialplans";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'dialplan_uuid';
$database->where[1]['value'] = $this->dialplan_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
}
//delete the fax
if (strlen($this->fax_uuid) > 0) {
$database->table = "v_fax";
$database->where[0]['name'] = 'domain_uuid';
$database->where[0]['value'] = $this->domain_uuid;
$database->where[0]['operator'] = '=';
$database->where[1]['name'] = 'fax_uuid';
$database->where[1]['value'] = $this->fax_uuid;
$database->where[1]['operator'] = '=';
$database->delete();
unset($this->fax_uuid);
}
//commit the transaction
//$count = $database->db->exec("COMMIT;");
}
}
示例7: action
//.........这里部分代码省略.........
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case update:
if ($_arg[orderdefault]) {
session::set(orderdefault, $_arg[id]);
} elseif (isset($_arg[orderdefault])) {
session::destroy(orderdefault);
}
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case edit:
session::set("edit", TRUE);
session::set("show", $_arg[id]);
session::destroy("searchshow");
break;
case noedit:
session::destroy("edit");
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case open:
session::open($_arg[id]);
break;
case close:
session::close($_arg[id]);
break;
case closeall:
session::close_all();
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case deleteid:
end_link();
hide();
database::delete($_arg[id]);
break;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
case suchen:
if (!$_arg[searchString] and ($_arg[searchowner] or $_arg[searchtype] or $_arg[searchstatus])) {
$_arg[searchString] = "%";
}
if ($_arg[searchString]) {
session::set("searchshow", true);
}
// show search result
session::set("search", $_arg[searchString]);
session::set("searchcom", $_arg[searchcom]);
session::set("searchorder", $_arg[searchorder]);
session::set("searchentrytype", $_arg[searchentrytype]);
session::set("searchstatus", $_arg[searchstatus]);
if ($_arg[searchowner]) {
session::set("searchowner", $_arg[searchowner]);
} else {
session::destroy("searchowner");
}
switch ($_arg[searchtype]) {
case 0:
session::destroy("searchexact");
session::destroy("searchstart");
break;
case 1:
session::destroy("searchexact");
session::set("searchstart", TRUE);
示例8: unsuspend_command
public static function unsuspend_command($nick, $ircdata = array())
{
$unick = core::get_nick(&$ircdata, 0);
// get the nick etc.
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// they've gotta be identified and opered..
if ($user = services::user_exists($unick, false, array('display', 'suspended', 'real_user'))) {
if ($user->suspended == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_4, array('nick' => $unick));
return false;
}
// nick isn't suspended
database::update('users', array('suspended' => 0, 'suspend_reason' => null), array('display', '=', $unick));
if ($user->real_user == 0) {
database::delete('users', array('display', '=', $unick));
}
// nick wasen't registered by a real person, drop it
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_4, array('nick' => $unick));
return false;
}
// nick isn't even registered.
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_5, array('nick' => $unick));
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' UNSUSPENDED ' . $unick);
ircd::globops(core::$config->nickserv->nick, $nick . ' UNSUSPENDED ' . $unick);
// oh well, was fun while it lasted eh?
// unsuspend it :P
}
示例9: database
$db->where("id = {$s_tournois}");
$db->exec();
/*** inscription des teams dans m4 ***/
if ($modescore_tournois == 'M4') {
$dbm4 = new database();
$dbm4->debug($m4dbdebug);
$dbm4->connect($m4dbhost, $m4dbuser, $m4dbpass, $m4dbname);
$db->select("id, tag");
$db->from("{$dbprefix}equipes, {$dbprefix}participe");
$db->where("{$dbprefix}equipes.id = {$dbprefix}participe.equipe");
$db->where("tournois = {$s_tournois}");
$db->order_by("id");
$res = $db->exec();
while ($equipes = $db->fetch($res)) {
/*** suppression de l'equipe dans m4 (eviter les conflits d'id) ***/
$dbm4->delete("m4_clan");
$dbm4->where("numero = {$equipes->id}");
$dbm4->exec();
/*** insertion de l'equipe inscrites dans m4 ***/
$dbm4->insert("m4_clan (numero,nom)");
$dbm4->values("{$equipes->id},'{$equipes->tag}'");
$dbm4->exec();
}
}
/*** redirection ***/
if (type_tournois($s_tournois) == 'E') {
js_goto("?page=finales&op=admin");
} else {
js_goto("?page=poules&op=admin");
}
} elseif ($op == "valider_poules") {
示例10: _clear_users
public static function _clear_users($nick)
{
database::delete('ignored_users');
services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_IGNORE_CLEARED, array('users' => database::num_rows($nicks_q)));
// list cleared.
}
示例11: database
<?php
/*
* php code///////////**********************************************************
*/
$db = new database();
$query = $db->delete("orders", "id='{$_GET['id']}'");
if ($query == TRUE) {
$db->delete("order_details", "order_id='{$_GET['id']}'");
header("location:" . $baseUrl . "/back/order");
} else {
echo "Error!";
}
mysql_close();
示例12: identify_command
public static function identify_command($nick, $ircdata = array())
{
$password = $ircdata[0];
if (trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'IDENTIFY'));
return false;
}
// wrong syntax damit!
if ($user = services::user_exists($nick, false, array('display', 'pass', 'identified', 'validated', 'salt', 'vhost'))) {
if ($user->validated == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
return false;
} elseif ($user->identified == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_IDENTIFIED);
return false;
} else {
if ($user->pass == sha1($password . $user->salt)) {
timer::remove(array('ns_identify', 'secured_callback', array($nick)));
// remove the secured timer. if there is one
ircd::on_user_login($nick);
// registered mode
database::update('users', array('identified' => 1, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => 0), array('display', '=', $nick));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_IDENTIFIED);
// right, standard identify crap
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' identified for nick ' . core::$nicks[$nick]['nick']);
// logchan
if ($user->vhost != '' && isset(modules::$list['os_vhost'])) {
if (substr_count($user->vhost, '@') == 1) {
$new_host = explode('@', $user->vhost);
$ident = $new_host[0];
$host = $new_host[1];
ircd::setident(core::$config->operserv->nick, $user->display, $ident);
ircd::sethost(core::$config->operserv->nick, $user->display, $host);
} else {
ircd::sethost(core::$config->operserv->nick, $user->display, $user->vhost);
}
}
// first thing we do, check if they have a vhost, if they do, apply it.
$failed_attempts = database::select('failed_attempts', array('nick', 'mask', 'time'), array('nick', '=', $nick));
if (database::num_rows($failed_attempts) > 0) {
services::communicate(core::$config->nickserv->nick, $nick, '' . database::num_rows($failed_attempts) . ' failed login(s) since last login.');
while ($row = database::fetch($failed_attempts)) {
services::communicate(core::$config->nickserv->nick, $nick, 'Failed login from: ' . $row->mask . ' on ' . date("F j, Y, g:i a", $row->time) . '');
}
// loop through the failed attempts messaging them to the user
database::delete('failed_attempts', array('nick', '=', $nick));
// clear them now that they've been seen
}
// we got any failed attempts? HUMM
$hostname = core::get_full_hostname($nick);
// generate a hostname.
if (core::$config->settings->mode_on_id == 'yes' && isset(modules::$list['cs_levels'])) {
foreach (core::$chans as $chan => $cdata) {
$access_array = cs_levels::get_access($chan);
// get the access array
if ($nick == core::$config->chanserv->nick) {
continue;
}
// skip us :D
$hostname = core::get_full_hostname($nick);
// get the hostname ready.
foreach ($access_array as $target => $access) {
if ($target == $nick) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos($target, '@') !== false && services::match($hostname, $target)) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos(core::$chans[$chan]['users'][$nick], 'o') !== false) {
$remove_access = true;
// set remove access to true
continue 1;
// continue to next loop to check other access records
} else {
continue 1;
// continue to next loop to check other access records
}
// we check if the user has access, if they do break;
// we also check if they dont have access and have op, if they do remove it.
}
// loop through the access records
}
// loop through channels, check if they are in any
}
// check if mode_on_id is set, also cs_access is enabled, and lets do a remote access gain :D
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
core::alog(core::$config->nickserv->nick . ': Invalid password from ' . core::get_full_hostname($nick));
// some logging stuff
database::insert('failed_attempts', array('nick' => $nick, 'mask' => core::get_full_hostname($nick), 'time' => core::$network_time));
core::$nicks[$nick]['failed_attempts']++;
// ooh, we have something to log :)
//.........这里部分代码省略.........
示例13: confirm_command
public static function confirm_command($nick, $ircdata = array())
{
$code = $ircdata[0];
if (trim($code) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'CONFIRM'));
return false;
}
// wrong syntax
if (!($user = services::user_exists($nick, false, array('display', 'id')))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
return false;
}
// unregistered
$code_array = database::select('validation_codes', array('nick', 'code'), array('nick', '=', $nick, 'AND', 'code', '=', $code));
if (database::num_rows($code_array) == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSCODE);
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_VALIDATED);
// let them know.
database::update('users', array('validated' => 1), array('id', '=', $user->id));
// user is now validated.
database::delete('validation_codes', array('nick', '=', $nick, 'AND', 'code', '=', $code));
// delete the code now that we've validated them
core::alog(core::$config->nickserv->nick . ': ' . $nick . ' activated');
// logchan
}
// no passcode found
}
示例14: del
public static function del($variable)
{
database::delete("variables", "variable_name='%var'", array("%var" => $variable));
}
示例15: check_expire
public static function check_expire()
{
if (core::$config->nickserv->expire == 0) {
return false;
}
// skip nicknames if config is set to no expire.
$expiry_time = core::$config->nickserv->expire * 86400;
$check_time = core::$network_time - $expiry_time;
// set up our times.
$nick_q = database::select('users', array('id', 'display', 'last_timestamp'), array('last_timestamp', '!=', '0', 'AND', 'last_timestamp', '<', $check_time));
if (database::num_rows($nick_q) == 0) {
return false;
}
// no expiring nicknames
while ($nick = database::fetch($nick_q)) {
// Mikeh gets most of the credit for helping
// me code this function
database::delete('users', array('display', '=', $nick->display));
database::delete('users_flags', array('nickname', '=', $user->display));
// delete the users record
database::delete('chans_levels', array('target', '=', $nick->display));
// also delete this users channel access.
core::alog(core::$config->nickserv->nick . ': ' . $nick->display . ' has expired. Last used on ' . date('F j, Y, g:i a', $nick->last_timestamp));
// logchan it
if (isset(core::$nicks[$nick->display])) {
ircd::on_user_logout($nick->display);
}
// if the nick is being used unregister it, even though it shouldn't be, just to be safe.
}
// loop through all expiring nicks.
}