Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
 function writeResponse(DevblocksHttpResponse $response)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(dirname(__FILE__))) . '/templates/';
     $umsession = UmPortalHelper::getSession();
     $active_user = $umsession->getProperty('sc_login', null);
     $stack = $response->path;
     array_shift($stack);
     // resources
     // F&R Topics
     $sFnrTopics = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_FNR_TOPICS, '');
     $fnr_topics = !empty($sFnrTopics) ? unserialize($sFnrTopics) : array();
     switch (array_shift($stack)) {
         default:
         case 'search':
             @($q = DevblocksPlatform::importGPC($_REQUEST['q'], 'string', ''));
             $tpl->assign('q', $q);
             if (!empty($q)) {
                 $feeds = array();
                 $where = null;
                 if (!empty($fnr_topics)) {
                     $where = sprintf("%s IN (%s)", DAO_FnrExternalResource::TOPIC_ID, implode(',', array_keys($fnr_topics)));
                 }
                 $resources = DAO_FnrExternalResource::getWhere($where);
                 $feeds = Model_FnrExternalResource::searchResources($resources, $q);
                 $tpl->assign('feeds', $feeds);
                 $tpl->assign('sources', $sources);
             }
             $tpl->display("devblocks:cerberusweb.fnr:support_center/fnr/search_results.tpl:portal_" . UmPortalHelper::getCode());
             break;
     }
 }
Ejemplo n.º 3
0
 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));
 }
Ejemplo n.º 4
0
 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));
 }
Ejemplo n.º 5
0
 function handleRequest(DevblocksHttpRequest $request)
 {
     $path = $request->path;
     if (empty($path) || !is_array($path)) {
         return;
     }
     if (null == ($portal = UmPortalHelper::getCode())) {
         return;
     }
     switch (array_shift($path)) {
         case 'most_popular':
             $this->_renderMostPopularRss($portal);
             break;
         case 'recent_changes':
             $this->_renderRecentChangesRss($portal);
             break;
     }
 }
Ejemplo n.º 6
0
 function writeResponse(DevblocksHttpResponse $response)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(dirname(dirname(__FILE__)))) . '/templates/';
     $sNewsRss = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_NEWS_RSS, '');
     $aNewsRss = !empty($sNewsRss) ? unserialize($sNewsRss) : array();
     $feeds = array();
     // [TODO] Implement a feed cache so we aren't bombing out
     foreach ($aNewsRss as $title => $url) {
         $feed = null;
         try {
             $feed = Zend_Feed::import($url);
         } catch (Exception $e) {
         }
         if (!empty($feed) && $feed->count()) {
             $feeds[] = array('name' => $title, 'url' => $url, 'feed' => $feed);
         }
     }
     $tpl->assign('feeds', $feeds);
     $tpl->display("devblocks:usermeet.core:support_center/announcements/index.tpl:portal_" . UmPortalHelper::getCode());
 }
Ejemplo n.º 7
0
 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')));
 }
Ejemplo n.º 8
0
 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();
 }
Ejemplo n.º 9
0
 function saveConfiguration()
 {
     // Home
     @($sHomeHtml = DevblocksPlatform::importGPC($_POST['home_html'], 'string', ''));
     DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_HOME_HTML, $sHomeHtml);
 }
Ejemplo n.º 10
0
Archivo: kb.php Proyecto: Hildy/cerb5
 function render()
 {
     //$this->_sanitize();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('id', $this->id);
     $tpl->assign('view', $this);
     $tpl->assign('view_fields', $this->getColumns());
     $tpl->display("devblocks:cerberusweb.kb:support_center/kb/view.tpl:portal_" . UmPortalHelper::getCode());
 }
Ejemplo n.º 11
0
 /**
  * release any resources tied up by the authenticate process, if necessary
  */
 function signoff()
 {
     $umsession = UmPortalHelper::getSession();
     $umsession->setProperty('sc_login', null);
 }
Ejemplo n.º 12
0
 function doContactSendAction()
 {
     @($sFrom = DevblocksPlatform::importGPC($_POST['from'], 'string', ''));
     @($sSubject = DevblocksPlatform::importGPC($_POST['subject'], 'string', ''));
     @($sContent = DevblocksPlatform::importGPC($_POST['content'], 'string', ''));
     @($sCaptcha = DevblocksPlatform::importGPC($_POST['captcha'], 'string', ''));
     @($aFieldIds = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
     @($aFollowUpQ = DevblocksPlatform::importGPC($_POST['followup_q'], 'array', array()));
     $fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket');
     // Load the answers to any situational questions
     $aFollowUpA = array();
     if (is_array($aFollowUpQ)) {
         foreach ($aFollowUpQ as $idx => $q) {
             // Only form values we were passed
             if (!isset($_POST['followup_a_' . $idx])) {
                 continue;
             }
             if (is_array($_POST['followup_a_' . $idx])) {
                 @($answer = DevblocksPlatform::importGPC($_POST['followup_a_' . $idx], 'array', array()));
                 $aFollowUpA[$idx] = implode(', ', $answer);
             } else {
                 @($answer = DevblocksPlatform::importGPC($_POST['followup_a_' . $idx], 'string', ''));
                 $aFollowUpA[$idx] = $answer;
             }
             // Translate field values into something human-readable (if needed)
             if (isset($aFieldIds[$idx]) && !empty($aFieldIds[$idx])) {
                 // Were we given a legit field id?
                 if (null != @($field = $fields[$aFieldIds[$idx]])) {
                     switch ($field->type) {
                         // Translate 'worker' fields into worker name (not ID)
                         case Model_CustomField::TYPE_WORKER:
                             if (null != ($worker = DAO_Worker::getAgent($answer))) {
                                 $aFollowUpA[$idx] = $worker->getName();
                             }
                             break;
                     }
                     // switch
                 }
                 // if
             }
             // if
         }
     }
     $umsession = UmPortalHelper::getSession();
     $active_user = $umsession->getProperty('sc_login', null);
     $fingerprint = UmPortalHelper::getFingerprint();
     $settings = CerberusSettings::getInstance();
     $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM);
     $umsession->setProperty('support.write.last_from', $sFrom);
     $umsession->setProperty('support.write.last_subject', $sSubject);
     $umsession->setProperty('support.write.last_content', $sContent);
     $umsession->setProperty('support.write.last_followup_a', $aFollowUpA);
     $sNature = $umsession->getProperty('support.write.last_nature', '');
     $captcha_enabled = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_CAPTCHA_ENABLED, 1);
     $captcha_session = $umsession->getProperty(UmScApp::SESSION_CAPTCHA, '***');
     // Subject is required if the field  is on the form
     if (isset($_POST['subject']) && empty($sSubject)) {
         $umsession->setProperty('support.write.last_error', 'A subject is required.');
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2')));
         return;
     }
     // Sender and CAPTCHA required
     if (empty($sFrom) || $captcha_enabled && 0 != strcasecmp($sCaptcha, $captcha_session)) {
         if (empty($sFrom)) {
             $umsession->setProperty('support.write.last_error', 'Invalid e-mail address.');
         } else {
             $umsession->setProperty('support.write.last_error', 'What you typed did not match the image.');
         }
         // Need to report the captcha didn't match and redraw the form
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2')));
         return;
     }
     // Dispatch
     $to = $default_from;
     $subject = 'Contact me: Other';
     $sDispatch = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_SITUATIONS, '');
     $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array();
     foreach ($dispatch as $k => $v) {
         if (md5($k) == $sNature) {
             $to = $v['to'];
             $subject = 'Contact me: ' . strip_tags($k);
             break;
         }
     }
     if (!empty($sSubject)) {
         $subject = $sSubject;
     }
     $fieldContent = '';
     if (!empty($aFollowUpQ)) {
         $fieldContent = "\r\n\r\n";
         $fieldContent .= "--------------------------------------------\r\n";
         if (!empty($sNature)) {
             $fieldContent .= $subject . "\r\n";
             $fieldContent .= "--------------------------------------------\r\n";
         }
         foreach ($aFollowUpQ as $idx => $q) {
             $answer = isset($aFollowUpA[$idx]) ? $aFollowUpA[$idx] : '';
             $fieldContent .= "Q) " . $q . "\r\n" . "A) " . $answer . "\r\n";
             if ($idx + 1 < count($aFollowUpQ)) {
                 $fieldContent .= "\r\n";
             }
         }
         $fieldContent .= "--------------------------------------------\r\n";
         "\r\n";
     }
     $message = new CerberusParserMessage();
     $message->headers['date'] = date('r');
     $message->headers['to'] = $to;
     $message->headers['subject'] = $subject;
     $message->headers['message-id'] = CerberusApplication::generateMessageId();
     $message->headers['x-cerberus-portal'] = 1;
     // Sender
     $fromList = imap_rfc822_parse_adrlist($sFrom, '');
     if (empty($fromList) || !is_array($fromList)) {
         return;
         // abort with message
     }
     $from = array_shift($fromList);
     $message->headers['from'] = $from->mailbox . '@' . $from->host;
     $message->body = 'IP: ' . $fingerprint['ip'] . "\r\n\r\n" . $sContent . $fieldContent;
     // Attachments
     $attachments_mode = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_ATTACHMENTS_MODE, 0);
     if (0 == $attachments_mode || 1 == $attachments_mode && !empty($active_user)) {
         if (is_array($_FILES) && !empty($_FILES)) {
             foreach ($_FILES as $name => $files) {
                 // field[]
                 if (is_array($files['name'])) {
                     foreach ($files['name'] as $idx => $name) {
                         $attach = new ParserFile();
                         $attach->setTempFile($files['tmp_name'][$idx], 'application/octet-stream');
                         $attach->file_size = filesize($files['tmp_name'][$idx]);
                         $message->files[$name] = $attach;
                     }
                 } else {
                     $attach = new ParserFile();
                     $attach->setTempFile($files['tmp_name'], 'application/octet-stream');
                     $attach->file_size = filesize($files['tmp_name']);
                     $message->files[$files['name']] = $attach;
                 }
             }
         }
     }
     // Custom Fields
     if (!empty($aFieldIds)) {
         foreach ($aFieldIds as $iIdx => $iFieldId) {
             if (!empty($iFieldId)) {
                 $field =& $fields[$iFieldId];
                 /* @var $field Model_CustomField */
                 $value = "";
                 switch ($field->type) {
                     case Model_CustomField::TYPE_SINGLE_LINE:
                     case Model_CustomField::TYPE_MULTI_LINE:
                     case Model_CustomField::TYPE_URL:
                         @($value = trim($aFollowUpA[$iIdx]));
                         break;
                     case Model_CustomField::TYPE_NUMBER:
                         @($value = $aFollowUpA[$iIdx]);
                         if (!is_numeric($value) || 0 == strlen($value)) {
                             $value = null;
                         }
                         break;
                     case Model_CustomField::TYPE_DATE:
                         if (false !== ($time = strtotime($aFollowUpA[$iIdx]))) {
                             @($value = intval($time));
                         }
                         break;
                     case Model_CustomField::TYPE_DROPDOWN:
                         @($value = $aFollowUpA[$iIdx]);
                         break;
                     case Model_CustomField::TYPE_MULTI_PICKLIST:
                         @($value = DevblocksPlatform::importGPC($_POST['followup_a_' . $iIdx], 'array', array()));
                         break;
                     case Model_CustomField::TYPE_CHECKBOX:
                         @($value = isset($aFollowUpA[$iIdx]) && !empty($aFollowUpA[$iIdx]) ? 1 : 0);
                         break;
                     case Model_CustomField::TYPE_MULTI_CHECKBOX:
                         @($value = DevblocksPlatform::importGPC($_POST['followup_a_' . $iIdx], 'array', array()));
                         break;
                     case Model_CustomField::TYPE_WORKER:
                         @($value = DevblocksPlatform::importGPC($_POST['followup_a_' . $iIdx], 'integer', 0));
                         break;
                 }
                 if (is_array($value) && !empty($value) || !is_array($value) && 0 != strlen($value)) {
                     $message->custom_fields[$iFieldId] = $value;
                 }
             }
         }
     }
     // Parse
     $ticket_id = CerberusParser::parseMessage($message);
     // It's possible for the parser to reject the message using pre-filters
     if (!empty($ticket_id) && null != ($ticket = DAO_Ticket::getTicket($ticket_id))) {
         $umsession->setProperty('support.write.last_opened', $ticket->mask);
     } else {
         $umsession->setProperty('support.write.last_opened', null);
     }
     // Clear any errors
     $umsession->setProperty('support.write.last_nature', null);
     $umsession->setProperty('support.write.last_nature_string', null);
     $umsession->setProperty('support.write.last_content', null);
     $umsession->setProperty('support.write.last_error', null);
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'confirm')));
 }
Ejemplo n.º 13
0
Archivo: home.php Proyecto: Hildy/cerb5
 function writeResponse(DevblocksHttpResponse $response)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->display("devblocks:usermeet.core:support_center/home/index.tpl:portal_" . UmPortalHelper::getCode());
 }
Ejemplo n.º 14
0
Archivo: kb.php Proyecto: rmiddle/cerb4
 function saveConfiguration()
 {
     // KB
     @($aKbRoots = DevblocksPlatform::importGPC($_POST['category_ids'], 'array', array()));
     $aKbRoots = array_flip($aKbRoots);
     DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_KB_ROOTS, serialize($aKbRoots));
 }
Ejemplo n.º 15
0
 function getContactSituationAction()
 {
     @($portal = DevblocksPlatform::importGPC($_REQUEST['portal'], 'string', ''));
     UmPortalHelper::setCode($portal);
     $module = DevblocksPlatform::getExtension('sc.controller.contact', true, true);
     $module->getSituation();
 }
Ejemplo n.º 16
0
 function saveConfiguration()
 {
     @($iRequireLogin = DevblocksPlatform::importGPC($_POST['kb_require_login'], 'integer', 0));
     DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_REQUIRE_LOGIN, $iRequireLogin);
     // KB
     @($aKbRoots = DevblocksPlatform::importGPC($_POST['category_ids'], 'array', array()));
     $aKbRoots = array_flip($aKbRoots);
     DAO_CommunityToolProperty::set(UmPortalHelper::getCode(), self::PARAM_KB_ROOTS, serialize($aKbRoots));
 }
Ejemplo n.º 17
0
 function doContactSendAction()
 {
     @($sFrom = DevblocksPlatform::importGPC($_POST['from'], 'string', ''));
     @($sSubject = DevblocksPlatform::importGPC($_POST['subject'], 'string', ''));
     @($sContent = DevblocksPlatform::importGPC($_POST['content'], 'string', ''));
     @($sCaptcha = DevblocksPlatform::importGPC($_POST['captcha'], 'string', ''));
     @($aFieldIds = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array()));
     @($aFollowUpQ = DevblocksPlatform::importGPC($_POST['followup_q'], 'array', array()));
     // Load the answers to any situational questions
     $aFollowUpA = array();
     if (is_array($aFollowUpQ)) {
         foreach ($aFollowUpQ as $idx => $q) {
             @($answer = DevblocksPlatform::importGPC($_POST['followup_a_' . $idx], 'string', ''));
             $aFollowUpA[$idx] = $answer;
         }
     }
     $umsession = UmPortalHelper::getSession();
     $fingerprint = UmPortalHelper::getFingerprint();
     $settings = CerberusSettings::getInstance();
     $default_from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM);
     $umsession->setProperty('support.write.last_from', $sFrom);
     $umsession->setProperty('support.write.last_subject', $sSubject);
     $umsession->setProperty('support.write.last_content', $sContent);
     //		$umsession->setProperty('support.write.last_followup_q',$aFollowUpQ);
     $umsession->setProperty('support.write.last_followup_a', $aFollowUpA);
     $sNature = $umsession->getProperty('support.write.last_nature', '');
     $captcha_enabled = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_CAPTCHA_ENABLED, 1);
     // Subject is required if the field  is on the form
     if (isset($_POST['subject']) && empty($sSubject)) {
         $umsession->setProperty('support.write.last_error', 'A subject is required.');
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2')));
         return;
     }
     // Sender and CAPTCHA required
     if (empty($sFrom) || $captcha_enabled && 0 != strcasecmp($sCaptcha, @$umsession->getProperty(UmScApp::SESSION_CAPTCHA, '***'))) {
         if (empty($sFrom)) {
             $umsession->setProperty('support.write.last_error', 'Invalid e-mail address.');
         } else {
             $umsession->setProperty('support.write.last_error', 'What you typed did not match the image.');
         }
         // Need to report the captcha didn't match and redraw the form
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'step2')));
         return;
     }
     // Dispatch
     $to = $default_from;
     $subject = 'Contact me: Other';
     $sDispatch = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_SITUATIONS, '');
     $dispatch = !empty($sDispatch) ? unserialize($sDispatch) : array();
     foreach ($dispatch as $k => $v) {
         if (md5($k) == $sNature) {
             $to = $v['to'];
             $subject = 'Contact me: ' . strip_tags($k);
             break;
         }
     }
     if (!empty($sSubject)) {
         $subject = $sSubject;
     }
     $fieldContent = '';
     if (!empty($aFollowUpQ)) {
         $fieldContent = "\r\n\r\n";
         $fieldContent .= "--------------------------------------------\r\n";
         if (!empty($sNature)) {
             $fieldContent .= $subject . "\r\n";
             $fieldContent .= "--------------------------------------------\r\n";
         }
         foreach ($aFollowUpQ as $idx => $q) {
             $answer = isset($aFollowUpA[$idx]) ? $aFollowUpA[$idx] : '';
             $fieldContent .= "Q) " . $q . "\r\n" . "A) " . $answer . "\r\n";
             if ($idx + 1 < count($aFollowUpQ)) {
                 $fieldContent .= "\r\n";
             }
         }
         $fieldContent .= "--------------------------------------------\r\n";
         "\r\n";
     }
     $message = new CerberusParserMessage();
     $message->headers['date'] = date('r');
     $message->headers['to'] = $to;
     $message->headers['subject'] = $subject;
     $message->headers['message-id'] = CerberusApplication::generateMessageId();
     $message->headers['x-cerberus-portal'] = 1;
     // Sender
     $fromList = imap_rfc822_parse_adrlist($sFrom, '');
     if (empty($fromList) || !is_array($fromList)) {
         return;
         // abort with message
     }
     $from = array_shift($fromList);
     $message->headers['from'] = $from->mailbox . '@' . $from->host;
     $message->body = 'IP: ' . $fingerprint['ip'] . "\r\n\r\n" . $sContent . $fieldContent;
     $ticket_id = CerberusParser::parseMessage($message);
     $ticket = DAO_Ticket::getTicket($ticket_id);
     // Auto-save any custom fields
     $fields = DAO_CustomField::getBySource('cerberusweb.fields.source.ticket');
     if (!empty($aFieldIds)) {
         foreach ($aFieldIds as $iIdx => $iFieldId) {
             if (!empty($iFieldId)) {
                 $field =& $fields[$iFieldId];
                 /* @var $field Model_CustomField */
                 $value = "";
                 switch ($field->type) {
                     case Model_CustomField::TYPE_SINGLE_LINE:
                     case Model_CustomField::TYPE_MULTI_LINE:
                         @($value = trim($aFollowUpA[$iIdx]));
                         break;
                     case Model_CustomField::TYPE_NUMBER:
                         @($value = intval($aFollowUpA[$iIdx]));
                         break;
                     case Model_CustomField::TYPE_DATE:
                         if (false !== ($time = strtotime($aFollowUpA[$iIdx]))) {
                             @($value = intval($time));
                         }
                         break;
                     case Model_CustomField::TYPE_DROPDOWN:
                         @($value = $aFollowUpA[$iIdx]);
                         break;
                     case Model_CustomField::TYPE_CHECKBOX:
                         @($value = isset($aFollowUpA[$iIdx]) && !empty($aFollowUpA[$iIdx]) ? 1 : 0);
                         break;
                 }
                 if (!empty($value)) {
                     DAO_CustomFieldValue::setFieldValue('cerberusweb.fields.source.ticket', $ticket_id, $iFieldId, $value);
                 }
             }
         }
     }
     // Clear any errors
     $umsession->setProperty('support.write.last_nature', null);
     $umsession->setProperty('support.write.last_nature_string', null);
     $umsession->setProperty('support.write.last_content', null);
     $umsession->setProperty('support.write.last_error', null);
     $umsession->setProperty('support.write.last_opened', $ticket->mask);
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'contact', 'confirm')));
 }
Ejemplo n.º 18
0
 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;
     }
 }
Ejemplo n.º 19
0
 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])));
 }
Ejemplo n.º 20
0
 function downloadFileAction(DevblocksHttpRequest $request)
 {
     $umsession = UmPortalHelper::getSession();
     $stack = $request->path;
     if (null == ($active_user = $umsession->getProperty('sc_login', null))) {
         return;
     }
     // Attachment ID + display name
     @($ticket_mask = array_shift($stack));
     @($hash = array_shift($stack));
     @($display_name = array_shift($stack));
     if (empty($ticket_mask) || empty($hash) || empty($display_name)) {
         return;
     }
     if (null == ($ticket_id = DAO_Ticket::getTicketIdByMask($ticket_mask))) {
         return;
     }
     // Load attachments by ticket mask
     list($attachments) = DAO_Attachment::search(array(SearchFields_Attachment::TICKET_MASK => new DevblocksSearchCriteria(SearchFields_Attachment::TICKET_MASK, '=', $ticket_mask)), -1, 0, null, null, false);
     $attachment = null;
     if (is_array($attachments)) {
         foreach ($attachments as $possible_file) {
             // Compare the hash
             $fingerprint = md5($possible_file[SearchFields_Attachment::ID] . $possible_file[SearchFields_Attachment::MESSAGE_ID] . $possible_file[SearchFields_Attachment::DISPLAY_NAME]);
             if (0 == strcmp($fingerprint, $hash)) {
                 if (null == ($attachment = DAO_Attachment::get($possible_file[SearchFields_Attachment::ID]))) {
                     return;
                 }
                 break;
             }
         }
     }
     // No hit (bad hash)
     if (null == $attachment) {
         return;
     }
     // Load requesters
     if (null == ($requesters = DAO_Ticket::getRequestersByTicket($ticket_id))) {
         return;
     }
     // Security: Make sure the active user is a requester on the proper ticket
     if (!isset($requesters[$active_user->id])) {
         return;
     }
     // Set headers
     header("Expires: Mon, 26 Nov 1962 00:00:00 GMT\n");
     header("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT\n");
     header("Cache-control: private\n");
     header("Pragma: no-cache\n");
     header("Content-Type: " . $attachment->mime_type . "\n");
     header("Content-transfer-encoding: binary\n");
     header("Content-Length: " . $attachment->getFileSize() . "\n");
     // Dump contents
     echo $attachment->getFileContents();
     exit;
 }
Ejemplo n.º 21
0
 protected static function _save()
 {
     // persist
     $umsession = UmPortalHelper::getSession();
     $umsession->setProperty(self::VISIT_ABSTRACTVIEWS, self::$views);
 }