[geeklog-cvs] geeklog-1.3/public_html/admin story.php,1.91,1.92
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Sat Jun 21 04:52:49 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory internal.geeklog.net:/tmp/cvs-serv21987/public_html/admin
Modified Files:
story.php
Log Message:
Added support for '_admin_block' and '_msg_block' template overrides
(and moved a hard-coded headline to the language files).
Index: story.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/story.php,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** story.php 23 May 2003 11:43:27 -0000 1.91
--- story.php 21 Jun 2003 08:52:47 -0000 1.92
***************
*** 6,11 ****
// +---------------------------------------------------------------------------+
// | story.php |
- // | Geeklog story administration page. |
// | |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2003 by the following authors: |
--- 6,11 ----
// +---------------------------------------------------------------------------+
// | story.php |
// | |
+ // | Geeklog story administration page. |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2000-2003 by the following authors: |
***************
*** 46,54 ****
* Geeklog commong function library
*/
! include('../lib-common.php');
/**
* Security check to ensure user even belongs on this page
*/
! include('auth.inc.php');
// Set this to true if you want to have this code output debug messages to
--- 46,54 ----
* Geeklog commong function library
*/
! require_once('../lib-common.php');
/**
* Security check to ensure user even belongs on this page
*/
! require_once('auth.inc.php');
// Set this to true if you want to have this code output debug messages to
***************
*** 59,67 ****
if (!SEC_hasRights('story.edit')) {
! $display .= COM_siteHeader('menu');
! $display .= COM_startBlock($MESSAGE[30]);
$display .= $MESSAGE[31];
! $display .= COM_endBlock();
! $display .= COM_siteFooter();
COM_errorLog("User {$_USER['username']} tried to illegally access the story administration screen",1);
echo $display;
--- 59,68 ----
if (!SEC_hasRights('story.edit')) {
! $display .= COM_siteHeader ('menu');
! $display .= COM_startBlock ($MESSAGE[30], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $MESSAGE[31];
! $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
! $display .= COM_siteFooter ();
COM_errorLog("User {$_USER['username']} tried to illegally access the story administration screen",1);
echo $display;
***************
*** 95,107 ****
$access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
if ($access == 2) {
! $display .= COM_startBlock($LANG24[40]);
$display .= $LANG24[41];
! $display .= COM_endBlock();
$display .= COM_article($A,n);
return $display;
} else if ($access == 0) {
! $display .= COM_startBlock($LANG24[40]);
$display .= $LANG24[42];
! $display .= COM_endBlock();
return $display;
}
--- 96,110 ----
$access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
if ($access == 2) {
! $display .= COM_startBlock($LANG24[40], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $LANG24[41];
! $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
$display .= COM_article($A,n);
return $display;
} else if ($access == 0) {
! $display .= COM_startBlock($LANG24[40], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $LANG24[42];
! $display .= COM_endBlock(COM_getBlockTemplate ('_msg_block', 'footer'));
return $display;
}
***************
*** 195,199 ****
if (!empty($A['title'])) {
! $display .= COM_startBlock($LANG24[26]);
$A['day'] = $A['unixdate'];
if (empty ($A['hits'])) {
--- 198,203 ----
if (!empty($A['title'])) {
! $display .= COM_startBlock ($LANG24[26], '',
! COM_getBlockTemplate ('_admin_block', 'header'));
$A['day'] = $A['unixdate'];
if (empty ($A['hits'])) {
***************
*** 201,217 ****
}
$display .= COM_article($A,"n");
! $display .= COM_endBlock();
}
! $display .= COM_startBlock($LANG24[5]);
if ($access == 3) {
! $story_templates->set_var('delete_option', "<input type=\"submit\" value=\"$LANG24[11]\" name=\"mode\">");
}
if ($A['type'] == 'editsubmission' || $mode == 'editsubmission') {
! $story_templates->set_var('submission_option', '<input type="hidden" name="type" value="submission">');
}
$story_templates->set_var('lang_author', $LANG24[7]);
! $story_templates->set_var('story_author', DB_getItem($_TABLES['users'],'username',"uid = {$A['uid']}"));
$story_templates->set_var('story_uid', $A['uid']);
--- 205,225 ----
}
$display .= COM_article($A,"n");
! $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
}
! $display .= COM_startBlock ($LANG24[5], '',
! COM_getBlockTemplate ('_admin_block', 'header'));
if ($access == 3) {
! $story_templates->set_var ('delete_option',
! '<input type="submit" value="' . $LANG24[11] . '" name="mode">');
}
if ($A['type'] == 'editsubmission' || $mode == 'editsubmission') {
! $story_templates->set_var ('submission_option',
! '<input type="hidden" name="type" value="submission">');
}
$story_templates->set_var('lang_author', $LANG24[7]);
! $story_templates->set_var ('story_author', DB_getItem ($_TABLES['users'],
! 'username', "uid = {$A['uid']}"));
$story_templates->set_var('story_uid', $A['uid']);
***************
*** 219,223 ****
$story_templates->set_var('lang_accessrights',$LANG_ACCESS['accessrights']);
$story_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
! $story_templates->set_var('owner_username', DB_getItem($_TABLES['users'],'username',"uid = {$A['owner_id']}"));
$story_templates->set_var('owner_id', $A['owner_id']);
$story_templates->set_var('lang_group', $LANG_ACCESS['group']);
--- 227,232 ----
$story_templates->set_var('lang_accessrights',$LANG_ACCESS['accessrights']);
$story_templates->set_var('lang_owner', $LANG_ACCESS['owner']);
! $story_templates->set_var ('owner_username', DB_getItem ($_TABLES['users'],
! 'username', "uid = {$A['owner_id']}"));
$story_templates->set_var('owner_id', $A['owner_id']);
$story_templates->set_var('lang_group', $LANG_ACCESS['group']);
***************
*** 225,242 ****
$usergroups = SEC_getUserGroups();
if ($access == 3) {
! $groupdd .= '<SELECT name="group_id">';
for ($i = 0; $i < count($usergroups); $i++) {
$groupdd .= '<option value="' . $usergroups[key($usergroups)] . '"';
if ($A['group_id'] == $usergroups[key($usergroups)]) {
! $groupdd .= ' SELECTED';
}
$groupdd .= '>' . key($usergroups) . '</option>';
next($usergroups);
}
! $groupdd .= '</SELECT>';
} else {
// they can't set the group then
! $groupdd .= DB_getItem($_TABLES['groups'],'grp_name',"grp_id = {$A['group_id']}");
! $groupdd .= '<input type="hidden" name="group_id" value="' . $A['group_id'] . '">';
}
$story_templates->set_var('group_dropdown', $groupdd);
--- 234,253 ----
$usergroups = SEC_getUserGroups();
if ($access == 3) {
! $groupdd .= '<select name="group_id">';
for ($i = 0; $i < count($usergroups); $i++) {
$groupdd .= '<option value="' . $usergroups[key($usergroups)] . '"';
if ($A['group_id'] == $usergroups[key($usergroups)]) {
! $groupdd .= ' selected="selected"';
}
$groupdd .= '>' . key($usergroups) . '</option>';
next($usergroups);
}
! $groupdd .= '</select>';
} else {
// they can't set the group then
! $groupdd .= DB_getItem ($_TABLES['groups'], 'grp_name',
! "grp_id = {$A['group_id']}");
! $groupdd .= '<input type="hidden" name="group_id" value="'
! . $A['group_id'] . '">';
}
$story_templates->set_var('group_dropdown', $groupdd);
***************
*** 264,270 ****
}
if ($ampm == 'pm') {
! $story_templates->set_var('publishpm_selected','selected="SELECTED"');
} else {
! $story_templates->set_var('publisham_selected','selected="SELECTED"');
}
$month_options = COM_getMonthFormOptions($publish_month);
--- 275,281 ----
}
if ($ampm == 'pm') {
! $story_templates->set_var ('publishpm_selected', 'selected="selected"');
} else {
! $story_templates->set_var ('publisham_selected', 'selected="selected"');
}
$month_options = COM_getMonthFormOptions($publish_month);
***************
*** 301,305 ****
$story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
if ($A['show_topic_icon'] == 1) {
! $story_templates->set_var('show_topic_icon_checked', 'checked="CHECKED"');
} else {
$story_templates->set_var('show_topic_icon_checked', '');
--- 312,316 ----
$story_templates->set_var('lang_show_topic_icon', $LANG24[56]);
if ($A['show_topic_icon'] == 1) {
! $story_templates->set_var('show_topic_icon_checked', 'checked="checked"');
} else {
$story_templates->set_var('show_topic_icon_checked', '');
***************
*** 307,311 ****
$story_templates->set_var('lang_draft', $LANG24[34]);
if ($A['draft_flag'] == 1) {
! $story_templates->set_var('is_checked', 'CHECKED');
}
$story_templates->set_var('lang_mode', $LANG24[3]);
--- 318,322 ----
$story_templates->set_var('lang_draft', $LANG24[34]);
if ($A['draft_flag'] == 1) {
! $story_templates->set_var('is_checked', 'checked="checked"');
}
$story_templates->set_var('lang_mode', $LANG24[3]);
***************
*** 378,382 ****
$story_templates->parse('output','editor');
$display .= $story_templates->finish($story_templates->get_var('output'));
! $display .= COM_endBlock();
return $display;
--- 389,393 ----
$story_templates->parse('output','editor');
$display .= $story_templates->finish($story_templates->get_var('output'));
! $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
return $display;
***************
*** 398,404 ****
$display = '';
! $display .= COM_startBlock($LANG24[22]);
$story_templates = new Template($_CONF['path_layout'] . 'admin/story');
! $story_templates->set_file(array('list'=>'liststories.thtml','row'=>'listitem.thtml'));
$story_templates->set_var('layout_url', $_CONF['layout_url']);
--- 409,417 ----
$display = '';
! $display .= COM_startBlock ($LANG24[22], '',
! COM_getBlockTemplate ('_admin_block', 'header'));
$story_templates = new Template($_CONF['path_layout'] . 'admin/story');
! $story_templates->set_file (array ('list' => 'liststories.thtml',
! 'row' => 'listitem.thtml'));
$story_templates->set_var('layout_url', $_CONF['layout_url']);
***************
*** 519,523 ****
}
$display .= $story_templates->parse('output','list');
! $display .= COM_endBlock();
return $display;
--- 532,536 ----
}
$display .= $story_templates->parse('output','list');
! $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
return $display;
***************
*** 650,654 ****
* Saves story to database
*
! * @param string $type ??
* @param string $sid ID of story to save
* @param int $uid ID of user that wrote the story
--- 663,667 ----
* Saves story to database
*
! * @param string $type story submission or (new) story
* @param string $sid ID of story to save
* @param int $uid ID of user that wrote the story
***************
*** 695,703 ****
}
if (($access < 3) || (SEC_hasTopicAccess ($tid) < 2) || !SEC_inGroup ($group_id)) {
! $display .= COM_siteHeader('menu');
! $display .= COM_startBlock($MESSAGE[30]);
$display .= $MESSAGE[31];
! $display .= COM_endBlock();
! $display .= COM_siteFooter();
COM_errorLog("User {$_USER['username']} tried to illegally submit or edit story $sid",1);
echo $display;
--- 708,717 ----
}
if (($access < 3) || (SEC_hasTopicAccess ($tid) < 2) || !SEC_inGroup ($group_id)) {
! $display .= COM_siteHeader ('menu');
! $display .= COM_startBlock ($MESSAGE[30], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $MESSAGE[31];
! $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
! $display .= COM_siteFooter ();
COM_errorLog("User {$_USER['username']} tried to illegally submit or edit story $sid",1);
echo $display;
***************
*** 716,721 ****
$draft_flag = 0;
! // OK, if this story was already in the database and the user changed this from a draft
! // to an actual story then update the date to be now
if (DB_count($_TABLES['stories'],'sid',$sid) == 1) {
if (DB_getItem($_TABLES['stories'],'draft_flag',"sid = '$sid'") == 1) {
--- 730,736 ----
$draft_flag = 0;
! // OK, if this story was already in the database and the user
! // changed this from a draft to an actual story then update the
! // date to be now
if (DB_count($_TABLES['stories'],'sid',$sid) == 1) {
if (DB_getItem($_TABLES['stories'],'draft_flag',"sid = '$sid'") == 1) {
***************
*** 763,767 ****
$comments = DB_count($_TABLES['comments'],'sid',$sid);
-
// Delete any images if needed
for ($i = 1; $i <= count($delete); $i++) {
--- 778,781 ----
***************
*** 795,799 ****
$index_start = 1;
}
!
if (count($HTTP_POST_FILES) > 0 AND $_CONF['maximagesperarticle'] > 0) {
require_once($_CONF['path_system'] . 'classes/upload.class.php');
--- 809,813 ----
$index_start = 1;
}
!
if (count($HTTP_POST_FILES) > 0 AND $_CONF['maximagesperarticle'] > 0) {
require_once($_CONF['path_system'] . 'classes/upload.class.php');
***************
*** 822,832 ****
exit;
}
! // NOTE: if $_CONF['path_to_mogrify'] is set, the call below will force any images bigger than
! // the passed dimensions to be resized. If mogrify is not set, any images larger than these
! // dimensions will get validation errors
$upload->setMaxDimensions($_CONF['max_image_width'], $_CONF['max_image_height']);
$upload->setMaxFileSize($_CONF['max_image_size']); // size in bytes, 1048576 = 1MB
! // Set file permissions on file after it gets uploaded (number is in octet)
$upload->setPerms('0644');
$filenames = array();
--- 836,848 ----
exit;
}
!
! // NOTE: if $_CONF['path_to_mogrify'] is set, the call below will
! // force any images bigger than the passed dimensions to be resized.
! // If mogrify is not set, any images larger than these dimensions
! // will get validation errors
$upload->setMaxDimensions($_CONF['max_image_width'], $_CONF['max_image_height']);
$upload->setMaxFileSize($_CONF['max_image_size']); // size in bytes, 1048576 = 1MB
! // Set file permissions on file after it gets uploaded (number is in octal)
$upload->setPerms('0644');
$filenames = array();
***************
*** 845,859 ****
$upload->setDebug(true);
$upload->uploadFiles();
!
if ($upload->areErrors()) {
$retval = COM_siteHeader('menu');
! $retval .= COM_startBlock('File Upload Errors');
$retval .= $upload->printErrors(false);
! $retval .= COM_endBlock();
$retval .= COM_siteFooter('true');
echo $retval;
exit;
}
!
reset($filenames);
for ($z = $index_start; $z <= $end_index; $z++) {
--- 861,876 ----
$upload->setDebug(true);
$upload->uploadFiles();
!
if ($upload->areErrors()) {
$retval = COM_siteHeader('menu');
! $retval .= COM_startBlock ($LANG24[30], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
$retval .= $upload->printErrors(false);
! $retval .= COM_endBlock(COM_getBlockTemplate ('_msg_block', 'footer'));
$retval .= COM_siteFooter('true');
echo $retval;
exit;
}
!
reset($filenames);
for ($z = $index_start; $z <= $end_index; $z++) {
***************
*** 866,877 ****
list($errors, $introtext, $bodytext) = insert_images($sid, $introtext, $bodytext);
if (count($errors) > 0) {
! $display = COM_siteHeader('menu');
! $display .= COM_startBlock($LANG24[54]);
! $display .= $LANG24[55] . '<P>';
for ($i = 1; $i <= count($errors); $i++) {
$display .= current($errors) . '<br>';
next($errors);
}
! $display .= COM_endBlock();
$display .= storyeditor($sid);
$display .= COM_siteFooter();
--- 883,895 ----
list($errors, $introtext, $bodytext) = insert_images($sid, $introtext, $bodytext);
if (count($errors) > 0) {
! $display = COM_siteHeader ('menu');
! $display .= COM_startBlock ($LANG24[54], '',
! COM_getBlockTemplate ('_msg_block', 'header'));
! $display .= $LANG24[55] . '<p>';
for ($i = 1; $i <= count($errors); $i++) {
$display .= current($errors) . '<br>';
next($errors);
}
! $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
$display .= storyeditor($sid);
$display .= COM_siteFooter();
***************
*** 887,891 ****
}
DB_save($_TABLES['stories'],'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon',"$sid,$uid,'$tid','$title','$introtext','$bodytext',$hits,'$date','$comments','$related',$featured,'$commentcode','$statuscode','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon", $return_to);
!
// If this is done as part of moderation stuff then delete the submission
if ($type = 'submission') {
--- 905,909 ----
}
DB_save($_TABLES['stories'],'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon',"$sid,$uid,'$tid','$title','$introtext','$bodytext',$hits,'$date','$comments','$related',$featured,'$commentcode','$statuscode','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon", $return_to);
!
// If this is done as part of moderation stuff then delete the submission
if ($type = 'submission') {
More information about the geeklog-cvs
mailing list