#!/usr/bin/php
<?php
+/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
+ license. */
// only execute from command line
if (!(isset ($argc)) || !(isset ($argv))) {
exit (0);
}
-$ROOTDIR="../../";
-$SCRIPTS=array("admin"); // scripts in rootdir we need to link to
+$ROOTDIR = "../../";
+// scripts in rootdir we need to link to
+$SCRIPTS = array ("admin", "index", "upgrade", "wizard");
function usage() {
global $argv;
}
function escape_newline ($str, $tab) {
- return str_replace("\n", "\\n\" .\n$tab$tab\"", $str);
+ return str_replace ("\n", "\\n\" .\n$tab$tab\"", $str);
}
function escape_slash ($str) {
- $res = str_replace("\\", "\\\\", $str);
- $res = str_replace("\"", "\\\"", $res);
+ $res = str_replace ("\\", "\\\\", $str);
+ $res = str_replace ("\"", "\\\"", $res);
return $res;
}
return $str;
}
-function updatelang($lang, $rootdir, $scripts) {
+function updatelang ($lang, $rootdir, $scripts) {
if (!preg_match ('/^[a-zA-Z]{2,3}(-[a-zA-Z]{2,3})?$/', $lang)) {
warn ("$lang is not a valid lang format.\n");
return false;
warn ("en is reference language. It must be managed manually.\n");
return false;
}
-
+
if (!is_dir ($lang)) {
if (!mkdir ($lang)) {
error ("could not create $lang directory.\n");
$tab = str_repeat (" ", 4);
$tmpname = tempnam ("", "");
- $output = fopen($tmpname, "w");
+ $output = fopen ($tmpname, "w");
fwrite ($output, "<?php\n");
error ("could not set permissions to $lang/sys.php");
return false;
}
-
+
foreach ($scripts as $script) {
$link = $rootdir . "/" . $script . "." . $lang . ".php";
$target = $script . ".php";