本文整理汇总了PHP中db_ei函数的典型用法代码示例。如果您正苦于以下问题:PHP db_ei函数的具体用法?PHP db_ei怎么用?PHP db_ei使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_ei函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_utils_get_new_releases
function new_utils_get_new_releases($start_time, &$select, &$from, &$where)
{
$frsrf = new FRSReleaseFactory();
$select = "SELECT groups.group_name AS group_name, " . "groups.group_id AS group_id, " . "groups.unix_group_name AS unix_group_name, " . "frs_release.release_id AS release_id, " . "frs_release.name AS release_version, " . "frs_release.release_date AS release_date, " . "frs_package.package_id AS package_id ";
$from = "FROM groups,frs_package,frs_release ";
$where = "WHERE frs_release.release_date > " . db_ei($start_time) . " " . "AND frs_release.package_id = frs_package.package_id " . "AND frs_package.group_id = groups.group_id " . "AND frs_release.status_id=" . $frsrf->STATUS_ACTIVE . " " . "AND groups.is_public=1 ";
}
示例2: session_require
function session_require($req)
{
global $Language;
/*
Codendi admins always return true
*/
if (user_is_super_user()) {
return true;
}
if (isset($req['group']) && $req['group']) {
$query = "SELECT user_id FROM user_group WHERE user_id=" . user_getid() . " AND group_id=" . db_ei($req['group']);
if (isset($req['admin_flags']) && $req['admin_flags']) {
$query .= " AND admin_flags = '" . db_escape_string($req['admin_flags']) . "'";
}
if (db_numrows(db_query($query)) < 1 || !$req['group']) {
exit_error($Language->getText('include_session', 'insufficient_g_access'), $Language->getText('include_session', 'no_perm_to_view'));
}
} elseif (isset($req['user']) && $req['user']) {
if (user_getid() != $req['user']) {
exit_error($Language->getText('include_session', 'insufficient_u_access'), $Language->getText('include_session', 'no_perm_to_view'));
}
} elseif (isset($req['isloggedin']) && $req['isloggedin']) {
if (!user_isloggedin()) {
exit_error($Language->getText('include_session', 'required_login'), $Language->getText('include_session', 'login'));
}
} else {
exit_error($Language->getText('include_session', 'insufficient_access'), $Language->getText('include_session', 'no_access'));
}
}
示例3: service_create_service
/**
* Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
*
*
*
*/
function service_create_service($arr, $group_id, $template, $force_enable = false)
{
// Convert link to real values
// NOTE: if you change link variables here, change them also in src/www/project/admin/servicebar.php and src/www/include/Layout.class.php
$link = $arr['link'];
$pm = ProjectManager::instance();
if ($template['system']) {
$link = str_replace('$projectname', $pm->getProject($group_id)->getUnixName(), $link);
$link = str_replace('$sys_default_domain', $GLOBALS['sys_default_domain'], $link);
$link = str_replace('$group_id', $group_id, $link);
if ($GLOBALS['sys_force_ssl']) {
$sys_default_protocol = 'https';
} else {
$sys_default_protocol = 'http';
}
$link = str_replace('$sys_default_protocol', $sys_default_protocol, $link);
} else {
//for non-system templates
$link = service_replace_template_name_in_link($link, $template, $pm->getProject($group_id));
}
$is_used = isset($template['is_used']) ? $template['is_used'] : $arr['is_used'];
$server_id = isset($template['server_id']) ? $template['server_id'] : $arr['server_id'];
$sql = "INSERT INTO service (group_id, label, description, short_name, link, is_active, is_used, scope, rank, location, server_id, is_in_iframe) VALUES (" . db_ei($group_id) . ", '" . db_es($arr['label']) . "', '" . db_es($arr['description']) . "', '" . db_es($arr['short_name']) . "', '" . db_es($link) . "', " . db_ei($arr['is_active']) . ", " . ($force_enable ? 1 : db_ei($is_used)) . ", '" . db_es($arr['scope']) . "', " . db_ei($arr['rank']) . ", '" . db_es($arr['location']) . "', " . db_ei($server_id) . ", " . db_ei($arr['is_in_iframe']) . ")";
$result = db_query($sql);
if ($result) {
// activate corresponding references
$reference_manager =& ReferenceManager::instance();
if ($arr['short_name'] != "") {
$reference_manager->addSystemReferencesForService($template['id'], $group_id, $arr['short_name']);
}
return true;
} else {
return false;
}
}
示例4: svn_data_get_revision_detail
function svn_data_get_revision_detail($group_id, $commit_id, $rev_id = 0, $order = '')
{
$order_str = "";
if ($order) {
if ($order != 'filename') {
// SQLi Warning: no real possibility to escape $order here.
// We rely on a proper filtering of user input by calling methods.
$order_str = " ORDER BY " . $order;
} else {
$order_str = " ORDER BY dir, file";
}
}
//check user access rights
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$forbidden = svn_utils_get_forbidden_paths(user_getname(), $project->getSVNRootPath());
$where_forbidden = "";
if (!empty($forbidden)) {
while (list($no_access, ) = each($forbidden)) {
$where_forbidden .= " AND svn_dirs.dir not like '%" . db_es(substr($no_access, 1)) . "%' ";
}
}
// if the subversion revision id is given then it akes precedence on
// the internal commit_id (this is to make it easy for users to build
// URL to access a revision
if ($rev_id) {
// To be done -> get the commit ID from the svn-commit table
$sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.revision=" . db_ei($rev_id) . " " . "AND svn_commits.group_id=" . db_ei($group_id) . " " . $where_forbidden . $order_str;
} else {
$sql = "SELECT svn_commits.description, svn_commits.date, svn_commits.revision, svn_checkins.type,svn_checkins.commitid,svn_dirs.dir,svn_files.file " . "FROM svn_dirs, svn_files, svn_checkins, svn_commits " . "WHERE svn_checkins.fileid=svn_files.id " . "AND svn_checkins.dirid=svn_dirs.id " . "AND svn_checkins.commitid=svn_commits.id " . "AND svn_commits.id=" . db_ei($commit_id) . " " . $where_forbidden . $order_str;
}
$result = db_query($sql);
return $result;
}
示例5: snippet_data_get_license_from_id
function snippet_data_get_license_from_id($license_id)
{
$license_id = (int) $license_id;
$sql = "SELECT license_name FROM snippet_license WHERE license_id=" . db_ei($license_id);
$result = db_query($sql);
return db_result($result, 0, 0);
}
示例6: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例7: forum_show_nested_messages
function forum_show_nested_messages($thread_id, $msg_id)
{
global $total_rows, $Language;
$sql = "SELECT user.user_name,forum.has_followups,user.realname,user.user_id,forum.msg_id,forum.group_forum_id,forum.subject,forum.thread_id,forum.body,forum.date,forum.is_followup_to, forum_group_list.group_id " . "FROM forum,user,forum_group_list WHERE forum.thread_id=" . db_ei($thread_id) . " AND user.user_id=forum.posted_by AND forum.is_followup_to=" . db_ei($msg_id) . " AND forum_group_list.group_forum_id = forum.group_forum_id " . "ORDER BY forum.date ASC;";
$result = db_query($sql);
$rows = db_numrows($result);
$ret_val = '';
if ($result && $rows > 0) {
$ret_val .= '
<UL>';
/*
iterate and show the messages in this result
for each message, recurse to show any submessages
*/
for ($i = 0; $i < $rows; $i++) {
// increment the global total count
$total_rows++;
// show the actual nested message
$ret_val .= forum_show_a_nested_message($result, $i) . '<P>';
if (db_result($result, $i, 'has_followups') > 0) {
// Call yourself if there are followups
$ret_val .= forum_show_nested_messages($thread_id, db_result($result, $i, 'msg_id'));
}
}
$ret_val .= '
</UL>';
}
return $ret_val;
}
示例8: searchNotification
public function searchNotification($tracker_id, $user_id)
{
$tracker_id = $this->da->escapeInt($tracker_id);
$user_id = $this->da->escapeInt($user_id);
$sql = "SELECT role_label,event_label,notify \n FROM {$this->table_name}" . "_role AS r, {$this->table_name}" . "_event AS e, {$this->table_name} AS n \n WHERE n.tracker_id=" . db_ei($tracker_id) . " \n AND n.user_id=" . db_ei($user_id) . " \n AND n.role_id=r.role_id \n AND r.tracker_id=" . db_ei($tracker_id) . " \n AND n.event_id=e.event_id \n AND e.tracker_id=" . db_ei($tracker_id);
return $this->retrieve($sql);
}
示例9: printnode
function printnode($nodeid, $text, $depth = 0, $delete_ok = false)
{
global $Language;
$purifier = Codendi_HTMLPurifier::instance();
// print current node, then all subnodes
print '<BR>';
for ($i = 0; $i < $depth; $i++) {
print " ";
}
html_image('ic/cfolder15.png', array());
print ' ' . $purifier->purify($text) . " ";
if ($nodeid != 0) {
print ' <A href="trove_cat_edit.php?trove_cat_id=' . $nodeid . '">[' . $Language->getText('admin_trove_cat_list', 'edit') . ']</A> ';
}
if ($delete_ok) {
print ' <A href="trove_cat_delete.php?trove_cat_id=' . $nodeid . '">[' . $Language->getText('admin_trove_cat_list', 'delete') . ']</A> ';
}
if ($nodeid != 0) {
print ' ' . help_button('trove_cat', $nodeid) . "\n";
}
$res_child = db_query("SELECT trove_cat_id,fullname,parent FROM trove_cat " . "WHERE parent='" . db_ei($nodeid) . "' ORDER BY fullpath");
while ($row_child = db_fetch_array($res_child)) {
$delete_ok = $row_child["parent"] != 0;
printnode($row_child["trove_cat_id"], $row_child["fullname"], $depth + 1, $delete_ok);
}
}
示例10: fetchDatas
/**
* Fill the arrays $this->source_refs_datas and $this->target_refs_datas
* for the current CrossReferenceFactory
*/
function fetchDatas()
{
$sql = "SELECT * \n FROM cross_references \n WHERE (target_gid=" . db_ei($this->entity_gid) . " AND target_id='" . db_ei($this->entity_id) . "' AND target_type='" . db_es($this->entity_type) . "' )\n OR (source_gid=" . db_ei($this->entity_gid) . " AND source_id='" . db_ei($this->entity_id) . "' AND source_type='" . db_es($this->entity_type) . "' )";
$res = db_query($sql);
if ($res && db_numrows($res) > 0) {
$this->source_refs_datas = array();
$this->target_refs_datas = array();
while ($field_array = db_fetch_array($res)) {
$target_id = $field_array['target_id'];
$target_gid = $field_array['target_gid'];
$target_type = $field_array['target_type'];
$target_key = $field_array['target_keyword'];
$source_id = $field_array['source_id'];
$source_gid = $field_array['source_gid'];
$source_type = $field_array['source_type'];
$source_key = $field_array['source_keyword'];
$user_id = $field_array['user_id'];
$created_at = $field_array['created_at'];
if ($target_id == $this->entity_id && $target_gid == $this->entity_gid && $target_type == $this->entity_type) {
$this->source_refs_datas[] = new CrossReference($source_id, $source_gid, $source_type, $source_key, $target_id, $target_gid, $target_type, $target_key, $user_id);
}
if ($source_id == $this->entity_id && $source_gid == $this->entity_gid && $source_type == $this->entity_type) {
$this->target_refs_datas[] = new CrossReference($source_id, $source_gid, $source_type, $source_key, $target_id, $target_gid, $target_type, $target_key, $user_id);
}
}
}
}
示例11: Widget_MySurveys
function Widget_MySurveys()
{
$this->Widget('mysurveys');
$no_survey = true;
// Get id and title of the survey that will be promoted to user page. default = survey whose id=1
if ($GLOBALS['sys_my_page_survey']) {
$developer_survey_id = $GLOBALS['sys_my_page_survey'];
} else {
$developer_survey_id = "1";
}
$survey = SurveySingleton::instance();
$sql = "SELECT * from surveys WHERE survey_id=" . db_ei($developer_survey_id);
$result = db_query($sql);
$group_id = db_result($result, 0, 'group_id');
$purifier = Codendi_HTMLPurifier::instance();
$survey_title = $purifier->purify($survey->getSurveyTitle(db_result($result, 0, 'survey_title')));
// Check that the survey is active
$devsurvey_is_active = db_result($result, 0, 'is_active');
if ($devsurvey_is_active == 1) {
$sql = "SELECT * FROM survey_responses " . "WHERE survey_id='" . db_ei($developer_survey_id) . "' AND user_id='" . db_ei(user_getid()) . "'";
$result = db_query($sql);
if (db_numrows($result) < 1) {
$no_survey = false;
$this->content .= '<a href="/survey/survey.php?group_id=' . $group_id . '&survey_id=' . $developer_survey_id . '">' . $survey_title . '</a>';
}
}
if ($no_survey) {
$this->content .= $GLOBALS['Language']->getText('my_index', 'no_survey');
}
}
示例12: deleteArtifactFromDateReminderProcessing
/**
* Delete artifact from artifact_date_reminder_processing table
*
* @param field_id: the field id
* @param artifact_id: the artifact id
* @param group_artifact_id: the tracker id
*
* @return nothing
*/
function deleteArtifactFromDateReminderProcessing($field_id, $artifact_id, $group_artifact_id)
{
if ($field_id == 0) {
$del = sprintf('DELETE FROM artifact_date_reminder_processing' . ' WHERE artifact_id=%d' . ' AND group_artifact_id=%d', db_ei($artifact_id), db_ei($group_artifact_id));
} else {
$del = sprintf('DELETE FROM artifact_date_reminder_processing' . ' WHERE artifact_id=%d' . ' AND field_id=%d' . ' AND group_artifact_id=%d', db_ei($artifact_id), db_ei($field_id), db_ei($group_artifact_id));
}
$result = db_query($del);
}
示例13: listallchilds
function listallchilds($nodeid, &$list)
{
// list current node and then all subnodes
$res_child = db_query("SELECT trove_cat_id, parent, shortname FROM trove_cat " . "WHERE parent='" . db_ei($nodeid) . "'");
while ($row_child = db_fetch_array($res_child)) {
$list[] = $row_child['trove_cat_id'];
listallchilds($row_child['trove_cat_id'], $list);
}
}
示例14: cacheFieldsWithNotification
function cacheFieldsWithNotification($group_artifact_id)
{
$sql = 'SELECT field_id' . ' FROM artifact_date_reminder_settings' . ' WHERE group_artifact_id = ' . db_ei($group_artifact_id);
$res = db_query($sql);
if ($res && !db_error($res)) {
while ($row = db_fetch_array($res)) {
$this->fieldsWithNotification[$row['field_id']] = true;
}
}
}
示例15: setLoginDate
/**
* Record when user log on Codendi
*
* @param Integer $userId Id of the user
* @param Integer $date Date of login (timestamp)
*
* @return Boolean
*/
function setLoginDate($userId, $date)
{
$sql = 'UPDATE plugin_ldap_user' . ' SET login_confirmation_date = ' . db_ei($date) . ' WHERE user_id = ' . db_ei($userId);
$updated = $this->update($sql);
if (!$updated) {
// Try to insert
$updated = $this->createLdapUser($userId, $date);
}
return $updated;
}