[Phpbbkb-checkins] SF.net SVN: phpbbkb: [36] root
Status: Alpha
Brought to you by:
markthedaemon
|
From: <so...@us...> - 2007-01-07 01:10:02
|
Revision: 36
http://svn.sourceforge.net/phpbbkb/?rev=36&view=rev
Author: softphp
Date: 2007-01-06 17:09:59 -0800 (Sat, 06 Jan 2007)
Log Message:
-----------
- Added the viewarticle tpl file, that i apparently had forgotten.
- Added some basic auth that will work for Alpha 1.
- Corrected minor language vars here and there, and other minor bugs.
Modified Paths:
--------------
root/kb/functions.php
root/kb.php
root/language/lang_english/lang_kb.php
Added Paths:
-----------
root/templates/subSilver/kb_viewarticle.tpl
Modified: root/kb/functions.php
===================================================================
--- root/kb/functions.php 2007-01-06 11:14:40 UTC (rev 35)
+++ root/kb/functions.php 2007-01-07 01:09:59 UTC (rev 36)
@@ -169,6 +169,7 @@
break;
case "delete_article":
+ $title .= ": " . $lang['kb_ucp_articledelete'];
break;
case "post_comment": // Only input
@@ -195,7 +196,7 @@
$error_msg = '';
$user_sig = $userdata['user_sig'];
- // This is instead of authentication which will be featured after alpha
+ // Simple auth for Alpha 1
if(!$userdata['session_logged_in'])
{
message_die(GENERAL_MESSAGE, 'Not authenticated!');
@@ -219,7 +220,7 @@
$article = $db->sql_fetchrow($result);
// if user editing set status = 0, else set status = old status :)
- if($userdata['user_id'] == $article_author)
+ if($userdata['user_id'] == $article['article_author'])
{
$article_status = "0";
}
@@ -227,6 +228,12 @@
{
$article_status = $article['article_status'];
}
+
+ // Simple Auth for alpha 1
+ if(($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $article['article_author']))
+ {
+ message_die(GENERAL_MESSAGE, $lang['kb_edit_noauth'];
+ }
}
// Add the new article
@@ -356,8 +363,15 @@
}
// Message here somewhere
+ $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '>"';
+ $return_message = $lang['kb_edited'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . phpEx . '?pid=view_article&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>');
}
- return;
+
+ $template->assign_vars(array(
+ 'META' => $meta)
+ );
+
+ message_die(GENERAL_MESSAGE, $return_message);
}
}
@@ -678,6 +692,12 @@
{
global $lang, $db, $phpEx, $template;
+ // Simple auth for alpha 1
+ if(($userdata['user_level'] != ADMIN) && ($userdata['user_id'] != $article['article_author']))
+ {
+ message_die(GENERAL_MESSAGE, $lang['kb_delete_noauth'];
+ }
+
if(!$confirm)
{
$s_hidden_fields = '<input type="hidden" name="article_id" value="' . $id . '" />';
@@ -697,7 +717,7 @@
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
- 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?mode=ucp&action=delete"),
+ 'S_CONFIRM_ACTION' => append_sid("kb." . $phpEx . "?mode=ucp&action=delete_article"),
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);
@@ -721,6 +741,14 @@
}
// Message
+ $meta = '<meta http-equiv="refresh" content="3;url=' . append_sid('kb.' . $phpEx . '?pid=view_article&id=' . $article_id) . '>"';
+ $return_message = $lang['kb_deleted'] . '<br /><br />' . sprintf($lang['kb_click_view_article'], '<a href="' . append_sid('kb.' . phpEx . '?pid=view_article&id=' . $article_id) . '">', '</a>') . '<br /><br />' . sprintf($lang['kb_click_return_ucp'], '<a href="' . append_sid('kb.' . $phpEx . '?pid=ucp') . '">', '</a>');
+
+ $template->assign_vars(array(
+ 'META' => $meta)
+ );
+
+ message_die(GENERAL_MESSAGE, $return_message);
}
}
Modified: root/kb.php
===================================================================
--- root/kb.php 2007-01-06 11:14:40 UTC (rev 35)
+++ root/kb.php 2007-01-07 01:09:59 UTC (rev 36)
@@ -525,9 +525,19 @@
'ARTICLE_TITLE' => $article_title,
'ARTICLE_TEXT' => $article_text,
'POSTED_BY' => $posted_by,
- 'SIGNATURE' => $user_sig)
+ 'SIGNATURE' => $user_sig,
+ 'L_EDITARTICLE' => $lang['kb_ucp_articleedit'],
+ 'L_DELETEARTICLE' => $lang['kb_ucp_articledelete'],
+
+ 'U_EDITARTICLE' => append_sid('kb.' . $phpEx . '?pid=ucp&action=edit_article&id=' . $id),
+ 'U_DELETEARTICLE' => append_sid('kb.' . $phpEx . '?pid=ucp&action=delete_article&id=' . $id))
);
+ if(($userdata['user_level'] == ADMIN) || ($userdata['user_id'] == $article['article_author']))
+ {
+ $template->assign_block_vars('switch_mod', array());
+ }
+
//
// Generate the page
//
@@ -591,7 +601,10 @@
//
// Generate the page
//
- $template->pparse('body');
+ if($action != "delete_article")
+ {
+ $template->pparse('body');
+ }
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
break;
Modified: root/language/lang_english/lang_kb.php
===================================================================
--- root/language/lang_english/lang_kb.php 2007-01-06 11:14:40 UTC (rev 35)
+++ root/language/lang_english/lang_kb.php 2007-01-07 01:09:59 UTC (rev 36)
@@ -25,6 +25,7 @@
$lang['kb_ucp'] = "KB User Control Panel";
$lang['kb_ucp_articlepost'] = "Post new article";
$lang['kb_ucp_articleedit'] = "Edit article";
+$lang['kb_ucp_articledelete'] = "Delete article";
// Normal Page
$lang['kb_categories'] = "Knowledge Base Categories";
@@ -53,10 +54,17 @@
$lang['kb_empty_cats'] = "The article you submitted had no category defined.";
$lang['kb_empty_article_desc'] = "The article has to contain an article description.";
$lang['kb_added'] = "Your article has been submitted and is awaiting approval.";
+$lang['kb_deleted'] = "Your article has been deleted and is now nonexistant.";
+$lang['kb_edited'] = "Your article has been edited and is awaiting reapproval.";
$lang['kb_click_view_article'] = "Click %here% to view you article."; // Change this later on, they can't view the article yet.
$lang['kb_click_return_ucp'] = "Click %here% to go back to the user control panel";
$lang['kb_posted_by'] = "This article was submitted by %s on %s, it was last updated on %s.";
+$lang['kb_confirm_deletearticle'] = "Are you sure you want to delete this article?";
+// Auth
+$lang['kb_edit_noauth'] = "You are not allowed to edit this article.";
+$lang['kb_delete_noauth'] = "You are not allowed to delete this article.";
+
// Admin
$lang['kbadm_header_editcat'] = "Edit Category";
$lang['kbadm_explain_editcat'] = "Here you can edit the chosen category, specifying its name, parent category and description.";
Added: root/templates/subSilver/kb_viewarticle.tpl
===================================================================
--- root/templates/subSilver/kb_viewarticle.tpl (rev 0)
+++ root/templates/subSilver/kb_viewarticle.tpl 2007-01-07 01:09:59 UTC (rev 36)
@@ -0,0 +1,39 @@
+<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
+ <tr>
+ <td align="left">{NAVIGATION}</td>
+ <td align="right"> </td>
+ </tr>
+</table>
+
+<table class="forumline" width="100%" cellspacing="1" cellpadding="3" border="0">
+ <tr>
+ <th colspan="2" class="thRight" nowrap="nowrap"><a class="maintitle" href="{U_VIEW_ARTICLE}">{ARTICLE_TITLE}</a></th>
+ </tr>
+ <tr>
+ <td align="left" class="catHead" height="28"><span class="gensmall">{POSTED_BY}</span></td>
+ <td align="right" class="catHead" height="28"><span class="gensmall">
+ <!-- switch_mod BEGIN -->
+ <a href="{U_EDITARTICLE}">{L_EDITARTICLE}</a> <a href="{U_DELETEARTICLE}">{L_DELETEARTICLE}</a>
+ <!-- switch_mod END -->
+ </span></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="row1" width="100%" height="28"><span class="postbody">{ARTICLE_TEXT}{SIGNATURE}</span></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="row1" width="150" align="left" valign="middle"><span class="nav"><a href="#top" class="nav">{L_BACK_TO_TOP}</a></span></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="spaceRow" height="1"><img src="templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
+ </tr>
+ <tr>
+ <td colspan="2" class="catBottom" height="28"></td>
+ </tr>
+</table>
+
+<table width="100%" cellspacing="0" border="0" align="center" cellpadding="2">
+ <tr>
+ <td align="left">{NAVIGATION}</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.
|