public function loadExtras(array &$storage, w2p_Core_CAppUI $AppUI, $m, $type = 'tabs')
 {
     //Set up extra $type
     if (!isset($storage['all_' . $type][$m])) {
         // For some reason on some systems if you don't set this up
         // first you get recursive pointers to the all_$type array, creating
         // phantom tabs.
         if (!isset($storage['all_' . $type])) {
             $storage['all_' . $type] = array();
         }
         $storage['all_' . $type][$m] = array();
         $all_items =& $storage['all_' . $type][$m];
         foreach ($AppUI->getActiveModules() as $dir => $notUsed) {
             if (!canAccess($dir)) {
                 continue;
             }
             $loader = new w2p_FileSystem_Loader();
             $modules_items = $loader->readFiles(W2P_BASE_DIR . '/modules/' . $dir . '/', '^' . $m . '_' . substr($type, 0, -1) . '.*\\.php');
             foreach ($modules_items as $item) {
                 // Get the name as the subextension
                 // cut the module_tab. and the .php parts of the filename
                 // (begining and end)
                 $nameparts = explode('.', $item);
                 $filename = substr($item, 0, -4);
                 if (count($nameparts) > 3) {
                     $file = $nameparts[1];
                     if (!isset($all_items[$file])) {
                         $all_items[$file] = array();
                     }
                     $tabArray =& $all_items[$file];
                     $name = $nameparts[2];
                 } else {
                     $tabArray =& $all_items;
                     $name = $nameparts[1];
                 }
                 $tabArray[] = array('name' => ucfirst(str_replace('_', ' ', $name)), 'file' => W2P_BASE_DIR . '/modules/' . $dir . '/' . $filename, 'module' => $dir);
             }
         }
     } else {
         $all_items =& $storage['all_' . $type][$m];
     }
 }
示例#2
0
 /**
  * Load the known language codes for loaded locales
  *
  */
 public function loadLanguages()
 {
     if (isset($_SESSION['LANGUAGES'])) {
         $LANGUAGES =& $_SESSION['LANGUAGES'];
     } else {
         $LANGUAGES = array();
         $loader = new w2p_FileSystem_Loader();
         $langs = $loader->readDirs('locales');
         foreach ($langs as $lang) {
             if (file_exists(W2P_BASE_DIR . '/locales/' . $lang . '/lang.php')) {
                 include W2P_BASE_DIR . '/locales/' . $lang . '/lang.php';
             }
         }
         $_SESSION['LANGUAGES'] =& $LANGUAGES;
     }
     return $LANGUAGES;
 }
示例#3
0
    if (strpos($redirect, 'logout') !== false) {
        $redirect = '';
    }
    if (isset($locale_char_set)) {
        header('Content-type: text/html;charset=' . $locale_char_set);
    }
    include $theme->resolveTemplate('login');
    // destroy the current session and output login page
    session_unset();
    session_destroy();
    exit;
}
$AppUI->setUserLocale();
// bring in the rest of the support and localisation files
$perms =& $AppUI->acl();
$loader = new w2p_FileSystem_Loader();
/**
 * TODO: We should validate that the module identified by $m is actually
 *   installed & active. If not, we should go back to the defaults.
 */
$def_a = 'index';
if (!isset($_GET['m']) && !empty($w2Pconfig['default_view_m'])) {
    if (!$perms->checkModule($w2Pconfig['default_view_m'], 'view', $AppUI->user_id)) {
        $m = 'public';
        $def_a = 'welcome';
    } else {
        $m = $w2Pconfig['default_view_m'];
        $def_a = !empty($w2Pconfig['default_view_a']) ? $w2Pconfig['default_view_a'] : $def_a;
        $tab = $w2Pconfig['default_view_tab'];
        $_GET['tab'] = $tab;
    }
示例#4
0
if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// @todo    remove database query
// check permissions
$perms =& $AppUI->acl();
$canEdit = canEdit('system');
$canRead = canView('system');
if (!$canRead) {
    $AppUI->redirect(ACCESS_DENIED);
}
$module = new w2p_System_Module();
$hidden_modules = array('public', 'install');
$modules = __extract_from_modules_index($hidden_modules);
// get the modules actually installed on the file system
$loader = new w2p_FileSystem_Loader();
$modFiles = $loader->readDirs('modules');
$titleBlock = new w2p_Theme_TitleBlock('Modules', 'power-management.png', $m);
$titleBlock->addCrumb('?m=system', 'System Admin');
$titleBlock->show();
$fieldList = array('mod_name', 'mod_active', 'mod_customize', 'mod_type', 'mod_version', 'mod_ui_name', 'mod_ui_icon', 'mod_ui_active', 'mod_ui_order');
$fieldNames = array('Module', 'Status', 'Customize', 'Type', 'Version', 'Menu Text', 'Menu Icon', 'Menu Status', 'Order');
$htmlHelper = new w2p_Output_HTMLHelper($AppUI);
?>

<table class="tbl list modules">
    <?php 
echo '<tr><th></th>';
foreach ($fieldNames as $index => $name) {
    echo '<th>' . $AppUI->_($fieldNames[$index]) . '</th>';
}
示例#5
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly.');
}
// check permissions
$perms =& $AppUI->acl();
if (!canEdit('system')) {
    $AppUI->redirect(ACCESS_DENIED);
}
$module = w2PgetParam($_REQUEST, 'module', 'admin');
$lang = w2PgetParam($_REQUEST, 'lang', $AppUI->user_locale);
// read the installed modules
$loader = new w2p_FileSystem_Loader();
$modules = arrayMerge($loader->readDirs('modules'), array('common' => 'common', 'styles' => 'styles'));
asort($modules);
// read the installed languages
$locales = $loader->readDirs('locales');
ob_start();
// read language files from module's locale directory preferably
$localeFile = W2P_BASE_DIR . '/modules/' . $modules[$module] . '/locales/en/' . $modules[$module] . '.inc';
if (file_exists($localeFile)) {
    readfile($localeFile);
} else {
    $localeFile = W2P_BASE_DIR . '/locales/en/' . $modules[$module] . '.inc';
    if (file_exists($localeFile)) {
        readfile($localeFile);
    }
}
eval("\$english=array(" . ob_get_contents() . "\n'0');");
ob_end_clean();
示例#6
0
<?php

if (!defined('W2P_BASE_DIR')) {
    die('You should not access this file directly');
}
ob_start();
$AppUI->user_locale = '' == $AppUI->user_locale ? 'en' : $AppUI->user_locale;
if (isset($perms)) {
    foreach ($AppUI->getActiveModules() as $dir => $module) {
        if (!canAccess($dir)) {
            continue;
        }
        $loader = new w2p_FileSystem_Loader();
        $modules_tabs_crumbs = $loader->readFiles(W2P_BASE_DIR . '/modules/' . $dir . '/', '^' . $m . '_(tab|crumb).*\\.php');
        if (count($modules_tabs_crumbs) > 0) {
            if (file_exists(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc')) {
                readfile(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc');
            } elseif (file_exists(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc')) {
                readfile(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/' . $dir . '.inc');
            } elseif (file_exists(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '.inc')) {
                readfile(W2P_BASE_DIR . '/modules/' . $dir . '/locales/' . $AppUI->user_locale . '.inc');
            }
        }
    }
}
if (W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/common.inc') {
    readfile(W2P_BASE_DIR . '/locales/' . $AppUI->user_locale . '/common.inc');
}
/**
 * language files for specific locales and specific modules (for external modules) should be put in
 *   modules/[the-module]/locales/[the-locale]/[the-module].inc or modules/[the-module]/locales/[the-locale].inc
示例#7
0
    $AppUI->redirect(ACCESS_DENIED);
}
$project_list = array('0' => $AppUI->_('All', UI_OUTPUT_RAW));
$projectObj = new CProject();
$projectList = $projectObj->getAllowedProjects($AppUI->user_id, false);
$company = new CCompany();
$companyList = $company->loadAll();
foreach ($projectList as $pr) {
    if ($pr['project_id'] == $project_id) {
        $display_project_name = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name'];
    }
    $project_list[$pr['project_id']] = '(' . $companyList[$pr['project_company']]['company_name'] . ') ' . $pr['project_name'];
}
// get the prefered date format
$df = $AppUI->getPref('SHDATEFORMAT');
$loader = new w2p_FileSystem_Loader();
$reports = $loader->readFiles(W2P_BASE_DIR . '/modules/reports/reports', '\\.php$');
// setup the title block
if (!$suppressHeaders) {
    $titleBlock = new w2p_Theme_TitleBlock('Reports', 'icon.png', $m);
    $titleBlock->addCrumb('?m=projects', 'projects list');
    if ($project_id) {
        $titleBlock->addCrumb('?m=projects&amp;a=view&amp;project_id=' . $project_id, 'view this project');
    }
    if ($report_type) {
        $titleBlock->addCrumb('?m=reports&amp;project_id=' . $project_id, 'reports index');
    }
    $titleBlock->show();
}
$report_type_var = w2PgetParam($_GET, 'report_type', '');
if (!empty($report_type_var)) {