PHP 클래스 Agora_Driver, horde

Copyright 2003-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
저자: Marko Djukic ([email protected])
저자: Jan Schneider ([email protected])
저자: Duck ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$_forum array Current forum data
$_forum_id string Current forum ID

보호된 프로퍼티들

프로퍼티 타입 설명
$_cache Horde_Cache Cache object
$_charset string Charset
$_db Horde_Db_Adapter The database connection object.
$_forums_table string Scope theads table name
$_scope string The forums scope.
$_threads_table string Scope theads table name

공개 메소드들

메소드 설명
__construct ( $scope, $params ) Constructor
_forumSequence ( integer $forum_id, string $type = 'message', integer | string $diff = '+' ) Increments or decrements a forum's message count.
allowAttachments ( ) : boolean Checks if attachments are allowed in messages for the current forum.
convertFromDriver ( mixed $value ) : mixed Converts a value from the driver's charset to the default charset.
convertToDriver ( mixed $value ) : mixed Converts a value from the default charset to the driver's charset.
countForums ( ) Returns the number of forums.
countMessages ( ) : integer Returns the number of all messages (threads and replies) in a forum
countThreads ( integer $thread_root ) : integer Returns the number of replies on a thread, or threads in a forum
dateFormat ( integer $timestamp ) : string Formats time according to user preferences.
deleteForum ( integer $forum_id ) : boolean Deletes a forum, any subforums that are present and all messages contained in the forum and subforums.
deleteMessage ( integer $message_id ) : string Deletes a message and all replies.
deleteThread ( integer $thread_id ) Deletes an entire message thread.
formatBody ( string $body ) Formats a message body.
formatSize ( integer $filesize ) : string Formats file size.
getAttachmentLink ( $message_id ) Constructs message attachments link.
getBanned ( ) Get banned users from the current forum
getBareForums ( ) : array Get forums ids and titles
getForm ( $vars, $title, $editing = false, $new_forum = false )
getForum ( integer $forum_id ) : array Fetches a forum data.
getForums ( integer $root_forum, boolean $formatted = true, string $sort_by = 'forum_name', integer $sort_dir, boolean $add_scope = false, string $from, string $count ) : mixed Fetches a list of forums.
getMessage ( integer $message_id ) Fetches a message.
getModerateList ( string $sort_by, integer $sort_dir ) Fetches a list of messages awaiting moderation. Selects all messages, irrespective of the thread root, which have the 'moderate' flag set in the attributes.
getThreadActions ( )
getThreadRoot ( $message_id )
getThreads ( integer $thread_root, boolean $all_levels = false, string $sort_by = 'message_timestamp', integer $sort_dir, boolean $message_view = false, string $link_back = '', string $base_url = null, string $from = null, string $count = null, boolean $nofollow = false ) Returns a list of threads.
getThreadsUi ( array $threads, array $col_headers, boolean $bodies = false, string $template_file = false ) : string Returns a table showing the specified message list.
hasPermission ( integer $perm = Horde_Perms::READ, integer $forum_id = null, string $scope = null ) : boolean Finds out if the user has the specified rights to the messages forum.
isHot ( $views, $last_post ) Returns true if the message is hot.
isNew ( $thread_id, $last_post ) Returns true, has new posts since user last visit
isThreadLocked ( $message_id ) : boolean
logView ( $thread_id ) : boolean Logs a message view.
mergeThread ( $thread_from, integer $message_id ) Merges two threads.
moderate ( string $action, array $ids ) Approves one or more ids.
moveThread ( integer $thread_id, integer $forum_id ) Moves a thread to another forum.
newForum ( string $forum_name, $owner ) : integer Creates a new forum.
replyMessage ( mixed $message ) : array Returns a hash with all information necessary to reply to a message.
saveForum ( array $info ) : integer Saves a forum, either creating one if no forum ID is given or updating an existing one.
saveMessage ( array $info ) : mixed Saves the message.
search ( array $filter, string $sort_by = 'message_subject', integer $sort_dir, string $from, string $count ) : array Searches forums for matching threads or posts.
setThreadLock ( $message_id, $lock )
splitThread ( integer $message_id ) Splits a thread on message id.
updateBan ( string $user, integer $forum_id = null, string $action = 'add' ) Ban user on a specific forum.
updateModerator ( string $moderator, integer $forum_id = null, string $action = 'add' ) Updates forum moderators.

보호된 메소드들

메소드 설명
_formatForums ( integer $forums ) : array | Traversable Fetches a list of forums.
_formatThreads ( array | Traversable $messages, string $sort_by = 'message_modifystamp', boolean $format = false, integer $thread_root ) Formats a message body.
_getCache ( $key, $thread ) Get cache value
_getForums ( integer $root_forum, boolean $formatted = true, string $sort_by = 'forum_name', integer $sort_dir, boolean $add_scope = false, string $from, string $count ) : mixed Fetches a list of forums.
_setCache ( $key, $value, $thread ) Set cache value

비공개 메소드들

메소드 설명
_getCacheKey ( $key, $thread ) Append namespace to cache key
_lastInForum ( integer $forum_id, integer $message_id, string $message_author = '', integer $message_timestamp ) Update lastMessage in a Forum
_lastInThread ( integer $thread_id, integer $message_id, string $message_author = '', integer $message_timestamp ) Update lastMessage in Thread
_sequence ( integer $thread_id, integer | string $diff = '+' ) Increments or decrements a thread's message count.
_updateCacheState ( $thread ) Increment namespace

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( $scope, $params )

_formatForums() 보호된 메소드

Fetches a list of forums.
protected _formatForums ( integer $forums ) : array | Traversable
$forums integer Forums to format
리턴 array | Traversable An array of forums.

_formatThreads() 보호된 메소드

Formats a message body.
protected _formatThreads ( array | Traversable $messages, string $sort_by = 'message_modifystamp', boolean $format = false, integer $thread_root )
$messages array | Traversable Messages to format
$sort_by string List format order
$format boolean Format messages body
$thread_root integer Thread root

_forumSequence() 공개 메소드

Increments or decrements a forum's message count.
public _forumSequence ( integer $forum_id, string $type = 'message', integer | string $diff = '+' )
$forum_id integer Forum to update
$type string What to increment message, thread or view.
$diff integer | string Incremental or decremental step, either a positive or negative integer, or a plus or minus sign.

_getCache() 보호된 메소드

Get cache value
protected _getCache ( $key, $thread )

_getForums() 보호된 메소드

Fetches a list of forums.
protected _getForums ( integer $root_forum, boolean $formatted = true, string $sort_by = 'forum_name', integer $sort_dir, boolean $add_scope = false, string $from, string $count ) : mixed
$root_forum integer The first level forum.
$formatted boolean Whether to return the list formatted or raw.
$sort_by string The column to sort by.
$sort_dir integer Sort direction, 0 = ascending, 1 = descending.
$add_scope boolean Add parent forum if forum for another scopelication.
$from string The forum to start listing at.
$count string The number of forums to return.
리턴 mixed An array of forums or PEAR_Error on failure.

_setCache() 보호된 메소드

Set cache value
protected _setCache ( $key, $value, $thread )

allowAttachments() 공개 메소드

Checks if attachments are allowed in messages for the current forum.
public allowAttachments ( ) : boolean
리턴 boolean Whether attachments allowed or not.

convertFromDriver() 공개 메소드

Converts a value from the driver's charset to the default charset.
public convertFromDriver ( mixed $value ) : mixed
$value mixed A value to convert.
리턴 mixed The converted value.

convertToDriver() 공개 메소드

Converts a value from the default charset to the driver's charset.
public convertToDriver ( mixed $value ) : mixed
$value mixed A value to convert.
리턴 mixed The converted value.

countForums() 공개 메소드

Returns the number of forums.
public countForums ( )

countMessages() 공개 메소드

Returns the number of all messages (threads and replies) in a forum
public countMessages ( ) : integer
리턴 integer The number of messages in forum or PEAR_Error on failure.

countThreads() 공개 메소드

Returns the number of replies on a thread, or threads in a forum
public countThreads ( integer $thread_root ) : integer
$thread_root integer Thread to count.
리턴 integer The number of messages in thread or PEAR_Error on failure.

dateFormat() 공개 메소드

Formats time according to user preferences.
public dateFormat ( integer $timestamp ) : string
$timestamp integer Message timestamp.
리턴 string Formatted date.

deleteForum() 공개 메소드

Deletes a forum, any subforums that are present and all messages contained in the forum and subforums.
public deleteForum ( integer $forum_id ) : boolean
$forum_id integer The ID of the forum to delete.
리턴 boolean True on success.

deleteMessage() 공개 메소드

Deletes a message and all replies.
public deleteMessage ( integer $message_id ) : string
$message_id integer The ID of the message to delete.
리턴 string Thread ID on success.

deleteThread() 공개 메소드

Deletes an entire message thread.
public deleteThread ( integer $thread_id )
$thread_id integer The ID of the thread to delete. If not specified will delete all the threads for the current forum.

formatBody() 공개 메소드

Formats a message body.
public formatBody ( string $body )
$body string Text to format.

formatSize() 공개 메소드

Formats file size.
public formatSize ( integer $filesize ) : string
$filesize integer
리턴 string Formatted filesize.

getBanned() 공개 메소드

Get banned users from the current forum
public getBanned ( )

getBareForums() 공개 메소드

Get forums ids and titles
public getBareForums ( ) : array
리턴 array An array of forums and form names.

getForm() 공개 메소드

public getForm ( $vars, $title, $editing = false, $new_forum = false )

getForum() 공개 메소드

Fetches a forum data.
public getForum ( integer $forum_id ) : array
$forum_id integer The ID of the forum to fetch.
리턴 array The forum hash or a PEAR_Error on failure.

getForums() 공개 메소드

Fetches a list of forums.
public getForums ( integer $root_forum, boolean $formatted = true, string $sort_by = 'forum_name', integer $sort_dir, boolean $add_scope = false, string $from, string $count ) : mixed
$root_forum integer The first level forum.
$formatted boolean Whether to return the list formatted or raw.
$sort_by string The column to sort by.
$sort_dir integer Sort direction, 0 = ascending, 1 = descending.
$add_scope boolean Add parent forum if forum for another scopelication.
$from string The forum to start listing at.
$count string The number of forums to return.
리턴 mixed An array of forums or PEAR_Error on failure.

getMessage() 공개 메소드

Fetches a message.
public getMessage ( integer $message_id )
$message_id integer The ID of the message to fetch.

getModerateList() 공개 메소드

Fetches a list of messages awaiting moderation. Selects all messages, irrespective of the thread root, which have the 'moderate' flag set in the attributes.
public getModerateList ( string $sort_by, integer $sort_dir )
$sort_by string The column by which to sort.
$sort_dir integer The direction by which to sort: 0 - ascending 1 - descending

getThreadActions() 공개 메소드

public getThreadActions ( )

getThreadRoot() 공개 메소드

public getThreadRoot ( $message_id )

getThreads() 공개 메소드

Returns a list of threads.
public getThreads ( integer $thread_root, boolean $all_levels = false, string $sort_by = 'message_timestamp', integer $sort_dir, boolean $message_view = false, string $link_back = '', string $base_url = null, string $from = null, string $count = null, boolean $nofollow = false )
$thread_root integer Message at which to start the thread. If null get all forum threads
$all_levels boolean Show all child levels or just one level.
$sort_by string The column by which to sort.
$sort_dir integer The direction by which to sort: 0 - ascending 1 - descending
$message_view boolean
$link_back string A url to pass to the reply script which will be returned to after an insertion of a post. Useful in cases when this thread view is used in blocks to return to the original page rather than to Agora.
$base_url string An alternative URL where edit/delete links point to. Mainly for api usage. Takes "%p" as a placeholder for the parent message ID.
$from string The thread to start listing at.
$count string The number of threads to return.
$nofollow boolean Whether to set the 'rel="nofollow"' attribute on linked URLs in the messages.

getThreadsUi() 공개 메소드

Returns a table showing the specified message list.
public getThreadsUi ( array $threads, array $col_headers, boolean $bodies = false, string $template_file = false ) : string
$threads array A hash with the thread messages as returned by {@link Agora_Driver::getThreads}.
$col_headers array A hash with the column headers.
$bodies boolean Display the message bodies?
$template_file string Template to use.
리턴 string The rendered message table.

hasPermission() 공개 메소드

Finds out if the user has the specified rights to the messages forum.
public hasPermission ( integer $perm = Horde_Perms::READ, integer $forum_id = null, string $scope = null ) : boolean
$perm integer The permission level needed for access.
$forum_id integer Forum to check permissions for.
$scope string Application scope to use.
리턴 boolean True if the user has the specified permissions.

isHot() 공개 메소드

Returns true if the message is hot.
public isHot ( $views, $last_post )

isNew() 공개 메소드

Returns true, has new posts since user last visit
public isNew ( $thread_id, $last_post )

isThreadLocked() 공개 메소드

public isThreadLocked ( $message_id ) : boolean
리턴 boolean

logView() 공개 메소드

Logs a message view.
public logView ( $thread_id ) : boolean
리턴 boolean True, if the view was logged, false if the message was aleredy seen

mergeThread() 공개 메소드

Merges two threads.
public mergeThread ( $thread_from, integer $message_id )
$message_id integer The ID of the message to merge to.

moderate() 공개 메소드

Approves one or more ids.
public moderate ( string $action, array $ids )
$action string Whether to 'approve' or 'delete' messages.
$ids array Array of message IDs.

moveThread() 공개 메소드

Moves a thread to another forum.
public moveThread ( integer $thread_id, integer $forum_id )
$thread_id integer The ID of the thread to move.
$forum_id integer The ID of the destination forum.

newForum() 공개 메소드

Creates a new forum.
public newForum ( string $forum_name, $owner ) : integer
$forum_name string Forum name.
리턴 integer ID of the new generated forum.

replyMessage() 공개 메소드

Returns a hash with all information necessary to reply to a message.
public replyMessage ( mixed $message ) : array
$message mixed The ID of the parent message to reply to, or arry of its data.
리턴 array A hash with all relevant information.

saveForum() 공개 메소드

Saves a forum, either creating one if no forum ID is given or updating an existing one.
public saveForum ( array $info ) : integer
$info array The forum information to save consisting of: forum_id forum_author forum_parent_id forum_name forum_moderated forum_description forum_attachments
리턴 integer The forum ID on success.

saveMessage() 공개 메소드

Saves the message.
public saveMessage ( array $info ) : mixed
$info array Array containing all the message data to save.
리턴 mixed Message ID on success or PEAR_Error on failure.

setThreadLock() 공개 메소드

public setThreadLock ( $message_id, $lock )

splitThread() 공개 메소드

Splits a thread on message id.
public splitThread ( integer $message_id )
$message_id integer The ID of the message to split at.

updateBan() 공개 메소드

Ban user on a specific forum.
public updateBan ( string $user, integer $forum_id = null, string $action = 'add' )
$user string Moderator username.
$forum_id integer Forum to add moderator to.
$action string Action to peform ('add' or 'delete').

updateModerator() 공개 메소드

Updates forum moderators.
public updateModerator ( string $moderator, integer $forum_id = null, string $action = 'add' )
$moderator string Moderator username.
$forum_id integer Forum to add moderator to.
$action string Action to peform ('add' or 'delete').

프로퍼티 상세

$_cache 보호되어 있는 프로퍼티

Cache object
protected Horde_Cache $_cache
리턴 Horde_Cache

$_charset 보호되어 있는 프로퍼티

Charset
protected string $_charset
리턴 string

$_db 보호되어 있는 프로퍼티

The database connection object.
protected Horde_Db_Adapter $_db
리턴 Horde_Db_Adapter

$_forum 공개적으로 프로퍼티

Current forum data
public array $_forum
리턴 array

$_forum_id 공개적으로 프로퍼티

Current forum ID
public string $_forum_id
리턴 string

$_forums_table 보호되어 있는 프로퍼티

Scope theads table name
protected string $_forums_table
리턴 string

$_scope 보호되어 있는 프로퍼티

The forums scope.
protected string $_scope
리턴 string

$_threads_table 보호되어 있는 프로퍼티

Scope theads table name
protected string $_threads_table
리턴 string