Пример #1
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $translationParser = new TranslationParser();
     $phpRenderer = $serviceLocator->get('ViewRenderer');
     $translationParser->setView($phpRenderer);
     return $translationParser;
 }
Пример #2
0
/**
 * SolidWorks (entry point)
 *
 * This function serves as the entry point for the entire application.  It opens
 * the session, loads the Page object, processes any forms, and invokes any actions
 * for the page.
 *
 * @package SolidWorks
 * @author John Diamond <*****@*****.**>
 */
function solidworks(&$conf, $smarty)
{
    global $page;
    // Make the Page object available to smarty_extensions
    global $translations;
    // Make sure the client is logged in as a valid user before proceeding
    validate_client();
    // Load the user's language preference
    $language = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getLanguage() : null;
    if ($language != null) {
        TranslationParser::load("language/" . $language);
        Translator::getTranslator()->setActiveLanguage($language);
    }
    if ($_SESSION['currentpage'] != $_GET['page']) {
        $_SESSION['lastpage'] = $_SESSION['currentpage'];
    }
    // Get a Page object for the page being requested
    $page = null;
    $page = get_page_object($conf, $smarty);
    if ($page == null) {
        // Delete current session
        session_destroy();
        // Instantiate a generic page object
        $page = new Page();
    }
    // Make sure the client has access to this page
    if (!$page->control_access()) {
        // Access denied
        $page->setError(array("type" => "ACCESS_DENIED"));
        $page->goback(1);
    }
    // Process any forms
    if ($_SERVER['REQUEST_METHOD'] == "POST") {
        handle_post_request();
    }
    // Execute any action if present in the URL
    if (isset($_GET['action'])) {
        $page->action($_GET['action']);
    }
    // Display
    display_page($page);
    // Push page onto the navigation stack
    $_SESSION['navstack'][] = array("page" => $page->getName(), "url" => $page->getURL());
}
Пример #3
0
 /**
  * Load Modules
  */
 public function loadModules()
 {
     global $conf;
     if (!($dh = opendir($this->modulesPath))) {
         throw new SWException("Could not access the modules directory: " . $this->modulesPath);
     }
     // Read the contents of the modules directory
     while ($file = readdir($dh)) {
         $moduleName = $file;
         $moduleDir = sprintf("%s%s", $this->modulesPath, $moduleName);
         $moduleConfFile = sprintf("%s/module.conf", $moduleDir);
         $moduleClassFile = sprintf("%s/%s.class.php", $moduleDir, $moduleName);
         $moduleDefTransFile = sprintf("%s/language/english", $moduleDir);
         $moduleActTransFile = sprintf("%s/language/%s", $moduleDir, Translator::getTranslator()->getActiveLanguage());
         if (is_dir($moduleDir) && (isset($file) && $file != "." && $file != "..") && file_exists($moduleClassFile)) {
             // Load the module's config file
             if (file_exists($moduleConfFile)) {
                 $modConf = load_config_file($moduleConfFile);
                 $conf['pages'] = array_merge($conf['pages'], $modConf['pages']);
                 $conf['forms'] = array_merge($conf['forms'], $modConf['forms']);
                 $conf['hooks'] = array_merge($conf['hooks'], $modConf['hooks']);
                 // Load the module's default translation file
                 if (file_exists($moduleDefTransFile)) {
                     TranslationParser::load($moduleDefTransFile);
                 }
                 // Load the module's active translation file
                 if ($moduleDefTransFile != $moduleActTransFile && file_exists($moduleActTransFile)) {
                     TranslationParser::load($moduleActTransFile);
                 }
             }
             // Load the module's class file
             require $moduleClassFile;
             // Initialize module
             $module = new $moduleName();
             $module->init();
             $this->registerModule($module);
         }
     }
     closedir($dh);
 }
Пример #4
0
 * @copyright John Diamond <*****@*****.**>
 * @license http://www.opensource.org/licenses/gpl-license.php GNU Public License
 */
// Load config file
require_once dirname(__FILE__) . "/../config/config.inc.php";
// Load SolidWorks
require_once dirname(__FILE__) . "/../solidworks/solidworks.php";
// Load settings from database
require_once dirname(__FILE__) . "/../util/settings.php";
load_settings($conf);
require_once dirname(__FILE__) . "/../include/SolidStateMenu.class.php";
// Set the current theme
$theme = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getTheme() : $conf['themes']['manager'];
$conf['themes']['current'] = $theme;
// Load the user's language preference
session_start();
$language = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getLanguage() : null;
if ($language != null) {
    TranslationParser::load("language/" . $language);
    Translator::getTranslator()->setActiveLanguage($language);
}
// Change the charset to UTF-8
header("Content-type: text/html; charset=utf-8");
// Build the core menu
$menu = SolidStateMenu::getSolidStateMenu();
$username = isset($_SESSION['client']['userdbo']) ? $_SESSION['client']['userdbo']->getUsername() : null;
$menu->addItem(new SolidStateMenuItem("myinfo", "[MY_INFO]", "vcard_edit.png", "manager_content.php?page=config_edit_user&user="******"administration");
$menuItems = $menu->getItemArray();
$smarty->assign("menuItems", $menuItems);
// Display menu
$smarty->display(Page::selectTemplateFile("manager_menu.tpl"));
Пример #5
0
/**
 * Load Settings
 *
 * Load the application settings from the database
 *
 * @param array $conf Configuration data
 */
function load_settings(&$conf)
{
    $DB = DBConnection::getDBConnection();
    // Build Query
    $sql = $DB->build_select_sql("settings", "*");
    // Run Query
    if (!($result = @mysql_query($sql, $DB->handle()))) {
        throw new DBException(mysql_error($DB->handle()));
    }
    while ($setting = mysql_fetch_array($result)) {
        $key = $setting['setting'];
        $val = $setting['value'];
        switch ($key) {
            case "company_name":
                $conf['company']['name'] = $val;
                break;
            case "company_email":
                $conf['company']['email'] = $val;
                break;
            case "company_notification_email":
                $conf['company']['notification_email'] = $val;
                break;
            case "order_confirmation_email":
                $conf['order']['confirmation_email'] = $val;
                break;
            case "order_confirmation_subject":
                $conf['order']['confirmation_subject'] = $val;
                break;
            case "order_notification_email":
                $conf['order']['notification_email'] = $val;
                break;
            case "order_notification_subject":
                $conf['order']['notification_subject'] = $val;
                break;
            case "welcome_email":
                $conf['welcome_email'] = $val;
                break;
            case "welcome_subject":
                $conf['welcome_subject'] = $val;
                break;
            case "nameservers_ns1":
                $conf['dns']['nameservers'][0] = $val;
                break;
            case "nameservers_ns2":
                $conf['dns']['nameservers'][1] = $val;
                break;
            case "nameservers_ns3":
                $conf['dns']['nameservers'][2] = $val;
                break;
            case "nameservers_ns4":
                $conf['dns']['nameservers'][3] = $val;
                break;
            case "invoice_text":
                $conf['invoice_text'] = $val;
                break;
            case "invoice_subject":
                $conf['invoice_subject'] = $val;
                break;
            case "locale_language":
                TranslationParser::load("language/" . $val);
                Translator::getTranslator()->setActiveLanguage($val);
                $conf['locale']['language'] = $val;
                break;
            case "locale_currency_symbol":
                $conf['locale']['currency_symbol'] = $val;
                break;
            case "payment_gateway_default_module":
                $conf['payment_gateway']['default_module'] = $val;
                break;
            case "payment_gateway_order_method":
                $conf['payment_gateway']['order_method'] = $val;
                break;
            case "order_accept_checks":
                $conf['order']['accept_checks'] = $val;
                break;
            case "order_title":
                $conf['order']['title'] = $val;
                break;
            case "order_tos_required":
                $conf['order']['tos_required'] = $val;
                break;
            case "order_tos_url":
                $conf['order']['tos_url'] = $val;
                break;
            case "theme_manager":
                $conf['themes']['manager'] = $val;
                break;
            case "theme_order":
                $conf['themes']['order'] = $val;
                break;
        }
    }
}