Browse files

rename ini files, add phpinfo.php

  • Loading branch information...
1 parent 1c78883 commit 390e6d7ebf17eed926b3ab4ea707164b4551959c Ubuntu committed Jun 9, 2011
Showing with 873 additions and 269 deletions.
  1. +1 −0 .gitignore
  2. +293 −0 config.ini
  3. +308 −0 inc.php
  4. +265 −265 lib/Lampcms/Ini.php
  5. +2 −2 sitemap.php
  6. +1 −1 www/index.php
  7. +2 −0 www/phpinfo.php
  8. +1 −1 www/twitter.php
View
1 .gitignore
@@ -0,0 +1 @@
+logs
View
293 config.ini
@@ -0,0 +1,293 @@
+[DB]
+Database_name=LAMPCMS
+Database_host=localhost
+TCP_Port_number=
+Database_type=mysql
+Database_username=
+Database_password=
+Persistent = 0
+
+[MONGO]
+server = "mongodb://127.0.0.2:27017"
+db = "LAMPCMS"
+
+[CACHE_MONGO]
+; good option to use the same db as in "MONGO" section
+db = "LAMPCMS"
+collection = "C_Cache"
+
+[CONSTANTS]
+; set to true when debugging to enable
+; debug log and raize error reporting level
+DEBUG = true
+; maximum commets per item
+; set to 0 to disable comments feature
+MAX_COMMENTS = 20
+; max comments to show per item
+SHOW_COMMENTS = 5
+;
+; Time interval in minutes in which poster can edit
+; the comment. After this time editing
+; is no longer allowed
+; set to 0 to disable edit timeout
+COMMENT_EDIT_TIME = 5
+; time to wait between comments
+; in seconds
+COMMENTS_FLOOD_TIME = 30
+;
+; time to wait between posting
+; questions and answers in minutes
+;
+FLOOD_CHECK_TIME = 2
+; number of items per page
+; on search results page
+PER_PAGE_SEARCH = 10
+; number of answers per page
+; on the question page page
+PER_PAGE_ANSWERS = 20
+; number of questions per page
+; on pages like home page or unanswered
+PER_PAGE_QUESTIONS = 20
+; number of questions per page
+; on pages like home page or unanswered
+PER_PAGE_USERS = 15
+; This will be used in some page as title as well as in some emails as 'From' name
+SITE_TITLE = "LampCms Q and A site"
+SITE_NAME ="LampCMS project"
+;Default language
+DEFAULT_LANG = en
+;set timezone of the server.
+;Must be correct name,
+;see names here: http://us2.php.net/manual/en/timezones.php
+SERVER_TIMEZONE = America/Chicago
+;
+;Set this to true if you dont want to use cache
+;or if you think cache is causing problems
+;or if you are developing new feature
+;of if you dont have memcache at all
+;
+SKIP_CACHE = false
+;
+;Leave at null unless
+;you need to set cookie under some
+;global domain.
+;For example if your Q and A site is on
+;qa.oursite.com
+;but you want to be able to access cookie
+;of oursite.com, then you
+;should set this value
+;
+COOKIE_DOMAIN = null
+;
+;system path to temporary directory. Must we writable to php
+;
+TEMP_DIR = /tmp
+;
+;Some configuration constants
+;Leave black if you host images, css and js
+;on the same server as this program,
+;otherwise defile the full path to domain + dir
+;where the files reside, without the '/' at the end
+;
+IMAGE_SITE = ""
+CSS_SITE = ""
+JS_SITE = ""
+AVATAR_IMG_SITE = ""
+;site of square avatar in pixels
+AVATAR_SQUARE_SIZE= 40
+;
+;Name of GeoIP file - must be in the LAMPCMS_DIR (root dir of program)
+;Download it from maxmind.com
+;http://www.maxmind.com/app/geolitecity
+;
+GEOIP_FILE = GeoLiteCity.dat
+;
+;
+; Set the LOG_PER_SCRIPT to true (default)
+; to always reset log fine for
+; each new script
+; Logging is enabled in debugging mode only
+;
+LOG_PER_SCRIPT = true
+; set LOG_FILE_PATH to point to your writable log file to enable logging
+; for example: /usr/local/apache/sites/qa.lampcms.com/logs/php.log
+LOG_FILE_PATH = /var/www/qa.kinbou.com/logs/php.log
+;/usr/local/apache/sites/lampcms.com/logs/cgiphp.log
+LOG_FILE_PATH_CGI = /var/www/qa.kinbou.com/logs/cgiphp.log
+;
+; base url of your main website. Required value!
+SITE_URL="http://qa.kinbou.com"
+; system path to root directory (the one that contains this file)
+LAMPCMS_PATH ="/"
+; system path to directory that is accessable via browser as /w/
+LAMPCMS_DATA_DIR =
+;
+POSTFIX_PATH = /usr/sbin/sendmail
+;
+; email address of developer.
+; Developer will be notified of php errors and various bad situations on the site //message@ptd.net
+EMAIL_DEVELOPER = "me@me.me"
+; email address of admin. Admin will also be notified on important events and errors
+EMAIL_ADMIN = "me@me.me"
+;
+; emails to new registrations sent from this domain
+EMAIL_DOMAIN =
+; Make sure to set the value of SALT to a random string of about 40 chars
+; then write it down and store it like gold!
+; and never change it again!
+; if it's lost, you will not be able to authenticate
+; any existing users - users will never be able to login!
+SALT = 'abcdefg';
+
+;Enter some random string BEFORE launching your site
+;but DONT EVER CHANGE IT AFTER
+;you launched your site, otherwise users will not be
+;able to auto-login to site using the 'remember me' cookie
+COOKIE_SALT = 'abcde1234512345'
+;
+; Show page render time in footer?
+; set to true to have "Page generated in .... seconds
+; added to bottom of pages
+SHOW_TIMER = false;
+; If using Google friend connect, then you need to have the site id
+; sing up with Google Friend Connect first and get your site id
+; Create account here http://www.google.com/friendconnect/
+; After you signup and reviewing your site's settings,
+; the id will be in url of the browser, for example:
+; http://www.google.com/friendconnect/admin/site/overview?id=231123423423
+;
+GFC_ID =
+;
+; disable autocomplete widget
+; in search form and in Title in "Ask" form
+; Autocomplete does send request to server
+; on every key press, and search by title tags
+; is run on server.
+; This is fast process and does
+; not add much load to server but if you
+; still don't want it then set this to true
+; to disable autocomplete
+;
+DISABLE_AUTOCOMPLETE = false
+
+[CAPTCHA]
+; to disable captcha for any reason
+; set disabled = true
+; When disabled, captcha will
+; not be added to forms
+disabled = false
+; change this to something between 3 and 25
+secretposition = 15
+; Change this to any random string. CHANGE it to something unique!
+secretstring = "Stuff for captcha"
+; maximum captcha errors. After this ip will be blocked for awhile
+maxtry = 5
+
+; GRAVATAR SUPPORT
+; to Disable automatic
+; use of gravatar for new user's avatars
+; remove the every value of just comment
+; our every value in this section by prefixing the line
+; with the semicolon ;
+; DO NOT REMOVE OR COMMENT OUT this section though!
+[GRAVATAR]
+; base url to gravatar site
+; must have trailing slash (its a directory)
+url = http://www.gravatar.com/avatar/
+
+; default size of avatars
+; we will slightly resize this image
+; from between 32 and 50, so 45 is a good size
+; also when we display the 40x40 avatar some
+; browsers that are not able to resize the
+; background image will just cut-off the excess from
+; bottom and from right, so setting it close to 40 px
+; is good way to avoid having too much cut off the image
+size = 44
+
+; fallback when user does not have actual
+; image of gravatar. This can be identicon or monsterid
+; Check with gravatar.com documentation for fallback options
+fallback = identicon
+
+; rating defaults to PG
+rating = PG
+
+
+[LOGIN_ERROR_LOCK]
+;in what number of seconds login errors occured.
+interval = 360
+;how many seconds since latest login error user must wait before allowed to try again
+wait = 300
+;number of login failures. After this many login failures withing interval
+max_errors = 4
+
+
+
+[MY_IP]
+; list values of ip addresses of developers
+; access from these ips will result in extra debugging console for javascript
+; as well as sql debugging data added to the pages
+; values should be added like this (one per line): 192.168.1.1=office
+; here the word office if for your own info, you can add another ip for
+; your home and add it on another line: 192.168.1.2=home
+; You can add as many as you like
+127.0.0.1=home
+127.0.0.2=home1
+
+[TWITTER]
+; API_KEY is needed for the @anywhere JS library only
+; get api key and secret from here http://dev.twitter.com/apps/new
+; When creating new application on Twitter Website MAKE SURE
+; to select READ AND WRITE access (not just READ, else it would not work)
+;
+API_KEY =
+; twitter consumer key and consumer secret for oauth
+TWITTER_OAUTH_KEY =
+TWITTER_OAUTH_SECRET =
+; account name that we use on twitter. We may tweet from it
+; we may also add new user to follow this account when they
+; join
+TWITTER_USERNAME =
+
+[FACEBOOK]
+; Get your APP_ID and API_SECRET here:
+; http://developers.facebook.com/setup/
+; To setup new application and get API_KEY
+; go here: http://www.facebook.com/developers/
+;
+; user picture is not in any json, its simply this:
+; http://graph.facebook.com/$UID/picture
+API_KEY =
+APP_ID =
+APP_SECRET =
+; YOU MUST at least require the email in EXTENDED_PERMS
+; so that you can create email record for facebook user
+; You should require publish_stream also if
+; you want to post something to user 'wall'
+EXTENDED_PERMS = "email,publish_stream,offline_access"
+POST_TO_WALL = true
+
+; Custom classes that extend LampcmsObserver
+; can be listed here and they will be automatically
+; registered as observers
+; see clsFloodCheck for an example on how to use it
+[OBSERVERS]
+;questionView = "Viewobserver"
+;
+; Order is important
+; since each observer can halt the processing
+; of script, make sure to put most important ones first
+; and most resource-intensive last
+; Make sure Names are Unique - cannot use same filter name twice!
+[INPUT_FILTERS]
+ipFilter= "\\Lampcms\\Modules\\Observers\\IpFilter"
+floodCheck = "\\Lampcms\\Modules\\Observers\\FloodCheck"
+questionSimilar = "\\Lampcms\\Modules\\Observers\\Similars"
+EmailNotifier = "\\Lampcms\\Modules\\Observers\\EmailNotifier"
+
+[CURL]
+; primary ip address from which curl will connect
+ip = "127.0.0.1"
+; secondary ip address
+ip2 = "127.0.0.2"
View
308 inc.php
@@ -0,0 +1,308 @@
+<?php
+/**
+ *
+ * PHP 5.3 or better is required
+ *
+ * @package Global functions
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * @author Dmitri Snytkine <cms@lampcms.com>
+ * @copyright 2005-2011 (or current year) ExamNotes.net inc.
+ * @license http://www.gnu.org/licenses/gpl-3.0.txt The GNU General Public License (GPL) version 3
+ * @link http://cms.lampcms.com Lampcms.com project
+ * @version Release: @package_version@
+ *
+ *
+ */
+
+error_reporting(E_ALL | E_DEPRECATED);
+ini_set('display_errors', 1);
+ini_set('display_startup_errors', 1);
+
+/**
+ * Set all the multibyte
+ * functions to use UTF-8
+ * as internal encoding
+ */
+if(function_exists('mb_internal_encoding')){
+ mb_internal_encoding("UTF-8");
+}
+
+function exception_handler($e)
+{
+ echo 'Eeeeee '.$e->getMessage()."\n<br>";
+ try {
+ $strHtml = 'ooopsy... '.Lampcms\Responder::makeErrorPage('<strong>Error:</strong> '.Lampcms\Exception::formatException($e));
+ $extra = (isset($_SERVER)) ? ' $_SERVER: '.print_r($_SERVER, 1) : ' no extra';
+ mail(DEVELOPER_EMAIL, 'ErrorHandle in inc.php', $strHtml.$extra);
+ exit ($strHtml);
+ }catch(\Exception $e) {
+ echo 'Error in Exception handler: : '.$e->getMessage().' line '.$e->getLine().$e->getTraceAsString();
+ }
+}
+
+/**
+ * if php NOT running as fastcgi
+ * then we need to create a dummy function
+ *
+ */
+if(!function_exists('fastcgi_finish_request')){
+ function fastcgi_finish_request(){}
+}
+
+set_exception_handler('exception_handler');
+
+define('LAMPCMS_PATH', realpath(dirname(__FILE__)));
+$libDir = LAMPCMS_PATH.DIRECTORY_SEPARATOR.'lib';
+$lampcmsClasses = $libDir.DIRECTORY_SEPARATOR.'Lampcms'.DIRECTORY_SEPARATOR;
+
+require $lampcmsClasses.'Interfaces'.DIRECTORY_SEPARATOR.'All.php';
+require $lampcmsClasses.'Exception.php';
+require $lampcmsClasses.'Object.php';
+require $lampcmsClasses.'Ini.php';
+require $lampcmsClasses.'Log.php';
+require $lampcmsClasses.'Request.php';
+require $lampcmsClasses.'Mongo.php';
+require $lampcmsClasses.'MongoDoc.php'; // User extends it
+require $lampcmsClasses.'User.php'; // User is always used
+require $lampcmsClasses.'SplClassLoader.php';
+require $lampcmsClasses.'Registry.php';
+require $lampcmsClasses.'Template'.DIRECTORY_SEPARATOR.'Template.php';
+
+
+
+/**
+ * Custom error handle
+ * the purpose of this is to catch
+ * the catchable fatal error, intoduced in php 5.2.0
+ * We use it with type hinting in class constructors
+ * if the object passed to class constructor is not of the same type
+ * as hinted, it generates a catchable fatal error.
+ * The only way to catch it in the normal way is to set custom error handler
+ * like this one, then re-throw exception and it will then be caught.
+ *
+ * This error handler also turns any php error into
+ * a ErrorException
+ *
+ * So almost any error will be displayed in a better way on
+ * the page, will be logged and email will be sent to admin.
+ *
+ *
+ * @param integer $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param integer $errline
+ * @return true
+ */
+function LampcmsErrorHandler($errno, $errstr, $errfile, $errline)
+{
+ $errLevel = error_reporting();
+ //echo 'Booooooooo ' .$errLevel. ' '.$errno.' '. $errstr.' '. $errfile.' '. $errline.'<br>';
+
+ if ($errno === E_RECOVERABLE_ERROR) {
+
+ d($errfile.' '.$errline.' '.$errstr);
+ $e = 'Caught catchable fatal error in file: %1$s<br>
+ on line: %2$s
+ <br><br>
+ Error message: <br>
+ %3$s<br>';
+
+ $err = vsprintf($e, array($errfile, $errline, $errstr));
+
+ throw new Lampcms\DevException($err);
+
+ } else {
+
+ if ($errLevel === 0) {
+
+ return;
+ }
+ /**
+ * If error level falls within our
+ * error reporting mask, then throw an ErrorException
+ */
+ if ($errLevel & $errno) {
+ //d('cp');
+ throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
+ }
+ }
+
+ return true;
+}
+
+$old_error_handler = set_error_handler("LampcmsErrorHandler");
+
+/**
+ * Autoloader for vtemplates
+ *
+ * @param string $classname
+ */
+function templateLoader($className){
+
+ //d('className: '.$className);
+
+ /**
+ * This is important
+ * This autoloader will be the first
+ * one in the __autoload stack (we pass true as 3rd arg
+ * to spl_autoload_register())
+ *
+ * Since this autoload can only
+ * handle template files, any file
+ * not starting with 'tpl' is not
+ * the responsibility of this loader
+ * and we must return false to save further
+ * pointless processing.
+ */
+ if(0 !== strpos($className, 'tpl') ){
+
+ return false;
+ }
+
+ $styleId = (defined('STYLE_ID')) ? STYLE_ID : '1';
+ $dir = (defined('VTEMPLATES_DIR')) ? VTEMPLATES_DIR : 'www';
+
+ $file = LAMPCMS_WWW_DIR.'style'.DIRECTORY_SEPARATOR.STYLE_ID.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$className.'.php';
+ d('looking for template file : '.$file);
+
+ /**
+ * Smart fallback to www dir
+ * if template does not exist in mobile version
+ * But if template file also does not exist in www
+ * and in mobile dir, then it will raise an error
+ * beause we using require this time instead in include && ('www' !== $dir)
+ */
+ if( ( false === include($file)) && ('www' !== $dir) ){
+ d('Unable to include template file '.$file.' looking if www dir');
+
+ require LAMPCMS_WWW_DIR.'style'.DIRECTORY_SEPARATOR.STYLE_ID.DIRECTORY_SEPARATOR.'www'.DIRECTORY_SEPARATOR.$className.'.php';
+ }
+
+ return true;
+}
+
+$oLoader = new Lampcms\SplClassLoader(null, $libDir);
+$oLoader->register();
+spl_autoload_register('templateLoader', false, true);
+$oRegistry = \Lampcms\Registry::getInstance();
+
+try{
+
+ $oINI = $oRegistry->Ini;
+ $dataDir = $oINI->LAMPCMS_DATA_DIR;
+ $dataDir = rtrim($dataDir, '/');
+
+ define('LAMPCMS_WWW_DIR', LAMPCMS_PATH.DIRECTORY_SEPARATOR.\Lampcms\WWW_DIR.DIRECTORY_SEPARATOR);
+ define('DEVELOPER_EMAIL', $oINI->EMAIL_DEVELOPER);
+ define('LAMPCMS_SALT', $oINI->SALT);
+ define('COOKIE_SALT', $oINI->COOKIE_SALT);
+ define('DEFAULT_LANG', $oINI->DEFAULT_LANG);
+ define('COOKIE_DOMAIN', $oINI->COOKIE_DOMAIN);
+ define('IMAGE_SITE', $oINI->IMAGE_SITE);
+ define('GEOIP_FILE', $oINI->GEOIP_FILE);
+ define('AVATAR_IMG_SITE', $oINI->AVATAR_IMG_SITE);
+
+ if (!empty($dataDir)) {
+ define('LAMPCMS_DATA_DIR', $dataDir.DIRECTORY_SEPARATOR);
+ } else {
+ define('LAMPCMS_DATA_DIR', LAMPCMS_WWW_DIR.'w'.DIRECTORY_SEPARATOR);
+ }
+
+} catch(Lampcms\IniException $e){
+ exit($e->getMessage());
+}
+
+
+/**
+ * First thing is to set our timezone
+ */
+if (false === date_default_timezone_set($oINI->SERVER_TIMEZONE)) {
+ throw new \Lampcms\DevException('Invalid name of "SERVER_TIMEZONE" in !config.ini constant. The list of valid timezone names can be found here: http://us.php.net/manual/en/timezones.php');
+}
+
+/**
+ * The DEBUG is automatically enabled for
+ * users whose ip addresses are added to
+ * MY_IP section of config.inc
+ * or if script is run from console
+ */
+$myIP = \Lampcms\Request::getIP();
+
+$aMyIPs = $oINI->offsetGet('MY_IP');
+$debug = $oINI->DEBUG;
+
+if ($debug || isset($aMyIPs[$myIP]) || defined('SPECIAL_LOG_FILE')) {
+ define('LAMPCMS_DEBUG', true);
+ error_reporting(E_ALL | E_DEPRECATED);
+ ini_set('display_errors', 1);
+ ini_set('display_startup_errors', 1);
+ ini_set('warn_plus_overloading', 1);
+} else {
+ define('LAMPCMS_DEBUG', false);
+ error_reporting(E_ALL ^ E_WARNING);
+ ini_set('display_errors', 0);
+ ini_set('display_startup_errors', 0);
+ ini_set('warn_plus_overloading', 0);
+}
+
+define('LOG_FILE_PATH', $oINI->LOG_FILE_PATH);
+
+/**
+ * Empty the log file if
+ * necessary
+ */
+/**
+ * LOG_PER_SCRIPT
+ * will return string '1' for true
+ * or empty string for false
+ */
+if((true === LAMPCMS_DEBUG) && ('' !== LOG_FILE_PATH) && (true === (bool)$oINI->LOG_PER_SCRIPT) && !\Lampcms\Request::isAjax()){
+
+ file_put_contents(LOG_FILE_PATH, PHP_SAPI.' '.print_r($_SERVER, 1), LOCK_EX);
+}
+
+/**
+ * Shortcuts to log debug and log error
+ * MUST BE CALLED after DEBUG MODE and LOG_FILE_PATH
+ * has been defined
+ */
+function d($message){
+ if(true === LAMPCMS_DEBUG){
+ \Lampcms\Log::d($message, 2);
+ }
+}
+
+function e($message){
+ \Lampcms\Log::e($message, 2);
+}
+
+
+/**
+ * Must be called here AFTER autoloaders have
+ * been registered because it relies on autoloaders
+ * to find observer classes
+ */
+$oRegistry->registerObservers();
+
View
530 lib/Lampcms/Ini.php
@@ -1,265 +1,265 @@
-<?php
-/**
- *
- * License, TERMS and CONDITIONS
- *
- * This software is lisensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
- * Please read the license here : http://www.gnu.org/licenses/lgpl-3.0.txt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * ATTRIBUTION REQUIRED
- * 4. All web pages generated by the use of this software, or at least
- * the page that lists the recent questions (usually home page) must include
- * a link to the http://www.lampcms.com and text of the link must indicate that
- * the website's Questions/Answers functionality is powered by lampcms.com
- * An example of acceptable link would be "Powered by <a href="http://www.lampcms.com">LampCMS</a>"
- * The location of the link is not important, it can be in the footer of the page
- * but it must not be hidden by style attibutes
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * This product includes GeoLite data created by MaxMind,
- * available from http://www.maxmind.com/
- *
- *
- * @author Dmitri Snytkine <cms@lampcms.com>
- * @copyright 2005-2011 (or current year) ExamNotes.net inc.
- * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
- * @link http://www.lampcms.com Lampcms.com project
- * @version Release: @package_version@
- *
- *
- */
-
-
-
-namespace Lampcms;
-
-
-/**
- * Object represents the parsed !config.ini file
- * has accessorts for the whole section via getSection
- * or access values from the CONSTANTS section via
- * the magic __get method like this:
- * oIni->ADMIN_EMAIL
- *
- *
- * @author admin
- *
- */
-class Ini extends LampcmsArray
-{
-
- protected static $oIni = null;
-
-
- public function __construct()
- {
- $iniFile = LAMPCMS_PATH.DIRECTORY_SEPARATOR.'!config.ini';
-
- $aIni = parse_ini_file($iniFile, true);
-
- if ( empty ($aIni)) {
- throw new IniException('Unable to parse ini file: '.$iniFile.' probably a syntax error in file');
- }
-
- parent::__construct($aIni);
- }
-
-
- /**
- * Magic method to get
- * a value of config param
- * from ini array's CONSTANTS section
- *
- * @return string a value of $name
- * @param string $name
- * @throws LampcmsIniException if $name
- * does not exist as a key in this->aIni
- *
- */
- public function __get($name)
- {
- if (!$this->offsetExists('CONSTANTS')) {
- throw new IniException('"CONSTANTS" section of ini file is missing');
- }
-
- $aConstants = $this->offsetGet('CONSTANTS');
-
- if ('TEMP_DIR' === $name) {
- if (!empty($aConstants['TEMP_DIR'])) {
-
- $tmpDir = rtrim($aConstants['TEMP_DIR'], '/');
- $tmpDir .= DIRECTORY_SEPARATOR;
-
- return $tmpDir;
- }
-
- return LAMPCMS_DATA_DIR.'tmp'.DIRECTORY_SEPARATOR;
- }
-
-
-
- if (!array_key_exists($name, $aConstants)) {
-
- throw new IniException('Error: configuration param: '.$name.' does not exist');
- }
-
- if ('MAGIC_MIME_FILE' === $name) {
- if (!empty($aConstants['MAGIC_MIME_FILE']) && !is_readable($aConstants['MAGIC_MIME_FILE']) ) {
- throw new IniException('magic mime file does not exist in this location or not readable: '.$aConstants['MAGIC_MIME_FILE']);
- }
- }
-
- switch($name){
- case 'SITE_URL':
- if(empty($aConstants['SITE_URL'])){
- throw new Exception('Value of SITE_URL in !config.inc file SHOULD NOT be empty!');
- }
-
- $ret = rtrim($aConstants['SITE_URL'], '/');
- break;
-
- /**
- * If these constants are not specifically set
- * then we should return the path to our
- * main website.
- * This is because we need to use absolute url, not
- * relative url for these.
- * The reason is if using virtual hosting, then
- * relative urls will point to just /images/
- * so they will actually resolve to individual's own domain + path
- * for example http://somedude.outsite.com/images/
- * and on another user's site http://johnny.oursite.com/images/
- * This will cause chaos in browser caching.
- * Browser will think (rightfully so) that these are different sites.
- *
- * That's why we must point to our main site
- * for all images, css, js, etc... so that no matter whose
- * site we are on the browser can use cached files and most
- * importantly will not keep storing the same images in cache for each
- * sub-domain
- */
- case 'THUMB_IMG_SITE':
- case 'ALBUM_THUMB_SITE':
- case 'ORIG_IMG_SITE':
- case 'AVATAR_IMG_SITE':
- case 'IMG_SITE':
- case 'JS_SITE':
- case 'CSS_SITE':
- $ret = (empty($aConstants[$name])) ? $this->__get('SITE_URL') : rtrim($aConstants[$name], '/');
- break;
-
- case 'WWW_DIR':
- case 'EMAIL_ADMIN':
- if(empty($aConstants[$name])){
- throw new Exception($name.' parametr in !config.inc file has not been set! Please make sure it is set');
- }
-
- $ret = trim($aConstants[$name], "\"'");
- break;
-
- case 'LOG_FILE_PATH':
- if((substr(PHP_SAPI, 0, 3) === 'cli') || (substr(PHP_SAPI, 0, 3) === 'cgi')){
- $ret = $aConstants['LOG_FILE_PATH_CGI'];
- } else {
- $ret = $aConstants['LOG_FILE_PATH'];
- }
- break;
-
- default:
- $ret = $aConstants[$name];
- break;
- }
-
- return $ret;
- }
-
-
- /**
- *
- * @param string $name name of section in !config.ini file
- *
- * @return array associative array of
- * param => val of all params belonging to
- * one section in !config.ini file
- */
- public function getSection($name)
- {
- if(!$this->offsetExists($name)){
- d('no section '.$name.' in config file');
-
- throw new IniException('Section '.$name.' does not exist in config');
- }
-
- return $this->offsetGet($name);
- }
-
-
-
- /**
- * Creates and returns array of
- * some config params;
- *
- * This array is usually added as json object
- * to some of the pages that then use javascript
- * to get values from it.
- *
- * @return array
- */
- public function getSiteConfigArray()
- {
- $a = array();
-
- if('' !== $albThum = $this->ALBUM_THUMB_SITE){
- $a['ALBUM_THUMB_SITE'] = $albThum;
- }
-
- if('' !== $imgThum = $this->THUMB_IMG_SITE){
- $a['THUMB_IMG']= $imgThum;
- }
-
- if('' !== $imgSite = $this->IMG_SITE){
- $a['IMG_SITE']= $imgSite;
- }
-
- if('' !== $origSite = $this->ORIG_IMG_SITE){
- $a['ORIG_IMG_SITE']= $origSite;
- }
-
- if('' !== $avatarSite = $this->AVATAR_IMG_SITE){
- $a['AVATAR_IMG_SITE']= $avatarSite;
- }
-
- if('' !== $cssSite = $this->CSS_SITE){
- $a['CSS_SITE']= $cssSite;
- }
-
- if('' !== $jsSite = $this->JS_SITE){
- $a['JS_SITE']= $jsSite;
- }
-
-
- return $a;
- }
-
-}
-
+<?php
+/**
+ *
+ * License, TERMS and CONDITIONS
+ *
+ * This software is lisensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
+ * Please read the license here : http://www.gnu.org/licenses/lgpl-3.0.txt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * ATTRIBUTION REQUIRED
+ * 4. All web pages generated by the use of this software, or at least
+ * the page that lists the recent questions (usually home page) must include
+ * a link to the http://www.lampcms.com and text of the link must indicate that
+ * the website's Questions/Answers functionality is powered by lampcms.com
+ * An example of acceptable link would be "Powered by <a href="http://www.lampcms.com">LampCMS</a>"
+ * The location of the link is not important, it can be in the footer of the page
+ * but it must not be hidden by style attibutes
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This product includes GeoLite data created by MaxMind,
+ * available from http://www.maxmind.com/
+ *
+ *
+ * @author Dmitri Snytkine <cms@lampcms.com>
+ * @copyright 2005-2011 (or current year) ExamNotes.net inc.
+ * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE (LGPL) version 3
+ * @link http://www.lampcms.com Lampcms.com project
+ * @version Release: @package_version@
+ *
+ *
+ */
+
+
+
+namespace Lampcms;
+
+
+/**
+ * Object represents the parsed !config.ini file
+ * has accessorts for the whole section via getSection
+ * or access values from the CONSTANTS section via
+ * the magic __get method like this:
+ * oIni->ADMIN_EMAIL
+ *
+ *
+ * @author admin
+ *
+ */
+class Ini extends LampcmsArray
+{
+
+ protected static $oIni = null;
+
+
+ public function __construct()
+ {
+ $iniFile = LAMPCMS_PATH.DIRECTORY_SEPARATOR.'config.ini';
+
+ $aIni = parse_ini_file($iniFile, true);
+
+ if ( empty ($aIni)) {
+ throw new IniException('Unable to parse ini file: '.$iniFile.' probably a syntax error in file');
+ }
+
+ parent::__construct($aIni);
+ }
+
+
+ /**
+ * Magic method to get
+ * a value of config param
+ * from ini array's CONSTANTS section
+ *
+ * @return string a value of $name
+ * @param string $name
+ * @throws LampcmsIniException if $name
+ * does not exist as a key in this->aIni
+ *
+ */
+ public function __get($name)
+ {
+ if (!$this->offsetExists('CONSTANTS')) {
+ throw new IniException('"CONSTANTS" section of ini file is missing');
+ }
+
+ $aConstants = $this->offsetGet('CONSTANTS');
+
+ if ('TEMP_DIR' === $name) {
+ if (!empty($aConstants['TEMP_DIR'])) {
+
+ $tmpDir = rtrim($aConstants['TEMP_DIR'], '/');
+ $tmpDir .= DIRECTORY_SEPARATOR;
+
+ return $tmpDir;
+ }
+
+ return LAMPCMS_DATA_DIR.'tmp'.DIRECTORY_SEPARATOR;
+ }
+
+
+
+ if (!array_key_exists($name, $aConstants)) {
+
+ throw new IniException('Error: configuration param: '.$name.' does not exist');
+ }
+
+ if ('MAGIC_MIME_FILE' === $name) {
+ if (!empty($aConstants['MAGIC_MIME_FILE']) && !is_readable($aConstants['MAGIC_MIME_FILE']) ) {
+ throw new IniException('magic mime file does not exist in this location or not readable: '.$aConstants['MAGIC_MIME_FILE']);
+ }
+ }
+
+ switch($name){
+ case 'SITE_URL':
+ if(empty($aConstants['SITE_URL'])){
+ throw new Exception('Value of SITE_URL in !config.inc file SHOULD NOT be empty!');
+ }
+
+ $ret = rtrim($aConstants['SITE_URL'], '/');
+ break;
+
+ /**
+ * If these constants are not specifically set
+ * then we should return the path to our
+ * main website.
+ * This is because we need to use absolute url, not
+ * relative url for these.
+ * The reason is if using virtual hosting, then
+ * relative urls will point to just /images/
+ * so they will actually resolve to individual's own domain + path
+ * for example http://somedude.outsite.com/images/
+ * and on another user's site http://johnny.oursite.com/images/
+ * This will cause chaos in browser caching.
+ * Browser will think (rightfully so) that these are different sites.
+ *
+ * That's why we must point to our main site
+ * for all images, css, js, etc... so that no matter whose
+ * site we are on the browser can use cached files and most
+ * importantly will not keep storing the same images in cache for each
+ * sub-domain
+ */
+ case 'THUMB_IMG_SITE':
+ case 'ALBUM_THUMB_SITE':
+ case 'ORIG_IMG_SITE':
+ case 'AVATAR_IMG_SITE':
+ case 'IMG_SITE':
+ case 'JS_SITE':
+ case 'CSS_SITE':
+ $ret = (empty($aConstants[$name])) ? $this->__get('SITE_URL') : rtrim($aConstants[$name], '/');
+ break;
+
+ case 'WWW_DIR':
+ case 'EMAIL_ADMIN':
+ if(empty($aConstants[$name])){
+ throw new Exception($name.' parametr in !config.inc file has not been set! Please make sure it is set');
+ }
+
+ $ret = trim($aConstants[$name], "\"'");
+ break;
+
+ case 'LOG_FILE_PATH':
+ if((substr(PHP_SAPI, 0, 3) === 'cli') || (substr(PHP_SAPI, 0, 3) === 'cgi')){
+ $ret = $aConstants['LOG_FILE_PATH_CGI'];
+ } else {
+ $ret = $aConstants['LOG_FILE_PATH'];
+ }
+ break;
+
+ default:
+ $ret = $aConstants[$name];
+ break;
+ }
+
+ return $ret;
+ }
+
+
+ /**
+ *
+ * @param string $name name of section in !config.ini file
+ *
+ * @return array associative array of
+ * param => val of all params belonging to
+ * one section in !config.ini file
+ */
+ public function getSection($name)
+ {
+ if(!$this->offsetExists($name)){
+ d('no section '.$name.' in config file');
+
+ throw new IniException('Section '.$name.' does not exist in config');
+ }
+
+ return $this->offsetGet($name);
+ }
+
+
+
+ /**
+ * Creates and returns array of
+ * some config params;
+ *
+ * This array is usually added as json object
+ * to some of the pages that then use javascript
+ * to get values from it.
+ *
+ * @return array
+ */
+ public function getSiteConfigArray()
+ {
+ $a = array();
+
+ if('' !== $albThum = $this->ALBUM_THUMB_SITE){
+ $a['ALBUM_THUMB_SITE'] = $albThum;
+ }
+
+ if('' !== $imgThum = $this->THUMB_IMG_SITE){
+ $a['THUMB_IMG']= $imgThum;
+ }
+
+ if('' !== $imgSite = $this->IMG_SITE){
+ $a['IMG_SITE']= $imgSite;
+ }
+
+ if('' !== $origSite = $this->ORIG_IMG_SITE){
+ $a['ORIG_IMG_SITE']= $origSite;
+ }
+
+ if('' !== $avatarSite = $this->AVATAR_IMG_SITE){
+ $a['AVATAR_IMG_SITE']= $avatarSite;
+ }
+
+ if('' !== $cssSite = $this->CSS_SITE){
+ $a['CSS_SITE']= $cssSite;
+ }
+
+ if('' !== $jsSite = $this->JS_SITE){
+ $a['JS_SITE']= $jsSite;
+ }
+
+
+ return $a;
+ }
+
+}
+
View
4 sitemap.php
@@ -44,7 +44,7 @@
*
*/
-include THIS_PATH.'/!inc.php';
+include THIS_PATH.'/inc.php';
try{
$o = new \Lampcms\SiteMap();
$o->run();
@@ -54,4 +54,4 @@
echo 'Done';
-?>
+?>
View
2 www/index.php
@@ -52,7 +52,7 @@
define('INIT_TIMESTAMP', microtime());
-include '../!inc.php';
+include '../inc.php';
require($lampcmsClasses.'Base.php');
require($lampcmsClasses.'WebPage.php');
require($lampcmsClasses.'Forms'.DIRECTORY_SEPARATOR.'Form.php');
View
2 www/phpinfo.php
@@ -0,0 +1,2 @@
+<?php
+phpinfo();
View
2 www/twitter.php
@@ -57,7 +57,7 @@
*
* No actual page rendering will be taking place.
*/
-include '../!inc.php';
+include '../inc.php';
try {

0 comments on commit 390e6d7

Please sign in to comment.