-
Notifications
You must be signed in to change notification settings - Fork 70
/
add_memdays.php
76 lines (75 loc) · 3.02 KB
/
add_memdays.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
set_time_limit(0);
require_once('config.inc.php');
require_once('include/utils/utils.php');
require_once('include/database/PearDatabase.php');
require('copydirr.inc.php');
require('modules/Memdays/MemdaysDataPopulator.php');
global $root_directory;
global $adb;
///
if(isset($_SESSION['authenticated_user_language']) && $_SESSION['authenticated_user_language'] != '')
{
$current_language = $_SESSION['authenticated_user_language'];
}
else
{
$current_language = $default_language;
}
copydirr($root_directory."modules/Memdays/Smarty/templates/",$root_directory."Smarty/templates/");
//增加cache/application/language/zh_cn.lang.php中所需要的选项
$language_file_path = $root_directory."cache/application/language/".$current_language.".lang.php";
if(!is_file($language_file_path)) {
touch($language_file_path);
}
$language_file_path = $root_directory."cache/application/language/".$current_language.".lang.php";
if(!is_file($language_file_path)) {
touch($language_file_path);
}
if(is_writable($language_file_path)) {
$custom_app_strings = return_custom_application_language($current_language);
$custom_applist_strings = return_custom_app_list_strings_language($current_language);
if((is_array($custom_app_strings) && count($custom_app_strings) > 0) || (is_array($custom_applist_strings) && count($custom_applist_strings) > 0)) {
$bk = chr(10); // The sign of line break
$qo = ' '; // The sign for quote
$string = '';
$fd = fopen($language_file_path, 'w');
fwrite($fd, '<?php'.$bk);//'$mod_strings = array ('.$bk
if(is_array($custom_app_strings) && count($custom_app_strings) > 0) {
unset($custom_app_strings['Memdays']);
unset($custom_app_strings['Memday']);
foreach($custom_app_strings as $key1 => $arr){
$string .= $qo.'$app_strings[\''.$key1.'\'] = \''.$arr.'\';'.$bk;
}
}
$string .= $qo.'$app_strings[\'Memdays\'] = \'纪念日\';'.$bk;
$string .= $qo.'$app_strings[\'Memday\'] = \'纪念日\';'.$bk;
if(is_array($custom_applist_strings) && count($custom_applist_strings) > 0) {
unset($custom_applist_strings['moduleList']['Memdays']);
foreach($custom_applist_strings['moduleList'] as $key1 => $arr){
$string .= $qo.'$app_list_strings[\'moduleList\'][\''.$key1.'\'] = \''.$arr.'\';'.$bk;
}
}
$string .= $qo.'$app_list_strings[\'moduleList\'][\'Memdays\'] = \'纪念日\';'.$bk;
fwrite($fd, $string);
fwrite($fd, $bk.'?>');
fclose($fd);
} else {
$bk = chr(10); // The sign of line break
$qo = ' '; // The sign for quote
$string = '';
$fd = fopen($language_file_path, 'w');
fwrite($fd, '<?php'.$bk);//'$mod_strings = array ('.$bk
$string .= $qo.'$app_strings[\'Memdays\'] = \'纪念日\';'.$bk;
$string .= $qo.'$app_strings[\'Memday\'] = \'纪念日\';'.$bk;
$string .= $qo.'$app_list_strings[\'moduleList\'][\'Memdays\'] = \'纪念日\';'.$bk;
fwrite($fd, $string);
fwrite($fd, $bk.'?>');
fclose($fd);
}
}
$focus = new MemdaysDataPopulator();
$focus->create_tables();
$focus->create_defautdata(true);
echo "Install Memdays Module successfully!<br>";
?>