PageRenderTime 29ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/setup.php

http://snowcms.googlecode.com/
PHP | 811 lines | 540 code | 89 blank | 182 comment | 65 complexity | f940218ead6cc4242ce8a520aa333749 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////
  3. // SnowCMS v2.0 //
  4. // By the SnowCMS Team //
  5. // www.snowcms.com //
  6. // Released under the Microsoft Reciprocal License //
  7. // www.opensource.org/licenses/ms-rl.html //
  8. ////////////////////////////////////////////////////////////////////////////
  9. // //
  10. // SnowCMS originally pawned by soren121 started in early 2008 //
  11. // //
  12. ////////////////////////////////////////////////////////////////////////////
  13. // //
  14. // SnowCMS v2.0 began in November 2009 //
  15. // //
  16. ////////////////////////////////////////////////////////////////////////////
  17. // File version: SnowCMS 2.0 //
  18. ////////////////////////////////////////////////////////////////////////////
  19. // Title: SnowCMS Installer
  20. // Setting this to true will prevent the setup.php and setup SQL files
  21. // from being deleted, just in case any modifications were made to these
  22. // files... Wouldn't want any work to be lost!
  23. define('INDEVMODE', true);
  24. session_start();
  25. // Magic quotes, what a joke!!!
  26. if(function_exists('set_magic_quotes_runtime'))
  27. {
  28. @set_magic_quotes_runtime(0);
  29. }
  30. // All time/date stuff should be considered UTC, makes life easier!
  31. if(function_exists('date_default_timezone_set'))
  32. {
  33. date_default_timezone_set('UTC');
  34. }
  35. else
  36. {
  37. @ini_set('date.timezone', 'UTC');
  38. }
  39. // We are currently in SnowCMS :)
  40. define('INSNOW', true, true);
  41. // We want to see those errors...
  42. error_reporting(E_STRICT | E_ALL);
  43. // Remove magic quotes, if it is on...
  44. if((function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc() == 1) || @ini_get('magic_quotes_sybase'))
  45. {
  46. $_COOKIE = remove_magic($_COOKIE);
  47. $_GET = remove_magic($_GET);
  48. $_POST = remove_magic($_POST);
  49. }
  50. function remove_magic($array, $depth = 5)
  51. {
  52. // Nothing in the array? No need!
  53. if(count($array) == 0)
  54. {
  55. return array();
  56. }
  57. // Exceeded our maximum depth? Just return the array, untouched.
  58. elseif($depth <= 0)
  59. {
  60. return $array;
  61. }
  62. foreach($array as $key => $value)
  63. {
  64. // Gotta remember that the key needs to have magic quote crud removed
  65. // as well!
  66. if(!is_array($value))
  67. {
  68. $array[stripslashes($key)] = stripslashes($value);
  69. }
  70. else
  71. {
  72. $array[stripslashes($key)] = remove_magic($value, $depth - 1);
  73. }
  74. }
  75. return $array;
  76. }
  77. // Alright, let's do this thing!
  78. call_user_func(setup_return_func());
  79. /*
  80. Function: setup_return_func
  81. Returns the function that ought to be called...
  82. Parameters:
  83. none
  84. Returns:
  85. string
  86. */
  87. function setup_return_func()
  88. {
  89. // We need to check system requirements. If you aren't running PHP 5.0,
  90. // have the XML Parser extension enabled, or MySQL, then you can't run
  91. // SnowCMS... Sorry! Oh, and this directory needs to be writeable.
  92. if(!is_writable(dirname(__FILE__)) || !version_compare(phpversion(), '5.0.0', '>=') || !function_exists('xml_parser_create') || !function_exists('mysql_connect'))
  93. {
  94. return 'setup_requirement_fail';
  95. }
  96. // What step do you claim you are on?
  97. $step = !empty($_GET['step']) && (int)$_GET['step'] > 0 && (int)$_GET['step'] < 4 ? (int)$_GET['step'] : 1;
  98. // Which are you really on?
  99. if(empty($_SESSION['step']) || $_SESSION['step'] != $step)
  100. {
  101. $step = 1;
  102. }
  103. // Just a simple session identifier.
  104. if(empty($_SESSION['id']))
  105. {
  106. $_SESSION['id'] = sha1(mt_rand(1, 9999) + str_shuffle('My favorite color is blue... Really. No joke.'));
  107. }
  108. // This is easy enough.
  109. return 'setup_step_'. $step;
  110. }
  111. /*
  112. Function: setup_requirement_fail
  113. Parameters:
  114. none
  115. Returns:
  116. void
  117. */
  118. function setup_requirement_fail()
  119. {
  120. template_header();
  121. echo '
  122. <h1>System Requirements Failure</h1>
  123. <p>Sorry, but it appears that your server does not meet the requirements in order to run SnowCMS. Please read the following for information as to why your server failed this test.</p>
  124. <br />
  125. <p>Checking if directory is writable... ', (is_writable(dirname(__FILE__)) ? '<span class="green bold">Writable</span>' : '<span class="red bold">Not Writable</span>'), '</p>
  126. <p>Checking for at least PHP version 5... ', (version_compare(phpversion(), '5.0.0', '>=') ? '<span class="green bold">OK</span>' : '<span class="red bold">FAIL</span>'), ' (running v', phpversion(), ')</p>
  127. <p>Checking for <a href="http://www.php.net/manual/en/book.xml.php" target="_blank">XML Parser</a> extension... ', (function_exists('xml_parser_create') ? '<span class="green bold">Enabled</span>' : '<span class="red bold">Not Enabled</span>'), '</p>
  128. <p>Checking for MySQL extension... ', (function_exists('mysql_connect') ? '<span class="green bold">Enabled</span>' : '<span class="red bold">Not Enabled</span>'), '</p>
  129. <br />
  130. <p>Once these issues are resolved, simply refresh this page to check again.</p>';
  131. template_footer();
  132. }
  133. /*
  134. Function: setup_step_1
  135. Displays and processes everything that occurs within the first step of
  136. the installation process.
  137. Parameters:
  138. none
  139. Returns:
  140. void
  141. */
  142. function setup_step_1()
  143. {
  144. if(!empty($_POST['proc_step_1']))
  145. {
  146. $error_msg = array();
  147. $db_host = !empty($_POST['db_host']) ? $_POST['db_host'] : '';
  148. $db_user = !empty($_POST['db_user']) ? $_POST['db_user'] : '';
  149. $db_pass = !empty($_POST['db_pass']) ? $_POST['db_pass'] : '';
  150. $db_name = !empty($_POST['db_name']) ? $_POST['db_name'] : '';
  151. $tbl_prefix = !empty($_POST['tbl_prefix']) ? $_POST['tbl_prefix'] : '';
  152. // Make sure the session id's match.
  153. if(empty($_POST['session_id']) || $_POST['session_id'] != $_SESSION['id'])
  154. {
  155. $error_msg[] = 'Session verification failed. Please try again.';
  156. }
  157. if(count($error_msg) == 0)
  158. {
  159. $connection = @mysql_connect($db_host, $db_user, $db_pass);
  160. // So, did it work?
  161. if(!empty($connection))
  162. {
  163. $selected_db = @mysql_select_db($db_name, $connection);
  164. // Were we able to select the database?
  165. if(!empty($selected_db))
  166. {
  167. // Sweet! Now to save the configuration file. Hopefully...
  168. // Shouldn't be a problem, seeing as the directory *ought* to be
  169. // writable if you are on step #1.
  170. if(generate_config($db_host, $db_user, $db_pass, $db_name, $tbl_prefix, $error_msg))
  171. {
  172. // You're on to step 2!
  173. $_SESSION['step'] = 2;
  174. // Let's redirect you there...
  175. header('HTTP/1.1 Temporary Redirect');
  176. header('Location: setup.php?step=2');
  177. exit;
  178. }
  179. }
  180. else
  181. {
  182. // No, maybe you didn't assign the right permissions :-/.
  183. $error_msg[] = 'MySQL Error: ['. mysql_errno(). '] '. mysql_error();
  184. }
  185. }
  186. else
  187. {
  188. // Shoot, it didn't!
  189. $error_msg[] = 'MySQL Error: ['. mysql_errno(). '] '. mysql_error();
  190. }
  191. }
  192. }
  193. template_header(1);
  194. echo '
  195. <h1>Let&#039;s Get Started!</h1>
  196. <p>Simply enter your MySQL credentials below, then click <em>Proceed</em>.</p>';
  197. if(!empty($error_msg) && count($error_msg) > 0)
  198. {
  199. echo '
  200. <div class="error-message">';
  201. foreach($error_msg as $e_message)
  202. {
  203. echo '
  204. <p>', $e_message, '</p>';
  205. }
  206. echo '
  207. </div>';
  208. }
  209. echo '
  210. <form action="setup.php" method="post">
  211. <table width="60%" style="margin: auto;">
  212. <tr>
  213. <td class="label" valign="middle">MySQL host:</td>
  214. <td><input type="text" name="db_host" value="', isset($_POST['db_host']) ? htmlspecialchars($_POST['db_host'], ENT_QUOTES) : 'localhost', '" /></td>
  215. </tr>
  216. <tr>
  217. <td class="label" valign="middle">MySQL user:</td>
  218. <td><input type="text" name="db_user" value="', !empty($_POST['db_user']) ? htmlspecialchars($_POST['db_user'], ENT_QUOTES) : '', '" /></td>
  219. </tr>
  220. <tr>
  221. <td class="label" valign="middle">MySQL password:</td>
  222. <td><input type="password" name="db_pass" value="" /></td>
  223. </tr>
  224. <tr>
  225. <td class="label" valign="middle">MySQL database:</td>
  226. <td><input type="text" name="db_name" value="', !empty($_POST['db_name']) ? htmlspecialchars($_POST['db_name'], ENT_QUOTES) : '', '" /></td>
  227. </tr>
  228. <tr>
  229. <td class="label" valign="middle">Table prefix:</td>
  230. <td><input type="text" name="tbl_prefix" value="', !empty($_POST['tbl_prefix']) ? htmlspecialchars($_POST['tbl_prefix'], ENT_QUOTES) : 'snow_', '" /></td>
  231. </tr>
  232. <tr>
  233. <td colspan="2" style="text-align: right; padding: 5px 0;"><input type="submit" name="proc_step_1" value="Proceed &raquo;" /></td>
  234. </tr>
  235. </table>
  236. <input name="session_id" type="hidden" value="', $_SESSION['id'], '" />
  237. </form>';
  238. template_footer();
  239. }
  240. /*
  241. Function: generate_config
  242. Generates the config.php file with the supplied information.
  243. Parameters:
  244. string $db_host
  245. string $db_user
  246. string $db_pass
  247. string $db_name
  248. string $tbl_prefix
  249. array &$error_msg
  250. Returns:
  251. bool
  252. */
  253. function generate_config($db_host, $db_user, $db_pass, $db_name, $tbl_prefix, &$error_msg)
  254. {
  255. $bytes = file_put_contents(dirname(__FILE__). '/config.php',
  256. '<?php
  257. ////////////////////////////////////////////////////////////////////////////
  258. // SnowCMS v2.0 //
  259. // By the SnowCMS Team //
  260. // www.snowcms.com //
  261. // Released under the Microsoft Reciprocal License //
  262. // www.opensource.org/licenses/ms-rl.html //
  263. ////////////////////////////////////////////////////////////////////////////
  264. // //
  265. // SnowCMS originally pawned by soren121 started in early 2008 //
  266. // //
  267. ////////////////////////////////////////////////////////////////////////////
  268. // //
  269. // SnowCMS v2.0 began in November 2009 //
  270. // //
  271. ////////////////////////////////////////////////////////////////////////////
  272. // File version: SnowCMS 2.0 //
  273. ////////////////////////////////////////////////////////////////////////////
  274. if(!defined(\'INSNOW\'))
  275. {
  276. die(\'Nice try...\');
  277. }
  278. //
  279. // config.php holds all your database information and paths.
  280. //
  281. // Database settings:
  282. define(\'DBTYPE\', \'mysql\', true); // Your database type, an example would be mysql, sqlite or postgresql
  283. define(\'DBHOST\', \''. addcslashes($db_host, '\''). '\', true); // The location of your database, could be localhost or a path (for SQLite)
  284. define(\'DBUSER\', \''. addcslashes($db_user, '\''). '\', true); // The user that has access to your database, though not all database systems have this.
  285. define(\'DBPASS\', \''. addcslashes($db_pass, '\''). '\', true); // The password to your database user.
  286. define(\'DBNAME\', \''. addcslashes($db_name, '\''). '\', true); // The name of the database.
  287. define(\'DBPERSIST\', false, true); // Whether or not to have a persistent connection to the database.
  288. define(\'DBDEBUG\', false, true); // Enable database debugging? (Outputs queries into a file ;))
  289. define(\'TBLPREFIX\', \''. addcslashes($tbl_prefix, '\''). '\', true); // The prefix of the tables, allows multiple installs on the same database.
  290. // The location of your root directory of your SnowCMS installation.
  291. define(\'BASEDIR\', defined(\'__DIR__\') ? __DIR__ : dirname(__FILE__), true);
  292. // Some other useful paths...
  293. define(\'COREDIR\', basedir. \'/core\', true);
  294. define(\'THEMEDIR\', basedir. \'/themes\', true);
  295. define(\'PLUGINDIR\', basedir. \'/plugins\', true);
  296. define(\'UPLOADDIR\', basedir. \'/uploads\', true);
  297. // The address of where your SnowCMS install is accessible (No trailing /!)
  298. define(\'BASEURL\', \'http://'. $_SERVER['HTTP_HOST']. (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI']))). '\', true);
  299. define(\'THEMEURL\', baseurl. \'/themes\', true);
  300. define(\'PLUGINURL\', baseurl. \'/plugins\', true);
  301. // What do you want to be the name of the cookie?
  302. define(\'COOKIENAME\', \'SCMS'. mt_rand(100, 999). '\', true);
  303. ?>');
  304. // Do we need to add an error message?
  305. if((int)$bytes == 0)
  306. {
  307. $error_msg[] = 'Failed to create the configuration file. Make sure the directory is writable.';
  308. }
  309. return (int)$bytes > 0;
  310. }
  311. /*
  312. Function: setup_step_2
  313. Displays and processes everything which needs to occur during step #2.
  314. Parameters:
  315. none
  316. Returns:
  317. void
  318. */
  319. function setup_step_2()
  320. {
  321. if(!empty($_POST['proc_step_2']))
  322. {
  323. $error_msg = array();
  324. $member_name = !empty($_POST['member_name']) ? trim($_POST['member_name']) : '';
  325. $member_pass = !empty($_POST['member_pass']) ? $_POST['member_pass'] : '';
  326. $verify_pass = !empty($_POST['verify_pass']) ? $_POST['verify_pass'] : '';
  327. $member_email = !empty($_POST['member_email']) ? $_POST['member_email'] : '';
  328. // Make sure they pass session verification.
  329. if(empty($_POST['session_id']) || $_POST['session_id'] != $_SESSION['id'])
  330. {
  331. $error_msg[] = 'Session verification failed. Please try again.';
  332. }
  333. // No empty username!
  334. if(strlen($member_name) == 0)
  335. {
  336. $error_msg[] = 'Please enter a username.';
  337. }
  338. // At least a 6 character long password, please.
  339. if(strlen($member_pass) < 6)
  340. {
  341. $error_msg[] = 'Please use a password that is more than 6 characters long.';
  342. }
  343. elseif($verify_pass != $member_pass)
  344. {
  345. $error_msg[] = 'Your passwords do not match.';
  346. }
  347. // We won't validate it, but enter SOMETHING!
  348. if(empty($member_email))
  349. {
  350. $error_msg[] = 'Please enter an email address.';
  351. }
  352. if(count($error_msg) == 0)
  353. {
  354. // Finalize the installation process :-)
  355. if(setup_finalize($member_name, $member_pass, $member_email, $error_msg))
  356. {
  357. // Awesome, you're done!
  358. $_SESSION['step'] = 3;
  359. header('HTTP/1.1 Temporary Redirect');
  360. header('Location: setup.php?step=3');
  361. exit;
  362. }
  363. }
  364. }
  365. template_header(2);
  366. echo '
  367. <h1>Create an Account</h1>
  368. <p>Alrighty, let&#039;s get you an administrative account created. We&#039;re just about done!</p>';
  369. if(!empty($error_msg) && count($error_msg) > 0)
  370. {
  371. echo '
  372. <div class="error-message">';
  373. foreach($error_msg as $e_message)
  374. {
  375. echo '
  376. <p>', $e_message, '</p>';
  377. }
  378. echo '
  379. </div>';
  380. }
  381. echo '
  382. <form action="setup.php?step=2" method="post">
  383. <table width="50%" style="margin: auto;">
  384. <tr>
  385. <td class="label">Username:</td>
  386. <td><input type="text" name="member_name" value="', !empty($_POST['member_name']) ? htmlspecialchars($_POST['member_name'], ENT_QUOTES) : '', '" /></td>
  387. </tr>
  388. <tr>
  389. <td class="label">Password:</td>
  390. <td><input type="password" name="member_pass" value="" /></td>
  391. </tr>
  392. <tr>
  393. <td class="label">Password: <sub>Just to be sure...</sub></td>
  394. <td><input type="password" name="verify_pass" value="" /></td>
  395. </tr>
  396. <tr>
  397. <td class="label">Email:</td>
  398. <td><input type="text" name="member_email" value="', !empty($_POST['member_email']) ? htmlspecialchars($_POST['member_email'], ENT_QUOTES) : '', '" /></td>
  399. <tr>
  400. <td colspan="2" style="text-align: right; padding: 5px 0;"><input type="submit" name="proc_step_2" value="Proceed &raquo;" /></td>
  401. </tr>
  402. </table>
  403. <input type="hidden" name="session_id" value="', $_SESSION['id'], '" />
  404. </form>';
  405. template_footer();
  406. }
  407. /*
  408. Function: setup_finalize
  409. Parameters:
  410. string $member_name
  411. string $member_pass
  412. array &$error_msg
  413. Returns:
  414. bool
  415. */
  416. function setup_finalize($member_name, $member_pass, $member_email, &$error_msg)
  417. {
  418. // Get the configuration file. We will need that!
  419. if(!file_exists(dirname(__FILE__). '/config.php'))
  420. {
  421. $error_msg[] = 'Could not find the configuration file. Please restart the installation process.';
  422. return false;
  423. }
  424. require_once(dirname(__FILE__). '/config.php');
  425. $connection = @mysql_connect(DBHOST, DBUSER, DBPASS);
  426. // This shouldn't happen, but hey, you never know!
  427. if(empty($connection))
  428. {
  429. $error_msg[] = 'MySQL Error: ['. mysql_errno(). '] '. mysql_error();
  430. return false;
  431. }
  432. $selected_db = @mysql_select_db(DBNAME, $connection);
  433. // This shouldn't happen either, but whatever.
  434. if(empty($selected_db))
  435. {
  436. $error_msg[] = 'MySQL Error: ['. mysql_errno(). '] '. mysql_error();
  437. return false;
  438. }
  439. // Get the setup SQL... If we can.
  440. if(!file_exists(dirname(__FILE__). '/setup-mysql.sql'))
  441. {
  442. $error_msg[] = 'Could not find setup-mysql.sql, which is required for installation.';
  443. return false;
  444. }
  445. $lines = explode("\r\n", file_get_contents(dirname(__FILE__). '/setup-mysql.sql'));
  446. $commands = array();
  447. foreach($lines as $line)
  448. {
  449. if(substr(ltrim($line), 0, 1) == '#' || substr(ltrim($line), 0, 2) == '--')
  450. {
  451. // Skip this, it's a comment.
  452. continue;
  453. }
  454. $commands[] = $line;
  455. }
  456. $commands = explode(';', str_replace('{db->prefix}', TBLPREFIX, implode('', $commands)));
  457. // Start a transaction.
  458. mysql_query('SET autocommit = 0');
  459. mysql_query('START TRANSACTION');
  460. foreach($commands as $command)
  461. {
  462. if(strlen(trim($command)) == 0)
  463. {
  464. continue;
  465. }
  466. // If anything bad happens, we will quit.
  467. if(!mysql_query($command))
  468. {
  469. // Oh noes! Something bad happened!
  470. $error_msg[] = 'MySQL Error: ['. mysql_errno(). '] '. mysql_error();
  471. // Rollback! Quick!
  472. mysql_query('ROLLBACK');
  473. // Quit!
  474. return false;
  475. }
  476. }
  477. // Seems to be all good.
  478. mysql_query('COMMIT');
  479. // Let's create your account now, shall we?
  480. mysql_query('
  481. INSERT INTO `'. TBLPREFIX. 'members`
  482. (`member_name`, `member_pass`, `member_email`, `display_name`, `member_groups`, `member_registered`, `member_activated`)
  483. VALUES(\''. mysql_real_escape_string(htmlspecialchars($member_name, ENT_QUOTES)). '\', \''. mysql_real_escape_string(sha1(strtolower($member_name). $member_pass)). '\', \''. mysql_real_escape_string(htmlspecialchars($member_email, ENT_QUOTES)). '\', \''. mysql_real_escape_string(htmlspecialchars($member_name, ENT_QUOTES)). '\', \'administrator\', \''. time(). '\', 1)');
  484. return true;
  485. }
  486. /*
  487. Function: rand_str
  488. Generates a random string, randomly... Of course!
  489. Parameters:
  490. int $length
  491. Returns:
  492. void
  493. Note:
  494. Well, it's as random as a random number can be... Well, what I could
  495. think of anyway. :-P
  496. */
  497. function rand_str($length = 0)
  498. {
  499. if(empty($length) || $length < 1)
  500. {
  501. $length = mt_rand(1, 100);
  502. }
  503. $chars = array(
  504. 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
  505. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  506. '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '~', '!', '@', '#', '$', '%', '^', '*', '-', '_', '+', '=', '?',
  507. );
  508. $str = '';
  509. for($i = 0; $i < $length; $i++)
  510. {
  511. $str .= $chars[array_rand($chars)];
  512. }
  513. return $str;
  514. }
  515. /*
  516. Function: setup_step_3
  517. Finishes the installation process by, well, deleting stuff!
  518. Parameters:
  519. none
  520. Returns:
  521. void
  522. */
  523. function setup_step_3()
  524. {
  525. // Delete some stuff... If we aren't in dev mode.
  526. if(!defined('INDEVMODE') || !INDEVMODE)
  527. {
  528. unlink(__FILE__);
  529. unlink(dirname(__FILE__). '/setup-mysql.sql');
  530. unlink(dirname(__FILE__). '/setup-sqlite.sql');
  531. }
  532. require_once(dirname(__FILE__). '/config.php');
  533. template_header(3);
  534. echo '
  535. <h1>You&#039;re Ready to Go!</h1>
  536. <p>You&#039;re <a href="', baseurl, '">new site is all set</a> and ready to go!</p>
  537. <p>Thanks again for choosing SnowCMS for your content management needs. If you need any help, check out <a href="http://www.snowcms.com/" target="_blank">www.snowcms.com</a>.</p>';
  538. template_footer();
  539. }
  540. /*
  541. Function: template_header
  542. Parameters:
  543. int $step
  544. Returns:
  545. void
  546. */
  547. function template_header($step = 0)
  548. {
  549. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  550. <html xmlns="http://www.w3.org/1999/xhtml">
  551. <head>
  552. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  553. <meta name="robots" content="noindex" />
  554. <title>SnowCMS Installer</title>
  555. <style style="text/css">
  556. body
  557. {
  558. font-family: Verdana, Tahoma, Arial, sans-serif;
  559. font-size: 13px;
  560. background: #F5F5F5;
  561. }
  562. #container
  563. {
  564. width: 600px;
  565. margin: auto;
  566. background: white;
  567. border: 1px solid #CCCCCC;
  568. }
  569. #current-step
  570. {
  571. padding: 0 10px;
  572. border-bottom: 1px solid #CCCCCC;
  573. }
  574. #current-step .header
  575. {
  576. font-size: 32px;
  577. font-family: Georgia;
  578. color: #CCCCCC;
  579. }
  580. #current-step .current
  581. {
  582. color: black !important;
  583. }
  584. #current-step sub
  585. {
  586. font-family: Verdana, Tahoma, Arial, sans-serif !important;
  587. font-size: 13px !important;
  588. }
  589. #content
  590. {
  591. padding: 0 10px;
  592. }
  593. #content h1
  594. {
  595. font-family: Georgia;
  596. font-size: 24px;
  597. font-weight: normal;
  598. }
  599. #content form .label
  600. {
  601. font-size: 15px;
  602. }
  603. #content form input[type="text"], #content form input[type="password"]
  604. {
  605. font-family: Verdana, Tahoma, Arial, sans-serif;
  606. font-size: 15px;
  607. padding: 3px;
  608. }
  609. #content form input[type="submit"]
  610. {
  611. font-family: Verdana, Tahoma, Arial, sans-serif;
  612. }
  613. #footer
  614. {
  615. border-top: 1px solid #CCCCCC;
  616. padding: 10px;
  617. text-align: center;
  618. }
  619. #footer p
  620. {
  621. margin: 0;
  622. padding: 0;
  623. }
  624. .green
  625. {
  626. color: green !important;
  627. }
  628. .red
  629. {
  630. color: red !important;
  631. }
  632. .bold
  633. {
  634. font-weight: bold !important;
  635. }
  636. .error-message
  637. {
  638. margin: 10px 0;
  639. padding: 10px 0 5px 0;
  640. background: #FFCCCC;
  641. border: 1px solid #B22222;
  642. text-align: center;
  643. }
  644. </style>
  645. </head>
  646. <body>
  647. <div id="container">
  648. <div id="current-step">
  649. <p><span class="header', $step == 1 ? ' current' : '', '">Step 1</span> <sub>Configure</sub> <span class="header current">&gt;</span> <span class="header', $step == 2 ? ' current' : '', '">Step 2</span> <sub>Create Account</sub> <span class="header current">&gt;</span> <span class="header', $step == 3 ? ' current' : '', '">Finished</span> <sub>Enjoy!</sub></p>
  650. </div>
  651. <div id="content">';
  652. }
  653. /*
  654. Function: template_footer
  655. Parameters:
  656. none
  657. Returns:
  658. void
  659. */
  660. function template_footer()
  661. {
  662. echo '
  663. </div>
  664. <div id="footer">
  665. <p>Thank you for choosing <a href="http://www.snowcms.com/" target="_blank">SnowCMS</a> for your content management solution!</p>
  666. </div>
  667. </div>
  668. </body>
  669. </html>';
  670. }
  671. ?>