Welcome to Geeklog, Anonymous Friday, November 08 2024 @ 09:31 pm EST
Geeklog Forums
Geeklog v2.2.1 - Manual Fix for #967 - Update all Article Permissions to the Default Settings
Status: offline
Laugh
Site Admin
Admin
Registered: 09/27/05
Posts: 1470
Location:Canada
This is in regards to the following bug https://github.com/Geeklog-Core/geeklog/issues/967
Since Geeklog v2.0.0 the default article permissions and the Story Admin Group where not used for the default permissions when a submitted article was approved or brought up in the Article Editor. Instead the Topic Admin group and the default topic permissions for the article was used. This has now been fixed in Geeklog v2.2.1. but you must manually go through and check any previously submitted articles and update their permissions if needed.
To update all articles to the default permissions (while not updating the owner_id) create a text file with the following name "fix-article-issue-967.php" in the public_html directory of your geeklog website. Add the code below to the file and save it.
<?php
require_once 'lib-common.php';
global $_CONF, $_GROUPS, $_TABLES, $MESSAGE, $_USER;
// For Root users only
if (!SEC_inGroup('Root')) {
$display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
COM_errorLog("Someone has tried to access a custom Geeklog Database Upgrade Routine {$_SERVER["SCRIPT_NAME"]} without proper permissions. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'],1);
COM_output($display);
exit;
}
COM_errorLog("Someone has run a custom Geeklog Database Upgrade Routine {$_SERVER["SCRIPT_NAME"]} User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'],1);
$display = '<h1>Custom Development Database Update</h1>';
$display .= '<p>Fix for Article Permissions and Issue #<a href="https://github.com/Geeklog-Core/geeklog/issues/967" target="_blank">967</a></p>';
$display .= "<p><strong>Starting Process</strong></p>";
$display .= "<p><em>WORKING</em></p>";
if (isset($_GROUPS['Story Admin'])) {
$group_id = $_GROUPS['Story Admin'];
} else {
$group_id = SEC_getFeatureGroup('story.edit');
}
$A = array();
SEC_setDefaultPermissions($A, $_CONF['default_permissions_story']);
DB_query("UPDATE {$_TABLES['stories']} SET group_id = '$group_id', perm_owner = '{$A['perm_owner']}', perm_group = '{$A['perm_group']}', perm_members = '{$A['perm_members']}', perm_anon = '{$A['perm_anon']}'");
COM_errorLog("Finished Upgrade Routine Successfully.");
$display .= "<p><strong>Finished Process</strong></p>";
CTL_clearCache();
$display .= '<p>The Geeklog Custom Development Database Update has completed.</p>
<p><em>Important:</em> Remember to delete the script file <code>' . $_SERVER["SCRIPT_NAME"] . '</code> once this process has run successfully.</p>
<p>Please visit the <a href="https://www.geeklog.net/forum/viewtopic.php?showtopic=97115" target="_blank">Geeklog Support Forums</a> if you have any questions or run into any problems.</p>';
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[40]));
COM_output($display);
Using your browser then visit the file to execute the code (you must be logged in as the Root user to run the code).
Once complete, delete the file (DO NOT FORGET THIS).
One of the Geeklog Core Developers.
Since Geeklog v2.0.0 the default article permissions and the Story Admin Group where not used for the default permissions when a submitted article was approved or brought up in the Article Editor. Instead the Topic Admin group and the default topic permissions for the article was used. This has now been fixed in Geeklog v2.2.1. but you must manually go through and check any previously submitted articles and update their permissions if needed.
To update all articles to the default permissions (while not updating the owner_id) create a text file with the following name "fix-article-issue-967.php" in the public_html directory of your geeklog website. Add the code below to the file and save it.
Text Formatted Code
<?php
require_once 'lib-common.php';
global $_CONF, $_GROUPS, $_TABLES, $MESSAGE, $_USER;
// For Root users only
if (!SEC_inGroup('Root')) {
$display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
COM_errorLog("Someone has tried to access a custom Geeklog Database Upgrade Routine {$_SERVER["SCRIPT_NAME"]} without proper permissions. User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'],1);
COM_output($display);
exit;
}
COM_errorLog("Someone has run a custom Geeklog Database Upgrade Routine {$_SERVER["SCRIPT_NAME"]} User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'],1);
$display = '<h1>Custom Development Database Update</h1>';
$display .= '<p>Fix for Article Permissions and Issue #<a href="https://github.com/Geeklog-Core/geeklog/issues/967" target="_blank">967</a></p>';
$display .= "<p><strong>Starting Process</strong></p>";
$display .= "<p><em>WORKING</em></p>";
if (isset($_GROUPS['Story Admin'])) {
$group_id = $_GROUPS['Story Admin'];
} else {
$group_id = SEC_getFeatureGroup('story.edit');
}
$A = array();
SEC_setDefaultPermissions($A, $_CONF['default_permissions_story']);
DB_query("UPDATE {$_TABLES['stories']} SET group_id = '$group_id', perm_owner = '{$A['perm_owner']}', perm_group = '{$A['perm_group']}', perm_members = '{$A['perm_members']}', perm_anon = '{$A['perm_anon']}'");
COM_errorLog("Finished Upgrade Routine Successfully.");
$display .= "<p><strong>Finished Process</strong></p>";
CTL_clearCache();
$display .= '<p>The Geeklog Custom Development Database Update has completed.</p>
<p><em>Important:</em> Remember to delete the script file <code>' . $_SERVER["SCRIPT_NAME"] . '</code> once this process has run successfully.</p>
<p>Please visit the <a href="https://www.geeklog.net/forum/viewtopic.php?showtopic=97115" target="_blank">Geeklog Support Forums</a> if you have any questions or run into any problems.</p>';
$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[40]));
COM_output($display);
Using your browser then visit the file to execute the code (you must be logged in as the Root user to run the code).
Once complete, delete the file (DO NOT FORGET THIS).
One of the Geeklog Core Developers.
21
15
Quote
All times are EST. The time is now 09:31 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content