Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 103 lines (89 sloc) 3.65 kb
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
1 <?php
2 /**
3 * Gallery - a web based photo album viewer and editor
c3c2b45 @bharat Update the copyright to 2010. It's only 3 months into the year :-)
bharat authored
4 * Copyright (C) 2000-2010 Bharat Mediratta
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 // Set this to true to disable demo/debugging controllers
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
21 define("IN_PRODUCTION", true);
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
22
23 // Gallery requires PHP 5.2+
8759828 @bharat If we fail the version check, at least show the version of PHP that t…
bharat authored
24 version_compare(PHP_VERSION, "5.2.3", "<") and
25 exit("Gallery requires PHP 5.2.3 or newer (you're using " . PHP_VERSION . ")");
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
26
92b1ae1 @bharat Require short_open_tag to be enabled, or die.
bharat authored
27 // Gallery requires short_tags to be on
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
28 !ini_get("short_open_tag") and exit("Gallery requires short_open_tag to be on.");
92b1ae1 @bharat Require short_open_tag to be enabled, or die.
bharat authored
29
94ab9fd @bharat Add a comment about error_reporting()
bharat authored
30 // Suppress errors. For information on how to debug Gallery 3, see:
31 // http://codex.gallery2.org/Gallery3:FAQ#How_do_I_see_debug_information.3F
1f7cec2 Change E_NONE -> 0 .. turns out E_NONE is a figment of my imagination…
bharat authored
32 error_reporting(0);
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
33
34 // Disabling display_errors will effectively disable Kohana error display
35 // and logging. You can turn off Kohana errors in application/config/config.php
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
36 ini_set("display_errors", false);
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
37
7d07190 @bharat Turn off session.use_trans_sid -- that feature attempts to inject ses…
bharat authored
38 // Turn off session.use_trans_sid -- that feature attempts to inject session ids
39 // into generated URLs and forms, but it doesn't interoperate will with Gallery's
40 // Ajax code.
41 ini_set("session.use_trans_sid", false);
42
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
43 define("EXT", ".php");
44 define("DOCROOT", getcwd() . "/");
45 define("KOHANA", "index.php");
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
46
47 // If the front controller is a symlink, change to the real docroot
f8b4c66 @bharat Set up unit test framework. Tweak configuration so that it only runs in
bharat authored
48 is_link(basename(__FILE__)) and chdir(dirname(realpath(__FILE__)));
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
49
50 // Define application and system paths
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
51 define("APPPATH", realpath("application") . "/");
52 define("MODPATH", realpath("modules") . "/");
53 define("THEMEPATH", realpath("themes") . "/");
54 define("SYSPATH", realpath("system") . "/");
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
55
6601481 @bharat refactor CLI support and add a help message.
bharat authored
56 // We only accept a few controllers on the command line
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
57 if (PHP_SAPI == "cli") {
6601481 @bharat refactor CLI support and add a help message.
bharat authored
58 switch ($arg_1 = $_SERVER["argv"][1]) {
65355c6 @talmdal Change the gallery3/index.php so there is a new option "install" whic…
talmdal authored
59 case "install":
60 include("installer/index.php");
61 exit(0);
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
62 case "upgrade":
63 case "package":
6601481 @bharat refactor CLI support and add a help message.
bharat authored
64 $_SERVER["argv"] = array("index.php", "{$arg_1}r/$arg_1");
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
65 define("TEST_MODE", 0);
66 define("VARPATH", realpath("var") . "/");
67 break;
68
69 case "test":
70 array_splice($_SERVER["argv"], 1, 1, "gallery_unit_test");
71 define("TEST_MODE", 1);
f1eed77 @bharat Tweak the test setup code to always copy database.php; something is
bharat authored
72 if (!is_dir("test/var")) {
73 @mkdir("test/var", 0777, true);
4ba02ad @bharat Don't recreate test/var/logs if it already exists. This fixes a
bharat authored
74 @mkdir("test/var/logs", 0777, true);
75 }
f1eed77 @bharat Tweak the test setup code to always copy database.php; something is
bharat authored
76 @copy("var/database.php", "test/var/database.php");
77 define("VARPATH", realpath("test/var") . "/");
d77f3a9 @bharat add a missing 'break' after running tests which caused tests not to
bharat authored
78 break;
6601481 @bharat refactor CLI support and add a help message.
bharat authored
79
80 default:
0b223d5 @bharat Clean up cli default instructions.
bharat authored
81 print "To install:\n";
82 print " php index.php install -d database -h host -u user -p password -x table_prefix \n\n";
83 print "To upgrade:\n";
84 print " php index.php upgrade\n\n";
85 print "Developer-only features:\n";
86 print " ** CAUTION! THESE FEATURES -WILL- DAMAGE YOUR INSTALL **\n";
2155a95 @bharat Warn the end user not to run test or package targets.
bharat authored
87 print " php index.php package # create new installer files\n";
88 print " php index.php test # run unit tests\n";
6601481 @bharat refactor CLI support and add a help message.
bharat authored
89 exit(1);
463b345 @talmdal Move the sql packaging code from installer into the gallery module. I…
talmdal authored
90 }
f8b4c66 @bharat Set up unit test framework. Tweak configuration so that it only runs in
bharat authored
91 } else {
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
92 define("TEST_MODE", 0);
93 define("VARPATH", realpath("var") . "/");
f8b4c66 @bharat Set up unit test framework. Tweak configuration so that it only runs in
bharat authored
94 }
f9d492b @bharat Create 3 separate CLI targets: test / package / upgrade
bharat authored
95 define("TMPPATH", VARPATH . "/tmp/");
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
96
567c911 @bharat Rename index.local.php to local.php so that tab completion on i<tab> …
bharat authored
97 if (file_exists("local.php")) {
98 include("local.php");
0a6249e @bharat Add support for index.local.php where you can override any existing s…
bharat authored
99 }
100
a69515e @bharat Placeholder app for Gallery3, along with a customized index.php and a…
bharat authored
101 // Initialize.
7dbb84b @bharat Bootstrap has moved in K24
bharat authored
102 require APPPATH . "Bootstrap" . EXT;
Something went wrong with that request. Please try again.