function generateScriptTags($prependedWhitespace = '')
{
    global $runningOnLive;
    global $language;
    $returnString = '';
    if ($runningOnLive) {
        $buildNumber = intval(file_get_contents('release/mc_rss-min.js_build#'));
        $returnString = $prependedWhitespace . '<script type="text/javascript" src="release/mc_rss-min.js?b=' . $buildNumber . '"></script>' . PHP_EOL;
        $languageBuildNumber = intval(file_get_contents('release/locals/' . $language . '.js_build#'));
        $returnString .= $prependedWhitespace . '<script type="text/javascript" src="release/locals/' . $language . '.js?b=' . $languageBuildNumber . '"></script>' . PHP_EOL;
    } else {
        $returnString .= $prependedWhitespace . '<!-- BEGIN GENERATED SCRIPT TAGS -->' . PHP_EOL;
        $fileList = file('src/_fileList.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        for ($i = 0; $i < count($fileList); $i++) {
            if (substr($fileList[$i], 0, 1) == ';') {
                continue;
            }
            //Ignore lines beginning with a semicolon as these are comments
            $returnString .= $prependedWhitespace . '<script type="text/javascript" src="' . str_replace("\\", '/', $fileList[$i]) . '"></script>' . PHP_EOL;
        }
        $returnString .= $prependedWhitespace . '<!-- END GENERATED SCRIPT TAGS -->' . PHP_EOL;
        $returnString .= PHP_EOL;
        $returnString .= $prependedWhitespace . '<!-- BEGIN LOCALIZATION STRINGS -->' . PHP_EOL;
        $localizationData = json_encode(localization::getLanguageStrings($language));
        $returnString .= $prependedWhitespace . '<script type="text/javascript">localizationStrings = ' . $localizationData . ';</script>' . PHP_EOL;
        $returnString .= $prependedWhitespace . '<!-- END LOCALIZATION STRINGS -->' . PHP_EOL;
    }
    return $returnString;
}
 private static function _init()
 {
     if (self::$isInitialized) {
         return;
     } else {
         self::$isInitialized = true;
     }
     $languagesFile = file(ROOT . '/php/resources/minecraft/lang/languages.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
     $output = array();
     foreach ($languagesFile as $languageLine) {
         $langArray = mb_split("=", $languageLine);
         self::$languages[$langArray[0]] = $langArray[1];
     }
 }
 public function generateLocalizationFiles()
 {
     foreach (localization::getLanguageList() as $languageCode => $languageName) {
         $file_jsFile = $this->outputPath . "/locals/" . $languageCode . ".js";
         $file_buildNumber = $file_jsFile . "_build#";
         $newContents = "localizationStrings = " . json_encode(localization::getLanguageStrings($languageCode), JSON_FORCE_OBJECT) . ";";
         $md5_existing = file_exists($file_jsFile) ? md5_file($file_jsFile) : false;
         $buildNumber = file_exists($file_buildNumber) ? file_get_contents($file_buildNumber) : 1;
         if ($md5_existing != md5($newContents) || !file_exists($file_jsFile)) {
             file_put_contents($file_buildNumber, ++$buildNumber);
             file_put_contents($file_jsFile, $newContents);
             echo "  Wrote new {$languageCode} to disk." . PHP_EOL;
         } else {
             echo "  Skipped {$languageCode} as content is unchanged." . PHP_EOL;
         }
     }
 }
Example #4
0
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_inc_config.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_core.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_excepition.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_smarty/_class_smarty.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_externals.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_localization.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_user.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/_includes/_classes/_class_snowlight.php";
session_start();
$smarty = new Smarty();
$core = new core();
$snowlight = new snowlight();
$excepition = new excepition();
$externals = new externals();
$l = new localization();
$user = new user();
$l->loadTranslationFile($_SERVER["DOCUMENT_ROOT"] . "/_includes/_languages/_" . $cms['language'] . ".xml");
$sql = @new mysqli($mysqli['server'] . ":" . $mysqli['port'], $mysqli['username'], $mysqli['password'], $mysqli['database']);
if (mysqli_connect_errno() != 0) {
    $excepition->out("critical", mysqli_connect_error());
}
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 60;
$smarty->template_dir = $_SERVER["DOCUMENT_ROOT"] . "/_templates/";
$smarty->compile_dir = $_SERVER["DOCUMENT_ROOT"] . "/_includes/_smarty/_templates_c/";
$smarty->config_dir = $_SERVER["DOCUMENT_ROOT"] . "/_includes/_smarty/_configs/";
$smarty->cache_dir = $_SERVER["DOCUMENT_ROOT"] . "/_includes/_smarty/_cache";
if (isset($_SESSION['user']['name'])) {
    $smarty->assign("USER", array("NAME" => $_SESSION['user']['name'], "PASSWORD" => $_SESSION['user']['password'], "FIGURE" => $_SESSION['user']['figure'], "MOTTO" => $_SESSION['user']['motto'], "CREDITS" => $_SESSION['user']['credits'], "PIXELS" => $_SESSION['user']['pixels'], true));
Example #5
0
					</a>
					<a href="#" class="btn btn-info" id="site-info">
						<span class="glyphicon glyphicon-user"></span>
						<span data-bind="text:current_visitors()">0</span>
					</a>
					<?php 
if (user::logged('developer')) {
    ?>
						<a href="#/super" class="btn btn-primary" title="Superadmin">
							<span class="glyphicon glyphicon-lock"></span>
						</a>
					<?php 
}
?>
					<a href="<?php 
echo URL::site(localization::get('users.urls.logout'));
?>
" data-bind="click:logout" class="btn btn-danger" title="<?php 
echo __('Log out');
?>
">
						<span class="glyphicon glyphicon-off"></span>
					</a>
				</div>
			</div>
		</div>
	</header>
	<div class="row" id="mainwrap">
		<div class="col-xs-12 col-md-2" id="sidebar">
			<ul class="nav nav-pills nav-stacked">
				<li id="navitem-welcome">
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
 * 
 */
header('Content-type: application/json; charset=UTF-8');
include_once 'includes/utf8_handling.php';
include_once 'includes/class_localization.php';
ob_start("ob_gzhandler");
if (!isset($_REQUEST["task"])) {
    $get_task = "getList";
} else {
    $get_task = $_REQUEST["task"];
}
switch ($get_task) {
    case "getLang":
        if (!isset($_REQUEST["lang"])) {
            $lang = "en_US";
        } else {
            $lang = $_REQUEST["lang"];
        }
        echo json_encode(localization::getLanguageStrings($lang));
        break;
    default:
        echo json_encode(localization::getLanguageList());
        break;
}
Example #7
0
 {
     return Auth_ORM::instance()->logged_in($role);
 }
 public static function url($uri = '', $protocol = NULL)
 {