Пример #1
0
 function render()
 {
     $active_worker = FegApplication::getActiveWorker();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->tpl_path);
     $response = DevblocksPlatform::getHttpResponse();
     $stack = $response->path;
     array_shift($stack);
     // reports
     @($reportId = array_shift($stack));
     $report = null;
     // We're given a specific report to display
     if (!empty($reportId)) {
         if (null != ($reportMft = DevblocksPlatform::getExtension($reportId))) {
             // Make sure we have a report group
             if (null == ($report_group_mft_id = $reportMft->params['report_group'])) {
                 return;
             }
             // Make sure the report group exists
             if (null == ($report_group_mft = DevblocksPlatform::getExtension($report_group_mft_id))) {
                 return;
             }
             // Check our permissions on the parent report group before rendering the report
             if (isset($report_group_mft->params['acl']) && !$active_worker->hasPriv($report_group_mft->params['acl'])) {
                 return;
             }
             // Render
             if (null != ($report = $reportMft->createInstance()) && $report instanceof Extension_Report) {
                 /* @var $report Extension_Report */
                 $report->render();
                 return;
             }
         }
     }
     // If we don't have a selected report yet
     if (empty($report)) {
         // Organize into report groups
         $report_groups = array();
         $reportGroupMfts = DevblocksPlatform::getExtensions('feg.report.group', false);
         // [TODO] Alphabetize groups and nested reports
         // Load report groups
         if (!empty($reportGroupMfts)) {
             foreach ($reportGroupMfts as $reportGroupMft) {
                 $report_groups[$reportGroupMft->id] = array('manifest' => $reportGroupMft, 'reports' => array());
             }
         }
         $reportMfts = DevblocksPlatform::getExtensions('feg.report', false);
         // Load reports and file them under groups according to manifest
         if (!empty($reportMfts)) {
             foreach ($reportMfts as $reportMft) {
                 $report_group = $reportMft->params['report_group'];
                 if (isset($report_group)) {
                     $report_groups[$report_group]['reports'][] = $reportMft;
                 }
             }
         }
         $tpl->assign('report_groups', $report_groups);
     }
     $tpl->display('file:' . $this->tpl_path . '/reports/index.tpl');
 }
Пример #2
0
 function isVisible()
 {
     // check login
     $visit = FegApplication::getVisit();
     if (empty($visit)) {
         return false;
     } else {
         return true;
     }
 }
Пример #3
0
 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');
 }
Пример #4
0
 function run(DevblocksHttpResponse $response, Smarty $tpl)
 {
     $path = $response->path;
     $callouts = FegApplication::getTourCallouts();
     switch (array_shift($path)) {
         case 'welcome':
             $tour = array('title' => 'Welcome!', 'body' => "This assistant will help you become familiar with the application by following along and providing information about the current page.  You may follow the 'Points of Interest' links highlighted below to read tips about nearby functionality.", 'callouts' => array($callouts['tourHeaderMenu']));
             break;
         case NULL:
         case "preferences":
             $tour = array('title' => 'Preferences', 'body' => 'This screen allows you to change the personal preferences on your account.');
             break;
         case "setup":
             $tour = array('title' => 'Setup', 'body' => '...');
             break;
         case "stats":
             $tour = array('title' => 'Stats', 'body' => '...');
             break;
     }
     if (!empty($tour)) {
         $tpl->assign('tour', $tour);
     }
 }
Пример #5
0
 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;
 }
Пример #6
0
 function saveLicensesAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $settings = DevblocksPlatform::getPluginSettingsService();
     $worker = FegApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     @($name = DevblocksPlatform::importGPC($_POST['company_name'], 'string', ''));
     @($serial = DevblocksPlatform::importGPC($_POST['company_serial'], 'string', ''));
     @($email = DevblocksPlatform::importGPC($_POST['email'], 'string', ''));
     @($do_delete = DevblocksPlatform::importGPC($_POST['do_delete'], 'integer', 0));
     if (!empty($do_delete)) {
         $settings->set('feg.core', FegSettings::LICENSE, '');
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings')));
         return;
     }
     if (empty($name) || empty($serial) || empty($email)) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'empty')));
         return;
     }
     if (null == ($valid = FegLicense::validate($name, $serial, $email)) || 5 != count($valid)) {
         DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings', 'invalid')));
         return;
     }
     /*
      * [IMPORTANT -- Yes, this is simply a line in the sand.]
      * You're welcome to modify the code to meet your needs, but please respect 
      * our licensing.  Buy a legitimate copy to help support the project!
      * http://feg.answernet.com/
      */
     $license = $valid;
     $settings->set('feg.core', FegSettings::LICENSE, serialize($license));
     DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('setup', 'settings')));
 }
Пример #7
0
 private static function _save()
 {
     // persist
     $visit = FegApplication::getVisit();
     $visit->set(self::VISIT_ABSTRACTVIEWS, self::$views);
 }
Пример #8
0
 public function writeResponse(DevblocksHttpResponse $response)
 {
     $path = $response->path;
     // [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();
     $active_worker = FegApplication::getActiveWorker();
     $visit = $session->getVisit();
     $page_manifests = $this->_getAllowedPages();
     $controller = array_shift($path);
     // Default page [TODO] This is supposed to come from framework.config.php
     if (empty($controller)) {
         $controller = 'preferences';
     }
     // [JAS]: Require us to always be logged in for Feg pages
     if (empty($visit) && 0 != strcasecmp($controller, 'login')) {
         $query = array();
         if (!empty($response->path)) {
             $query = array('url' => urlencode(implode('/', $response->path)));
         }
         DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query));
     }
     $page_id = $this->_getPageIdByUri($controller);
     @($page = DevblocksPlatform::getExtension($page_id, true));
     /* @var $page FegPageExtension */
     if (empty($page)) {
         header("Status: 404");
         return;
         // [TODO] 404
     }
     // [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);
     }
     $tpl->assign('active_worker', $active_worker);
     $tour_enabled = false;
     if (!empty($visit) && !is_null($active_worker)) {
         $tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
         $keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1));
         $tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
         //	    	$active_worker_memberships = $active_worker->getMemberships();
         //	    	$tpl->assign('active_worker_memberships', $active_worker_memberships);
         $unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id);
         $tpl->assign('active_worker_notify_count', $unread_notifications);
         DAO_Worker::logActivity($active_worker->id, $page->getActivity());
     }
     $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', FegLicense::getInstance());
     $tpl->assign('page_manifests', $page_manifests);
     $tpl->assign('page', $page);
     $tpl->assign('response_uri', implode('/', $response->path));
     $core_tpl = APP_PATH . '/features/feg.core/templates/';
     $tpl->assign('core_tpl', $core_tpl);
     // Prebody Renderers
     $preBodyRenderers = DevblocksPlatform::getExtensions('feg.renderer.prebody', true);
     if (!empty($preBodyRenderers)) {
         $tpl->assign('prebody_renderers', $preBodyRenderers);
     }
     // Postbody Renderers
     $postBodyRenderers = DevblocksPlatform::getExtensions('feg.renderer.postbody', true);
     if (!empty($postBodyRenderers)) {
         $tpl->assign('postbody_renderers', $postBodyRenderers);
     }
     // 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($core_tpl . 'border.tpl');
     //		$cache = DevblocksPlatform::getCacheService();
     //		$cache->printStatistics();
 }
Пример #9
0
 static function shouldLoadExtension(DevblocksExtensionManifest $extension_manifest)
 {
     // Always allow core
     if ("feg.core" == $extension_manifest->plugin_id) {
         return true;
     }
     // [TODO] This should limit to just things we can run with no session
     // Community Tools, Cron/Update.  They are still limited by their own
     // isVisible() otherwise.
     if (null == ($active_worker = FegApplication::getActiveWorker())) {
         return true;
     }
     // [TODO] ACL
     //return $active_worker->hasPriv('plugin.'.$extension_manifest->plugin_id);
     return true;
 }
Пример #10
0
             /* @var $plugin DevblocksPluginManifest */
             switch ($plugin->id) {
                 case 'devblocks.core':
                 case 'feg.core':
                 case 'feg.auditlog':
                     $plugin->setEnabled(true);
                     break;
                 default:
                     $plugin->setEnabled(false);
                     break;
             }
         }
     }
     // Platform + App
     try {
         FegApplication::update();
         // Reload plugin translations
         DAO_Translation::reloadPluginStrings();
         // Success
         $tpl->assign('step', STEP_CONTACT);
         $tpl->display('steps/redirect.tpl');
         exit;
         // [TODO] Verify the database
     } catch (Exception $e) {
         $tpl->assign('error', $e->getMessage());
         $tpl->assign('template', 'steps/step_init_db.tpl');
         exit;
     }
 } else {
     // upgrade / patch
     /*
Пример #11
0
 function showTab()
 {
     $visit = FegApplication::getVisit();
     /* @var $visit CerberusVisit */
     $translate = DevblocksPlatform::getTranslationService();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->tpl_path);
     @($customer_id = DevblocksPlatform::importGPC($_REQUEST['customer_id'], 'integer', 0));
     $tpl->assign('customer_id', $customer_id);
     $defaults = new Feg_AbstractViewModel();
     $defaults->class_name = 'View_MessageAuditLog';
     $defaults->id = 'customer_audit_log';
     $defaults->renderLimit = 15;
     $defaults->view_columns = array(SearchFields_MessageAuditLog::CHANGE_DATE, SearchFields_MessageAuditLog::RECIPIENT_ID, SearchFields_MessageAuditLog::MESSAGE_ID, SearchFields_MessageAuditLog::MESSAGE_RECIPIENT_ID, SearchFields_MessageAuditLog::WORKER_ID, SearchFields_MessageAuditLog::CHANGE_FIELD, SearchFields_MessageAuditLog::CHANGE_VALUE);
     $defaults->renderSortBy = SearchFields_MessageAuditLog::CHANGE_DATE;
     $defaults->renderSortAsc = false;
     $defaults->params = array();
     $defaults->renderPage = 0;
     $view = Feg_AbstractViewLoader::getView($defaults->id, $defaults);
     $view->name = 'Customer Audit Log';
     $view->renderTemplate = 'default';
     $view->params = array(SearchFields_MessageAuditLog::ACCOUNT_ID => new DevblocksSearchCriteria(SearchFields_MessageAuditLog::ACCOUNT_ID, DevblocksSearchCriteria::OPER_EQ, $customer_id));
     $view->renderPage = 0;
     Feg_AbstractViewLoader::setView($view->id, $view);
     $tpl->assign('view', $view);
     $tpl->display('file:' . $this->tpl_path . '/display/log/index.tpl');
 }
Пример #12
0
 function createNewCustomerAction()
 {
     $active_worker = FegApplication::getActiveWorker();
     @($account_number = DevblocksPlatform::importGPC($_REQUEST['account_name'], 'string', ''));
     @($message_id = DevblocksPlatform::importGPC($_REQUEST['message_id'], 'integer', 0));
     if (!$active_worker->hasPriv('core.access.customer.create')) {
         return;
     }
     if (empty($account_number)) {
         $fields = array(DAO_CustomerAccount::IMPORT_SOURCE => 0, DAO_CustomerAccount::ACCOUNT_NAME => "", DAO_CustomerAccount::ACCOUNT_NUMBER => "", DAO_CustomerAccount::IS_DISABLED => 1);
     } else {
         $fields = array(DAO_CustomerAccount::IMPORT_SOURCE => 0, DAO_CustomerAccount::ACCOUNT_NAME => "Customer # " . $account_number, DAO_CustomerAccount::ACCOUNT_NUMBER => $account_number, DAO_CustomerAccount::IS_DISABLED => 1);
     }
     // Create a new Customer Recipients
     $account_id = DAO_CustomerAccount::create($fields);
     if ($message_id > 0) {
         ImportCron::importAccountReProcessMessage($message_id, $account_id);
     }
     //		DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('customer', $customer_id,'property')));
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('customer', $account_id, 'property')));
 }
Пример #13
0
 function doNotificationsMarkReadAction()
 {
     $worker = FegApplication::getActiveWorker();
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     @($row_ids = DevblocksPlatform::importGPC($_REQUEST['row_id'], 'array', array()));
     if (is_array($row_ids) && !empty($row_ids)) {
         DAO_WorkerEvent::updateWhere(array(DAO_WorkerEvent::IS_READ => 1), sprintf("%s = %d AND %s IN (%s)", DAO_WorkerEvent::WORKER_ID, $worker->id, DAO_WorkerEvent::ID, implode(',', $row_ids)));
         DAO_WorkerEvent::clearCountCache($worker->id);
     }
     $myEventsView = Feg_AbstractViewLoader::getView($view_id);
     $myEventsView->render();
 }
Пример #14
0
 function showAccountFormatFailurePeekAction()
 {
     $active_worker = FegApplication::getActiveWorker();
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'integer', 0));
     @($view_id = DevblocksPlatform::importGPC($_REQUEST['view_id'], 'string', ''));
     $tpl->assign('id', $id);
     $tpl->assign('view_id', $view_id);
     $message = DAO_Message::get($id);
     $tpl->assign('message', $message);
     @($message_lines = explode('\\n', substr($message->message, 1, -1)));
     $tpl->assign('message_lines', $message_lines);
     $tpl->display('file:' . $this->_TPL_PATH . 'stats/message/failed_format.tpl');
 }
Пример #15
0
 function doRecoverStep1Action()
 {
     $translate = DevblocksPlatform::getTranslationService();
     @($email = DevblocksPlatform::importGPC($_REQUEST['email'], 'string'));
     $worker = null;
     $results = DAO_Worker::getWhere(sprintf("%s = %s", DAO_Worker::EMAIL, Feg_ORMHelper::qstr($email)));
     if (!empty($results)) {
         $worker = array_shift($results);
     }
     if (empty($email) || empty($worker)) {
         return;
     }
     $_SESSION[self::KEY_FORGOT_EMAIL] = $email;
     try {
         $code = FegApplication::generatePassword(10);
         $_SESSION[self::KEY_FORGOT_SENTCODE] = $code;
         $to = $email;
         $subject = $translate->_('login.forgot.mail.subject');
         $body = vsprintf($translate->_('login.forgot.mail.body'), $code);
         FegMail::quickSend($to, $subject, $body);
     } catch (Exception $e) {
         DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step1', 'failed')));
     }
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('login', 'forgot', 'step2')));
 }
Пример #16
0
 function showCalloutAction()
 {
     @($id = DevblocksPlatform::importGPC($_REQUEST['id'], 'string'));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $callouts = FegApplication::getTourCallouts();
     $callout = array();
     if (isset($callouts[$id])) {
         $callout = $callouts[$id];
     }
     $tpl->assign('callout', $callout);
     $tpl->display('file:' . $this->_TPL_PATH . 'internal/tour/callout.tpl');
 }
Пример #17
0
 function saveAddLanguagePanelAction()
 {
     $active_worker = FegApplication::getActiveWorker();
     // Make sure we're an active worker
     if (empty($active_worker) || empty($active_worker->id)) {
         return;
     }
     $codes = DAO_Translation::getDefinedLangCodes();
     @($add_lang_code = DevblocksPlatform::importGPC($_REQUEST['add_lang_code'], 'string', ''));
     @($copy_lang_code = DevblocksPlatform::importGPC($_REQUEST['copy_lang_code'], 'string', ''));
     @($del_lang_ids = DevblocksPlatform::importGPC($_REQUEST['del_lang_ids'], 'array', array()));
     if (!empty($del_lang_ids)) {
         if (is_array($del_lang_ids)) {
             foreach ($del_lang_ids as $lang_id) {
                 DAO_Translation::deleteByLangCodes($lang_id);
             }
         }
     }
     // Don't add blanks or the same language twice.
     if (!empty($add_lang_code) && !isset($codes[$add_lang_code])) {
         // English reference strings (to know our scope)
         $english_strings = DAO_Translation::getMapByLang('en_US');
         $copy_strings = array();
         // If we have a desired source language for defaults, load it.
         if (!empty($copy_lang_code)) {
             if (0 == strcasecmp('en_US', $copy_lang_code)) {
                 $copy_strings = $english_strings;
             } else {
                 $copy_strings = DAO_Translation::getMapByLang($copy_lang_code);
             }
         }
         // Loop through English strings for new language
         if (is_array($english_strings)) {
             foreach ($english_strings as $string_id => $src_en) {
                 /* @var $src_en Model_Translation */
                 $override = '';
                 // If we have a valid source, copy its override or its default (in that order)
                 @($copy_string = $copy_strings[$string_id]);
                 if (is_a($copy_string, 'Model_Translation')) {
                     $override = !empty($copy_string->string_override) ? $copy_string->string_override : $copy_string->string_default;
                 }
                 // Insert the new string as an override.  Only official translations are defaults
                 $fields = array(DAO_Translation::STRING_ID => $string_id, DAO_Translation::LANG_CODE => $add_lang_code, DAO_Translation::STRING_DEFAULT => '', DAO_Translation::STRING_OVERRIDE => $override);
                 DAO_Translation::create($fields);
             }
         }
     }
     // If we added a new language then change the view to display it
     if (!empty($add_lang_code)) {
         $defaults = new Feg_AbstractViewModel();
         $defaults->class_name = 'Feg_TranslationView';
         $defaults->id = Feg_TranslationView::DEFAULT_ID;
         // Clear the existing view
         $view = Feg_AbstractViewLoader::getView(Feg_TranslationView::DEFAULT_ID, $defaults);
         $view->doResetCriteria();
         // Set search to untranslated strings that aren't English
         $view->renderSortBy = SearchFields_Translation::STRING_ID;
         $view->renderSortAsc = true;
         $view->params = array(SearchFields_Translation::LANG_CODE => new DevblocksSearchCriteria(SearchFields_Translation::LANG_CODE, DevblocksSearchCriteria::OPER_EQ, $add_lang_code));
         /*
          * If we didn't copy from another language, only show empty strings 
          * which makes it easier to translate in the GUI.
          */
         if (empty($copy_lang_code)) {
             $view->params[SearchFields_Translation::STRING_OVERRIDE] = new DevblocksSearchCriteria(SearchFields_Translation::STRING_OVERRIDE, DevblocksSearchCriteria::OPER_EQ, '');
         }
         Feg_AbstractViewLoader::setView($view->id, $view);
     }
     self::_clearCache();
     DevblocksPlatform::redirect(new DevblocksHttpResponse(array('setup', 'translations')));
 }
Пример #18
0
require getcwd() . '/framework.config.php';
require DEVBLOCKS_PATH . 'Devblocks.class.php';
require APP_PATH . '/api/Application.class.php';
header("Content-type: text/html; charset=" . LANG_CHARSET_CODE);
$request = DevblocksPlatform::readRequest();
DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('UM_DevblocksExtensionDelegate');
$session = DevblocksPlatform::getSessionService();
$settings = DevblocksPlatform::getPluginSettingsService();
$worker = FegApplication::getActiveWorker();
// Localization
DevblocksPlatform::setLocale(isset($_SESSION['locale']) && !empty($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US');
if (isset($_SESSION['timezone'])) {
    @date_default_timezone_set($_SESSION['timezone']);
}
$tpl = DevblocksPlatform::getTemplateService();
$tpl->assign('translate', DevblocksPlatform::getTranslationService());
$tpl->assign('session', $_SESSION);
$tpl->assign('visit', $session->getVisit());
$tpl->assign('active_worker', $worker);
$tpl->assign('settings', $settings);
$tpl->assign('core_tpl', APP_PATH . '/features/feg.core/templates/');
if (!empty($worker)) {
    //	$active_worker_memberships = $worker->getMemberships();
    //	$tpl->assign('active_worker_memberships', $active_worker_memberships);
    //	$keyboard_shortcuts = intval(DAO_WorkerPref::get($worker->id,'keyboard_shortcuts', 1));
    //	$tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
}
FegApplication::processRequest($request, true);
exit;
Пример #19
0
    header('Location: ' . dirname($_SERVER['PHP_SELF']) . '/install/index.php');
    // [TODO] change this to a meta redirect
    exit;
}
require APP_PATH . '/api/Application.class.php';
DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('UM_DevblocksExtensionDelegate');
// Request
$request = DevblocksPlatform::readRequest();
// Patches (if not on the patch page)
if (@0 != strcasecmp(@$request->path[0], "update") && !DevblocksPlatform::versionConsistencyCheck()) {
    DevblocksPlatform::redirect(new DevblocksHttpResponse(array('update', 'locked')));
}
//DevblocksPlatform::readPlugins();
$session = DevblocksPlatform::getSessionService();
// Localization
DevblocksPlatform::setLocale(isset($_SESSION['locale']) && !empty($_SESSION['locale']) ? $_SESSION['locale'] : 'en_US');
if (isset($_SESSION['timezone'])) {
    @date_default_timezone_set($_SESSION['timezone']);
}
// Initialize Logging
if (method_exists('DevblocksPlatform', 'getConsoleLog')) {
    $timeout = ini_get('max_execution_time');
    $logger = DevblocksPlatform::getConsoleLog();
    $logger->info("[Devblocks] ** Platform starting (" . date("r") . ") **");
    $logger->info('[Devblocks] Time Limit: ' . ($timeout ? $timeout : 'unlimited') . " secs");
    $logger->info('[Devblocks] Memory Limit: ' . ini_get('memory_limit'));
}
// [JAS]: HTTP Request (App->Platform)
FegApplication::processRequest($request);
exit;