public abstract class Symphony

class.symphony.php #33

The Symphony class is an abstract class that implements the Singleton interface. It provides the glue that forms the Symphony CMS and initialises the toolkit classes. Symphony is extended by the Frontend and Administration classes

Constants

static string CRLF = PHP_EOL

The end-of-line constant.

Deprecated

This will be removed in the next version of Symphony

Properties

Author $Author

An instance of the currently logged in Author

static Configuration $Configuration

An instance of the Configuration class

Cookie $Cookie

An instance of the Cookie class

static MySQL $Database

An instance of the Database class

static ExtensionManager $ExtensionManager

An instance of the ExtensionManager class

static Log $Log

An instance of the Log class

Profiler $Profiler

An instance of the Profiler class

Methods

static Configuration Configuration()

Accessor for the current Configuration instance. This contains representation of the the Symphony config file.

static MySQL Database()

Accessor for the current $Database instance.

static Symphony Engine()

Accessor for the Symphony instance, whether it be Frontend or Administration

static ExtensionManager ExtensionManager()

Accessor for the current $ExtensionManager instance.

void customError(string $heading, string|XMLElement $message, string $template, array $additional)

A wrapper for throwing a new Symphony Error page.

Parameters
  • $heading stringA heading for the error page

  • $message string|XMLElementA description for this error, which can be provided as a string or as an XMLElement.

  • $template stringA string for the error page template to use, defaults to 'error'. This can be the name of any template file in the TEMPLATES directory. A template using the naming convention of tpl.*.php.

  • $additional arrayAllows custom information to be passed to the Symphony Error Page that the template may want to expose, such as custom Headers etc.

See Also
void initialiseCookie()

Setter for $Cookie. This will use PHP's parseurl function on the current URL to set a cookie using the cookieprefix defined in the Symphony configuration. The cookie will last two weeks.

boolean initialiseDatabase()

Setter for the $Database. This will create a new Database driver and then attempt to create a connection to the database using the connection details provided in the Symphony configuration. If any errors occur whilst doing so, a Symphony Error Page is displayed.

Returns

This function will return true if the $Database was initialised successfully.

void initialiseExtensionManager()

Setter for $ExtensionManager using the current Symphony instance as the parent. If for some reason this fails, a Symphony Error page will be thrown

void initialiseLog()

Setter for $Log. This function uses the configuration settings in the 'log' group in the Configuration to create an instance. Date formatting options are also retrieved from the configuration.

void isLoggedIn()

This function determines whether an there is a currently logged in Author for Symphony by using the $Cookie's username and password. If an Author is found, they will be logged in, otherwise the $Cookie will be destroyed.

See Also
boolean login(string $username, string $password, boolean $isHash)

Attempts to log an Author in given a username and password. If the password is not hashed, it will be hashed using the sha1 algorithm. The username and password will be sanitized before being used to query the Database. If an Author is found, they will be logged in and the sanitized username and password (also hashed) will be saved as values in the $Cookie.

Parameters
  • $username stringThe Author's username. This will be sanitized before use.

  • $password stringThe Author's password. This will be sanitized and then hashed before use

  • $isHash booleanIf the password provided is already hashed, setting this parameter to true will stop it becoming rehashed. By default it is false.

Returns

True if the Author was logged in, false otherwise

See Also
boolean loginFromToken(string $token)

Symphony allows Authors to login via the use of tokens instead of a username and password. A token is derived from concatenating the Author's username and password and applying the sha1 hash to it, from this, a portion of the hash is used as the token. This is a useful feature often used when setting up other Authors accounts or if an Author forgets their password.

Parameters
  • $token stringThe Author token, which is a portion of the hashed string concatenation of the Author's username and password

Returns

True if the Author is logged in, false otherwise

void logout()

This function will destroy the currently logged in $Author session, essentially logging them out.

See Also
array resolvePage(mixed $page_id, mixed $column)

Given the $page_id and a $column

Parameters
  • $page_id mixedThe ID of the Page that currently being viewed, or the handle of the current Page

Returns

An array of the current Page, containing the $column requested. The current page will be the last item the array, as all parent pages are prepended to the start of the array

string resolvePagePath(mixed $page_id)

Given the $page_id, return the complete path to the current page.

Parameters
  • $page_id mixedThe ID of the Page that currently being viewed, or the handle of the current Page

Returns

The complete path to the current Page including any parent Pages, ie. /articles/read

string resolvePageTitle(mixed $page_id)

Given the $page_id, return the complete title of the current page.

Parameters
  • $page_id mixedThe ID of the Page that currently being viewed, or the handle of the current Page

Returns

The title of the current Page. If the page is a child of another it will be prepended by the parent and a colon, ie. Articles: Read

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details