Core Class

Core class is used to manage all project functions. Not all methods are available at all times, since it depends on the classes that are loaded in the configuration.The class of each method will be explained in a subsequent review of this documentation.



Documentation index



  • Core class manages the following

  • Actual language based on GET, Cookie, browser set, and default set language
  • Skeleton for many domains and websites
  • Virtual pages from a db (no real pages are used)
  • Virtual websites and domains
  • HTML page generation from skeletons and content files
  • Text and rich text content blocks on many languages
  • Dynamic page info from db
  • Dynamic and static sitemaps
  • File cache for speed up static contents


 

Public methods

Class is initialized automatically from loader.

$obj->allAttrUserPass() - Encrypt or decrypt all the plain text passwords of attr table
$obj->allLanguages() - Returns array with all MAWI enabled languages
$obj->arraySanitize() - Sanitize normal or multidimensional array values
$obj->base64url_decode() - Decode string in base64 URL format
$obj->base64url_encode() - Encode string in base64 URL format
$obj->bruteforceAttemp() - Write a new invalid login attemp to bruteforce table
$obj->bruteforceCheck() - Check bruteforce access
$obj->captureGetVars() - Set global vars captured and filtered from GET with a given size 
$obj->captureGlobalGet() - Capture and filter all $_GET vars with $key = value if $key is not previously defined.
$obj->captureGlobalPost() - Capture and filter all $_POST vars with $key = value if $key is not previously defined.
$obj->capturePostVars() - Set global vars captured and filtered from POST with a given size
$obj->chkIndexBacktrace() - Detect if class is called from index or other page
$obj->chkLang($iso) - Check if supplied iso lang code is enabled
$obj->cleanString() - Remove and tags, links or multiline comments
$obj->db() - PDO database wrapper
$obj->decrypt() - Decrypt string
$obj->decryptPwd() - Decrypt db password (decrypt alias)
$obj->decVars() - Separate multiple vars received from a single base64 encoded GET var
$obj->detectBotByIP() - isBot method alias
$obj->detectBotByUserAgent() - Detect if the user_agent is from a bot.
$obj->download() - Download a file
$obj->dumpDecode() - Check response contents codified in json and base64-url
$obj->encrypt() - Encrypt string
$obj->encVars() - Encode and encrypt the vars of a GET query string
$obj->fileCacheChk() - Check if current page must be cached
$obj->fileCacheRead() - Read cache file if exist and delete expired cache files
$obj->fileCacheWrite() - Write the $obcontent to file cache
$obj->filterUsername() - Filter the login form username POST field
$obj->formatDate() - Returns a formated date, depending on int used in $opt
$obj->getAllText() - Generate array with (key => text) with actual page text on selected language
$obj->getAlternateHeader() - Generate alternate link header with all enabled languages
$obj->getBlock() - Get content block in selected language
$obj->getBreadcrumb() - Get breadcrumb to var with bootstrap styles
$obj->getConfValue() - Get the value of a given cat + key
$obj->getCopyright() - Generate HTML MAWI Copyright
$obj->getDate() - Get current date for configured default_time_zone
$obj->getMsg() - Create a system message or error from array
$obj->getQueryStr() - Create array with (name => value) data of URI query string
$obj->getQueryVars() - Convert from GET query to compresed var without base64 encode
$obj->getRawBlock() - Get block text of given ID and language
$obj->getRawBlockName() - Get block name of given ID and language
$obj->getReferer() - Returns one array with |http_referer|referer|uri_str|uri|domain|page|query|
$obj->getShiftDate() - get a shifted date/time by seconds, minutes, hours, days, weeks, months or years
$obj->getText() - Return text value for current language for given $key
$obj->getUriAlias() - Get actual alias page from URI
$obj->getUserInfo() - Get all user info and attributes for a given user id
$obj->getVersion() - Get framework version string
$obj->headers() - Generate http headers for current page
$obj->initClasses() - Authomatically initialize other framework classes
$obj->initDBClass() - Initialize DB class wrapper
$obj->initUserClass() - Initialize user management class
$obj->isBot() - Detect if a IP is from a bot.
$obj->isCountry() - Detect UE and LATAM countries
$obj->langName() -  Return language name for given ISO code
$obj->logException() - Log exceptions.
$obj->login() - Try to login if credentials and login order was sent
$obj->loginByHash() - Try to login if a login HASH is detected
$obj->loginHash() - Generate a login HASH to identify a user from a URL GET
$obj->logout() - Disconect user session
$obj->move2SSL() - If not https, redirect domain to SSL and viceversa if switch active
$obj->object2List() - Get a comma separated list from object to use as "WHERE $value IN ($list)"
$obj->pageBenchmark() - Measure the page loading speed and memory consumption
$obj->pageId2Alias() - Generate array with (page id => page alias) of all virtual pages
$obj->pdo() - PDO class
$obj->queryStr() - Used by getQueryStr() to capture all vars to an array
$obj->queryStrVar() - Used by getQueryStr() to return a single var instead all the query string
$obj->randPass() - Password generator
$obj->readCookiesAgree() - Read cookies_agree cookie
$obj->redir() - Redirect to a given URI and type or redirect.
$obj->redirect301() - Redirect old pages to new ones using configuration array
$obj->removeAccents() - Remove accents from a text string
$obj->rowOrder() - Change numeric order field to move up or down sql rows
$obj->SetCookieLang() - Set the cookie lang if GET var detected
$obj->setCookiesAgree() - Set de cookies_agree cookie
$obj->showBlock() - Show content block in selected language
$obj->showBreadcrumb() - Show breadcrumb with bootstrap styles
$obj->showMsg() - Show the message created by createMsg
$obj->showText() - Show text value for current language for given $key
$obj->ssl() - Check if page is loaded using https protocol
$obj->user() - User management class
$obj->urlizer() - Convert string to use in URLs, page names and similar.
$obj->userGroupName() - Get user group name for current user
$obj->validateEncryptionHash() - Validate encryption hashes


 

Public objects

Objects generated automatically on every page loaded

$obj->lang; //(string) Actual selected language two letters ISO code
$obj->pageInfo->skeleton_above; //(string) Skeleton elements above the content with path
$obj->pageInfo->skeleton_below; //(string) Skeleton elements below the content with path
$obj->pageInfo->content; //(string) Contente file with path
$obj->pageInfo->page_id; //(int) Id of current page
$obj->pageInfo->file_name; //(string) Content file name of current page
$obj->pageInfo->alias; //(string) Page alias taken from files db table alias value
$obj->pageInfo->group;  //(int) Group ID of actual page
$obj->pageInfo->group_up; //(int) Group id of precedent page of actual page
$obj->pageInfo->dir; //(string) Directory name relative to web root of current page content file
$obj->pageInfo->page_title; //(string) Title of current file in the selected language
$obj->pageInfo->meta_description; //(string) Meta description of current file in the selected language
$obj->pageInfo->meta_keyword; //(string) Meta keyword of current file in the selected language
$obj->pageInfo->http_header; //(string) HTTP status code of curren page.
$obj->pageInfo->trail_id; //(int) Trail page id of current file (Id of precedent page)
$obj->pageInfo->owner_id; //(int) Id of owner user for actual page
$obj->pageInfo->priority; //(int) Priority of file (1 to 10), used to generate sutemap.xml
$obj->pageInfo->no_header; //(bool) Page do not generate header, footer or http headers.
$obj->loginResult->lh_err; //(array) Array with "Login hash" errors.
$obj->loginResult->lh_msg; //(array) Array with "Login hash" messages.