Changeset 476
- Timestamp:
- Apr 26, 2014 5:06:03 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/examples/example.cli.php
r468 r476 5 5 * For details visit the project site: <http://trac.strangecode.com/codebase/> 6 6 * Copyright 2001-2012 Strangecode, LLC 7 * 7 * 8 8 * This file is part of The Strangecode Codebase. 9 9 * … … 12 12 * Free Software Foundation, either version 3 of the License, or (at your option) 13 13 * any later version. 14 * 14 * 15 15 * The Strangecode Codebase is distributed in the hope that it will be useful, but 16 16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 18 18 * details. 19 * 19 * 20 20 * You should have received a copy of the GNU General Public License along with 21 21 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 24 24 /* 25 25 * example.cli.php - An example of a command-line interface script using the Strangecode Codebase. 26 * 26 * 27 27 * 28 28 * @author Quinn Comendant <quinn@strangecode.com> … … 39 39 40 40 // First things first. Define the globally used directory paths. 41 // The parent directory of all application DocRoots , such as /home/user/www.example.com/42 define('COMMON_BASE', realpath( '../..'));41 // The parent directory of all application DocRoots. 42 define('COMMON_BASE', realpath(dirname(__FILE__) . '/../')); 43 43 44 44 // Set include path for all templates and libraries. … … 51 51 * CONFIG 52 52 ********************************************************************/ 53 54 // This will disable sessions and things not needed by a cli script. 55 define('_CLI', true); 53 56 54 57 // Include core libraries. … … 96 99 if (!$options) { 97 100 printf("%s: Syntax or usage error. Try '-h' if you are lost.\n", $this_script); 98 die(1); 101 die(1); 99 102 } 100 103 … … 134 137 135 138 OPTIONS: 136 139 137 140 -a Blah blah blah 138 141 -b Blah blah blah -
trunk/lib/App.inc.php
r475 r476 370 370 371 371 // Character set. This should also be printed in the html header template. 372 header('Content-type: text/html; charset=' . $this->getParam('character_set')); 372 if (!defined('_CLI')) { 373 header('Content-type: text/html; charset=' . $this->getParam('character_set')); 374 } 373 375 374 376 // Set the version of the codebase we're using. … … 377 379 $codebase_version = trim(file_get_contents($codebase_version_file)); 378 380 $this->setParam(array('codebase_version' => $codebase_version)); 379 header('X-Codebase-Version: ' . $codebase_version); 381 if (!defined('_CLI')) { 382 header('X-Codebase-Version: ' . $codebase_version); 383 } 380 384 } 381 385
Note: See TracChangeset
for help on using the changeset viewer.