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


PHP DevblocksPlatform::parseCsvString方法代码示例

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


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

示例1: run

 function run(Model_Alert $alert, $sensors)
 {
     @($to = DevblocksPlatform::parseCsvString($alert->actions[self::EXTENSION_ID]['to']));
     @($template_subject = $alert->actions[self::EXTENSION_ID]['template_subject']);
     @($template_body = $alert->actions[self::EXTENSION_ID]['template_body']);
     $logger = DevblocksPlatform::getConsoleLog();
     // Assign template variables
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->clear_all_assign();
     $tpl->assign('alert', $alert);
     $tpl->assign('sensors', $sensors);
     $tpl->assign('num_sensors', count($sensors));
     // Build template
     $tpl_builder = DevblocksPlatform::getTemplateBuilder();
     $errors = array();
     // Subject
     if (false == ($subject = $tpl_builder->build($template_subject))) {
         $errors += $tpl_builder->getErrors();
     }
     // Body
     if (false == ($body = $tpl_builder->build($template_body))) {
         $errors += $tpl_builder->getErrors();
     }
     if (!empty($errors)) {
         $logger->err(sprintf("Errors in mail template (skipping): %s", implode("<br>\r\n", $errors)));
         return false;
     }
     if (is_array($to)) {
         foreach ($to as $address) {
             $logger->info(sprintf("Sending mail to %s about %d sensors", $address, count($sensors)));
             PortSensorMail::quickSend($address, $subject, $body);
         }
     }
 }
开发者ID:jstanden,项目名称:portsensor,代码行数:34,代码来源:plugin.classes.php

示例2: run

 function run(Model_Alert $alert, $sensors)
 {
     @($to = DevblocksPlatform::parseCsvString($alert->actions[self::EXTENSION_ID]['to']));
     @($template_msg = $alert->actions[self::EXTENSION_ID]['template_msg']);
     $result = true;
     $logger = DevblocksPlatform::getConsoleLog();
     $settings = DevblocksPlatform::getPluginSettingsService();
     // Assign template variables
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->clear_all_assign();
     $tpl->assign('alert', $alert);
     $tpl->assign('sensors', $sensors);
     $tpl->assign('num_sensors', count($sensors));
     // Build template
     $tpl_builder = DevblocksPlatform::getTemplateBuilder();
     $errors = array();
     // Body
     if (false == ($text = $tpl_builder->build($template_msg))) {
         $errors += $tpl_builder->getErrors();
     }
     if (!empty($errors)) {
         $logger->err(sprintf("Errors in SMS template (skipping): %s", implode("<br>\r\n", $errors)));
         return false;
     }
     // Truncate message to 155 chars
     if (155 <= strlen($text)) {
         $text = substr($text, 0, 152) . '...';
     }
     // Clickatell SMS gateways
     $user = $settings->get('portsensor.sms', 'clickatell_username', '');
     $password = $settings->get('portsensor.sms', 'clickatell_password', '');
     $api_id = $settings->get('portsensor.sms', 'clickatell_api_id', '');
     if (empty($user) || empty($password) || empty($api_id)) {
         return;
     }
     if (is_array($to)) {
         foreach ($to as $phone) {
             $logger->info(sprintf("Sending SMS to %s about %d sensors", $phone, count($sensors)));
             $url = sprintf("http://api.clickatell.com/http/sendmsg?user=%s&password=%s&api_id=%s&to=%s&text=%s", urlencode($user), urlencode($password), urlencode($api_id), urlencode($phone), urlencode($text));
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_HEADER, 0);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
             $out = curl_exec($ch);
             curl_close($ch);
             $result = 0 == strcasecmp("ID:", substr($out, 0, 3));
         }
     }
     return $result;
 }
开发者ID:jstanden,项目名称:portsensor,代码行数:51,代码来源:Plugin.php

示例3: showTab

 function showTab()
 {
     @($ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'], 'integer', 0));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('path', $tpl_path);
     $ticket = DAO_Ticket::getTicket($ticket_id);
     $tpl->assign('ticket_id', $ticket_id);
     $tpl->assign('ticket', $ticket);
     // Receate the original spam decision
     $words = DevblocksPlatform::parseCsvString($ticket->interesting_words);
     $words = DAO_Bayes::lookupWordIds($words);
     // Calculate word probabilities
     foreach ($words as $idx => $word) {
         /* @var $word CerberusBayesWord */
         $word->probability = CerberusBayes::calculateWordProbability($word);
     }
     $tpl->assign('words', $words);
     // Determine what the spam probability would be if the decision was made right now
     $analysis = CerberusBayes::calculateTicketSpamProbability($ticket_id, true);
     $tpl->assign('analysis', $analysis);
     $tpl->display('file:' . $tpl_path . 'ticket_tab/index.tpl');
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:23,代码来源:App.php

示例4: doArticlesBulkUpdateAction

 function doArticlesBulkUpdateAction()
 {
     // Checked rows
     @($ids_str = DevblocksPlatform::importGPC($_REQUEST['ids'], 'string'));
     $ids = DevblocksPlatform::parseCsvString($ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView($view_id);
     $do = array();
     // Categories
     @($category_ids = DevblocksPlatform::importGPC($_REQUEST['category_ids'], 'array', array()));
     if (is_array($category_ids)) {
         $do['category_delta'] = array();
         foreach ($category_ids as $cat_id) {
             @($cat_mode = DevblocksPlatform::importGPC($_REQUEST['category_ids_' . $cat_id], 'string', ''));
             if (!empty($cat_mode)) {
                 $do['category_delta'][] = $cat_mode . $cat_id;
             }
         }
     }
     // Feedback fields
     //		@$list_id = trim(DevblocksPlatform::importGPC($_POST['list_id'],'integer',0));
     // Do: List
     //		if(0 != strlen($list_id))
     //			$do['list_id'] = $list_id;
     // Do: Custom fields
     //		$do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $ids);
     $view->render();
     return;
 }
开发者ID:rmiddle,项目名称:cerb4,代码行数:33,代码来源:App.php

示例5: 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

示例6: doTaskBulkUpdateAction

 function doTaskBulkUpdateAction()
 {
     // Checked rows
     @($ids_str = DevblocksPlatform::importGPC($_REQUEST['ids'], 'string'));
     $ids = DevblocksPlatform::parseCsvString($ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView('', $view_id);
     // Task fields
     $due = trim(DevblocksPlatform::importGPC($_POST['due'], 'string', ''));
     $status = trim(DevblocksPlatform::importGPC($_POST['status'], 'string', ''));
     $worker_id = trim(DevblocksPlatform::importGPC($_POST['worker_id'], 'string', ''));
     $do = array();
     // Do: Due
     if (0 != strlen($due)) {
         $do['due'] = $due;
     }
     // Do: Status
     if (0 != strlen($status)) {
         $do['status'] = $status;
     }
     // Do: Worker
     if (0 != strlen($worker_id)) {
         $do['worker_id'] = $worker_id;
     }
     // Do: Custom fields
     $do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $ids);
     $view->render();
     return;
 }
开发者ID:joegeck,项目名称:cerb4,代码行数:33,代码来源:tasks.php

示例7: doBulkUpdateAction

 function doBulkUpdateAction()
 {
     // Checked rows
     @($ids_str = DevblocksPlatform::importGPC($_REQUEST['ids'], 'string'));
     $ids = DevblocksPlatform::parseCsvString($ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView($view_id);
     // Feedback fields
     //		@$list_id = trim(DevblocksPlatform::importGPC($_POST['list_id'],'integer',0));
     $do = array();
     // Do: List
     //		if(0 != strlen($list_id))
     //			$do['list_id'] = $list_id;
     // Do: Custom fields
     $do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $ids);
     $view->render();
     return;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:22,代码来源:App.php

示例8: writeResponse

 public function writeResponse(DevblocksHttpResponse $response)
 {
     $umsession = UmPortalHelper::getSession();
     $stack = $response->path;
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('portal_code', UmPortalHelper::getCode());
     $page_title = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_PAGE_TITLE, 'Support Center');
     $tpl->assign('page_title', $page_title);
     $login_handler = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_LOGIN_HANDLER, '');
     $tpl->assign('login_handler', $login_handler);
     $login_extension = DevblocksPlatform::getExtension($login_handler, true);
     $tpl->assign('login_extension', $login_extension);
     @($visible_modules = unserialize(DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_VISIBLE_MODULES, '')));
     $tpl->assign('visible_modules', $visible_modules);
     @($active_user = $umsession->getProperty('sc_login', null));
     $tpl->assign('active_user', $active_user);
     // Usermeet Session
     if (null == ($fingerprint = UmPortalHelper::getFingerprint())) {
         die("A problem occurred.");
     }
     $tpl->assign('fingerprint', $fingerprint);
     $module_uri = array_shift($stack);
     switch ($module_uri) {
         case 'ajax':
             $controller = new UmScAjaxController(null);
             $controller->handleRequest(new DevblocksHttpRequest($stack));
             break;
         case 'rss':
             $controller = new UmScRssController(null);
             $controller->handleRequest(new DevblocksHttpRequest($stack));
             break;
         case 'captcha':
             @($color = DevblocksPlatform::parseCsvString(DevblocksPlatform::importGPC($_REQUEST['color'], 'string', '40,40,40')));
             @($bgcolor = DevblocksPlatform::parseCsvString(DevblocksPlatform::importGPC($_REQUEST['bgcolor'], 'string', '240,240,240')));
             // Sanitize colors
             // [TODO] Sanitize numeric range for elements 0-2
             if (3 != count($color)) {
                 $color = array(40, 40, 40);
             }
             if (3 != count($bgcolor)) {
                 $color = array(240, 240, 240);
             }
             header('Cache-control: max-age=0', true);
             // 1 wk // , must-revalidate
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 604800) . ' GMT');
             // 1 wk
             header('Content-type: image/jpeg');
             // Get CAPTCHA secret passphrase
             $phrase = CerberusApplication::generatePassword(4);
             $umsession->setProperty(UmScApp::SESSION_CAPTCHA, $phrase);
             $im = @imagecreate(150, 70) or die("Cannot Initialize new GD image stream");
             $background_color = imagecolorallocate($im, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
             $text_color = imagecolorallocate($im, $color[0], $color[1], $color[2]);
             $font = DEVBLOCKS_PATH . 'resources/font/ryanlerch_-_Tuffy_Bold(2).ttf';
             imagettftext($im, 24, mt_rand(0, 20), 5, 60 + 6, $text_color, $font, $phrase);
             imagejpeg($im, null, 85);
             imagedestroy($im);
             exit;
             break;
         case 'captcha.check':
             $entered = DevblocksPlatform::importGPC($_REQUEST['captcha'], 'string', '');
             $captcha = $umsession->getProperty(UmScApp::SESSION_CAPTCHA, '');
             if (!empty($entered) && !empty($captcha) && 0 == strcasecmp($entered, $captcha)) {
                 echo 'true';
                 exit;
             }
             echo 'false';
             exit;
             break;
         default:
             // Build the menu
             $modules = $this->_getModules();
             $menu_modules = array();
             if (is_array($modules)) {
                 foreach ($modules as $uri => $module) {
                     // Must be menu renderable
                     if (!empty($module->manifest->params['menu_title']) && !empty($uri)) {
                         $menu_modules[$uri] = $module;
                     }
                 }
             }
             $tpl->assign('menu', $menu_modules);
             // Modules
             if (isset($modules[$module_uri])) {
                 $controller = $modules[$module_uri];
             } else {
                 // First menu item
                 $controller = reset($menu_modules);
             }
             array_unshift($stack, $module_uri);
             $tpl->assign('module', $controller);
             $tpl->assign('module_response', new DevblocksHttpResponse($stack));
             $tpl->display('devblocks:usermeet.core:support_center/index.tpl:portal_' . UmPortalHelper::getCode());
             break;
     }
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:97,代码来源:UmScApp.php

示例9: configure

 /**
  * @param $instance Model_CommunityTool 
  */
 public function configure(Model_CommunityTool $instance)
 {
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl_path = dirname(dirname(__FILE__)) . '/templates/';
     $tpl->assign('config_path', $tpl_path);
     $logo_url = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_LOGO_URL, '');
     $tpl->assign('logo_url', $logo_url);
     $page_title = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_PAGE_TITLE, 'Support Center');
     $tpl->assign('page_title', $page_title);
     $style_css = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_STYLE_CSS, '');
     $tpl->assign('style_css', $style_css);
     $footer_html = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_FOOTER_HTML, '');
     $tpl->assign('footer_html', $footer_html);
     $allow_logins = DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_ALLOW_LOGINS, 0);
     $tpl->assign('allow_logins', $allow_logins);
     $enabled_modules = DevblocksPlatform::parseCsvString(DAO_CommunityToolProperty::get(UmPortalHelper::getCode(), self::PARAM_ENABLED_MODULES, array()));
     $tpl->assign('enabled_modules', $enabled_modules);
     $all_modules = DevblocksPlatform::getExtensions('usermeet.sc.controller', true, true);
     $modules = array();
     // Sort the enabled modules first, in order.
     if (is_array($enabled_modules)) {
         foreach ($enabled_modules as $module_id) {
             if (!isset($all_modules[$module_id])) {
                 continue;
             }
             $module = $all_modules[$module_id];
             $modules[$module_id] = $module;
             unset($all_modules[$module_id]);
         }
     }
     // Append the unused modules
     if (is_array($all_modules)) {
         foreach ($all_modules as $module_id => $module) {
             $modules[$module_id] = $module;
             $modules = array_merge($modules, $all_modules);
         }
     }
     $tpl->assign('modules', $modules);
     $tpl->display("file:{$tpl_path}portal/sc/config/index.tpl");
 }
开发者ID:jsjohnst,项目名称:cerb4,代码行数:43,代码来源:UmScApp.php

示例10: getInstance

 /**
  * @return _DevblocksCacheManager
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new _DevblocksCacheManager();
         $options = array('key_prefix' => defined('DEVBLOCKS_CACHE_PREFIX') && DEVBLOCKS_CACHE_PREFIX ? DEVBLOCKS_CACHE_PREFIX : null);
         // Shared-memory cache
         if ((extension_loaded('memcache') || extension_loaded('memcached')) && defined('DEVBLOCKS_MEMCACHED_SERVERS') && DEVBLOCKS_MEMCACHED_SERVERS) {
             $pairs = DevblocksPlatform::parseCsvString(DEVBLOCKS_MEMCACHED_SERVERS);
             $servers = array();
             if (is_array($pairs) && !empty($pairs)) {
                 foreach ($pairs as $server) {
                     list($host, $port) = explode(':', $server);
                     if (empty($host) || empty($port)) {
                         continue;
                     }
                     $servers[] = array('host' => $host, 'port' => $port);
                 }
             }
             $options['servers'] = $servers;
             self::$_cacher = new _DevblocksCacheManagerMemcached($options);
         }
         // Disk-based cache (default)
         if (null == self::$_cacher) {
             $options['cache_dir'] = APP_TEMP_PATH;
             self::$_cacher = new _DevblocksCacheManagerDisk($options);
         }
     }
     return self::$instance;
 }
开发者ID:jstanden,项目名称:devblocks,代码行数:32,代码来源:Devblocks.class.php

示例11: doWatcherBulkPanelAction

 function doWatcherBulkPanelAction()
 {
     // Checked rows
     @($ids_str = DevblocksPlatform::importGPC($_REQUEST['ids'], 'string'));
     $ids = DevblocksPlatform::parseCsvString($ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView($view_id);
     // Watcher fields
     @($status = trim(DevblocksPlatform::importGPC($_POST['do_status'], 'string', '')));
     $do = array();
     // Do: ...
     if (0 != strlen($status)) {
         $do['status'] = intval($status);
     }
     // Do: Custom fields
     //$do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $ids);
     $view->render();
     return;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:23,代码来源:App.php

示例12: sendMailProperties

 static function sendMailProperties($properties)
 {
     $status = true;
     @($toStr = $properties['to']);
     @($cc = $properties['cc']);
     @($bcc = $properties['bcc']);
     @($subject = $properties['subject']);
     @($content = $properties['content']);
     @($files = $properties['files']);
     $mail_settings = self::getMailerDefaults();
     if (empty($properties['from_addy'])) {
         @($from_addy = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_FROM, $_SERVER['SERVER_ADMIN']));
     }
     if (empty($properties['from_personal'])) {
         @($from_personal = $settings->get('feg.core', FegSettings::DEFAULT_REPLY_PERSONAL, ''));
     }
     if (empty($subject)) {
         $subject = '(no subject)';
     }
     // [JAS]: Replace any semi-colons with commas (people like using either)
     $toList = DevblocksPlatform::parseCsvString(str_replace(';', ',', $toStr));
     $mail_headers = array();
     $mail_headers['X-FegCompose'] = '1';
     // Headers needed for the ticket message
     $log_headers = new Swift_Message_Headers();
     $log_headers->setCharset(LANG_CHARSET_CODE);
     $log_headers->set('To', $toList);
     $log_headers->set('From', !empty($from_personal) ? sprintf("%s <%s>", $from_personal, $from_addy) : sprintf('%s', $from_addy));
     $log_headers->set('Subject', $subject);
     $log_headers->set('Date', date('r'));
     foreach ($log_headers->getList() as $hdr => $v) {
         if (null != ($hdr_val = $log_headers->getEncoded($hdr))) {
             if (!empty($hdr_val)) {
                 $mail_headers[$hdr] = $hdr_val;
             }
         }
     }
     try {
         $mail_service = DevblocksPlatform::getMailService();
         $mailer = $mail_service->getMailer(FegMail::getMailerDefaults());
         $email = $mail_service->createMessage();
         $email->setTo($toList);
         // cc
         $ccs = array();
         if (!empty($cc) && null != ($ccList = DevblocksPlatform::parseCsvString(str_replace(';', ',', $cc)))) {
             $email->setCc($ccList);
         }
         // bcc
         if (!empty($bcc) && null != ($bccList = DevblocksPlatform::parseCsvString(str_replace(';', ',', $bcc)))) {
             $email->setBcc($bccList);
         }
         $email->setFrom(array($from => $personal));
         $email->setSubject($subject);
         $email->generateId();
         $headers = $email->getHeaders();
         $headers->addTextHeader('X-Mailer', 'Fax Email Gateway (FEG) ' . APP_VERSION . ' (Build ' . APP_BUILD . ')');
         $email->setBody($content);
         // Mime Attachments
         if (is_array($files) && !empty($files)) {
             foreach ($files['tmp_name'] as $idx => $file) {
                 if (empty($file) || empty($files['name'][$idx])) {
                     continue;
                 }
                 $email->attach(Swift_Attachment::fromPath($file)->setFilename($files['name'][$idx]));
             }
         }
         // Headers
         foreach ($email->getHeaders()->getAll() as $hdr) {
             if (null != ($hdr_val = $hdr->getFieldBody())) {
                 if (!empty($hdr_val)) {
                     $mail_headers[$hdr->getFieldName()] = $hdr_val;
                 }
             }
         }
         // [TODO] Allow separated addresses (parseRfcAddress)
         //		$mailer->log->enable();
         if (!@$mailer->send($email)) {
             throw new Exception('Mail failed to send: unknown reason');
         }
         //		$mailer->log->dump();
     } catch (Exception $e) {
         // Do Something
         $status = false;
     }
     // Give plugins a chance to note a message is imported.
     $eventMgr = DevblocksPlatform::getEventService();
     $eventMgr->trigger(new Model_DevblocksEvent('email.send', array('properties' => $properties, 'send_status' => $status ? 2 : 1)));
     return $status;
 }
开发者ID:rmiddle,项目名称:feg,代码行数:89,代码来源:Application.class.php

示例13: doOppBulkUpdateAction

 function doOppBulkUpdateAction()
 {
     // Checked rows
     @($opp_ids_str = DevblocksPlatform::importGPC($_REQUEST['opp_ids'], 'string'));
     $opp_ids = DevblocksPlatform::parseCsvString($opp_ids_str);
     // Filter: whole list or check
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     // View
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView('', $view_id);
     // Opp fields
     @($status = trim(DevblocksPlatform::importGPC($_POST['status'], 'string', '')));
     @($closed_date = trim(DevblocksPlatform::importGPC($_POST['closed_date'], 'string', '')));
     @($worker_id = trim(DevblocksPlatform::importGPC($_POST['worker_id'], 'string', '')));
     $do = array();
     // Do: Status
     if (0 != strlen($status)) {
         $do['status'] = $status;
     }
     // Do: Closed Date
     if (0 != strlen($closed_date)) {
         @($do['closed_date'] = intval(strtotime($closed_date)));
     }
     // Do: Worker
     if (0 != strlen($worker_id)) {
         $do['worker_id'] = $worker_id;
     }
     // Do: Custom fields
     $do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, $do, $opp_ids);
     $view->render();
     return;
 }
开发者ID:joegeck,项目名称:cerb4,代码行数:33,代码来源:App.php

示例14: array_flip

// ,'mysql'
$tables = $datadict->MetaTables();
$tables = array_flip($tables);
// ===========================================================================
// Convert the module format
$sql = "SELECT tool_code, property_value FROM community_tool_property WHERE property_key = 'common.enabled_modules'";
$rs = $db->Execute($sql);
while (!$rs->EOF) {
    $tool_code = $rs->Fields('tool_code');
    $property_value = $rs->Fields('property_value');
    // Check the deprecated login bits
    $login_contact = $db->GetOne(sprintf("SELECT property_value FROM community_tool_property WHERE property_key = 'contact.require_login' AND tool_code = %s AND property_value='1'", $db->qstr($tool_code)));
    $login_kb = $db->GetOne(sprintf("SELECT property_value FROM community_tool_property WHERE property_key = 'contact.require_kb' AND tool_code = %s AND property_value='1'", $db->qstr($tool_code)));
    // Change the format
    $modules = array();
    $mods = DevblocksPlatform::parseCsvString($property_value);
    if (is_array($mods)) {
        foreach ($mods as $mod) {
            switch ($mod) {
                case 'sc.controller.contact':
                    $modules[$mod] = !empty($login_contact) ? 1 : 0;
                    break;
                case 'sc.controller.kb':
                    $modules[$mod] = !empty($login_kb) ? 1 : 0;
                    break;
                case 'sc.controller.history':
                case 'sc.controller.account':
                    $modules[$mod] = '1';
                    // default to require login
                    break;
                default:
开发者ID:rmiddle,项目名称:cerb4,代码行数:31,代码来源:4.3.0.php

示例15: doBatchUpdateAction

 function doBatchUpdateAction()
 {
     @($ticket_id_str = DevblocksPlatform::importGPC($_REQUEST['ticket_ids'], 'string'));
     @($shortcut_name = DevblocksPlatform::importGPC($_REQUEST['shortcut_name'], 'string', ''));
     @($filter = DevblocksPlatform::importGPC($_REQUEST['filter'], 'string', ''));
     @($senders = DevblocksPlatform::importGPC($_REQUEST['senders'], 'string', ''));
     @($subjects = DevblocksPlatform::importGPC($_REQUEST['subjects'], 'string', ''));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string'));
     $view = C4_AbstractViewLoader::getView($view_id);
     $subjects = DevblocksPlatform::parseCrlfString($subjects);
     $senders = DevblocksPlatform::parseCrlfString($senders);
     $do = array();
     // [TODO] This logic is repeated in several places -- try to condense (like custom field form handlers)
     // Move to Group/Bucket
     @($move_code = DevblocksPlatform::importGPC($_REQUEST['do_move'], 'string', null));
     if (0 != strlen($move_code)) {
         list($g_id, $b_id) = CerberusApplication::translateTeamCategoryCode($move_code);
         $do['move'] = array('group_id' => intval($g_id), 'bucket_id' => intval($b_id));
     }
     // Assign to worker
     @($worker_id = DevblocksPlatform::importGPC($_REQUEST['do_assign'], 'string', null));
     if (0 != strlen($worker_id)) {
         $do['assign'] = array('worker_id' => intval($worker_id));
     }
     // Spam training
     @($is_spam = DevblocksPlatform::importGPC($_REQUEST['do_spam'], 'string', null));
     if (0 != strlen($is_spam)) {
         $do['spam'] = array('is_spam' => !$is_spam ? 0 : 1);
     }
     // Set status
     @($status = DevblocksPlatform::importGPC($_REQUEST['do_status'], 'string', null));
     if (0 != strlen($status)) {
         $do['status'] = array('is_waiting' => 3 == $status ? 1 : 0, 'is_closed' => 0 == $status || 3 == $status ? 0 : 1, 'is_deleted' => 2 == $status ? 1 : 0);
     }
     $data = array();
     $ticket_ids = array();
     if ($filter == 'sender') {
         $data = $senders;
     } elseif ($filter == 'subject') {
         $data = $subjects;
     } elseif ($filter == 'checks') {
         $filter = '';
         // bulk update just looks for $ticket_ids == !null
         $ticket_ids = DevblocksPlatform::parseCsvString($ticket_id_str);
     }
     // Restrict to current worker groups
     $active_worker = CerberusApplication::getActiveWorker();
     $memberships = $active_worker->getMemberships();
     $view->params['tmp'] = new DevblocksSearchCriteria(SearchFields_Ticket::TICKET_TEAM_ID, 'in', array_keys($memberships));
     // Do: Custom fields
     $do = DAO_CustomFieldValue::handleBulkPost($do);
     $view->doBulkUpdate($filter, '', $data, $do, $ticket_ids);
     // Clear our temporary group restriction before re-rendering
     unset($view->params['tmp']);
     $view->render();
     return;
 }
开发者ID:Hildy,项目名称:cerb5,代码行数:57,代码来源:tickets.php


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