[geeklog-cvs] geeklog-1.3/public_html/admin story.php,1.129,1.130
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sun Aug 29 14:52:20 EDT 2004
Update of /var/cvs/geeklog-1.3/public_html/admin
In directory www:/tmp/cvs-serv14946/public_html/admin
Modified Files:
story.php
Log Message:
Story IDs are now editable
Index: story.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/admin/story.php,v
retrieving revision 1.129
retrieving revision 1.130
diff -C2 -d -r1.129 -r1.130
*** story.php 25 Aug 2004 22:54:25 -0000 1.129
--- story.php 29 Aug 2004 18:52:16 -0000 1.130
***************
*** 144,147 ****
--- 144,148 ----
return $display;
}
+ $A['old_sid'] = $A['sid'];
} elseif (!empty($sid) && $mode == 'editsubmission') {
$result = DB_query ("SELECT STRAIGHT_JOIN s.*, UNIX_TIMESTAMP(s.date) as unixdate, "
***************
*** 159,162 ****
--- 160,164 ----
$access = 3;
$A['title'] = htmlspecialchars ($A['title']);
+ $A['old_sid'] = $A['sid'];
} else {
// that submission doesn't seem to be there any more (may have been
***************
*** 166,169 ****
--- 168,172 ----
} elseif ($mode == 'edit') {
$A['sid'] = COM_makesid();
+ $A['old_sid'] = '';
$A['show_topic_icon'] = 1;
$A['uid'] = $_USER['uid'];
***************
*** 479,482 ****
--- 482,487 ----
$story_templates->set_var('story_emails', $A['numemails']);
$story_templates->set_var('story_id', $A['sid']);
+ $story_templates->set_var('old_story_id', $A['old_sid']);
+ $story_templates->set_var('lang_sid', $LANG24[12]);
$story_templates->set_var('lang_save', $LANG24[8]);
$story_templates->set_var('lang_preview', $LANG24[9]);
***************
*** 862,866 ****
*
*/
! function submitstory($type='',$sid,$uid,$tid,$title,$introtext,$bodytext,$hits,$unixdate,$expiredate,$comments,$featured,$commentcode,$statuscode,$postmode,$frontpage,$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$delete,$show_topic_icon)
{
global $_CONF, $_TABLES, $_USER, $LANG24, $MESSAGE, $HTTP_POST_FILES;
--- 867,871 ----
*
*/
! function submitstory($type='',$sid,$uid,$tid,$title,$introtext,$bodytext,$hits,$unixdate,$expiredate,$comments,$featured,$commentcode,$statuscode,$postmode,$frontpage,$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$delete,$show_topic_icon,$old_sid)
{
global $_CONF, $_TABLES, $_USER, $LANG24, $MESSAGE, $HTTP_POST_FILES;
***************
*** 868,874 ****
// Convert array values to numeric permission values
list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
!
$access = 0;
if (DB_count ($_TABLES['stories'], 'sid', $sid) > 0) {
$result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['stories']} WHERE sid = '{$sid}'");
$A = DB_fetchArray ($result);
--- 873,891 ----
// Convert array values to numeric permission values
list($perm_owner,$perm_group,$perm_members,$perm_anon) = SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon);
!
! // some minimal sanitizing on the story id ...
! $sid = str_replace (' ', '', $sid);
! $sid = str_replace (array ('_', '/', '\\', ':'), '-', $sid);
! if (empty ($sid)) {
! $sid = COM_makesid ();
! }
!
! $duplicate_sid = false;
! $delete_old_story = false;
$access = 0;
if (DB_count ($_TABLES['stories'], 'sid', $sid) > 0) {
+ if ($sid != $old_sid) {
+ $duplicate_sid = true;
+ }
$result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['stories']} WHERE sid = '{$sid}'");
$A = DB_fetchArray ($result);
***************
*** 877,880 ****
--- 894,900 ----
$A['perm_anon']);
} else {
+ if (!empty ($old_sid) && ($sid != old_sid)) {
+ $delete_old_story = true;
+ }
$access = SEC_hasAccess ($owner_id, $group_id, $perm_owner, $perm_group,
$perm_members, $perm_anon);
***************
*** 890,893 ****
--- 910,920 ----
echo $display;
exit;
+ } elseif ($duplicate_sid) {
+ $display .= COM_siteHeader ('menu');
+ $display .= COM_errorLog ($LANG24[24], 2);
+ $display .= storyeditor ($sid);
+ $display .= COM_siteFooter ();
+ echo $display;
+ exit;
} elseif (!empty($title) && !empty($introtext)) {
$date = date ('Y-m-d H:i:s', $unixdate);
***************
*** 1069,1076 ****
}
! DB_save ($_TABLES['stories'], 'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,expire,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,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$statuscode','$expire','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon");
// If this is done as part of the moderation then delete the submission
! DB_delete ($_TABLES['storysubmission'], 'sid', $sid);
// update feed(s) and Older Stories block
--- 1096,1113 ----
}
! DB_save ($_TABLES['stories'], 'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,expire,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,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$statuscode','$expire','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon");
// If this is done as part of the moderation then delete the submission
! if (empty ($old_sid)) {
! $del_sid = $sid;
! } else {
! $del_sid = $old_sid;
! }
! DB_delete ($_TABLES['storysubmission'], 'sid', $del_sid);
!
! // if the story id has changed, delete the story with the old id
! if ($delete_old_story && !empty ($old_sid)) {
! DB_delete ($_TABLES['stories'], 'sid', $old_sid);
! }
// update feed(s) and Older Stories block
***************
*** 1138,1142 ****
$sid = COM_applyFilter ($HTTP_POST_VARS['sid']);
$type = COM_applyFilter ($HTTP_POST_VARS['type']);
! if (!isset ($sid) || empty ($sid) || ($sid == 0)) {
COM_errorLog ('Attempted to delete story sid=' . $sid);
echo COM_refresh ($_CONF['site_admin_url'] . '/story.php');
--- 1175,1179 ----
$sid = COM_applyFilter ($HTTP_POST_VARS['sid']);
$type = COM_applyFilter ($HTTP_POST_VARS['type']);
! if (!isset ($sid) || empty ($sid)) {
COM_errorLog ('Attempted to delete story sid=' . $sid);
echo COM_refresh ($_CONF['site_admin_url'] . '/story.php');
***************
*** 1233,1237 ****
$HTTP_POST_VARS['perm_members'], $HTTP_POST_VARS['perm_anon'],
$HTTP_POST_VARS['delete'],
! COM_applyFilter ($HTTP_POST_VARS['show_topic_icon']));
} else { // 'cancel' or no mode at all
$type = COM_applyFilter ($HTTP_POST_VARS['type']);
--- 1270,1275 ----
$HTTP_POST_VARS['perm_members'], $HTTP_POST_VARS['perm_anon'],
$HTTP_POST_VARS['delete'],
! COM_applyFilter ($HTTP_POST_VARS['show_topic_icon']),
! COM_applyFilter ($HTTP_POST_VARS['old_sid']));
} else { // 'cancel' or no mode at all
$type = COM_applyFilter ($HTTP_POST_VARS['type']);
More information about the geeklog-cvs
mailing list