本文整理汇总了PHP中DBUtil::deleteWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::deleteWhere方法的具体用法?PHP DBUtil::deleteWhere怎么用?PHP DBUtil::deleteWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::deleteWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deletePostProcess
public function deletePostProcess($data = null)
{
// After delete, it should delete the references to this registry
// in the categories mapobj table
$where = "WHERE reg_id = '{$this->_objData[$this->_objField]}'";
return DBUtil::deleteWhere('categories_mapobj', $where);
}
示例2: hookAreaDelete
/**
* Listener for installer.subscriberarea.uninstalled
*
* @param Zikula_Event $event
*
* @return void
*/
public static function hookAreaDelete(Zikula_Event $event)
{
$areaId = $event['areaid'];
// Database information
ModUtil::dbInfoLoad('EZComments');
$tables = DBUtil::getTables();
$columns = $tables['EZComments_column'];
// Get items
$where = "WHERE {$columns['areaid']} = '" . DataUtil::formatForStore($areaId) . "'";
DBUtil::deleteWhere('EZComments', $where);
}
示例3: deleteEntry
/**
* Delete a category registry entry
*
* @param string $modname The module to create a property for.
* @param integer $entryID The category-id to bind this property to.
*
* @return boolean The DB insert operation result code cast to a boolean.
*/
public static function deleteEntry($modname, $entryID = null)
{
if (!isset($modname) || !$modname) {
return z_exit(__f("Error! Received invalid parameter '%s'", 'modname'));
}
$where = "modname='{$modname}'";
if ($entryID) {
$where .= " AND id={$entryID}";
}
return (bool) DBUtil::deleteWhere('categories_registry', $where);
}
示例4: deletefavourite
function deletefavourite()
{
$objectid = FormUtil::getPassedValue('objectid', null, 'POST');
$userid = FormUtil::getPassedValue('userid', null, 'POST');
if (!SecurityUtil::checkPermission('AddressBook::', "::", ACCESS_COMMENT)) {
AjaxUtil::error($this->__('Error! No authorization to access this module.'));
}
$ztables = DBUtil::getTables();
$fav_column = $ztables['addressbook_favourites_column'];
$where = "{$fav_column['favadr_id']} = '" . DataUtil::formatForStore($objectid) . "' AND {$fav_column['favuser_id']} = '" . DataUtil::formatForStore($userid) . "'";
DBUtil::deleteWhere('addressbook_favourites', $where);
return;
}
示例5: deleteFile
function deleteFile($fileReference)
{
$dom = ZLanguage::getModuleDomain('mediashare');
$pntable = pnDBGetTables();
$mediadbColumn = $pntable['mediashare_mediadb_column'];
$fileReference = DataUtil::formatForStore($fileReference);
$where = "{$mediadbColumn['fileref']} = '{$fileReference}'";
$result = DBUtil::deleteWhere('mediashare_mediadb', $where);
if ($result === false) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('vfsHandlerDB.deleteFile', 'Could not delete the file information.'), $dom));
}
return true;
}
示例6: delUserGroups
/**
* Delete all the group membership of the user
* @author: Albert Pérez Monfort (aperezm@xtec.cat)
* @author: Josep Ferràndiz (jferran6@xtec.cat)
* @param: none
* @return: True if success and false in other case
*/
public function delUserGroups() {
// Security check
if (!SecurityUtil::checkPermission('IWmyrole::', "::", ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
$pntables = DBUtil::getTables();
$c = $pntables['group_membership_column'];
$where = "WHERE $c[uid]=" . UserUtil::getVar('uid') . " AND $c[gid] <>" . ModUtil::getVar('IWmyrole', 'rolegroup');
if (!DBUtil::deleteWhere('group_membership', $where)) {
return LogUtil::registerError($this->__('Error! Sorry! Deletion attempt failed.'));
}
return true;
}
示例7: buida
public function buida($args) {
$sid = FormUtil::getPassedValue('sid', isset($args['sid']) ? $args['sid'] : null, 'POST');
//Comprovem que el par�metre id efectivament hagi arribat
if (!isset($sid)) {
LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
return false;
}
//Cridem la funci� get que retorna les dades
$link = ModUtil::apiFunc('IWbookings', 'user', 'get', array('sid' => $sid));
//Comprovem que el registre efectivament existeix i, per tant, es podr� esborrar
if ($link == false) {
LogUtil::registerError($this->__('The room or equipment was not found'));
return false;
}
//Comprovaci� de seguretat
if (!SecurityUtil::checkPermission('IWbookings::', "::", ACCESS_ADMIN)) {
LogUtil::registerError($this->__('You are not allowed to administrate the bookings'));
return false;
}
$pntables = DBUtil::getTables();
$c = $pntables['IWbookings_column'];
$where = "WHERE $c[sid]=" . $sid;
if (!DBUtil::deleteWhere('IWbookings', $where)) {
return false;
} else {
//Retornem true ja que el proc�s ha finalitzat amb �xit
return true;
}
}
示例8: processDelete
/**
* Example delete process hook handler.
*
* The subject should be the object that was deleted.
* args[id] Is the is of the object
* args[caller] is the name of who notified this event.
*
* @param Zikula_ProcessHook $hook The hookable event.
*
* @return void
*/
public function processDelete(Zikula_ProcessHook $hook)
{
if ($hook->getId() <= 0) {
return;
}
// Security check
$res = ModUtil::apiFunc('EZComments', 'user', 'checkPermission', array('module' => $hook->getCaller(), 'objectid' => $hook->getId(), 'level' => ACCESS_DELETE));
if (!$res) {
return LogUtil::registerPermissionError(ModUtil::url('EZComments', 'admin', 'main'));
}
// get db table and column for where statement
ModUtil::dbInfoLoad('EZComments');
$tables = DBUtil::getTables();
$column = $tables['EZComments_column'];
$mod = DataUtil::formatForStore($hook->getCaller());
$objectid = DataUtil::formatForStore($hook->getId());
$areaid = DataUtil::formatForStore($hook->getAreaId());
$where = "{$column['modname']} = '{$mod}' AND {$column['objectid']} = '{$objectid}' AND {$column['areaid']} = '{$areaid}'";
DBUtil::deleteWhere('EZComments', $where);
}
示例9: deleteWhere
/**
* Delete with a where-clause.
*
* @param string $where The where-clause to use.
*
* @return array|boolean The Object Data.
*/
public function deleteWhere($where = null)
{
if (!$where) {
return false;
}
if (!$this->deletePreProcess()) {
return false;
}
$res = DBUtil::deleteWhere($this->_objType, $where);
$this->deletePostProcess();
return $this->_objData;
}
示例10: delete
/**
* Esborra un element indicant el tipus i la seva id
*
* > També s'esborren els registres associats d'altres taules.
*
* @param array $args Array amb els paràmetres de la funció
*
* ### Paràmetres de l'array $args:
* * string **que** Indica allò que volem esborrar: activitat, unitat, catàleg, orientació, ...
* * integer **id** Identificador de l'element a esborrar
*
* @return boolean true si tot ha anat bé || false en cas d'error
*/
public function delete($args) {
// Check permission
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_DELETE));
$que = $args['que'] ? $args['que'] : null;
$id = $args['id'] ? $args['id'] : null;
if (isset($id)) {
switch ($que) {
case 'activitat':
$where = 'actId =' . $id;
//return LogUtil::registerError($id." -".$que." - WHERE: ". $where);
// Esborrem de la taula activitats
if ((DBUtil::deleteWhere('cataleg_activitats', $where)) &&
(DBUtil::deleteWhere('cataleg_contactes', $where)) &&
(DBUtil::deleteWhere('cataleg_activitatsZona', $where)) &&
(DBUtil::deleteWhere('cataleg_centresActivitat', $where)))
return true;
else
return false;
break;
case 'cataleg':
$where = 'catId =' . $id;
if ((DBUtil::deleteWhere('cataleg', $where)))
return true;
else
return false;
break;
case 'eix':
$where = 'eixId =' . $id;
if ((DBUtil::deleteWhere('cataleg_eixos', $where)))
return true;
else
return false;
break;
case 'subprioritat':
$where = 'sprId =' . $id;
if ((DBUtil::deleteWhere('cataleg_subprioritats', $where)))
return true;
else
return false;
break;
case 'impunit':
$where = 'impunitId =' . $id;
if ((DBUtil::deleteWhere('cataleg_unitatsImplicades', $where)))
return true;
else
return false;
break;
case 'unitat':
$where = 'uniId =' . $id;
if ((DBUtil::deleteWhere('cataleg_unitats', $where)))
return true;
else
return false;
break;
case 'responsable':
$where = 'respunitId =' . $id;
if ((DBUtil::deleteWhere('cataleg_responsables', $where)))
return true;
else
return false;
break;
case 'allResponsablesUnitat':
$where = 'uniId =' . $id;
if ((DBUtil::deleteWhere('cataleg_responsables', $where)))
return true;
else
return false;
break;
case 'prioritat':
$where = 'priId =' . $id;
if ((DBUtil::deleteWhere('cataleg_prioritats', $where)))
return true;
else
return false;
break;
case 'allSubprioritatsPrioritat':
$where = 'priId =' . $id;
if ((DBUtil::deleteWhere('cataleg_subprioritats', $where)))
return true;
else
return false;
break;
case 'allImpunitsPrioritat':
//.........这里部分代码省略.........
示例11: importGtafEntities
/**
* Importa les taules de entitats-gtaf i grups d'entitats a partir d'un csv a la base de dades de Sirius
*
* Esborra el contingut previ de les taules i importa el contingut del fitxer
*
* @return void Retorna a la funció *gtafEntitiesGest* amb els missatges d'execució
*/
public function importGtafEntities() {
if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// get input values. Check for direct function call first because calling function might be either get or post
if (isset($args) && is_array($args) && !empty($args)) {
$confirmed = isset($args['confirmed']) ? $args['confirmed'] : false;
$case = isset($args['case']) ? $args['case'] : false;
} elseif (isset($args) && !is_array($args)) {
throw new Zikula_Exception_Fatal(LogUtil::getErrorMsgArgs());
} elseif ($this->request->isGet()) {
$confirmed = 1;
} elseif ($this->request->isPost()) {
$this->checkCsrfToken();
$confirmed = $this->request->request->get('confirmed', false);
$case = $this->request->request->get('case',false);
}
if ($confirmed == 2) {
if ($case == 'entities') {
$caps = array(
'gtafEntityId' => 'gtafEntityId',
'nom' => 'nom',
'tipus' => 'tipus',
'gtafGroupId' => 'gtafGroupId'
);
$caps_man = $caps;
$taula = 'cataleg_gtafEntities';
$mes = "Importació d'entitats-gtaf";
$field_id = 'gtafEntityId';
} else {
$caps = array(
'gtafGroupId' => 'gtafGroupId',
'nom' => 'nom',
'resp_uid' => 'resp_uid'
);
$caps_man = array(
'gtafGroupId' => 'gtafGroupId',
'nom' => 'nom'
);
$taula = 'cataleg_gtafGroups';
$mes = "Importació de grups d'entitats-gtaf";
$field_id = 'gtafGroupId';
}
// get other import values
$importFile = $this->request->files->get('importFile', isset($args['importFile']) ? $args['importFile'] : null);
$fileName = $importFile['name'];
$importResults = '';
if ($fileName == '') {
$importResults = $this->__("No heu triat cap fitxer.");
} elseif (FileUtil::getExtension($fileName) != 'csv') {
$importResults = $this->__("L'extensió del fitxer ha de ser csv.");
} elseif (!$file_handle = fopen($importFile['tmp_name'], 'r')) {
$importResults = $this->__("No s'ha pogut llegir el fitxer csv.");
} else {
while (!feof($file_handle)) {
$line = fgetcsv($file_handle, 1024, ';', '"');
if ($line != '') {
$lines[] = $line;
}
}
fclose($file_handle);
//
foreach ($lines as $line_num => $line) {
if ($line_num != 0) {
if (count($lines[0]) != count($line)) {
$importResults .= $this->__("<div>Hi ha registres amb un número de camps incorrecte.</div>");
} else {
$import[] = array_combine($lines[0], $line);
$import_id[] = $line[0];
}
} else {
$difs = array_diff($line, $caps);
$difs2 = array_diff($caps_man,$line);
if (count($line) != count(array_unique($line))) {
$importResults .= $this->__("<div>La capçalera del csv té columnes repetides.</div>");
} elseif (!in_array($field_id, $line)) {
$importResults .= $this->__("<div>Falta el camp obligatori de la clau primària (id).</div>");
} elseif ($line[0] != $field_id) {
$importResults .= $this->__("<div>El camp obligatori de la clau primària (id) ha d'ocupar el primer lloc.</div>");
} elseif (!empty($difs2)) {
$importResults .= $this->__("<div>Falten camps obligatoris.</div>");
} elseif (!empty($difs)) {
$importResults .= $this->__("div>El csv té camps incorrectes.</div>");
}
}
}
if (count($import_id) != count(array_unique($import_id))) $importResults .= $this->__("<div>El fitxer té alguna id repetida.</div>");
}
if ($importResults == '') {
$old_reg = DBUtil::selectObjectCount($taula);
DBUtil::deleteWhere($taula);
//.........这里部分代码省略.........
示例12: deleteObjectCategories
/**
* Delete a meta data object.
*
* @param array $obj The object we wish to delete categorization data for.
* @param string $tablename The object's tablename.
* @param string $idcolumn The object's idcolumn (optional) (default='obj_id').
*
* @return The result from the metadata insert operation
*/
public static function deleteObjectCategories($obj, $tablename, $idcolumn = 'obj_id')
{
if (!ModUtil::dbInfoLoad('ZikulaCategoriesModule')) {
return false;
}
$where = "tablename='" . DataUtil::formatForStore($tablename) . "' AND obj_id='" . DataUtil::formatForStore($obj[$idcolumn]) . "' AND obj_idcolumn='" . DataUtil::formatForStore($idcolumn) . "'";
$categoriesDeleted = (bool) DBUtil::deleteWhere('categories_mapobj', $where);
$dbtables = DBUtil::getTables();
if (isset($dbtables[$tablename])) {
DBUtil::flushCache($tablename);
}
return $categoriesDeleted;
}
示例13: delete
public function delete($args) {
//$mdid = FormUtil::getPassedValue('mdid', isset($args['mdid']) ? $args['mdid'] : null, 'POST');
//$mode = FormUtil::getPassedValue('m', isset($args['m']) ? $args['m'] : null, 'POST');
$mdid = $args['mdid'];
$mode = $args['m'];
//Comprovem que el parï¿œmetre id hagi arribat
if (!isset($mdid)) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
//Carreguem l'API de l'usuari per carregar les dades del registre
if (!ModUtil::loadApi('IWtimeframes', 'user')) {
return LogUtil::registerError($this->__('Error! Could not load module.'));
}
//Cridem la funciᅵ get que retorna les dades
$registre = ModUtil::apiFunc('IWtimeframes', 'user', 'get', array('mdid' => $mdid));
//Comprovem que el registre efectivament existeix i per tant, es podrᅵ esborrar
if (empty($registre)) {
return LogUtil::registerError($this->__('Can not find the timeFrame over which do the action.') . " - " . $registre['nom_marc']);
}
//Comprovaciᅵ de seguretat
if (!SecurityUtil::checkPermission('IWtimeframes::', "$registre[nom_marc]::$mdid", ACCESS_DELETE)) {
return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'));
}
switch ($mode) {
case 'all': //erase timetable and all the bookings referenced in IWbookings
// falta esborrar totes les reserves
if (ModUtil::apifunc('IWtimeframes', 'admin', 'installed', 'IWbookings')){
$where = "mdid = " . $mdid;
$rs = array();
$rs = DBUtil::selectObjectArray('IWbookings_spaces', $where);
foreach ($rs as $item) {
DBUtil::deleteWhere('IWbookings', "sid=" . $item['sid']);
}
}
case 'keep': //keep bookings and reset timeframe
if (ModUtil::apifunc('IWtimeframes', 'admin', 'installed', 'IWbookings')){
// Posem a 0 la referència al marc horari esborrat dels espais afectats
ModUtil::apiFunc('IWbookings', 'admin', 'reset_timeframe', $mdid);
}
//case 'noref': //delete: timetable
// DBUtil::deleteWhere('IWtimeframes_definition', "mdid=" . $mdid);
// DBUtil::deleteWhere('IWtimeframes', "mdid=" . $mdid);
}
// Esborrem el mac horari
DBUtil::deleteWhere('IWtimeframes_definition', "mdid=" . $mdid);
DBUtil::deleteWhere('IWtimeframes', "mdid=" . $mdid);
//Retornem true ja que el procï¿œs ha finalitzat amb ï¿œxit
return true;
}
示例14: gc
/**
* {@inheritdoc}
*/
public function gc($lifetime)
{
$now = time();
$inactive = $now - (int) (System::getVar('secinactivemins') * 60);
$daysold = $now - (int) (System::getVar('secmeddays') * 86400);
// find the hash length dynamically
$hash = ini_get('session.hash_function');
if (empty($hash) || $hash == 0) {
$sessionlength = 32;
} else {
$sessionlength = 40;
}
if (System::getVar('sessionstoretofile')) {
// file based GC
$path = DataUtil::formatForOS(session_save_path(), true);
// get files
$files = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..' && strlen($file) == $sessionlength) {
// filename, created, last modified
$file = "{$path}/{$file}";
$files[] = array('name' => $file, 'lastused' => filemtime($file));
}
}
}
// check we have something to do
if (count($files) == 0) {
return true;
}
// do GC
switch (System::getVar('seclevel')) {
case 'Low':
// Low security - delete session info if user decided not to
// remember themself and session is inactive
foreach ($files as $file) {
$name = $file['name'];
$lastused = $file['lastused'];
$session = unserialize(file_get_contents($name));
if ($lastused < $inactive && !isset($session['rememberme'])) {
unlink($name);
}
}
break;
case 'Medium':
// Medium security - delete session info if session cookie has
// expired or user decided not to remember themself and inactivity timeout
// OR max number of days have elapsed without logging back in
foreach ($files as $file) {
$name = $file['name'];
$lastused = $file['lastused'];
$session = unserialize(file_get_contents($name));
if ($lastused < $inactive && !isset($session['rememberme'])) {
unlink($name);
} elseif ($lastused < $daysold) {
unlink($name);
}
}
break;
case 'High':
// High security - delete session info if user is inactive
foreach ($files as $file) {
$name = $file['name'];
$lastused = $file['lastused'];
if ($lastused < $inactive) {
unlink($name);
}
}
break;
}
return true;
} else {
// DB based GC
$dbtable = DBUtil::getTables();
$sessioninfocolumn = $dbtable['session_info_column'];
$inactive = DataUtil::formatForStore(date('Y-m-d H:i:s', $inactive));
$daysold = DataUtil::formatForStore(date('Y-m-d H:i:s', $daysold));
switch (System::getVar('seclevel')) {
case 'Low':
// Low security - delete session info if user decided not to
// remember themself and inactivity timeout
$where = "WHERE {$sessioninfocolumn['remember']} = 0\n AND {$sessioninfocolumn['lastused']} < '{$inactive}'";
break;
case 'Medium':
// Medium security - delete session info if session cookie has
// expired or user decided not to remember themself and inactivity timeout
// OR max number of days have elapsed without logging back in
$where = "WHERE ({$sessioninfocolumn['remember']} = 0\n AND {$sessioninfocolumn['lastused']} < '{$inactive}')\n OR ({$sessioninfocolumn['lastused']} < '{$daysold}')\n OR ({$sessioninfocolumn['uid']} = 0 AND {$sessioninfocolumn['lastused']} < '{$inactive}')";
break;
case 'High':
default:
// High security - delete session info if user is inactive
$where = "WHERE {$sessioninfocolumn['lastused']} < '{$inactive}'";
break;
}
$res = DBUtil::deleteWhere('session_info', $where);
return (bool) $res;
//.........这里部分代码省略.........
示例15: resetVerifyChgFor
/**
* Removes a record from the users_verifychg table for a specified uid and changetype.
*
* Parameters passed in the $args array:
* -------------------------------------
* integer $args['uid'] The uid of the verifychg record to remove. Required.
* integer|array $args['changetype'] The changetype(s) of the verifychg record to remove. If more
* than one type is to be removed, use an array. Optional. If
* not specifed, all verifychg records for the user will be
* removed. Note: specifying an empty array will remove none.
*
* @param array $args All parameters passed to this function.
*
* @return void|bool Null on success, false on error.
*/
public function resetVerifyChgFor($args)
{
if (!isset($args['uid'])) {
$this->registerError(LogUtil::getErrorMsgArgs());
return false;
}
$uid = $args['uid'];
if (!is_numeric($uid) || ((int)$uid != $uid) || ($uid <= 1)) {
$this->registerError(LogUtil::getErrorMsgArgs());
return false;
}
if (!isset($args['changetype'])) {
$changeType = null;
} else {
$changeType = $args['changetype'];
if (!is_array($changeType)) {
$changeType = array($changeType);
} elseif (empty($changeType)) {
return;
}
foreach ($changeType as $theType) {
if (!is_numeric($theType) || ((int)$theType != $theType) || ($theType < 0)) {
$this->registerError(LogUtil::getErrorMsgArgs());
return false;
}
}
}
$dbinfo = DBUtil::getTables();
$verifyChgColumn = $dbinfo['users_verifychg_column'];
$where = "WHERE ({$verifyChgColumn['uid']} = {$uid})";
if (isset($changeType)) {
$where .= " AND ({$verifyChgColumn['changetype']} IN (" . implode(', ', $changeType) . "))";
}
DBUtil::deleteWhere('users_verifychg', $where);
}