当前位置: 首页>>代码示例>>PHP>>正文


PHP DevblocksPlatform::getPluginSettingsService方法代码示例

本文整理汇总了PHP中DevblocksPlatform::getPluginSettingsService方法的典型用法代码示例。如果您正苦于以下问题:PHP DevblocksPlatform::getPluginSettingsService方法的具体用法?PHP DevblocksPlatform::getPluginSettingsService怎么用?PHP DevblocksPlatform::getPluginSettingsService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DevblocksPlatform的用法示例。


在下文中一共展示了DevblocksPlatform::getPluginSettingsService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showTab

 function showTab()
 {
     $settings = DevblocksPlatform::getPluginSettingsService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $core_tplpath = dirname(dirname(dirname(__FILE__))) . '/portsensor.core/templates/';
     $tpl->assign('core_tplpath', $core_tplpath);
     $tpl->assign('response_uri', 'setup/translations');
     $defaults = new Ps_AbstractViewModel();
     $defaults->class_name = 'Ps_TranslationView';
     $defaults->id = Ps_TranslationView::DEFAULT_ID;
     $view = Ps_AbstractViewLoader::getView(Ps_TranslationView::DEFAULT_ID, $defaults);
     $tpl->assign('view', $view);
     $tpl->assign('view_fields', Ps_TranslationView::getFields());
     $tpl->assign('view_searchable_fields', Ps_TranslationView::getSearchFields());
     $tpl->display('file:' . $tpl_path . 'setup/translations/index.tpl');
 }
开发者ID:jstanden,项目名称:portsensor,代码行数:17,代码来源:App.php

示例2: sendFax

 /**
  * exec_sendfax
  *
  * @param string command
  * @return array
  */
 function sendFax($phone_number, $message, $subject, $to, $account_name, $from = null)
 {
     // sendfax -f "robert.middleswarth@answernet.com" -D -R -r "Test Fax" -x "Account Name" -d "RecipientName@4106311699" /home/rmiddle/test.txt
     $settings = DevblocksPlatform::getPluginSettingsService();
     if (empty($from)) {
         @($from = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM, $_SERVER['SERVER_ADMIN']));
     }
     $command = "sendfax ";
     $command .= sprintf("-f '%s' ", $from);
     $command .= "-D -R ";
     $command .= sprintf("-r '%s' ", $subject);
     $command .= sprintf("-x '%s' ", $account_name);
     $command .= sprintf("-d '%s@%s' ", $to, $phone_number);
     $tempfilename = tempnam(APP_TEMP_PATH . "/fax_cache", 'fax_message-');
     $temp_fh = fopen($tempfilename, 'w') or die($php_errormsg);
     fputs($temp_fh, $message);
     fclose($temp_fh) or die($php_errormsg);
     // Generate Text file of message.
     $command .= sprintf("'%s' ", $tempfilename);
     $o = exec($command . " 2>&1", $sendfax_output, $retval);
     $debug = DEBUG_MODE;
     if ($retval == 0) {
         // success
         if ($debug) {
             echo "<p>{$command}";
         }
         $result = str_replace("(", "", $sendfax_output[0]);
         $result = str_replace(")", "", $result);
         //	request id is 80 (group id 80) for host localhost (3 files)
         //	request id is 81 (group id 81) for host localhost (1 file)
         $output = split(" ", $result);
         return array('status' => true, 'jobid' => $output[3], 'groupid' => $output[6], 'host' => $output[9], 'numfiles' => $output[10]);
     }
     if ($debug) {
         echo "<p>";
         print_r($o);
         echo "<p>";
         print_r($sendfax_output);
         echo "<p>{$command}<br>";
     }
     $forlog = implode("\n", $sendfax_output);
     return array('status' => false, 'output' => $forlog);
 }
开发者ID:rmiddle,项目名称:feg,代码行数:49,代码来源:Hylafax.php

示例3: hasPriv

 function hasPriv($priv_id)
 {
     // We don't need to do much work if we're a superuser
     if ($this->is_superuser) {
         return true;
     }
     $settings = DevblocksPlatform::getPluginSettingsService();
     $acl_enabled = $settings->get('feg.core', FegSettings::ACL_ENABLED);
     // ACL is a paid feature (please respect the licensing and support the project!)
     $license = FegLicense::getInstance();
     if (!$acl_enabled || !isset($license['serial']) || isset($license['a'])) {
         return "core.setup" == substr($priv_id, 0, 11) ? false : true;
     }
     // Check the aggregated worker privs from roles
     $acl = DAO_WorkerRole::getACL();
     $privs_by_worker = $acl[DAO_WorkerRole::CACHE_KEY_PRIVS_BY_WORKER];
     if (!empty($priv_id) && isset($privs_by_worker[$this->id][$priv_id])) {
         return true;
     }
     return false;
 }
开发者ID:rmiddle,项目名称:feg,代码行数:21,代码来源:worker.php

示例4: doContactSendAction

 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 = DevblocksPlatform::getPluginSettingsService();
     $default_from = $settings->get('cerberusweb.core', 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";
//.........这里部分代码省略.........
开发者ID:Hildy,项目名称:cerb5,代码行数:101,代码来源:contact.php

示例5: saveOutgoingMailSettingsAction

 function saveOutgoingMailSettingsAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = CerberusApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     if (DEMO_MODE) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'mail')));
         return;
     }
     @($default_reply_address = DevblocksPlatform::importGPC($_REQUEST['sender_address'], 'string'));
     @($default_reply_personal = DevblocksPlatform::importGPC($_REQUEST['sender_personal'], 'string'));
     @($default_signature = DevblocksPlatform::importGPC($_POST['default_signature'], 'string'));
     @($default_signature_pos = DevblocksPlatform::importGPC($_POST['default_signature_pos'], 'integer', 0));
     @($smtp_host = DevblocksPlatform::importGPC($_REQUEST['smtp_host'], 'string', 'localhost'));
     @($smtp_port = DevblocksPlatform::importGPC($_REQUEST['smtp_port'], 'integer', 25));
     @($smtp_enc = DevblocksPlatform::importGPC($_REQUEST['smtp_enc'], 'string', 'None'));
     @($smtp_timeout = DevblocksPlatform::importGPC($_REQUEST['smtp_timeout'], 'integer', 30));
     @($smtp_max_sends = DevblocksPlatform::importGPC($_REQUEST['smtp_max_sends'], 'integer', 20));
     @($smtp_auth_enabled = DevblocksPlatform::importGPC($_REQUEST['smtp_auth_enabled'], 'integer', 0));
     if ($smtp_auth_enabled) {
         @($smtp_auth_user = DevblocksPlatform::importGPC($_REQUEST['smtp_auth_user'], 'string'));
         @($smtp_auth_pass = DevblocksPlatform::importGPC($_REQUEST['smtp_auth_pass'], 'string'));
     } else {
         // need to clear auth info when smtp auth is disabled
         @($smtp_auth_user = '');
         @($smtp_auth_pass = '');
     }
     $settings = DevblocksPlatform::getPluginSettingsService();
     $settings->set('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM, $default_reply_address);
     $settings->set('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL, $default_reply_personal);
     $settings->set('cerberusweb.core', CerberusSettings::DEFAULT_SIGNATURE, $default_signature);
     $settings->set('cerberusweb.core', CerberusSettings::DEFAULT_SIGNATURE_POS, $default_signature_pos);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_HOST, $smtp_host);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_PORT, $smtp_port);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_AUTH_ENABLED, $smtp_auth_enabled);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_AUTH_USER, $smtp_auth_user);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_AUTH_PASS, $smtp_auth_pass);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_ENCRYPTION_TYPE, $smtp_enc);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_TIMEOUT, !empty($smtp_timeout) ? $smtp_timeout : 30);
     $settings->set('cerberusweb.core', CerberusSettings::SMTP_MAX_SENDS, !empty($smtp_max_sends) ? $smtp_max_sends : 20);
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config', 'mail', 'outgoing', 'test')));
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:45,代码来源:config.php

示例6: getInstance

 /**
  * @return array
  */
 public static function getInstance()
 {
     $settings = DevblocksPlatform::getPluginSettingsService();
     $license = $settings->get('cerberusweb.core', CerberusSettings::LICENSE, array());
     if (!empty($license)) {
         @($license = unserialize($license));
     }
     if (!is_array($license)) {
         $license = array();
     }
     return $license;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:15,代码来源:Application.class.php

示例7: handleRequest

 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;
 }
开发者ID:rmiddle,项目名称:feg,代码行数:88,代码来源:Update.php

示例8: handleRequest

 function handleRequest(DevblocksHttpRequest $request)
 {
     $worker = CerberusApplication::getActiveWorker();
     if (empty($worker)) {
         return;
     }
     $stack = $request->path;
     array_shift($stack);
     // print
     @($object = strtolower(array_shift($stack)));
     // ticket|message|etc
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $settings = DevblocksPlatform::getPluginSettingsService();
     $tpl->assign('settings', $settings);
     $translate = DevblocksPlatform::getTranslationService();
     $tpl->assign('translate', $translate);
     $teams = DAO_Group::getAll();
     $tpl->assign('teams', $teams);
     $buckets = DAO_Bucket::getAll();
     $tpl->assign('buckets', $buckets);
     $workers = DAO_Worker::getAll();
     $tpl->assign('workers', $workers);
     // Security
     $active_worker = CerberusApplication::getActiveWorker();
     $active_worker_memberships = $active_worker->getMemberships();
     // [TODO] Make this pluggable
     // Subcontroller
     switch ($object) {
         case 'ticket':
             @($id = array_shift($stack));
             @($ticket = is_numeric($id) ? DAO_Ticket::getTicket($id) : DAO_Ticket::getTicketByMask($id));
             $convo_timeline = array();
             $messages = $ticket->getMessages();
             foreach ($messages as $message_id => $message) {
                 /* @var $message CerberusMessage */
                 $key = $message->created_date . '_m' . $message_id;
                 // build a chrono index of messages
                 $convo_timeline[$key] = array('m', $message_id);
             }
             @($mail_inline_comments = DAO_WorkerPref::get($active_worker->id, 'mail_inline_comments', 1));
             if ($mail_inline_comments) {
                 // if inline comments are enabled
                 $comments = DAO_TicketComment::getByTicketId($ticket->id);
                 arsort($comments);
                 $tpl->assign('comments', $comments);
                 // build a chrono index of comments
                 foreach ($comments as $comment_id => $comment) {
                     /* @var $comment Model_TicketComment */
                     $key = $comment->created . '_c' . $comment_id;
                     $convo_timeline[$key] = array('c', $comment_id);
                 }
             }
             ksort($convo_timeline);
             $tpl->assign('convo_timeline', $convo_timeline);
             // Comment parent addresses
             $comment_addresses = array();
             foreach ($comments as $comment) {
                 /* @var $comment Model_TicketComment */
                 $address_id = intval($comment->address_id);
                 if (!isset($comment_addresses[$address_id])) {
                     $address = DAO_Address::get($address_id);
                     $comment_addresses[$address_id] = $address;
                 }
             }
             $tpl->assign('comment_addresses', $comment_addresses);
             // Message Notes
             $notes = DAO_MessageNote::getByTicketId($ticket->id);
             $message_notes = array();
             // Index notes by message id
             if (is_array($notes)) {
                 foreach ($notes as $note) {
                     if (!isset($message_notes[$note->message_id])) {
                         $message_notes[$note->message_id] = array();
                     }
                     $message_notes[$note->message_id][$note->id] = $note;
                 }
             }
             $tpl->assign('message_notes', $message_notes);
             // Make sure we're allowed to view this ticket or message
             if (!isset($active_worker_memberships[$ticket->team_id])) {
                 echo "<H1>" . $translate->_('common.access_denied') . "</H1>";
                 return;
             }
             $tpl->assign('ticket', $ticket);
             $tpl->display('file:' . $this->_TPL_PATH . 'print/ticket.tpl');
             break;
         case 'message':
             @($id = array_shift($stack));
             @($message = DAO_Ticket::getMessage($id));
             @($ticket = DAO_Ticket::getTicket($message->ticket_id));
             // Make sure we're allowed to view this ticket or message
             if (!isset($active_worker_memberships[$ticket->team_id])) {
                 echo "<H1>" . $translate->_('common.access_denied') . "</H1>";
                 return;
             }
             // Message Notes
             $notes = DAO_MessageNote::getByTicketId($ticket->id);
             $message_notes = array();
             // Index notes by message id
//.........这里部分代码省略.........
开发者ID:Hildy,项目名称:cerb5,代码行数:101,代码来源:print.php

示例9: handleRequest

 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;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:80,代码来源:Update.php

示例10: sendMail

 static function sendMail($to, $subject, $body, $from_addy = null, $from_personal = null)
 {
     try {
         $mail_service = DevblocksPlatform::getMailService();
         $mailer = $mail_service->getMailer(FegMail::getMailerDefaults());
         $mail = $mail_service->createMessage();
         $settings = DevblocksPlatform::getPluginSettingsService();
         if (empty($from_addy)) {
             @($from_addy = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM, $_SERVER['SERVER_ADMIN']));
         }
         if (empty($from_personal)) {
             @($from_personal = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL, ''));
         }
         $mail->setTo($to);
         $mail->setFrom(array($from_addy => $from_personal));
         $mail->setSubject($subject);
         $mail->generateId();
         $headers = $mail->getHeaders();
         $headers->addTextHeader('X-Mailer', 'Feg (Build ' . APP_BUILD . ')');
         $mail->setBody($body);
         // [TODO] Report when the message wasn't sent.
         if (!$mailer->send($mail)) {
             return false;
         }
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
开发者ID:rmiddle,项目名称:feg,代码行数:29,代码来源:Application.class.php

示例11: _sendConfirmation

 private function _sendConfirmation($email, $link)
 {
     $settings = DevblocksPlatform::getPluginSettingsService();
     $from = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM);
     $from_personal = $settings->get('cerberusweb.core', 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_Address::IS_REGISTERED => 0, DAO_Address::PASS => $code);
             DAO_Address::update($addy->id, $fields);
         } else {
             return;
         }
         $message = $mail_service->createMessage();
         $message->setTo(array($email));
         $message->setFrom(array($from => $from_personal));
         $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));
         $headers = $mail->getHeaders();
         $headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
         $result = $mailer->send($message);
     } catch (Exception $e) {
         return;
     }
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:28,代码来源:App.php

示例12: doRecoverStep1Action

 function doRecoverStep1Action()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string'));
     $worker = DAO_Worker::lookupAgentEmail($email);
     if (empty($email) || empty($worker)) {
         return;
     }
     $_SESSION[self::KEY_FORGOT_EMAIL] = $email;
     try {
         $mail_service = DevblocksPlatform::getMailService();
         $mailer = $mail_service->getMailer(CerberusMail::getMailerDefaults());
         $mail = $mail_service->createMessage();
         $code = CerberusApplication::generatePassword(10);
         $_SESSION[self::KEY_FORGOT_SENTCODE] = $code;
         $settings = DevblocksPlatform::getPluginSettingsService();
         $from = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_FROM);
         $personal = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_REPLY_PERSONAL);
         // Headers
         $mail->setTo(array($email));
         $mail->setFrom(array($from => $personal));
         $mail->setSubject($translate->_('signin.forgot.mail.subject'));
         $mail->generateId();
         $headers = $mail->getHeaders();
         $headers->addTextHeader('X-Mailer', 'Cerberus Helpdesk (Build ' . APP_BUILD . ')');
         $mail->setBody(vsprintf($translate->_('signin.forgot.mail.body'), $code));
         if (!$mailer->send($mail)) {
             throw new Exception('Password Forgot confirmation email failed to send.');
         }
     } catch (Exception $e) {
         DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step1', 'failed')));
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:34,代码来源:login.php

示例13: doReplyAction

 function doReplyAction()
 {
     @($mask = DevblocksPlatform::importGPC($_REQUEST['mask'], 'string', ''));
     @($content = DevblocksPlatform::importGPC($_REQUEST['content'], 'string', ''));
     $umsession = UmPortalHelper::getSession();
     $active_user = $umsession->getProperty('sc_login', null);
     // Secure retrieval (address + mask)
     list($tickets) = DAO_Ticket::search(array(), array(new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_MASK, '=', $mask), new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_FIRST_WROTE_ID, '=', $active_user->id)), 1, 0, null, null, false);
     $ticket = array_shift($tickets);
     $messages = DAO_Ticket::getMessagesByTicket($ticket[SearchFields_Ticket::TICKET_ID]);
     $last_message = array_pop($messages);
     /* @var $last_message CerberusMessage */
     $last_message_headers = $last_message->getHeaders();
     unset($messages);
     // Helpdesk settings
     $settings = DevblocksPlatform::getPluginSettingsService();
     $global_from = $settings->get('cerberusweb.core', 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'] = date('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])));
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:35,代码来源:history.php

示例14: writeResponse

 public function writeResponse(DevblocksHttpResponse $response)
 {
     /* @var $response DevblocksHttpResponse */
     $path = $response->path;
     $uri_prefix = array_shift($path);
     // should be mobile
     // [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
     //	    if(empty($path))
     //			return;
     $tpl = DevblocksPlatform::getTemplateService();
     $session = DevblocksPlatform::getSessionService();
     $settings = DevblocksPlatform::getPluginSettingsService();
     $translate = DevblocksPlatform::getTranslationService();
     $visit = $session->getVisit();
     $controller = array_shift($path);
     $pages = DevblocksPlatform::getExtensions('cerberusweb.mobile.page', true);
     // Default page [TODO] This is supposed to come from framework.config.php
     if (empty($controller)) {
         $controller = 'tickets';
     }
     // [JAS]: Require us to always be logged in for Cerberus pages
     // [TODO] This should probably consult with the page itself for ::authenticated()
     if (empty($visit)) {
         $controller = 'login';
     }
     $page_id = $this->_getPageIdByUri($controller);
     /* @var $page CerberusPageExtension */
     @($page = $pages[$page_id]);
     if (empty($page)) {
         return;
     }
     // 404
     // [TODO] Reimplement
     if (!empty($visit) && !is_null($visit->getWorker())) {
         DAO_Worker::logActivity($visit->getWorker()->id, $page->getActivity());
     }
     // [JAS]: Listeners (Step-by-step guided tour, etc.)
     $listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
     foreach ($listenerManifests as $listenerManifest) {
         /* @var $listenerManifest DevblocksExtensionManifest */
         $inst = $listenerManifest->createInstance();
         /* @var $inst DevblocksHttpRequestListenerExtension */
         $inst->run($response, $tpl);
     }
     // [JAS]: Pre-translate any dynamic strings
     $common_translated = array();
     if (!empty($visit) && !is_null($visit->getWorker())) {
         $common_translated['header_signed_in'] = vsprintf($translate->_('header.signed_in'), array('<b>' . $visit->getWorker()->getName() . '</b>'));
     }
     $tpl->assign('common_translated', $common_translated);
     //        $tour_enabled = false;
     //		if(!empty($visit) && !is_null($visit->getWorker())) {
     //        	$worker = $visit->getWorker();
     //			$tour_enabled = DAO_WorkerPref::get($worker->id, 'assist_mode');
     //			$tour_enabled = ($tour_enabled===false) ? 1 : $tour_enabled;
     //			if(DEMO_MODE) $tour_enabled = 1; // override for DEMO
     //		}
     //		$tpl->assign('tour_enabled', $tour_enabled);
     // [JAS]: Variables provided to all page templates
     $tpl->assign('settings', $settings);
     $tpl->assign('session', $_SESSION);
     $tpl->assign('translate', $translate);
     $tpl->assign('visit', $visit);
     $tpl->assign('license', CerberusLicense::getInstance());
     $active_worker = CerberusApplication::getActiveWorker();
     $tpl->assign('active_worker', $active_worker);
     if (!empty($active_worker)) {
         $active_worker_memberships = $active_worker->getMemberships();
         $tpl->assign('active_worker_memberships', $active_worker_memberships);
     }
     $tpl->assign('pages', $pages);
     $tpl->assign('page', $page);
     $tpl->assign('response_uri', implode('/', $response->path));
     $tpl_path = APP_PATH . '/features/cerberusweb.mobile/templates/';
     $tpl->assign('core_tpl', APP_PATH . '/features/cerberusweb.core/templates/');
     // Timings
     $tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
     if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
         $tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
         $tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
     }
     $tpl->display($tpl_path . 'border.tpl');
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:83,代码来源:classes.php

示例15: replyAction

 function replyAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($is_forward = DevblocksPlatform::importGPC($_REQUEST['forward'], 'integer', 0));
     $settings = DevblocksPlatform::getPluginSettingsService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $tpl->assign('id', $id);
     $tpl->assign('is_forward', $is_forward);
     $message = DAO_Ticket::getMessage($id);
     $tpl->assign('message', $message);
     $ticket = DAO_Ticket::getTicket($message->ticket_id);
     $tpl->assign('ticket', $ticket);
     // ReplyToolbarItem Extensions
     $replyToolbarItems = DevblocksPlatform::getExtensions('cerberusweb.reply.toolbaritem', true);
     if (!empty($replyToolbarItems)) {
         $tpl->assign('reply_toolbaritems', $replyToolbarItems);
     }
     // Show attachments for forwarded messages
     if ($is_forward) {
         $forward_attachments = $message->getAttachments();
         $tpl->assign('forward_attachments', $forward_attachments);
     }
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     $teams = DAO_Group::getAll();
     $tpl->assign('teams', $teams);
     $team_categories = DAO_Bucket::getTeams();
     $tpl->assign('team_categories', $team_categories);
     @($ticket_team = $teams[$ticket->team_id]);
     if (null != ($worker = CerberusApplication::getActiveWorker())) {
         /* @var $worker CerberusWorker */
         /* [JAS]:
          * If the worker is replying to an unassigned ticket, assign it to them to warn
          * other workers.  By default the 'next worker' followup propery will revert back 
          * to 'anybody' when desired.
          * 
          * We're intentionally not telling the template about the new owner.
          */
         if (0 == $ticket->next_worker_id) {
             DAO_Ticket::updateTicket($ticket->id, array(DAO_Ticket::NEXT_WORKER_ID => $worker->id));
         }
         // Signatures
         if (!empty($ticket_team) && !empty($ticket_team->signature)) {
             $signature = $ticket_team->signature;
         } else {
             // [TODO] Default signature
             $signature = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_SIGNATURE);
         }
         $tpl->assign('signature', str_replace(array('#first_name#', '#last_name#', '#title#'), array($worker->first_name, $worker->last_name, $worker->title), $signature));
         $signature_pos = $settings->get('cerberusweb.core', CerberusSettings::DEFAULT_SIGNATURE_POS, 0);
         $tpl->assign('signature_pos', $signature_pos);
     }
     $tpl->assign('upload_max_filesize', ini_get('upload_max_filesize'));
     $kb_topics = DAO_KbCategory::getWhere(sprintf("%s = %d", DAO_KbCategory::PARENT_ID, 0));
     $tpl->assign('kb_topics', $kb_topics);
     $tpl->display('file:' . $this->_TPL_PATH . 'display/rpc/reply.tpl');
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:58,代码来源:display.php


注:本文中的DevblocksPlatform::getPluginSettingsService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。