/bbsengine3.php

Description

This file is part of bbsengine3

  • copyright:

    (C) 2002-2016 Zoid Technologies. All Rights Reserved.

    Thank you for using Software That Sucks Less.

Includes
require_once ("HTML/QuickForm2/Renderer.php") (line 17)
require_once ("HTML/Page2.php") (line 37)

pull in PEAR::HTML_Page2

require_once ("Log.php") (line 22)
  • since: 20160419
require_once ("Pager.php") (line 39)
require_once ("HTML/QuickForm2.php") (line 16)

pull in pear::html_quickform

require_once ("MDB2.php") (line 32)

pull in PEAR::MDB2 database abstraction module

require_once ("Smarty.class.php") (line 27)

pull in smarty class

Functions
accesscart (line 3743)
  • since: 20160502
void accesscart ( $op, [ $data = null])
  • $op
  • $data
accesscartitem (line 3695)
  • since: 20160429
void accesscartitem ( $op, [ $cartitem = null])
  • $op
  • $cartitem
accessmantra (line 4053)

given an operation, return a boolean or null if the operation is not handled

  • return: True, False, or null if the operation is not handled
  • since: 20160910
boolean|null accessmantra (string $op, [dictionary $data = null], [integer $memberid = null])
  • string $op: op operation.. for example "summary" or "edit" or "delete"
  • dictionary $data: data optional data needed to resolve access check
  • integer $memberid: memberid member id to check or null to use result of getcurrentmemberid()
accessmember (line 1764)

function to determine access to the "member" table

  • since: 20130225
void accessmember (string $op, [array $data = null], [integer $memberid = null])
  • string $op
  • array $data
  • integer $memberid
accessnotify (line 2630)
  • since: 20130411
void accessnotify ( $op, [ $notify = null], [ $memberid = null])
  • $op
  • $notify
  • $memberid
accesssig (line 3187)
  • since: 20160202
boolean accesssig (string $op, [dictionary $sig = null], [integer $memberid = null])
  • string $op: op delete, edit, add, view
  • dictionary $sig: sig dictionary containing a sig record
  • integer $memberid: memberid memberid to check or null to use currentmemberid
addflag (line 898)

add a flag to the system

  • since: 20121029
void addflag ( $name,  $description,  $defaultvalue)
  • $name
  • $description
  • $defaultvalue
buildaccountfieldset (line 3941)
void buildaccountfieldset ( $form,  $options)
  • $form
  • $options
buildbreadcrumbs (line 3331)

return a list of dictionaries with keys 'title' and 'uri' for each part of $sigpath (ltree)

  • since: 20151118
void buildbreadcrumbs ( $sigpath)
  • $sigpath
buildbutton (line 4012)
void buildbutton ( $form,  $name,  $data)
  • $form
  • $name
  • $data
buildbuttonfieldset (line 2743)
  • since: 20150418
void buildbuttonfieldset ( $form, [ $submitlabel = "NEEDINFO"], [ $attributes = null])
  • $form
  • $submitlabel
  • $attributes
buildcartactions (line 3796)
  • since: 20160429
void buildcartactions ( $data)
  • $data
buildcartitemactions (line 3719)
  • since: 20160429
void buildcartitemactions ([ $data = []])
  • $data
buildcartrecord (line 3651)
  • since: 20151222
void buildcartrecord ()
buildchangepasswordfieldset (line 2238)
  • since: 20140831
void buildchangepasswordfieldset ( $form, [ $data = array()])
  • $form
  • $data
buildlabel (line 1659)
  • since: 20120507
void buildlabel ( $buf)
  • $buf
buildlabelpath (line 3081)

given one or more URIs (the function has a variable number of arguments), compose a proper labelpath, calling normalizelabelpath() at the end.

  • since: 20120312 re-written 20160115
void buildlabelpath ()
buildloginfieldset (line 2322)
void buildloginfieldset ( $form)
  • $form
buildmantraactions (line 4100)
  • since: 20160910
void buildmantraactions ( $data)
  • $data
buildmantrafieldset (line 4022)
  • since: 20160910
void buildmantrafieldset ( $form)
  • $form
buildmantrarecord (line 4036)

build a mantra record (dict) from html_quickform2 values

  • since: 20160910
void buildmantrarecord ( $values)
  • $values
buildmemberfieldset (line 2047)
  • since: 20140805
void buildmemberfieldset ( $form)
  • $form
buildmemberrecord (line 2138)
void buildmemberrecord ( $values)
  • $values
buildname (line 1678)
  • deprecated:
void buildname ( $buf)
  • $buf
buildnewpasswordfieldset (line 2223)
  • since: 20141016
void buildnewpasswordfieldset ( $form)
  • $form
buildnotifyactions (line 2492)
void buildnotifyactions ( $notify)
  • $notify
buildnotifydata (line 2545)
void buildnotifydata ( $notify)
  • $notify
buildnotifyrecord (line 2476)
  • since: 20160202
void buildnotifyrecord ( $key,  $notify)
  • $key
  • $notify
buildnotifytemplatename (line 1892)
void buildnotifytemplatename ( $type)
  • $type
buildpagerinfo (line 3271)
  • since: 20151118
void buildpagerinfo ( $sql,  $params)
  • $sql
  • $params
buildparentlabelpath (line 2126)
  • return: labelpath except for last element
  • since: 20140829
ltree buildparentlabelpath (ltree $labelpath)
  • ltree $labelpath: ltree label path
buildpath (line 1692)
  • since:

    20121107

    transforms the given uri into something that can be used with the 'ltree' type.

string buildpath ( $buf, string $name)
  • string $name
  • $buf
buildsigactions (line 3239)
  • since: 20150203
void buildsigactions ( $sig)
  • $sig
buildsigfieldset (line 3161)

build a fieldset for handling the 'sig' table

  • since: 20140730
void buildsigfieldset ( $form)
  • $form
builduri (line 1712)

builds a uri from a given ltree labelpath

void builduri (labelpath $labelpath)
  • labelpath $labelpath: ltree
cartidexists (line 3419)
  • since: 20160430
void cartidexists ( $cartid)
  • $cartid
cartitemexists (line 3979)
  • since: 20160502
void cartitemexists ( $trailerid)
  • $trailerid
checklogin (line 2299)

this function is intended to be used as part of an html_quickform2 callback rule

boolean checklogin (args $args)
  • args $args: dictionary with 'username' and 'password' as keys
checknonce (line 2003)
void checknonce ( $secret,  $nonce)
  • $secret
  • $nonce
checkpassword (line 2182)
void checkpassword (text $password, integer $memberid)
  • text $password: plain text password i.e. from a quickform
  • integer $memberid: memberid memberid to check against
checksession (line 1477)
void checksession ()
clearcart (line 3530)
  • since: 20160503
void clearcart ( $cartid)
  • $cartid
clearcurrentaction (line 1351)

function to clear the current action

  • since: 20150309
void clearcurrentaction ()
clearcurrentcart (line 3550)
  • since: 20151214
void clearcurrentcart ()
clearcurrentmemberid (line 1939)

unset the "current member id" for the session aka "logout"

  • since: 20121018
void clearcurrentmemberid ()
clearflag (line 925)

function to clear a flag, resetting it to the default value for the given user.

  • since: 20121029
void clearflag ( $name, [ $memberid = null])
  • $name
  • $memberid
clearpageprotocol (line 2075)
  • since: 20140825
void clearpageprotocol ()
datestamp (line 879)
void datestamp ( $stamp, [ $format = null])
  • $stamp
  • $format
dbconnect (line 711)

connect to a DSN using the MDB2 "singleton" static method, configures the object (quote_identifier set to true, fetchmode set to MDB2_FETCHMODE_ASSOC, and loading the "Extended" module), and returns a reference to it.

object|error dbconnect (string $dsn)
  • string $dsn: dsn
decodejson (line 2355)

decodes given json data into a dictionary (associative array)

  • since: 20140730
void decodejson ( $data)
  • $data
displaydeleteconfirmation (line 1296)

function which displays the "delete confirmation" template.

  • since: 20110801
void displaydeleteconfirmation ( $message,  $yesuri,  $yestxt,  $nouri,  $notxt, [ $title = null])
  • $message
  • $yesuri
  • $yestxt
  • $nouri
  • $notxt
  • $title
displayerrorpage (line 332)

display an error page template with message

  • since: 20120608
  • access: public
void displayerrorpage (string $message, [ $statuscode = 418], [ $title = "error"], [ $template = "errormessage.tmpl"], integer $errorcode)
  • string $message
  • integer $errorcode: http error code (i.e. 500, 404)
  • $statuscode
  • $title
  • $template
displayfooter (line 402)

display a page footer template

  • deprecated:
  • access: public
void displayfooter ()
displayform (line 3045)

function which accepts a renderer instance converted to an array, a page title, and an optional template name. it composes an html_page2 instance and calls displaypage() which is part of bbsengine3

  • since: 20150629
void displayform ( $renderer, string $title, [ $options = array()], html_quickform2 $form, string $template)
  • html_quickform2 $form
  • string $title
  • string $template
  • $renderer
  • $options
displayheader (line 454)

display a page header template with optional title string

  • deprecated:
  • access: public
void displayheader ([string $title = null], [array $css = null], [array $script = null])
  • string $title: title of page
  • array $css
  • array $script
displaypage (line 3012)
  • since: 20151203
void displaypage ( $page, [ $options = null])
  • $page
  • $options
displaypagefooter (line 414)

print result of fetchpagefooter() to browser

  • since: 20130826
void displaypagefooter ()
displaypageheader (line 460)
void displaypageheader ([ $title = null], [ $css = null], [ $script = null])
  • $title
  • $css
  • $script
displaypermissiondenied (line 624)

display the permission denied template

  • since: 20121008
  • access: public
void displaypermissiondenied ([ $message = null], [ $title = "permission denied"])
  • $message
  • $title
displayredirectpage (line 251)

display a redirect page template with message and optional url

  • access: public
void displayredirectpage (string $message, [string $url = null], [ $delay = 5])
  • string $message
  • string $url
  • $delay
emailaddressformrule (line 839)

an html_quickfom rule which returns True if the given email address is in the database.

  • see: emailaddresscallback()
  • todo: is this a duplicate?
void emailaddressformrule (string $value, [integer $id = 0])
  • string $value
  • integer $id
encodejson (line 2344)

calls json_encode() with default parameters

  • since: 20140730
void encodejson ( $data)
  • $data
endsession (line 1482)
void endsession ()
explodesiglabelpaths (line 3927)
  • since: 20160207
void explodesiglabelpaths ( $siglabelpaths)
  • $siglabelpaths
explodesigmap (line 3912)

accepts a string of comma separated label paths and returns an array.

  • return: of siglabelpaths
  • deprecated:
  • since: 20150703
array explodesigmap ( $sigmap)
  • $sigmap
explodeuri (line 3950)
  • since: 20160319
void explodeuri ( $uri)
  • $uri
fetcherrorpage (line 309)

return a html_page2 instance populated with the errormessage.tmpl smarty template

  • since: 20120823
void fetcherrorpage ( $message)
  • $message
fetchheader (line 422)
  • since: 20110105
void fetchheader ([ $title = null], [ $css = null], [ $script = null])
  • $title
  • $css
  • $script
fetchmaturecontentwarning (line 1187)

returns the maturecontentwarning smarty template as a string.

  • since: 20110601
void fetchmaturecontentwarning ()
fetchnavbar (line 486)
void fetchnavbar ([ $menu = null])
  • $menu
fetchpagefooter (line 377)
void fetchpagefooter ()
fetchpageheader (line 436)
  • since: 20110105
void fetchpageheader ([ $title = null], [ $css = null], [ $script = null])
  • $title
  • $css
  • $script
fetchredirectpage (line 239)

return a configured html_page2 instance using the 'message' and 'url' parameters. this function should be used in cases where content or css files need to be added.

  • deprecated:
  • since: 20120823
void fetchredirectpage ( $message, [ $url = null], [ $delay = 3])
  • $message
  • $url
  • $delay
fetchsidebar (line 499)
void fetchsidebar ([ $menu = null])
  • $menu
fetchtopbar (line 2274)
  • since: 20140908
void fetchtopbar ([ $actions = null])
  • $actions
flag (line 657)

permission checking function

permissions "PUBLIC" and "AUTHENTICATED" are built-in and checked for specially before any database connection is made. other permissions are in uppercase and must be listed in the flag table. if the member being checked does not have a value set for a particular flag, the default value will be returned.

  • since: 20080324
boolean flag (string $name, [integer $memberid = 0])
  • string $name
  • integer $memberid
generatenonce (line 1989)
void generatenonce ( $secret, [ $timeoutSeconds = 180])
  • $secret
  • $timeoutSeconds
generatesalt (line 2029)
void generatesalt ()
getcart (line 3619)
  • since: 20151220
void getcart ( $cartid)
  • $cartid
getcartitems (line 3671)
  • since: 20160411
void getcartitems ( $cartid)
  • $cartid
getcurrentaction (line 1340)

function to get the current "action" so that "view" can be hidden when in view mode, etc

  • since: 20110803
void getcurrentaction ()
getcurrentcart (line 3445)
  • since: 20151214
void getcurrentcart ()
getcurrentcartid (line 3478)
void getcurrentcartid ()
getcurrentmember (line 824)
void getcurrentmember ()
getcurrentmembercredits (line 2917)
  • since: 20150903
void getcurrentmembercredits ()
getcurrentmemberid (line 752)

return the "current member id" for the session

int getcurrentmemberid ([string $key = null])
  • string $key: key optional key to use when accessing $_SESSION, defaults to "currentmemberid"
getcurrentpage (line 1212)

get current page

  • author: Zoid Technologies
  • since: 20100510
void getcurrentpage ()
getcurrentpath (line 3401)
  • since: 20151204
void getcurrentpath ([ $uri = null])
  • $uri
getcurrentsig (line 3961)
  • since: 20160427
void getcurrentsig ()
getcurrentsite (line 1868)
  • since: 20131031
void getcurrentsite ()
getcurrenturi (line 1372)

function that returns the current url (protocol, hostname, etc)

  • since: 20110804
void getcurrenturi ()
getflag (line 1002)

returns flag value given the flag name and member id.

boolean getflag (string $flag,  $memberid, integer $id)
  • string $flag: flag name
  • integer $id: member id
  • $memberid
getflags (line 1045)

return the set of flags and their values for a given memberid.

rewritten 2011-jun-23 so it actually works without smarty3 throwing notices about undefined vars

  • return: or PEAR_Error
  • since: 20081002
array getflags (integer $memberid)
  • integer $memberid
getlastlogin (line 2368)
  • since: 20141223
void getlastlogin ()
getlastloginfrom (line 2388)
  • since: 20141223
void getlastloginfrom ()
getmantra (line 4127)
  • since: 20140512
void getmantra ( $mantraid)
  • $mantraid
getmember (line 818)
void getmember ( $id)
  • $id
getmembercredits (line 2879)
  • since: 20150903
void getmembercredits ( $id)
  • $id
getmemberid (line 2158)
  • return: memberid for $name, NULL if name doesn't exist, PEAR::Error for errors
  • since: 20140901
mixed getmemberid ($name $name)
  • $name $name: text handle
getmemberidfrom (line 2704)
  • since: 20150420
void getmemberidfrom ( $name,  $value,  $type)
  • $name
  • $value
  • $type
getmemberidfromemail (line 2677)
  • since: 20150410
void getmemberidfromemail ( $email)
  • $email
getmemberidfromusername (line 2727)
void getmemberidfromusername ( $username)
  • $username
getnotify (line 2555)
  • since: 20130411
void getnotify ( $notifyid)
  • $notifyid
getpage (line 1176)
void getpage ([ $title = null], [ $options = null])
  • $title
  • $options
getpageprotocol (line 2099)
  • since: 20140822
string getpageprotocol ()
getquickform (line 91)

returns a configured PEAR::HTML_QuickForm2 instance.

'pageprotocol' is set to 'standard'. if javascript is running the field value will be changed to 'enhanced'.

the 'tracksubmit' param defaults to * True because I cannot think of a reason not to use it that way but it should be a knob.

there is a recursive filter automagically added that calls 'trim'.

  • return: configured html_quickform2 instance
  • since: 20130209
a getquickform ( $id, [string $method = "post"], [string $attributes = ""], [boolean $tracksubmit = True], string $name)
  • string $name: name of the form which should be unique to the app
  • string $method: "post" or "get" defaults to "post"
  • string $attributes: attributes for the <form> tag
  • boolean $tracksubmit: defines whether or not to add a hidden field that tracks if the form has been submitted.
  • $id
getquickformrenderer (line 112)
  • return: Array renderer
  • since:

    20140902

    function which returns a configured Array renderer for use by quickform2

QF2 getquickformrenderer ([$options $options = null])
  • $options $options: array optional dictionary containing renderer options
getreturnto (line 576)

get the 'returnto' session var which contains 'url' and 'title', falling back to SITEURL and SITETITLE from config

  • return: with two keys 'url' and 'title'
  • since: 20150722
array getreturnto ()
getreturntotitle (line 599)
void getreturntotitle ()
getreturntourl (line 585)

returns the returntourl as a string if it has been set.

void getreturntourl ()
getsig (line 1968)
  • since: 20140727
void getsig ( $labelpath)
  • $labelpath
getsigidfromlabelpath (line 3379)

get sigid for a given labelpath

  • since: 20140713 moved from zoidweb2 2015nov22
void getsigidfromlabelpath ( $labelpath)
  • $labelpath
getsigmap (line 3871)
  • since: 20160206
void getsigmap ( $maptablename,  $idfield,  $id, [ $ltreefield = &quot;siglabelpath&quot;])
  • $maptablename
  • $idfield
  • $id
  • $ltreefield
getsmarty (line 220)

define getsmarty() in case an upper layer did not define it

  • since: 20140710
void getsmarty ([ $options = null])
  • $options
gettotalnotifications (line 2578)
  • since: 20130401
void gettotalnotifications ( $id)
  • $id
gettotalunreadnotifications (line 2604)
  • since: 20130401
void gettotalunreadnotifications ( $id)
  • $id
get_request_scheme (line 1362)
void get_request_scheme ()
get_request_url (line 1357)
void get_request_url ()
handleform (line 2797)

handle a form given an html_quickform2 instance, a callback function and a page title. if the form validates, the callback function is called.

  • return: value the callback returns. 'True' should be used for 'success'.
  • since: 20150408
whatever handleform (form $form, callback $callback, pagetitle 2)
  • pagetitle 2: string page title
  • form $form: html_quickform2 instance
  • callback $callback: function/method to call if form validates
hashpassword (line 2440)
  • since: 20150109
void hashpassword ( $plaintext)
  • $plaintext
implodesigmap (line 3895)
void implodesigmap ( $sigmap)
  • $sigmap
iscartowner (line 3997)
void iscartowner ( $cart)
  • $cart
logentry (line 520)

put $message into a log at the given priority

  • since: 20080105
void logentry (string $message, [enum $priority = LOG_INFO])
  • string $message
  • enum $priority
normalizecart (line 3574)
  • since: 20151214
void normalizecart ()
normalizelabelpath (line 3126)
  • since: 20140903
string normalizelabelpath ([string $labelpath = ])
  • string $labelpath
normalizepath (line 1880)

function to add a trailing slash if needed. also removes duplicate slashes.

  • since: 20140511
void normalizepath ( $path)
  • $path
normalizeuri (line 2285)
  • since: 20140910
void normalizeuri ( $uri)
  • $uri
permission (line 637)
  • deprecated:
  • since: 20110722
void permission ( $name, [ $memberid = 0])
  • $name
  • $memberid
processupload (line 1734)

process an uploaded file

rewritten based on code in register.php 2010-10-20

changed on 2015-09-01 so it accepts a dictionary (values) as a parameter, because most times this function is called from an update() or insert() function. this change is a COMPAT BUSTER.

  • since: 20100730
void processupload ( $value,  $destinationdir)
  • $value
  • $destinationdir
removesessioncookie (line 1955)

invalidate session cookie. from OWASP Cookies

  • since: 20140724
void removesessioncookie ()
safestripslashes (line 613)

only strip slashes from a string if get_magic_quotes_gpc() returns True

this function was ripped from PEAR::Services_Amazon.

  • return: with slashes stripped if get_magic_quotes_gpc returns True
string safestripslashes (string $value)
  • string $value
sendnotify (line 1905)
  • since: 20140513
void sendnotify (type $type, memberid $memberid, [data $data = null])
  • type $type: string
  • memberid $memberid: integer
  • data $data: dictionary automagically converted to json
setcurrentaction (line 1322)

function to set the current "action" so that "view" can be hidden when in view mode, etc

  • since: 20110803
void setcurrentaction ( $op)
  • $op
setcurrentcart (line 3610)
  • since: 20151214
void setcurrentcart ( $cart)
  • $cart
setcurrentcartid (line 3488)
void setcurrentcartid ( $cartid)
  • $cartid
setcurrentmembercredits (line 2926)
  • since: 20150903
void setcurrentmembercredits ( $credits)
  • $credits
setcurrentmemberid (line 776)

set the "current member id" for the session

  • return: previous value
int setcurrentmemberid (integer $id)
  • integer $id
setcurrentpage (line 1199)

set current page

  • since: 20100510
void setcurrentpage (string $page)
  • string $page
setcurrentsig (line 3970)
  • since: 20160427
void setcurrentsig ([ $sig = null])
  • $sig
setcurrentsite (line 1858)
  • since: 20131031
void setcurrentsite ( $site)
  • $site
setflag (line 956)

set a flag on the given memberid to the given value

  • since: 20120409
void setflag (string $flag, boolean $value, [integer $id = null])
  • string $flag
  • boolean $value
  • integer $id
setlastlogin (line 2377)
  • since: 20141223
void setlastlogin ( $lastlogin)
  • $lastlogin
setlastloginfrom (line 2397)
  • since: 20141223
void setlastloginfrom ( $lastloginfrom)
  • $lastloginfrom
setmembercredits (line 2901)
  • since: 20150903
void setmembercredits ( $id,  $credits)
  • $id
  • $credits
setpageprotocol (line 2087)
  • since: 20140822
void setpageprotocol ( $pageprotocol, string $pageproto)
  • string $pageproto
  • $pageprotocol
setpassword (line 2451)
void setpassword ( $memberid,  $hashedpassword)
  • $memberid
  • $hashedpassword
setreturnto (line 555)

set the 'returnto' session variable used by redirectpage()

  • return: value
old setreturnto ([string $url = null], [string $title = null])
  • string $url
  • string $title
startsession (line 1443)
  • since: 20111215
void startsession ()
toboolean (line 2769)
void toboolean ( $field, [ $label = &quot;field&quot;])
  • $field
  • $label
uniqueemailaddresscallback (line 1391)

html_quickform callback function to check if an email address is already in use in the db

  • return: if address is _not_ in the database
  • see: emailaddressformrule()
  • todo: is this a duplicate?
  • since: 20101011
True uniqueemailaddresscallback ( $value)
  • $value
uniqueusernamecallback (line 2408)
  • since:

    20121017

    a quickform2 callback to see if the given $value exists in the name field of the member table

void uniqueusernamecallback ( $value)
  • $value
updatemember (line 1423)

update user record in database

  • since: 20111128
void updatemember ( $memberid,  $member)
  • $memberid
  • $member
updatesigmap (line 3821)

moved from zoidweb2 to bbsengine

this function will update a sig mapping given the table name, the name of the id field, and the value of the idfield.

  • return: if all is well else PEAR::Error
  • since: 20151114
null updatesigmap (sigs $sigs, tablename $tablename, idfield $idfield, id $id, [ $ltreefield = &quot;siglabelpath&quot;])
  • sigs $sigs: string|array if string, call explodesiglabelpaths()
  • tablename $tablename: name of mapping table
  • idfield $idfield: name of id field marked unique in the db (example: "linkid")
  • id $id: the actual id of the item (example: 42)
  • $ltreefield
_buildnotifydata (line 2523)
void _buildnotifydata ( $notify)
  • $notify
_displaypage (line 2935)
  • since: 20150929
void _displaypage ( $page, [ $options = null])
  • $page
  • $options
_fetchsidebar (line 492)
void _fetchsidebar ([ $menu = null])
  • $menu
_getmember (line 793)

returns data for a given member id.

  • since: 19990102
  • access: public
array|PEAR::Error _getmember (integer $id)
  • integer $id
_getpage (line 1102)

returns a lightly configured PEAR::HTML_Page2 instance

  • since: 20110725
void _getpage ([ $title = null], [ $options = array()])
  • $title
  • $options
_getsmarty (line 134)

return a smarty3 template object, configured for the website

  • since: 20140710
void _getsmarty ([dictionary $options = null])
  • dictionary $options: options an array of options: templatedir, pluginsdir, compiledir, compileid

Documentation generated on Mon, 10 Oct 2016 21:16:56 -0400 by phpDocumentor 1.4.4