function showTabAction() { @($ext_id = DevblocksPlatform::importGPC($_REQUEST['ext_id'], 'string', '')); if (null != ($tab_mft = DevblocksPlatform::getExtension($ext_id)) && null != ($inst = $tab_mft->createInstance()) && $inst instanceof Extension_ResearchTab) { $inst->showTab(); } }
function saveConfiguration() { // KB @($aFnrTopics = DevblocksPlatform::importGPC($_POST['topic_ids'], 'array', array())); $aFnrTopics = array_flip($aFnrTopics); DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_FNR_TOPICS, serialize($aFnrTopics)); }
function showTab() { @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0)); $visit = CerberusApplication::getVisit(); /* @var $visit CerberusVisit */ $translate = DevblocksPlatform::getTranslationService(); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('path', $this->tpl_path); $tpl->cache_lifetime = "0"; $view = C4_AbstractViewLoader::getView('', 'audit_log'); if (null == $view) { $view = new C4_TicketAuditLogView(); $view->id = 'audit_log'; $view->name = $translate->_('auditlog.audit_log'); $view->view_columns = array(SearchFields_TicketAuditLog::CHANGE_DATE, SearchFields_TicketAuditLog::WORKER_ID, SearchFields_TicketAuditLog::CHANGE_FIELD, SearchFields_TicketAuditLog::CHANGE_VALUE); $view->params = array(); $view->renderLimit = 15; $view->renderPage = 0; $view->renderSortBy = SearchFields_TicketAuditLog::CHANGE_DATE; $view->renderSortAsc = false; } $view->params = array(SearchFields_TicketAuditLog::TICKET_ID => new DevblocksSearchCriteria(SearchFields_TicketAuditLog::TICKET_ID, DevblocksSearchCriteria::OPER_EQ, $ticket_id)); $view->renderPage = 0; C4_AbstractViewLoader::setView($view->id, $view); $tpl->assign('view', $view); $tpl->display('file:' . $this->tpl_path . '/display/log/index.tpl'); }
function saveConfiguration(Model_CommunityTool $instance) { // KB @($aFnrTopics = DevblocksPlatform::importGPC($_POST['topic_ids'], 'array', array())); $aFnrTopics = array_flip($aFnrTopics); DAO_CommunityToolProperty::set($instance->code, self::PARAM_FNR_TOPICS, serialize($aFnrTopics)); }
function saveConfiguration() { // @$iRequireLogin = DevblocksPlatform::importGPC($_POST['kb_require_login'],'integer',0); // DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_REQUIRE_LOGIN, $iRequireLogin); // KB @($aFnrTopics = DevblocksPlatform::importGPC($_POST['topic_ids'], 'array', array())); $aFnrTopics = array_flip($aFnrTopics); DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_FNR_TOPICS, serialize($aFnrTopics)); }
function generateTicketsAction() { require_once dirname(__FILE__) . '/api/API.class.php'; $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(__FILE__) . '/templates/'; $tpl->assign('path', $tpl_path); $tpl->cache_lifetime = "0"; @($address = DevblocksPlatform::importGPC($_POST['address'], 'string')); @($dataset = DevblocksPlatform::importGPC($_POST['dataset'], 'string')); @($how_many = DevblocksPlatform::importGPC($_POST['how_many'], 'integer', 0)); if (empty($address)) { $tpl->assign('error', sprintf("Oops! '%s' is not a valid e-mail address.", htmlspecialchars($address))); $tpl->display('file:' . $tpl_path . 'config_tab/output.tpl'); return; } // [JAS]: [TODO] This should probably move to an extension point later switch ($dataset) { default: case "retail": $dataset = new RetailDataset(); break; case "hosting": $dataset = new HostingDataset(); break; case "edu": $dataset = new EduDataset(); break; case "gov": $dataset = new GovDataset(); break; case "npo": $dataset = new NPODataset(); break; case "spam": $dataset = new SpamDataset(); break; } $simulator = CerberusSimulator::getInstance(); $emails = $simulator->generateEmails($dataset, $how_many); foreach ($emails as $template) { if (preg_match("/\"(.*?)\" \\<(.*?)\\>/", $template['sender'], $matches)) { $personal = $matches[1]; $from = $matches[1]; } // [TODO] error checking $message = new CerberusParserMessage(); $message->headers['from'] = $template['sender']; $message->headers['to'] = $address; $message->headers['subject'] = $template['subject']; $message->headers['message-id'] = CerberusApplication::generateMessageId(); $message->body = sprintf("%s\r\n" . "\r\n" . "--\r\n%s\r\n", $template['body'], $personal); CerberusParser::parseMessage($message, array('no_autoreply' => true)); } $tpl->assign('output', sprintf("Success! %d simulated tickets were generated for %s", $how_many, htmlspecialchars($address))); $tpl->display('file:' . $tpl_path . 'config_tab/output.tpl'); }
function saveConfiguration() { // RSS Feeds @($aNewsRssTitles = DevblocksPlatform::importGPC($_POST['news_rss_title'], 'array', array())); @($aNewsRssUrls = DevblocksPlatform::importGPC($_POST['news_rss_url'], 'array', array())); $aNewsRss = array(); foreach ($aNewsRssUrls as $idx => $rss) { if (empty($rss)) { unset($aNewsRss[$idx]); continue; } $aNewsRss[$aNewsRssTitles[$idx]] = $rss; } DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_NEWS_RSS, serialize($aNewsRss)); }
/** * Proxy page actions from an extension's render() to the extension's scope. * */ function actionAction() { @($extid = DevblocksPlatform::importGPC($_REQUEST['extid'])); @($extid_a = DevblocksPlatform::strAlphaNumDash($_REQUEST['extid_a'])); $action = $extid_a . 'Action'; $reportMft = DevblocksPlatform::getExtension($extid); // If it's a value report extension, proxy the action if (null != ($reportInst = DevblocksPlatform::getExtension($extid, true)) && $reportInst instanceof Extension_Report) { // If we asked for a value method on the extension, call it if (method_exists($reportInst, $action)) { call_user_func(array(&$reportInst, $action)); } } return; }
function saveAnswernetAction() { $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->cache_lifetime = "0"; @($al_comment_enabled = DevblocksPlatform::importGPC($_REQUEST['al_comment_enabled'], 'integer', 0)); @($uf_comment_enabled = DevblocksPlatform::importGPC($_POST['uf_comment_enabled'], 'integer', 0)); @($al_merge_enabled = DevblocksPlatform::importGPC($_REQUEST['al_merge_enabled'], 'integer', 0)); @($uf_merge_enabled = DevblocksPlatform::importGPC($_POST['uf_merge_enabled'], 'integer', 0)); $this->setParam('al_comment_enabled', $al_comment_enabled); $this->setParam('uf_comment_enabled', $uf_comment_enabled); $this->setParam('al_merge_enabled', $al_merge_enabled); $this->setParam('uf_merge_enabled', $uf_merge_enabled); $tpl->display('file:' . $tpl_path . 'config_success.tpl'); }
function saveCerb5BlogAuditLogAction() { $settings = DevblocksPlatform::getPluginSettingsService(); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->cache_lifetime = "0"; @($al_comment_enabled = DevblocksPlatform::importGPC($_REQUEST['al_comment_enabled'], 'integer', 0)); @($uf_comment_enabled = DevblocksPlatform::importGPC($_POST['uf_comment_enabled'], 'integer', 0)); @($al_merge_enabled = DevblocksPlatform::importGPC($_REQUEST['al_merge_enabled'], 'integer', 0)); @($uf_merge_enabled = DevblocksPlatform::importGPC($_POST['uf_merge_enabled'], 'integer', 0)); $settings->set('cerb5blog.last_action_and_audit_log', 'al_comment_enabled', $al_comment_enabled); $settings->set('cerb5blog.last_action_and_audit_log', 'uf_comment_enabled', $uf_comment_enabled); $settings->set('cerb5blog.last_action_and_audit_log', 'al_merge_enabled', $al_merge_enabled); $settings->set('cerb5blog.last_action_and_audit_log', 'uf_merge_enabled', $uf_merge_enabled); $tpl->display('file:' . $tpl_path . 'config_success.tpl'); }
function authenticate() { // Pull from $_POST @($email = DevblocksPlatform::importGPC($_POST['email'])); @($password = DevblocksPlatform::importGPC($_POST['password'])); $worker = DAO_Worker::login($email, $password); if (!is_null($worker)) { $session = DevblocksPlatform::getSessionService(); $visit = new CerberusVisit(); $visit->setWorker($worker); $session->setVisit($visit); // [TODO] Only direct to /welcome when tour is enabled return true; } else { return false; } }
function showTab() { @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0)); $tpl = DevblocksPlatform::getTemplateService(); $tpl->cache_lifetime = "0"; $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; // $tpl->assign('response_uri', 'config/attachments'); $defaults = new C4_AbstractViewModel(); $defaults->class_name = 'C4_AttachmentView'; $defaults->name = 'Attachements View'; $defaults->id = 'ticket_view_attachements'; $defaults->renderLimit = 15; $view_attachements = C4_AbstractViewLoader::getView('ticket_view_attachements', $defaults); $view_attachements->params = array(SearchFields_Attachment::TICKET_ID => new DevblocksSearchCriteria(SearchFields_Attachment::TICKET_ID, DevblocksSearchCriteria::OPER_EQ, $ticket_id)); $view_attachements->renderPage = 0; C4_AbstractViewLoader::setView($view_attachements->id, $view_attachements); $tpl->assign('view_attachements', $view_attachements); $tpl->display('file:' . $tpl_path . 'attachments/index.tpl'); }
function showTab() { @($org = DevblocksPlatform::importGPC($_REQUEST['org_id'])); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->assign('path', $tpl_path); $contact = DAO_ContactOrg::get($org); $tpl->assign('contact', $contact); $defaults = new C4_AbstractViewModel(); $defaults->class_name = 'View_ContactOrg'; $defaults->id = View_ContactOrg::DEFAULT_ID; $view = C4_AbstractViewLoader::getView(View_ContactOrg::DEFAULT_ID, $defaults); $view->params = array(new DevblocksSearchCriteria(SearchFields_ContactOrg::PARENT_ORG_ID, '=', $contact->id)); $tpl->assign('view', $view); $tpl->assign('contacts_page', 'orgs'); $tpl->assign('response_uri', 'contacts/orgs'); $tpl->assign('view_fields', View_ContactOrg::getFields()); $tpl->assign('view_searchable_fields', View_ContactOrg::getSearchFields()); $tpl->display('file:' . $tpl_path . 'childorgs.tpl'); exit; }
function showTab() { @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0)); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl = DevblocksPlatform::getTemplateService(); //$visit = CerberusApplication::getVisit(); //$visit->set(Extension_ConfigTab::POINT, 'attachments'); $message_ids = array_keys(DAO_Message::getMessagesByTicket($ticket_id)); $comment_ids = array_keys(DAO_Comment::getByContext(CerberusContexts::CONTEXT_TICKET, $ticket_id)); $attachment_links = array_merge(DAO_AttachmentLink::getByContextIds(CerberusContexts::CONTEXT_MESSAGE, $message_ids), DAO_AttachmentLink::getByContextIds(CerberusContexts::CONTEXT_COMMENT, $comment_ids)); $defaults = new C4_AbstractViewModel(); $defaults->class_name = 'View_AttachmentLink'; $defaults->name = 'Attachements'; $defaults->id = '_ticket_view_attachements'; $defaults->renderLimit = 15; $view = C4_AbstractViewLoader::getView($defaults->id, $defaults); $view->renderPage = 0; $view->addParams(array(SearchFields_AttachmentLink::GUID => new DevblocksSearchCriteria(SearchFields_AttachmentLink::GUID, 'in', array_keys($attachment_links))), true); C4_AbstractViewLoader::setView($view->id, $view); $tpl->assign('view', $view); $tpl->display('file:' . $tpl_path . 'attachments/index.tpl'); }
function showTab() { @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0)); $tpl = DevblocksPlatform::getTemplateService(); $tpl_path = dirname(dirname(__FILE__)) . '/templates/'; $tpl->assign('path', $tpl_path); $ticket = DAO_Ticket::getTicket($ticket_id); $tpl->assign('ticket_id', $ticket_id); $tpl->assign('ticket', $ticket); // Receate the original spam decision $words = DevblocksPlatform::parseCsvString($ticket->interesting_words); $words = DAO_Bayes::lookupWordIds($words); // Calculate word probabilities foreach ($words as $idx => $word) { /* @var $word CerberusBayesWord */ $word->probability = CerberusBayes::calculateWordProbability($word); } $tpl->assign('words', $words); // Determine what the spam probability would be if the decision was made right now $analysis = CerberusBayes::calculateTicketSpamProbability($ticket_id, true); $tpl->assign('analysis', $analysis); $tpl->display('file:' . $tpl_path . 'ticket_tab/index.tpl'); }
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'))); }
function handleRequest(DevblocksHttpRequest $request) { @($reload = DevblocksPlatform::importGPC($_REQUEST['reload'], 'integer', 0)); @($loglevel = DevblocksPlatform::importGPC($_REQUEST['loglevel'], 'integer', 0)); $logger = DevblocksPlatform::getConsoleLog(); $translate = DevblocksPlatform::getTranslationService(); $settings = CerberusSettings::getInstance(); $authorized_ips_str = $settings->get(CerberusSettings::AUTHORIZED_IPS); $authorized_ips = DevblocksPlatform::parseCrlfString($authorized_ips_str); $authorized_ip_defaults = DevblocksPlatform::parseCsvString(AUTHORIZED_IPS_DEFAULTS); $authorized_ips = array_merge($authorized_ips, $authorized_ip_defaults); @($is_ignoring_wait = DevblocksPlatform::importGPC($_REQUEST['ignore_wait'], 'integer', 0)); $pass = false; foreach ($authorized_ips as $ip) { if (substr($ip, 0, strlen($ip)) == substr($_SERVER['REMOTE_ADDR'], 0, strlen($ip))) { $pass = true; break; } } if (!$pass) { echo vsprintf($translate->_('cron.ip_unauthorized'), $_SERVER['REMOTE_ADDR']); return; } $stack = $request->path; array_shift($stack); // cron $job_id = array_shift($stack); @set_time_limit(0); // Unlimited (if possible) $url = DevblocksPlatform::getUrlService(); $timelimit = intval(ini_get('max_execution_time')); if ($reload) { $reload_url = sprintf("%s?reload=%d&loglevel=%d&ignore_wait=%d", $url->write('c=cron' . ($job_id ? "&a=" . $job_id : "")), intval($reload), intval($loglevel), intval($is_ignoring_wait)); echo "<HTML>" . "<HEAD>" . "<TITLE></TITLE>" . "<meta http-equiv='Refresh' content='" . intval($reload) . ";" . $reload_url . "'>" . "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>" . "</HEAD>" . "<BODY>"; // onload=\"setTimeout(\\\"window.location.replace('".$url->write('c=cron')."')\\\",30);\" } // [TODO] Determine if we're on a time limit under 60 seconds $cron_manifests = DevblocksPlatform::getExtensions('cerberusweb.cron', true, true); $jobs = array(); if (empty($job_id)) { // do everything // Determine who wants to go first by next time and longest waiting $nexttime = time() + 86400; if (is_array($cron_manifests)) { foreach ($cron_manifests as $idx => $instance) { /* @var $instance CerberusCronPageExtension */ $lastrun = $instance->getParam(CerberusCronPageExtension::PARAM_LASTRUN, 0); if ($instance->isReadyToRun($is_ignoring_wait)) { if ($timelimit) { if ($lastrun < $nexttime) { $jobs[0] = $cron_manifests[$idx]; $nexttime = $lastrun; } } else { $jobs[] =& $cron_manifests[$idx]; } } } } } else { // single job $manifest = DevblocksPlatform::getExtension($job_id, false, true); if (empty($manifest)) { exit; } $instance = $manifest->createInstance(); if ($instance) { if ($instance->isReadyToRun($is_ignoring_wait)) { $jobs[0] =& $instance; } } } if (!empty($jobs)) { foreach ($jobs as $nextjob) { $nextjob->setParam(CerberusCronPageExtension::PARAM_LOCKED, time()); $nextjob->_run(); } } elseif ($reload) { $logger->info(vsprintf($translate->_('cron.nothing_to_do'), intval($reload))); } if ($reload) { echo "</BODY>" . "</HTML>"; } exit; }
function viewSortByAction(DevblocksHttpRequest $request) { @($view_id = DevblocksPlatform::importGPC($_REQUEST['id'], 'string', '')); @($sort_by = DevblocksPlatform::importGPC($_REQUEST['sort_by'], 'string', '')); if (null != ($view = UmScAbstractViewLoader::getView('', $view_id))) { $fields = $view->getColumns(); if (isset($fields[$sort_by])) { if (0 == strcasecmp($view->renderSortBy, $sort_by)) { // clicked same col? $view->renderSortAsc = !(bool) $view->renderSortAsc; // flip order } else { $view->renderSortBy = $sort_by; $view->renderSortAsc = true; } $view->renderPage = 0; UmScAbstractViewLoader::setView($view->id, $view); } $view->render(); } }
function saveConfiguration() { // Home @($sHomeHtml = DevblocksPlatform::importGPC($_POST['home_html'], 'string', '')); DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_HOME_HTML, $sHomeHtml); }
private function _putIdAction($path) { $xmlstr = $this->getPayload(); $xml_in = new SimpleXMLElement($xmlstr); $in_id = array_shift($path); if (empty($in_id)) { $this->_error("ID was not provided."); } if (null == ($event = DAO_WorkerEvent::get($in_id))) { $this->_error("ID not valid."); } $fields = array(); $flds = DAO_WorkerEvent::getFields(); unset($flds[DAO_WorkerEvent::ID]); foreach ($flds as $idx => $f) { $idx_name = $this->translate($idx, true); if ($idx_name == null) { continue; } @($value = DevblocksPlatform::importGPC($xml_in->{$idx_name}, 'string')); if ($this->isValid($idx_name, $value)) { $fields[$idx] = $value; } } if (!empty($fields)) { DAO_WorkerEvent::update($event->id, $fields); } $this->_getIdAction(array($event->id)); }
function savePluginsAction() { $translate = DevblocksPlatform::getTranslationService(); $worker = CerberusApplication::getActiveWorker(); if (!$worker || !$worker->is_superuser) { echo $translate->_('common.access_denied'); return; } if (DEMO_MODE) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'plugins'))); return; } @($plugins_enabled = DevblocksPlatform::importGPC($_REQUEST['plugins_enabled'], 'array')); $pluginStack = DevblocksPlatform::getPluginRegistry(); if (is_array($plugins_enabled)) { foreach ($plugins_enabled as $plugin_id) { $plugin = $pluginStack[$plugin_id]; $plugin->setEnabled(true); unset($pluginStack[$plugin_id]); } } // [JAS]: Clear unchecked plugins foreach ($pluginStack as $plugin) { // [JAS]: We can't force disable core here [TODO] Improve if ($plugin->id == 'cerberusweb.core') { continue; } $plugin->setEnabled(false); } DevblocksPlatform::clearCache(); // Run any enabled plugin patches // [TODO] Should the platform do this automatically on enable in order? $patchMgr = DevblocksPlatform::getPatchService(); $patches = DevblocksPlatform::getExtensions("devblocks.patch.container", false, true); if (is_array($patches)) { foreach ($patches as $patch_manifest) { /* @var $patch_manifest DevblocksExtensionManifest */ $container = $patch_manifest->createInstance(); /* @var $container DevblocksPatchContainerExtension */ $patchMgr->registerPatchContainer($container); } } if (!$patchMgr->run()) { // fail die("Failed updating plugins."); // [TODO] Make this more graceful } // Reload plugin translations DAO_Translation::reloadPluginStrings(); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'plugins'))); }
function doRegisterConfirmAction() { @($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string', '')); @($code = trim(DevblocksPlatform::importGPC($_REQUEST['code'], 'string', ''))); @($pass = DevblocksPlatform::importGPC($_REQUEST['pass'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $tpl->assign('register_email', $email); $tpl->assign('register_code', $code); if (!empty($email) && !empty($pass) && !empty($code)) { if (null != ($addy = DAO_Address::lookupAddress($email, false)) && !$addy->is_registered && !empty($addy->pass) && 0 == strcasecmp($code, $addy->pass)) { $fields = array(DAO_Address::IS_REGISTERED => 1, DAO_Address::PASS => md5($pass)); DAO_Address::update($addy->id, $fields); } else { $tpl->assign('register_error', sprintf("The confirmation code you entered does not match our records. Try again.")); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register', 'confirm'))); return; } } else { $tpl->assign('register_error', sprintf("You must enter a valid e-mail address, confirmation code and desired password to continue.")); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register', 'confirm'))); return; } }
function doSetCriteria($field, $oper, $value) { $criteria = null; switch ($field) { case SearchFields_WatcherMailFilter::NAME: // force wildcards if none used on a LIKE if (($oper == DevblocksSearchCriteria::OPER_LIKE || $oper == DevblocksSearchCriteria::OPER_NOT_LIKE) && false === strpos($value, '*')) { $value = '*' . $value . '*'; } $criteria = new DevblocksSearchCriteria($field, $oper, $value); break; case SearchFields_WatcherMailFilter::ID: case SearchFields_WatcherMailFilter::POS: $criteria = new DevblocksSearchCriteria($field, $oper, $value); break; case SearchFields_WatcherMailFilter::WORKER_ID: @($worker_id = DevblocksPlatform::importGPC($_REQUEST['worker_id'], 'array', array())); $criteria = new DevblocksSearchCriteria($field, $oper, $worker_id); break; case SearchFields_WatcherMailFilter::IS_DISABLED: @($bool = DevblocksPlatform::importGPC($_REQUEST['bool'], 'integer', 1)); $criteria = new DevblocksSearchCriteria($field, $oper, $bool); break; case SearchFields_WatcherMailFilter::CREATED: @($from = DevblocksPlatform::importGPC($_REQUEST['from'], 'string', '')); @($to = DevblocksPlatform::importGPC($_REQUEST['to'], 'string', '')); if (empty($from)) { $from = 0; } if (empty($to)) { $to = 'today'; } $criteria = new DevblocksSearchCriteria($field, $oper, array($from, $to)); break; } if (!empty($criteria)) { $this->params[$field] = $criteria; $this->renderPage = 0; } }
function doNotificationsMarkReadAction() { $worker = PortSensorApplication::getActiveWorker(); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); @($row_ids = DevblocksPlatform::importGPC($_REQUEST['row_id'], 'array', array())); if (is_array($row_ids) && !empty($row_ids)) { DAO_WorkerEvent::updateWhere(array(DAO_WorkerEvent::IS_READ => 1), sprintf("%s = %d AND %s IN (%s)", DAO_WorkerEvent::WORKER_ID, $worker->id, DAO_WorkerEvent::ID, implode(',', $row_ids))); DAO_WorkerEvent::clearCountCache($worker->id); } $myEventsView = Ps_AbstractViewLoader::getView($view_id); $myEventsView->render(); }
function saveConfigurationAction() { @($max_messages = DevblocksPlatform::importGPC($_POST['max_messages'], 'integer')); $this->setParam('max_messages', $max_messages); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'jobs'))); }
public static function handleFormPost($source_ext_id, $source_id, $field_ids) { $fields = DAO_CustomField::getBySource($source_ext_id); if (is_array($field_ids)) { foreach ($field_ids as $field_id) { if (!isset($fields[$field_id])) { continue; } switch ($fields[$field_id]->type) { case Model_CustomField::TYPE_MULTI_LINE: case Model_CustomField::TYPE_SINGLE_LINE: case Model_CustomField::TYPE_URL: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_DROPDOWN: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_MULTI_PICKLIST: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'array', array())); if (!empty($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_CHECKBOX: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'integer', 0)); $set = !empty($field_value) ? 1 : 0; DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $set); break; case Model_CustomField::TYPE_MULTI_CHECKBOX: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'array', array())); if (!empty($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $field_value); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_DATE: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); @($date = strtotime($field_value)); if (!empty($date)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, $date); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; case Model_CustomField::TYPE_NUMBER: case Model_CustomField::TYPE_WORKER: @($field_value = DevblocksPlatform::importGPC($_POST['field_' . $field_id], 'string', '')); if (0 != strlen($field_value)) { DAO_CustomFieldValue::setFieldValue($source_ext_id, $source_id, $field_id, intval($field_value)); } else { DAO_CustomFieldValue::unsetFieldValue($source_ext_id, $source_id, $field_id); } break; } } } return true; }
function saveLicensesAction() { $translate = DevblocksPlatform::getTranslationService(); $settings = DevblocksPlatform::getPluginSettingsService(); $worker = FegApplication::getActiveWorker(); if (!$worker || !$worker->is_superuser) { echo $translate->_('common.access_denied'); return; } @($name = DevblocksPlatform::importGPC($_POST['company_name'], 'string', '')); @($serial = DevblocksPlatform::importGPC($_POST['company_serial'], 'string', '')); @($email = DevblocksPlatform::importGPC($_POST['email'], 'string', '')); @($do_delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0)); if (!empty($do_delete)) { $settings->set('feg.core', FegSettings::LICENSE, ''); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings'))); return; } if (empty($name) || empty($serial) || empty($email)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'empty'))); return; } if (null == ($valid = FegLicense::validate($name, $serial, $email)) || 5 != count($valid)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'invalid'))); return; } /* * [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://feg.answernet.com/ */ $license = $valid; $settings->set('feg.core', FegSettings::LICENSE, serialize($license)); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings'))); }
function doRecoverStep3Action() { @($password = DevblocksPlatform::importGPC($_REQUEST['password'], 'string')); $email = $_SESSION[self::KEY_FORGOT_EMAIL]; $sentcode = $_SESSION[self::KEY_FORGOT_SENTCODE]; $code = $_SESSION[self::KEY_FORGOT_CODE]; $worker_id = DAO_Worker::lookupAgentEmail($email); if (empty($email) || empty($code) || empty($worker_id)) { return; } if (0 == strcmp($sentcode, $code)) { // passed DAO_Worker::updateAgent($worker_id, array(DAO_Worker::PASSWORD => md5($password))); unset($_SESSION[self::KEY_FORGOT_EMAIL]); unset($_SESSION[self::KEY_FORGOT_CODE]); unset($_SESSION[self::KEY_FORGOT_SENTCODE]); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login'))); } else { DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2'))); } }
function doDeleteWorkspaceAction() { @($workspace = DevblocksPlatform::importGPC($_POST['workspace'], 'string', '')); $db = DevblocksPlatform::getDatabaseService(); $active_worker = CerberusApplication::getActiveWorker(); $lists = DAO_WorkerWorkspaceList::getWhere(sprintf("%s = %s AND %s = %d", DAO_WorkerWorkspaceList::WORKSPACE, $db->qstr($workspace), DAO_WorkerWorkspaceList::WORKER_ID, $active_worker->id)); DAO_WorkerWorkspaceList::delete(array_keys($lists)); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('home'))); }
function saveCommunityToolAction() { @($code = DevblocksPlatform::importGPC($_POST['portal'], 'string')); @($name = DevblocksPlatform::importGPC($_POST['portal_name'], 'string', '')); @($iDelete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0)); UmPortalHelper::setCode($code); if (DEMO_MODE) { if ($iDelete) { DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities'))); } else { self::getCommunityToolAction(); } return; } if (null != ($instance = DAO_CommunityTool::getByCode($code))) { // Deleting? if (!empty($iDelete)) { $tool = DAO_CommunityTool::getByCode($code); /* @var $tool Model_CommunityTool */ DAO_CommunityTool::delete($tool->id); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('config', 'communities'))); return; } else { $manifest = DevblocksPlatform::getExtension($instance->extension_id, false, true); $tool = $manifest->createInstance(); /* @var $tool Extension_UsermeetTool */ // Update the tool name if it has changed if (0 != strcmp($instance->name, $name)) { DAO_CommunityTool::update($instance->id, array(DAO_CommunityTool::NAME => $name)); } // Defer the rest to tool instances and extensions $tool->saveConfiguration(); } } self::getCommunityToolAction(); }