install.php 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055
  1. <?php
  2. if (function_exists('opcache_reset')) {
  3. opcache_reset();
  4. }
  5. require('../../constants.php');
  6. define('BCRYPT_COST', 9);
  7. include(LIB_PATH . '/lib_rss.php');
  8. session_name('FreshRSS');
  9. session_set_cookie_params(0, dirname(empty($_SERVER['REQUEST_URI']) ? '/' : dirname($_SERVER['REQUEST_URI'])), null, false, true);
  10. session_start();
  11. if (isset ($_GET['step'])) {
  12. define ('STEP', $_GET['step']);
  13. } else {
  14. define ('STEP', 1);
  15. }
  16. define('SQL_CREATE_DB', 'CREATE DATABASE IF NOT EXISTS %1$s DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;');
  17. include(APP_PATH . '/sql.php');
  18. //<updates>
  19. define('SQL_SHOW_TABLES', 'SHOW tables;');
  20. define('SQL_BACKUP006', 'RENAME TABLE `%1$scategory` TO `%1$scategory006`, `%1$sfeed` TO `%1$sfeed006`, `%1$sentry` TO `%1$sentry006`;');
  21. define('SQL_SHOW_COLUMNS_UPDATEv006', 'SHOW columns FROM `%1$sentry006` LIKE "id2";');
  22. define('SQL_UPDATEv006', '
  23. ALTER TABLE `%1$scategory006` ADD id2 SMALLINT;
  24. SET @i = 0;
  25. UPDATE `%1$scategory006` SET id2=(@i:=@i+1) ORDER BY id;
  26. ALTER TABLE `%1$sfeed006` ADD id2 SMALLINT, ADD category2 SMALLINT;
  27. SET @i = 0;
  28. UPDATE `%1$sfeed006` SET id2=(@i:=@i+1) ORDER BY name;
  29. UPDATE `%1$sfeed006` f
  30. INNER JOIN `%1$scategory006` c ON f.category = c.id
  31. SET f.category2 = c.id2;
  32. INSERT IGNORE INTO `%2$scategory` (name, color)
  33. SELECT name, color
  34. FROM `%1$scategory006`
  35. ORDER BY id2;
  36. INSERT IGNORE INTO `%2$sfeed` (url, category, name, website, description, priority, pathEntries, httpAuth, keep_history)
  37. SELECT url, category2, name, website, description, priority, pathEntries, httpAuth, IF(keep_history = 1, -1, -2)
  38. FROM `%1$sfeed006`
  39. ORDER BY id2;
  40. ALTER TABLE `%1$sentry006` ADD id2 bigint;
  41. UPDATE `%1$sentry006` SET id2 = ((date * 1000000) + (rand() * 100000000));
  42. INSERT IGNORE INTO `%2$sentry` (id, guid, title, author, link, date, is_read, is_favorite, id_feed, tags)
  43. SELECT e0.id2, e0.guid, e0.title, e0.author, e0.link, e0.date, e0.is_read, e0.is_favorite, f0.id2, e0.tags
  44. FROM `%1$sentry006` e0
  45. INNER JOIN `%1$sfeed006` f0 ON e0.id_feed = f0.id;
  46. ');
  47. define('SQL_CONVERT_SELECTv006', '
  48. SELECT e0.id2, e0.content
  49. FROM `%1$sentry006` e0
  50. INNER JOIN `%2$sentry` e1 ON e0.id2 = e1.id
  51. WHERE e1.content_bin IS NULL');
  52. define('SQL_CONVERT_UPDATEv006', 'UPDATE `%1$sentry` SET content_bin=COMPRESS(?) WHERE id=?;');
  53. define('SQL_DROP_BACKUPv006', 'DROP TABLE IF EXISTS `%1$sentry006`, `%1$sfeed006`, `%1$scategory006`;');
  54. define('SQL_UPDATE_CACHED_VALUES', '
  55. UPDATE `%1$sfeed` f
  56. INNER JOIN (
  57. SELECT e.id_feed,
  58. COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbUnreads,
  59. COUNT(e.id) AS nbEntries
  60. FROM `%1$sentry` e
  61. GROUP BY e.id_feed
  62. ) x ON x.id_feed=f.id
  63. SET f.cache_nbEntries=x.nbEntries, f.cache_nbUnreads=x.nbUnreads
  64. ');
  65. define('SQL_UPDATE_HISTORYv007b', 'UPDATE `%1$sfeed` SET keep_history = CASE WHEN keep_history = 0 THEN -2 WHEN keep_history = 1 THEN -1 ELSE keep_history END;');
  66. //</updates>
  67. // gestion internationalisation
  68. $translates = array ();
  69. $actual = 'en';
  70. function initTranslate () {
  71. global $translates;
  72. global $actual;
  73. $actual = isset($_SESSION['language']) ? $_SESSION['language'] : getBetterLanguage('en');
  74. $file = APP_PATH . '/i18n/' . $actual . '.php';
  75. if (file_exists($file)) {
  76. $translates = array_merge($translates, include($file));
  77. }
  78. $file = APP_PATH . '/i18n/install.' . $actual . '.php';
  79. if (file_exists($file)) {
  80. $translates = array_merge($translates, include($file));
  81. }
  82. }
  83. function getBetterLanguage ($fallback) {
  84. $available = availableLanguages ();
  85. $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  86. $language = strtolower (substr ($accept, 0, 2));
  87. if (isset ($available[$language])) {
  88. return $language;
  89. } else {
  90. return $fallback;
  91. }
  92. }
  93. function availableLanguages () {
  94. return array (
  95. 'en' => 'English',
  96. 'fr' => 'Français'
  97. );
  98. }
  99. function _t ($key) {
  100. global $translates;
  101. $translate = $key;
  102. if (isset ($translates[$key])) {
  103. $translate = $translates[$key];
  104. }
  105. $args = func_get_args ();
  106. unset($args[0]);
  107. return vsprintf ($translate, $args);
  108. }
  109. /*** SAUVEGARDES ***/
  110. function saveLanguage () {
  111. if (!empty ($_POST)) {
  112. if (!isset ($_POST['language'])) {
  113. return false;
  114. }
  115. $_SESSION['language'] = $_POST['language'];
  116. header ('Location: index.php?step=1');
  117. }
  118. }
  119. function saveStep2 () {
  120. if (!empty ($_POST)) {
  121. if (empty ($_POST['title']) ||
  122. empty ($_POST['old_entries']) ||
  123. empty ($_POST['auth_type']) ||
  124. empty ($_POST['default_user'])) {
  125. return false;
  126. }
  127. $_SESSION['salt'] = sha1(uniqid(mt_rand(), true).implode('', stat(__FILE__)));
  128. $_SESSION['title'] = substr(trim($_POST['title']), 0, 25);
  129. $_SESSION['old_entries'] = $_POST['old_entries'];
  130. if ((!ctype_digit($_SESSION['old_entries'])) || ($_SESSION['old_entries'] < 1)) {
  131. $_SESSION['old_entries'] = 3;
  132. }
  133. $_SESSION['mail_login'] = filter_var($_POST['mail_login'], FILTER_VALIDATE_EMAIL);
  134. $_SESSION['default_user'] = substr(preg_replace('/[^a-zA-Z0-9]/', '', $_POST['default_user']), 0, 16);
  135. $_SESSION['auth_type'] = $_POST['auth_type'];
  136. if (!empty($_POST['passwordPlain'])) {
  137. if (!function_exists('password_hash')) {
  138. include_once(LIB_PATH . '/password_compat.php');
  139. }
  140. $passwordHash = password_hash($_POST['passwordPlain'], PASSWORD_BCRYPT, array('cost' => BCRYPT_COST));
  141. $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js
  142. $_SESSION['passwordHash'] = $passwordHash;
  143. }
  144. $token = '';
  145. if ($_SESSION['mail_login']) {
  146. $token = sha1($_SESSION['salt'] . $_SESSION['mail_login']);
  147. }
  148. $config_array = array (
  149. 'language' => $_SESSION['language'],
  150. 'theme' => $_SESSION['theme'],
  151. 'old_entries' => $_SESSION['old_entries'],
  152. 'mail_login' => $_SESSION['mail_login'],
  153. 'passwordHash' => $_SESSION['passwordHash'],
  154. 'token' => $token,
  155. );
  156. $configPath = DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php';
  157. @unlink($configPath); //To avoid access-rights problems
  158. file_put_contents($configPath, "<?php\n return " . var_export($config_array, true) . ';');
  159. if ($_SESSION['mail_login'] != '') {
  160. $personaFile = DATA_PATH . '/persona/' . $_SESSION['mail_login'] . '.txt';
  161. @unlink($personaFile);
  162. file_put_contents($personaFile, $_SESSION['default_user']);
  163. }
  164. header ('Location: index.php?step=3');
  165. }
  166. }
  167. function saveStep3 () {
  168. if (!empty ($_POST)) {
  169. if (empty ($_POST['type']) ||
  170. empty ($_POST['host']) ||
  171. empty ($_POST['user']) ||
  172. empty ($_POST['base'])) {
  173. $_SESSION['bd_error'] = 'Missing parameters!';
  174. }
  175. $_SESSION['bd_type'] = isset ($_POST['type']) ? $_POST['type'] : 'mysql';
  176. $_SESSION['bd_host'] = $_POST['host'];
  177. $_SESSION['bd_user'] = $_POST['user'];
  178. $_SESSION['bd_password'] = $_POST['pass'];
  179. $_SESSION['bd_base'] = substr($_POST['base'], 0, 64);
  180. $_SESSION['bd_prefix'] = substr($_POST['prefix'], 0, 16);
  181. $_SESSION['bd_prefix_user'] = $_SESSION['bd_prefix'] . (empty($_SESSION['default_user']) ? '' : ($_SESSION['default_user'] . '_'));
  182. $ini_array = array(
  183. 'general' => array(
  184. 'environment' => empty($_SESSION['environment']) ? 'production' : $_SESSION['environment'],
  185. 'use_url_rewriting' => false,
  186. 'salt' => $_SESSION['salt'],
  187. 'base_url' => '',
  188. 'title' => $_SESSION['title'],
  189. 'default_user' => $_SESSION['default_user'],
  190. 'auth_type' => $_SESSION['auth_type'],
  191. 'allow_anonymous' => isset($_SESSION['allow_anonymous']) ? $_SESSION['allow_anonymous'] : false,
  192. ),
  193. 'db' => array(
  194. 'type' => $_SESSION['bd_type'],
  195. 'host' => $_SESSION['bd_host'],
  196. 'user' => $_SESSION['bd_user'],
  197. 'password' => $_SESSION['bd_password'],
  198. 'base' => $_SESSION['bd_base'],
  199. 'prefix' => $_SESSION['bd_prefix'],
  200. ),
  201. );
  202. @unlink(DATA_PATH . '/config.php'); //To avoid access-rights problems
  203. file_put_contents(DATA_PATH . '/config.php', "<?php\n return " . var_export($ini_array, true) . ';');
  204. if (file_exists(DATA_PATH . '/config.php') && file_exists(DATA_PATH . '/application.ini')) {
  205. @unlink(DATA_PATH . '/application.ini'); //v0.6
  206. }
  207. $res = checkBD ();
  208. if ($res) {
  209. $_SESSION['bd_error'] = '';
  210. header ('Location: index.php?step=4');
  211. } elseif (empty($_SESSION['bd_error'])) {
  212. $_SESSION['bd_error'] = 'Unknown error!';
  213. }
  214. }
  215. invalidateHttpCache();
  216. }
  217. function updateDatabase($perform = false) {
  218. $needs = array('bd_type', 'bd_host', 'bd_base', 'bd_user', 'bd_password', 'bd_prefix', 'bd_prefix_user');
  219. foreach ($needs as $need) {
  220. if (!isset($_SESSION[$need])) {
  221. return false;
  222. }
  223. }
  224. try {
  225. $str = '';
  226. switch ($_SESSION['bd_type']) {
  227. case 'mysql':
  228. $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base'];
  229. $driver_options = array(
  230. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
  231. );
  232. break;
  233. case 'sqlite':
  234. $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite';
  235. $driver_options = null;
  236. break;
  237. default:
  238. return false;
  239. }
  240. $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
  241. $stm = $c->prepare(SQL_SHOW_TABLES);
  242. $stm->execute();
  243. $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
  244. if (!in_array($_SESSION['bd_prefix'] . 'entry006', $res)) {
  245. return false;
  246. }
  247. $sql = sprintf(SQL_SHOW_COLUMNS_UPDATEv006, $_SESSION['bd_prefix']);
  248. $stm = $c->prepare($sql);
  249. $stm->execute();
  250. $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
  251. if (!in_array('id2', $res)) {
  252. if (!$perform) {
  253. return true;
  254. }
  255. $sql = sprintf(SQL_UPDATEv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']);
  256. $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true));
  257. $stm->execute();
  258. }
  259. $sql = sprintf(SQL_UPDATE_HISTORYv007b, $_SESSION['bd_prefix_user']);
  260. $stm = $c->prepare($sql);
  261. $stm->execute();
  262. $sql = sprintf(SQL_UPDATE_CACHED_VALUES, $_SESSION['bd_prefix_user']);
  263. $stm = $c->prepare($sql);
  264. $stm->execute();
  265. $sql = sprintf(SQL_CONVERT_SELECTv006, $_SESSION['bd_prefix'], $_SESSION['bd_prefix_user']);
  266. if (!$perform) {
  267. $sql .= ' LIMIT 1';
  268. }
  269. $stm = $c->prepare($sql);
  270. $stm->execute();
  271. if (!$perform) {
  272. $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
  273. return count($res) > 0;
  274. } else {
  275. @set_time_limit(300);
  276. }
  277. $c2 = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
  278. $sql = sprintf(SQL_CONVERT_UPDATEv006, $_SESSION['bd_prefix_user']);
  279. $stm2 = $c2->prepare($sql);
  280. while ($row = $stm->fetch(PDO::FETCH_ASSOC)) {
  281. $id = $row['id2'];
  282. $content = unserialize(gzinflate(base64_decode($row['content'])));
  283. $stm2->execute(array($content, $id));
  284. }
  285. return true;
  286. } catch (PDOException $e) {
  287. return false;
  288. }
  289. return false;
  290. }
  291. function deleteInstall () {
  292. $res = unlink (INDEX_PATH . '/install.php');
  293. if ($res) {
  294. header ('Location: index.php');
  295. }
  296. $needs = array('bd_type', 'bd_host', 'bd_base', 'bd_user', 'bd_password', 'bd_prefix');
  297. foreach ($needs as $need) {
  298. if (!isset($_SESSION[$need])) {
  299. return false;
  300. }
  301. }
  302. try {
  303. switch ($_SESSION['bd_type']) {
  304. case 'mysql':
  305. $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base'];
  306. $driver_options = array(
  307. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
  308. );
  309. break;
  310. case 'sqlite':
  311. $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite';
  312. $driver_options = null;
  313. break;
  314. default:
  315. return false;
  316. }
  317. $c = new PDO($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
  318. $sql = sprintf(SQL_DROP_BACKUPv006, $_SESSION['bd_prefix']);
  319. $stm = $c->prepare($sql);
  320. $stm->execute();
  321. return true;
  322. } catch (PDOException $e) {
  323. return false;
  324. }
  325. return false;
  326. }
  327. function moveOldFiles() {
  328. $mvs = array(
  329. '/app/configuration/application.ini' => '/data/application.ini', //v0.6
  330. '/public/data/Configuration.array.php' => '/data/Configuration.array.php', //v0.6
  331. );
  332. $ok = true;
  333. foreach ($mvs as $fFrom => $fTo) {
  334. if (file_exists(FRESHRSS_PATH . $fFrom)) {
  335. if (copy(FRESHRSS_PATH . $fFrom, FRESHRSS_PATH . $fTo)) {
  336. @unlink(FRESHRSS_PATH . $fFrom);
  337. } else {
  338. $ok = false;
  339. }
  340. }
  341. }
  342. return $ok;
  343. }
  344. function delTree($dir) { //http://php.net/rmdir#110489
  345. if (!is_dir($dir)) {
  346. return true;
  347. }
  348. $files = array_diff(scandir($dir), array('.', '..'));
  349. foreach ($files as $file) {
  350. $f = $dir . '/' . $file;
  351. if (is_dir($f)) {
  352. @chmod($f, 0777);
  353. delTree($f);
  354. }
  355. else unlink($f);
  356. }
  357. return rmdir($dir);
  358. }
  359. /*** VÉRIFICATIONS ***/
  360. function checkStep () {
  361. $s0 = checkStep0 ();
  362. $s1 = checkStep1 ();
  363. $s2 = checkStep2 ();
  364. $s3 = checkStep3 ();
  365. if (STEP > 0 && $s0['all'] != 'ok') {
  366. header ('Location: index.php?step=0');
  367. } elseif (STEP > 1 && $s1['all'] != 'ok') {
  368. header ('Location: index.php?step=1');
  369. } elseif (STEP > 2 && $s2['all'] != 'ok') {
  370. header ('Location: index.php?step=2');
  371. } elseif (STEP > 3 && $s3['all'] != 'ok') {
  372. header ('Location: index.php?step=3');
  373. }
  374. $_SESSION['actualize_feeds'] = true;
  375. }
  376. function checkStep0 () {
  377. moveOldFiles();
  378. if (file_exists(DATA_PATH . '/config.php')) {
  379. $ini_array = include(DATA_PATH . '/config.php');
  380. } elseif (file_exists(DATA_PATH . '/application.ini')) { //v0.6
  381. $ini_array = parse_ini_file(DATA_PATH . '/application.ini', true);
  382. $ini_array['general']['title'] = empty($ini_array['general']['title']) ? '' : stripslashes($ini_array['general']['title']);
  383. } else {
  384. $ini_array = null;
  385. }
  386. if ($ini_array) {
  387. $ini_general = isset($ini_array['general']) ? $ini_array['general'] : null;
  388. if ($ini_general) {
  389. $keys = array('environment', 'salt', 'title', 'default_user', 'allow_anonymous', 'auth_type');
  390. foreach ($keys as $key) {
  391. if ((empty($_SESSION[$key])) && isset($ini_general[$key])) {
  392. $_SESSION[$key] = $ini_general[$key];
  393. }
  394. }
  395. }
  396. $ini_db = isset($ini_array['db']) ? $ini_array['db'] : null;
  397. if ($ini_db) {
  398. $keys = array('type', 'host', 'user', 'password', 'base', 'prefix');
  399. foreach ($keys as $key) {
  400. if ((!isset($_SESSION['bd_' . $key])) && isset($ini_db[$key])) {
  401. $_SESSION['bd_' . $key] = $ini_db[$key];
  402. }
  403. }
  404. }
  405. }
  406. if (isset($_SESSION['default_user']) && file_exists(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php')) {
  407. $userConfig = include(DATA_PATH . '/' . $_SESSION['default_user'] . '_user.php');
  408. } elseif (file_exists(DATA_PATH . '/Configuration.array.php')) {
  409. $userConfig = include(DATA_PATH . '/Configuration.array.php'); //v0.6
  410. if (empty($_SESSION['auth_type'])) {
  411. $_SESSION['auth_type'] = empty($userConfig['mail_login']) ? 'none' : 'persona';
  412. }
  413. if (!isset($_SESSION['allow_anonymous'])) {
  414. $_SESSION['allow_anonymous'] = empty($userConfig['anon_access']) ? false : ($userConfig['anon_access'] === 'yes');
  415. }
  416. } else {
  417. $userConfig = array();
  418. }
  419. if (empty($_SESSION['auth_type'])) { //v0.7b
  420. $_SESSION['auth_type'] = '';
  421. }
  422. $keys = array('language', 'theme', 'old_entries', 'mail_login', 'passwordHash');
  423. foreach ($keys as $key) {
  424. if ((!isset($_SESSION[$key])) && isset($userConfig[$key])) {
  425. $_SESSION[$key] = $userConfig[$key];
  426. }
  427. }
  428. $languages = availableLanguages ();
  429. $language = isset ($_SESSION['language']) &&
  430. isset ($languages[$_SESSION['language']]);
  431. if (empty($_SESSION['passwordHash'])) { //v0.7b
  432. $_SESSION['passwordHash'] = '';
  433. }
  434. if (empty($_SESSION['theme'])) {
  435. $_SESSION['theme'] = 'Origine';
  436. } else {
  437. switch (strtolower($_SESSION['theme'])) {
  438. case 'default': //v0.7b
  439. $_SESSION['theme'] = 'Origine';
  440. break;
  441. case 'flat-design': //v0.7b
  442. $_SESSION['theme'] = 'Flat';
  443. break;
  444. case 'default_dark': //v0.7b
  445. $_SESSION['theme'] = 'Dark';
  446. break;
  447. }
  448. }
  449. return array (
  450. 'language' => $language ? 'ok' : 'ko',
  451. 'all' => $language ? 'ok' : 'ko'
  452. );
  453. }
  454. function checkStep1 () {
  455. $php = version_compare (PHP_VERSION, '5.2.0') >= 0;
  456. $minz = file_exists (LIB_PATH . '/Minz');
  457. $curl = extension_loaded ('curl');
  458. $pdo = extension_loaded ('pdo_mysql');
  459. $pcre = extension_loaded ('pcre');
  460. $ctype = extension_loaded ('ctype');
  461. $dom = class_exists('DOMDocument');
  462. $data = DATA_PATH && is_writable (DATA_PATH);
  463. $cache = CACHE_PATH && is_writable (CACHE_PATH);
  464. $log = LOG_PATH && is_writable (LOG_PATH);
  465. $favicons = is_writable (DATA_PATH . '/favicons');
  466. $persona = is_writable (DATA_PATH . '/persona');
  467. return array (
  468. 'php' => $php ? 'ok' : 'ko',
  469. 'minz' => $minz ? 'ok' : 'ko',
  470. 'curl' => $curl ? 'ok' : 'ko',
  471. 'pdo-mysql' => $pdo ? 'ok' : 'ko',
  472. 'pcre' => $pcre ? 'ok' : 'ko',
  473. 'ctype' => $ctype ? 'ok' : 'ko',
  474. 'dom' => $dom ? 'ok' : 'ko',
  475. 'data' => $data ? 'ok' : 'ko',
  476. 'cache' => $cache ? 'ok' : 'ko',
  477. 'log' => $log ? 'ok' : 'ko',
  478. 'favicons' => $favicons ? 'ok' : 'ko',
  479. 'persona' => $persona ? 'ok' : 'ko',
  480. 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $data && $cache && $log && $favicons && $persona ? 'ok' : 'ko'
  481. );
  482. }
  483. function checkStep2 () {
  484. $conf = !empty($_SESSION['salt']) &&
  485. !empty($_SESSION['title']) &&
  486. !empty($_SESSION['old_entries']) &&
  487. isset($_SESSION['mail_login']) &&
  488. !empty($_SESSION['default_user']);
  489. $defaultUser = empty($_POST['default_user']) ? null : $_POST['default_user'];
  490. if ($defaultUser === null) {
  491. $defaultUser = empty($_SESSION['default_user']) ? '' : $_SESSION['default_user'];
  492. }
  493. $data = is_writable(DATA_PATH . '/' . $defaultUser . '_user.php');
  494. if ($data) {
  495. @unlink(DATA_PATH . '/Configuration.array.php'); //v0.6
  496. }
  497. return array (
  498. 'conf' => $conf ? 'ok' : 'ko',
  499. 'data' => $data ? 'ok' : 'ko',
  500. 'all' => $conf && $data ? 'ok' : 'ko'
  501. );
  502. }
  503. function checkStep3 () {
  504. $conf = is_writable(DATA_PATH . '/config.php');
  505. $bd = isset ($_SESSION['bd_type']) &&
  506. isset ($_SESSION['bd_host']) &&
  507. isset ($_SESSION['bd_user']) &&
  508. isset ($_SESSION['bd_password']) &&
  509. isset ($_SESSION['bd_base']) &&
  510. isset ($_SESSION['bd_prefix']) &&
  511. isset ($_SESSION['bd_error']);
  512. $conn = empty($_SESSION['bd_error']);
  513. return array (
  514. 'bd' => $bd ? 'ok' : 'ko',
  515. 'conn' => $conn ? 'ok' : 'ko',
  516. 'conf' => $conf ? 'ok' : 'ko',
  517. 'all' => $bd && $conn && $conf ? 'ok' : 'ko'
  518. );
  519. }
  520. function checkBD () {
  521. $ok = false;
  522. try {
  523. $str = '';
  524. $driver_options = null;
  525. switch ($_SESSION['bd_type']) {
  526. case 'mysql':
  527. $driver_options = array(
  528. PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'
  529. );
  530. try { // on ouvre une connexion juste pour créer la base si elle n'existe pas
  531. $str = 'mysql:host=' . $_SESSION['bd_host'] . ';';
  532. $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
  533. $sql = sprintf (SQL_CREATE_DB, $_SESSION['bd_base']);
  534. $res = $c->query ($sql);
  535. } catch (PDOException $e) {
  536. }
  537. // on écrase la précédente connexion en sélectionnant la nouvelle BDD
  538. $str = 'mysql:host=' . $_SESSION['bd_host'] . ';dbname=' . $_SESSION['bd_base'];
  539. break;
  540. case 'sqlite':
  541. $str = 'sqlite:' . DATA_PATH . $_SESSION['bd_base'] . '.sqlite';
  542. break;
  543. default:
  544. return false;
  545. }
  546. $c = new PDO ($str, $_SESSION['bd_user'], $_SESSION['bd_password'], $driver_options);
  547. $stm = $c->prepare(SQL_SHOW_TABLES);
  548. $stm->execute();
  549. $res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
  550. if (in_array($_SESSION['bd_prefix'] . 'entry', $res) && !in_array($_SESSION['bd_prefix'] . 'entry006', $res)) {
  551. $sql = sprintf(SQL_BACKUP006, $_SESSION['bd_prefix']); //v0.6
  552. $res = $c->query($sql); //Backup tables
  553. }
  554. $sql = sprintf(SQL_CREATE_TABLES, $_SESSION['bd_prefix_user']);
  555. $stm = $c->prepare($sql, array(PDO::ATTR_EMULATE_PREPARES => true));
  556. $values = array(
  557. 'catName' => _t('default_category'),
  558. );
  559. $ok = $stm->execute($values);
  560. } catch (PDOException $e) {
  561. $ok = false;
  562. $_SESSION['bd_error'] = $e->getMessage();
  563. }
  564. if (!$ok) {
  565. @unlink(DATA_PATH . '/config.php');
  566. }
  567. return $ok;
  568. }
  569. /*** AFFICHAGE ***/
  570. function printStep0 () {
  571. global $actual;
  572. ?>
  573. <?php $s0 = checkStep0 (); if ($s0['all'] == 'ok') { ?>
  574. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('language_defined'); ?></p>
  575. <?php } ?>
  576. <form action="index.php?step=0" method="post">
  577. <legend><?php echo _t ('choose_language'); ?></legend>
  578. <div class="form-group">
  579. <label class="group-name" for="language"><?php echo _t ('language'); ?></label>
  580. <div class="group-controls">
  581. <select name="language" id="language">
  582. <?php $languages = availableLanguages (); ?>
  583. <?php foreach ($languages as $short => $lib) { ?>
  584. <option value="<?php echo $short; ?>"<?php echo $actual == $short ? ' selected="selected"' : ''; ?>><?php echo $lib; ?></option>
  585. <?php } ?>
  586. </select>
  587. </div>
  588. </div>
  589. <div class="form-group form-actions">
  590. <div class="group-controls">
  591. <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
  592. <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
  593. <?php if ($s0['all'] == 'ok') { ?>
  594. <a class="btn btn-important next-step" href="?step=1"><?php echo _t ('next_step'); ?></a>
  595. <?php } ?>
  596. </div>
  597. </div>
  598. </form>
  599. <?php
  600. }
  601. function printStep1 () {
  602. $res = checkStep1 ();
  603. ?>
  604. <noscript><p class="alert alert-warn"><span class="alert-head"><?php echo _t ('attention'); ?></span> <?php echo _t ('javascript_is_better'); ?></p></noscript>
  605. <?php if ($res['php'] == 'ok') { ?>
  606. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('php_is_ok', PHP_VERSION); ?></p>
  607. <?php } else { ?>
  608. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('php_is_nok', PHP_VERSION, '5.1.0'); ?></p>
  609. <?php } ?>
  610. <?php if ($res['minz'] == 'ok') { ?>
  611. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('minz_is_ok'); ?></p>
  612. <?php } else { ?>
  613. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('minz_is_nok', LIB_PATH . '/Minz'); ?></p>
  614. <?php } ?>
  615. <?php if ($res['pdo-mysql'] == 'ok') { ?>
  616. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pdomysql_is_ok'); ?></p>
  617. <?php } else { ?>
  618. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pdomysql_is_nok'); ?></p>
  619. <?php } ?>
  620. <?php if ($res['curl'] == 'ok') { ?>
  621. <?php $version = curl_version(); ?>
  622. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('curl_is_ok', $version['version']); ?></p>
  623. <?php } else { ?>
  624. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('curl_is_nok'); ?></p>
  625. <?php } ?>
  626. <?php if ($res['pcre'] == 'ok') { ?>
  627. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('pcre_is_ok'); ?></p>
  628. <?php } else { ?>
  629. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('pcre_is_nok'); ?></p>
  630. <?php } ?>
  631. <?php if ($res['ctype'] == 'ok') { ?>
  632. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('ctype_is_ok'); ?></p>
  633. <?php } else { ?>
  634. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('ctype_is_nok'); ?></p>
  635. <?php } ?>
  636. <?php if ($res['dom'] == 'ok') { ?>
  637. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('dom_is_ok'); ?></p>
  638. <?php } else { ?>
  639. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('dom_is_nok'); ?></p>
  640. <?php } ?>
  641. <?php if ($res['data'] == 'ok') { ?>
  642. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('data_is_ok'); ?></p>
  643. <?php } else { ?>
  644. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH); ?></p>
  645. <?php } ?>
  646. <?php if ($res['cache'] == 'ok') { ?>
  647. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('cache_is_ok'); ?></p>
  648. <?php } else { ?>
  649. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', CACHE_PATH); ?></p>
  650. <?php } ?>
  651. <?php if ($res['log'] == 'ok') { ?>
  652. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('log_is_ok'); ?></p>
  653. <?php } else { ?>
  654. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', LOG_PATH); ?></p>
  655. <?php } ?>
  656. <?php if ($res['favicons'] == 'ok') { ?>
  657. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('favicons_is_ok'); ?></p>
  658. <?php } else { ?>
  659. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH . '/favicons'); ?></p>
  660. <?php } ?>
  661. <?php if ($res['persona'] == 'ok') { ?>
  662. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('persona_is_ok'); ?></p>
  663. <?php } else { ?>
  664. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('file_is_nok', DATA_PATH . '/persona'); ?></p>
  665. <?php } ?>
  666. <?php if ($res['all'] == 'ok') { ?>
  667. <a class="btn btn-important next-step" href="?step=2"><?php echo _t ('next_step'); ?></a>
  668. <?php } else { ?>
  669. <p class="alert alert-error"><?php echo _t ('fix_errors_before'); ?></p>
  670. <?php } ?>
  671. <?php
  672. }
  673. function printStep2 () {
  674. ?>
  675. <?php $s2 = checkStep2 (); if ($s2['all'] == 'ok') { ?>
  676. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('general_conf_is_ok'); ?></p>
  677. <?php } ?>
  678. <form action="index.php?step=2" method="post">
  679. <legend><?php echo _t ('general_configuration'); ?></legend>
  680. <div class="form-group">
  681. <label class="group-name" for="title"><?php echo _t ('title'); ?></label>
  682. <div class="group-controls">
  683. <input type="text" id="title" name="title" value="<?php echo isset ($_SESSION['title']) ? $_SESSION['title'] : _t ('freshrss'); ?>" />
  684. </div>
  685. </div>
  686. <div class="form-group">
  687. <label class="group-name" for="old_entries"><?php echo _t ('delete_articles_every'); ?></label>
  688. <div class="group-controls">
  689. <input type="number" id="old_entries" name="old_entries" required="required" min="1" max="1200" value="<?php echo isset ($_SESSION['old_entries']) ? $_SESSION['old_entries'] : '3'; ?>" /> <?php echo _t ('month'); ?>
  690. </div>
  691. </div>
  692. <div class="form-group">
  693. <label class="group-name" for="default_user"><?php echo _t ('default_user'); ?></label>
  694. <div class="group-controls">
  695. <input type="text" id="default_user" name="default_user" required="required" size="16" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" value="<?php echo isset ($_SESSION['default_user']) ? $_SESSION['default_user'] : ''; ?>" placeholder="<?php echo httpAuthUser() == '' ? 'user1' : httpAuthUser(); ?>" />
  696. </div>
  697. </div>
  698. <div class="form-group">
  699. <label class="group-name" for="auth_type"><?php echo _t('auth_type'); ?></label>
  700. <div class="group-controls">
  701. <select id="auth_type" name="auth_type" required="required">
  702. <?php if (!in_array($_SESSION['auth_type'], array('form', 'persona', 'http_auth', 'none'))) { ?>
  703. <option selected="selected"></option>
  704. <?php } ?>
  705. <option value="form"<?php echo $_SESSION['auth_type'] === 'form' ? ' selected="selected"' : '', version_compare(PHP_VERSION, '5.3', '<') ? ' disabled="disabled"' : ''; ?>><?php echo _t('auth_form'); ?></option>
  706. <option value="persona"<?php echo $_SESSION['auth_type'] === 'persona' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_persona'); ?></option>
  707. <option value="http_auth"<?php echo $_SESSION['auth_type'] === 'http_auth' ? ' selected="selected"' : '', httpAuthUser() == '' ? ' disabled="disabled"' : ''; ?>><?php echo _t('http_auth'); ?> (REMOTE_USER = '<?php echo httpAuthUser(); ?>')</option>
  708. <option value="none"<?php echo $_SESSION['auth_type'] === 'none' ? ' selected="selected"' : ''; ?>><?php echo _t('auth_none'); ?></option>
  709. </select>
  710. </div>
  711. </div>
  712. <div class="form-group">
  713. <label class="group-name" for="passwordPlain"><?php echo _t('password_form'); ?></label>
  714. <div class="group-controls">
  715. <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" autocomplete="off" />
  716. <noscript><b><?php echo _t('javascript_should_be_activated'); ?></b></noscript>
  717. </div>
  718. </div>
  719. <div class="form-group">
  720. <label class="group-name" for="mail_login"><?php echo _t ('persona_connection_email'); ?></label>
  721. <div class="group-controls">
  722. <input type="email" id="mail_login" name="mail_login" value="<?php echo isset ($_SESSION['mail_login']) ? $_SESSION['mail_login'] : ''; ?>" placeholder="alice@example.net" />
  723. <noscript><b><?php echo _t ('javascript_should_be_activated'); ?></b></noscript>
  724. </div>
  725. </div>
  726. <div class="form-group form-actions">
  727. <div class="group-controls">
  728. <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
  729. <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
  730. <?php if ($s2['all'] == 'ok') { ?>
  731. <a class="btn btn-important next-step" href="?step=3"><?php echo _t ('next_step'); ?></a>
  732. <?php } ?>
  733. </div>
  734. </div>
  735. </form>
  736. <?php
  737. }
  738. function printStep3 () {
  739. ?>
  740. <?php $s3 = checkStep3 (); if ($s3['all'] == 'ok') { ?>
  741. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('ok'); ?></span> <?php echo _t ('bdd_conf_is_ok'); ?></p>
  742. <?php } elseif ($s3['conn'] == 'ko') { ?>
  743. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('damn'); ?></span> <?php echo _t ('bdd_conf_is_ko'), (empty($_SESSION['bd_error']) ? '' : ' : ' . $_SESSION['bd_error']); ?></p>
  744. <?php } ?>
  745. <form action="index.php?step=3" method="post">
  746. <legend><?php echo _t ('bdd_configuration'); ?></legend>
  747. <div class="form-group">
  748. <label class="group-name" for="type"><?php echo _t ('bdd_type'); ?></label>
  749. <div class="group-controls">
  750. <select name="type" id="type">
  751. <option value="mysql"
  752. <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'mysql') ? 'selected="selected"' : ''; ?>>
  753. MySQL
  754. </option>
  755. <!-- TODO : l'utilisation de SQLite n'est pas encore possible. Pour tester tout de même, décommentez ce bloc
  756. <option value="sqlite"
  757. <?php echo (isset($_SESSION['bd_type']) && $_SESSION['bd_type'] === 'sqlite') ? 'selected="selected"' : ''; ?>>
  758. SQLite
  759. </option>-->
  760. </select>
  761. </div>
  762. </div>
  763. <div class="form-group">
  764. <label class="group-name" for="host"><?php echo _t ('host'); ?></label>
  765. <div class="group-controls">
  766. <input type="text" id="host" name="host" pattern="[0-9A-Za-z_.-]{1,64}" value="<?php echo isset ($_SESSION['bd_host']) ? $_SESSION['bd_host'] : 'localhost'; ?>" />
  767. </div>
  768. </div>
  769. <div class="form-group">
  770. <label class="group-name" for="user"><?php echo _t ('username'); ?></label>
  771. <div class="group-controls">
  772. <input type="text" id="user" name="user" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset ($_SESSION['bd_user']) ? $_SESSION['bd_user'] : ''; ?>" />
  773. </div>
  774. </div>
  775. <div class="form-group">
  776. <label class="group-name" for="pass"><?php echo _t ('password'); ?></label>
  777. <div class="group-controls">
  778. <input type="password" id="pass" name="pass" value="<?php echo isset ($_SESSION['bd_password']) ? $_SESSION['bd_password'] : ''; ?>" />
  779. </div>
  780. </div>
  781. <div class="form-group">
  782. <label class="group-name" for="base"><?php echo _t ('bdd'); ?></label>
  783. <div class="group-controls">
  784. <input type="text" id="base" name="base" maxlength="64" pattern="[0-9A-Za-z_]{1,64}" value="<?php echo isset ($_SESSION['bd_base']) ? $_SESSION['bd_base'] : ''; ?>" placeholder="freshrss" />
  785. </div>
  786. </div>
  787. <div class="form-group">
  788. <label class="group-name" for="prefix"><?php echo _t ('prefix'); ?></label>
  789. <div class="group-controls">
  790. <input type="text" id="prefix" name="prefix" maxlength="16" pattern="[0-9A-Za-z_]{1,16}" value="<?php echo isset ($_SESSION['bd_prefix']) ? $_SESSION['bd_prefix'] : 'freshrss_'; ?>" />
  791. </div>
  792. </div>
  793. <div class="form-group form-actions">
  794. <div class="group-controls">
  795. <button type="submit" class="btn btn-important"><?php echo _t ('save'); ?></button>
  796. <button type="reset" class="btn"><?php echo _t ('cancel'); ?></button>
  797. <?php if ($s3['all'] == 'ok') { ?>
  798. <a class="btn btn-important next-step" href="?step=4"><?php echo _t ('next_step'); ?></a>
  799. <?php } ?>
  800. </div>
  801. </div>
  802. </form>
  803. <?php
  804. }
  805. function printStep4 () {
  806. ?>
  807. <form action="index.php?step=4" method="post">
  808. <legend><?php echo _t ('version_update'); ?></legend>
  809. <?php if (updateDatabase(false)) { ?>
  810. <p class="alert"><?php echo _t ('update_long'); ?></p>
  811. <div class="form-group form-actions">
  812. <div class="group-controls">
  813. <input type="hidden" name="updateDatabase" value="1" />
  814. <button type="submit" class="btn btn-important"><?php echo _t ('update_start'); ?></button>
  815. </div>
  816. </div>
  817. <?php } else { ?>
  818. <p class="alert"><?php echo _t ('update_end'); ?></p>
  819. <div class="form-group form-actions">
  820. <div class="group-controls">
  821. <a class="btn btn-important next-step" href="?step=5"><?php echo _t ('next_step'); ?></a>
  822. </div>
  823. </div>
  824. <?php } ?>
  825. </form>
  826. <?php
  827. }
  828. function printStep5 () {
  829. ?>
  830. <p class="alert alert-success"><span class="alert-head"><?php echo _t ('congratulations'); ?></span> <?php echo _t ('installation_is_ok'); ?></p>
  831. <a class="btn btn-important next-step" href="?step=6"><?php echo _t ('finish_installation'); ?></a>
  832. <?php
  833. }
  834. function printStep6 () {
  835. ?>
  836. <p class="alert alert-error"><span class="alert-head"><?php echo _t ('oops'); ?></span> <?php echo _t ('install_not_deleted', INDEX_PATH . '/install.php'); ?></p>
  837. <?php
  838. }
  839. checkStep ();
  840. initTranslate ();
  841. switch (STEP) {
  842. case 0:
  843. default:
  844. saveLanguage ();
  845. break;
  846. case 1:
  847. break;
  848. case 2:
  849. saveStep2 ();
  850. break;
  851. case 3:
  852. saveStep3 ();
  853. break;
  854. case 4:
  855. if (!empty($_POST['updateDatabase'])) {
  856. updateDatabase(true);
  857. }
  858. break;
  859. case 5:
  860. break;
  861. case 6:
  862. deleteInstall ();
  863. break;
  864. }
  865. ?>
  866. <!DOCTYPE html>
  867. <html lang="fr">
  868. <head>
  869. <meta charset="utf-8">
  870. <meta name="viewport" content="initial-scale=1.0">
  871. <title><?php echo _t ('freshrss_installation'); ?></title>
  872. <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/global.css" />
  873. <link rel="stylesheet" type="text/css" media="all" href="../themes/Origine/freshrss.css" />
  874. </head>
  875. <body>
  876. <div class="header">
  877. <div class="item title">
  878. <h1><a href="index.php"><?php echo _t ('freshrss'); ?></a></h1>
  879. <h2><?php echo _t ('installation_step', STEP); ?></h2>
  880. </div>
  881. </div>
  882. <div id="global">
  883. <ul class="nav nav-list aside">
  884. <li class="nav-header"><?php echo _t ('steps'); ?></li>
  885. <li class="item<?php echo STEP == 0 ? ' active' : ''; ?>"><a href="?step=0"><?php echo _t ('language'); ?></a></li>
  886. <li class="item<?php echo STEP == 1 ? ' active' : ''; ?>"><a href="?step=1"><?php echo _t ('checks'); ?></a></li>
  887. <li class="item<?php echo STEP == 2 ? ' active' : ''; ?>"><a href="?step=2"><?php echo _t ('general_configuration'); ?></a></li>
  888. <li class="item<?php echo STEP == 3 ? ' active' : ''; ?>"><a href="?step=3"><?php echo _t ('bdd_configuration'); ?></a></li>
  889. <li class="item<?php echo STEP == 4 ? ' active' : ''; ?>"><a href="?step=4"><?php echo _t ('version_update'); ?></a></li>
  890. <li class="item<?php echo STEP == 5 ? ' active' : ''; ?>"><a href="?step=5"><?php echo _t ('this_is_the_end'); ?></a></li>
  891. </ul>
  892. <div class="post">
  893. <?php
  894. switch (STEP) {
  895. case 0:
  896. default:
  897. printStep0 ();
  898. break;
  899. case 1:
  900. printStep1 ();
  901. break;
  902. case 2:
  903. printStep2 ();
  904. break;
  905. case 3:
  906. printStep3 ();
  907. break;
  908. case 4:
  909. printStep4 ();
  910. break;
  911. case 5:
  912. printStep5 ();
  913. break;
  914. case 6:
  915. printStep6 ();
  916. break;
  917. }
  918. ?>
  919. </div>
  920. </div>
  921. </body>
  922. </html>