Example #1
0
 function show($view, $loc = null, $title = '')
 {
     global $db;
     $template = new template('translatormodule', $view, $loc);
     $langs = array();
     $lloc = pathos_core_makeLocation('translatormodule');
     foreach ($db->selectObjects('translation_language') as $lang) {
         $lloc->int = $lang->id;
         $lang->permissions = array('administrate' => pathos_permissions_check('administrate', $lloc) ? 1 : 0, 'configure' => pathos_permissions_check('configure', $lloc) ? 1 : 0);
         $langs[] = $lang;
     }
     $template->assign('languages', $langs);
     $template->assign('dictionaries', translatormodule::dictionaries());
     $template->assign('moduletitle', $title);
     $template->register_permissions(array('administrate', 'configure'), $loc);
     $template->output();
 }
Example #2
0
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: view_dictionary.php,v 1.4 2005/03/13 20:40:47 filetreefrog Exp $
##################################################
if (!defined("PATHOS")) {
    exit("");
}
$lang = null;
if (isset($_GET['lang_id'])) {
    $lang = $db->selectObject('translation_language', 'id=' . $_GET['lang_id']);
}
if ($lang) {
    pathos_flow_set(SYS_FLOW_PROTECTED, SYS_FLOW_ACTION);
    $ref_constants = translatormodule::parseDictionary($_GET['type'], $_GET['name'], 'en');
    $these_constants = array();
    foreach ($db->selectObjects('translation_dictentry', "lang_id='" . $lang->id . "' AND dictionary='" . $_GET['type'] . '/' . $_GET['name'] . "'") as $entry) {
        $these_constants[$entry->constant] = $entry;
    }
    $added_constants = array_diff(array_keys($ref_constants), array_keys($these_constants));
    $removed_constants = array_diff(array_keys($these_constants), array_keys($ref_constants));
    $all_constants = array_merge(array_keys($these_constants), $added_constants);
    usort($all_constants, 'strnatcmp');
    $template = new template('translatormodule', '_viewDictionary');
    $template->assign('d_type', $_GET['type']);
    $template->assign('d_name', $_GET['name']);
    $template->assign('lang', $lang);
    $template->assign('ref_constants', $ref_constants);
    $template->assign('these_constants', $these_constants);
    $template->assign('added_constants', $added_constants);
Example #3
0
             $lang->id = $db->insertObject($lang, 'translation_language');
             // Set up an entry for later
             $entry = null;
             $entry->lang_id = $lang->id;
             $langdir = $base . $file . '/';
             $langdh = opendir($langdir);
             while (($type = readdir($langdh)) !== false) {
                 if (is_dir($langdir . $type) && $type[0] != '.' && $type != 'CVS') {
                     echo '2:' . $langdir . $type . '<br />';
                     $typedir = $langdir . $type . '/';
                     $typedh = opendir($typedir);
                     while (($dictionary = readdir($typedh)) !== false) {
                         if (substr($typedir . $dictionary, -4, 4) == '.php') {
                             $dictionary = substr($dictionary, 0, -4);
                             echo '3:' . $dictionary . '<br />';
                             $constants = translatormodule::parseDictionary($type, $dictionary, $file, $tmpdir);
                             $entry->dictionary = $type . '/' . $dictionary;
                             foreach ($constants as $constant => $value) {
                                 $entry->constant = $constant;
                                 $entry->value = $value;
                                 $db->insertObject($entry, 'translation_dictentry');
                             }
                         }
                     }
                     closedir($typedh);
                 }
             }
             closedir($langdh);
         }
     }
 }