本文整理汇总了PHP中DBUtil类的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil类的具体用法?PHP DBUtil怎么用?PHP DBUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkForDuplicateReg
public function checkForDuplicateReg($params)
{
$db = new DBUtil();
$sql = "select count(*) as count from person p \n" . "join user u on p.person_id = u.person_id \n" . "join contact c on p.person_id = c.person_id \n" . "where email = :email or login = :username \n" . "or (first_name = :first_name and last_name = :last_name and postal_code = :postal_code) \n";
$stmt = $db->query($sql, $params);
if ($stmt && ($row = $stmt->fetch(PDO::FETCH_OBJ))) {
echo print_r($row, true);
if (empty($row->count)) {
// we haven't created this example or a similar user doesn't already exist
return false;
}
}
return true;
}
开发者ID:recoveredvader,项目名称:NilFactorFrameWork,代码行数:14,代码来源:NilFactorReg.php
示例2: _createOperationLog
/**
* Creates a new logging instance.
*
* @param Doctrine_Event $event Event.
* @param int $opType I/U/D for Insert/Update/Delete.
*
* @return void
*/
private function _createOperationLog(Doctrine_Event $event, $opType = 'I')
{
$data = $event->getInvoker();
$tableName = $this->getTableNameFromEvent($event);
$idColumn = $this->getIdColumnFromEvent($event);
$log = array();
$log['object_type'] = $tableName;
$log['object_id'] = $data[$idColumn];
$log['op'] = $opType;
if ($opType == 'U') {
$oldValues = $data->getLastModified(true);
$diff = array();
foreach ($oldValues as $column => $oldValue) {
if (empty($oldValue) && isset($data[$column]) && !empty($data[$column])) {
$diff[$column] = 'I: ' . $data[$column];
} elseif (!empty($oldValue) && isset($data[$column]) && !empty($data[$column])) {
$diff[$column] = 'U: ' . $data[$column];
} elseif (!empty($oldValue) && empty($data[$column])) {
$diff[$column] = 'D: ' . $oldValue;
}
}
$log['diff'] = serialize($diff);
} else {
// Convert object to array (otherwise we serialize the record object)
$log['diff'] = serialize($data->toArray());
}
DBUtil::insertObject($log, 'objectdata_log');
}
开发者ID:Silwereth,项目名称:core,代码行数:36,代码来源:Logging.php
示例3: Authenticate
public static function Authenticate($username, $pass)
{
$o = new DBUtil();
$username = mysql_real_escape_string($username);
$pass = md5(mysql_real_escape_string($pass));
$query = "CALL " . SP_LOGIN . "('" . $username . "','" . $pass . "')";
$res = $o->fetch($query);
$row = mysql_fetch_array($res);
$loginInfo = new LoginInfo();
$loginInfo->msg = $row['res_msg'];
$loginInfo->id = $row['id1'];
return $loginInfo;
}
开发者ID:nandkunal,项目名称:sustain-brand,代码行数:13,代码来源:loginManager.php
示例4: display
function display()
{
$prevpage = null;
$nextpage = null;
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId));
$tables = DBUtil::getTables();
$pageTable = $tables['content_page'];
$pageColumn = $tables['content_page_column'];
$options = array('makeTree' => true);
$options['orderBy'] = 'position';
$options['orderDir'] = 'desc';
$options['pageSize'] = 1;
$options['filter']['superParentId'] = $page['parentPageId'];
if ($page['position'] > 0) {
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} < {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$prevpage = $pages[0];
}
}
if (isset($page['position']) && $page['position'] >= 0) {
$options['orderDir'] = 'asc';
$options['filter']['where'] = "{$pageColumn['level']} = {$page['level']} and {$pageColumn['position']} > {$page['position']}";
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options);
if (count($pages) > 0) {
$nextpage = $pages[0];
}
}
$this->view->assign('loggedin', UserUtil::isLoggedIn());
$this->view->assign('prevpage', $prevpage);
$this->view->assign('nextpage', $nextpage);
return $this->view->fetch($this->getTemplate());
}
开发者ID:robbrandt,项目名称:Content,代码行数:33,代码来源:PageNavigation.php
示例5: do_main
function do_main()
{
$this->oPage->setBreadcrumbDetails(_kt("transactions"));
$this->oPage->setTitle(_kt('Folder transactions'));
$folder_data = array();
$folder_data["folder_id"] = $this->oFolder->getId();
$this->oPage->setSecondaryTitle($this->oFolder->getName());
$aTransactions = array();
// FIXME do we really need to use a raw db-access here? probably...
$sQuery = "SELECT DTT.name AS transaction_name, FT.transaction_namespace, U.name AS user_name, FT.comment AS comment, FT.datetime AS datetime " . "FROM " . KTUtil::getTableName("folder_transactions") . " AS FT LEFT JOIN " . KTUtil::getTableName("users") . " AS U ON FT.user_id = U.id " . "LEFT JOIN " . KTUtil::getTableName("transaction_types") . " AS DTT ON DTT.namespace = FT.transaction_namespace " . "WHERE FT.folder_id = ? ORDER BY FT.datetime DESC";
$aParams = array($this->oFolder->getId());
$res = DBUtil::getResultArray(array($sQuery, $aParams));
if (PEAR::isError($res)) {
var_dump($res);
// FIXME be graceful on failure.
exit(0);
}
// FIXME roll up view transactions
$aTransactions = $res;
// Set the namespaces where not in the transactions lookup
foreach ($aTransactions as $key => $transaction) {
if (empty($transaction['transaction_name'])) {
$aTransactions[$key]['transaction_name'] = $this->_getActionNameForNamespace($transaction['transaction_namespace']);
}
}
// render pass.
$this->oPage->title = _kt("Folder History");
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("kt3/view_folder_history");
$aTemplateData = array("context" => $this, "folder_id" => $folder_id, "folder" => $this->oFolder, "transactions" => $aTransactions);
return $oTemplate->render($aTemplateData);
}
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:32,代码来源:Transactions.php
示例6: transform
function transform()
{
global $default;
$iMimeTypeId = $this->oDocument->getMimeTypeId();
$sMimeType = KTMime::getMimeTypeName($iMimeTypeId);
$sFileName = $this->oDocument->getFileName();
$aTestTypes = array('application/octet-stream', 'application/zip', 'application/x-zip');
if (in_array($sMimeType, $aTestTypes)) {
$sExtension = KTMime::stripAllButExtension($sFileName);
$sTable = KTUtil::getTableName('mimetypes');
$sQuery = "SELECT id, mimetypes FROM {$sTable} WHERE LOWER(filetypes) = ?";
$aParams = array($sExtension);
$aRow = DBUtil::getOneResult(array($sQuery, $aParams));
if (PEAR::isError($aRow)) {
$default->log->debug("ODI: error in query: " . print_r($aRow, true));
return;
}
if (empty($aRow)) {
$default->log->debug("ODI: query returned entry");
return;
}
$id = $aRow['id'];
$mimetype = $aRow['mimetypes'];
$default->log->debug("ODI: query returned: " . print_r($aRow, true));
if (in_array($mimetype, $aTestTypes)) {
// Haven't changed, really not an OpenDocument file...
return;
}
if ($id) {
$this->oDocument->setMimeTypeId($id);
$this->oDocument->update();
}
}
parent::transform();
}
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:35,代码来源:OpenDocumentIndexer.php
示例7: upgrade
/**
* upgrade the module from an old version
*
* This function must consider all the released versions of the module!
* If the upgrade fails at some point, it returns the last upgraded version.
*
* @param string $oldVersion version number string to upgrade from
* @return mixed true on success, last valid version string or false if fails
*/
public function upgrade($oldversion)
{
// Upgrade dependent on old version number
switch ($oldversion) {
case '3.6':
// Rename 'thelang' block.
$table = 'blocks';
$sql = "UPDATE {$table} SET bkey = 'lang' WHERE bkey = 'thelang'";
\DBUtil::executeSQL($sql);
// Optional upgrade
if (in_array(\DBUtil::getLimitedTablename('message'), \DBUtil::metaTables())) {
$this->migrateMessages();
}
$this->migrateBlockNames();
$this->migrateExtMenu();
case '3.7':
case '3.7.0':
if (!\DBUtil::changeTable('blocks')) {
return false;
}
case '3.7.1':
$this->newBlockPositions();
case '3.8.0':
// update empty filter fields to an empty array
$entity = $this->name . '\\Entity\\Block';
$dql = "UPDATE {$entity} p SET p.filter = 'a:0:{}' WHERE p.filter = '' OR p.filter = 's:0:\"\";'";
$query = $this->entityManager->createQuery($dql);
$query->getResult();
case '3.8.1':
// future upgrade routines
}
// Update successful
return true;
}
开发者ID:planetenkiller,项目名称:core,代码行数:43,代码来源:Installer.php
示例8: IWmenu_tables
/**
* Define module tables
* @author Albert Perez Monfort ([email protected])
* @return module tables information
*/
function IWmenu_tables() {
// Initialise table array
$tables = array();
// IWmain table definition
$tables['IWmenu'] = DBUtil::getLimitedTablename('IWmenu');
//Noms dels camps
$tables['IWmenu_column'] = array('mid' => 'iw_mid',
'text' => 'iw_text',
'url' => 'iw_url',
'id_parent' => 'iw_id_parent',
'groups' => 'iw_groups',
'active' => 'iw_active',
'target' => 'iw_target',
'descriu' => 'iw_descriu',
'iorder' => 'iw_iorder',
'icon' => 'iw_icon',);
$tables['IWmenu_column_def'] = array('mid' => "I NOTNULL AUTO PRIMARY",
'text' => "C(255) NOTNULL DEFAULT ''",
'url' => "X NOTNULL",
'id_parent' => "I NOTNULL DEFAULT '0'",
'groups' => "X NOTNULL",
'active' => "I(1) NOTNULL DEFAULT '0'",
'target' => "I(1) NOTNULL DEFAULT '0'",
'descriu' => "X NOTNULL",
'iorder' => "I NOTNULL DEFAULT '0'",
'icon' => "C(40) NOTNULL DEFAULT ''");
// Return the table information
return $tables;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:38,代码来源:tables.php
示例9: upgrade
/**
* Update the IWwebbox module
* @author Albert Pérez Monfort ([email protected])
* @author Jaume Fernàndez Valiente ([email protected])
* @return bool true if successful, false otherwise
*/
public function upgrade($oldversion) {
// Update z_blocs table
$c = "UPDATE blocks SET bkey = 'Webbox' WHERE bkey = 'webbox'";
if (!DBUtil::executeSQL($c)) {
return false;
}
//Array de noms
$oldVarsNames = DBUtil::selectFieldArray("module_vars", 'name', "`modname` = 'IWwebbox'", '', false, '');
$newVarsNames = Array('url', 'width', 'height', 'scrolls', 'widthunit');
$newVars = Array('url' => 'http://phobos.xtec.cat/intraweb',
'width' => '100',
'height' => '600',
'scrolls' => '1',
'widthunit' => '%');
// Delete unneeded vars
$del = array_diff($oldVarsNames, $newVarsNames);
foreach ($del as $i) {
$this->delVar($i);
}
// Add new vars
$add = array_diff($newVarsNames, $oldVarsNames);
foreach ($add as $i) {
$this->setVar($i, $newVars[$i]);
}
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:40,代码来源:Installer.php
示例10: down
public function down()
{
$tables = array('bans', 'user_metadata', 'user_security', 'user_groups', 'users', 'group_permissions', 'groups_users');
foreach ($tables as $table) {
\DBUtil::drop_table($table);
}
}
开发者ID:inespons,项目名称:ethanol,代码行数:7,代码来源:001_create_ethanol_tables.php
示例11: getModuleConfig
public function getModuleConfig($args)
{
if (!isset($args['modulename'])) {
$args['modulename'] = ModUtil::getName();
}
$modconfig = array();
if ($args['modulename'] == 'list') {
$modconfig = DBUtil::selectObjectArray('scribite', '', 'modname');
} else {
$dbtables = DBUtil::getTables();
$scribitecolumn = $dbtables['scribite_column'];
$where = "{$scribitecolumn['modname']} = '" . $args['modulename'] . "'";
$item = DBUtil::selectObjectArray('scribite', $where);
if ($item == false) {
return;
}
$modconfig['mid'] = $item[0]['mid'];
$modconfig['modulename'] = $item[0]['modname'];
if (!is_int($item[0]['modfuncs'])) {
$modconfig['modfuncs'] = unserialize($item[0]['modfuncs']);
}
if (!is_int($item[0]['modareas'])) {
$modconfig['modareas'] = unserialize($item[0]['modareas']);
}
$modconfig['modeditor'] = $item[0]['modeditor'];
}
return $modconfig;
}
开发者ID:rmaiwald,项目名称:Scribite,代码行数:28,代码来源:User.php
示例12: down
function down()
{
// get the driver used
\Config::load('auth', true);
$drivers = \Config::get('auth.driver', array());
is_array($drivers) or $drivers = array($drivers);
if (in_array('Simpleauth', $drivers)) {
// get the tablename
\Config::load('simpleauth', true);
$table = \Config::get('simpleauth.table_name', 'users') . '_providers';
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('simpleauth.db_connection', null));
} elseif (in_array('Ormauth', $drivers)) {
// get the tablename
\Config::load('ormauth', true);
$table = \Config::get('ormauth.table_name', 'users') . '_providers';
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('ormauth.db_connection', null));
}
if (isset($table)) {
// drop the users remote table
\DBUtil::drop_table($table);
}
// reset any DBUtil connection set
\DBUtil::set_connection(null);
}
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:26,代码来源:008_auth_create_providers.php
示例13: getref
/**
* Return a reference depending on this reference name
*
* @param int $args['ref'] Id of the reference that have to be returned
* @return array array of items, or false on failure
*/
public function getref($args) {
if (!isset($args['ref'])) {
return LogUtil::registerError(__('Error! Could not do what you wanted. Please check your input.'));
}
return DBUtil::selectObjectByID('IWwebbox', $args['ref'], 'ref', '', '');
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:13,代码来源:User.php
示例14: ruleDeleted
public function ruleDeleted($rid)
{
$form = DBUtil::findUnique(DBUtil::$TABLE_ORDER_FORM, array(":rid" => $rid));
pdo_delete(DBUtil::$TABLE_ORDER_ITEM, array("fid" => $form['id']));
pdo_delete(DBUtil::$TABLE_ORDER_ORDER, array("fid" => $form['id']));
pdo_delete(DBUtil::$TABLE_ORDER_FORM, array('id' => $form['id']));
}
开发者ID:eduNeusoft,项目名称:weixin,代码行数:7,代码来源:module.php
示例15: down
public function down()
{
$tables = array('bans', 'groups_users', 'group_permissions', 'log_in_attempt', 'users', 'user_groups', 'user_metadata', 'user_oauth', 'user_security');
foreach ($tables as $table) {
\DBUtil::rename_table('ethanol_' . $table, $table);
}
}
开发者ID:inespons,项目名称:ethanol,代码行数:7,代码来源:003_table_prefix.php
示例16: SiriusXtecAuth_tables
/**
* Zikula Application Framework
*
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @author Joan Guillén i Pelegay ([email protected])
*
* @category Sirius Modules
*/
function SiriusXtecAuth_tables()
{
// Inclusió de la definició de la taula IWusers
$tables['IWusers'] = DBUtil::getLimitedTablename('IWusers');
$tables['IWusers_column'] = array(
'suid' => 'iw_suid',
'uid' => 'iw_uid',
'id' => 'iw_id',
'nom' => 'iw_nom',
'cognom1' => 'iw_cognom1',
'cognom2' => 'iw_cognom2',
'naixement' => 'iw_naixement',
'accio' => 'iw_accio',
'sex' => 'iw_sex',
'description' => 'iw_description',
'avatar' => 'iw_avatar',
'newavatar' => 'iw_newavatar',
);
$tables['IWusers_column_def'] = array('suid' => "I NOTNULL AUTO PRIMARY",
'uid' => "I NOTNULL DEFAULT '0'",
'id' => "C(50) NOTNULL DEFAULT ''",
'nom' => "C(25) NOTNULL DEFAULT ''",
'cognom1' => "C(25) NOTNULL DEFAULT ''",
'cognom2' => "C(25) NOTNULL DEFAULT ''",
'naixement' => "C(8) NOTNULL DEFAULT ''",
'accio' => "I(1) NOTNULL DEFAULT '0'",
'sex' => "C(1) NOTNULL DEFAULT ''",
'description' => "X NOTNULL",
'avatar' => "C(50) NOTNULL DEFAULT ''",
'newavatar' => "C(50) NOTNULL DEFAULT ''",
);
//Returns informació de les taules
return $tables;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:44,代码来源:tables.php
示例17: index
/**
* This method gets ran when a valid method name is not used in the command.
*
* Usage (from command line):
*
* php oil r setuptables:index "arguments"
*
* @return string
*/
public function index($args = NULL)
{
echo "\n===========================================";
echo "\nRunning task [Setuptables:Index]";
echo "\n-------------------------------------------\n\n";
/***************************
Put in TASK DETAILS HERE
**************************/
// 初期ユーザー定義
$init_users = array(array('name' => 'codex', 'password' => '1234', 'group' => 6));
// データベース接続
\DBUtil::set_connection(null);
// {{{ トランケート
$truncates = array('', '_permissions', '_metadata', '_user_permissions', '_group_permissions', '_role_permissions');
foreach ($truncates as $truncate) {
\DBUtil::truncate_table('users' . $truncate);
}
// }}}
// {{{ 初期ユーザー追加
foreach ($init_users as $init_user) {
// ユーザー名
$key = $init_user['name'];
// パスワード
$password = $init_user['password'];
// メールアドレス
$email = $key . '@xenophy.com';
// グループ
$group = $init_user['group'];
// 追加
$user = \Auth\Model\Auth_User::forge()->find(\Auth::create_user($key, $password, $email, $group));
// 保存
$user->save();
}
// }}}
}
开发者ID:xenophy,项目名称:code-x,代码行数:44,代码来源:setuptables.php
示例18: delete
function delete()
{
// security check
if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
$id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
$url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
$class = 'AddressBook_DBObject_' . ucfirst($ot);
if (!class_exists($class)) {
return z_exit(__f('Error! Unable to load class [%s]', $ot));
}
$object = new $class();
$data = $object->get($id);
if (!$data) {
LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
return System::redirect($url);
}
$object->delete();
if ($ot == "customfield") {
$sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
try {
DBUtil::executeSQL($sql, -1, -1, true, true);
} catch (Exception $e) {
}
}
LogUtil::registerStatus($this->__('Done! Item deleted.'));
return System::redirect($url);
}
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:30,代码来源:Admin.php
示例19: setstatus
/**
* This function sets active/inactive status.
*
* @param eid
*
* @return mixed true or Ajax error
*/
public function setstatus()
{
$this->checkAjaxToken();
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_ADMIN));
$eid = $this->request->request->get('eid', 0);
$status = $this->request->request->get('status', 0);
$alert = '';
if ($eid == 0) {
$alert .= $this->__('No ID passed.');
} else {
$item = array('eid' => $eid, 'status' => $status);
$res = DBUtil::updateObject($item, 'ephem', '', 'eid');
if (!$res) {
$alert .= $item['eid'] . ', ' . $this->__f('Could not change item, ID %s.', DataUtil::formatForDisplay($eid));
if ($item['status']) {
$item['status'] = 0;
} else {
$item['status'] = 1;
}
}
}
// get current status to return
$item = ModUtil::apiFunc($this->name, 'user', 'get', array('eid' => $eid));
if (!$item) {
$alert .= $this->__f('Could not get data, ID %s.', DataUtil::formatForDisplay($eid));
}
return new Zikula_Response_Ajax(array('eid' => $eid, 'status' => $item['status'], 'alert' => $alert));
}
开发者ID:nmpetkov,项目名称:Ephemerides,代码行数:35,代码来源:Ajax.php
示例20: down
function down()
{
// get the drivers defined
$drivers = normalize_driver_types();
if (in_array('Simpleauth', $drivers)) {
// get the tablename
\Config::load('simpleauth', true);
$basetable = \Config::get('simpleauth.table_name', 'users');
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('simpleauth.db_connection', null));
} elseif (in_array('Ormauth', $drivers)) {
// get the tablename
\Config::load('ormauth', true);
$basetable = \Config::get('ormauth.table_name', 'users');
// make sure the configured DB is used
\DBUtil::set_connection(\Config::get('ormauth.db_connection', null));
} else {
$basetable = 'users';
}
\DBUtil::drop_table($basetable . '_sessionscopes');
\DBUtil::drop_table($basetable . '_sessions');
\DBUtil::drop_table($basetable . '_scopes');
\DBUtil::drop_table($basetable . '_clients');
// reset any DBUtil connection set
\DBUtil::set_connection(null);
}
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:26,代码来源:009_auth_create_oauth2tables.php
注:本文中的DBUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论