本文整理匯總了PHP中Misc::escapeInteger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Misc::escapeInteger方法的具體用法?PHP Misc::escapeInteger怎麽用?PHP Misc::escapeInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Misc
的用法示例。
在下文中一共展示了Misc::escapeInteger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDetails
/**
* Method used to get the details of a specific resolution.
*
* @access public
* @param integer $res_id The resolution ID
* @return array The details of the resolution
*/
function getDetails($res_id)
{
$stmt = "SELECT\n *\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "resolution\n WHERE\n res_id=" . Misc::escapeInteger($res_id);
$res = $GLOBALS["db_api"]->dbh->getRow($stmt, DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return "";
} else {
return $res;
}
}
示例2: getFieldDisplaySettings
/**
* Returns display settings for a specific project.
*
* @access public
* @param integer $prj_id The project ID
* @return array An associative array of minimum role required to access a field.
*/
function getFieldDisplaySettings($prj_id)
{
$stmt = "SELECT\n pfd_field,\n pfd_min_role\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_field_display\n WHERE\n pfd_prj_id = " . Misc::escapeInteger($prj_id);
$res = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
}
$fields = Project::getDisplayFields();
foreach ($fields as $field_name => $field_title) {
if (!isset($res[$field_name])) {
$res[$field_name] = 0;
}
}
return $res;
}
示例3: getEmailAccount
/**
* Method used to get the first support email account associated
* with the current activated project.
*
* @access public
* @param integer $prj_id The ID of the project. If blank the currently project will be used.
* @return integer The email account ID
*/
function getEmailAccount($prj_id = false)
{
if ($prj_id == false) {
$prj_id = Auth::getCurrentProject();
}
$stmt = "SELECT\n ema_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_account\n WHERE\n ema_prj_id=" . Misc::escapeInteger($prj_id) . "\n LIMIT\n 0, 1";
$res = $GLOBALS["db_api"]->dbh->getOne($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return "";
} else {
return $res;
}
}
示例4: buildWhereClause
/**
* Method used to get the list of issues to be displayed in the grid layout.
*
* @param array $options The search parameters
* @return string The where clause
*/
public static function buildWhereClause($options)
{
$usr_id = Auth::getUserID();
$prj_id = Auth::getCurrentProject();
$role_id = User::getRoleByUser($usr_id, $prj_id);
$usr_details = User::getDetails($usr_id);
$stmt = ' AND iss_usr_id = usr_id';
if ($role_id == User::getRoleID('Customer')) {
$crm = CRM::getInstance($prj_id);
$contact = $crm->getContact($usr_details['usr_customer_contact_id']);
$stmt .= " AND iss_customer_contract_id IN('" . implode("','", $contact->getContractIDS()) . "')";
$stmt .= " AND iss_customer_id ='" . Auth::getCurrentCustomerID() . "'";
} elseif ($role_id == User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
$stmt .= " AND (\n iss_usr_id = {$usr_id} OR\n iur_usr_id = {$usr_id}\n )";
}
if (!empty($usr_details['usr_par_code'])) {
// restrict partners
$stmt .= " AND ipa_par_code = '" . Misc::escapeString($usr_details['usr_par_code']) . "'";
}
if (!empty($options['users'])) {
$stmt .= " AND (\n";
if (stristr($options['users'], 'grp') !== false) {
$chunks = explode(':', $options['users']);
$stmt .= 'iss_grp_id = ' . Misc::escapeInteger($chunks[1]);
} else {
if ($options['users'] == '-1') {
$stmt .= 'isu_usr_id IS NULL';
} elseif ($options['users'] == '-2') {
$stmt .= 'isu_usr_id IS NULL OR isu_usr_id=' . $usr_id;
} elseif ($options['users'] == '-3') {
$stmt .= 'isu_usr_id = ' . $usr_id . ' OR iss_grp_id = ' . User::getGroupID($usr_id);
} elseif ($options['users'] == '-4') {
$stmt .= 'isu_usr_id IS NULL OR isu_usr_id = ' . $usr_id . ' OR iss_grp_id = ' . User::getGroupID($usr_id);
} else {
$stmt .= 'isu_usr_id =' . Misc::escapeInteger($options['users']);
}
}
$stmt .= ')';
}
if (!empty($options['reporter'])) {
$stmt .= ' AND iss_usr_id = ' . Misc::escapeInteger($options['reporter']);
}
if (!empty($options['show_authorized_issues'])) {
$stmt .= " AND (iur_usr_id={$usr_id})";
}
if (!empty($options['show_notification_list_issues'])) {
$stmt .= " AND (sub_usr_id={$usr_id})";
}
if (!empty($options['keywords'])) {
$stmt .= " AND (\n";
if ($options['search_type'] == 'all_text' && APP_ENABLE_FULLTEXT) {
$stmt .= 'iss_id IN(' . implode(', ', self::getFullTextIssues($options)) . ')';
} elseif ($options['search_type'] == 'customer' && CRM::hasCustomerIntegration($prj_id)) {
// check if the user is trying to search by customer name / email
$crm = CRM::getInstance($prj_id);
$customer_ids = $crm->getCustomerIDsByString($options['keywords'], true);
if (count($customer_ids) > 0) {
$stmt .= ' iss_customer_id IN (' . implode(', ', $customer_ids) . ')';
} else {
// no results, kill query
$stmt .= ' iss_customer_id = -1';
}
} else {
$stmt .= '(' . Misc::prepareBooleanSearch('iss_summary', $options['keywords']);
$stmt .= ' OR ' . Misc::prepareBooleanSearch('iss_description', $options['keywords']) . ')';
}
$stmt .= "\n) ";
}
if (!empty($options['customer_id'])) {
$stmt .= " AND iss_customer_id='" . Misc::escapeString($options['customer_id']) . "'";
}
if (!empty($options['priority'])) {
$stmt .= ' AND iss_pri_id=' . Misc::escapeInteger($options['priority']);
}
if (!empty($options['status'])) {
$stmt .= ' AND iss_sta_id=' . Misc::escapeInteger($options['status']);
}
if (!empty($options['category'])) {
if (!is_array($options['category'])) {
$options['category'] = array($options['category']);
}
$stmt .= ' AND iss_prc_id IN(' . implode(', ', Misc::escapeInteger($options['category'])) . ')';
}
if (!empty($options['hide_closed'])) {
$stmt .= ' AND sta_is_closed=0';
}
if (!empty($options['release'])) {
$stmt .= ' AND iss_pre_id = ' . Misc::escapeInteger($options['release']);
}
if (!empty($options['product'])) {
$stmt .= ' AND ipv_pro_id = ' . Misc::escapeInteger($options['product']);
}
// now for the date fields
$date_fields = array('created_date', 'updated_date', 'last_response_date', 'first_response_date', 'closed_date');
//.........這裏部分代碼省略.........
示例5: getEmailListing
/**
* Method used to get the list of emails to be displayed in the
* grid layout.
*
* @param array $options The search parameters
* @param integer $current_row The current page number
* @param integer $max The maximum number of rows per page
* @return array The list of issues to be displayed
*/
public static function getEmailListing($options, $current_row = 0, $max = 5)
{
$prj_id = Auth::getCurrentProject();
if ($max == 'ALL') {
$max = 9999999;
}
$start = $current_row * $max;
$stmt = 'SELECT
sup_id,
sup_ema_id,
sup_iss_id,
sup_customer_id,
sup_from,
sup_date,
sup_to,
sup_subject,
sup_has_attachment
FROM
(
{{%support_email}},
{{%email_account}}';
if (!empty($options['keywords'])) {
$stmt .= ', {{%support_email_body}} ';
}
$stmt .= '
)
LEFT JOIN
{{%issue}}
ON
sup_iss_id = iss_id';
$stmt .= self::buildWhereClause($options);
$stmt .= '
ORDER BY
' . Misc::escapeString($options['sort_by']) . ' ' . Misc::escapeString($options['sort_order']);
$total_rows = Pager::getTotalRows($stmt);
$stmt .= '
LIMIT
' . Misc::escapeInteger($max) . ' OFFSET ' . Misc::escapeInteger($start);
try {
$res = DB_Helper::getInstance()->getAll($stmt);
} catch (DbException $e) {
return array('list' => '', 'info' => '');
}
if (count($res) < 1 && $current_row > 0) {
// if there are no results, and the page is not the first page reset page to one and reload results
Auth::redirect("emails.php?pagerRow=0&rows={$max}");
}
if (CRM::hasCustomerIntegration($prj_id)) {
$crm = CRM::getInstance($prj_id);
$customer_ids = array();
foreach ($res as $row) {
if (!empty($row['sup_customer_id']) && !in_array($row['sup_customer_id'], $customer_ids)) {
$customer_ids[] = $row['sup_customer_id'];
}
}
if (count($customer_ids) > 0) {
$company_titles = $crm->getCustomerTitles($customer_ids);
}
}
foreach ($res as &$row) {
$row['sup_date'] = Date_Helper::getFormattedDate($row['sup_date']);
$row['sup_subject'] = Mime_Helper::fixEncoding($row['sup_subject']);
$row['sup_from'] = implode(', ', Mail_Helper::getName($row['sup_from'], true));
if (empty($row['sup_to']) && !empty($row['sup_iss_id'])) {
$row['sup_to'] = 'Notification List';
} else {
$to = Mail_Helper::getName($row['sup_to']);
// Ignore unformattable headers
if (!Misc::isError($to)) {
$row['sup_to'] = Mime_Helper::fixEncoding($to);
}
}
if (CRM::hasCustomerIntegration($prj_id)) {
// FIXME: $company_titles maybe used uninitialied
$row['customer_title'] = $company_titles[$row['sup_customer_id']];
}
}
$total_pages = ceil($total_rows / $max);
$last_page = $total_pages - 1;
return array('list' => $res, 'info' => array('current_page' => $current_row, 'start_offset' => $start, 'end_offset' => $start + count($res), 'total_rows' => $total_rows, 'total_pages' => $total_pages, 'previous_page' => $current_row == 0 ? '-1' : $current_row - 1, 'next_page' => $current_row == $last_page ? '-1' : $current_row + 1, 'last_page' => $last_page));
}
示例6: getAssocList
/**
* Method used to get the list of priorities as an associative array in the
* style of (id => title)
*
* @access public
* @param integer $prj_id The project ID
* @return array The list of priorities
*/
function getAssocList($prj_id)
{
static $list;
if (count(@$list[$prj_id]) > 0) {
return $list[$prj_id];
}
$stmt = "SELECT\n pri_id,\n pri_title\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority\n WHERE\n pri_prj_id=" . Misc::escapeInteger($prj_id) . "\n ORDER BY\n pri_rank ASC";
$res = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return "";
} else {
$list[$prj_id] = $res;
return $res;
}
}
示例7: getAssocList
/**
* Method used to get a list as an associative array of the
* releases.
*
* @access public
* @param integer $prj_id The project ID
* @param boolean $show_all_dates If true all releases, not just those with future dates will be returned
* @return array The list of releases
*/
function getAssocList($prj_id, $show_all_dates = false)
{
$stmt = "SELECT\n pre_id,\n pre_title\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release\n WHERE\n pre_prj_id=" . Misc::escapeInteger($prj_id) . " AND\n (\n pre_status='available'";
if ($show_all_dates != true) {
$stmt .= " AND\n pre_scheduled_date >= '" . gmdate('Y-m-d') . "'";
}
$stmt .= "\n )\n ORDER BY\n pre_scheduled_date ASC";
$res = $GLOBALS["db_api"]->dbh->getAssoc($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return "";
} else {
return $res;
}
}
示例8: getSummaryByUser
/**
* Returns summary information about all time spent by a user in a specified time frame.
*
* @access public
* @param string $usr_id The ID of the user this report is for.
* @param integer The timestamp of the beginning of the report.
* @param integer The timestamp of the end of this report.
* @return array An array of data containing information about time trackinge
*/
function getSummaryByUser($usr_id, $start, $end)
{
$stmt = "SELECT\n ttc_title,\n COUNT(ttr_id) as total,\n SUM(ttr_time_spent) as total_time\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking,\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "time_tracking_category\n WHERE\n ttr_ttc_id = ttc_id AND\n ttr_usr_id = " . Misc::escapeInteger($usr_id) . " AND\n ttr_created_date BETWEEN '" . Misc::escapeString($start) . "' AND '" . Misc::escapeString($end) . "'\n GROUP BY\n ttc_title";
$res = $GLOBALS["db_api"]->dbh->getAssoc($stmt, false, array(), DB_FETCHMODE_ASSOC);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return array();
} else {
if (count($res) > 0) {
foreach ($res as $index => $row) {
$res[$index]["formatted_time"] = Misc::getFormattedTime($res[$index]["total_time"], true);
}
}
return $res;
}
}
示例9: send
/**
* Converts an email to a draft and sends it.
*
* @access public
* @param integer $draft_id The id of the draft to send.
*/
function send($draft_id)
{
global $HTTP_POST_VARS;
$draft_id = Misc::escapeInteger($draft_id);
$draft = Draft::getDetails($draft_id);
$HTTP_POST_VARS["issue_id"] = $draft["emd_iss_id"];
$HTTP_POST_VARS["subject"] = $draft["emd_subject"];
$HTTP_POST_VARS["from"] = User::getFromHeader(Auth::getUserID());
$HTTP_POST_VARS["to"] = $draft["to"];
$HTTP_POST_VARS["cc"] = @join(";", $draft["cc"]);
$HTTP_POST_VARS["message"] = $draft["emd_body"];
$HTTP_POST_VARS["ema_id"] = Email_Account::getEmailAccount();
$res = Support::sendEmail();
if ($res == 1) {
Draft::remove($draft_id);
}
return $res;
}
示例10: removeNotes
/**
* Removes the selected notes from the database.
*
* @access public
* @param array $ids An array of cno_id's to be deleted.
*/
function removeNotes($ids)
{
$stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note\n WHERE\n cno_id IN (" . join(", ", Misc::escapeInteger($ids)) . ")";
$res = $GLOBALS['db_api']->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return -1;
} else {
return 1;
}
}
示例11: getReplierIDByEmail
/**
* Returns the replier based on the given issue and email address combo.
*
* @access public
* @param integer $issue_id The id of the issue.
* @param string $email The email address of the user
* @return integer The id of the replier
*/
function getReplierIDByEmail($issue_id, $email)
{
$stmt = "SELECT\n iur_id\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user_replier\n LEFT JOIN\n " . ETEL_USER_TABLE . "\n ON\n iur_usr_id = usr_id\n WHERE\n iur_iss_id = " . Misc::escapeInteger($issue_id) . " AND\n (iur_email = '" . Misc::escapeString($email) . "' OR usr_email = '" . Misc::escapeString($email) . "')";
$res = $GLOBALS["db_api"]->dbh->getOne($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return 0;
}
return $res;
}
示例12: removeByProjects
/**
* Method used to remove all custom filters associated with some
* specific projects.
*
* @access public
* @param array $ids List of projects to remove from
* @return boolean Whether the removal worked properly or not
*/
function removeByProjects($ids)
{
$items = implode(", ", Misc::escapeInteger($ids));
$stmt = "DELETE FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "custom_filter\n WHERE\n cst_prj_id IN ({$items})";
$res = $GLOBALS["db_api"]->dbh->query($stmt);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return false;
} else {
return true;
}
}
示例13: elseif
if (Search::getParam('hide_closed', true) === '') {
$options_override['hide_closed'] = 1;
}
$_REQUEST['nosave'] = 1;
} elseif ($_REQUEST['view'] == 'customer_all' && isset($_REQUEST['customer_id'])) {
$options_override = array('customer_id' => Misc::escapeString($_REQUEST['customer_id']), 'rows' => $rows);
if (Search::getParam('hide_closed', true) === '') {
$options_override['hide_closed'] = 0;
}
$_REQUEST['nosave'] = 1;
$profile = Search_Profile::getProfile($usr_id, $prj_id, 'issue');
Search_Profile::remove($usr_id, $prj_id, 'issue');
Auth::redirect('list.php?customer_id=' . Misc::escapeString($_REQUEST['customer_id']) . "&hide_closed=1&rows={$rows}&sort_by=" . $profile['sort_by'] . '&sort_order=' . $profile['sort_order'] . '&nosave=1');
} elseif ($_REQUEST['view'] == 'reporter' && isset($_REQUEST['reporter_id'])) {
$profile = Search_Profile::getProfile($usr_id, $prj_id, 'issue');
Auth::redirect('list.php?reporter=' . Misc::escapeInteger($_REQUEST['reporter_id']) . "&hide_closed=1&rows={$rows}&sort_by=" . $profile['sort_by'] . '&sort_order=' . $profile['sort_order'] . '&nosave=1');
} elseif ($_REQUEST['view'] == 'clear') {
Search_Profile::remove($usr_id, $prj_id, 'issue');
Auth::redirect('list.php');
} elseif ($_REQUEST['view'] == 'clearandfilter') {
Search_Profile::remove($usr_id, $prj_id, 'issue');
Auth::redirect('list.php?' . str_replace('view=clearandfilter&', '', $_SERVER['QUERY_STRING']));
}
}
if (!empty($_REQUEST['nosave'])) {
$options = Search::saveSearchParams(false);
} else {
$options = Search::saveSearchParams();
}
$options += $options_override;
$options = array_merge($options, $options_override);
示例14: getMessageRecipients
function getMessageRecipients($type, $type_id)
{
$sql = "SELECT\n maq_recipient\n FROM\n " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "mail_queue\n WHERE\n maq_type = '" . Misc::escapeString($type) . "' AND\n maq_type_id = " . Misc::escapeInteger($type_id);
$res = $GLOBALS["db_api"]->dbh->getCol($sql);
if (PEAR::isError($res)) {
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
return false;
} else {
for ($i = 0; $i < count($res); $i++) {
$res[$i] = Mime_Helper::decodeAddress(str_replace('"', '', $res[$i]));
}
return $res;
}
}
示例15: createWhereClause
function createWhereClause($date_field, $user_field = false)
{
global $start_date, $end_date;
$sql = '';
if ($_REQUEST['report_type'] == 'recent') {
$sql .= "{$date_field} >= DATE_SUB('" . Date_API::getCurrentDateGMT() . "', INTERVAL " . Misc::escapeInteger($_REQUEST['amount']) . " " . Misc::escapeString($_REQUEST['unit']) . ")";
} else {
$sql .= "{$date_field} BETWEEN '{$start_date}' AND '{$end_date}'";
}
if ($user_field != false && !empty($_REQUEST['developer'])) {
$sql .= " AND {$user_field} = " . Misc::escapeString($_REQUEST['developer']);
}
$sql .= " ORDER BY {$date_field} " . Misc::escapeString($_REQUEST['sort_order']);
return $sql;
}