[ Index ] |
PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 24 // Get INI values 25 if(is_file(PHPWCMS_TEMPLATE.'inc_script/felogin/felogin.ini.php')) { 26 27 $FELOGIN = parse_ini_file(PHPWCMS_TEMPLATE.'inc_script/felogin/felogin.ini.php', TRUE); 28 29 if(isset($FELOGIN['FELOGIN_LEVEL_DEPTH']) && isset($FELOGIN['FELOGIN_LEVEL_ID'])) { 30 31 define('FELOGIN_LEVEL_DEPTH', intval($FELOGIN['FELOGIN_LEVEL_DEPTH'])); 32 define('FELOGIN_LEVEL_ID', intval($FELOGIN['FELOGIN_LEVEL_ID'])); 33 34 define('FELOGIN_CHILD_LEVEL', FELOGIN_LEVEL_DEPTH + 1); 35 define('FELOGIN_CHILD_SUBLEVEL', FELOGIN_LEVEL_DEPTH + 2); 36 37 define('FELOGIN_LOGOUT_LINK', empty($FELOGIN['FELOGIN_LOGOUT_LINK']) ? 0 : trim($FELOGIN['FELOGIN_LOGOUT_LINK']) ); 38 define('FELOGIN_LOGOUT_GET_VALUE', empty($FELOGIN['FELOGIN_LOGOUT_GET_VALUE']) ? 'yes' : trim($FELOGIN['FELOGIN_LOGOUT_GET_VALUE']) ); 39 40 define('FELOGIN_LOGOUT_LINK_PREFIX', empty($FELOGIN['FELOGIN_LOGOUT_LINK_PREFIX']) ? '' : cleandblsquote($FELOGIN['FELOGIN_LOGOUT_LINK_PREFIX']) ); 41 define('FELOGIN_LOGOUT_LINK_SUFFIX', empty($FELOGIN['FELOGIN_LOGOUT_LINK_SUFFIX']) ? '' : cleandblsquote($FELOGIN['FELOGIN_LOGOUT_LINK_SUFFIX']) ); 42 43 define('FELOGIN_ERROR_PREFIX', empty($FELOGIN['FELOGIN_ERROR_PREFIX']) ? '<p class="error">' : cleandblsquote($FELOGIN['FELOGIN_ERROR_PREFIX']) ); 44 define('FELOGIN_ERROR_SUFFIX', empty($FELOGIN['FELOGIN_ERROR_SUFFIX']) ? '</p>' : cleandblsquote($FELOGIN['FELOGIN_ERROR_SUFFIX']) ); 45 46 define('FELOGIN_ERROR_EMPTY_USER', empty($FELOGIN['FELOGIN_ERROR_EMPTY_USER']) ? 'Insert your username' : $FELOGIN['FELOGIN_ERROR_EMPTY_USER']); 47 define('FELOGIN_ERROR_UNKNOWN_USER', empty($FELOGIN['FELOGIN_ERROR_UNKNOWN_USER']) ? 'Please proof, the user is unknow' : $FELOGIN['FELOGIN_ERROR_UNKNOWN_USER']); 48 define('FELOGIN_ERROR_EMPTY_PASS', empty($FELOGIN['FELOGIN_ERROR_EMPTY_PASS']) ? 'Insert your password' : $FELOGIN['FELOGIN_ERROR_EMPTY_PASS']); 49 define('FELOGIN_ERROR_WRONG_PASS', empty($FELOGIN['FELOGIN_ERROR_WRONG_PASS']) ? 'Wrong password' : $FELOGIN['FELOGIN_ERROR_WRONG_PASS']); 50 51 } 52 53 } 54 55 // check if we are in right section 56 if( defined('FELOGIN_LEVEL_DEPTH') && isset($LEVEL_ID[FELOGIN_LEVEL_DEPTH]) && $LEVEL_ID[FELOGIN_LEVEL_DEPTH] == FELOGIN_LEVEL_ID) { 57 58 if(isset($_GET['logout']) && $_GET['logout'] == FELOGIN_LOGOUT_GET_VALUE) { 59 unset($_SESSION['FELOGIN_IS_LOGGED'], $_SESSION['FELOGIN_USER_NAME']); 60 headerRedirect( PHPWCMS_URL . 'index.php' . (isset($LEVEL_ID[FELOGIN_CHILD_LEVEL]) ? '?id='.$LEVEL_ID[FELOGIN_CHILD_LEVEL] : ''), 401); 61 } 62 63 $FELOGIN_ERROR = array(); 64 65 if(isset($LEVEL_ID[FELOGIN_CHILD_LEVEL]) && isset( $FELOGIN[ $LEVEL_ID[FELOGIN_CHILD_LEVEL] ] ) ) { 66 67 $FELOGIN = $FELOGIN[ $LEVEL_ID[FELOGIN_CHILD_LEVEL] ]; 68 69 // OK, user is trying to login 70 if(isset($_POST['feSubmit'])) { 71 72 $FELOGIN_USER_NAME = empty($_POST['feLogin']) ? '' : slweg($_POST['feLogin']); 73 $FELOGIN_USER_PASS = empty($_POST['fePassword']) ? '' : slweg($_POST['fePassword']); 74 75 if(empty($FELOGIN_USER_NAME)) { 76 77 $FELOGIN_ERROR[] = FELOGIN_ERROR_EMPTY_USER; 78 unset($_SESSION['FELOGIN_IS_LOGGED'], $_SESSION['FELOGIN_USER_NAME']); 79 80 } elseif( !isset($FELOGIN[ $FELOGIN_USER_NAME ]) ) { 81 82 $FELOGIN_ERROR[] = FELOGIN_ERROR_UNKNOWN_USER; 83 unset($_SESSION['FELOGIN_IS_LOGGED'], $_SESSION['FELOGIN_USER_NAME']); 84 85 } else { 86 87 $_SESSION['FELOGIN_USER_NAME'] = $FELOGIN_USER_NAME; 88 89 if(empty($FELOGIN_USER_PASS)) { 90 91 $FELOGIN_ERROR[] = FELOGIN_ERROR_EMPTY_PASS; 92 unset($_SESSION['FELOGIN_IS_LOGGED']); 93 94 } elseif($FELOGIN[ $FELOGIN_USER_NAME ] !== $FELOGIN_USER_PASS) { 95 96 $FELOGIN_ERROR[] = FELOGIN_ERROR_WRONG_PASS; 97 unset($_SESSION['FELOGIN_IS_LOGGED']); 98 99 } else { 100 101 $_SESSION['FELOGIN_IS_LOGGED'] = $LEVEL_ID[FELOGIN_CHILD_LEVEL]; 102 103 } 104 105 } 106 107 } 108 109 110 // check if the user is logged in 111 if( empty($_SESSION['FELOGIN_IS_LOGGED']) || $_SESSION['FELOGIN_IS_LOGGED'] != $LEVEL_ID[FELOGIN_CHILD_LEVEL] ) { 112 113 // if user has opened deeper level, deny permission 114 if(isset($LEVEL_ID[FELOGIN_CHILD_SUBLEVEL])) { 115 116 headerRedirect( PHPWCMS_URL . 'index.php?id=' . $LEVEL_ID[FELOGIN_CHILD_LEVEL], 401); 117 118 } 119 120 foreach( $content['struct'] as $key => $value ) { 121 122 if( $content['struct'][$key]['acat_struct'] == $LEVEL_ID[FELOGIN_CHILD_LEVEL] ) { 123 $content['struct'][$key]['acat_regonly'] = 1; 124 } 125 126 } 127 128 define('FELOGIN_IS_LOGGED', false); 129 130 } else { 131 132 define('FELOGIN_IS_LOGGED', true); 133 134 if(FELOGIN_LOGOUT_LINK) { 135 $content['struct'][100000] = array( 136 137 'acat_id' => 100000, 138 'acat_name' => FELOGIN_LOGOUT_LINK, 139 'acat_info' => '', 140 'acat_struct' => FELOGIN_LEVEL_ID, 141 'acat_sort' => 10000, 142 'acat_hidden' => 0, 143 'acat_regonly' => 0, 144 'acat_ssl' => 0, 145 'acat_template' => 1, 146 'acat_alias' => '', 147 'acat_topcount' => -1, 148 'acat_maxlist' => 0, 149 'acat_redirect' => 'index.php?id='.FELOGIN_LEVEL_ID.'&logout='.FELOGIN_LOGOUT_GET_VALUE, 150 'acat_order' => 0, 151 'acat_timeout' => '', 152 'acat_nosearch' => '', 153 'acat_nositemap' => 1, 154 'acat_permit' => array(), 155 'acat_pagetitle' => '', 156 'acat_paginate' => 0, 157 'acat_overwrite' => '' 158 ); 159 160 } 161 162 } 163 164 } 165 166 } 167 168 function cleandblsquote($string) { 169 return trim( str_replace("''", '"', $string) ); 170 } 171 172 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Nov 16 22:51:00 2010 | Cross-referenced by PHPXref 0.7 |