14 |
14 |
* @lastmodified $Date$
|
15 |
15 |
*
|
16 |
16 |
*/
|
17 |
|
error_reporting(E_ALL);
|
|
17 |
error_reporting(E_ALL);
|
18 |
18 |
require('../../config.php');
|
19 |
19 |
require_once(WB_PATH."/include/jscalendar/jscalendar-functions.php");
|
20 |
20 |
// Get post_id
|
... | ... | |
72 |
72 |
$publisheduntil = jscalendar_to_timestamp($admin->get_post_escaped('enddate'), $publishedwhen);
|
73 |
73 |
if($publisheduntil == '' || $publisheduntil < 1) { $publisheduntil=0; }
|
74 |
74 |
// Update row
|
75 |
|
$sql = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` ';
|
76 |
|
$sql .= 'SET `group_id`='.(int)$group_id.', ';
|
77 |
|
$sql .= '`title`=\''.$title.'\', ';
|
78 |
|
$sql .= '`link`=\''.$newLink.'\', ';
|
79 |
|
$sql .= '`content_short`=\''.$short.'\', ';
|
80 |
|
$sql .= '`content_long`=\''.$long.'\', ';
|
81 |
|
$sql .= '`commenting`=\''.$commenting.'\', ';
|
82 |
|
$sql .= '`active`='.(int)$active.', ';
|
83 |
|
$sql .= '`published_when`='.(int)$publishedwhen.', ';
|
84 |
|
$sql .= '`published_until`='.(int)$publisheduntil.', ';
|
85 |
|
$sql .= '`posted_when`='.time().', ';
|
86 |
|
$sql .= '`posted_by`='.(int)$admin->get_user_id().' ';
|
87 |
|
$sql .= 'WHERE `post_id`='.(int)$post_id;
|
|
75 |
$sql = 'UPDATE `'.TABLE_PREFIX.'mod_news_posts` '
|
|
76 |
. 'SET `group_id`='.(int)$group_id.', '
|
|
77 |
. '`title`=\''.$database->escapeString($title).'\', '
|
|
78 |
. '`link`=\''.$database->escapeString($newLink).'\', '
|
|
79 |
. '`content_short`=\''.$database->escapeString($short).'\', '
|
|
80 |
. '`content_long`=\''.$database->escapeString($long).'\', '
|
|
81 |
. '`commenting`=\''.$database->escapeString($commenting).'\', '
|
|
82 |
. '`active`='.(int)$active.', '
|
|
83 |
. '`published_when`='.(int)$publishedwhen.', '
|
|
84 |
. '`published_until`='.(int)$publisheduntil.', '
|
|
85 |
. '`posted_when`='.time().', '
|
|
86 |
. '`posted_by`='.(int)$admin->get_user_id().' '
|
|
87 |
. 'WHERE `post_id`='.(int)$post_id;
|
88 |
88 |
if( $database->query($sql) ) {
|
89 |
89 |
// create new accessfile
|
90 |
90 |
$sDoWhat = (($newLink == $old_link) && (file_exists($sNewFilename))) ? "nothing" : "action";
|
91 |
|
// try to create the whole path to the accessfile
|
92 |
|
$sAccessPath = dirname($sNewFilename).'/';
|
93 |
|
if(!($bRetval = is_dir($sAccessPath))) {
|
94 |
|
$iOldUmask = umask(0) ;
|
95 |
|
// sanitize directory mode to 'o+rwx/g+x/u+x' and create path
|
96 |
|
$bRetval = mkdir($sAccessPath, (OCTAL_DIR_MODE |0711), true);
|
97 |
|
umask($iOldUmask);
|
98 |
|
}
|
99 |
91 |
if($sDoWhat == "action") {
|
100 |
92 |
$sDoWhat = (($sDoWhat == "action") && file_exists($sOldFilename)) ? "update" : "create";
|
101 |
93 |
}
|
... | ... | |
104 |
96 |
{
|
105 |
97 |
case "update":
|
106 |
98 |
try {
|
107 |
|
$oAF = new AccessFile($sOldFilename, $page_id);
|
108 |
|
$oAF->rename($sNewFile);
|
109 |
|
unset($oAF);
|
|
99 |
// prozedural rename accessfile if link has changed, has to be changed to accessfile class when fixed
|
|
100 |
if(($sNewFilename != $sOldFilename) && (is_writable($sOldFilename))) {
|
|
101 |
if(!rename($sOldFilename,$sNewFilename)) {
|
|
102 |
$admin->print_error($MESSAGE['PAGES_CANNOT_DELETE_ACCESS_FILE'].' - '.$oldLink,$sBackUrl);
|
|
103 |
}
|
|
104 |
}
|
|
105 |
// $oAF = new AccessFile($sOldFilename, $page_id);
|
|
106 |
// $oAF->rename($sNewFile);
|
|
107 |
// unset($oAF);
|
110 |
108 |
}catch(AccessFileException $e) {
|
111 |
109 |
$admin->print_error($e,$sBackUrl);
|
112 |
110 |
}
|