Data Structures | Namespaces | Functions | Variables

cms/common.lib.php File Reference

Contains functions which are common to many tasks and very frequently used. More...

Go to the source code of this file.

Data Structures

class  messenger

Namespaces

namespace  pragyan
 

Widget Framework for Pragyan CMS (c) 2010 Pragyan Team http://www.gnu.org/licenses/ GNU Public License For more details, see README Add support for File Upload/Download via the widget's configurations Reload Widgets ,Get Widget Instances. see bottom.


Functions

 connect ()
 disconnect ()
 prettyurl ($str)
 convertUrif ($x, $attr)
 convertUri ($x)
 escape ($query)
 URLSecurityCheck ($getvars)
 safe_html ($html)
 reloadTemplates ()
 reloadModules ()
 getGlobalSettings ()
 setGlobalSettings ($globals)
 check_email ($mail)
 setGlobalSettingByAttribute ($attribute, $value)
 displayerror ($error_desc)
 displayinfo ($error_desc)
 displaywarning ($error_desc)
 arraytostring ($array)
 getUserName ($userId)
 getUserFullName ($userId)
 getUserFullNameFromEmail ($email)
 getUserEmail ($userId)
 getUserIdFromEmail ($email)
 getEffectivePageModule ($pageId)
 getNextModuleComponentId ($modulename)
 getDereferencedPageId ($pageId)
 getPagePath ($pageid)
 getPageModule ($pageId)
 getPageTitle ($pageId)
 getParentPage ($pageid)
 getPageInfo ($pageid)
 getPageModuleComponentId ($pageid)
 getPageIdFromModuleComponentId ($moduleName, $moduleComponentId)
 getModuleComponentIdFromPageId ($pageId, $moduleName)
 getPageDepth ($pageId)
 logInfo ($userEmail, $userId, $pageId, $pagePath, $permModule, $permAction, $accessIpAddress)
 isRequiredMaintenance ()
 convertToHttps ($url)
 convertToHttp ($url)
 verifyHttps ($url)
 selfURI ()
 hostURL ()
 replaceAction ($url, $old, $new)
 strleft ($s1, $s2)
 updateUserPassword ($user_email, $user_passwd)
 getUserInfo ($user_email)
 getAvailableTemplates ()
 getAvailableModules ()
 getTableFieldsName ($tablename, $exclude="user_profilepic")
 getNextUserId ()
 showBreadcrumbSubmenu ()
 getFileActualPath ($moduleType, $moduleComponentId, $fileName)
 iscurlinstalled ()
 censor_words ($text)

Variables

global $sourceFolder
global $moduleFolder
 $curl_message = "cURL extention is not enabled/installed on your system. OpenID requires this extention to be loaded. Please enable cURL extention. (This can be done by uncommenting the line \"extension=curl.so\" in your php.ini file). OpenID can't be enabled until you enable cURL."

Detailed Description

Contains functions which are common to many tasks and very frequently used.

Author:
Abhishek <i.abhi27[at]gmail.com>. (c) 2010 Pragyan Team. http://www.gnu.org/licenses/ GNU Public License. For more details, see README

Definition in file common.lib.php.


Function Documentation

arraytostring ( array  ) 

Convert an array to a string recursively

Parameters:
$array Array to convert
Returns:
string containing the array information

Definition at line 276 of file common.lib.php.

censor_words ( text  ) 

Definition at line 772 of file common.lib.php.

check_email ( mail  ) 

To Check if the email provider is not blacklisted

Definition at line 230 of file common.lib.php.

connect (  ) 

To connect to the database

Definition at line 26 of file common.lib.php.

convertToHttp ( url  ) 

Replaces the protocol in a url with http://

Parameters:
$url Url to be converted
Returns:
Converted Url

Definition at line 554 of file common.lib.php.

convertToHttps ( url  ) 

Replaces the protocol in a url with https://

Parameters:
$url Url to be converted
Returns:
Converted Url

Definition at line 542 of file common.lib.php.

convertUri ( x  ) 

Definition at line 99 of file common.lib.php.

convertUrif ( x,
attr 
)

Definition at line 69 of file common.lib.php.

disconnect (  ) 

To disconnect from the database once query is over

Definition at line 33 of file common.lib.php.

displayerror ( error_desc  ) 

Used for error handling

Definition at line 253 of file common.lib.php.

displayinfo ( error_desc  ) 

Used for giving info

Definition at line 259 of file common.lib.php.

displaywarning ( error_desc  ) 

Used for giving warning

Definition at line 266 of file common.lib.php.

escape ( query  ) 

Security Functions Begin, by Abhishek (For Usage, read Security Guidelines) To escape the database queries for avoiding SQL injection attacks

Definition at line 115 of file common.lib.php.

getAvailableModules (  ) 

Definition at line 692 of file common.lib.php.

getAvailableTemplates (  ) 

Definition at line 677 of file common.lib.php.

getDereferencedPageId ( pageId  ) 

Determines the dereferenced Page Id of a given page

Parameters:
$pageid Page id of the page (link) to be dereferenced
Returns:
Integer indicating the dereferenced page id

Definition at line 401 of file common.lib.php.

getEffectivePageModule ( pageId  ) 

Determines the module type of a given page

Parameters:
$pageid Page id of the page, whose module name is to be determined
Returns:
String containing the module name of the given page

Definition at line 371 of file common.lib.php.

getFileActualPath ( moduleType,
moduleComponentId,
fileName 
)

Not checking if filetype adheres to uploadable filetype list beacuse this check can be performed in $moduleInstance->getFileAccessPermission.

Definition at line 742 of file common.lib.php.

getGlobalSettings (  ) 

To retrieve Global Settings from Database

Definition at line 208 of file common.lib.php.

getModuleComponentIdFromPageId ( pageId,
moduleName 
)

Definition at line 473 of file common.lib.php.

getNextModuleComponentId ( modulename  ) 

Gets the next module component id of a given module, which can be used for creating new instances of the same module.

Parameters:
$modulename Name of the module
Returns:
Integer representing the new module component id

Definition at line 384 of file common.lib.php.

getNextUserId (  ) 

Definition at line 727 of file common.lib.php.

getPageDepth ( pageId  ) 
Author:
boopathi returns the depth of the page - 0 if the page is a child of /home
Parameters:
pageId 
Returns:
pageDepth

Definition at line 485 of file common.lib.php.

getPageIdFromModuleComponentId ( moduleName,
moduleComponentId 
)

Definition at line 466 of file common.lib.php.

getPageInfo ( pageid  ) 

Definition at line 454 of file common.lib.php.

getPageModule ( pageId  ) 

Definition at line 428 of file common.lib.php.

getPageModuleComponentId ( pageid  ) 

Definition at line 460 of file common.lib.php.

getPagePath ( pageid  ) 

Definition at line 413 of file common.lib.php.

getPageTitle ( pageId  ) 

Definition at line 434 of file common.lib.php.

getParentPage ( pageid  ) 

Determines the page id of the parent of a given page

Parameters:
$pageid Page id of the page, whose parent is to be determined
Returns:
Integer indicating the page id of the parent page

Definition at line 448 of file common.lib.php.

getTableFieldsName ( tablename,
exclude = "user_profilepic" 
)

Definition at line 707 of file common.lib.php.

getUserEmail ( userId  ) 

Determines the Email-Id of a user, given his/her User Id

Parameters:
$userid User Id of the user, whose E-mail address is to be determined
Returns:
string containing the e-mail address of the user, null representing failure

Definition at line 344 of file common.lib.php.

getUserFullName ( userId  ) 

Determines the Full Name of a user, given his/her User Id

Parameters:
$userId User Id of the user, whose Full Name is to be determined
Returns:
string containing the Full Name of the user, null representing failure

Definition at line 318 of file common.lib.php.

getUserFullNameFromEmail ( email  ) 

Determines the Full Name of a user, given his/her Email ID

Parameters:
$email Email Id of the user, whose Full Name is to be determined
Returns:
string containing the Full Name of the user, null representing failure

Definition at line 331 of file common.lib.php.

getUserIdFromEmail ( email  ) 

Determines the User Id of a user, given his/her E-mail Id

Parameters:
$email E-mail address of the user, whose User Id is to be determined
Returns:
Integer representing the User Id of the user, null representing failure

Definition at line 357 of file common.lib.php.

getUserInfo ( user_email  ) 

Definition at line 614 of file common.lib.php.

getUserName ( userId  ) 

Determines the User Name of a user, given his/her User Id

Parameters:
$userId User Id of the user, whose User Name is to be determined
Returns:
string containing the User Name of the user, null representing failure

Definition at line 305 of file common.lib.php.

hostURL (  ) 

Definition at line 580 of file common.lib.php.

iscurlinstalled (  ) 

Checks for presence of the cURL extension for OpenID.

Definition at line 763 of file common.lib.php.

isRequiredMaintenance (  ) 

Definition at line 518 of file common.lib.php.

logInfo ( userEmail,
userId,
pageId,
pagePath,
permModule,
permAction,
accessIpAddress 
)

Definition at line 493 of file common.lib.php.

prettyurl ( str  ) 

Definition at line 36 of file common.lib.php.

reloadModules (  ) 

Definition at line 174 of file common.lib.php.

reloadTemplates (  ) 

Security Functions Ends Load Templates into the database

Definition at line 145 of file common.lib.php.

replaceAction ( url,
old,
new 
)

Replaces the action in the url to a new action

Parameters:
$url Initial URL
$old Old Action
$new New Action
Returns:
the URL with the new action check for rewrite enabled and handle +action as well as &action=action kind of URLs
Warning:
Whats the guarantee it won't convert some word in the URL which matches the Old Action ?

Definition at line 599 of file common.lib.php.

safe_html ( html  ) 

To prevent XSS attacks

Definition at line 137 of file common.lib.php.

selfURI (  ) 

Definition at line 573 of file common.lib.php.

setGlobalSettingByAttribute ( attribute,
value 
)

To set Global Settings by attribute in Database

Definition at line 243 of file common.lib.php.

setGlobalSettings ( globals  ) 

To set Global Settings in Database

Definition at line 220 of file common.lib.php.

showBreadcrumbSubmenu (  ) 

Definition at line 735 of file common.lib.php.

strleft ( s1,
s2 
)

Definition at line 605 of file common.lib.php.

updateUserPassword ( user_email,
user_passwd 
)

Definition at line 609 of file common.lib.php.

URLSecurityCheck ( getvars  ) 

To protect against writing dangerous URLs, Returns true if it detects a risk, More improvement to be done

Definition at line 125 of file common.lib.php.

verifyHttps ( url  ) 

Definition at line 566 of file common.lib.php.


Variable Documentation

$curl_message = "cURL extention is not enabled/installed on your system. OpenID requires this extention to be loaded. Please enable cURL extention. (This can be done by uncommenting the line \"extension=curl.so\" in your php.ini file). OpenID can't be enabled until you enable cURL."

Definition at line 771 of file common.lib.php.

global $moduleFolder

Definition at line 21 of file common.lib.php.

global $sourceFolder

Definition at line 21 of file common.lib.php.