aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Tools.class.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-09-20 04:36:35 -0700
committerNicolas LÅ“uillet <nicolas.loeuillet@gmail.com>2013-09-20 04:36:35 -0700
commit79026b73a804d1fe3715c3edf5bc2cfb1e56732c (patch)
tree225136afe844ad0b1c3fef443fcea86fe54384e5 /inc/poche/Tools.class.php
parentc51be6b697da573cdcf0788eb8617130ce5517a4 (diff)
parent6a6c1c1172f3c6167d360a2322335ea91e94a3ff (diff)
downloadwallabag-1.0-beta5.tar.gz
wallabag-1.0-beta5.tar.zst
wallabag-1.0-beta5.zip
Merge pull request #226 from inthepoche/dev1.0-beta5
beta5
Diffstat (limited to 'inc/poche/Tools.class.php')
-rw-r--r--inc/poche/Tools.class.php41
1 files changed, 18 insertions, 23 deletions
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 3a792d43..8eb988f4 100644
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -84,9 +84,9 @@ class Tools
84 84
85 public static function getTplFile($view) 85 public static function getTplFile($view)
86 { 86 {
87 $tpl_file = 'home.twig'; 87 $default_tpl = 'home.twig';
88 switch ($view) 88
89 { 89 switch ($view) {
90 case 'install': 90 case 'install':
91 $tpl_file = 'install.twig'; 91 $tpl_file = 'install.twig';
92 break; 92 break;
@@ -102,9 +102,20 @@ class Tools
102 case 'view': 102 case 'view':
103 $tpl_file = 'view.twig'; 103 $tpl_file = 'view.twig';
104 break; 104 break;
105
106 case 'login':
107 $tpl_file = 'login.twig';
108 break;
109
110 case 'error':
111 $tpl_file = 'error.twig';
112 break;
113
105 default: 114 default:
106 break; 115 $tpl_file = $default_tpl;
116 break;
107 } 117 }
118
108 return $tpl_file; 119 return $tpl_file;
109 } 120 }
110 121
@@ -228,24 +239,8 @@ class Tools
228 return $minutes; 239 return $minutes;
229 } 240 }
230 241
231 242 public static function getDocLanguage($userlanguage) {
232 public static function createMyConfig() 243 $lang = explode('.', $userlanguage);
233 { 244 return str_replace('_', '-', $lang[0]);
234 $myconfig_file = './inc/poche/myconfig.inc.php';
235
236 if (!is_writable('./inc/poche/')) {
237 self::logm('you don\'t have write access to create ./inc/poche/myconfig.inc.php');
238 die('You don\'t have write access to create ./inc/poche/myconfig.inc.php.');
239 }
240
241 if (!file_exists($myconfig_file))
242 {
243 $fp = fopen($myconfig_file, 'w');
244 fwrite($fp, '<?php'."\r\n");
245 fwrite($fp, "define ('POCHE_VERSION', '1.0-beta4');" . "\r\n");
246 fwrite($fp, "define ('SALT', '" . md5(time() . $_SERVER['SCRIPT_FILENAME'] . rand()) . "');" . "\r\n");
247 fwrite($fp, "define ('LANG', 'en_EN.utf8');" . "\r\n");
248 fclose($fp);
249 }
250 } 245 }
251} \ No newline at end of file 246} \ No newline at end of file