[Phpbbkb-checkins] SF.net SVN: phpbbkb: [18] root
Status: Alpha
Brought to you by:
markthedaemon
From: <so...@us...> - 2006-11-21 15:00:57
|
Revision: 18 http://svn.sourceforge.net/phpbbkb/?rev=18&view=rev Author: softphp Date: 2006-11-21 07:00:56 -0800 (Tue, 21 Nov 2006) Log Message: ----------- - Added loads of new files. In kb.php the main site works as it is now, look at kb.softphp.dk/kb.php for example. Added Paths: ----------- root/kb/ root/kb/constants.php root/kb/functions.php root/kb.php root/language/ root/language/lang_english/ root/language/lang_english/lang_kb.php root/templates/ root/templates/subSilver/ root/templates/subSilver/kb_main.tpl Added: root/kb/constants.php =================================================================== --- root/kb/constants.php (rev 0) +++ root/kb/constants.php 2006-11-21 15:00:56 UTC (rev 18) @@ -0,0 +1,26 @@ +<?php +/*************************************************************************** + * lang_kb.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +// All constants here +// DB Tables +define('KB_CATEGORIES_TABLE', $table_prefix . "kb_categories"); +define('KB_ARTICLES_TABLE', $table_prefix . "kb_articles"); + +?> \ No newline at end of file Added: root/kb/functions.php =================================================================== --- root/kb/functions.php (rev 0) +++ root/kb/functions.php 2006-11-21 15:00:56 UTC (rev 18) @@ -0,0 +1,23 @@ +<?php +/*************************************************************************** + * functions.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +// Nothing yet! + +?> \ No newline at end of file Added: root/kb.php =================================================================== --- root/kb.php (rev 0) +++ root/kb.php 2006-11-21 15:00:56 UTC (rev 18) @@ -0,0 +1,163 @@ +<?php +/*************************************************************************** + * kb.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ +define('IN_PHPBB', true); +$phpbb_root_path = './'; +include($phpbb_root_path . 'extension.inc'); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'kb/constants.' . $phpEx); // Added these two files, yes i could just add the 10-15 lines it will end with in +include($phpbb_root_path . 'kb/functions.' . $phpEx); // the existing files, but this makes it a lot easier to install/uninstall. + +// +// Start session management +// +$userdata = session_pagestart($user_ip, PAGE_INDEX); +init_userprefs($userdata); +// +// End session management +// + +// File takes care of the following action set via $pid ($HTTP_GET_VARS['pid']): +// main - views categories, with subcategories listed +// view_cat - views a category, either lists subcategories or articles contained, or both ofc. +// view_article - views an article +// ucp - My idea of this is that it should be the complete possibility for users here. If they are normal users, they can see their own +// articles and if they get approved or not. They can also view their comments, and wether they are approved or not. This should +// also include mod options for admins. Approving/disapproving comments or articles, editing them, so on... +// search - the kb search engine... +// More will come whenever i figure something out. Now i'll start coding. :D // Imladris +include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_kb.' . $phpEx); +$pid = ( isset($HTTP_GET_VARS['pid']) ) ? $HTTP_GET_VARS['pid'] : "main"; + +// Making sure the install file has been removed +if(file_exists($phpbb_root_path . "kb_install." . $phpEx)) +{ + message_die(GENERAL_MESSAGE, $lang['kb_remove_installfile']); +} + +switch($pid) +{ + case "main": + $sql = "SELECT c.cat_id, c.cat_main, c.cat_title, c.cat_desc, c.cat_articles, c.cat_order + FROM " . KB_CATEGORIES_TABLE . " c + WHERE c.cat_main = '0' + ORDER BY c.cat_order"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); + } + + $catrows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $catrows[] = $row; + } + + // Start Page output + $page_title = $lang['kb_main']; + include($phpbb_root_path . 'includes/page_header.'.$phpEx); + + $template->set_filenames(array( + 'body' => 'kb_main.tpl') + ); + + $template->assign_vars(array( + 'L_CATEGORIES' => $lang['kb_categories'], + 'L_ARTICLES' => $lang['kb_articles']) + ); + + if($total_catrows = count($catrows)) + { + for($i = 0; $i < $total_catrows; $i++) + { + // Ok display one cat here + $template->assign_block_vars('catrow', array( + 'CAT_TITLE' => $catrows[$i]['cat_title'], + 'CAT_DESC' => $catrows[$i]['cat_desc'], + 'CAT_ARTICLES' => $catrows[$i]['cat_articles'], + 'U_VIEWCAT' => append_sid("kb.$phpEx?pid=view_cat&id=" . $catrows[$i]['cat_id']), + 'L_SUBCATS' => $lang['kb_subcats'], + 'FORUM_FOLDER_IMG' => $images['forum']) // Stolen :D + ); + + // Now let's look at subcats + $sql = "SELECT c.cat_id, c.cat_main, c.cat_title, c.cat_order + FROM " . KB_CATEGORIES_TABLE . " c + WHERE c.cat_main = '" . $catrows[$i]['cat_id'] . "' + ORDER BY c.cat_order"; + if( !($result = $db->sql_query($sql)) ) + { + message_die(GENERAL_ERROR, 'Could not query subcategories list', '', __LINE__, __FILE__, $sql); + } + + $subcats = array(); + while ($row = $db->sql_fetchrow($result)) + { + $subcats[] = $row; + } + + if($total_subcats = count($subcats)) + { + // Contains subcats, show them + $template->assign_block_vars('catrow.switch_subcats', array()); + + for($j = 0; $j < $total_subcats; $j++) + { + // Show the subcat + $k = $j + 1; + $subcat_comma = ( isset($subcats[$k]) ) ? ", " : "."; + $template->assign_block_vars('catrow.subcatrow', array( + 'U_SUBCAT' => append_sid("kb.$phpEx?pid=view_cat&id=" . $subcats[$j]['cat_id']), + 'SUBCAT_TITLE' => $subcats[$j]['cat_title'], + 'SUBCAT_COMMA' => $subcat_comma) + ); + } + } + } + } + else + { + message_die(GENERAL_MESSAGE, $lang['No_kb_cats']); + } + + // + // Generate the page + // + $template->pparse('body'); + + include($phpbb_root_path . 'includes/page_tail.'.$phpEx); + break; + + case "view_cat": + break; + + case "view_article": + break; + + case "ucp": + break; + + case "search": + break; + + default: + message_die(GENERAL_MESSAGE, 'Wrong page id defined. No page shown.'); + break; +} +?> \ No newline at end of file Added: root/language/lang_english/lang_kb.php =================================================================== --- root/language/lang_english/lang_kb.php (rev 0) +++ root/language/lang_english/lang_kb.php 2006-11-21 15:00:56 UTC (rev 18) @@ -0,0 +1,29 @@ +<?php +/*************************************************************************** + * lang_kb.php + * ------------------- + * + * copyright: phpBB KB Group + * site: http://www.phpbbknowledgebase.com + * SF Project Page: http://www.sourceforge.net/projects/phpbbkb + * + ***************************************************************************/ + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + ***************************************************************************/ + +// Page titles +$lang['kb_main'] = "KnowledgeBase Home"; + +$lang['kb_categories'] = "KnowledgeBase Categories"; +$lang['kb_articles'] = "Articles"; +$lang['kb_subcats'] = "Subcategories"; +$lang['kb_remove_installfile'] = "Please ensure that you remove the kb_install.php file located in your phpBB root folder. KnowledgeBase won't work before that has been done!"; +$lang['No_kb_cats'] = "No knowledgebase categories has been added."; +?> \ No newline at end of file Added: root/templates/subSilver/kb_main.tpl =================================================================== --- root/templates/subSilver/kb_main.tpl (rev 0) +++ root/templates/subSilver/kb_main.tpl 2006-11-21 15:00:56 UTC (rev 18) @@ -0,0 +1,33 @@ +<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> + <tr> + <th colspan="2" class="thCornerL" height="25" nowrap="nowrap"> {L_CATEGORIES} </th> + <th class="thCornerR" nowrap="nowrap"> {L_ARTICLES} </th> + </tr> + <tr> + <td class="catLeft" colspan="2" height="28"><span class="cattitle"> </span></td> + <td class="rowpic" align="right"> </td> + </tr> + <!-- BEGIN catrow --> + <tr> + <td class="row1" align="center" valign="middle" height="50"><img src="{catrow.FORUM_FOLDER_IMG}" width="46" height="25" /></td> + <td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.U_VIEWCAT}" class="forumlink">{catrow.CAT_TITLE}</a><br /> + </span> <span class="genmed">{catrow.CAT_DESC}<br /> + </span><span class="gensmall"> + <!-- BEGIN switch_subcats --> + {catrow.L_SUBCATS}: + <!-- END switch_subcats --> + <!-- BEGIN subcatrow --> + <a href="{catrow.subcatrow.U_SUBCAT}" title="{catrow.subcatrow.SUBCAT_TITLE}">{catrow.subcatrow.SUBCAT_TITLE}</a>{catrow.subcatrow.SUBCAT_COMMA} + <!-- END subcatrow --> + </span></td> + <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.CAT_ARTICLES}</span></td> + </tr> + <!-- END catrow --> +</table> + +<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2"> + <tr> + <td align="left"> </td> + <td align="right"><span class="gensmall">{S_TIMEZONE}</span></td> + </tr> +</table> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |