LEPTON CMS 7.0.0
feel free to keep it strictly simple...
Loading...
Searching...
No Matches
LEPTON_handle Class Reference

Public Member Functions

 __call (string $name, array $arguments)
 

Static Public Member Functions

static setDisplay (bool $bUseDisplay=true)
 
static __callStatic (string $name, array $arguments)
 
static install_table (string $table_name='', string $table_fields='')
 
static encrypt_table (string $table_name='', array $aListOfFields=[], string $field_condition='')
 
static decrypt_table (string $table_name='', array $aListOfFields=[], string $field_condition='')
 
static insert_values (string $table_name='', string $field_values='')
 
static drop_table (string $table_name='')
 
static rename_table (string $table_name='')
 
static create_sik_table (string $table_name='')
 
static delete_obsolete_files (string|array ... $aFileNames)
 
static delete_obsolete_directories (array $directory_names=[])
 
static rename_directories (array $directory_names=[])
 
static include_files (array|string $file_names=[], bool $interrupt=true)
 
static require_alternative (string $file_name, string $usage='backend')
 
static install_modules (array $module_names=[])
 
static upgrade_modules (string|array $module_names=[])
 
static install_droplets (string $module_name='', string|array $zip_names=[])
 
static uninstall_droplets (string|array $droplet_names=[])
 
static register ()
 
static checkEmailChars (string $sEmail)
 
static checkPasswordChars (string $sPassword)
 
static checkUsernameChars (string $sName)
 
static checkHexChars (string $sHexHash)
 
static restoreSpecialChars (string &$sAnyString, array $aAnyAssocArray=self::SPECIAL_CHARS_RESTORE)
 
static restoreStandardProtection ()
 
static createStandardProtection (string $path='/temp/secure/', string $username='')
 
static array_orderby (array $array, string $on, string $order=SORT_ASC)
 
static themeExists (string $sThemeName="")
 
static moveThemeFiles (string $sModuleDirectory="")
 
static copyThemeFilesRecursive (string $dirsource, string $dirdest, int $deep=0)
 
static removeAllThemeFiles (string $sModuleDirectory="")
 
static getModuleDirectory (string $anyNameOrPath="")
 
static getAllThemes ()
 
static getPathElements (string $anyNameOrPath="")
 
static createGUID ()
 

Data Fields

const HTACCESS_PATH = SECURE_PATH.'/.htaccess'
 
const HTPASSWD_PATH = SECURE_PATH.'/.htpasswd'
 
const ALT_BACKEND_FILE = '/templates/'.DEFAULT_THEME.'/backend/backend/'
 
const ALT_FRONTEND_FILE = '/templates/'.TEMPLATE.'/frontend/'
 
const SPECIAL_CHARS_RESTORE
 

Static Public Attributes

static bool $display_errors = true
 

Detailed Description

This file is part of LEPTON Core, released under the GNU GPL Please see LICENSE and COPYING files in your package for details, specially for terms and warranties.

NOTICE:LEPTON CMS Package has several different licenses. Please see the individual license in the header of each single file or info.php of modules and templates.

Author
LEPTON Project
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 24 of file lepton_handle.php.

Member Function Documentation

◆ __call()

__call ( string  $name,
array  $arguments 
)

Called if a method is unknown.

Parameters
string$name
array$arguments
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 65 of file lepton_handle.php.

◆ __callStatic()

static __callStatic ( string  $name,
array  $arguments 
)
static

Called if a static method is unknown.

Parameters
string$name
array$arguments
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 78 of file lepton_handle.php.

◆ array_orderby()

static array_orderby ( array  $array,
string  $on,
string  $order = SORT_ASC 
)
static

Sort given array

Parameters
array$arrayGiven array
string$onkey to sort
string$orderSORT_ASC OR SORT_DESC
Returns
array
$array_sorted = LEPTON_handle::array_orderby($array_source,'field_to_sort',SORT_DESC);
static array_orderby(array $array, string $on, string $order=SORT_ASC)
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 993 of file lepton_handle.php.

◆ checkEmailChars()

static checkEmailChars ( string  $sEmail)
static

Returns 'false' if the given string contains a non 'valid' char. Accepted chars are "a" to "z" (case-insensitive) and "0" to "9" with "-", ".", "_".

Parameters
string$sEmailAny string.
Returns
bool True if all chars matches.
$sEmailToCheck = "and 'OR'1'='1'OR'@mail.com";
$bEmailIsValid = LEPTON_handle::checkEmailChars( $sEmailToCheck );
// $bEmailIsValid will have boolean "false"
$sEmailToCheck = "example.php@toplevel.tld";
$bEmailIsValid = LEPTON_handle::checkEmailChars( $sEmailToCheck );
// $bEmailIsValid will have boolean "true"
static checkEmailChars(string $sEmail)
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 768 of file lepton_handle.php.

◆ checkHexChars()

static checkHexChars ( string  $sHexHash)
static

NOTICE: Strings (hash) consisting only of integers can be checked with "intval()" example: $sValueToCheck = intval($StringToCheck); result: $sValueToCheck is forced to be an integer Returns 'false' if the given string contains a non 'valid' char. Accepted chars are "a" to "f" (case-insensitive) and "0" to "9" with "-"

Parameters
string$sHexHashAny string.
Returns
bool True if all chars matches.
$sHexHash = "and 'OR'1'='1'OR'@mail.com";
$bHashIsValid = LEPTON_handle::checkHexChars( $sHexHash );
// $bHashIsValid will have boolean "false"
$sHexHash = "936DA01F-9ABD-4D9D-80C7-02AF85C822A8";
$bHashIsValid = LEPTON_handle::checkHexChars( $sHexHash );
// $bHashIsValid will have boolean "true"
static checkHexChars(string $sHexHash)
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 882 of file lepton_handle.php.

◆ checkPasswordChars()

static checkPasswordChars ( string  $sPassword)
static

Returns 'false' if the given string contains a non 'valid' char. Accepted chars see LEPTON_core around line 26

Parameters
string$sPasswordAny string.
Returns
bool True if all chars matches.
$sPasswordToCheck = "and 'OR'1'='1'";
$bPasswordIsValid = LEPTON_handle::checkPasswordChars( $sPasswordToCheck );
// $bPasswordIsValid will have boolean "false"
$sPasswordToCheck = "1258Ab$yz?";
$bPasswordIsValid = LEPTON_handle::checkPasswordChars( $sPasswordToCheck );
// $bPasswordIsValid will have boolean "true"
static checkPasswordChars(string $sPassword)
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 804 of file lepton_handle.php.

◆ checkUsernameChars()

static checkUsernameChars ( string  $sName)
static

Returns 'false' if the given string contains a non 'valid' char. Accepted chars are "a" to "z" (case-insensitive) and "0" to "9" with "-", ".", "_", " " (space).

Parameters
string$sNameAny string.
Returns
bool True if all chars matches.
$sNameToCheck = "and 'OR'1'='1'OR'@mail.com";
$bNameIsValid = LEPTON_handle::checkEmailChars( $sNameToCheck );
// $bNameIsValid will have boolean "false"
$sNameToCheck = "Aldus2 - from LEPTON-CMS";
$bNameIsValid = LEPTON_handle::checkEmailChars( $sNameToCheck );
// $bNameIsValid will have boolean "true"
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 839 of file lepton_handle.php.

◆ copyThemeFilesRecursive()

static copyThemeFilesRecursive ( string  $dirsource,
string  $dirdest,
int  $deep = 0 
)
static
Parameters
string$dirsource
string$dirdest
int$deep
Returns
bool
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1097 of file lepton_handle.php.

◆ create_sik_table()

static create_sik_table ( string  $table_name = '')
static

create sik table

Parameters
string$table_namefor table_name
static create_sik_table(string $table_name='')
Returns
boolean true if successful
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 324 of file lepton_handle.php.

◆ createGUID()

static createGUID ( )
static

Generate a globally unique identifier (GUID) Uses COM extension under Windows otherwise create a random GUID in the same style.

Returns
string GUID

also generate a hash for form validation

Exceptions
Exception
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1231 of file lepton_handle.php.

◆ createStandardProtection()

static createStandardProtection ( string  $path = '/temp/secure/',
string  $username = '' 
)
static

Create passwordfiles in chosen directory

Parameters
string$pathDefault directory is '/temp/secure/'.
string$usernameThe username the htacess belongs to
Returns
bool
Exceptions
Exception
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 946 of file lepton_handle.php.

◆ decrypt_table()

static decrypt_table ( string  $table_name = '',
array  $aListOfFields = [],
string  $field_condition = '' 
)
static

◆ delete_obsolete_directories()

static delete_obsolete_directories ( array  $directory_names = [])
static

Delete obsolete directories

Parameters
array$directory_nameslinear array with directory_names to delete
$directory_names = array(
'/modules/lib_r_filemanager/thumbs'
);
static delete_obsolete_directories(array $directory_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 399 of file lepton_handle.php.

◆ delete_obsolete_files()

static delete_obsolete_files ( string|array ...  $aFileNames)
static

Delete obsolete files

Parameters
string | array$aFileNamesA linear array with filenames to delete. Since L* IV this method could handle more than one param.
$file_names = array(
'/modules/lib_r_filemanager/filemanager/js/ZeroClipboard.swf'
);
static delete_obsolete_files(string|array ... $aFileNames)
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 355 of file lepton_handle.php.

◆ drop_table()

static drop_table ( string  $table_name = '')
static

drop table

Parameters
string$table_namefor table_name
$table_name = 'mod_test';
static drop_table(string $table_name='')
Returns
bool True if successful.
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 276 of file lepton_handle.php.

◆ encrypt_table()

static encrypt_table ( string  $table_name = '',
array  $aListOfFields = [],
string  $field_condition = '' 
)
static

◆ getAllThemes()

static getAllThemes ( )
static
Returns
array
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1186 of file lepton_handle.php.

◆ getModuleDirectory()

static getModuleDirectory ( string  $anyNameOrPath = "")
static
Parameters
string$anyNameOrPath
Returns
string

[5.4.5.2] ist the method called from a file inside the given module-dir? see: https://stackoverflow.com/questions/2960805/php-determine-where-function-was-called-from This is to avoid the situation that module 'A' can copy/delete theme-files from module 'B'!

Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1157 of file lepton_handle.php.

◆ getPathElements()

static getPathElements ( string  $anyNameOrPath = "")
staticfinal

[5.4.7] Internal

Parameters
string$anyNameOrPath
Returns
array
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1210 of file lepton_handle.php.

◆ include_files()

static include_files ( array|string  $file_names = [],
bool  $interrupt = true 
)
static

include files

Parameters
array | string$file_nameslinear array with filenames to include
bool$interrupt
$file_names = array(
'/framework/initialize.php'
);
static include_files(array|string $file_names=[], bool $interrupt=true)
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 464 of file lepton_handle.php.

◆ insert_values()

static insert_values ( string  $table_name = '',
string  $field_values = '' 
)
static

insert data into table

Parameters
string$table_namefor table_name
string$field_valuesfor table_fields
$table_name = 'mod_test';
$field_values="
(1, 'module_order', 'wysiwyg', ''),
(2, 'max_excerpt', '15', ''),
(3, 'time_limit', '0', '')
";
LEPTON_handle::insert_values($table_name, $field_values);
static insert_values(string $table_name='', string $field_values='')
Returns
bool True if successful, otherwise false.
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 250 of file lepton_handle.php.

◆ install_droplets()

static install_droplets ( string  $module_name = '',
string|array  $zip_names = [] 
)
static

Install droplets.

Parameters
string$module_namefor module name
string | array$zip_namesfor zip name
$module_name = 'droplets';
$zip_names = array(
'droplet_LoginBox'
);
LEPTON_handle::install_droplets($module_name, $zip_names);
static install_droplets(string $module_name='', string|array $zip_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 634 of file lepton_handle.php.

◆ install_modules()

static install_modules ( array  $module_names = [])
static

install modules

Parameters
array$module_nameslinear array with module_names to install
$module_names = array(
'code2'
);
static install_modules(array $module_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 530 of file lepton_handle.php.

◆ install_table()

static install_table ( string  $table_name = '',
string  $table_fields = '' 
)
static

install table

Parameters
string$table_namefor table_name
string$table_fieldsfor table_fields
$table_name = 'mod_test';
$table_fields='
`id` INT(10) UNSIGNED NOT NULL,
`edit_perm` VARCHAR(50) NOT NULL,
`view_perm` VARCHAR(50) NOT NULL,
PRIMARY KEY ( `id` )
';
LEPTON_handle::install_table($table_name, $table_fields);
static install_table(string $table_name='', string $table_fields='')
Returns
bool True if successful, otherwise false.
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 104 of file lepton_handle.php.

◆ moveThemeFiles()

static moveThemeFiles ( string  $sModuleDirectory = "")
static

[5.4.2] Copies module-specific theme-files to the installed themes during
installation and/or upgrade. The "basefiles" have to be inside the module-directory
inside the subdirectory "backendthemes" e.g. ~modules/foldergallery/backendthemes/talgos ~modules/foldergallery/backendthemes/black_hole

Parameters
string$sModuleDirectoryModule-Directory or path to a file inside the module.
Returns
void
// 1.1 direct by name
LEPTON_handle::moveThemeFiles( "foldergallery" );
// 1.2 via a var
LEPTON_handle::moveThemeFiles( $modules_directory );
// 1.3 the directory (path)
// 1.4 via the filepath of the current file
LEPTON_handle::moveThemeFiles( __FILE__ ); // inside upgrade.php
static moveThemeFiles(string $sModuleDirectory="")
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1071 of file lepton_handle.php.

◆ register()

static register ( )
static

Static method to "require" a (LEPTON-) internal function file

Returns
bool

example given:

// one single function
LEPTON_handle::register( "get_menu_title" );
// a set of functions
LEPTON_handle::register( "get_menu_title", "page_tree", "get_page_link" );
// a set of function names inside an array
$all_needed= array("get_menu_title", "page_tree", "get_page_link" );
LEPTON_handle::register( $all_needed, "rm_full_dir" );
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 717 of file lepton_handle.php.

◆ removeAllThemeFiles()

static removeAllThemeFiles ( string  $sModuleDirectory = "")
static
Parameters
string$sModuleDirectory
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 1141 of file lepton_handle.php.

◆ rename_directories()

static rename_directories ( array  $directory_names = [])
static

rename recursive directories

Parameters
array$directory_nameslinear array with directory_names to rename as assoziative array
$directory_names = array(
array ('source' =>'old_path1', 'target'=>'new_path1'),
array ('source' =>'old_path2', 'target'=>'new_path2')
);
static rename_directories(array $directory_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 431 of file lepton_handle.php.

◆ rename_table()

static rename_table ( string  $table_name = '')
static

rename table

Parameters
string$table_namefor table_name
static rename_table(string $table_name='')
Returns
boolean true if successful
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 300 of file lepton_handle.php.

◆ require_alternative()

static require_alternative ( string  $file_name,
string  $usage = 'backend' 
)
static

include files if exist and end process of start file

Parameters
string$file_namelinear array with filenames to include.
string$usageOnly "backend" or "frontend" supported.
if(LEPTON_handle::require_alternative('access/index.php') ) return 0;
if(LEPTON_handle::require_alternative('login/login_form.php','frontend') ) return 0;
static require_alternative(string $file_name, string $usage='backend')
Returns
boolean True, the given file is found and included, otherwise false.
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 502 of file lepton_handle.php.

◆ restoreSpecialChars()

static restoreSpecialChars ( string &  $sAnyString,
array  $aAnyAssocArray = self::SPECIAL_CHARS_RESTORE 
)
static

To "restore" some given special chars. E.g. per default "&lt" will be restored to "<";

Parameters
string$sAnyStringAny valid string. Pass|call by reference.
array$aAnyAssocArrayOptional an assoc. array with the char-pairs. Default is internal const SPECIAL_CHARS_RESTORE
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 895 of file lepton_handle.php.

◆ restoreStandardProtection()

static restoreStandardProtection ( )
static

Create new passwordfiles in standard protected directory

Default directory is '/temp/secure/.htaccess'

Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 909 of file lepton_handle.php.

◆ setDisplay()

static setDisplay ( bool  $bUseDisplay = true)
static

Method to change the display_errors. As the property is static we can't set it "outside" direct."

Parameters
boolean$bUseDisplayTrue to use LEPTON_tools::display.
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 54 of file lepton_handle.php.

◆ themeExists()

static themeExists ( string  $sThemeName = "")
static

◆ uninstall_droplets()

static uninstall_droplets ( string|array  $droplet_names = [])
static

uninstall droplets

Parameters
string | array$droplet_namesfor module name
$droplet_names = array(
'check-css'
);
static uninstall_droplets(string|array $droplet_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 671 of file lepton_handle.php.

◆ upgrade_modules()

static upgrade_modules ( string|array  $module_names = [])
static

upgrade modules

Parameters
string | array$module_nameslinear array with module_names to update
$module_names = array(
'code2'
);
static upgrade_modules(string|array $module_names=[])
Returns
void
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 581 of file lepton_handle.php.

Field Documentation

◆ $display_errors

bool $display_errors = true
static

◆ ALT_BACKEND_FILE

const ALT_BACKEND_FILE = '/templates/'.DEFAULT_THEME.'/backend/backend/'

◆ ALT_FRONTEND_FILE

const ALT_FRONTEND_FILE = '/templates/'.TEMPLATE.'/frontend/'

◆ HTACCESS_PATH

const HTACCESS_PATH = SECURE_PATH.'/.htaccess'

◆ HTPASSWD_PATH

const HTPASSWD_PATH = SECURE_PATH.'/.htpasswd'

◆ SPECIAL_CHARS_RESTORE

const SPECIAL_CHARS_RESTORE
Initial value:
= [
"&lt;" => "<",
"&gt;" => ">",
"&amp;" => "&",
"&quot;" => "\""
]
Examples
C:/Develope/SVN/upload/framework/classes/lepton_handle.php.

Definition at line 32 of file lepton_handle.php.


The documentation for this class was generated from the following file: