本文整理汇总了PHP中DevblocksPlatform::setHttpResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::setHttpResponse方法的具体用法?PHP DevblocksPlatform::setHttpResponse怎么用?PHP DevblocksPlatform::setHttpResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::setHttpResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveTab
function saveTab()
{
@($id = DevblocksPlatform::importGPC($_POST['id'], 'integer', 0));
@($name = trim(DevblocksPlatform::importGPC($_POST['name'], 'string', 'New Search Engine')));
@($url = trim(DevblocksPlatform::importGPC($_POST['url'], 'string', '')));
@($delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'wgm.google_cse')));
return;
}
if (!empty($delete)) {
DAO_WgmGoogleCse::delete($id);
} else {
// Data massaging
$token = '';
if (!empty($url)) {
if (null != ($query_args = parse_url($url, PHP_URL_QUERY))) {
$args = array();
parse_str($query_args, $args);
$token = isset($args['cx']) ? $args['cx'] : '';
}
}
$fields = array(DAO_WgmGoogleCse::NAME => !empty($name) ? $name : 'New Search Engine', DAO_WgmGoogleCse::URL => $url, DAO_WgmGoogleCse::TOKEN => $token);
if (empty($id)) {
// Create
$id = DAO_WgmGoogleCse::create($fields);
} else {
// Edit
DAO_WgmGoogleCse::update($id, $fields);
}
}
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'wgm.google_cse')));
}
示例2: saveTab
function saveTab()
{
@($plugin_id = DevblocksPlatform::importGPC($_REQUEST['plugin_id'], 'string'));
@($access_ids = DevblocksPlatform::importGPC($_REQUEST['access_ids'], 'array', array()));
@($add_nickname = DevblocksPlatform::importGPC($_REQUEST['add_nickname'], 'string'));
@($deletes = DevblocksPlatform::importGPC($_REQUEST['deletes'], 'array', array()));
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'webapi')));
return;
}
// Deletes
if (!empty($deletes)) {
DAO_WebapiKey::delete($deletes);
}
// Edits
if (is_array($access_ids)) {
foreach ($access_ids as $access_id) {
$rights = array();
// ACL
@($aclAddresses = DevblocksPlatform::importGPC($_REQUEST['aclAddresses' . $access_id], 'integer', 0));
@($aclFnr = DevblocksPlatform::importGPC($_REQUEST['aclFnr' . $access_id], 'integer', 0));
@($aclOrgs = DevblocksPlatform::importGPC($_REQUEST['aclOrgs' . $access_id], 'integer', 0));
@($aclTasks = DevblocksPlatform::importGPC($_REQUEST['aclTasks' . $access_id], 'integer', 0));
@($aclParser = DevblocksPlatform::importGPC($_REQUEST['aclParser' . $access_id], 'integer', 0));
@($aclTickets = DevblocksPlatform::importGPC($_REQUEST['aclTickets' . $access_id], 'integer', 0));
@($aclKB = DevblocksPlatform::importGPC($_REQUEST['aclKB' . $access_id], 'array'));
$aclKBTopics = array();
foreach ($aclKB as $k => $v) {
$aclKBTopics[$v] = 1;
}
$rights['acl_addresses'] = $aclAddresses;
$rights['acl_fnr'] = $aclFnr;
$rights['acl_orgs'] = $aclOrgs;
$rights['acl_tasks'] = $aclTasks;
$rights['acl_parser'] = $aclParser;
$rights['acl_tickets'] = $aclTickets;
$rights['acl_kb_topics'] = $aclKBTopics;
// IPs
@($ipList = DevblocksPlatform::importGPC($_REQUEST['ips' . $access_id], 'string', ''));
if (!empty($ipList)) {
$ips = array_unique(DevblocksPlatform::parseCsvString($ipList));
$rights['ips'] = $ips;
}
$fields = array(DAO_WebapiKey::RIGHTS => serialize($rights));
DAO_WebapiKey::update($access_id, $fields);
}
}
// Add Access Key
if (!empty($add_nickname)) {
$gen_access_key = CerberusApplication::generatePassword(20);
$gen_secret_key = CerberusApplication::generatePassword(30);
$fields = array(DAO_WebapiKey::NICKNAME => $add_nickname, DAO_WebapiKey::ACCESS_KEY => $gen_access_key, DAO_WebapiKey::SECRET_KEY => $gen_secret_key);
$key_id = DAO_WebapiKey::create($fields);
}
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'webapi')));
exit;
}
示例3: saveTab
function saveTab()
{
$settings = CerberusSettings::getInstance();
@($plugin_id = DevblocksPlatform::importGPC($_REQUEST['plugin_id'], 'string'));
// Edit|Delete
@($ids = DevblocksPlatform::importGPC($_REQUEST['ids'], 'array', array()));
@($names = DevblocksPlatform::importGPC($_REQUEST['names'], 'array', array()));
@($urls = DevblocksPlatform::importGPC($_REQUEST['urls'], 'array', array()));
@($keys = DevblocksPlatform::importGPC($_REQUEST['keys'], 'array', array()));
@($deletes = DevblocksPlatform::importGPC($_REQUEST['deletes'], 'array', array()));
@($poster_workers = DevblocksPlatform::importGPC($_REQUEST['poster_workers'], 'string', ''));
// Add
@($name = DevblocksPlatform::importGPC($_REQUEST['name'], 'string', ''));
@($url = DevblocksPlatform::importGPC($_REQUEST['url'], 'string', ''));
@($secret_key = DevblocksPlatform::importGPC($_REQUEST['secret_key'], 'string', ''));
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'forums')));
return;
}
// Deletes
if (is_array($deletes) && !empty($deletes)) {
DAO_ForumsSource::delete($deletes);
}
if (!empty($poster_workers)) {
$settings->set(ChForumsPlugin::SETTING_POSTER_WORKERS, strtolower($poster_workers));
}
// Edits
if (is_array($ids) && !empty($ids)) {
foreach ($ids as $idx => $source_id) {
$source_name = $names[$idx];
$source_url = $urls[$idx];
$source_key = $keys[$idx];
$fields = array(DAO_ForumsSource::NAME => $source_name, DAO_ForumsSource::URL => $source_url, DAO_ForumsSource::SECRET_KEY => $source_key);
DAO_ForumsSource::update($source_id, $fields);
}
}
// Add
if (!empty($name) && !empty($url)) {
$fields = array(DAO_ForumsSource::NAME => $name, DAO_ForumsSource::URL => $url, DAO_ForumsSource::SECRET_KEY => $secret_key);
$source_id = DAO_ForumsSource::create($fields);
}
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'forums')));
exit;
}
示例4: saveAccountAction
function saveAccountAction()
{
@($first_name = DevblocksPlatform::importGPC($_REQUEST['first_name'], 'string', ''));
@($last_name = DevblocksPlatform::importGPC($_REQUEST['last_name'], 'string', ''));
@($change_password = DevblocksPlatform::importGPC($_REQUEST['change_password'], 'string', ''));
@($change_password2 = DevblocksPlatform::importGPC($_REQUEST['change_password2'], 'string', ''));
$tpl = DevblocksPlatform::getTemplateService();
$umsession = UmPortalHelper::getSession();
$active_user = $umsession->getProperty('sc_login', null);
if (!empty($active_user)) {
$fields = array(DAO_Address::FIRST_NAME => $first_name, DAO_Address::LAST_NAME => $last_name);
DAO_Address::update($active_user->id, $fields);
$tpl->assign('account_success', true);
if (!empty($change_password)) {
if (0 == strcmp($change_password, $change_password2)) {
DAO_AddressAuth::update($active_user->id, array(DAO_AddressAuth::PASS => md5($change_password)));
} else {
$tpl->assign('account_error', "The passwords you entered did not match.");
}
}
}
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'account')));
}
示例5: parseUploadAction
function parseUploadAction()
{
@($csv_file = $_FILES['csv_file']);
$active_worker = CerberusApplication::getActiveWorker();
if (!$active_worker->hasPriv('crm.opp.actions.import')) {
return;
}
if (!is_array($csv_file) || !isset($csv_file['tmp_name']) || empty($csv_file['tmp_name'])) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('activity', 'opps')));
return;
}
$visit = CerberusApplication::getVisit();
$tpl = DevblocksPlatform::getTemplateService();
$filename = basename($csv_file['tmp_name']);
$newfilename = APP_TEMP_PATH . '/' . $filename;
if (!rename($csv_file['tmp_name'], $newfilename)) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('activity', 'opps')));
return;
// [TODO] Throw error
}
$visit->set('crm.import.last.csv', $newfilename);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('activity', 'opps', 'import', 'step2')));
}
示例6: parseUploadAction
function parseUploadAction()
{
@($type = DevblocksPlatform::importGPC($_REQUEST['type'], 'string', ''));
$csv_file = $_FILES['csv_file'];
if (empty($type) || !is_array($csv_file) || !isset($csv_file['tmp_name']) || empty($csv_file['tmp_name'])) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('contacts', 'import')));
return;
}
$visit = CerberusApplication::getVisit();
$tpl = DevblocksPlatform::getTemplateService();
$filename = basename($csv_file['tmp_name']);
$newfilename = APP_TEMP_PATH . '/' . $filename;
if (!rename($csv_file['tmp_name'], $newfilename)) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('contacts', 'import')));
return;
// [TODO] Throw error
}
// [TODO] Move these to a request holding object?
$visit->set('import.last.type', $type);
$visit->set('import.last.csv', $newfilename);
$fp = fopen($newfilename, "rt");
if ($fp) {
$parts = fgetcsv($fp, 8192, ',', '"');
$tpl->assign('parts', $parts);
}
@fclose($fp);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('contacts', 'import', 'step2')));
}
示例7: saveLicenseAction
function saveLicenseAction()
{
@($key = DevblocksPlatform::importGPC($_POST['key'], 'string', ''));
if (empty($key)) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'license', 'empty')));
return;
}
// Clean off the wrapper
@($lines = explode("\r\n", trim($key)));
$company = '';
$features = array();
$key = '';
$valid = 0;
if (is_array($lines)) {
foreach ($lines as $line) {
if (0 == strcmp(substr($line, 0, 3), '---')) {
$valid++;
continue;
}
if (preg_match("/^(.*?)\\: (.*?)\$/", $line, $matches)) {
if (0 == strcmp($matches[1], "Company")) {
$company = $matches[2];
}
if (0 == strcmp($matches[1], "Feature")) {
$features[$matches[2]] = true;
}
} else {
$key .= trim($line);
}
}
}
if (2 != $valid || 0 != $key % 4) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'license', 'invalid')));
return;
}
// Save for reuse in form in case we need to redraw on error
$settings = PortSensorSettings::getInstance();
// $settings->set('company', trim($company));
ksort($features);
/*
* [IMPORTANT -- Yes, this is simply a line in the sand.]
* You're welcome to modify the code to meet your needs, but please respect
* our licensing. Buy a legitimate copy to help support the project!
* http://www.portsensor.com/
*/
$license = PortSensorLicense::getInstance();
// $license['name'] = CerberusHelper::strip_magic_quotes($company,'string');
$license['name'] = $company;
$license['features'] = $features;
$license['key'] = PortSensorHelper::base64_decode_strings($company, $key);
$settings->set(PortSensorSettings::LICENSE, serialize($license));
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'license')));
}
示例8: _saveTabFnrResource
private function _saveTabFnrResource()
{
// Form
@($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
@($name = DevblocksPlatform::importGPC($_REQUEST['name'], 'string', ''));
@($url = DevblocksPlatform::importGPC($_REQUEST['url'], 'string', ''));
@($topic_id = DevblocksPlatform::importGPC($_REQUEST['topic_id'], 'integer', 0));
@($do_delete = DevblocksPlatform::importGPC($_REQUEST['do_delete'], 'integer', 0));
if (DEMO_MODE) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'fnr')));
return;
}
// Deletes
if (!empty($do_delete)) {
DAO_FnrExternalResource::delete($id);
return;
}
$fields = array(DAO_FnrExternalResource::NAME => $name, DAO_FnrExternalResource::URL => $url, DAO_FnrExternalResource::TOPIC_ID => $topic_id);
// Edit
if (!empty($id)) {
DAO_FnrExternalResource::update($id, $fields);
// Add
} else {
$id = DAO_FnrExternalResource::create($fields);
}
}
示例9: doRecoverStep2Action
function doRecoverStep2Action()
{
@($code = DevblocksPlatform::importGPC($_REQUEST['code'], 'string'));
$email = $_SESSION[self::KEY_FORGOT_EMAIL];
$sentcode = $_SESSION[self::KEY_FORGOT_SENTCODE];
$_SESSION[self::KEY_FORGOT_CODE] = $code;
$worker_id = DAO_Worker::lookupAgentEmail($email);
if (empty($email) || empty($worker_id) || empty($code)) {
return;
}
if (0 == strcmp($sentcode, $code)) {
// passed
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('login', 'forgot', 'step3')));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
}
}
示例10: saveRssAction
function saveRssAction()
{
@($id = DevblocksPlatform::importGPC($_POST['id']));
$active_worker = CerberusApplication::getActiveWorker();
if (null != ($feed = DAO_ViewRss::getId($id)) && $feed->worker_id == $active_worker->id) {
DAO_ViewRss::delete($id);
}
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('preferences', 'rss')));
}
示例11: processRequest
/**
* Processes the HTTP request.
*
* @param DevblocksHttpRequest $request
* @param boolean $is_ajax
*/
static function processRequest(DevblocksHttpRequest $request, $is_ajax = false)
{
$path = $request->path;
$controller_uri = array_shift($path);
// [JAS]: Offer the platform a chance to intercept.
switch ($controller_uri) {
// [JAS]: Plugin-supplied URIs
default:
$routing = array();
$controllers = DevblocksPlatform::getExtensions('devblocks.controller', false);
// Add any controllers which have definitive routing
if (is_array($controllers)) {
foreach ($controllers as $controller_mft) {
if (isset($controller_mft->params['uri'])) {
$routing[$controller_mft->params['uri']] = $controller_mft->id;
}
}
}
// [TODO] Ask the platform to look at any routing maps (extension manifest) or
// controller objects
// print_r($routing);
// [TODO] Pages like 'tickets' currently work because APP_DEFAULT_CONTROLLER
// is the ChPageController which looks up those URIs in manifests
if (empty($controllers)) {
die("No controllers are available!");
}
// Set our controller based on the results
$controller_mft = isset($routing[$controller_uri]) ? $controllers[$routing[$controller_uri]] : $controllers[APP_DEFAULT_CONTROLLER];
// Instance our manifest
if (!empty($controller_mft)) {
$controller = $controller_mft->createInstance();
}
if ($controller instanceof DevblocksHttpRequestHandler) {
$controller->handleRequest($request);
// [JAS]: If we didn't write a new response, repeat the request
if (null == ($response = DevblocksPlatform::getHttpResponse())) {
$response = new DevblocksHttpResponse($request->path);
DevblocksPlatform::setHttpResponse($response);
}
// [JAS]: An Ajax request doesn't need the full Http cycle
if (!$is_ajax) {
$controller->writeResponse($response);
}
} else {
header("Status: 404");
die;
// [TODO] Improve
}
break;
}
return;
}
示例12: doReplyAction
function doReplyAction()
{
@($mask = DevblocksPlatform::importGPC($_REQUEST['mask'], 'string', ''));
@($content = DevblocksPlatform::importGPC($_REQUEST['content'], 'string', ''));
$umsession = UmPortalHelper::getSession();
$active_user = $umsession->getProperty('sc_login', null);
// Secure retrieval (address + mask)
list($tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MASK, '=', $mask), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id)), 1, 0, null, null, false);
$ticket = array_shift($tickets);
$messages = DAO_Ticket::getMessagesByTicket($ticket[SearchFields_Ticket::TICKET_ID]);
$last_message = array_pop($messages);
/* @var $last_message CerberusMessage */
$last_message_headers = $last_message->getHeaders();
unset($messages);
// Helpdesk settings
$settings = CerberusSettings::getInstance();
$global_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM, null);
// Ticket group settings
$group_id = $ticket[SearchFields_Ticket::TICKET_TEAM_ID];
@($group_from = DAO_GroupSettings::get($group_id, DAO_GroupSettings::SETTING_REPLY_FROM, ''));
// Headers
$to = !empty($group_from) ? $group_from : $global_from;
@($in_reply_to = $last_message_headers['message-id']);
@($message_id = CerberusApplication::generateMessageId());
$message = new CerberusParserMessage();
$message->headers['from'] = $active_user->email;
$message->headers['to'] = $to;
$message->headers['date'] = gmdate('r');
$message->headers['subject'] = 'Re: ' . $ticket[SearchFields_Ticket::TICKET_SUBJECT];
$message->headers['message-id'] = $message_id;
$message->headers['in-reply-to'] = $in_reply_to;
$message->body = sprintf("%s", $content);
CerberusParser::parseMessage($message, array('no_autoreply' => true));
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'history', $ticket[SearchFields_Ticket::TICKET_MASK])));
}
示例13: searchviewAction
function searchviewAction()
{
$visit = CerberusApplication::getVisit();
$response = DevblocksPlatform::getHttpRequest();
$path = $response->path;
array_shift($path);
// tickets
array_shift($path);
// searchview
$id = array_shift($path);
$view = C4_AbstractViewLoader::getView($id);
if (!empty($view->params)) {
$params = array();
// Index by field name for search system
if (is_array($view->params)) {
foreach ($view->params as $key => $criteria) {
/* @var $criteria DevblocksSearchCriteria */
$params[$key] = $criteria;
}
}
}
if (null == ($search_view = C4_AbstractViewLoader::getView(CerberusApplication::VIEW_SEARCH))) {
$search_view = C4_TicketView::createSearchView();
}
$search_view->params = $params;
$search_view->renderPage = 0;
C4_AbstractViewLoader::setView($search_view->id, $search_view);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('tickets', 'search')));
}
示例14: saveCustomerAccountAction
function saveCustomerAccountAction()
{
@($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0));
@($and_close = DevblocksPlatform::importGPC($_POST['and_close'], 'integer', 0));
@($id = DevblocksPlatform::importGPC($_POST['id'], 'integer'));
@($disabled = DevblocksPlatform::importGPC($_POST['account_is_disabled'], 'integer', 0));
@($import_source = DevblocksPlatform::importGPC($_POST['customer_account_import_source'], 'integer', 0));
@($account_number = DevblocksPlatform::importGPC($_REQUEST['customer_account_number'], 'string', ''));
@($account_name = DevblocksPlatform::importGPC($_REQUEST['customer_account_name'], 'string', ''));
$fields = array(DAO_CustomerAccount::IMPORT_SOURCE => $import_source, DAO_CustomerAccount::ACCOUNT_NAME => $account_name, DAO_CustomerAccount::ACCOUNT_NUMBER => $account_number, DAO_CustomerAccount::IS_DISABLED => $disabled);
// Update Customer Recipients
$status = DAO_CustomerAccount::update($customer_id, $fields);
if ($and_close) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('account')));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('customer', $customer_id, 'property')));
}
}
示例15: doSearchAction
public function doSearchAction()
{
@($query = DevblocksPlatform::importGPC($_REQUEST['query'], 'string', ''));
@($match = DevblocksPlatform::importGPC($_REQUEST['match'], 'string', ''));
$session = $this->getSession();
$session->setProperty('last_query', $query);
$session->setProperty('last_query_type', $match);
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', $this->getPortal(), 'search')));
}