install.php 35 KB

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