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)
 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 255 of file common.lib.php.

censor_words ( text  ) 

Definition at line 751 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 533 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 521 of file common.lib.php.

convertUri ( x  ) 

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

convertUrif ( x,
attr 
)

Definition at line 65 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 232 of file common.lib.php.

displayinfo ( error_desc  ) 

Used for giving info

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

displaywarning ( error_desc  ) 

Used for giving warning

Definition at line 245 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 106 of file common.lib.php.

getAvailableModules (  ) 

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

getAvailableTemplates (  ) 

Definition at line 656 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 380 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 350 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 721 of file common.lib.php.

getGlobalSettings (  ) 

To retrieve Global Settings from Database

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

getModuleComponentIdFromPageId ( pageId,
moduleName 
)

Definition at line 452 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 363 of file common.lib.php.

getNextUserId (  ) 

Definition at line 706 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 464 of file common.lib.php.

getPageIdFromModuleComponentId ( moduleName,
moduleComponentId 
)

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

getPageInfo ( pageid  ) 

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

getPageModule ( pageId  ) 

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

getPageModuleComponentId ( pageid  ) 

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

getPagePath ( pageid  ) 

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

getPageTitle ( pageId  ) 

Definition at line 413 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 427 of file common.lib.php.

getTableFieldsName ( tablename,
exclude = "user_profilepic" 
)

Definition at line 686 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 323 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 297 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 310 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 336 of file common.lib.php.

getUserInfo ( user_email  ) 

Definition at line 593 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 284 of file common.lib.php.

hostURL (  ) 

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

iscurlinstalled (  ) 

Checks for presence of the cURL extension for OpenID.

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

isRequiredMaintenance (  ) 

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

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

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

prettyurl ( str  ) 

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

reloadModules (  ) 

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

reloadTemplates (  ) 

Security Functions Ends Load Templates into the database

Definition at line 136 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 578 of file common.lib.php.

safe_html ( html  ) 

To prevent XSS attacks

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

selfURI (  ) 

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

setGlobalSettingByAttribute ( attribute,
value 
)

To set Global Settings by attribute in Database

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

setGlobalSettings ( globals  ) 

To set Global Settings in Database

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

showBreadcrumbSubmenu (  ) 

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

strleft ( s1,
s2 
)

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

updateUserPassword ( user_email,
user_passwd 
)

Definition at line 588 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 116 of file common.lib.php.

verifyHttps ( url  ) 

Definition at line 545 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 750 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.