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; }
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; } }
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>'; }
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(); }
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); }
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'); }
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); }
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'))); }
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'); }
function getLink($source_id) { $url = DevblocksPlatform::getUrlService(); return $url->write('c=display&id=' . $source_id); }
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))); }
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'); }
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); }
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(); } }
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; }
function handleRequest(DevblocksHttpRequest $request) { @set_time_limit(0); // no timelimit (when possible) $stack = $request->path; array_shift($stack); // update // $cache = DevblocksPlatform::getCacheService(); /* @var $cache _DevblocksCacheManager */ $settings = DevblocksPlatform::getPluginSettingsService(); $authorized_ips_str = $settings->get('cerberusweb.core', 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 this IP authorized? $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 'Your IP address (' . $_SERVER['REMOTE_ADDR'] . ') is not authorized to debug this helpdesk. Your administrator needs to authorize your IP in Helpdesk Setup or in the framework.config.php file under AUTHORIZED_IPS_DEFAULTS.'; return; } switch (array_shift($stack)) { case 'phpinfo': phpinfo(); break; case 'check': echo sprintf("<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<title></title>\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tBODY {font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n\t\t\t\t\t\t\tFORM {margin:0px; } \n\t\t\t\t\t\t\tH1 { margin:0px; }\n\t\t\t\t\t\t\t.fail {color:red;font-weight:bold;}\n\t\t\t\t\t\t\t.pass {color:green;font-weight:bold;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t\t<h1>Cerberus Helpdesk - Requirements Checker:</h1>\n\t\t\t\t\t"); $errors = CerberusApplication::checkRequirements(); if (!empty($errors)) { echo "<ul class='fail'>"; foreach ($errors as $error) { echo sprintf("<li>%s</li>", $error); } echo "</ul>"; } else { echo '<span class="pass">Your server is compatible with Cerberus Helpdesk 5.x!</span>'; } echo sprintf("\n\t\t\t\t\t</body>\n\t\t\t\t\t</html>\n\t\t\t\t"); break; case 'report': @($db = DevblocksPlatform::getDatabaseService()); @($settings = DevblocksPlatform::getPluginSettingsService()); @($tables = $db->MetaTables('TABLE', false)); $report_output = sprintf("[Cerberus Helpdesk] App Build: %s\n" . "[Cerberus Helpdesk] Devblocks Build: %s\n" . "[Cerberus Helpdesk] URL-Rewrite: %s\n" . "\n" . "[Privs] storage/attachments: %s\n" . "[Privs] storage/mail/new: %s\n" . "[Privs] storage/mail/fail: %s\n" . "[Privs] storage/tmp: %s\n" . "[Privs] storage/tmp/templates_c: %s\n" . "[Privs] storage/tmp/cache: %s\n" . "\n" . "[PHP] Version: %s\n" . "[PHP] OS: %s\n" . "[PHP] SAPI: %s\n" . "\n" . "[php.ini] safe_mode: %s\n" . "[php.ini] max_execution_time: %s\n" . "[php.ini] memory_limit: %s\n" . "[php.ini] file_uploads: %s\n" . "[php.ini] upload_max_filesize: %s\n" . "[php.ini] post_max_size: %s\n" . "\n" . "[PHP:Extension] MySQL: %s\n" . "[PHP:Extension] PostgreSQL: %s\n" . "[PHP:Extension] MailParse: %s\n" . "[PHP:Extension] IMAP: %s\n" . "[PHP:Extension] Session: %s\n" . "[PHP:Extension] PCRE: %s\n" . "[PHP:Extension] GD: %s\n" . "[PHP:Extension] mbstring: %s\n" . "[PHP:Extension] XML: %s\n" . "[PHP:Extension] SimpleXML: %s\n" . "[PHP:Extension] DOM: %s\n" . "[PHP:Extension] SPL: %s\n" . "\n" . '%s', APP_BUILD, PLATFORM_BUILD, file_exists(APP_PATH . '/.htaccess') ? 'YES' : 'NO', substr(sprintf('%o', fileperms(APP_STORAGE_PATH . '/attachments')), -4), substr(sprintf('%o', fileperms(APP_STORAGE_PATH . '/mail/new')), -4), substr(sprintf('%o', fileperms(APP_STORAGE_PATH . '/mail/fail')), -4), substr(sprintf('%o', fileperms(APP_TEMP_PATH)), -4), substr(sprintf('%o', fileperms(APP_TEMP_PATH . '/templates_c')), -4), substr(sprintf('%o', fileperms(APP_TEMP_PATH . '/cache')), -4), PHP_VERSION, PHP_OS . ' (' . php_uname() . ')', php_sapi_name(), ini_get('safe_mode'), ini_get('max_execution_time'), ini_get('memory_limit'), ini_get('file_uploads'), ini_get('upload_max_filesize'), ini_get('post_max_size'), extension_loaded("mysql") ? 'YES' : 'NO', extension_loaded("pgsql") ? 'YES' : 'NO', extension_loaded("mailparse") ? 'YES' : 'NO', extension_loaded("imap") ? 'YES' : 'NO', extension_loaded("session") ? 'YES' : 'NO', extension_loaded("pcre") ? 'YES' : 'NO', extension_loaded("gd") ? 'YES' : 'NO', extension_loaded("mbstring") ? 'YES' : 'NO', extension_loaded("xml") ? 'YES' : 'NO', extension_loaded("simplexml") ? 'YES' : 'NO', extension_loaded("dom") ? 'YES' : 'NO', extension_loaded("spl") ? 'YES' : 'NO', ''); if (!empty($settings)) { $report_output .= sprintf("[Setting] HELPDESK_TITLE: %s\n" . "[Setting] DEFAULT_REPLY_FROM: %s\n" . "[Setting] DEFAULT_REPLY_PERSONAL: %s\n" . "[Setting] SMTP_HOST: %s\n" . "[Setting] SMTP_PORT: %s\n" . "[Setting] SMTP_ENCRYPTION_TYPE: %s\n" . "\n" . '%s', $settings->get('cerberusweb.core', CerberusSettings::HELPDESK_TITLE, ''), str_replace(array('@', '.'), array(' at ', ' dot '), $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM, '')), $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL, ''), $settings->get('cerberusweb.core', CerberusSettings::SMTP_HOST, ''), $settings->get('cerberusweb.core', CerberusSettings::SMTP_PORT, ''), $settings->get('cerberusweb.core', CerberusSettings::SMTP_ENCRYPTION_TYPE, ''), ''); } if (is_array($tables) && !empty($tables)) { $report_output .= sprintf("[Stats] # Workers: %s\n" . "[Stats] # Groups: %s\n" . "[Stats] # Tickets: %s\n" . "[Stats] # Messages: %s\n" . "\n" . "[Database] Tables:\n * %s\n" . "\n" . '%s', intval($db->getOne('SELECT count(id) FROM worker')), intval($db->getOne('SELECT count(id) FROM team')), intval($db->getOne('SELECT count(id) FROM ticket')), intval($db->getOne('SELECT count(id) FROM message')), implode("\n * ", array_values($tables)), ''); } echo sprintf("<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<title></title>\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tBODY {font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n\t\t\t\t\t\t\tFORM {margin:0px; } \n\t\t\t\t\t\t\tH1 { margin:0px; }\n\t\t\t\t\t\t\t.fail {color:red;font-weight:bold;}\n\t\t\t\t\t\t\t.pass {color:green;font-weight:bold;}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t<h1>Cerberus Helpdesk - Debug Report:</h1>\n\t\t\t\t\t\t\t<textarea rows='25' cols='100'>%s</textarea>\n\t\t\t\t\t\t</form>\t\n\t\t\t\t\t</body>\n\t\t\t\t\t</html>\n\t\t\t\t\t", $report_output); break; default: $url_service = DevblocksPlatform::getUrlService(); echo sprintf("<html>\n\t\t\t\t\t<head>\n\t\t\t\t\t\t<title></title>\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\tBODY {font-family: Arial, Helvetica, sans-serif; font-size: 12px;}\n\t\t\t\t\t\t\tFORM {margin:0px; } \n\t\t\t\t\t\t\tH1 { margin:0px; }\n\t\t\t\t\t\t</style>\n\t\t\t\t\t</head>\n\t\t\t\t\t<body>\n\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t<h1>Cerberus Helpdesk - Debug Menu:</h1>\n\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t<li><a href='%s'>Requirements Checker</a></li>\n\t\t\t\t\t\t\t\t<li><a href='%s'>Debug Report (for technical support)</a></li>\n\t\t\t\t\t\t\t\t<li><a href='%s'>phpinfo()</a></li>\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</form>\t\n\t\t\t\t\t</body>\n\t\t\t\t\t</html>\n\t\t\t\t\t", $url_service->write('c=debug&a=check'), $url_service->write('c=debug&a=report'), $url_service->write('c=debug&a=phpinfo')); break; } exit; }
function handleRequest(DevblocksHttpRequest $request) { @set_time_limit(0); // no timelimit (when possible) $translate = DevblocksPlatform::getTranslationService(); $stack = $request->path; array_shift($stack); // update $cache = DevblocksPlatform::getCacheService(); /* @var $cache _DevblocksCacheManager */ $settings = DevblocksPlatform::getPluginSettingsService(); switch (array_shift($stack)) { case 'locked': if (!DevblocksPlatform::versionConsistencyCheck()) { $url = DevblocksPlatform::getUrlService(); echo "<h1>Cerberus Helpdesk 5.x</h1>"; echo "The helpdesk 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('login'))); } break; default: $path = APP_TEMP_PATH . DIRECTORY_SEPARATOR; $file = $path . 'c4update_lock'; $authorized_ips_str = $settings->get('cerberusweb.core', 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 this IP authorized? $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->_('update.ip_unauthorized'), $_SERVER['REMOTE_ADDR']); return; } // Check requirements $errors = CerberusApplication::checkRequirements(); if (!empty($errors)) { echo $translate->_('update.correct_errors'); echo "<ul style='color:red;'>"; foreach ($errors as $error) { echo "<li>" . $error . "</li>"; } echo "</ul>"; exit; } // If authorized, lock and attempt update if (!file_exists($file) || @filectime($file) + 600 < time()) { // 10 min lock touch($file); //echo "Running plugin patches...<br>"; if (DevblocksPlatform::runPluginPatches('core.patches')) { @unlink($file); // [JAS]: Clear all caches $cache->clean(); DevblocksPlatform::getClassLoaderService()->destroy(); // Clear compiled templates $tpl = DevblocksPlatform::getTemplateService(); $tpl->clear_compiled_tpl(); // Reload plugin translations DAO_Translation::reloadPluginStrings(); DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login'))); } else { @unlink($file); echo "Failure!"; // [TODO] Needs elaboration } break; } else { echo $translate->_('update.locked_another'); } } exit; }
function AnswernetMetlifeReportGroupReport1Action() { $db = DevblocksPlatform::getDatabaseService(); $translate = DevblocksPlatform::getTranslationService(); $url = DevblocksPlatform::getUrlService(); $workers = DAO_Worker::getAll(); $radius = 12; // Security if (null == ($active_worker = CerberusApplication::getActiveWorker())) { die($translate->_('common.access_denied')); } // import dates from form @($start_time = DevblocksPlatform::importGPC($_REQUEST['start'], 'string', '')); @($group = DevblocksPlatform::importGPC($_REQUEST['group'], 'string', '')); if (empty($start_time) || !is_numeric($start_time)) { return; } if (empty($group)) { return; } $end_time = $start_time + 604800; print $translate->_('answernet.er.metlife.week.number'); print date("W", $start_time); print '<br>'; print $translate->_('answernet.er.metlife.generate.report'); switch ($group) { case "All": $filename = "report-metlife-week-" . date("W", $start_time) . ".xls"; $group_sql = "and (t.team_id = 756 or t.team_id = 782) "; print " Group: ALL "; $group_text = "All"; break; case "fp": $filename = "report-metlife-first-person-week-" . date("W", $start_time) . ".xls"; $group_sql = "and t.team_id = 756 "; print " Group: First Person "; $group_text = "First Person"; break; case "iDesign": $filename = "report-metlife-iDesign-week-" . date("W", $start_time) . ".xls"; $group_sql = "and team_id = 782 "; print " Group: iDesign "; $group_text = "iDesign"; break; default: print "Error: Group not set: " . $group; return; } print '<br>'; print $translate->_('answernet.er.metlife.generating'); $full_filename = getcwd() . '/storage/answernet/' . $filename; $href_filename = $url->write('storage/answernet/' . $filename, true); $week_range_text = "Week # " . date("W - n/j/y", $start_time) . " - " . date("n/j/y", $start_time + 518400); // Create new Excel Spreadsheet. $workbook = new Spreadsheet_Excel_Writer($full_filename); // Create metrics Tab and set Column Width and Row Hight. $worksheet_metrics =& $workbook->addWorksheet('Weekly Metrics'); $worksheet_metrics->setColumn(0, 0, $radius * 1.71); $worksheet_metrics->setColumn(0, 0, $radius * 0.5); $worksheet_metrics->setRow(0, 56); // Create ACD Calls(Inbound) Tab and set Column Width and Row Hight. $worksheet_acd_in =& $workbook->addWorksheet('ACD calls(Inbound)'); $worksheet_acd_in->setColumn(0, 1, $radius * 0.78); $worksheet_acd_in->setColumn(2, 2, $radius * 1.05); $worksheet_acd_in->setColumn(3, 3, $radius * 1.23); $worksheet_acd_in->setColumn(4, 4, $radius * 1.11); $worksheet_acd_in->setColumn(5, 5, $radius * 1.15); $worksheet_acd_in->setColumn(6, 6, $radius * 2.0); $worksheet_acd_in->setColumn(7, 7, $radius * 0.78); $worksheet_acd_in->setColumn(8, 8, $radius * 2.0); $worksheet_acd_in->setColumn(9, 9, $radius * 0.78); $worksheet_acd_in->setRow(0, 28); $worksheet_acd_in->setRow(2, 32); // Create ACD Calls(Outbound) Tab and set Column Width and Row Hight. $worksheet_acd_out =& $workbook->addWorksheet('ACD calls(Outbound)'); // Create Phone Tickets Tab and set Column Width and Row Hight. $worksheet_phone_tickets =& $workbook->addWorksheet('Phone Tickets'); // Create Email Tickets Tab and set Column Width and Row Hight. $worksheet_email_tickets =& $workbook->addWorksheet('Email Tickets'); // Create Email Tickets Tab and set Column Width and Row Hight. $worksheet_call_count =& $workbook->addWorksheet('Call Count'); // Create Inbound Count Tab and set Column Width and Row Hight. $worksheet_in_count =& $workbook->addWorksheet('Inbound Email Count'); $worksheet_in_count->setColumn(0, 0, $radius * 2.87); $worksheet_in_count->setColumn(1, 1, $radius * 0.66); $worksheet_in_count->setColumn(2, 2, $radius * 2.87); $worksheet_in_count->setColumn(3, 3, $radius * 0.62); $worksheet_in_count->setColumn(4, 4, $radius * 0.66); $worksheet_in_count->setColumn(5, 5, $radius * 2.87); $worksheet_in_count->setColumn(6, 6, $radius * 0.66); $worksheet_in_count->setRow(0, 32); $worksheet_in_count->freezePanes(array(2, 0, 2, 0)); // Create Outbound Count Tab and set Column Width and Row Hight. $worksheet_out_count =& $workbook->addWorksheet('Outbound Email Count'); $worksheet_out_count->setColumn(0, 0, $radius * 2.87); $worksheet_out_count->setColumn(1, 1, $radius * 0.66); $worksheet_out_count->setColumn(2, 2, $radius * 2.87); $worksheet_out_count->setColumn(3, 3, $radius * 0.62); $worksheet_out_count->setColumn(4, 4, $radius * 0.66); $worksheet_out_count->setColumn(5, 5, $radius * 2.87); $worksheet_out_count->setColumn(6, 6, $radius * 0.66); $worksheet_out_count->setRow(0, 32); $worksheet_out_count->freezePanes(array(2, 0, 2, 0)); // Create Inbound Tab and set Column Width and Row Hight. $worksheet_inbound =& $workbook->addWorksheet('Inbound Emails'); $worksheet_inbound->setColumn(0, 0, $radius * 2.78); $worksheet_inbound->setColumn(1, 1, $radius * 1.55); $worksheet_inbound->setColumn(2, 2, $radius * 0.72); $worksheet_inbound->setColumn(3, 4, $radius * 1.51); $worksheet_inbound->setColumn(5, 5, $radius * 2.76); $worksheet_inbound->setColumn(6, 9, $radius * 2.22); $worksheet_inbound->setColumn(10, 10, $radius * 0.83); $worksheet_inbound->setRow(0, 36); $worksheet_inbound->freezePanes(array(2, 0, 2, 0)); // Create Outbound Tab and set Column Width and Row Hight. $worksheet_outbound =& $workbook->addWorksheet('Outbound Emails'); $worksheet_outbound->setColumn(0, 0, $radius * 2.78); $worksheet_outbound->setColumn(1, 1, $radius * 1.55); $worksheet_outbound->setColumn(2, 2, $radius * 0.72); $worksheet_outbound->setColumn(3, 4, $radius * 1.51); $worksheet_outbound->setColumn(5, 5, $radius * 2.76); $worksheet_outbound->setColumn(6, 9, $radius * 2.22); $worksheet_outbound->setColumn(10, 10, $radius * 1.2); $worksheet_outbound->setColumn(11, 11, $radius * 0.83); $worksheet_outbound->setRow(0, 36); $worksheet_outbound->freezePanes(array(2, 0, 2, 0)); // Formats used thoughout the workbook. $format_general =& $workbook->addFormat(); $format_general->setBorder(1); $format_general->setHAlign('center'); $format_general->setTextWrap(); $format_general_nowrap =& $workbook->addFormat(); $format_general_nowrap->setBorder(1); // Setup templating for the formating of certain cells in the Metics Group. $format_metrics_title =& $workbook->addFormat(); $format_metrics_title->setBorder(1); $format_metrics_title->setBold(); $format_metrics_title->setColor(9); $format_metrics_title->setFgColor(32); $format_metrics_title->setHAlign('center'); $format_metrics_title->setVAlign('vjustify'); $format_metrics_title->setVAlign('vcenter'); $format_metrics_title->setTextWrap(); $format_metrics_title2 =& $workbook->addFormat(); $format_metrics_title2->setBorder(1); $format_metrics_title2->setBold(); $format_metrics_title2->setColor(8); $format_metrics_title2->setFgColor(43); $format_metrics_title2->setHAlign('center'); $format_metrics_title2->setVAlign('vjustify'); $format_metrics_title2->setVAlign('vcenter'); $format_metrics_title2->setTextWrap(); $format_metrics_weekly =& $workbook->addFormat(); $format_metrics_weekly->setBorder(1); $format_metrics_weekly->setBold(); $format_metrics_weekly->setColor(8); $format_metrics_weekly->setFgColor(29); $format_metrics_weekly->setHAlign('center'); $format_metrics_weekly->setVAlign('vjustify'); $format_metrics_weekly->setVAlign('vcenter'); $format_metrics_weekly->setTextWrap(); $format_metrics_daily =& $workbook->addFormat(); $format_metrics_daily->setBorder(1); $format_metrics_daily->setBold(); $format_metrics_daily->setColor(8); $format_metrics_daily->setFgColor(29); $format_metrics_daily->setHAlign('center'); $format_metrics_daily->setVAlign('vjustify'); $format_metrics_daily->setVAlign('vcenter'); $format_metrics_daily->setTextWrap(); // Added headers since they never change in the Metics Group. $worksheet_metrics->write(0, 0, 'Week Range', $format_metrics_title); $worksheet_metrics->write(0, 1, 'Inbnd Field Emails', $format_metrics_title); $worksheet_metrics->write(0, 2, 'Inbnd Admin Emails', $format_metrics_title); $worksheet_metrics->write(0, 3, 'Weekly Total Inbnd', $format_metrics_title); $worksheet_metrics->write(0, 4, 'Outbnd Field Emails', $format_metrics_title); $worksheet_metrics->write(0, 5, 'Outbnd Admin Emails', $format_metrics_title); $worksheet_metrics->write(0, 6, 'Weekly Total Outbnd', $format_metrics_title); $worksheet_metrics->write(0, 7, 'Avg time to respond (hrs)', $format_metrics_title); $worksheet_metrics->write(0, 8, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 9, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 10, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 11, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 12, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 13, ' ', $format_metrics_title2); $worksheet_metrics->write(0, 14, ' ', $format_metrics_title2); $week_range_text_metrics = date("n/j/y", $start_time) . " - " . date("n/j/y", $start_time + 518400); $worksheet_metrics->write(1, 0, $week_range_text_metrics, $format_general); $worksheet_metrics->write(5, 0, 'Grand Total', $format_general); $worksheet_metrics->write(6, 0, 'Weekly Averages', $format_metrics_weekly); $worksheet_metrics->write(7, 0, 'Daily Averages', $format_metrics_daily); $worksheet_metrics->write(8, 0, '%', $format_general); // Setup templating for the formating of certain cells in the Inbound Count Group. $format_acd_in_title =& $workbook->addFormat(); $format_acd_in_title->setSize(18); $format_acd_in_title->setColor(8); $format_acd_in_title->setFgColor(34); $format_acd_in_title->setBorder(1); $format_acd_in_title->setBold(); $format_acd_in_title->setHAlign('center'); $format_acd_in_title->setVAlign('vjustify'); $format_acd_in_title->setVAlign('top'); $format_acd_in_title->setTextWrap(); $format_acd_in_title->setAlign('merge'); $format_acd_in_title2 =& $workbook->addFormat(); $format_acd_in_title2->setColor(8); $format_acd_in_title2->setFgColor(43); $format_acd_in_title2->setBorder(1); $format_acd_in_title2->setBold(); $format_acd_in_title2->setHAlign('center'); $format_acd_in_title2->setVAlign('vjustify'); $format_acd_in_title2->setVAlign('top'); $format_acd_in_title2->setTextWrap(); $format_acd_in_title2->setAlign('merge'); $format_acd_in_title3 =& $workbook->addFormat(); $format_acd_in_title3->setColor(8); $format_acd_in_title3->setFgColor(47); $format_acd_in_title2->setBorder(1); $format_acd_in_title3->setBold(); $format_acd_in_title3->setHAlign('center'); $format_acd_in_title3->setVAlign('vjustify'); $format_acd_in_title3->setVAlign('top'); $format_acd_in_title3->setTextWrap(); $format_acd_in_total =& $workbook->addFormat(); $format_acd_in_title->setSize(15); $format_acd_in_total->setBorder(1); $format_acd_in_total->setColor(8); $format_acd_in_total->setFgColor(6); $format_acd_in_total->setBold(); $format_acd_in_total->setHAlign('left'); $format_acd_in_total->setVAlign('vjustify'); $format_acd_in_total->setVAlign('top'); // Added headers since they never change in the acd in Group. $worksheet_acd_in->write(0, 0, 'MetLife / ' . $group_text, $format_acd_in_title); $worksheet_acd_in->write(0, 1, '', $format_acd_in_title); $worksheet_acd_in->write(0, 2, '', $format_acd_in_title); $worksheet_acd_in->write(0, 3, '', $format_acd_in_title); $worksheet_acd_in->write(0, 4, '', $format_acd_in_title); $worksheet_acd_in->write(0, 5, '', $format_acd_in_title); $worksheet_acd_in->write(0, 6, 'WEEKLY TOTALS', $format_acd_in_title); $worksheet_acd_in->write(0, 7, '', $format_acd_in_title); $worksheet_acd_in->write(0, 8, '', $format_acd_in_title); $worksheet_acd_in->write(0, 9, '', $format_acd_in_title); $worksheet_acd_in->write(1, 0, $week_range_text, $format_acd_in_title2); $worksheet_acd_in->write(1, 1, '', $format_acd_in_title2); $worksheet_acd_in->write(1, 2, '', $format_acd_in_title2); $worksheet_acd_in->write(1, 3, '', $format_acd_in_title2); $worksheet_acd_in->write(1, 4, '', $format_acd_in_title2); $worksheet_acd_in->write(1, 5, '', $format_acd_in_title2); $worksheet_acd_in->write(2, 0, 'Date', $format_acd_in_title3); $worksheet_acd_in->write(2, 1, 'Call Times', $format_acd_in_title3); $worksheet_acd_in->write(2, 2, 'Agent Talk', $format_acd_in_title3); $worksheet_acd_in->write(2, 3, '(MIN.SEC) Hold time', $format_acd_in_title3); $worksheet_acd_in->write(2, 4, '(MIN.SEC) Patch Time', $format_acd_in_title3); $worksheet_acd_in->write(2, 5, 'ANI', $format_acd_in_title3); $worksheet_acd_in->write(1, 6, 'Weekly Total Calls', $format_acd_in_total); $worksheet_acd_in->writeFormula(1, 7, "=count(A1:A1000)", $format_acd_in_title2); $worksheet_acd_in->write(1, 8, 'Weekly Average Patch Time', $format_acd_in_total); $worksheet_acd_in->writeFormula(1, 9, "=SUM(B2,E2)", $format_acd_in_title2); $worksheet_acd_in->write(2, 6, 'Weekly Agent Talk Time', $format_acd_in_total); $worksheet_acd_in->writeFormula(2, 7, "=SUM(B2,E2)", $format_acd_in_title2); $worksheet_acd_in->write(2, 8, 'Weekly Average Hold Time', $format_acd_in_total); $worksheet_acd_in->writeFormula(2, 9, "=SUM(B2,E2)", $format_acd_in_title2); // Setup templating for the formating of certain cells in the Inbound Count Group. $format_in_count_title =& $workbook->addFormat(); $format_in_count_title->setSize(15); $format_in_count_title->setColor(8); $format_in_count_title->setBorder(1); $format_in_count_title->setFgColor(35); $format_in_count_title->setBold(); $format_in_count_title->setHAlign('center'); $format_in_count_title->setVAlign('vjustify'); $format_in_count_title->setVAlign('top'); $format_in_count_title->setTextWrap(); $format_in_count_title2 =& $workbook->addFormat(); $format_in_count_title2->setColor(8); $format_in_count_title2->setFgColor(47); $format_in_count_title2->setBold(); $format_in_count_title2->setHAlign('center'); $format_in_count_title2->setVAlign('vjustify'); $format_in_count_title2->setVAlign('top'); $format_in_count_title2->setTextWrap(); $format_in_count_total =& $workbook->addFormat(); $format_in_count_total->setBorder(1); $format_in_count_total->setColor(8); $format_in_count_total->setFgColor(6); $format_in_count_total->setBold(); $format_in_count_total->setSize(18); $format_in_count_total->setHAlign('left'); $format_in_count_total->setVAlign('vjustify'); $format_in_count_total->setVAlign('top'); $format_in_count_grand =& $workbook->addFormat(); $format_in_count_grand->setBorder(1); $format_in_count_grand->setColor(8); $format_in_count_grand->setFgColor(43); $format_in_count_grand->setBold(); $format_in_count_grand->setSize(18); $format_in_count_grand->setHAlign('left'); $format_in_count_grand->setVAlign('vjustify'); $format_in_count_grand->setVAlign('top'); // Added headers since they never change in the Inbound Count Group. $worksheet_in_count->write(0, 0, 'Email Count Admin', $format_in_count_title); $worksheet_in_count->write(0, 1, 'Totals', $format_in_count_title); $worksheet_in_count->write(0, 2, 'Email Count Field', $format_in_count_title); $worksheet_in_count->write(0, 3, 'ID', $format_in_count_title); $worksheet_in_count->write(0, 4, 'Totals', $format_in_count_title); // Setup templating for the formating of certain cells in the Outbound Count Group. $format_out_count_title =& $workbook->addFormat(); $format_out_count_title->setSize(15); $format_out_count_title->setColor(8); $format_out_count_title->setBorder(1); $format_out_count_title->setFgColor(14); $format_out_count_title->setBold(); $format_out_count_title->setHAlign('center'); $format_out_count_title->setVAlign('vjustify'); $format_out_count_title->setVAlign('top'); $format_out_count_title->setTextWrap(); $format_out_count_title2 =& $workbook->addFormat(); $format_out_count_title2->setColor(8); $format_out_count_title2->setFgColor(47); $format_out_count_title2->setBold(); $format_out_count_title2->setHAlign('center'); $format_out_count_title2->setVAlign('vjustify'); $format_out_count_title2->setVAlign('top'); $format_out_count_title2->setTextWrap(); $format_out_count_total =& $workbook->addFormat(); $format_out_count_total->setBorder(1); $format_out_count_total->setColor(8); $format_out_count_total->setFgColor(42); $format_out_count_total->setBold(); $format_out_count_total->setSize(18); $format_out_count_total->setHAlign('left'); $format_out_count_total->setVAlign('vjustify'); $format_out_count_total->setVAlign('top'); $format_out_count_grand =& $workbook->addFormat(); $format_out_count_grand->setBorder(1); $format_out_count_grand->setColor(8); $format_out_count_grand->setFgColor(43); $format_out_count_grand->setBold(); $format_out_count_grand->setSize(18); $format_out_count_grand->setHAlign('left'); $format_out_count_grand->setVAlign('vjustify'); $format_out_count_grand->setVAlign('top'); // Added headers since they never change in the Outbound Count Group. $worksheet_out_count->write(0, 0, 'Email Count Admin', $format_out_count_title); $worksheet_out_count->write(0, 1, 'Totals', $format_out_count_title); $worksheet_out_count->write(0, 2, 'Email Count Field', $format_out_count_title); $worksheet_out_count->write(0, 3, 'ID', $format_out_count_title); $worksheet_out_count->write(0, 4, 'Totals', $format_out_count_title); // Setup templating for the formating of certain cells in the Inbound Group. $format_inbound_title =& $workbook->addFormat(); $format_inbound_title->setSize(15); $format_inbound_title->setColor(8); $format_inbound_title->setBorder(1); $format_inbound_title->setFgColor(35); $format_inbound_title->setBold(); $format_inbound_title->setHAlign('center'); $format_inbound_title->setVAlign('vjustify'); $format_inbound_title->setVAlign('top'); $format_inbound_title->setTextWrap(); $format_inbound_title2 =& $workbook->addFormat(); $format_inbound_title2->setColor(8); $format_inbound_title2->setFgColor(47); $format_inbound_title2->setBold(); $format_inbound_title2->setHAlign('center'); $format_inbound_title2->setVAlign('vjustify'); $format_inbound_title2->setVAlign('top'); $format_inbound_title2->setTextWrap(); // Setup templating for the formating of certain cells in the Inbound Group. $format_inbound_title3 =& $workbook->addFormat(); $format_inbound_title3->setSize(15); $format_inbound_title3->setColor(8); $format_inbound_title3->setBorder(1); $format_inbound_title3->setFgColor(34); $format_inbound_title3->setBold(); $format_inbound_title3->setHAlign('center'); $format_inbound_title3->setVAlign('vjustify'); $format_inbound_title3->setVAlign('top'); $format_inbound_title3->setTextWrap(); // Added headers since they never change in the Inbound Group. $worksheet_inbound->setInputEncoding('utf-8'); $worksheet_inbound->write(0, 0, 'Inbound Email From', $format_inbound_title); $worksheet_inbound->write(0, 1, 'User Name', $format_inbound_title); $worksheet_inbound->write(0, 2, 'ID', $format_inbound_title); $worksheet_inbound->write(0, 3, 'Date Email Received', $format_inbound_title); $worksheet_inbound->write(0, 4, 'Ticket Mask', $format_inbound_title); $worksheet_inbound->write(0, 5, 'Subject Line', $format_inbound_title); $worksheet_inbound->write(0, 6, 'Email Contents', $format_inbound_title); $worksheet_inbound->write(0, 7, 'Category', $format_inbound_title3); $worksheet_inbound->write(0, 8, 'Code', $format_inbound_title3); $worksheet_inbound->write(0, 9, 'Description(or snapshot)', $format_inbound_title3); $worksheet_inbound->write(0, 10, 'Group', $format_inbound_title); $worksheet_inbound->write(1, 0, $week_range_text, $format_inbound_title2); $worksheet_inbound->write(1, 1, "", $format_inbound_title2); $worksheet_inbound->write(1, 2, "", $format_inbound_title2); $worksheet_inbound->write(1, 3, "", $format_inbound_title2); $worksheet_inbound->write(1, 4, "", $format_inbound_title2); $worksheet_inbound->write(1, 5, "", $format_inbound_title2); $worksheet_inbound->write(1, 6, "", $format_inbound_title2); $worksheet_inbound->write(1, 7, "", $format_inbound_title2); $worksheet_inbound->write(1, 8, "", $format_inbound_title2); $worksheet_inbound->write(1, 9, "", $format_inbound_title2); $worksheet_inbound->write(1, 10, "", $format_inbound_title2); // Setup templating for the formating of certain cells in the Outbound Group. $format_outbound_title =& $workbook->addFormat(); $format_outbound_title->setSize(15); $format_outbound_title->setColor(8); $format_outbound_title->setBorder(1); $format_outbound_title->setFgColor(11); $format_outbound_title->setBold(); $format_outbound_title->setHAlign('center'); $format_outbound_title->setVAlign('vjustify'); $format_outbound_title->setVAlign('top'); $format_outbound_title->setTextWrap(); $format_outbound_title2 =& $workbook->addFormat(); $format_outbound_title2->setColor(8); $format_outbound_title2->setFgColor(6); $format_outbound_title2->setBold(); $format_outbound_title2->setHAlign('center'); $format_outbound_title2->setVAlign('vjustify'); $format_outbound_title2->setVAlign('top'); $format_outbound_title2->setTextWrap(); $format_outbound_title3 =& $workbook->addFormat(); $format_outbound_title3->setSize(15); $format_outbound_title3->setColor(8); $format_outbound_title3->setBorder(1); $format_outbound_title3->setFgColor(34); $format_outbound_title3->setBold(); $format_outbound_title3->setHAlign('center'); $format_outbound_title3->setVAlign('vjustify'); $format_outbound_title3->setVAlign('top'); $format_outbound_title3->setTextWrap(); // Added headers since they never change in the Outbound Group. $worksheet_outbound->setInputEncoding('utf-8'); $worksheet_outbound->write(0, 0, 'Outbound Email To', $format_outbound_title); $worksheet_outbound->write(0, 1, 'User Name', $format_outbound_title); $worksheet_outbound->write(0, 2, 'ID', $format_outbound_title); $worksheet_outbound->write(0, 3, 'Date Email Sent', $format_outbound_title); $worksheet_outbound->write(0, 4, 'Ticket Mask', $format_outbound_title); $worksheet_outbound->write(0, 5, 'Subject Line', $format_outbound_title); $worksheet_outbound->write(0, 6, 'Email Contents', $format_outbound_title); $worksheet_outbound->write(0, 7, 'Category', $format_outbound_title3); $worksheet_outbound->write(0, 8, 'Code', $format_outbound_title3); $worksheet_outbound->write(0, 9, 'Description(or snapshot)', $format_outbound_title3); $worksheet_outbound->write(0, 10, 'Responder', $format_outbound_title); $worksheet_outbound->write(0, 11, 'Group', $format_outbound_title); $worksheet_outbound->write(1, 0, $week_range_text, $format_outbound_title2); $worksheet_outbound->write(1, 1, "", $format_outbound_title2); $worksheet_outbound->write(1, 2, "", $format_outbound_title2); $worksheet_outbound->write(1, 3, "", $format_outbound_title2); $worksheet_outbound->write(1, 4, "", $format_outbound_title2); $worksheet_outbound->write(1, 5, "", $format_outbound_title2); $worksheet_outbound->write(1, 6, "", $format_outbound_title2); $worksheet_outbound->write(1, 7, "", $format_outbound_title2); $worksheet_outbound->write(1, 8, "", $format_outbound_title2); $worksheet_outbound->write(1, 9, "", $format_outbound_title2); $worksheet_outbound->write(1, 10, "", $format_outbound_title2); $worksheet_outbound->write(1, 11, "", $format_outbound_title2); print $translate->_('answernet.er.metlife.metlife.done'); print '<br>'; print $translate->_('answernet.er.metlife.generating.email.detail'); $groups = DAO_Group::getAll(); $buckets = DAO_Bucket::getAll(); $sql = "SELECT t.mask, a.email, m.address_id, a.contact_org_id, "; $sql .= "t.created_date ticket_created_date, t.team_id, "; $sql .= "m.created_date message_created_date, mc.content, "; $sql .= "mh.header_value message_subject, m.worker_id, "; $sql .= "m.is_outgoing, mh_to.header_value outbound_email, t.team_id "; $sql .= "FROM message m "; $sql .= "INNER JOIN ticket t ON m.ticket_id = t.id "; $sql .= "INNER JOIN address a ON m.address_id = a.id "; $sql .= "INNER JOIN message_content mc on m.id = mc.message_id "; $sql .= "INNER JOIN message_header mh on m.id = mh.message_id "; $sql .= "and mh.header_name = 'subject' "; $sql .= "INNER JOIN message_header mh_to on m.id = mh_to.message_id "; $sql .= "and mh_to.header_name = 'to' "; $sql .= sprintf("WHERE m.created_date > %d AND m.created_date <= %d ", $start_time, $end_time); // Set abouve based on group selected. $sql .= $group_sql; $sql .= "ORDER BY m.id "; $rs = $db->Execute($sql); $row_inbound = 2; $row_outbound = 2; $in_count_admin = array(); $in_count_other = array(); $out_count_admin = array(); $out_count_other = array(); if (is_a($rs, 'ADORecordSet')) { while (!$rs->EOF) { $mask = $rs->fields['mask']; $ticket_created_date = intval($rs->fields['ticket_created_date']); $team_id = intval($rs->fields['team_id']); // Date Format Month/Day/Year Hour:Min:Sec AM/PM $message_created_date = date("n/j/y g:i:s A", intval($rs->fields['message_created_date'])); $message_content = $rs->fields['content']; $message_subject = $rs->fields['message_subject']; $worker_id = $rs->fields['worker_id']; $is_outgoing = $rs->fields['is_outgoing']; if ($team_id == 756) { $team_text = 'First Person'; } elseif ($team_id == 782) { $team_text = 'iDesign'; } else { $team_text = 'Error'; } if ($worker_id) { $worker_name = $workers[$worker_id]->first_name; } else { $worker_name = ""; } if ($is_outgoing) { $outbound_email = $rs->fields['outbound_email']; $to = array(); $to = CerberusParser::parseRfcAddress($outbound_email); @($toAddress = $to[0]->mailbox . '@' . $to[0]->host); $toAddressInst = CerberusApplication::hashLookupAddress($toAddress, true); $address_id = $toAddressInst->id; $contact_org_id = $toAddressInst->contact_org_id; $email = $toAddressInst->email; } else { $address_id = $rs->fields['address_id']; $contact_org_id = $rs->fields['contact_org_id']; $email = $rs->fields['email']; } if ($is_outgoing) { $worksheet_outbound->setRow($row_outbound, 12); $worksheet_outbound->write($row_outbound, 0, $email, $format_general); $worksheet_outbound->write($row_outbound, 1, "", $format_general); $worksheet_outbound->write($row_outbound, 2, "", $format_general); $worksheet_outbound->write($row_outbound, 3, $message_created_date, $format_general); $worksheet_outbound->write($row_outbound, 4, $mask, $format_general); $worksheet_outbound->write($row_outbound, 5, trim($message_subject), $format_general_nowrap); $worksheet_outbound->write($row_outbound, 6, trim(strip_tags($message_content))); $worksheet_outbound->writeString($row_outbound, 10, $worker_name, $format_general); $worksheet_outbound->write($row_outbound, 11, $team_text, $format_general); $row_outbound++; } else { $worksheet_inbound->setRow($row_inbound, 12); $worksheet_inbound->write($row_inbound, 0, $email, $format_general); $worksheet_inbound->write($row_inbound, 1, "", $format_general); $worksheet_inbound->write($row_inbound, 2, "", $format_general); $worksheet_inbound->write($row_inbound, 3, $message_created_date, $format_general); $worksheet_inbound->write($row_inbound, 4, $mask, $format_general); $worksheet_inbound->write($row_inbound, 5, trim($message_subject), $format_general_nowrap); $worksheet_inbound->writeString($row_inbound, 6, trim(strip_tags($message_content))); $worksheet_inbound->write($row_inbound, 10, $team_text, $format_general); $row_inbound++; } if ($is_outgoing) { if ($contact_org_id == 1) { if (!isset($out_count_admin[$address_id]['count'])) { $out_count_admin[$address_id]['email'] = $email; $out_count_admin[$address_id]['count'] = 1; } else { $out_count_admin[$address_id]['count']++; } } else { if (!isset($out_count_other[$address_id]['count'])) { $out_count_other[$address_id]['email'] = $email; $out_count_other[$address_id]['count'] = 1; } else { $out_count_other[$address_id]['count']++; } } } else { if ($contact_org_id == 1) { if (!isset($in_count_admin[$address_id]['count'])) { $in_count_admin[$address_id]['email'] = $email; $in_count_admin[$address_id]['count'] = 1; } else { $in_count_admin[$address_id]['count']++; } } else { if (!isset($in_count_other[$address_id]['count'])) { $in_count_other[$address_id]['email'] = $email; $in_count_other[$address_id]['count'] = 1; } else { $in_count_other[$address_id]['count']++; } } } $rs->MoveNext(); } } print $translate->_('answernet.er.metlife.metlife.done'); print '<br>'; print $translate->_('answernet.er.metlife.generating.email.count'); $worksheet_in_count->setRow(1, 24); $row_count = 2; foreach ($in_count_admin as $record) { $worksheet_in_count->write($row_count, 0, $record['email'], $format_general); $worksheet_in_count->write($row_count, 1, $record['count'], $format_general); $row_count++; } $worksheet_in_count->write(1, 0, 'Total Admin Email', $format_in_count_total); $worksheet_in_count->writeFormula(1, 1, "=SUM(B3:B" . $row_count . ")", $format_in_count_total); $row_count = 2; foreach ($in_count_other as $record) { $worksheet_in_count->write($row_count, 2, $record['email'], $format_general); $worksheet_in_count->write($row_count, 3, '', $format_general); $worksheet_in_count->write($row_count, 4, $record['count'], $format_general); $row_count++; } $worksheet_in_count->write(1, 2, 'Total Field Email', $format_in_count_total); $worksheet_in_count->write(1, 3, '', $format_in_count_total); $worksheet_in_count->writeFormula(1, 4, "=SUM(E3:E" . $row_count . ")", $format_in_count_total); // Grand Total $worksheet_in_count->write(1, 5, 'Grand Total Email', $format_in_count_grand); $worksheet_in_count->writeFormula(1, 6, "=SUM(B2,E2)", $format_in_count_grand); $worksheet_out_count->setRow(1, 24); $row_count = 2; foreach ($out_count_admin as $record) { $worksheet_out_count->write($row_count, 0, $record['email'], $format_general); $worksheet_out_count->write($row_count, 1, $record['count'], $format_general); $row_count++; } $worksheet_out_count->write(1, 0, 'Total Admin Email', $format_out_count_total); $worksheet_out_count->writeFormula(1, 1, "=SUM(B3:B" . $row_count . ")", $format_out_count_total); $row_count = 2; foreach ($out_count_other as $record) { $worksheet_out_count->write($row_count, 2, $record['email'], $format_general); $worksheet_out_count->write($row_count, 3, '', $format_general); $worksheet_out_count->write($row_count, 4, $record['count'], $format_general); $row_count++; } $worksheet_out_count->write(1, 2, 'Total Field Email', $format_out_count_total); $worksheet_out_count->write(1, 3, '', $format_out_count_total); $worksheet_out_count->writeFormula(1, 4, "=SUM(E3:E" . $row_count . ")", $format_out_count_total); // Grand Total $worksheet_out_count->write(1, 5, 'Grand Total Email', $format_out_count_grand); $worksheet_out_count->writeFormula(1, 6, "=SUM(B2,E2)", $format_out_count_grand); $workbook->close(); print $translate->_('answernet.er.metlife.metlife.done'); print '<br>'; print $translate->_('ranswernet.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>'; }
function viewAssignThreadsAction() { @($row_ids = DevblocksPlatform::importGPC($_POST['row_id'], 'array', array())); @($worker_id = DevblocksPlatform::importGPC($_REQUEST['assign_worker_id'], 'integer', 0)); @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', '')); $active_worker = CerberusApplication::getActiveWorker(); if (is_array($row_ids) && !empty($row_ids)) { // Do assignments $fields = array(DAO_ForumsThread::WORKER_ID => $worker_id); DAO_ForumsThread::update($row_ids, $fields); // Only send notifications if not assigning to self (or unassigning) if (!empty($worker_id) && $active_worker->id != $worker_id) { $url_writer = DevblocksPlatform::getUrlService(); // Load threads for notifications $forum_threads = DAO_ForumsThread::getWhere(sprintf("%s IN (%s)", DAO_ForumsThread::ID, implode(',', $row_ids))); // Send notifications about assigned forum threads if (is_array($forum_threads) && !empty($forum_threads)) { foreach ($forum_threads as $forum_thread) { /* @var $forum_thread Model_ForumsThread */ $fields = array(DAO_WorkerEvent::CREATED_DATE => time(), DAO_WorkerEvent::WORKER_ID => $worker_id, DAO_WorkerEvent::URL => $url_writer->write('c=forums&a=explorer', true) . '?start=' . $forum_thread->id, DAO_WorkerEvent::TITLE => 'New Forum Assignment', DAO_WorkerEvent::CONTENT => sprintf("%s assigned: %s", $active_worker->getName(), $forum_thread->title), DAO_WorkerEvent::IS_READ => 0); DAO_WorkerEvent::create($fields); } } } } if (!empty($view_id) && null != ($view = C4_AbstractViewLoader::getView($view_id))) { $view->render(); } }
function write($sQuery = '', $full = false) { $url = DevblocksPlatform::getUrlService(); $args = $url->parseQueryString($sQuery); $c = @$args['c']; @($proxyssl = $_SERVER['HTTP_DEVBLOCKSPROXYSSL']); @($proxyhost = $_SERVER['HTTP_DEVBLOCKSPROXYHOST']); @($proxybase = $_SERVER['HTTP_DEVBLOCKSPROXYBASE']); // Proxy (Community Tool) if (!empty($proxyhost)) { if ($full) { $prefix = sprintf("%s://%s%s/", !empty($proxyssl) ? 'https' : 'http', $proxyhost, $proxybase); } else { $prefix = $proxybase . '/'; } // Index page if (empty($sQuery)) { return sprintf("%s", $prefix); } // [JAS]: Internal non-component URL (images/css/js/etc) if (empty($c)) { $contents = sprintf("%s%s", $prefix, $sQuery); // [JAS]: Component URL } else { $contents = sprintf("%s%s", $prefix, !empty($args) ? implode('/', array_values($args)) : ''); } // Devblocks App } else { if ($full) { $prefix = sprintf("%s://%s%s", $this->_isSSL() ? 'https' : 'http', $_SERVER['HTTP_HOST'], DEVBLOCKS_WEBPATH); } else { $prefix = DEVBLOCKS_WEBPATH; } // Index page if (empty($sQuery)) { return sprintf("%s%s", $prefix, DEVBLOCKS_REWRITE ? '' : 'index.php/'); } // [JAS]: Internal non-component URL (images/css/js/etc) if (empty($c)) { $contents = sprintf("%s%s", $prefix, $sQuery); // [JAS]: Component URL } else { if (DEVBLOCKS_REWRITE) { $contents = sprintf("%s%s", $prefix, !empty($args) ? implode('/', array_values($args)) : ''); } else { $contents = sprintf("%sindex.php/%s", $prefix, !empty($args) ? implode('/', array_values($args)) : ''); } } } return $contents; }
function handleRequest(DevblocksHttpRequest $request) { @set_time_limit(0); // no timelimit (when possible) $translate = DevblocksPlatform::getTranslationService(); $stack = $request->path; array_shift($stack); // update $cache = DevblocksPlatform::getCacheService(); /* @var $cache _DevblocksCacheManager */ switch (array_shift($stack)) { case 'locked': if (!DevblocksPlatform::versionConsistencyCheck()) { $url = DevblocksPlatform::getUrlService(); echo "<h1>Feg - Fax Email Gateway 1.x</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('login'))); } break; default: $path = APP_TEMP_PATH . DIRECTORY_SEPARATOR; $file = $path . 'feg_update_lock'; $settings = DevblocksPlatform::getPluginSettingsService(); $authorized_ips_str = $settings->get('feg.core', FegSettings::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 this IP authorized? $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->_('update.ip_unauthorized'), $_SERVER['REMOTE_ADDR']); return; } // Check requirements $errors = FegApplication::checkRequirements(); if (!empty($errors)) { echo $translate->_('update.correct_errors'); echo "<ul style='color:red;'>"; foreach ($errors as $error) { echo "<li>" . $error . "</li>"; } echo "</ul>"; exit; } try { // If authorized, lock and attempt update if (!file_exists($file) || @filectime($file) + 600 < time()) { // 10 min lock // Log everybody out since we're touching the database $session = DevblocksPlatform::getSessionService(); $session->clearAll(); // Lock file touch($file); // Recursive patch FegApplication::update(); // Clean up @unlink($file); $cache = DevblocksPlatform::getCacheService(); $cache->save(APP_BUILD, "devblocks_app_build"); // Clear all caches $cache->clean(); DevblocksPlatform::getClassLoaderService()->destroy(); // Clear compiled templates $tpl = DevblocksPlatform::getTemplateService(); $tpl->utility->clearCompiledTemplate(); $tpl->cache->clearAll(); // Reload plugin translations DAO_Translation::reloadPluginStrings(); // Redirect DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login'))); } else { echo $translate->_('update.locked_another'); } } catch (Exception $e) { unlink($file); die($e->getMessage()); } } exit; }
function doRegisterAction() { @($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string', '')); $tpl = DevblocksPlatform::getTemplateService(); $settings = CerberusSettings::getInstance(); $from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM, null); $from_personal = $settings->get(CerberusSettings::DEFAULT_REPLY_PERSONAL, "Support Dept."); $url = DevblocksPlatform::getUrlService(); $mail_service = DevblocksPlatform::getMailService(); $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults()); $code = CerberusApplication::generatePassword(8); if (!empty($email) && null != ($addy = DAO_Address::lookupAddress($email, true))) { // Already registered? if ($addy->is_registered) { $tpl->assign('register_error', sprintf("'%s' is already registered.", $email)); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register'))); return; } $fields = array(DAO_Address::IS_REGISTERED => 0, DAO_Address::PASS => $code); DAO_Address::update($addy->id, $fields); } else { $tpl->assign('register_error', sprintf("'%s' is an invalid e-mail address.", $email)); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register'))); return; } $message = $mail_service->createMessage(); $message->setTo($email); $message->setFrom(array($from => $from_personal)); $message->setSubject("Confirming your support e-mail address"); $message->setBody(sprintf("This is a message to confirm your recent registration request at:\r\n" . "%s\r\n" . "\r\n" . "Your confirmation code is: %s\r\n" . "\r\n" . "If you've closed the browser window, you can continue by visiting:\r\n" . "%s\r\n" . "\r\n" . "Thanks!\r\n" . "%s\r\n", $url->write('', true), $code, $url->write('c=register&a=confirm', true), $from_personal)); $headers = $message->getHeaders(); $headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')'); $result = $mailer->send($message); DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('portal', UmPortalHelper::getCode(), 'register', 'confirm'))); }
private function _sendForwards($event, $is_inbound) { @($ticket_id = $event->params['ticket_id']); @($send_worker_id = $event->params['worker_id']); $url_writer = DevblocksPlatform::getUrlService(); $ticket = DAO_Ticket::get($ticket_id); // (Action) Forward Email To: // Sanitize and combine all the destination addresses $context_workers = CerberusContexts::getWorkers(CerberusContexts::CONTEXT_TICKET, $ticket->id); if (!is_array($context_workers)) { return; } foreach ($context_workers as $next_worker) { $notify_emails = $next_worker->email; if (empty($notify_emails)) { continue; } } // [TODO] This could be more efficient $messages = DAO_Message::getMessagesByTicket($ticket_id); $message = end($messages); // last message unset($messages); $headers = $message->getHeaders(); // The whole flipping Swift section needs wrapped to catch exceptions try { $settings = DevblocksPlatform::getPluginSettingsService(); $reply_to = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM, CerberusSettingsDefaults::DEFAULT_REPLY_FROM); // See if we need a group-specific reply-to if (!empty($ticket->team_id)) { @($group_from = DAO_GroupSettings::get($ticket->team_id, DAO_GroupSettings::SETTING_REPLY_FROM, '')); if (!empty($group_from)) { $reply_to = $group_from; } } $sender = DAO_Address::get($message->address_id); $sender_email = strtolower($sender->email); $sender_split = explode('@', $sender_email); if (!is_array($sender_split) || count($sender_split) != 2) { return; } // If return-path is blank if (isset($headers['return-path']) && $headers['return-path'] == '<>') { return; } // Ignore bounces if ($sender_split[0] == "postmaster" || $sender_split[0] == "mailer-daemon") { return; } // Ignore autoresponses autoresponses if (isset($headers['auto-submitted']) && $headers['auto-submitted'] != 'no') { return; } // Attachments $attachments = $message->getAttachments(); $mime_attachments = array(); if (is_array($attachments)) { foreach ($attachments as $attachment) { if (0 == strcasecmp($attachment->display_name, 'original_message.html')) { continue; } $attachment_path = APP_STORAGE_PATH . '/attachments/'; // [TODO] This is highly redundant in the codebase if (!file_exists($attachment_path . $attachment->filepath)) { continue; } $attach = Swift_Attachment::fromPath($attachment_path . $attachment->filepath); if (!empty($attachment->display_name)) { $attach->setFilename($attachment->display_name); } $mime_attachments[] = $attach; } } // Send copies $mail_service = DevblocksPlatform::getMailService(); $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults()); $mail = $mail_service->createMessage(); /* @var $mail Swift_Message */ $mail->setTo(array($notify_emails)); $mail->setFrom(array($sender->email)); $mail->setReplyTo($reply_to); $mail->setReturnPath($reply_to); $mail->setSubject(sprintf("[RW: %s #%s]: %s", $is_inbound ? 'inbound' : 'outbound', $ticket->mask, $ticket->subject)); $hdrs = $mail->getHeaders(); if (null !== @($msgid = $headers['message-id'])) { $hdrs->addTextHeader('Message-Id', $msgid); } if (null !== @($in_reply_to = $headers['in-reply-to'])) { $hdrs->addTextHeader('References', $in_reply_to); $hdrs->addTextHeader('In-Reply-To', $in_reply_to); } $hdrs->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')'); $hdrs->addTextHeader('Precedence', 'List'); $hdrs->addTextHeader('Auto-Submitted', 'auto-generated'); $mail->setBody($message->getContent()); // Send message attachments with watcher if (is_array($mime_attachments)) { foreach ($mime_attachments as $mime_attachment) { $mail->attach($mime_attachment); } } $result = $mailer->send($mail); } catch (Exception $e) { if (!empty($message_id)) { $fields = array(DAO_MessageNote::MESSAGE_ID => $message_id, DAO_MessageNote::CREATED => time(), DAO_MessageNote::WORKER_ID => 0, DAO_MessageNote::CONTENT => 'Exception thrown while sending watcher email: ' . $e->getMessage(), DAO_MessageNote::TYPE => Model_MessageNote::TYPE_ERROR); DAO_MessageNote::create($fields); } } }
private function _sendConfirmationEmail($to, $worker) { $translate = DevblocksPlatform::getTranslationService(); $settings = DevblocksPlatform::getPluginSettingsService(); $url_writer = DevblocksPlatform::getUrlService(); $tpl = DevblocksPlatform::getTemplateService(); // Tentatively assign the e-mail address to this worker DAO_AddressToWorker::assign($to, $worker->id); // Create a confirmation code and save it $code = CerberusApplication::generatePassword(20); DAO_AddressToWorker::update($to, array(DAO_AddressToWorker::CODE => $code, DAO_AddressToWorker::CODE_EXPIRE => time() + 24 * 60 * 60)); // Email the confirmation code to the address // [TODO] This function can return false, and we need to do something different if it does. CerberusMail::quickSend($to, vsprintf($translate->_('prefs.address.confirm.mail.subject'), $settings->get('cerberusweb.core', CerberusSettings::HELPDESK_TITLE)), vsprintf($translate->_('prefs.address.confirm.mail.body'), array($worker->getName(), $url_writer->write('c=preferences&a=confirm_email&code=' . $code, true)))); $output = array(vsprintf($translate->_('prefs.address.confirm.mail.subject'), $to)); $tpl->assign('pref_success', $output); }
function getFeedAsRss($feed) { $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(); // Channel $channel = $xml->addChild('channel'); $channel->addChild('title', $feed->title); $channel->addChild('link', $url->write('', true)); $channel->addChild('description', ''); // View $view = new C4_TaskView(); $view->name = $feed->title; $view->params = $feed->params['params']; $view->renderLimit = 100; $view->renderSortBy = $feed->params['sort_by']; $view->renderSortAsc = $feed->params['sort_asc']; // Results list($results, $count) = $view->getData(); $task_sources = DevblocksPlatform::getExtensions('cerberusweb.task.source', true); // [TODO] We should probably be building this feed with Zend Framework for compliance foreach ($results as $task) { $created = intval($task[SearchFields_Task::UPDATED_DATE]); if (empty($created)) { $created = time(); } $eItem = $channel->addChild('item'); $escapedSubject = htmlspecialchars($task[SearchFields_Task::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($task[SearchFields_Task::CONTENT],null,LANG_CHARSET_CODE)); $eDesc = $eItem->addChild('description', ''); if (isset($task_sources[$task[SearchFields_Task::SOURCE_EXTENSION]]) && isset($task[SearchFields_Task::SOURCE_ID])) { $source_ext =& $task_sources[$task[SearchFields_Task::SOURCE_EXTENSION]]; /* @var $source_ext Extension_TaskSource */ $source_ext_info = $source_ext->getSourceInfo($task[SearchFields_Task::SOURCE_ID]); $link = $source_ext_info['url']; $eLink = $eItem->addChild('link', $link); } else { $link = $url->write('c=activity&tab=tasks', 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"); } return $xml->asXML(); }
function saveOrgNoteAction() { @($org_id = DevblocksPlatform::importGPC($_REQUEST['org_id'], 'integer', 0)); @($content = DevblocksPlatform::importGPC($_REQUEST['content'], 'string', '')); $active_worker = CerberusApplication::getActiveWorker(); if (!empty($org_id) && 0 != strlen(trim($content))) { $fields = array(DAO_Note::SOURCE_EXTENSION_ID => ChNotesSource_Org::ID, DAO_Note::SOURCE_ID => $org_id, DAO_Note::WORKER_ID => $active_worker->id, DAO_Note::CREATED => time(), DAO_Note::CONTENT => $content); $note_id = DAO_Note::create($fields); } $org = DAO_ContactOrg::get($org_id); // Worker 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=contacts&a=orgs&d=display&id=' . $org_id, true), DAO_WorkerEvent::TITLE => 'New Organization Note', DAO_WorkerEvent::CONTENT => sprintf("%s\n%s notes: %s", $org->name, $active_worker->getName(), $content), DAO_WorkerEvent::IS_READ => 0); DAO_WorkerEvent::create($fields); } } DevblocksPlatform::redirect(new DevblocksHttpResponse(array('contacts', 'orgs', 'display', $org_id))); }
function saveWorkerPeekAction() { $translate = DevblocksPlatform::getTranslationService(); $active_worker = CerberusApplication::getActiveWorker(); if (!$active_worker || !$active_worker->is_superuser || DEMO_MODE) { 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::deleteAgent($id); } } else { if (empty($id) && null == DAO_Worker::lookupAgentEmail($email)) { $workers = DAO_Worker::getAll(); $license = CerberusLicense::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('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM); $replyPersonal = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL, ''); $url = DevblocksPlatform::getUrlService(); $password = CerberusApplication::generatePassword(8); try { $mail_service = DevblocksPlatform::getMailService(); $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults()); $mail = $mail_service->createMessage(); $mail->setTo(array($email => $first_name . ' ' . $last_name)); $mail->setFrom(array($replyFrom => $replyPersonal)); $mail->setSubject('Your new helpdesk login information!'); $mail->generateId(); $headers = $mail->getHeaders(); $headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')'); $body = sprintf("Your new helpdesk login information is below:\r\n" . "\r\n" . "URL: %s\r\n" . "Login: %s\r\n" . "Password: %s\r\n" . "\r\n" . "You should change your password from Preferences after logging in for the first time.\r\n" . "\r\n", $url->write('', true), $email, $password); $mail->setBody($body); if (!$mailer->send($mail)) { throw new Exception('Password notification email failed to send.'); } } catch (Exception $e) { // [TODO] need to report to the admin when the password email doesn't send. The try->catch // will keep it from killing php, but the password will be empty and the user will never get an email. } } $id = DAO_Worker::create($email, $password, '', '', ''); } } // 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::PASSWORD] = md5($password); } // Update worker DAO_Worker::updateAgent($id, $fields); // Update group memberships if (is_array($group_ids) && is_array($group_roles)) { foreach ($group_ids as $idx => $group_id) { if (empty($group_roles[$idx])) { DAO_Group::unsetTeamMember($group_id, $id); } else { DAO_Group::setTeamMember($group_id, $id, 2 == $group_roles[$idx]); } } } // Add the worker e-mail to the addresses table if (!empty($email)) { DAO_Address::lookupAddress($email, true); } // Addresses if (null == DAO_AddressToWorker::getByAddress($email)) { DAO_AddressToWorker::assign($email, $id); DAO_AddressToWorker::update($email, array(DAO_AddressToWorker::IS_CONFIRMED => 1)); } // Custom field saves @($field_ids = DevblocksPlatform::importGPC($_POST['field_ids'], 'array', array())); DAO_CustomFieldValue::handleFormPost(ChCustomFieldSource_Worker::ID, $id, $field_ids); } if (!empty($view_id)) { $view = C4_AbstractViewLoader::getView($view_id); $view->render(); } //DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config','workers'))); }
private function _writeArticlesAsRss($articles, $title) { $url_writer = DevblocksPlatform::getUrlService(); $aFeed = array('title' => $title, 'link' => $url_writer->write('', true), 'charset' => 'utf-8', 'entries' => array()); foreach ($articles as $article_id => $article) { $summary = substr(strip_tags($article->content), 0, 255) . (strlen($article->content) > 255 ? '...' : ''); $aEntry = array('title' => utf8_encode($article->title), 'link' => $url_writer->write('c=article&id=' . $article_id, true), 'lastUpdate' => $article->updated, 'published' => $article->updated, 'guid' => md5($article->title . $article->updated), 'description' => utf8_encode($summary), 'content' => utf8_encode($article->content)); $aFeed['entries'][] = $aEntry; } unset($articles); $rssFeed = Zend_Feed::importArray($aFeed, 'rss'); echo $rssFeed->saveXML(); }
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; }
private function _sendConfirmation($email, $link) { $settings = CerberusSettings::getInstance(); $from = $settings->get(CerberusSettings::DEFAULT_REPLY_FROM); $from_personal = $settings->get(CerberusSettings::DEFAULT_REPLY_PERSONAL); $url = DevblocksPlatform::getUrlService(); try { $mail_service = DevblocksPlatform::getMailService(); $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults()); $code = CerberusApplication::generatePassword(8); if (!empty($email) && null != ($addy = DAO_Address::lookupAddress($email, false))) { $fields = array(DAO_AddressAuth::CONFIRM => $code); DAO_AddressAuth::update($addy->id, $fields); } else { return; } $message = $mail_service->createMessage(); $message->setTo($email); $send_from = new Swift_Address($from, $from_personal); $message->setFrom($send_from); $message->setSubject("Account Confirmation Code"); $message->setBody(sprintf("Below is your confirmation code. Please copy and paste it into the confirmation form at:\r\n" . "%s\r\n" . "\r\n" . "Your confirmation code is: %s\r\n" . "\r\n" . "Thanks!\r\n", $link, $code)); $message->headers->set('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')'); $mailer->send($message, $email, $send_from); } catch (Exception $e) { return; } }