本文整理汇总了PHP中ipDb函数的典型用法代码示例。如果您正苦于以下问题:PHP ipDb函数的具体用法?PHP ipDb怎么用?PHP ipDb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipDb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchQuery
public function searchQuery($searchVariables)
{
if (isset($searchVariables[$this->field]) && $searchVariables[$this->field] !== '') {
return ' `' . $this->field . '` = ' . ipDb()->getConnection()->quote($searchVariables[$this->field] * 100) . '';
}
return null;
}
示例2: getError
/**
* Get error
*
* @param array $values
* @param int $valueKey
* @param $environment
* @return string|bool
*/
public function getError($values, $valueKey, $environment)
{
if (!array_key_exists($valueKey, $values)) {
return false;
}
if ($values[$valueKey] == '' && empty($this->data['allowEmpty'])) {
return false;
}
$table = $this->data['table'];
$idField = empty($this->data['idField']) ? 'id' : $this->data['idField'];
$row = ipDb()->selectRow($table, '*', array($valueKey => $values[$valueKey]));
if (!$row) {
return false;
}
if (isset($values[$idField]) && $values[$idField] == $row[$idField]) {
return false;
}
if ($this->errorMessage !== null) {
return $this->errorMessage;
}
if ($environment == \Ip\Form::ENVIRONMENT_ADMIN) {
$errorText = __('The value should be unique', 'Ip-admin');
} else {
$errorText = __('The value should be unique', 'Ip');
}
return $errorText;
}
示例3: getList
/**
* @param string $languageCode
* @param int $parentId
* @return array
*/
protected static function getList($languageCode, $parentId)
{
$pages = ipDb()->selectAll('page', '*', array('parentId' => $parentId, 'isDeleted' => 0), 'ORDER BY `pageOrder`');
$answer = array();
//generate jsTree response array
foreach ($pages as $page) {
$pageData = array();
$pageData['state'] = 'closed';
$jsTreeId = 'page_' . $page['id'];
if (!empty($_SESSION['Pages.nodeOpen'][$jsTreeId])) {
$pageData['state'] = 'open';
}
$children = self::getList($languageCode, $page['id']);
if (count($children) === 0) {
$pageData['children'] = false;
$pageData['state'] = 'leaf';
}
$pageData['children'] = $children;
if ($page['isVisible']) {
$icon = '';
} else {
$icon = ipFileUrl('Ip/Internal/Pages/assets/img/file_hidden.png');
}
$pageData['li_attr'] = array('id' => $jsTreeId, 'rel' => 'page', 'languageId' => $languageCode, 'pageId' => $page['id']);
$pageData['data'] = array('title' => $page['title'] . '', 'icon' => $icon);
//transform null into empty string. Null break JStree into infinite loop
$pageData['text'] = htmlspecialchars($page['title']);
$answer[] = $pageData;
}
return $answer;
}
示例4: generatePasswordResetSecret
private static function generatePasswordResetSecret($userId)
{
$secret = md5(ipConfig()->get('sessionName') . uniqid());
$data = array('resetSecret' => $secret, 'resetTime' => time());
ipDb()->update('administrator', $data, array('id' => $userId));
return $secret;
}
示例5: searchQuery
public function searchQuery($searchVariables)
{
if (isset($searchVariables[$this->field]) && $searchVariables[$this->field] !== '') {
return ' `' . $this->field . '` like ' . ipDb()->getConnection()->quote('%' . json_encode($searchVariables[$this->field]) . '%') . '';
}
return null;
}
示例6: checkIfChildren
public static function checkIfChildren($parentIds, $id)
{
$parentIds = implode(',', $parentIds);
if (empty($parentIds)) {
return false;
}
$table = ipTable('page');
$sql = "SELECT `id` FROM {$table} WHERE `parentId` IN ({$parentIds}) AND `isVisible` = 1 AND `isDeleted` = 0 ";
$results = ipDb()->fetchAll($sql);
$ids = array();
$found = false;
foreach ($results as $result) {
$ids[] = $result['id'];
if ($result['id'] == $id) {
$found = true;
break;
}
}
if ($found) {
return true;
} elseif (!empty($ids)) {
return self::checkIfChildren($ids, $id);
} else {
return false;
}
}
示例7: removePermission
public static function removePermission($permission, $administratorId = null)
{
if ($administratorId === null) {
$administratorId = ipAdminId();
}
$condition = array('permission' => $permission, 'administratorId' => $administratorId);
ipDb()->delete('permission', $condition);
}
示例8: getByCode
public static function getByCode($languageCode)
{
$row = ipDb()->selectRow('language', '*', array('code' => $languageCode));
if (!$row) {
return null;
}
return new self($row['id'], $row['code'], $row['url'], $row['title'], $row['abbreviation'], $row['isVisible'], $row['textDirection']);
}
示例9: veryEmail_10
public static function veryEmail_10($vcode)
{
$fcode = substr($vcode, 0, strpos($vcode, '-!'));
$mail = substr($vcode, strpos($vcode, '-!') + 2, 250);
ipDb()->update('comments', array('approved' => '1'), array('verification_code' => $fcode, 'email' => $mail));
$data = array('message' => __('Your email address has been verified. Thank you.', 'Comments'));
return ipView('view/mailVerified.php', $data)->render();
}
示例10: findFiles
/**
* Find all files bind to particular module
*/
public function findFiles($plugin, $instanceId = null)
{
$where = array('plugin' => $plugin);
if ($instanceId !== null) {
$where['instanceId'] = $instanceId;
}
return ipDb()->selectAll('repository_file', '*', $where);
}
示例11: ipWidgetDuplicated
public static function ipWidgetDuplicated($data)
{
$oldId = $data['oldWidgetId'];
$newId = $data['newWidgetId'];
$newRevisionId = ipDb()->selectValue('widget', 'revisionId', array('id' => $newId));
$widgetTable = ipTable('widget');
$sql = "\n UPDATE\n {$widgetTable}\n SET\n `blockName` = REPLACE(`blockName`, 'block_" . (int) $oldId . "', 'block_" . (int) $newId . "')\n WHERE\n `revisionId` = :newRevisionId\n ";
ipDb()->execute($sql, array('newRevisionId' => $newRevisionId));
}
示例12: getAll
/**
* Get all storage values
*
* @return array Key=>value array of all storage values
*/
public function getAll()
{
$values = ipDb()->selectAll($this->tableName, array($this->keyColumn, $this->valueColumn), array($this->namespaceColumn => $this->namespace));
$result = array();
foreach ($values as $value) {
$result[$value[$this->keyColumn]] = json_decode($value[$this->valueColumn], true);
}
return $result;
}
示例13: dropDataTableRepository
/**
* Drops the datatable repository db table
*/
private function dropDataTableRepository()
{
$ipTable = ipTable(TableRepository::DATA_TABLE_REPOSITORY);
$sql = "\n DROP TABLE {$ipTable}\n ";
try {
ipDb()->execute($sql);
} catch (\Ip\Exception\Db $e) {
ipLog()->error("Could not drop repository table. Statement: {$sql}, Message: " . $e->getMessage());
}
}
示例14: getPageByAlias
/**
* @param string $alias
* @param string|null $languageCode
* @return \Ip\Page
*/
public function getPageByAlias($alias, $languageCode = null)
{
if ($languageCode === null) {
$languageCode = ipContent()->getCurrentLanguage()->getCode();
}
$row = ipDb()->selectRow('page', '*', array('alias' => $alias, 'languageCode' => $languageCode, 'isDeleted' => 0));
if (!$row) {
return null;
}
return new \Ip\Page($row);
}
示例15: emptyPageForm
public static function emptyPageForm()
{
$form = new \Ip\Form();
$form->setEnvironment(\Ip\Form::ENVIRONMENT_ADMIN);
$pages = ipDb()->selectAll('page', 'id, title', array('isDeleted' => 1));
foreach ($pages as $page) {
$field = new \Ip\Form\Field\Checkbox(array('name' => 'page[]', 'label' => $page['title'], 'value' => true, 'postValue' => $page['id']));
$form->addField($field);
}
return $form;
}