Changeset 674
- Timestamp:
- May 2, 2019 10:17:26 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/_config.inc.php
r572 r674 39 39 define('CODEBASE_PATH', realpath(dirname(__FILE__) . '/../')); 40 40 41 42 41 $db_auth_file = false; 43 42 if (!defined('_NODB')) { … … 51 50 } 52 51 if (!$db_auth_file) { 53 die(sprintf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND a db_auth file must exist within two directory levels.\n", $cli_executed)); 52 printf("%s error: the current directory must be common site directory (i.e. the parent directory of the document root) AND a db_auth file must exist within two directory levels.\n", $cli_executed); 53 exit(1); 54 54 } 55 55 if (fileowner($db_auth_file) != getmyuid()) { 56 die(sprintf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed)); 56 printf("%s error: you must execute this script as the owner of the web files.\n", $cli_executed); 57 exit(1); 57 58 } 58 59 } 59 60 60 61 // Set include path. 61 ini_set('include_path', get_include_path() . PATH_SEPARATOR . COMMON_BASE); 62 ini_set('include_path', join(PATH_SEPARATOR, array_unique(array( 63 '.', 64 COMMON_BASE, 65 dirname($db_auth_file) 66 )))); 62 67 63 68 /******************************************************************** … … 66 71 67 72 // Include core libraries. 68 require_once CODEBASE_PATH . '/lib/App.inc.php'; 69 require_once CODEBASE_PATH . '/lib/Utilities.inc.php'; 73 (include_once 'codebase/lib/App.inc.php') || require_once CODEBASE_PATH . '/lib/App.inc.php'; 70 74 71 75 define('_CLI', true); -
trunk/bin/acl.cli.php
r534 r674 189 189 Access Control List command line tool. 190 190 191 This script must be run in the common site directory (i.e. the parent 192 directory of the document root). DB credentials are retrieved from: 193 global/db_auth.inc.php so this file must exist. Furthermore this script 194 must be executed as the owner of the db_auth.inc.php file. 191 This script must be run in a common site directory configured with a DB auth file, 192 e.g., `lib/db_auth.json`, readable by the user executing this script. 195 193 196 194 Three types of objects are managed by this interface: -
trunk/lib/Auth_SQL.inc.php
r671 r674 896 896 } 897 897 898 /** 899 * Returns a user_id for a specified username. 900 * 901 * @param string $username Username to look for. 902 * @return string User_id, or false if none found. 903 */ 904 public function getUserID($username) 905 { 906 $db =& DB::getInstance(); 907 908 $this->initDB(); 909 910 $qid = $db->query(" 911 SELECT " . $this->_params['db_primary_key'] . " 912 FROM " . $this->_params['db_table'] . " 913 WHERE " . $this->_params['db_username_column'] . " = '" . $db->escapeString($username) . "' 914 "); 915 if (list($user_id) = mysql_fetch_row($qid)) { 916 return $user_id; 917 } else { 918 return false; 919 } 920 } 921 898 922 /* 899 923 * Generate a cryptographically secure, random password.
Note: See TracChangeset
for help on using the changeset viewer.