本文整理汇总了PHP中DevblocksPlatform::getUrlService方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getUrlService方法的具体用法?PHP DevblocksPlatform::getUrlService怎么用?PHP DevblocksPlatform::getUrlService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevblocksPlatform
的用法示例。
在下文中一共展示了DevblocksPlatform::getUrlService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
function handleRequest(DevblocksHttpRequest $request)
{
@set_time_limit(0);
// no timelimit (when possible)
DevblocksPlatform::clearCache();
$stack = $request->path;
array_shift($stack);
// update
switch (array_shift($stack)) {
case 'locked':
if (!DevblocksPlatform::versionConsistencyCheck()) {
$url = DevblocksPlatform::getUrlService();
echo "<h1>PortSensor Portal</h1>";
echo "The application is currently waiting for an administrator to finish upgrading. " . "Please wait a few minutes and then " . sprintf("<a href='%s'>try again</a>.<br><br>", $url->write('c=update&a=locked'));
echo sprintf("If you're an admin you may <a href='%s'>finish the upgrade</a>.", $url->write('c=update'));
} else {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
}
break;
default:
$path = DEVBLOCKS_PATH . 'tmp' . DIRECTORY_SEPARATOR;
$file = $path . 'psupdate_lock';
if (!file_exists($file) || @filectime($file) + 600 < time()) {
// 10 min lock
touch($file);
// $settings = CerberusSettings::getInstance();
// $authorized_ips_str = $settings->get(CerberusSettings::AUTHORIZED_IPS);
// $authorized_ips = CerberusApplication::parseCrlfString($authorized_ips_str);
//
// $authorized_ip_defaults = CerberusApplication::parseCsvString(AUTHORIZED_IPS_DEFAULTS);
// $authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults);
//
// $pass = false;
// foreach ($authorized_ips as $ip)
// {
// if(substr($ip,0,strlen($ip)) == substr($_SERVER['REMOTE_ADDR'],0,strlen($ip)))
// { $pass=true; break; }
// }
$pass = true;
if (!$pass) {
echo 'Your IP address (' . $_SERVER['REMOTE_ADDR'] . ') is not authorized to update this helpdesk.';
return;
}
//echo "Running plugin patches...<br>";
if (DevblocksPlatform::runPluginPatches()) {
@unlink($file);
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home')));
} else {
@unlink($file);
echo "Failure!";
// [TODO] Needs elaboration
}
break;
} else {
echo "Another administrator is currently running update. Please wait...";
}
}
exit;
}
示例2: smarty_block_devblocks_url
function smarty_block_devblocks_url($params, $content, &$smarty)
{
$url = DevblocksPlatform::getUrlService();
$contents = $url->write($content, !empty($params['full']) ? true : false);
if (!empty($params['assign'])) {
$smarty->assign($params['assign'], $contents);
} else {
return $contents;
}
}
示例3: AnswernetMetlifeReportDRAction
function AnswernetMetlifeReportDRAction()
{
$translate = DevblocksPlatform::getTranslationService();
$url = DevblocksPlatform::getUrlService();
$filename = self::AnswernetMetlifeReportDRReport(0);
$full_filename = getcwd() . '/storage/answernet/' . $filename;
$href_filename = $url->write('storage/answernet/' . $filename, true);
print $translate->_('answernet.er.metlife.metlife.done');
print '<br>';
print $translate->_('answernet.er.metlife.generating');
print $translate->_('answernet.er.metlife.metlife.done');
print '<br><br>';
print '<b><a href=' . $href_filename . '>' . $translate->_('answernet.er.metlife.download.xls') . '</a></b>';
print '<br><br>';
}
示例4: _renderRecentChangesRss
private function _renderRecentChangesRss($portal)
{
header("Content-Type: text/xml");
$xmlstr = <<<XML
\t\t<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'>
\t\t</rss>
XML;
$xml = new SimpleXMLElement($xmlstr);
$translate = DevblocksPlatform::getTranslationService();
$url = DevblocksPlatform::getUrlService();
// Portal details
$portal_name = DAO_CommunityToolProperty::get($portal, UmScApp::PARAM_PAGE_TITLE, '');
// Channel
$channel = $xml->addChild('channel');
$channel->addChild('title', (!empty($portal_name) ? '[' . $portal_name . '] ' : '') . "Recently Changed Articles");
$channel->addChild('link', $url->write(sprintf('c=rss&kb=kb&a=recent_changes', $portal), true));
$channel->addChild('description', '');
// Limit topics to portal config
@($topics = unserialize(DAO_CommunityToolProperty::get($portal, UmScKbController::PARAM_KB_ROOTS, '')));
if (empty($topics)) {
return;
}
// Search Results
list($results, $null) = DAO_KbArticle::search(array(SearchFields_KbArticle::TOP_CATEGORY_ID => new DevblocksSearchCriteria(SearchFields_KbArticle::TOP_CATEGORY_ID, 'in', array_keys($topics))), 25, 0, SearchFields_KbArticle::UPDATED, false, false);
// [TODO] We should probably be building this feed with Zend Framework for compliance
foreach ($results as $article) {
$created = intval($article[SearchFields_KbArticle::UPDATED]);
if (empty($created)) {
$created = time();
}
$eItem = $channel->addChild('item');
$escapedSubject = htmlspecialchars($article[SearchFields_KbArticle::TITLE], null, LANG_CHARSET_CODE);
//filter out a couple non-UTF-8 characters (0xC and ESC)
$escapedSubject = preg_replace("/[\f]/", '', $escapedSubject);
$eTitle = $eItem->addChild('title', $escapedSubject);
$eDesc = $eItem->addChild('description', htmlspecialchars($article[SearchFields_KbArticle::CONTENT], null, LANG_CHARSET_CODE));
$link = $url->write('c=kb&a=article&id=' . $article[SearchFields_KbArticle::ID], true);
$eLink = $eItem->addChild('link', $link);
$eDate = $eItem->addChild('pubDate', gmdate('D, d M Y H:i:s T', $created));
$eGuid = $eItem->addChild('guid', md5($escapedSubject . $link . $created));
$eGuid->addAttribute('isPermaLink', "false");
}
echo $xml->asXML();
}
示例5: authenticateAction
function authenticateAction()
{
// Pull from $_POST
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
@($email = DevblocksPlatform::importGPC($_POST['email']));
@($password = DevblocksPlatform::importGPC($_POST['password']));
$url_service = DevblocksPlatform::getUrlService();
$worker = DAO_Worker::login($email, $password);
if (!is_null($worker)) {
$session = DevblocksPlatform::getSessionService();
$visit = new UsermeetVisit();
$visit->setWorker($worker);
$session->setVisit($visit);
//authentication passed
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path);
// Worker
$worker = UsermeetApplication::getActiveWorker();
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
if (empty($devblocks_response->path)) {
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login', 'failed'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例6: render
function render()
{
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
$active_worker = FegApplication::getActiveWorker();
$visit = FegApplication::getVisit();
$response = DevblocksPlatform::getHttpResponse();
$translate = DevblocksPlatform::getTranslationService();
$url = DevblocksPlatform::getUrlService();
$stack = $response->path;
@array_shift($stack);
// customer
@($customer_id = array_shift($stack));
@($customer = DAO_CustomerAccount::get($customer_id));
if (empty($customer)) {
echo "<H1>" . $translate->_('customer.display.invalid_customer') . "</H1>";
return;
}
$tpl->assign('customer_id', $customer_id);
// Tabs
$tab_manifests = DevblocksPlatform::getExtensions('feg.customer.tab', false);
$tpl->assign('tab_manifests', $tab_manifests);
@($tab_selected = array_shift($stack));
if (empty($tab_selected)) {
$tab_selected = 'property';
}
$tpl->assign('tab_selected', $tab_selected);
switch ($tab_selected) {
case 'property':
@($tab_parm = array_shift($stack));
break;
}
// ====== Who's Online
$whos_online = DAO_Worker::getAllOnline();
if (!empty($whos_online)) {
$tpl->assign('whos_online', $whos_online);
$tpl->assign('whos_online_count', count($whos_online));
}
$tpl->display('file:' . $this->_TPL_PATH . 'customer/index.tpl');
}
示例7: authenticateAction
function authenticateAction()
{
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
$manifest = DevblocksPlatform::getExtension('login.default');
$inst = $manifest->createInstance();
/* @var $inst Extension_LoginAuthenticator */
$url_service = DevblocksPlatform::getUrlService();
if ($inst->authenticate()) {
//authentication passed
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path);
// Worker
$worker = CerberusApplication::getActiveWorker();
// Timezone
if (null != ($timezone = DAO_WorkerPref::get($worker->id, 'timezone'))) {
$_SESSION['timezone'] = $timezone;
@date_default_timezone_set($timezone);
}
// Language
if (null != ($lang_code = DAO_WorkerPref::get($worker->id, 'locale'))) {
$_SESSION['locale'] = $lang_code;
DevblocksPlatform::setLocale($lang_code);
}
if (!empty($devblocks_response->path) && $devblocks_response->path[0] == 'login') {
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login', 'failed'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例8: saveCommentAction
function saveCommentAction()
{
@($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer'));
@($comment = DevblocksPlatform::importGPC($_REQUEST['comment'], 'string', ''));
// Worker is logged in
if (null === ($active_worker = CerberusApplication::getActiveWorker())) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display', $ticket_id)));
}
$worker_email = $active_worker->email;
// Worker address exists
if (null === ($address = CerberusApplication::hashLookupAddress($active_worker->email, true))) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display', $ticket_id)));
}
// Form was filled in
if (empty($ticket_id) || empty($comment)) {
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display', $ticket_id)));
}
$fields = array(DAO_TicketComment::CREATED => time(), DAO_TicketComment::TICKET_ID => $ticket_id, DAO_TicketComment::ADDRESS_ID => $address->id, DAO_TicketComment::COMMENT => $comment);
$comment_id = DAO_TicketComment::create($fields);
@($ticket = DAO_Ticket::getTicket($ticket_id));
// Notifications
$url_writer = DevblocksPlatform::getUrlService();
@($notify_worker_ids = DevblocksPlatform::importGPC($_REQUEST['notify_worker_ids'], 'array', array()));
if (is_array($notify_worker_ids) && !empty($notify_worker_ids)) {
foreach ($notify_worker_ids as $notify_worker_id) {
$fields = array(DAO_WorkerEvent::CREATED_DATE => time(), DAO_WorkerEvent::WORKER_ID => $notify_worker_id, DAO_WorkerEvent::URL => $url_writer->write('c=display&id=' . $ticket->mask, true), DAO_WorkerEvent::TITLE => 'New Ticket Comment', DAO_WorkerEvent::CONTENT => sprintf("#%s: %s\n%s comments: %s", $ticket->mask, $ticket->subject, $active_worker->getName(), $comment), DAO_WorkerEvent::IS_READ => 0);
DAO_WorkerEvent::create($fields);
}
}
DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display', $ticket->mask, 'comments')));
}
示例9: getCommunityToolAction
function getCommunityToolAction()
{
$worker = CerberusApplication::getActiveWorker();
if (!$worker || !$worker->is_superuser) {
echo "Access denied.";
return;
}
@($portal = DevblocksPlatform::importGPC($_REQUEST['portal'], 'string', ''));
@($is_submitted = DevblocksPlatform::importGPC($_POST['is_submitted'], 'integer', 0));
UmPortalHelper::setCode($portal);
if (!empty($is_submitted)) {
$is_submitted = time();
}
$tpl = DevblocksPlatform::getTemplateService();
$tpl->cache_lifetime = "0";
$tpl_path = dirname(__FILE__) . '/templates/';
$tpl->assign('path', $tpl_path);
$tpl->assign('portal', $portal);
$tpl->assign('is_submitted', $is_submitted);
if (null != ($instance = DAO_CommunityTool::getByCode($portal))) {
$tpl->assign('instance', $instance);
$manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true);
if (null != ($tool = $manifest->createInstance())) {
/* @var $app Extension_UsermeetTool */
$tpl->assign('tool', $tool);
}
}
// Community Record
$community_id = $instance->community_id;
$community = DAO_Community::get($community_id);
$tpl->assign('community', $community);
// Install
$url_writer = DevblocksPlatform::getUrlService();
$url = $url_writer->write('c=portal&a=' . $portal, true);
$url_parts = parse_url($url);
$host = $url_parts['host'];
@($port = $_SERVER['SERVER_PORT']);
$base = substr(DEVBLOCKS_WEBPATH, 0, -1);
// consume trailing
$path = substr($url_parts['path'], strlen(DEVBLOCKS_WEBPATH) - 1);
// consume trailing slash
@($parts = explode('/', $path));
if ($parts[1] == 'index.php') {
// 0 is null from /part1/part2 paths.
unset($parts[1]);
}
$path = implode('/', $parts);
$tpl->assign('host', $host);
$tpl->assign('is_ssl', $url_writer->isSSL() ? 1 : 0);
$tpl->assign('port', $port);
$tpl->assign('base', $base);
$tpl->assign('path', $path);
$tpl->display('file:' . $tpl_path . 'community/config/tab/tool_config.tpl');
}
示例10: getLink
function getLink($source_id)
{
$url = DevblocksPlatform::getUrlService();
return $url->write('c=display&id=' . $source_id);
}
示例11: getSourceInfo
function getSourceInfo($object_id)
{
if (null == ($opp = DAO_CrmOpportunity::get($object_id))) {
return;
}
$url = DevblocksPlatform::getUrlService();
return array('name' => '[Opp] ' . $opp->name, 'url' => $url->write(sprintf('c=crm&a=opps&id=%d', $opp->id)));
}
示例12: showTabInstallationAction
function showTabInstallationAction()
{
@($tool_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('path', $this->_TPL_PATH);
if (null != ($tool = DAO_CommunityTool::get($tool_id))) {
$tpl->assign('tool', $tool);
}
// Install
$url_writer = DevblocksPlatform::getUrlService();
$url = $url_writer->write('c=portal&a=' . $tool->code, true);
$url_parts = parse_url($url);
$host = $url_parts['host'];
@($port = $_SERVER['SERVER_PORT']);
$base = substr(DEVBLOCKS_WEBPATH, 0, -1);
// consume trailing
$path = substr($url_parts['path'], strlen(DEVBLOCKS_WEBPATH) - 1);
// consume trailing slash
@($parts = explode('/', $path));
if ($parts[1] == 'index.php') {
// 0 is null from /part1/part2 paths.
unset($parts[1]);
}
$path = implode('/', $parts);
$tpl->assign('host', $host);
$tpl->assign('is_ssl', $url_writer->isSSL() ? 1 : 0);
$tpl->assign('port', $port);
$tpl->assign('base', $base);
$tpl->assign('path', $path);
$tpl->display('file:' . $this->_TPL_PATH . 'community/display/tabs/installation/index.tpl');
}
示例13: authenticateLDAPAction
function authenticateLDAPAction()
{
@($server = DevblocksPlatform::importGPC($_POST['server']));
@($port = DevblocksPlatform::importGPC($_POST['port']));
@($dn = DevblocksPlatform::importGPC($_POST['dn']));
@($password = DevblocksPlatform::importGPC($_POST['password']));
@($original_path = explode(',', DevblocksPlatform::importGPC($_POST['original_path'])));
@($original_query_str = DevblocksPlatform::importGPC($_POST['original_query']));
$manifest = DevblocksPlatform::getExtension('login.ldap');
$inst = $manifest->createInstance();
/* @var $inst CerberusLoginPageExtension */
$url_service = DevblocksPlatform::getUrlService();
if ($inst->authenticate(array('server' => $server, 'port' => $port, 'dn' => $dn, 'password' => $password))) {
//authentication passed
$original_query = $url_service->parseQueryString($original_query_str);
if ($original_path[0] == '') {
unset($original_path[0]);
}
$devblocks_response = new DevblocksHttpResponse($original_path, $original_query);
if ($devblocks_response->path[0] == 'login') {
$session = DevblocksPlatform::getSessionService();
$visit = $session->getVisit();
$tour_enabled = false;
if (!empty($visit) && !is_null($visit->getWorker())) {
$worker = $visit->getWorker();
$tour_enabled = intval(DAO_WorkerPref::get($worker->id, 'assist_mode', 1));
}
$next_page = $tour_enabled ? 'welcome' : 'home';
$devblocks_response = new DevblocksHttpResponse(array($next_page));
}
} else {
//authentication failed
$devblocks_response = new DevblocksHttpResponse(array('login'));
}
DevblocksPlatform::redirect($devblocks_response);
}
示例14: saveWorkerPeekAction
function saveWorkerPeekAction()
{
$translate = DevblocksPlatform::getTranslationService();
$active_worker = FegApplication::getActiveWorker();
if (!$active_worker || !$active_worker->is_superuser) {
return;
}
@($id = DevblocksPlatform::importGPC($_POST['id'], 'integer'));
@($view_id = DevblocksPlatform::importGPC($_POST['view_id'], 'string'));
@($first_name = DevblocksPlatform::importGPC($_POST['first_name'], 'string'));
@($last_name = DevblocksPlatform::importGPC($_POST['last_name'], 'string'));
@($title = DevblocksPlatform::importGPC($_POST['title'], 'string'));
@($email = DevblocksPlatform::importGPC($_POST['email'], 'string'));
@($password = DevblocksPlatform::importGPC($_POST['password'], 'string'));
@($is_superuser = DevblocksPlatform::importGPC($_POST['is_superuser'], 'integer', 0));
@($disabled = DevblocksPlatform::importGPC($_POST['is_disabled'], 'integer', 0));
// @$group_ids = DevblocksPlatform::importGPC($_POST['group_ids'],'array');
// @$group_roles = DevblocksPlatform::importGPC($_POST['group_roles'],'array');
@($delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
// [TODO] The superuser set bit here needs to be protected by ACL
if (empty($first_name)) {
$first_name = "Anonymous";
}
if (!empty($id) && !empty($delete)) {
// Can't delete or disable self
if ($active_worker->id != $id) {
DAO_Worker::delete($id);
}
} else {
if (empty($id) && null == DAO_Worker::getWhere(sprintf("%s=%s", DAO_Worker::EMAIL, Feg_ORMHelper::qstr($email)))) {
$workers = DAO_Worker::getAll();
$license = FegLicense::getInstance();
if (!empty($license) && !empty($license['serial']) || count($workers) < 3) {
// Creating new worker. If password is empty, email it to them
if (empty($password)) {
$settings = DevblocksPlatform::getPluginSettingsService();
$replyFrom = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM);
$replyPersonal = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL, '');
$url = DevblocksPlatform::getUrlService();
$password = FegApplication::generatePassword(8);
}
$fields = array(DAO_Worker::EMAIL => $email, DAO_Worker::PASS => $password);
$id = DAO_Worker::create($fields);
}
}
// end create worker
// Update
$fields = array(DAO_Worker::FIRST_NAME => $first_name, DAO_Worker::LAST_NAME => $last_name, DAO_Worker::TITLE => $title, DAO_Worker::EMAIL => $email, DAO_Worker::IS_SUPERUSER => $is_superuser, DAO_Worker::IS_DISABLED => $disabled);
// if we're resetting the password
if (!empty($password)) {
$fields[DAO_Worker::PASS] = md5($password);
}
// Update worker
DAO_Worker::update($id, $fields);
// Custom field saves
@($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
DAO_CustomFieldValue::handleFormPost(FegCustomFieldSource_Worker::ID, $id, $field_ids);
}
if (!empty($view_id)) {
$view = Feg_AbstractViewLoader::getView($view_id);
$view->render();
}
}
示例15: getContext
function getContext($issue, &$token_labels, &$token_values, $prefix=null) {
if(is_null($prefix))
$prefix = 'Milestone:';
$translate = DevblocksPlatform::getTranslationService();
// Polymorph
if(is_numeric($issue)) {
$issue = DAO_Issue::get($issue);
} elseif($issue instanceof Model_Issue) {
// It's what we want already.
} else {
$article = null;
}
/* @var $article Model_Issue */
// Token labels
$token_labels = array(
'id' => $prefix.$translate->_('common.id'),
'title' => $prefix.$translate->_('issue.title'),
'body' => $prefix.$translate->_('issue.body'),
'created|date' => $prefix.$translate->_('issue.created_date'),
'updated|date' => $prefix.$translate->_('issue.updated_date'),
'closed|date' => $prefix.$translate->_('issue.closed_date'),
'milestone_id'=> $prefix.$translate->_('issue.milestone_id'),
'state' => $prefix.$translate->_('issue.state'),
);
// Token values
$token_values = array();
// Token values
if(null != $article) {
$token_values['id'] = $issue->id;
$token_values['title'] = $issue->title;
$token_values['body'] = $issue->body;
$token_values['created_date'] = $issue->created_date;
$token_values['updated_date'] = $issue->updated_date;
$token_values['closed_date'] = $issue->closed_date;
$token_values['milestone_id'] = $issue->milestone_id;
$token_values['state'] = $issue->state;
// Milestones
if(null != ($categories = $article->getCategories()) && is_array($categories)) {
$token_values['categories'] = array();
foreach($categories as $category_id => $trail) {
foreach($trail as $step_id => $step) {
if(!isset($token_values['categories'][$category_id]))
$token_values['categories'][$category_id] = array();
$token_values['categories'][$category_id][$step_id] = $step->name;
}
}
}
// URL
$url_writer = DevblocksPlatform::getUrlService();
$token_values['record_url'] = $url_writer->writeNoProxy(sprintf("c=issues&action=issues&id=%d-%s", $issue->id, DevblocksPlatform::strToPermalink($issue->title)), true);
}
return TRUE;
}