Authentication, form elements display, data handling routines
Version: 2.3
Package: eiseIntra
eiseIntra is the core class that encapsulates routines for authenication, form elements display, data handling, redirection and debug.
This class extends eiseIntraData as base class.
Array with data of currently logged user:
['Managers', 'Users']['MNG', 'USR'](*) - type is ‘string’ because of PHP function mysql_fetch_assoc()’s nature. It fetches anything like strings despite actual data type in the database.
For more details on how and when this data is obtained, please proceed to eiseIntra::checkPermissions().
Category: Authentication
ID of current user.
Category: Authentication
Configuration array. See description at eiseIntra::$defaultConf
Category: Configuration
This property is set to ‘Local’ when local language is selected by the user
Category: i18n
Default configuration. Exact configuration parameters list is:
ltrim(dirname($_SERVER['PHP_SELF']), '/')(isset($eiseIntraCookiePath) ? $eiseIntraCookiePath : '/')public static $defaultConf = array(
'versionIntra'=>EISEINTRA_VERSION
, 'dateFormat' => "d.m.Y" //
, 'timeFormat' => "H:i" //
, 'decimalPlaces' => "2"
, 'decimalSeparator' => "."
, 'thousandsSeparator' => ","
, 'language' => 'rus'
, 'logofftimeout' => 360 //6 hours
, 'addEiseIntraValueClass' => true
, 'keyboards' => 'EN,RU'
, 'dataActionKey' => 'DataAction'
, 'dataReadKey' => 'DataAction'
, 'cachePreventorVar' => 'nc'
, 'system' => 'nc'
, 'cookiePath' => 'nc'
, 'cookieExpire' => 'nc'
, 'useBootstrap' => false
, 'strAttrib' => ''
, 'context' => ''
, 'auto_translate'=>true
, 'collect_keys'=>false
// , 'flagSetGlobalCookieOnRedirect' = false
, 'selItemMenu' => null
, 'selItemTopLevelMenu' => null
, 'defaultPage' => 'about.php'
, 'pass_hash' => 'md5'
, 'frame' => false
);
Category: Configuration
Array with keyboard layouts. Key is layout code, value is string with characters in the order of keyboard keys.
static $arrKeyboard = array(
'EN' => 'qwertyuiop[]asdfghjkl;\'\\zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"|ZXCVBNM<>?'
, 'RU' => 'йцукенгшщзхъфывапролджэёячсмитьбю/ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЁЯЧСМИТЬБЮ?'
);
Category: Data Handling i18n
Constructor receives eiseSQL object with database connection as input parameter and performs object initialization with configuration options supplied in $conf array.
Parameters:
Category: Authentication Configuration
Function decodes authstring login:password using decrypt() method
Parameters:
Returns: array [string $login, string $password]
Category: Authentication
Function encodes authstring login:password using encrypt() method.
Parameters:
Returns: string Encoded authentication string.
Category: Authentication
This function returns combination of global variable $eiseIntraKey
stored at eiseIntra’s inc_config.php and server variable EISINTRA_KEY that can be set in Nginx or Apache config.
Key length is set to 128-bit (32 bytes/chars).
If concatentated key length is less that 32 bytes, all remaining places are padded with zeros (0).
When both keys are not set, function returns false and eiseIntra::encrypt() and eiseIntra::decrypt() are forced to work only as base64 encoder/decoder.
Returns: string Key or false, if both key parts are empty.
Function encrypts a string with symmetric encryption using the key obtained from getEncryptionKey() method and current encoding algorithm (now RIJNDAEL_256 and mcrypt). In case mcrypt is missed in PHP or encryption key is empty, it encodes string with base64.
Parameters:
Returns: string Encrypted string.
Category: Authentication
Function decrypts a string with symmetric decryption using the key obtained from getEncryptionKey() method and current encoding algorithm (now RIJNDAEL_256 and mcrypt). In case mcrypt is missed in PHP, it encodes string with base64.
Parameters:
Returns: string Encrypted string.
Category: Authentication
This function returns password hash according to hashing method specified in $conf[‘pass_hash’].
Parameters:
Returns: string Hash of given string.
Category: Authentication
This function verifies the password across the hash according to hashing method specified in $conf[‘pass_hash’].
Parameters:
Returns: string Hash of given string.
Category: Authentication
Function that checks authentication with credentials database using selected $method. Now it supports the following methods:
LDAP method was successfully tested with Active Directory on Windows 2000, 2003, 2008, 2008R2 servers.
Parameters:
Returns: boolean authentication result: true on success, otherwise false.
Category: Authentication
This function intialize session with session cookes placed at path set by $this->conf[‘cookiePath’] configuration variable.
Category: Authentication
This function quits user session.
Category: Authentication
This function fills in $arrUsrData[‘roles’] and $arrUsrData[‘roleIDs’] arrays. Can be overriden for virtual roles.
NOTE: Role membership information is collected from stbl_role_user table basing on rluInsertDate timestamp, it should not be in the future. It is useful when some actions should be temporarily delegated to the other user in case of vacations, illness etc.
Page permissions can be set with eiseAdmin’s GUI at < database >/Pages menu.
Role membership can be set by system’s GUI at system’s Setting/Access Control menu or
Parameters:
$intra->arrUsrData['roles'] and $intra->arrUsrData['roleIDs']Returns: array with role IDs as keys and role titles are values.
Category: Authentication Authorization
This function checks current user’s permissions on currently open script.
Also it checks session expiration time, and condition when user is blocked or not in the database.
Script name is obtained from $_SERVER['SCRIPT_NAME'] global variable.
Permission information is collected from stbl_page_role table and calculated according to user role membership defined at stbl_role_user table.
Permissions are calulated in the following way:
If user has no permissions to ‘Read’ the script, function throws an exception. When ‘Read’ permissions are confirmed for the user, function updates $intra->arrUsrData property. Click on this link to see full description.
NOTE: Role membership information is collected from stbl_role_user table basing on rluInsertDate timestamp, it should not be in the future. It is useful when some actions should be temporarily delegated to the other user in case of vacations, illness etc.
Page permissions can be set with eiseAdmin’s GUI at < database >/Pages menu.
Role membership can be set by system’s GUI at system’s Setting/Access Control menu or
Returns: array $intra->arrUsrData
Category: Authentication Authorization
This method returns content of top-level “jumper” menu as drop-down list. “Jumper” menu content goes with an associative array passed as parameter to this function.
Parameters:
Category: Navigation
This method returns system menu <ul> HTML for menu structure.
Parameters:
<a href="..."> inside menuReturns: string HTML with menu structure
Category: Navigation
This method is called before each menu item <li> closure. You can add custom menu items/submenus in your own app overriding this method in the inherited class.
Parameters:
Returns: string HTML with submenu structure
Category: Navigation
This method returns HTML for “action menu” - the menu that displayed above the functional part of the screen. Menu content is set by $arrActions parameter, the set of associative arrays with menu items. Menu item definition array consists of the following properties: array[] - menu item set. No nested menu items, no dropdowns in this version.
Parameters:
Returns: string HTML for “action menu”.
Category: Navigation
This method includes specified $components into your PHP code by calling corresponding include() PHP functions and filling out $arrJS and $arrCSS arrays.
Parameters:
Category: Configuration
This method adds HTTP header “Location” that redirects user to URL/URI specified in $strLocation, with text message to be shown on this page, specified in $strMessage parameter.
Message will be shown on eiseIntra enabled page, using $('body').eiseIntra('showMessage') function that will fire right after $(document).ready() event.
Message will be saved for display using cookies. By default cookie path is the path part of $strLocation URL. If $intra->conf[‘flagSetGlobalCookieOnRedirect’] is TRUE, cookie path will be set by global constant $this->conf[‘cookiePath’].
This property can be overriden for this function with the $arrConfig[] parameter member ‘flagSetGlobalCookieOnRedirect’ = TRUE/FALSE. It can be useful when you need to redirect user from project subdirectory to the script placed at the root one, for example:
$intra->redirect('Operation successfull', '/myproject/item_form.php?itemID=12345');
// normal redirect within the project
$intra->redirect('Bye-bye, see you later', '/byebye.php', array('flagSetGlobalCookieOnRedirect'=>true));
// when $this->conf['cookiePath']='/' and you redirect user to the root dir of your web server.
Parameters:
Returns: nothing, script execution terminates.
Category: Navigation
This method returns proper ‘Back’ reference for this button in Action Menu. If $_SERVER[‘HTTP_REFERER’] doesn’t contain current URI, it set a cookie with referring page.
Otherwise, it use this cookie value, and if it’s absent, it returns $urlIfNoReferer parameter.
It works like this: when user arrives to given form via hyperlink in list or other form, or whatever that leaves HTTP_REFERER header, it returns this value and saves a cookie with that URL, with this form path. When user saves data on this form it appears back without this HTTP header and ‘Back’ button needs proper value. It takes it from cookie (if it exists) or from specified parameter.
$arrActions[] = array('title'=>'Back', 'action'=>$intra->backref('myitems_list.php'));
// it will return user to the item list by default
Parameters:
Returns: string URL
Category: Navigation
Function outputs JSON-encoded response basing on intra specification and terminates the script.
Parameters:
Category: Data Output
Function outputs binary stuff to the user.
Parameters:
Category: Data Output
This function outputs necessary stuff to start batch data operation script. WARNING: this function closes existing session using session_write_close(), so avoid changing $_SESSION variables in your batch processing script.
Parameters:
Category: Batch run
This function outputs data at batch data operation script, adds htmlspecialchars() and flushes output buffer.
Parameters:
Category: Batch run
This function sets user message to the cookie.
Parameters:
This function retrieves user message from the cookie and deletes the cookie itself.
Returns: string with user message
This method returns array of role users by role ID
Parameters:
Returns: array of user ID’s
Category: Authentication Authorization
This function initialize what language to use: local or global
Category: i18n
An analog of industrial standard __() function, $intra->translate() translates simple words/phrases to local language according to the system dictionary oridinarily located in < sys dir >/common/lang.php and included at auth.php. Now it supports sprintf() formatting, so it can translate phrases with format strings like “Item #%s is updated.”
Parameters:
Category: i18n
This is service method that turns on translation key collection for further dictionary fill in (lang.php)
Parameters:
Category: i18n
This function reads stbl_setup table into $intra->conf[] array.
Category: Configuration
This function is to read or write system variable values stored in stbl_setup.
Parameters:
Returns: variant if param $stpVarValue is omitted it returns current setting value, otherwise it returns null in case of successful value set or throws an exception if settings variable doesn’t exist in the system
This function returns HTML for single field If parameter $title is specified, it returns full HTML with container, label and input/text If parameter $name is specified it returns HTML for input/text according to $value parameter else it returns HTML specified in $value parameter.
Parameters:
Category: Forms
This function returns HTML for single fieldset
Parameters:
<legend> tagCategory: Forms
This function returns HTML for the form.
Parameters:
Category: Forms
This function returns HTML for the text box <input type="text">.
Parameters:
Category: Forms
This function returns HTML for the <textarea>.
Parameters:
Category: Forms
showButton() method returns <input type="submit"> or <button> HTML. Input type should be specified in $arrConfig['type'] member.
Parameters:
<input type="submit" class="eiseIntraActionSubmit"> will be returned<button class="eiseIntraDelete"><button> element will be returnedReturns: HTML string
Category: Forms
This method returns HTML for <select> form control.
Element id and name are set with $strName parameter. Selected element will be chosen accorging to $strValue. Option values and this variable will be converted being casted to strings.
Empty element (with empty value) will be added if $confOptions[‘defaultText’] option is set.
$arrOptions array can have nested arrays. In this case <optgroup> tag will be added. Option group title can be set via $confOptions[‘optgroups’] option array. See below.
$confOptions is configuration array, it can have the following options:
<select> element will be shown. Otherwise, it will be <div> with chosen option text and hidden <input> with existing value.<select class="{...}"> attribute. Specified classes will be added to the end of class list.<select> element attributes string, e.g. ` data-xx=”YY” aria-role=”nav” class=”my-gorgeous-class”`. Classes will be merged with ‘class’ option content.<option> with empty value will be added to the beginning of dropdown list, option text will be taken from this conf option value. If ‘auto_translate’ $intra option is TRUE, this value will be translated.<option class="deleted"><optgroup> titles. If $arrOption array member is array, it will search for <optgroup> tag title in this conf option array by the same key.<a href="{...}">Parameters:
<option value=""> and array element value is option text<select> element. See above.Returns: string HTML
Category: Forms
This function returns HTML for the < input type=”checkbox” >.
Parameters:
Category: Forms
This function returns HTML for the < input type=”radio” >.
Parameters:
Category: Forms
This function returns HTML for the < input type=”radio” >, basing on arrays
Parameters:
Category: Forms
This function returns HTML for the AJAX-based autocomplete inputs. They download data from the server while user inputs the text.
Parameters:
Category: Forms
This method returns True if user permissions allow to edit the data. It is possible either if FlagWrite is positive at current page or FlagCreate or FlagUpdate are too. Perissions may be forced to allow editing or deny it by setting $flagToForce parameter to True or Flase correspondingly. If it’s not set or null it meaningless.
Parameters:
Returns: bool
Category: Forms
Function that loads JavaScript files basing on GLOBAL $arrJS
Category: Data Output
Function that loads CSS files basing on GLOBAL $arrCSS
Category: Data Output
Data handling hook function. If $_GET or $_POST [‘DataAction’] array member fits contents of $dataAction parameter that can be array or string, user function $function_name will be called and contents of $_POST or $_GET will be passed as parameters.
Parameters:
Returns: variant value that return user function.
Category: Navigation Data Handling
Data read hook function. If $query[‘DataAction’] array member fits contents of $dataReadValues parameter that can be array or string, user function $function_name will be called and contents of $query parameter will be passed. If $query parameter is omitted, function will take $_GET global array.
Parameters:
Returns: variant value that return user function.
Category: Data Handling
This function returns date and time string basing on operation date and time string. If operation day start time is greater than operation day end time, and time passed less than operation day end time, then date will be incremented by one day.
For example, if operation day starts at 07:30 and ends at 01:30 next day, then operation time ‘01:00’ will be considered as next day time. If operation date is ‘2024-06-30’, then returned date and time will be ‘2024-07-01 01:00:00’.
Parameters:
Returns: string date and time in ‘Y-m-d H:i:s’ format
Category: Data Output
This function returns date period string basing on start and end dates. If both dates are equal, only one date will be returned.
Parameters:
Category: Data Output
Static functions that returns first occurence of configuration array $conf key variations passed as $variations parameter (array). Made for backward compatibility.
Parameters:
Returns: $conf array value of first occurence of supplied key variations. NULL if key not found
Category: Utilities
This function returns external reference to the script inside <iframe>. This href will load all iframe surrounding, including menu and $iframeHREF will be inside this <iframe>
Parameters:
<iframe>function to obtain keyboard layout variations when user searches something but miss keyboard layout switch
It takes multibyte UTF-8-encoded string as the parameter, then it searches variations in static property self::$arrKeyboard and returns it as associative array.
Parameters:
Returns: array Associative array of possible string variations, like array('EN'=>'qwe', 'RU'=>'йцу')
Category: i18n Useful stuff
This function dumps $to_echo variable using var_export() or simply echoes it, with stack trace ahead
Parameters:
Category: Debug
This function rebuilds style.css for selected theme using style.less located in the same folder as style.css. REMEMBER TO chmod a+w to this folder!
Category: Utilities
eiseIntraData is the class that encapsulates data handling routines
Data types definition and conversion SQL <-> PHP output data conversions SQL query result conversion to JSON or Array (result2JSON()) Reference table routines (getDataFromCommonViews()) Archive/Restore routines etc
Version: 2.0beta
Package: eiseIntra
$arrIntraDataTypes defines basic type set that is used for conversion of data obtained from the database into user-specific locale.
public static $arrIntraDataTypes = array(
'integer' => array('integer', 'int', 'number', 'smallint', 'mediumint', 'bigint')
, 'real' => array('real', 'double', 'decimal', 'float')
, 'money' => array('money')
, 'boolean' => array('boolean', 'tinyint', 'bit')
, 'text' => array('text', 'varchar', 'char', 'tinytext', 'text', 'mediumtext', 'longtext')
, 'binary' => array('binary', 'varbinary', 'tinyblob', 'blob', 'mediumblob', 'longblob')
, 'date' => array('date'), 'time' => array('time'), 'datetime' => array('datetime')
, 'timestamp' => array('timestamp')
, 'FK' => array('int', 'integer', 'varchar', 'char', 'text')
, 'PK' => array('int', 'integer', 'varchar', 'char', 'text')
, 'activity_stamp' => array('datetime', 'timestamp')
);
This function formats data for user-friendly output according to user data type provided in $type parameter.
Parameters:
Returns: string
Category: Data formatting
This function formats data to SQL-query friendly value, not escaped, without quotes.
Parameters:
Returns: string - The value formatted.
Category: Data formatting
This function returns SQL result as JSON string or array, in format that can be understood by eiseIntra’s JavaScript fill() methods. Output format is a bit more complex than just list of rows as dictionaries. It also contains some features that scipt interpret for data display:
Parameters:
$arrConf['arrPermittedFields'] == ['c'] and $arrConf['flagAllowDeny'] == 'allow' ‘c’ field will be prenected in the following way: {c: {v: ‘d’, rw: ‘r’}}.$arrConf['fields']['c']['href'] == '/page.php?a=[a]' and $arrConf['fields']['c']['target'] == '_blank' it will return {c: {v: d, h: '/page.php?a=b', tr: '_blank'}}Returns: array (default) or string when $arrConf[‘flagEncode’]==True
Category: Data Output
This function unquotes SQL value previously prepared to be added into SQL code by functions like $oSQL->e(). Same exists in eiseSQL class.
Parameters:
Returns: string $sqlReadyValue without quotes, or NULL if source string is ‘NULL’ (case-insensitive)
Category: Data formatting
This function converts decimal value from user input locale into SQL-friendly value. If $val is empty string it returns $valueIfNull string or ‘NULL’ string.
Parameters:
Returns: variant - double value converted from original one or $valueIfNull if it’s set or ‘NULL’ string otherwise.
Category: Data formatting
This function converts data fetched from SQL query to string, according to $intra locale settings.
Parameters:
Returns: string decimal value.
Category: Data formatting
This function converts date value as it’s been fetched from SQL (‘YYYY-MM-DD’ or any strtotime()-parseable format) into string accoring to $intra locale settings ($intra->conf[‘dateFormat’] and $intra->conf[‘timeFormat’]). If $precision is not ‘date’ (e.g. ‘time’ or ‘datetime’) it will also adds a time component.
Parameters:
Returns: string - converted date or date/time value
Category: Data formatting
This function converts date value as it’s been fetched from SQL (‘YYYY-MM-DD’ or any strtotime()-parseable format) into string accoring to $intra locale settings ($intra->conf[‘dateFormat’] and $intra->conf[‘timeFormat’]).
Parameters:
Returns: string - converted date/time value
Category: Data formatting
This function converts date value received from user input into SQL-friendly value, quoted with single quotes. If origin value is empty string it returns $valueIfEmpty parameter or ‘NULL’ if it’s not set. Origin value is checked for compliance to date format using regular expression $intra->conf[‘prgDate’]. Also $dtVar format accepts output formatted as ‘YYYY-MM-DD’ string. If $dtVar format is wrong it returns $valueIfEmpty or ‘NULL’ string.
Parameters:
Returns: string - Converted value ready to be added to SQL query string.
Category: Data formatting
This function converts date/time value received from user input into SQL-friendly string, quoted with single quotes. If origin value is empty string it returns $valueIfEmpty parameter or ‘NULL’ if it’s not set. Origin value is checked for compliance to date format using regular expression $intra->conf[‘prgDate’] and $intra->conf[‘prgTime’]. Time part is optional. Function also accepts ‘YYYY-MM-DD[ HH:MM:SS]’ string. If $dtVar format is wrong it returns $valueIfEmpty or ‘NULL’ string.
Parameters:
Returns: string - Converted value ready to be added to SQL query string.
Category: Data formatting
getTableInfo() funiction retrieves useful MySQL table information: in addition to MySQL’s ‘SHOW FULL COLUMNS …’ and ‘SHOW KEYS FROM …’ it also returns some PHP code that could be added to URL string, SQL queries or evaluated. See description below. Currently it uses eiseSQL::getTableInfo() function.
Parameters:
Returns: array - see more in eiseSQL::getTableInfo() function documentation
getSQLValue() function returns ready-to-eval PHP code to be used in SQL queries. Currently kept for backward compatibility.
Parameters:
Returns: string PHP code that could be evaluated in SQL query.
Category: Data formatting
This tiny function composes WHERE SQL condition for multiple column primary key. It’s assumed that column values are delimited with double-hash (‘##’).
Parameters:
Category: Database routines
This function reads data from SQL views or tables that’s used as foreign key references. This function is widely used in eiseIntra as the data source for
Parameters:
LIKE %..%, e.g. for AJAX autocomplete list.| $extra (string) - some extra criteria, pipe(‘ | ’)-delimited string. Table/view should contain fields named like ‘extra’, ‘extra1’, ‘extra2’… |
Returns: resource with data obtained from the database
Category: Database routines
This function recursively converts data in associative array according to type definition supplied in $types parameter. Suitable for situations when you need locale-indepedent json.
Parameters:
This function also recursively converts data in associative array according to type definition supplied in $types parameter. Suitable for situations when you need to convert data according to your user locale.
Parameters:
This function returns SQL for field values. It can be used either in UPDATE or in INSERT … SET queries.
Parameters:
This function returns basic data type for provided $type variable. It can be as any MySQL data type as input type used in eiseIntra.
Parameters:
Returns: string - basic type from keys of eiseIntraData::$arrBasicTypes. If basic type’s not found it returns ‘text’.
This function returns Intra type from key set of $arrIntraDataTypes array above. It takes $type and $field name as parameters, and it can be as Intra types as SQL data types returned by fetch_fields() or getTableInfo() functions.
Parameters:
eiseIntra::getDecimalPlaces() gets actual number of digits beyond decimal separator. It reads original float or string value with “.” (period symbol) as delimiter and returns actual number of decimal places skipping end zeros.
Parameters:
Returns: int - number of decimals. If $val is not numberic (i.e. it doesn’t fit is_numeric() PHP function) it returns NULL.
Category: Data formatting
eiseSQL is the class for object wrapper for database access functions. Currently it extends PHP’s built-in mysqli class but also it adds some useful shortcuts for most popular functions. Also in contains built-in profiler and some functions to profile your SQL query sequence.
Version: 2.0beta
Package: eiseIntra
This array maps intra data types into MySQL data types
public $arrIntra2DBTypeMap = array(
"integer"=>'int(11)',
"real"=>'decimal(16,4)',
"boolean"=>'tinyint(4)',
"text"=>'varchar(1024)',
"binary"=>'blob',
"date"=>'date',
"time"=>'time',
"datetime" => 'datetime'
);
This array maps intra data types into MySQL binary data types constants
public $arrDBTypeMap = array(
"integer"=>array(MYSQLI_TYPE_SHORT
, MYSQLI_TYPE_LONG
, MYSQLI_TYPE_LONGLONG
, MYSQLI_TYPE_INT24
, MYSQLI_TYPE_YEAR),
"real"=>array(MYSQLI_TYPE_DECIMAL
, MYSQLI_TYPE_NEWDECIMAL
, MYSQLI_TYPE_FLOAT
, MYSQLI_TYPE_DOUBLE),
"boolean"=>array(MYSQLI_TYPE_BIT
, MYSQLI_TYPE_TINY
, MYSQLI_TYPE_CHAR),
"text"=>array(MYSQLI_TYPE_ENUM
, MYSQLI_TYPE_SET
, MYSQLI_TYPE_VAR_STRING
, MYSQLI_TYPE_STRING
, MYSQLI_TYPE_GEOMETRY),
"binary"=>array(MYSQLI_TYPE_TINY_BLOB
, MYSQLI_TYPE_MEDIUM_BLOB
, MYSQLI_TYPE_LONG_BLOB
, MYSQLI_TYPE_BLOB),
"date"=>array(MYSQLI_TYPE_DATE
, MYSQLI_TYPE_NEWDATE),
"time"=>array(MYSQLI_TYPE_TIME
, MYSQLI_TYPE_INTERVAL),
"datetime" => array(MYSQLI_TYPE_DATETIME),
"timestamp" => array(MYSQLI_TYPE_TIMESTAMP)
);
Performs connect to the database with parent constructor.
WARNING! method connect() only make some adjustments
Parameters:
Category: Database routines
Throws: eiseSQLException object when connect fails
Dummy. Needed for some backward compatibility. Do not use.
Parameters:
Another backward-compatibility function Do not use.
Parameters:
Method e() escapes source string for SQL query using mysql_escape_string() and put escaped string into single quotes. Please used it to prevent from SQL injections.
Parameters:
echo $oSQL->('qq', 'search')=>LIKE '%qq%'Category: Database routines Data formatting
This function strips single quotes from both ends of the string. If string is word ‘NULL’, it returns NULL.
Parameters:
Returns: string
This function first quotes the string using eiseSQL::e() function, then it strips quotes with eiseSQL::unq(). So it secures the string from any SQL injection.
Parameters:
Returns: string
Category: Database routines Data formatting
This method executes SQL query and returns MySQL resource. Also it collects all necessary data for query profile:
Parameters:
Returns: MySQL resource
Category: Database routines
This method returns number of rows obtained within MySQL result object. Actually it returns $mysqli_result->num_rows property.
Parameters:
Returns: int
Category: Database routines
This method fetches a row from MySQL result or SQL query passed as a parameter. If you’d like to reduce amount of code and you need to obtain only one record - just pass SQL query directly to this method. So it is a little bit more than wrapper around MySQL result::fetch_assoc()
Parameters:
Returns: associative array with field names as keys, like MySQL result::fetch_assoc()
Category: Database routines
This method fetches a row from MySQL result as an enumerated array. So it is just a wrapper around MySQL result::fetch_array()
Parameters:
Returns: enumerated array, like MySQL result::fetch_array()
Category: Database routines
This method fetches field information from MySQL result as MySQL result::fetch_fields(). It is actually a wrapper around it.
Parameters:
Returns: array, like MySQL result::fetch_fields()
Category: Database routines
This method returns autoincremental ID value after last INSERT ... query in current connection. It is a wrapper over MySQLi::insert_id property.
Returns: int - last insert id.
Category: Database routines
This method returns number of rows affected by last INSERT ..., UPDATE ... or DELETE ... query in current connection. It is a wrapper over MySQLi::affected_rows property.
Returns: int - number of records affected.
Category: Database routines
This method fetches first value of first row from MySQL result or SQL query passed as a parameter. If you’d like to reduce amount of code and you need to obtain only one record - just pass SQL query directly to this method. So it is a little bit more than wrapper around MySQL result::fetch_assoc()
Parameters:
Returns: associative array with field names as keys, like MySQL result::fetch_assoc()
Category: Database routines
Use this method to start or reset profiling process in your MySQL script. It drops all counters and set $oSQL->flagProfiling=true
Category: Debug
This function outputs profile info to current standard output. Use it for brief investigation of what’s going on within your SQL query sequence.
Category: Debug
This function returns profiling as the list of associative arrays for each query.
Returns: enumerable array of associative arrays:
Category: Debug
getTableInfo() funiction retrieves useful MySQL table information: in addition to MySQL’s ‘SHOW FULL COLUMNS …’ and ‘SHOW KEYS FROM …’ it also returns some PHP code that could be added to URL string, SQL queries or evaluated. See description below.
Parameters:
Returns: array:
'SHOW FULL COLUMNS ...':
'SHOW KEYS FROM ...''$bltID = (isset($_POST[\'bltID\']) ? $_POST[\'bltID\'] : $_GET[\'bltID\'] );'bltID = ".(int)($bltID)."''bltID=".urlencode($bltID)."',Category: Database routines