Class MvBlog_common

Description

Class that holds methods that can be used by every part of mvblog

Located in /common/mvblog_common.php (line 25)


	
			
Direct descendents
Class Description
MvBlog_admin Class that holds methods to create admin site.
MvBlog Class that holds methods to create public site.
MvBlog_import Class that holds methods that can be used to import other blogs
MvBlog_import_wordpress Class that holds methods for WordPress import
Variable Summary
array $authors
array $categories
object $db
array $dossiers
array $menuitems
array $plugins
mixed $plugman
array $settings
string $version
string $webroot
Method Summary
MvBlog_common __construct ([string $plugindir = "plugins/"], [int $adminmode = 0], [int $upgrade = 0])
void copy_files ( $srcbase, string $src,  $dest, [int $overwrite_dest = 0], string $dst)
string db_quote (string $field)
void html_footer ()
nothing html_header ([string $title = "Home"], [string $style = "MvBlog"])
string replace_dossier_ref (string $data)
string replace_num_ref (string $data)
void show_captcha ()
void _get_authors ()
void _get_categories ()
void _get_dossiers ()
void _get_menuitems ()
array _get_posts ([array $options = array()])
void _get_settings ()
void _get_webroot ()
void _init_db ([ $settings = ""])
mixed _magic_quotes_strip (mixed $mixed)
mixed _sanitize (mixed $data, [array $options = array()])
Variables
mixed $active_plugins = array() (line 122)
  • access: public
array $authors = array() (line 61)
  • var: Array with all active authors. The array looks like this:
     array (
       [id] => "fullname",
       [id] => "fullname"
     )
  • access: public
array $categories = array() (line 80)
  • var: Array with all active categories. The array looks like this:
     array (
       [id] => array(
         "id" => id,
         "login" => loginname,
         "password" => password,
         "email" => email address,
         "fullname" => userfriendly name,
         "active" => 1 if active, 0 or null otherwise,
         "website" => full url to authors website
       ),
       [id] => ....
     )
  • access: public
object $db (line 33)
  • var: The PEAR::DB connected database
  • access: public
array $dossiers = array() (line 94)
  • var: Array with all the dossiers. The array looks like this:
     array (
       [id] => array(
          "id" => id,
          "name" => name
       ),
       [id] => ...
     )
  • access: public
array $menuitems = array() (line 116)
  • var: The user configured menuitems
  • access: public
array $plugins = array() (line 50)
  • var: Array with registered plugins. The array looks like this:
     array (
       [$type] => "name",
       [$type] => "name"
     )
    Where type can be:
    • text_output
  • access: public
mixed $plugman (line 121)
  • access: public
array $settings = array() (line 112)
  • var: Array with all active settings. The array looks like this:
     array (
       [settingname] => "settingvalue",
       [settingname] => "settingvalue"
     )
    Current settingnames:
    • blogtitle
    • blogdescription
    • blogkeywords
    • postsperpage
    • allowanoncomments
    • cleanurl
  • access: public
string $version = "%%VERSION%%" (line 37)
  • var: The current program version
  • access: public
string $webroot = "" (line 120)
  • var: The webroot for current blog
  • access: public
Methods
Constructor __construct (line 137)

Setup stuff and handle settings etc and populate the data containers.

If one of the default values for the function parameters is changed, please also change the call in mvblog_upgrade constructor.

  • access: public
MvBlog_common __construct ([string $plugindir = "plugins/"], [int $adminmode = 0], [int $upgrade = 0])
  • string $plugindir: Directory where the plugins are.
  • int $adminmode: Must be 1 if in the admin interface.
  • int $upgrade: If set to 1 the data containers will not be populated to allow upgrades to them.

Redefined in descendants as:
copy_files (line 817)

Copies files and directories recursive to dirs under site_images

  • access: public
void copy_files ( $srcbase, string $src,  $dest, [int $overwrite_dest = 0], string $dst)
  • string $src: The sourcefile or dir
  • string $dst: The dir inside site_images where the files/folders should be copied to
  • int $overwrite_dest: if set will overwrite the destination if it already exists
  • $srcbase
  • $dest
db_quote (line 372)

Quote a fieldname with the database specific quote style

  • return: the quoted version
  • access: public
string db_quote (string $field)
  • string $field: fieldname to quote
html_footer (line 916)

send the end of a html document

  • access: public
void html_footer ()
html_header (line 860)

Send start of html document

  • return: It uses echo to send the data to the client
  • access: public
nothing html_header ([string $title = "Home"], [string $style = "MvBlog"])
  • string $title: (optional)The title to use in html title tag
  • string $style: (optional)The style to use
replace_dossier_ref (line 793)

Replace references to dossiers in a piece of data.

You can reference to dossiers in postdata by including a string like [#d<dossiernumber>]. The output will be: <a href="index.php?action=viewdossier&id=<dossiernumber>">dossiertitle</a>

  • return: input with the postreference code replaced
  • access: public
string replace_dossier_ref (string $data)
  • string $data: The code to do the replacement in
replace_num_ref (line 767)

Replace numeric references to other posts in a piece of data.

You can reference to other posts in postdata by including a string like [#<postnumber>]. The output will be: <a href="index.php?action=view&id=<postnumber>">posttitle</a>

  • return: input with the postreference code replaced
  • access: public
string replace_num_ref (string $data)
  • string $data: The code to do the replacement in
show_captcha (line 929)

Show a captcha and hidden input and user input field

  • access: public
void show_captcha ()
_get_active_plugins (line 482)

Read active plugins from settings and unserialize it so plugmrg can handle it

  • access: protected
void _get_active_plugins ()
_get_authors (line 448)

Get all the authors into an array.

  • access: public
void _get_authors ()
_get_categories (line 494)

Get all the categories into an array

  • access: protected
void _get_categories ()
_get_dossiers (line 525)

Get all the dossiers into an array

  • access: protected
void _get_dossiers ()
_get_menuitems (line 555)

Get all the user configured menuitems from db

  • access: protected
void _get_menuitems ()
_get_posts (line 578)

Get posts based on optional options

  • return: The posts data
  • access: protected
array _get_posts ([array $options = array()])
  • array $options: Optional options posts should match
_get_settings (line 394)

Get all the settings into an array

  • access: protected
void _get_settings ()
_get_webroot (line 425)

Get the webroot for the mvblog install Sets the value in class var webroot.

This value will always end with a /

  • access: protected
void _get_webroot ()
_handle_magic_quotes (line 259)

Detect wether magic_quotes_gpc is on.

If so, it will disable it and get rid of all the automagically added slashes etc

  • access: protected
void _handle_magic_quotes ()
_handle_php_bugs (line 216)

Handle some php bugs.

There's some weird bugs when register_globals is on. You can clear them with stuff like this: ?GLOBALS&GLOBALS[bla]=test So what we do is detect this and bail out. We also make sure that if register_globals is on the gpc stuff will be removed from the globals stuff

  • access: protected
void _handle_php_bugs ()
_init_db (line 290)

Create database connection using the PEAR::MDB2 framework and puts this object in class variable db

  • access: protected
void _init_db ([ $settings = ""])
  • $settings
_magic_quotes_strip (line 280)

strip escape \ signs when magic_quotes_gpc is on in php.ini

  • return: the string/array with the magic_quotes_gpc added slashes removed
  • access: protected
mixed _magic_quotes_strip (mixed $mixed)
  • mixed $mixed: the input string or array
_sanitize (line 336)

Sanitize given data.

This function will return an array if array was given, otherwise it will return the input. The array contents or the given string will be sanitized based on the optional options array. Key's with names that are outside a-zA-Z0-9_- will be removed.

The optional options parameter is an array. The following keys will be handled:

  • bbcode: if true, besides the a-zA-Z0-9_- also @[]=/:+.? will be allowed
  • space: if true, also allow a whitespace character
  • url: if true, also allow :/+.?
  • email: if true, also allow @.
if no options array is given, only a-zA-Z0-9_- will be allowed (that is without whitespace chars)

  • return: See description of the function for array structure
  • access: public
mixed _sanitize (mixed $data, [array $options = array()])
  • mixed $data: The data to sanitize
  • array $options: Options, see description for possible items

Documentation generated on Fri, 28 Dec 2007 13:17:39 +0100 by phpDocumentor 1.4.1