示例#1
0
文件: configure.php 项目: rair/yacs
    $label = i18n::s('Security salt');
    $input = '<input type="text" name="bbb_salt" id="bbb_salt" size="32" value="' . encode_field(isset($context['bbb_salt']) ? $context['bbb_salt'] : '') . '" maxlength="255" />';
    $fields[] = array($label, $input);
    // build the form
    $context['text'] .= Skin::build_form($fields);
    $fields = array();
    // bottom commands
    $menu = array();
    // the submit button
    $local['submit_en'] = 'Submit';
    $local['submit_fr'] = 'Enregistrer';
    $local['title_en'] = 'Press [s] to save data';
    $local['title_fr'] = 'Appuyer sur [s] pour enregistrer les donn&eacute;es';
    $menu[] = Skin::build_submit_button(i18n::user('submit'), i18n::user('title'), 's');
    // control panel
    $menu[] = Skin::build_link('control/', i18n::user('Control Panel'), 'span');
    // insert the menu in the page
    $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    // end of the form
    $context['text'] .= '</form>';
    // no modifications in demo mode
} elseif (file_exists($context['path_to_root'] . 'parameters/demo.flag')) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // save updated parameters
} else {
    // build the new configuration file
    $content = '<?php' . "\n" . '// This file has been created by the configuration script overlays/bbb_meetings/configure.php' . "\n" . '// on ' . gmdate("F j, Y, g:i a") . ' GMT, for ' . Surfer::get_name() . '. Please do not modify it manually.' . "\n";
    if (isset($_REQUEST['bbb_server'])) {
        $content .= '$context[\'bbb_server\']=\'' . addcslashes($_REQUEST['bbb_server'], "\\'") . "';\n";
    }
        echo i18n::user('error') . "<br />\n";
    }
    // we have something in hand
    if ($content) {
        // create missing directories where applicable
        Safe::make_path(dirname($file));
        // create backups, if possible
        if (file_exists($context['path_to_root'] . $file)) {
            Safe::unlink($context['path_to_root'] . $file . '.bak');
            Safe::rename($context['path_to_root'] . $file, $context['path_to_root'] . $file . '.bak');
        }
        // update the target file
        if (!Safe::file_put_contents($file, $content)) {
            $local['label_en'] = 'Impossible to write to the file ' . $file . '.';
            $local['label_fr'] = 'Impossible d\'&eacute;crire le fichier ' . $file . '.';
            echo i18n::user('label') . "<br />\n";
        } else {
            $local['label_en'] = 'has been updated';
            $local['label_fr'] = 'a &eacute;t&eacute; mis &agrave; jour';
            echo $file . ' ' . i18n::user('label') . "<br />\n";
        }
    }
    // next one
    $count += 1;
    Safe::set_time_limit(30);
}
// basic reporting
$local['label_en'] = 'files have been copied';
$local['label_fr'] = 'fichiers ont &eacute;t&eacute; copi&eacute;s';
echo $count . ' ' . i18n::user('label') . "<br />\n";
示例#3
0
 /**
  * format a time stamp
  *
  * Accept either a time stamp, or a formatted string as input parameter:
  * - YYYY-MM-DD HH:MM:SS
  * - YYMMDD HH:MM:SS GMT
  *
  * @param int or string the time to be displayed
  * @param string the variant -- reserved for future use
  * @param string the language to express this stamp
  * @return string the HTML to be used
  */
 public static function &build_time($stamp, $variant = NULL, $language = NULL)
 {
     global $context, $local;
     // return by reference
     $output = '';
     // sanity check
     if (!isset($stamp) || !$stamp) {
         return $output;
     }
     // surfer offset
     $surfer_offset = Surfer::get_gmt_offset();
     // YYMMDD-HH:MM:SS GMT -- this one is natively GMT
     if (preg_match('/GMT$/', $stamp) && strlen($stamp) == 19) {
         // YYMMDD-HH:MM:SS GMT -> HH, MM, SS, MM, DD, YY
         $actual_stamp = mktime(substr($stamp, 7, 2), substr($stamp, 10, 2), substr($stamp, 13, 2), substr($stamp, 2, 2), substr($stamp, 4, 2), substr($stamp, 0, 2));
         // adjust to surfer time zone
         $actual_stamp += $surfer_offset * 3600;
         // time()-like stamp
     } elseif (intval($stamp) > 1000000000) {
         // adjust to surfer time zone
         $actual_stamp = intval($stamp) + $surfer_offset * 3600;
         // YYYY-MM-DD HH:MM:SS, or a string that can be readed
     } elseif (($actual_stamp = strtotime($stamp)) != -1) {
         // adjust to surfer time zone
         $actual_stamp += $surfer_offset * 3600;
     } else {
         $output = '*' . $stamp . '*';
         return $output;
     }
     if (!($items = @getdate($actual_stamp))) {
         $output = '*' . $stamp . '*';
         return $output;
     }
     // if undefined language, use surfer language
     if (!$language) {
         $language = $context['language'];
     }
     // format the time
     $local['label_en'] = date('h:i a', $actual_stamp);
     $local['label_fr'] = date('H:i', $actual_stamp);
     $output = i18n::user('label');
     return $output;
 }
示例#4
0
文件: i18n.php 项目: rair/yacs
 function get_local($label, $language = NULL)
 {
     return i18n::user($label, $language);
 }