From: <lph...@us...> - 2009-04-16 18:42:26
|
Revision: 18046 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=18046&view=rev Author: lphuberdeau Date: 2009-04-16 18:42:16 +0000 (Thu, 16 Apr 2009) Log Message: ----------- [NEW] Forum handler for profiles Modified Paths: -------------- branches/3.0/lib/profilelib/installlib.php Modified: branches/3.0/lib/profilelib/installlib.php =================================================================== --- branches/3.0/lib/profilelib/installlib.php 2009-04-16 18:20:57 UTC (rev 18045) +++ branches/3.0/lib/profilelib/installlib.php 2009-04-16 18:42:16 UTC (rev 18046) @@ -21,6 +21,7 @@ 'topic' => 'Tiki_Profile_InstallHandler_Topic', 'article_type' => 'Tiki_Profile_InstallHandler_ArticleType', 'article' => 'Tiki_Profile_InstallHandler_Article', + 'forum' => 'Tiki_Profile_InstallHandler_Forum', ); private static $typeMap = array( @@ -1334,6 +1335,8 @@ $defaults = array( 'description' => null, 'refresh' => 30, + 'show_title' => 'n', + 'show_publication_date' => 'n', ); $data = array_merge( @@ -1422,6 +1425,32 @@ 'show' => 'y', 'allow' => 'y', ), true ); + + $defaults = array( + 'show_pre_publication' => 'n', + 'show_post_expire' => 'n', + 'show_heading_only' => 'n', + 'show_image' => 'n', + 'show_avatar' => 'n', + 'show_author' => 'n', + 'show_publication_date' => 'n', + 'show_expiration_date' => 'n', + 'show_reads' => 'n', + 'show_size' => 'n', + 'show_topline' => 'n', + 'show_subtitle' => 'n', + 'show_link_to' => 'n', + 'show_image_caption' => 'n', + 'show_language' => 'n', + + 'allow_ratings' => 'n', + 'allow_comments' => 'n', + 'allow_comments_rating_article' => 'n', + 'allow_creator_edit' => 'n', + ); + + $data = array_merge( $defaults, $data ); + $data = Tiki_Profile::convertYesNo( $data ); return $this->data = $data; @@ -1555,6 +1584,166 @@ } } // }}} +class Tiki_Profile_InstallHandler_Forum extends Tiki_Profile_InstallHandler // {{{ +{ + function getData() + { + if( $this->data ) + return $this->data; + + $data = $this->obj->getData(); + + $defaults = array( + 'description' => '', + 'flood_interval' => 120, + 'moderator' => 'admin', + 'per_page' => 10, + 'prune_max_age' => 3*24*3600, + 'prune_unreplied_max_age' => 30*24*3600, + 'topic_order' => 'lastPost_desc', + 'thread_order' => '', + 'section' => '', + 'inbound_pop_server' => '', + 'inbound_pop_port' => 110, + 'inbound_pop_user' => '', + 'inbound_pop_password' => '', + 'outbound_address' => '', + 'outbound_from' => '', + 'approval_type' => 'all_posted', + 'moderator_group' => '', + 'forum_password' => '', + 'attachments' => 'none', + 'attachments_store' => 'db', + 'attachments_store_dir' => '', + 'attachments_max_size' => 10000000, + 'forum_last_n' => 0, + 'comments_per_page' => '', + 'thread_style' => '', + 'is_flat' => 'n', + + 'list_topic_reads' => 'n', + 'list_topic_replies' => 'n', + 'list_topic_points' => 'n', + 'list_topic_last_post' => 'n', + 'list_topic_author' => 'n', + + 'show_description' => 'n', + + 'enable_flood_control' => 'n', + 'enable_inbound_mail' => 'n', + 'enable_prune_unreplied' => 'n', + 'enable_prune_old' => 'n', + 'enable_vote_threads' => 'n', + 'enable_outbound_for_inbound' => 'n', + 'enable_outbound_reply_link' => 'n', + 'enable_topic_smiley' => 'n', + 'enable_topic_summary' => 'n', + 'enable_ui_avatar' => 'n', + 'enable_ui_flag' => 'n', + 'enable_ui_posts' => 'n', + 'enable_ui_level' => 'n', + 'enable_ui_email' => 'n', + 'enable_ui_online' => 'n', + 'enable_password_protection' => 'n', + ); + + $data = Tiki_Profile::convertLists( $data, array( + 'enable' => 'y', + 'list' => 'y', + 'show' => 'y', + ), true ); + + $data = array_merge( $defaults, $data ); + + $data = Tiki_Profile::convertYesNo( $data ); + + return $this->data = $data; + } + + function canInstall() + { + $data = $this->getData(); + + if( ! isset( $data['name'] ) ) + return false; + + return true; + } + + function _install() + { + global $dbTiki; + require_once 'lib/commentslib.php'; + $comments = new Comments( $dbTiki ); + + $data = $this->getData(); + $this->replaceReferences( $data ); + + $attConverter = new Tiki_Profile_ValueMapConverter( array( + 'none' => 'att_no', + 'everyone' => 'att_all', + 'allowed' => 'att_perm', + 'admin' => 'att_admin', + ) ); + + $id = $comments->replace_forum( + 0, + $data['name'], + $data['description'], + $data['enable_flood_control'], + $data['flood_interval'], + $data['moderator'], + $data['mail'], + $data['enable_inbound_mail'], + $data['enable_prune_unreplied'], + $data['prune_unreplied_max_age'], + $data['enable_prune_old'], + $data['prune_max_age'], + $data['per_page'], + $data['topic_order'], + $data['thread_order'], + $data['section'], + $data['list_topic_reads'], + $data['list_topic_replies'], + $data['list_topic_points'], + $data['list_topic_last_post'], + $data['list_topic_author'], + $data['enable_vote_threads'], + $data['show_description'], + $data['inbound_pop_server'], + $data['inbound_pop_port'], + $data['inbound_pop_user'], + $data['inbound_pop_password'], + $data['outbound_address'], + $data['enable_outbound_for_inbound'], + $data['enable_outbound_reply_link'], + $data['outbound_from'], + $data['enable_topic_smiley'], + $data['enable_topic_summary'], + $data['enable_ui_avatar'], + $data['enable_ui_flag'], + $data['enable_ui_posts'], + $data['enable_ui_level'], + $data['enable_ui_email'], + $data['enable_ui_online'], + $data['approval_type'], + $data['moderator_group'], + $data['forum_password'], + $data['enable_password_protection'], + $attConverter->convert( $data['attachments'] ), + $data['attachments_store'], + $data['attachments_store_dir'], + $data['attachments_max_size'], + $data['forum_last_n'], + $data['comments_per_page'], + $data['thread_style'], + $data['is_flat'] + ); + + return $id; + } +} // }}} + interface Tiki_Profile_Converter { function convert( $value ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |