Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Procedural File: lib-common.php

Source Location: /public_html/lib-common.php



Page Details:

This is the common library for Geeklog. Through our code, you will see functions with the COM_ prefix (e.g. COM_siteHeader()). Any such functions can be found in this file.

--- You don't need to modify anything in this file! --- WARNING: put any custom hacks in lib-custom.php and not in here. This file is modified frequently by the Geeklog development team. If you put your hacks in lib-custom.php you will find upgrading much easier.




Includes:

require_once($_CONF['path_system'].'lib-topic.php') [line 224]
This is the topic library used to manage topics.

require_once($_CONF['path_system'].'classes/device.class.php') [line 201]
Include Device Detect class

require_once($_CONF['path'].'plugins/'.$pi_name.'/functions.inc') [line 8525]
require_once('siteconfig.php') [line 87]
Configuration Include:

You do NOT need to modify anything here any more!


require_once($_CONF['path_system'].'classes/url.class.php') [line 195]
require_once($_CONF['path_system'].'lib-custom.php') [line 248]
This is the custom library.

It is the sandbox for every Geeklog Admin to play in. The lib-custom.php as shipped will never contain required code, so it's safe to always use your own copy. This should hold all custom hacks to make upgrading easier.


require_once($_CONF['path_system'].'lib-syndication.php') [line 219]
This is the syndication library used to offer (RSS) feeds.

require_once($_CONF['path_language'].$_CONF['language'].'.php') [line 418]
Language include

require_once($_CONF['path_system'].'classes/router.class.php') [line 194]
Include URL class

This provides optional URL rewriting functionality.


require_once($_CONF['path_system'].'lib-security.php') [line 214]
This is the security library used for application security

require_once($_CONF['path_system'].'lib-template.php') [line 209]
require_once($_CONF['path_system'].'classes/template.class.php') [line 208]
This is our HTML template class. It is the same one found in PHPLib and is licensed under the LGPL. See that file for details.

require_once($_CONF['path_system'].'classes/timer.class.php') [line 185]
Include page time -- used to time how fast each page was created

require_once($_CONF['path_system'].'classes/config.class.php') [line 98]
Configuration class

require_once($_CONF['path_system'].'classes/timezoneconfig.class.php') [line 167]
Set the webserver's timezone

require_once($_CONF['path_system'].'classes/Autoload.php') [line 92]
require_once($_CONF['path_system'].'lib-mbyte.php') [line 173]
Include multibyte functions

require_once($_CONF['path_system'].'classes/input.class.php') [line 142]
require_once($_CONF['path_system'].'lib-plugins.php') [line 180]
Include plugin class.

This is a poorly implemented class that was not very well thought out. Still very necessary


require_once($_CONF['path_system'].'lib-sessions.php') [line 253]
Session management library

require_once($_CONF['path_system'].'classes/scripts.class.php') [line 318]
Include the Scripts class This provides the ability to set css and javascript.

require_once($_CONF['path_layout'].'functions.php') [line 325]
Include theme functions file which may/may not do anything

require_once($_CONF['path_system'].'lib-block.php') [line 229]
This is the block library used to manage blocks.

require_once($_CONF['path_system'].'classes/language.class.php') [line 413]



Boolean $_COM_VERBOSE [line 54]

Turn this on to get various debug messages from the code in this library

Default value:   false


[ Top ]



array $_GROUPS [line 450]

Global array of groups current user belongs to

Default value:   SEC_getUserGroups($_USER['uid'])


[ Top ]



array $_RIGHTS [line 460]

Global array of current user permissions [read,edit]

Default value:   explode(',', SEC_getUserPermissions())


[ Top ]





GL_INITIALIZED [line 8539]

GL_INITIALIZED = true

[ Top ]




COM_accessLog [line 2637]

void COM_accessLog( string $logentry)

Logs message to access.log This will print a message to the Geeklog access log



Tags:

see:  COM_errorLog()


Parameters

string   $logentry   Message to write to access log
[ Top ]



COM_adminMenu [line 3642]

void COM_adminMenu( [string $help = ''], [string $title = ''], [string $position = ''])

Prints administration menu This will return the administration menu items that the user has sufficient rights to -- Admin Block on the left side.



Tags:

see:  COM_userMenu()


Parameters

string   $help   Help file to show
string   $title   Menu Title
string   $position   Side being shown on 'left', 'right' or blank.
[ Top ]



COM_allowedAutotags [line 4619]

string COM_allowedAutotags( [boolean $list_only = false], [array $allowed_tags = ''])

Returns what autotag is allowed in content Returns what autotags the system allows to be used inside content.



Tags:

return:  HTML <div>/<span> enclosed string
see:  COM_checkHTML()


Parameters

boolean   $list_only   true = return only the list of HTML tags
array   $allowed_tags   Array of allowed special tags ('code', 'raw', 'page_break' ...)
[ Top ]



COM_allowedHTML [line 4548]

string COM_allowedHTML( [string $permissions = 'story.edit'], [boolean $list_only = false], [int $filter_html_flag = 1], [string $post_mode = ''])

Returns what HTML is allowed in content Returns what HTML tags the system allows to be used inside content.

You can modify this by changing $_CONF['user_html'] in the configuration (for admins, see also $_CONF['admin_html']).




Tags:

return:  HTML <div>/<span> enclosed string
see:  COM_checkHTML()


Parameters

string   $permissions   comma-separated list of rights which identify the current user as an "Admin"
boolean   $list_only   true = return only the list of HTML tags
int   $filter_html_flag  
    1. = returns allowed HTML tags only,
    2. = returns No HTML Tags Allowed (this is used by plugins if they have
    a config that overrides Geeklogs filter html settings or do not have a post mode)
    string   $post_mode   Indicates if text is html, adveditor, wikitext or plaintext
    [ Top ]



    COM_applyBasicFilter [line 6351]

    string COM_applyBasicFilter( string $parameter, [boolean $isnumeric = false])

    Filter parameters NOTE: Use this function instead of COM_applyFilter for parameters _not_ coming in through a GET or POST request.



    Tags:

    return:  the filtered parameter (may now be empty or 0)
    see:  COM_applyFilter()


    Parameters

    string   $parameter   the parameter to test
    boolean   $isnumeric   true if $parameter is supposed to be numeric
    [ Top ]



    COM_applyFilter [line 6334]

    string COM_applyFilter( string $parameter, [boolean $isnumeric = false])

    Filter parameters passed per GET (URL) or POST.



    Tags:

    return:  the filtered parameter (may now be empty or 0)
    see:  COM_applyBasicFilter()


    Parameters

    string   $parameter   the parameter to test
    boolean   $isnumeric   true if $parameter is supposed to be numeric
    [ Top ]



    COM_buildURL [line 6026]

    string COM_buildURL( string $url)

    Wrapper function for URL class so as to not confuse people as this will eventually get used all over the place This function returns a crawler friendly URL (if possible)



    Tags:

    return:  Rewritten URL


    Parameters

    string   $url   URL to try to build crawler friendly URL for
    [ Top ]



    COM_checkHTML [line 3828]

    string COM_checkHTML( string $str, [string $permissions = 'story.edit'])

    This function checks html tags.

    Checks to see that the HTML tags are on the approved list and removes them if not.




    Tags:

    return:  Filtered HTML


    Parameters

    string   $str   HTML to check
    string   $permissions   comma-separated list of rights which identify the current user as an "Admin"
    [ Top ]



    COM_checkInstalled [line 8226]

    void COM_checkInstalled( )

    Check if Geeklog has been installed yet This is a (very) simple check to see if the user already ran the install script. If not, abort and display a nice(r) welcome screen with handy links to the install script and instructions. Inspired by MediaWiki ...



    [ Top ]



    COM_checkList [line 2370]

    string COM_checkList( string $table, string $selection, [string $where = ''], [string $selected = ''], [string $fieldname = ''])

    Creates a <input> checklist from a database list for use in forms Creates a group of checkbox form fields with given arguments



    Tags:

    return:  HTML with Checkbox code
    see:  COM_optionList()


    Parameters

    string   $table   DB Table to pull data from
    string   $selection   Comma delimited list of fields to pull from table
    string   $where   Where clause of SQL statement
    string   $selected   Value to set to CHECKED
    string   $fieldname   Name to use for the checkbox array
    [ Top ]



    COM_checkSpeedlimit [line 5915]

    int COM_checkSpeedlimit( [string $type = 'submit'], [int $max = 1], [string $property = ''])

    Check if speed limit applies



    Tags:

    return:  0: does not apply, else: seconds since last post


    Parameters

    string   $type   type of speed limit, e.g. 'submit', 'comment'
    int   $max   max number of allowed tries within speed limit
    string   $property   IP address or other identifiable property
    [ Top ]



    COM_checkWords [line 3730]

    string COM_checkWords( string $message, [string $type = ''])

    This censors inappropriate content This will replace 'bad words' with something more appropriate



    Tags:

    return:  Edited $Message
    see:  COM_checkHTML()


    Parameters

    string   $message   String to check
    string   $type   e.g. 'story', 'comment'
    [ Top ]



    COM_clearSpeedlimit [line 5987]

    void COM_clearSpeedlimit( [int $speedlimit = 60], [string $type = ''])

    Clear out expired speed limits, i.e. entries older than 'x' seconds



    Parameters

    int   $speedlimit   number of seconds
    string   $type   type of speed limit, e.g. 'submit', 'comment'
    [ Top ]



    COM_commandControl [line 3082]

    void COM_commandControl( [string $adminMenu = false], [string $help = ''], [string $title = ''], [string $position = ''])

    Prints Command and Control Page or Administration Menu Block This will return the command and control items or administration menu items that the user has sufficient rights to -- Admin Block on the left side.



    Tags:

    see:  COM_adminMenu()


    Parameters

    string   $adminMenu   True if admin menu, false if command and control page
    string   $help   Help file to show (admin menu only)
    string   $title   Menu Title (admin menu only)
    string   $position   Side being shown on 'left', 'right' or blank. (admin menu only)
    [ Top ]



    COM_convertDate2Timestamp [line 6840]

    int COM_convertDate2Timestamp( string $date, [string $time = ''])

    Convert a text based date YYYY-MM-DD to a unix timestamp integer value



    Tags:

    return:  UNIX Timestamp


    Parameters

    string   $date   Date in the format YYYY-MM-DD
    string   $time   Option time in the format HH:MM::SS
    [ Top ]



    COM_createHTMLDocument [line 1506]

    string COM_createHTMLDocument( [ &$content = ''], [array $information = array()], string $content)

    Create and return the HTML document



    Tags:

    return:  Formated HTML document
    see:  COM_siteFooter()
    see:  COM_siteHeader()


    Parameters

    string   $content   Main content for the page
    array   $information   An array defining variables to be used when creating the output string 'what' If 'none' then no left blocks are returned, if 'menu' (default) then right blocks are returned string 'pagetitle' Optional content for the page's <title> string 'breadcrumbs' Optional content for the page's breadcrumb string 'headercode' Optional code to go into the page's <head> boolean 'rightblock' Whether or not to show blocks on right hand side default is no (-1) array 'custom' An array defining custom function to be used to format Rightblocks
       &$content  
    [ Top ]



    COM_createImage [line 7052]

    string COM_createImage( string $url, [string $alt = ''], [array $attr = array()])

    Create an HTML img



    Tags:

    return:  the HTML img


    Parameters

    string   $url   the URL of the image, either starting with http://... or $_CONF['layout_url'] is prepended
    string   $alt   the 'alt'-tag of the image
    array   $attr   an array of optional attributes for the link for example array('title' => 'whatever');
    [ Top ]



    COM_createLink [line 7029]

    string COM_createLink( string $content, string $url, [array $attr = array()])

    Create an HTML link



    Tags:

    return:  the HTML link


    Parameters

    string   $content   the object to be linked (text, image etc)
    string   $url   the URL the link will point to
    array   $attr   an array of optional attributes for the link for example array('title' => 'whatever');
    [ Top ]



    COM_createMetaTags [line 7935]

    string COM_createMetaTags( mixed $meta_description, string $meta_keywords)

    Create Meta Tags to be used by COM_siteHeader in the headercode variable



    Tags:

    return:  (X)HTML formatted text
    since:  Geeklog-1.6.1


    Parameters

    mixed   $meta_description   In case of a string value, this is the text for the meta description of the page being displayed. In case of an array value, this is key-value pair(s) for the meta description.
    string   $meta_keywords   the text for the meta keywords of the page being displayed
    [ Top ]



    COM_dateDiff [line 6612]

    int COM_dateDiff( string $interval, string|int $date1, string|int $date2)

    Determines the difference between two dates.

    This will takes either unixtimestamps or English dates as input and will automatically do the date diff on the more recent of the two dates (e.g. the order of the two dates given doesn't matter).




    Tags:

    return:  Difference of the two dates in the unit of time indicated by the interval
    author:  Tony Bibbs, tony DOT bibbs AT iowa DOT gov
    access:  public


    Parameters

    string   $interval   Can be: y = year m = month w = week h = hours i = minutes s = seconds
    string|int   $date1   English date (e.g. 10 Dec 2004) or unixtimestamp
    string|int   $date2   English date (e.g. 10 Dec 2004) or unixtimestamp
    [ Top ]



    COM_debug [line 2444]

    string COM_debug( array $array)

    Prints out an associative array for debugging

    The core of this code has been lifted from phpweblog which is licenced under the GPL. This is not used very much in the code but you can use it if you see fit




    Tags:

    return:  Formatted HTML List


    Parameters

    array   $array   Array to loop through and print values for
    [ Top ]



    COM_displayMessageAndAbort [line 6938]

    void COM_displayMessageAndAbort( int $msg, [string $plugin = ''], [int $http_status = 200], [string $http_text = 'OK'])

    Display a message and abort NOTE: Displays the message and aborts the script.



    Parameters

    int   $msg   message number
    string   $plugin   plugin name, if applicable
    int   $http_status   HTTP status code to send with the message
    string   $http_text   Textual version of the HTTP status code
    [ Top ]



    COM_emailEscape [line 3901]

    string COM_emailEscape( string $string)

    Encode a string such that it can be used in an email header



    Tags:

    return:  encoded text


    Parameters

    string   $string   the text to be encoded
    [ Top ]



    COM_emailUserTopics [line 4781]

    void COM_emailUserTopics( )

    This will email new stories in the topics that the user is interested in In account information the user can specify which topics for which they will receive any new article for in a daily digest.



    [ Top ]



    COM_emailUserTopicsUrlRewriter [line 4759]

    string COM_emailUserTopicsUrlRewriter( $matches)

    Convert a relative URL to an absolute one



    Parameters

    array   $matches  
    [ Top ]



    COM_endBlock [line 2173]

    string COM_endBlock( [string $template = 'blockfooter.thtml'])

    Closes out COM_startBlock



    Tags:

    return:  Formatted HTML to close block
    see:  COM_startBlock()


    Parameters

    string   $template   HTML template file used to format block footer
    [ Top ]



    COM_errorLog [line 2559]

    string COM_errorLog( string $logentry, [int $actionid = ''])

    Logs messages to error.log or the web page or both Prints a well formatted message to either the web page, error log or both.



    Tags:

    return:  If $actionid = 2 or '' then HTML formatted string (wrapped in block) else nothing
    see:  COM_accessLog()


    Parameters

    string   $logentry   Text to log to error log
    int   $actionid   where 1 = write to log file, 2 = write to screen (default) both
    [ Top ]



    COM_escapeMetaTagValue [line 7900]

    string COM_escapeMetaTagValue( string $value)

    Check and modify a meta tag value



    Tags:

    since:  Geeklog-2.1.0


    Parameters

    string   $value  
    [ Top ]



    COM_featuredCheck [line 2513]

    void COM_featuredCheck( )

    Checks and Updates the featured status of all articles.

    Checks to see if any articles that were published for the future have been published and, if so, will see if they are featured. If they are featured, this will set old featured article (if there is one) to normal




    [ Top ]



    COM_formatBlock [line 4262]

    string COM_formatBlock( array $A, [boolean $noboxes = false], [boolean $noposition = false])

    Formats a Geeklog block This shows a single block and is typically called from COM_showBlocks OR from plugin code



    Tags:

    return:  HTML Formated block


    Parameters

    array   $A   Block Record
    boolean   $noboxes   Set to true if userpref is no blocks
    boolean   $noposition   Set to true if you don't want to use the left or right side footer and header of block
    [ Top ]



    COM_formatEmailAddress [line 3944]

    string COM_formatEmailAddress( string $name, string $address)

    Takes a name and an email address and returns a string that vaguely resembles an email address specification conforming to RFC(2)822 ...



    Tags:

    return:  formatted email address
    deprecated:  since v2.1.2


    Parameters

    string   $name   name, e.g. John Doe
    string   $address   email address only, e.g. john.doe@example.com
    [ Top ]



    COM_formatTimeString [line 5188]

    void COM_formatTimeString( string $time_string, int $time, [string $type = ''], [int $amount = 0])

    Creates the string that indicates the timespan in which new items were found



    Parameters

    string   $time_string   template string
    int   $time   number of seconds in which results are found
    string   $type   type (translated string) of new item
    int   $amount   amount of things that have been found.
    [ Top ]



    COM_getAmPmFormSelection [line 5843]

    string COM_getAmPmFormSelection( string $name, [string $selected = ''])

    Create an am/pm selector dropdown menu



    Tags:

    return:  HTML for the dropdown; empty string in 24 hour mode


    Parameters

    string   $name   name of the <select>
    string   $selected   preselection: 'am' or 'pm'
    [ Top ]



    COM_getArgument [line 6050]

    string COM_getArgument( string $name)

    Wrapper function for URL class returns value for specified argument



    Tags:

    return:  Argument value


    Parameters

    string   $name   argument to get value for
    [ Top ]



    COM_getBlockTemplate [line 584]

    string COM_getBlockTemplate( string $blockname, string $which, [string $position = ''])

    Return the file to use for a block template.

    This returns the template needed to build the HTML for a block. This function allows designers to give a block it's own custom look and feel. If no templates for the block are specified, the default blockheader.html and blockfooter.html will be used.




    Tags:

    return:  template name
    see:  COM_showBlock()
    see:  COM_showBlocks()
    see:  COM_endBlock()
    see:  COM_startBlock()


    Parameters

    string   $blockname   corresponds to name field in block table
    string   $which   can be either 'header' or 'footer' for corresponding template
    string   $position   can be 'left', 'right' or blank. If set, will be used to find a side specific override template.
    [ Top ]



    COM_getCharset [line 7574]

    string COM_getCharset( )

    Get the current character set

    Uses (if available, and in this order)

    • $LANG_CHARSET (from the current language file)
    • $_CONF['default_charset'] (from siteconfig.php)
    • 'iso-8859-1' (hard-coded fallback)




    Tags:

    return:  character set, e.g. 'utf-8'


    [ Top ]



    COM_getCurrentURL [line 6699]

    string COM_getCurrentURL( )

    Try to figure out our current URL, including all parameters.

    This is an ugly hack since there's no single variable that returns what we want and the variables used here may not be available on all servers and / or setups. Seems to work on Apache (1.3.x and 2.x), nginx, and IIS.




    Tags:

    return:  complete URL, e.g. 'http://www.example.com/blah.php?foo=bar'


    [ Top ]



    COM_getDayFormOptions [line 5662]

    string COM_getDayFormOptions( [string $selected = ''])

    Gets the <option> values for calendar days



    Tags:

    return:  HTML days as option values
    see:  COM_getMinuteFormOptions()
    see:  COM_getHourFormOptions()
    see:  COM_getYearFormOptions()
    see:  COM_getMonthFormOptions()


    Parameters

    string   $selected   Selected day
    [ Top ]



    COM_getDisplayName [line 4698]

    string COM_getDisplayName( [int $uid = ''], [string $username = ''], [string $fullname = ''], [string $remoteusername = ''], [string $remoteservice = ''])

    Return the username or fullname for the passed member id (uid) Allows the siteAdmin to determine if loginname (username) or fullname should be displayed.



    Tags:

    return:  Username, fullname or username@Service


    Parameters

    int   $uid   site member id
    string   $username   Username, if this is set no lookup is done.
    string   $fullname   Users full name.
    string   $remoteusername   Username on remote service
    string   $remoteservice   Remote login service.
    [ Top ]



    COM_getEncodingt [line 8318]

    string COM_getEncodingt( )

    Get a valid encoding for htmlspecialchars()



    Tags:

    return:  character set, e.g. 'utf-8'


    [ Top ]



    COM_getHourFormOptions [line 5736]

    string COM_getHourFormOptions( [string $selected = ''], [int $mode = 12])

    Gets the <option> values for clock hours



    Tags:

    return:  HTML string of options
    see:  COM_getMinuteFormOptions()
    see:  COM_getYearFormOptions()
    see:  COM_getDayFormOptions()
    see:  COM_getMonthFormOptions()


    Parameters

    string   $selected   Selected hour
    int   $mode   12 or 24 hour mode
    [ Top ]



    COM_getImgSizeAttributes [line 6888]

    string COM_getImgSizeAttributes( string $file)

    Get the HTML for an image with height & width



    Tags:

    return:  html that will be included in the img-tag


    Parameters

    string   $file   full path to the file
    [ Top ]



    COM_getLangIso639Code [line 8361]

    string COM_getLangIso639Code( [string $langName = null])

    Returns the ISO-639-1 language code



    Parameters

    string   $langName  
    [ Top ]



    COM_getLangSQL [line 7223]

    string COM_getLangSQL( string $field, [string $type = 'WHERE'], [string $table = ''])

    Return SQL expression to request language-specific content Creates part of an SQL expression that can be used to request items in the current language only.



    Tags:

    return:  SQL expression string (may be empty)


    Parameters

    string   $field   name of the "id" field, e.g. 'sid' for stories
    string   $type   part of the SQL expression, e.g. 'WHERE', 'AND'
    string   $table   table name if ambiguous, e.g. in JOINs
    [ Top ]



    COM_getLanguage [line 7115]

    string COM_getLanguage( )

    Determine current language



    Tags:

    return:  name of the language file (minus the '.php' extension)


    [ Top ]



    COM_getLanguageFromBrowser [line 7082]

    string COM_getLanguageFromBrowser( )

    Try to determine the user's preferred language by looking at the "Accept-Language" header sent by their browser (assuming they bothered to select a preferred language there).

    Sample header: Accept-Language: en-us,en;q=0.7,de-de;q=0.3




    Tags:

    return:  name of the language file to use or an empty string
    todo:  Bugs: Does not take the quantity ('q') parameter into account, but only looks at the order of language codes.


    [ Top ]



    COM_getLanguageId [line 7190]

    string COM_getLanguageId( [string $language = ''])

    Determine the ID to use for the current language The $_CONF['language_files'] array maps language IDs to language file names.

    This function returns the language ID for a certain language file, to be used in language-dependent URLs.




    Tags:

    return:  language ID, e.g 'en'; empty string on error


    Parameters

    string   $language   current language file name (optional)
    [ Top ]



    COM_getLanguageIdForObject [line 7153]

    string COM_getLanguageIdForObject( string $id)

    Determine the language of the object from the id



    Tags:

    return:  language ID, e.g 'en'; empty string on error


    Parameters

    string   $id   id of object to retrieve language id from
    [ Top ]



    COM_getLanguageName [line 7363]

    string COM_getLanguageName( )

    Get the name of the current language, minus the character set Strips the character set from $_CONF['language'].



    Tags:

    return:  language name


    [ Top ]



    COM_getMinuteFormOptions [line 5798]

    string COM_getMinuteFormOptions( [string $selected = ''], [int $step = 1])

    Gets the <option> values for clock minutes



    Tags:

    return:  HTML of option minutes
    see:  COM_getYearFormOptions()
    see:  COM_getHourFormOptions()
    see:  COM_getDayFormOptions()
    see:  COM_getMonthFormOptions()


    Parameters

    string   $selected   Selected minutes
    int   $step   number of minutes between options, e.g. 15
    [ Top ]



    COM_getMinuteOptions [line 5831]

    void COM_getMinuteOptions( [ $selected = ''], [ $step = 1])

    For backward compatibility only.

    This function should always have been called COM_getMinuteFormOptions




    Tags:



    Parameters

       $selected  
       $step  
    [ Top ]



    COM_getMonthFormOptions [line 5632]

    string COM_getMonthFormOptions( [string $selected = ''])

    Gets the <option> values for calendar months



    Tags:

    return:  HTML Months as option values
    see:  COM_getMinuteFormOptions()
    see:  COM_getHourFormOptions()
    see:  COM_getYearFormOptions()
    see:  COM_getDayFormOptions()


    Parameters

    string   $selected   Selected month
    [ Top ]



    COM_getNoScript [line 7388]

    string COM_getNoScript( [boolean $warning = true], [string $noscript_message = ''], [string $link_message = ''])

    Returns text that will display if JavaScript is not enabled in the browser



    Tags:

    return:  noscript html tag with message(s)


    Parameters

    boolean   $warning   If true displays default JavaScript recommended warning message If false displays default JavaScript Required message
    string   $noscript_message   Used instead of default message
    string   $link_message   Secondary message that may contain a link
    [ Top ]



    COM_getPassword [line 4666]

    string COM_getPassword( string $loginname)

    Return the password for the given username Fetches a password for the given user



    Tags:

    return:  Password or ''


    Parameters

    string   $loginname   username to get password for
    [ Top ]



    COM_getPermSQL [line 6192]

    string COM_getPermSQL( [string $type = 'WHERE'], [int $u_id = 0], [int $access = 2], [string $table = ''])

    Return SQL expression to check for permissions.

    Creates part of an SQL expression that can be used to request items with the standard set of Geeklog permissions.




    Tags:

    return:  SQL expression string (may be empty)


    Parameters

    string   $type   part of the SQL expr. e.g. 'WHERE', 'AND'
    int   $u_id   user id or 0 = current user
    int   $access   access to check for (2=read, 3=r&write)
    string   $table   table name if ambiguous (e.g. in JOINs)
    [ Top ]



    COM_getPermTag [line 6123]

    int COM_getPermTag( int $owner_id, int $group_id, int $perm_owner, int $perm_group, int $perm_members, int $perm_anon, [ $u_id = 0], int $uid)

    Check for Tag usuage permissions.

    This function takes the usuage access info of the autotag passed to it and let's us know if the user has access to use the autotag.




    Tags:

    return:  returns true if user has access


    Parameters

    int   $owner_id   ID of the owner of object
    int   $group_id   ID of group object belongs to
    int   $perm_owner   Permissions the owner has
    int   $perm_group   Permissions the gorup has
    int   $perm_members   Permissions logged in members have
    int   $perm_anon   Permissions anonymous users have
    int   $uid   User ID to get information for. If empty current user.
       $u_id  
    [ Top ]



    COM_getRate [line 6064]

    int COM_getRate( int $occurrences, int $timespan)

    Occurrences / time This will take a number of occurrences, and number of seconds for the time span and return the smallest #/time interval



    Tags:

    return:  Seconds per interval


    Parameters

    int   $occurrences   how many occurrences during time interval
    int   $timespan   time interval in seconds
    [ Top ]



    COM_getTextContent [line 8080]

    string COM_getTextContent( string $text)

    Turn a piece of HTML into continuous(!) plain text This function removes HTML tags, line breaks, etc. and returns one long line of text. This is useful for word counts (do an explode() on the result) and for text excerpts.



    Tags:

    return:  continuous plain text


    Parameters

    string   $text   original text, including HTML and line breaks
    [ Top ]



    COM_getThemes [line 635]

    array COM_getThemes( [boolean $all = false])

    Gets all installed themes Returns a list of all the directory names in $_CONF['path_themes'], i.e.

    a list of all the theme names.




    Tags:

    return:  All installed themes


    Parameters

    boolean   $all   if true, return all themes even if users aren't allowed to change their default themes
    [ Top ]



    COM_getTooltip [line 7431]

    string COM_getTooltip( [string $hoverover = ''], [string $text = ''], [string $link = ''], [string $title = ''], [string $template = 'classic'], [string $class = 'gl-tooltip'])

    Returns an text/image that will display a tooltip This tooltip is based on an example from http://downloads.sixrevisions.com/css-tooltips/index.html



    Tags:

    return:  HTML tooltip


    Parameters

    string   $hoverover   Text or image to display for the user to hover their mouse cursor over.
    string   $text   Text for the actual tooltip. Can include HTML.
    string   $link   Link for the tooltip. If passed, then the hoverover text becomes a link.
    string   $title   Text for the tooltip title (if there is one). Can include HTML.
    string   $template   Specify a different template to use (classic, critical, help, information, warning).
    string   $class   Specify a different tooltip class to use.
    [ Top ]



    COM_getTopicImageUrl [line 6991]

    string COM_getTopicImageUrl( string $imageurl)

    Return full URL of a topic icon



    Tags:

    return:  Full URL


    Parameters

    string   $imageurl   (relative) topic icon URL
    [ Top ]



    COM_getTopicSQL [line 6258]

    string COM_getTopicSQL( [string $type = 'WHERE'], [int $u_id = 0], [string $table = ''])

    Return SQL expression to check for allowed topics.

    Creates part of an SQL expression that can be used to only request stories from topics to which the user has access to. Note that this function does an SQL request, so you should cache the resulting SQL expression if you need it more than once.




    Tags:

    return:  SQL expression string (may be empty)


    Parameters

    string   $type   part of the SQL expr. e.g. 'WHERE', 'AND'
    int   $u_id   user id or 0 = current user
    string   $table   table name if ambiguous (e.g. in JOINs)
    [ Top ]



    COM_getUserCookieTimeout [line 5513]

    int COM_getUserCookieTimeout( )

    Returns user-defined cookie timeout In account preferences users can specify when their long-term cookie expires.

    This function returns that value.




    Tags:

    return:  Cookie time out value in seconds


    [ Top ]



    COM_getUserDateTimeFormat [line 5474]

    array COM_getUserDateTimeFormat( [string $date = ''])

    Returns formatted date/time for user

    This function COM_takes a date in either unixtimestamp or in english and formats it to the users preference. If the user didn't specify a format the format in the config file is used. This returns an array where array[0] is the formatted date and array[1] is the unixtimestamp




    Tags:

    return:  array[0] is the formatted date and array[1] is the unixtimestamp.


    Parameters

    string   $date   date to format, otherwise we format current date/time
    [ Top ]



    COM_getYearFormOptions [line 5699]

    string COM_getYearFormOptions( [string $selected = ''], [int $startoffset = -1], [int $endoffset = 5])

    Gets the <option> values for calendar years Returns Option list Containing 5 years starting with current unless @selected is < current year then starts with @selected



    Tags:

    return:  HTML years as option values
    see:  COM_getMinuteFormOptions()
    see:  COM_getHourFormOptions()
    see:  COM_getDayFormOptions()
    see:  COM_getMonthFormOptions()


    Parameters

    string   $selected   Selected year
    int   $startoffset   Optional (can be +/-) Used to determine start year for range of years
    int   $endoffset   Optional (can be +/-) Used to determine end year for range of years
    [ Top ]



    COM_handle404 [line 7595]

    void COM_handle404( [string $alternate_url = ''])

    Display a 404 not found error message



    Parameters

    string   $alternate_url   Point the user to another location
    [ Top ]



    COM_handleCode [line 3809]

    string COM_handleCode( string $str)

    Handles the part within a [code] ... [/code] section, i.e. escapes all special characters.



    Tags:

    return:  with the special characters encoded
    see:  COM_checkHTML()


    Parameters

    string   $str   the code section to encode
    [ Top ]



    COM_handleError [line 7660]

    void COM_handleError( int $errno, string $errstr, [string $errfile = ''], [int $errline = 0], [array $errcontext = ''])

    Handle errors.

    This function will handle all PHP errors thrown at it, without exposing paths, and hopefully, providing much more information to Root Users than the default white error page. This function will call out to CUSTOM_handleError if it exists, but, be advised, only override this function with a very, very stable function. I'd suggest one that outputs some static, basic HTML. The PHP feature that allows us to do so is documented here: http://uk2.php.net/manual/en/function.set-error-handler.php




    Parameters

    int   $errno   Error Number.
    string   $errstr   Error Message.
    string   $errfile   The file the error was raised in.
    int   $errline   The line of the file that the error was raised at.
    array   $errcontext   An array that points to the active symbol table at the point the error occurred.
    [ Top ]



    COM_handleException [line 8516]

    void COM_handleException( Throwable|Exception $exception)

    Default exception handler



    Parameters

    Throwable|Exception   $exception  
    [ Top ]



    COM_highlightQuery [line 6562]

    string COM_highlightQuery( string $text, string $query, [string $class = 'highlight'])

    Highlight the words from a search query in a given text string.



    Tags:

    return:  the text with highlighted search words


    Parameters

    string   $text   the text
    string   $query   the search query
    string   $class   html class to use to highlight
    [ Top ]



    COM_hit [line 4743]

    void COM_hit( )

    Adds a hit to the system

    This function is called in the footer of every page and is used to track the number of hits to the Geeklog system. This information is shown on stats.php




    [ Top ]



    COM_isAnonUser [line 7875]

    boolean COM_isAnonUser( [int $uid = ''])

    Checks to see if a specified user, or the current user if non-specified is the anonymous user.



    Tags:

    return:  true if the user is the anonymous user.


    Parameters

    int   $uid   ID of the user to check, or none for the current user.
    [ Top ]



    COM_isEmail [line 3886]

    boolean COM_isEmail( string $email)

    Checks to see if email address is valid.

    This function checks to see if an email address is in the correct from.




    Tags:

    return:  True if valid otherwise false


    Parameters

    string   $email   Email address to verify
    [ Top ]



    COM_isFrontpage [line 6806]

    void COM_isFrontpage( )

    Check if we're on Geeklog's index page [deprecated] Note that this function returns FALSE when we're on the index page. Due to the inverted return values, it has been deprecated and is only provided for backward compatibility - use COM_onFrontpage() instead.



    Tags:

    see:  COM_onFrontpage()
    deprecated:  since Geeklog 1.4.1


    [ Top ]



    COM_killJS [line 3796]

    string COM_killJS( string $Message)

    Takes some amount of text and replaces all javascript events on*= with in

    This script takes some amount of text and matches all javascript events, on*= (onBlur= onMouseClick=) and replaces them with in*= Essentially this will cause onBlur to become inBlur, onFocus to be inFocus These are not valid javascript events and the browser will ignore them.




    Tags:

    return:  with javascript filtered
    see:  COM_checkHTML()
    see:  COM_checkWords()


    Parameters

    string   $Message   Text to filter
    [ Top ]



    COM_mail [line 3980]

    bool COM_mail( string|array $to, string $subject, string $message, [string|array $from = ''], [bool $html = false], [int $priority = 0], [mixed $optional = null], [ $attachments = array()])

    Send an email.

    All emails sent by Geeklog are sent through this function. NOTE: Please note that using CC: will expose the email addresses of all recipients. Use with care.




    Tags:

    return:  true if successful, otherwise false


    Parameters

    string|array   $to   recipient's email address | array(email address => recipient's name)
    string   $subject   subject of the email
    string   $message   the text of the email
    string|array   $from   (optional) sender's email address | array(email address > sender's name)
    bool   $html   (optional) true if to be sent as HTML email
    int   $priority   (optional) add X-Priority header, if > 0
    mixed   $optional   (optional) other headers or CC:
    array   $attachments   (optional) array of file names to attach
    [ Top ]



    COM_makeClickableLinks [line 6481]

    string COM_makeClickableLinks( string $text)

    Detect links in a plain-ascii text and turn them into clickable links.

    Will detect links starting with "http:", "https:", "ftp:", and "www.".




    Tags:

    return:  the same string, with links enclosed in <a>...</a> tags


    Parameters

    string   $text   the (plain-ascii) text string
    [ Top ]



    COM_makeClickableLinksCallback [line 6511]

    string COM_makeClickableLinksCallback( string $http, string $link)

    Callback function to help format links in COM_makeClickableLinks



    Tags:

    return:  link enclosed in <a>...</a> tags


    Parameters

    string   $http   set to 'http://' when not already in the url
    string   $link   the url
    [ Top ]



    COM_makeList [line 5879]

    string COM_makeList( array $listofitems, [string $classname = ''])

    Creates an HTML unordered list from the given array.

    It formats one list item per array element, using the list.thtml template




    Tags:

    return:  HTML unordered list of array items


    Parameters

    array   $listofitems   Items to list out
    string   $classname   optional CSS class name for the list
    [ Top ]



    COM_makesid [line 3871]

    string COM_makesid( )

    Makes an ID based on current date/time This function creates a 17 digit sid for stories based on the 14 digit date and a 3 digit random number that was seeded with the number of microseconds (.000001th of a second) since the last full second.

    NOTE: this is now used for more than just stories!




    Tags:

    return:  Story ID


    [ Top ]



    COM_newTemplate [line 8287]

    object An COM_newTemplate( string $root, [array $options = array()])

    Provide support for drop-in replacable template engines



    Tags:

    return:  ITemplate derved object


    Parameters

    string   $root   Path to template root
    array   $options   List of options to pass to constructor
    [ Top ]



    COM_nl2br [line 8343]

    string COM_nl2br( string $string)

    Replaces all newlines in a string with
    or
    , depending on the detected setting.



    Tags:

    return:  The modified string


    Parameters

    string   $string   The string to modify
    [ Top ]



    COM_numberFormat [line 6818]

    string COM_numberFormat( float $number)

    Converts a number for output into a formatted number with thousands- separator, comma-separator and fixed decimals if necessary



    Tags:

    return:  formatted number


    Parameters

    float   $number   Number that will be formatted
    [ Top ]



    COM_olderStoriesBlock [line 3994]

    string COM_olderStoriesBlock( [string $help = ''], [string $title = ''], [string $position = ''])

    Shows older story information in a block Return the HTML that shows any older stories



    Tags:

    return:  Return the HTML that shows any new stories, comments, etc


    Parameters

    string   $help   Help file for block
    string   $title   Title used in block header
    string   $position   Position in which block is being rendered 'left', 'right' or blank (for centre)
    [ Top ]



    COM_onFrontpage [line 6773]

    boolean COM_onFrontpage( )

    Check if we're on Geeklog's index page.

    See if we're on the main index page (first page, no topics selected).




    Tags:

    return:  true = we're on the frontpage, false = we're not


    [ Top ]



    COM_optionList [line 2205]

    string COM_optionList( string $table, string $selection, [string $selected = ''], [int $sortcol = 1], [string $where = ''])

    Creates a <option> list from a database list for use in forms Creates option list form field using given arguments



    Tags:

    return:  Formated HTML of option values
    see:  COM_checkList()


    Parameters

    string   $table   Database Table to get data from
    string   $selection   Comma delimited string of fields to pull The first field is the value of the option and the second is the label to be displayed. This is used in a SQL statement and can include DISTINCT to start.
    int   $sortcol   Which field to sort option list by 0 (value) or 1 (label)
    string   $where   Optional WHERE clause to use in the SQL Selection
    string   $selected   /array $selected Value (from $selection) to set to SELECTED or default
    [ Top ]



    COM_output [line 8041]

    void COM_output( string $display)

    Sends compressed output to browser.

    Assumes that $display contains the _entire_ output for a request - no echoes are allowed before or after this function. Currently only supports gzip compression. Checks if zlib compression is enabled in PHP and does uncompressed output if it is.




    Parameters

    string   $display   Content to send to browser
    [ Top ]



    COM_printPageNavigation [line 5341]

    string COM_printPageNavigation( string $base_url, int $curpage, int $num_pages, [string $page_str = 'page='], [boolean $do_rewrite = false], [string $msg = ''], [string $open_ended = ''])

    Prints Google(tm)-like paging navigation



    Tags:

    return:  HTML formatted widget


    Parameters

    string   $base_url   base url to use for all generated links. If an array, then the current parameter as the first part of the url, and the end is the last part of the url
    int   $curpage   current page we are on
    int   $num_pages   Total number of pages
    string   $page_str   page-variable name AND '='
    boolean   $do_rewrite   if true, url-rewriting is respected
    string   $msg   to be displayed with the navigation
    string   $open_ended   replace next/last links with this
    [ Top ]



    COM_rdfCheck [line 4405]

    boolean COM_rdfCheck( string $bid, string $rdfurl, string $date, [string $maxheadlines = 0])

    Checks to see if it's time to import and RDF/RSS block again Updates RDF/RSS block if needed



    Tags:

    return:  true = feed was updated, false = otherwise
    see:  COM_rdfImport()


    Parameters

    string   $bid   Block ID
    string   $rdfurl   URL to get headlines from
    string   $date   Last time the headlines were imported
    string   $maxheadlines   max. number of headlines to import
    [ Top ]



    COM_rdfImport [line 4430]

    void COM_rdfImport( string $bid, string $rdfurl, [int $maxheadlines = 0])

    Syndication import function. Imports headline data to a portal block.

    Rewritten December 19th 2004 by Michael Jervis (mike AT fuckingbrit DOT com). Now utilises a Factory Pattern to open a URL and automaticaly retreive a feed object populated with feed data. Then import it into the portal block.




    Tags:

    see:  COM_rdfCheck()


    Parameters

    string   $bid   Block ID
    string   $rdfurl   URL to get content from
    int   $maxheadlines   Maximum number of headlines to display
    [ Top ]



    COM_rdfUpToDateCheck [line 2472]

    void COM_rdfUpToDateCheck( [string $updated_type = ''], [string $updated_topic = ''], [string $updated_id = ''])

    Checks to see if RDF file needs updating and updates it if so.

    Checks to see if we need to update the RDF as a result of an article with a future publish date reaching it's publish time and if so updates the RDF file. NOTE: When called without parameters, this will only check for new entries to include in the feeds. Pass the $updated_XXX parameters when the content of an existing entry has changed.




    Tags:

    see:  file lib-syndication.php


    Parameters

    string   $updated_type   (optional) feed type to update
    string   $updated_topic   (optional) feed topic to update
    string   $updated_id   (optional) feed id to update
    [ Top ]



    COM_redirect [line 3671]

    string COM_redirect( string $url)

    Redirects user to a given URL



    Tags:

    return:  HTML meta redirect
    since:  since v2.1.2


    Parameters

    string   $url   URL to send user to
    [ Top ]



    COM_refresh [line 3694]

    string COM_refresh( string $url)

    Redirects user to a given URL This function does a redirect using a meta refresh. This is (or at least used to be) more compatible than using a HTTP Location: header.

    NOTE: This does not need to be XHTML compliant. It may also be used in situations where the XHTML constant is not defined yet ...




    Tags:

    return:  HTML meta redirect
    see:  COM_redirect()
    deprecated:  since v2.1.2


    Parameters

    string   $url   URL to send user to
    [ Top ]



    COM_renderMenu [line 671]

    void COM_renderMenu( Template &$header, array $plugin_menu)

    Create the menu, i.e. replace {menu_elements} in the site header with the actual menu entries.



    Parameters

    Template   &$header   reference to the header template
    array   $plugin_menu   array of plugin menu entries, if any
    [ Top ]



    COM_renderWikiText [line 7973]

    string COM_renderWikiText( string $wikitext)

    Convert wiki-formatted text to (X)HTML



    Tags:

    return:  XHTML formatted text


    Parameters

    string   $wikitext   wiki-formatted text
    [ Top ]



    COM_resetSpeedlimit [line 6005]

    void COM_resetSpeedlimit( [string $type = 'submit'], [string $property = ''])

    Reset the speedlimit



    Parameters

    string   $type   type of speed limit to reset, e.g. 'submit'
    string   $property   IP address or other identifiable property
    [ Top ]



    COM_rootDebugClean [line 7843]

    array COM_rootDebugClean( array $array, [boolean $blank = false])

    Recurse through the error context array removing/blanking password/cookie values in case the "for development" only switch is left on in a production environment.

    [Not fit for public consumption comments about what users who enable root debug in production should have done to them, and why making this change defeats the point of the entire root debug feature go here.]




    Tags:

    return:  Cleaned array


    Parameters

    array   $array   Array of state info (Recursive array).
    boolean   $blank   override (wouldn't that blank out everything?)
    [ Top ]



    COM_sanitizeFilename [line 6462]

    string COM_sanitizeFilename( string $filename, [boolean $allow_dots = false])

    Sanitize a filename.

    NOTE: This function is pretty strict in what it allows. Meant to be used for files to be included where part of the filename is dynamic.




    Tags:

    return:  sanitized filename


    Parameters

    string   $filename   the filename to clean up
    boolean   $allow_dots   whether to allow dots in the filename or not
    [ Top ]



    COM_sanitizeID [line 6440]

    string COM_sanitizeID( string $id, [boolean $new_id = true])

    Ensure an ID contains only alphanumeric characters, dots, dashes, or underscores



    Tags:

    return:  the sanitized ID


    Parameters

    string   $id   the ID to sanitize
    boolean   $new_id   true = create a new ID in case we end up with an empty string
    [ Top ]



    COM_sanitizeUrl [line 6391]

    string COM_sanitizeUrl( string $url, [array $allowed_protocols = ''], [string $default_protocol = ''])

    Sanitize a URL



    Tags:

    return:  sanitized URL


    Parameters

    string   $url   URL to sanitized
    array   $allowed_protocols   array of allowed protocols
    string   $default_protocol   replacement protocol (default: http)
    [ Top ]



    COM_setArgNames [line 6038]

    boolean COM_setArgNames( array $names)

    Wrapper function for URL class so as to not confuse people This function sets the name of the arguments found in url



    Tags:

    return:  True if successful


    Parameters

    array   $names   Names of arguments in query string to assign to values
    [ Top ]



    COM_setLangIdAndAttribute [line 7992]

    void COM_setLangIdAndAttribute( object &$template)

    Set the {lang_id} and {lang_attribute} variables for a template



    Parameters

    object   &$template   template to use
    [ Top ]



    COM_setupAdvancedEditor [line 8426]

    void COM_setupAdvancedEditor( string $custom, [string $permissions = 'story.edit'], [string $myeditor = ''])

    Setup Advanced Editor



    Parameters

    string   $custom   location of custom script file relative to public_html directory. Include '/' at beginning
    string   $permissions   comma-separated list of rights which identify the current user as an "Admin"
    string   $myeditor  
    [ Top ]



    COM_showBlock [line 4084]

    string COM_showBlock( string $name, [string $help = ''], [string $title = ''], [string $position = ''])

    Shows a single Geeklog block This shows a single block and is typically called from COM_showBlocks OR from plugin code



    Tags:

    return:  HTML Formated block
    see:  COM_showBlocks()


    Parameters

    string   $name   Logical name of block (not same as title) -- 'user_block', 'admin_block', 'section_block', 'whats_new_block'.
    string   $help   Help file location
    string   $title   Title shown in block header
    string   $position   Side, 'left', 'right' or empty.
    [ Top ]



    COM_showBlocks [line 4141]

    string COM_showBlocks( string $side, [string $topic = ''])

    Shows Geeklog blocks Returns HTML for blocks on a given side and, potentially, for a given topic. Currently only used by static pages.



    Tags:

    return:  HTML Formated blocks
    see:  COM_showBlock()


    Parameters

    string   $side   Side to get blocks for (right or left for now)
    string   $topic   Only get blocks for this topic
    [ Top ]



    COM_showMessage [line 5272]

    string COM_showMessage( int $msg, [string $plugin = ''])

    Displays a message on the webpage Display one of the predefined messages from the $MESSAGE array. If a plugin name is provided, display that plugin's message instead.



    Tags:

    return:  HTML block with message
    see:  COM_showMessageText()
    see:  COM_showMessageFromParameter()


    Parameters

    int   $msg   ID of message to show
    string   $plugin   Optional name of plugin to lookup plugin defined message
    [ Top ]



    COM_showMessageFromParameter [line 5310]

    string COM_showMessageFromParameter( )

    Displays a message, as defined by URL parameters Helper function to display a message, if URL parameters 'msg' and 'plugin' (optional) are defined. Only for GET requests, but that's what Geeklog uses everywhere anyway.



    Tags:

    return:  HTML block with message
    see:  COM_showMessageText()
    see:  COM_showMessage()


    [ Top ]



    COM_showMessageText [line 5239]

    string COM_showMessageText( string $message, [string $title = ''])

    Displays a message text in a "System Message" block



    Tags:

    return:  HTML block with message
    see:  COM_showMessageFromParameter()
    see:  COM_showMessage()


    Parameters

    string   $message   Message text; may contain HTML
    string   $title   (optional) alternative block title
    [ Top ]



    COM_showTopics [line 2674]

    string COM_showTopics( [string $topic = ''])

    Shows all available topics Show the topics in the system the user has access to and prints them in HTML.

    This function is used to show the topics in the topics block.




    Tags:

    return:  HTML formatted topic list


    Parameters

    string   $topic   ID of currently selected topic
    [ Top ]



    COM_siteFooter [line 1308]

    string COM_siteFooter( [boolean $rightblock = -1], [array $custom = ''])

    Returns the site footer This loads the proper templates, does variable substitution and returns the HTML for the site footer.



    Tags:

    return:  Formated HTML containing site footer and optionally right blocks
    see:  COM_siteHeader()
    deprecated:  since v2.1.2


    Parameters

    boolean   $rightblock   Whether or not to show blocks on right hand side default is no
    array   $custom   An array defining custom function to be used to format Rightblocks
    [ Top ]



    COM_siteHeader [line 910]

    string COM_siteHeader( [string $what = 'menu'], [string $pagetitle = ''], [string $headercode = ''])

    Returns the site header

    This loads the proper templates, does variable substitution and returns the HTML for the site header with or without blocks depending on the value of $what Programming Note: The two functions COM_siteHeader and COM_siteFooter provide the framework for page display in Geeklog. COM_siteHeader controls the display of the Header and left blocks and COM_siteFooter controls the dsiplay of the right blocks and the footer. You use them like a sandwich. Thus the following code will display a Geeklog page with both right and left blocks displayed.

    1.  <?php
    2.  require_once 'lib-common.php';
    3.  // Change to COM_siteHeader('none') to not display left blocks
    4.  $display .= COM_siteHeader();
    5.  $display .= "Here is your html for display";
    6.  // Change to COM_siteFooter() to not display right blocks
    7.  $display .= COM_siteFooter(true);
    8.  echo $display;
    9.  ? >
    Note that the default for the header is to display the left blocks and the default of the footer is to not display the right blocks. This sandwich produces code like this (greatly simplified)
    1.  // COM_siteHeader
    2.  <table><tr><td colspan="3">Header</td></tr>
    3.  <tr><td>Left Blocks</td><td>
    4.  // Your HTML goes here
    5.  Here is your html for display
    6.  // COM_siteFooter
    7.  </td><td>Right Blocks</td></tr>
    8.  <tr><td colspan="3">Footer</td></table>




    Tags:

    return:  Formatted HTML containing the site header
    see:  COM_siteFooter()
    deprecated:  since v2.1.2


    Parameters

    string   $what   If 'none' then no left blocks are returned, if 'menu' (default) then right blocks are returned
    string   $pagetitle   optional content for the page's <title>
    string   $headercode   optional code to go into the page's <head>
    [ Top ]



    COM_startBlock [line 2110]

    string COM_startBlock( [string $title = ''], [string $helpfile = ''], [string $template = 'blockheader.thtml'])

    Prints out standard block header Prints out standard block header but pulling header HTML formatting from the database.

    Programming Note: The two functions COM_startBlock and COM_endBlock are used to sandwich your block content. These functions are not used only for blocks but anything that uses that format, e.g. Stats page. They are used like COM_siteHeader and COM_siteFooter but for internal page elements.




    Tags:

    return:  Formatted HTML containing block header
    see:  COM_siteHeader()
    see:  COM_endBlock()


    Parameters

    string   $title   Value to set block title to
    string   $helpfile   Help file, if one exists
    string   $template   HTML template file to use to format the block
    [ Top ]



    COM_stripslashes [line 6313]

    string COM_stripslashes( string $text)

    Strip slashes from a string only when magic_quotes_gpc = on.



    Tags:

    return:  The text, possibly without slashes.


    Parameters

    string   $text   The text
    [ Top ]



    COM_switchLanguageIdForObject [line 7342]

    string COM_switchLanguageIdForObject( string $id)

    Switch the language ID of the object id



    Tags:

    return:  id that is overwritten with the current language ID


    Parameters

    string   $id   object id that the language ID is attached to the end
    [ Top ]



    COM_switchLocaleSettings [line 7315]

    void COM_switchLocaleSettings( )

    Switch locale settings When multi-language support is enabled, allow overwriting the default locale settings with language-specific settings (date format, etc.). So in addition to $_CONF['date'] you can have a $_CONF['date_en'], $_CONF['date_de'], etc.



    [ Top ]



    COM_topicArray [line 2318]

    array COM_topicArray( string $selection, [int $sortcol = 0], [boolean $ignorelang = false])

    Return a list of topics in an array (derived from COM_topicList - API may change)



    Tags:

    return:  Array of topics
    see:  COM_topicList()


    Parameters

    string   $selection   Comma delimited string of fields to pull The first field is the value of the option and the second is the label to be displayed. This is used in a SQL statement and can include DISTINCT to start.
    int   $sortcol   Which field to sort option list by 0 (value) or 1 (label)
    boolean   $ignorelang   Whether to return all topics (true) or only the ones for the current language (false)
    [ Top ]



    COM_topicList [line 2279]

    string COM_topicList( string $selection, [string $selected = ''], [int $sortcol = 1], [boolean $ignorelang = false])

    Create and return a dropdown-list of available topics This is a variation of COM_optionList() from lib-common.php. It will add only those topics to the option list which are accessible by the current user.



    Tags:

    return:  Formated HTML of option values
    see:  COM_optionList()


    Parameters

    string   $selection   Comma delimited string of fields to pull The first field is the value of the option and the second is the label to be displayed. This is used in a SQL statement and can include DISTINCT to start.
    string   $selected   Value (from $selection) to set to SELECTED or default
    int   $sortcol   Which field to sort option list by 0 (value) or 1 (label)
    boolean   $ignorelang   Whether to return all topics (true) or only the ones for the current language (false)
    [ Top ]



    COM_truncate [line 7544]

    string COM_truncate( string $text, int $maxlen, [string $filler = ''], [int $endchars = 0])

    Truncate a string Truncates a string to a max. length and optionally adds a filler string, e.g. '...', to indicate the truncation.

    This function is multi-byte string aware, based on a patch by Yusuke Sakata. NOTE: The truncated string may be shorter but will never be longer than $maxlen characters, i.e. the $filler string is taken into account.




    Tags:

    return:  truncated string


    Parameters

    string   $text   the text string to truncate
    int   $maxlen   max. number of characters in the truncated string
    string   $filler   optional filler string, e.g. '...'
    int   $endchars   number of characters to show after the filler
    [ Top ]



    COM_truncateHTML [line 7486]

    string COM_truncateHTML( string $htmltext, int $maxlen, [string $filler = ''], [int $endchars = 0])

    Truncate a string that contains HTML tags. Will close all HTML tags as needed.

    Truncates a string to a max. length and optionally adds a filler string, e.g. '...', to indicate the truncation. This function is multi-byte string aware. This function is based on a code snippet by pitje at Snipplr.com. NOTE: The truncated string may be shorter or longer than $maxlen characters. Currently any initial html tags in the truncated string are taken into account. The $filler string is also taken into account but any html tags that are added by this function to close open html tags are not.




    Tags:

    return:  truncated string


    Parameters

    string   $htmltext   the text string which contains HTML tags to truncate
    int   $maxlen   max. number of characters in the truncated string
    string   $filler   optional filler string, e.g. '...'
    int   $endchars   number of characters to show after the filler
    [ Top ]



    COM_undoClickableLinks [line 6547]

    string COM_undoClickableLinks( string $text)

    Undo the conversion of URLs to clickable links (in plain text posts), e.g. so that we can present the user with the post as they entered them.



    Tags:

    return:  story text without links


    Parameters

    string   $text   story text
    [ Top ]



    COM_undoSpecialChars [line 3845]

    string COM_undoSpecialChars( string $string)

    undo function for htmlspecialchars() This function translates HTML entities created by htmlspecialchars() back into their ASCII equivalents. Also handles the entities for $, {, and }.



    Tags:

    return:  The converted string.


    Parameters

    string   $string   The string to convert.
    [ Top ]



    COM_updateSpeedlimit [line 5966]

    void COM_updateSpeedlimit( [string $type = 'submit'], [string $property = ''])

    Store post info for speed limit



    Parameters

    string   $type   type of speed limit, e.g. 'submit', 'comment'
    string   $property   IP address or other identifiable property
    [ Top ]



    COM_userComments [line 3712]

    void COM_userComments( $sid, $title, [ $type = 'article'], [ $order = ''], [ $mode = ''], [ $pid = 0], [ $page = 1], [ $cid = false], [ $delete_option = false])

    DEPRECIATED -- see CMT_userComments in lib-comment.php



    Tags:

    see:  CMT_userComments()
    deprecated:  since Geeklog 1.4.0


    Parameters

       $sid  
       $title  
       $type  
       $order  
       $mode  
       $pid  
       $page  
       $cid  
       $delete_option  
    [ Top ]



    COM_userMenu [line 2892]

    void COM_userMenu( [string $help = ''], [string $title = ''], [string $position = ''])

    Shows the user their menu options This shows the average Joe User their menu options. This is the user block on the left side



    Tags:

    see:  COM_adminMenu()


    Parameters

    string   $help   Help file to show
    string   $title   Title of Menu
    string   $position   Side being shown on 'left', 'right'. Though blank works not likely.
    [ Top ]



    COM_versionCompare [line 8205]

    mixed COM_versionCompare( string $version1, string $version2, [string $operator = ''])

    Common function used to compare two Geeklog version numbers



    Tags:

    return:  By default, returns -1 if the first version is lower than the second,
    1. if they are equal, and 1 if the second is lower.
    When using the optional operator argument, the function will return TRUE if the relationship is the one specified by the operator, FALSE otherwise.


    Parameters

    string   $version1   First version number to be compared
    string   $version2   Second version number to be sompared
    string   $operator   optional string to define how the two versions are to be compared valid operators are: <, lt, <=, le, >, gt, >=, ge, ==, =, eq, !=, <>, ne
    [ Top ]



    COM_versionConvert [line 8135]

    string COM_versionConvert( string $version)

    Common function used to convert a Geeklog version number into a version number that can be parsed by PHP's "version_compare()"



    Tags:

    return:  Generic version number that can be correctly handled by PHP


    Parameters

    string   $version   Geeklog version number
    [ Top ]



    COM_whatsNewBlock [line 4927]

    string COM_whatsNewBlock( [string $help = ''], [string $title = ''], [string $position = ''])

    Shows any new information in a block Return the HTML that shows any new stories, comments, etc



    Tags:

    return:  Return the HTML that shows any new stories, comments, etc


    Parameters

    string   $help   Help file for block
    string   $title   Title used in block header
    string   $position   Position in which block is being rendered 'left', 'right' or blank (for centre)
    [ Top ]



    phpblock_switch_language [line 7257]

    string phpblock_switch_language( )

    Provide a block to switch languages

    Provides a drop-down menu (or simple link, if you only have two languages) to switch languages. This can be used as a PHP block or called from within your theme's header.thtml:

    1.  <?php print phpblock_switch_language()?>




    Tags:

    return:  HTML for drop-down or link to switch languages


    [ Top ]



    phpblock_whosonline [line 5535]

    string phpblock_whosonline( )

    Shows who is online in slick little block



    Tags:

    return:  HTML string of online users seperated by line breaks.


    [ Top ]



    Documentation generated on Sun, 02 Oct 2016 07:51:16 +0000 by phpDocumentor 1.4.3