Revision 1891
Added by Luisehahne over 12 years ago
| branches/2.8.x/CHANGELOG | ||
|---|---|---|
| 13 | 13 |
|
| 14 | 14 |
|
| 15 | 15 |
|
| 16 |
19 Mar-2013 Build 1891 Dietmar Woellbrink (Luisehahne) |
|
| 17 |
! update captcha_control module set version to 1.2.1 |
|
| 16 | 18 |
19 Mar-2013 Build 1890 Dietmar Woellbrink (Luisehahne) |
| 17 | 19 |
# bugfix and update form module set version to 2.9.1 |
| 18 | 20 |
! update code module set version to 2.8.4 |
| branches/2.8.x/wb/upgrade-script.php | ||
|---|---|---|
| 763 | 763 |
if($oUser = $database->query($sql)){
|
| 764 | 764 |
$iTotalUsers = $oUser->numRows(); |
| 765 | 765 |
while($Users = $oUser->fetchRow(MYSQL_ASSOC)) {
|
| 766 |
|
|
| 767 | 766 |
$aUsers[$Users['user_id']]['groups_id'] = $Users['groups_id']; |
| 768 | 767 |
$aUsers[$Users['user_id']]['display_name'] = $Users['display_name']; |
| 769 | 768 |
} |
| 770 | 769 |
} else {
|
| 771 | 770 |
$aDebugMessage[] = $database->is_error()==false ? " $OK<br />" : " $FAIL!<br />"; |
| 772 | 771 |
} |
| 773 |
|
|
| 774 | 772 |
foreach($aUsers AS $user_id => $value){
|
| 775 | 773 |
// choose group_id from groups_id - workaround for still remaining calls to group_id (to be cleaned-up) |
| 776 | 774 |
$aGroups_id = explode(',', $aUsers[$user_id]['groups_id']);
|
| ... | ... | |
| 778 | 776 |
$group_id = 0; |
| 779 | 777 |
//if user is in administrator-group, get this group else just get the first one |
| 780 | 778 |
if($admin->is_group_match($aGroups_id,'1')) { $group_id = 1; $groups_id = '1'; } else { $group_id = intval($aGroups_id[0]); }
|
| 781 |
|
|
| 782 | 779 |
$sMessage = "<span>Updating group_id ".$TEXT['DISPLAY_NAME']." " .$aUsers[$user_id]['display_name']."</span>"; |
| 783 | 780 |
$sql = 'UPDATE `'.TABLE_PREFIX.'users` '; |
| 784 | 781 |
$sql .= 'SET `group_id` = '.$group_id.', '; |
| 785 | 782 |
$sql .= '`groups_id` = \''.$groups_id.'\' '; |
| 786 | 783 |
$sql .= 'WHERE `user_id` = '.intval($user_id); |
| 787 |
|
|
| 788 | 784 |
if($oRes = $database->query($sql)){ }
|
| 789 | 785 |
$aDebugMessage[] = $database->is_error()==false ? $sMessage." $OK<br />" : $sMessage." $FAIL!<br />"; |
| 790 | 786 |
} |
| ... | ... | |
| 969 | 965 |
* upgrade modules if newer version is available |
| 970 | 966 |
* $aModuleList list of proofed modules |
| 971 | 967 |
*/ |
| 972 |
// $aModuleList = array('wysiwyg','news','form','captcha_control','output_filter');
|
|
| 973 |
$aModuleList = array('wysiwyg','form','code');
|
|
| 968 |
$aModuleList = array('wysiwyg','form','code','captcha_control');
|
|
| 974 | 969 |
if(sizeof($aModuleList)) |
| 975 | 970 |
{
|
| 976 | 971 |
echo '<h3>Step '.(++$stepID).': Upgrade proofed modules</h3>'; |
| branches/2.8.x/wb/admin/interface/version.php | ||
|---|---|---|
| 51 | 51 |
|
| 52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
| 53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3');
|
| 54 |
if(!defined('REVISION')) define('REVISION', '1890');
|
|
| 54 |
if(!defined('REVISION')) define('REVISION', '1891');
|
|
| 55 | 55 |
if(!defined('SP')) define('SP', '');
|
| branches/2.8.x/wb/modules/captcha_control/sql/mod_captcha_control.sql | ||
|---|---|---|
| 1 |
-- phpMyAdmin SQL Dump |
|
| 2 |
-- Erstellungszeit: 15. Mrz 2013 um 18:21 |
|
| 3 |
-- Server-Version: 5.5.27 |
|
| 4 |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
|
| 5 |
SET time_zone = "+00:00"; |
|
| 6 |
-- -------------------------------------------------------- |
|
| 7 |
-- Database structure for WebsiteBaker core |
|
| 8 |
-- |
|
| 9 |
-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
|
|
| 10 |
-- |
|
| 11 |
-- -------------------------------------------------------- |
|
| 12 |
-- |
|
| 13 |
-- Tabellenstruktur für Tabelle `mod_captcha_control` |
|
| 14 |
-- |
|
| 15 |
DROP TABLE IF EXISTS `{TABLE_PREFIX}mod_captcha_control`;
|
|
| 16 |
CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}mod_captcha_control` (
|
|
| 17 |
`enabled_captcha` int(11) NOT NULL DEFAULT '1', |
|
| 18 |
`enabled_asp` int(11) NOT NULL DEFAULT '1', |
|
| 19 |
`captcha_type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT 'calc_text',
|
|
| 20 |
`asp_session_min_age` int(11) NOT NULL DEFAULT '20', |
|
| 21 |
`asp_view_min_age` int(11) NOT NULL DEFAULT '10', |
|
| 22 |
`asp_input_min_age` int(11) NOT NULL DEFAULT '5', |
|
| 23 |
`ct_text` longtext{TABLE_COLLATION} NOT NULL
|
|
| 24 |
) {TABLE_ENGINE};
|
|
| 25 |
-- EndOfFile |
|
| branches/2.8.x/wb/modules/captcha_control/sql/data_captcha_control.sql | ||
|---|---|---|
| 1 |
-- phpMyAdmin SQL Dump |
|
| 2 |
-- Erstellungszeit: 18. Mrz 2013 um 04:21 |
|
| 3 |
-- Server-Version: 5.5.27 |
|
| 4 |
-- |
|
| 5 |
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; |
|
| 6 |
SET time_zone = "+00:00"; |
|
| 7 |
-- -------------------------------------------------------- |
|
| 8 |
-- Database structure for WebsiteBaker core |
|
| 9 |
-- |
|
| 10 |
-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
|
|
| 11 |
-- |
|
| 12 |
-- -------------------------------------------------------- |
|
| 13 |
-- |
|
| 14 |
-- Daten für Tabelle `mod_captcha_control` |
|
| 15 |
-- |
|
| 16 |
|
|
| 17 |
INSERT INTO `{TABLE_PREFIX}mod_captcha_control` VALUES(1, '1', 'calc_ttf_image', 20, 10, 5, '');
|
|
| 18 |
-- EndOfFile |
|
| branches/2.8.x/wb/modules/captcha_control/info.php | ||
|---|---|---|
| 24 | 24 |
} |
| 25 | 25 |
/* -------------------------------------------------------- */ |
| 26 | 26 |
$module_directory = 'captcha_control'; |
| 27 |
$module_name = 'Spam-Protection Control';
|
|
| 27 |
$module_name = 'CAPTCHA SPAM-Protection Control';
|
|
| 28 | 28 |
$module_function = 'tool'; |
| 29 |
$module_version = '1.2.0';
|
|
| 30 |
$module_platform = '2.7 | 2.8.x';
|
|
| 29 |
$module_version = '1.2.1';
|
|
| 30 |
$module_platform = '2.8.4';
|
|
| 31 | 31 |
$module_author = 'Thomas Hornik (thorn)'; |
| 32 | 32 |
$module_license = 'GNU General Public License'; |
| 33 | 33 |
$module_description = 'Admin-Tool to control CAPTCHA and ASP'; |
| branches/2.8.x/wb/modules/captcha_control/tool.php | ||
|---|---|---|
| 4 | 4 |
* @category modules |
| 5 | 5 |
* @package captcha_control |
| 6 | 6 |
* @author WebsiteBaker Project |
| 7 |
* @copyright 2009-2011, Website Baker Org. e.V.
|
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
|
| 8 | 8 |
* @link http://www.websitebaker2.org/ |
| 9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 10 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
|
| 62 |
// update database settings |
|
| 63 |
|
|
| 64 |
$sql = 'UPDATE '.$table.' '; |
|
| 62 |
// update/insert database settings |
|
| 63 |
$sql = 'UPDATE `'.$table.'` '; |
|
| 65 | 64 |
$sql .= 'SET `enabled_captcha` = \''.$enabled_captcha.'\', '; |
| 66 | 65 |
$sql .= '`enabled_asp` = \''.$enabled_asp.'\', '; |
| 67 | 66 |
$sql .= '`captcha_type` = \''.$captcha_type.'\', '; |
| ... | ... | |
| 71 | 70 |
$sql .= '`ct_text` =\''.$ct_text.'\' '; |
| 72 | 71 |
|
| 73 | 72 |
if(!$database->query($sql)) {
|
| 74 |
// print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />'; |
|
| 75 |
// print_r( explode(',',$sql) ); print '</pre>'; // flush ();sleep(10); die();
|
|
| 76 | 73 |
} |
| 77 | 74 |
|
| 78 | 75 |
// check if there is a database error, otherwise say successful |
| branches/2.8.x/wb/modules/captcha_control/install.php | ||
|---|---|---|
| 7 | 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
| 8 | 8 |
* @link http://www.websitebaker2.org/ |
| 9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 10 |
* @platform WebsiteBaker 2.8.x
|
|
| 10 |
* @platform WebsiteBaker 2.8.3
|
|
| 11 | 11 |
* @requirements PHP 5.2.2 and higher |
| 12 | 12 |
* @version $Id$ |
| 13 | 13 |
* @filesource $HeadURL$ |
| 14 | 14 |
* @lastmodified $Date$ |
| 15 | 15 |
* |
| 16 | 16 |
*/ |
| 17 |
|
|
| 18 |
// prevent this file from being accessed directly |
|
| 19 | 17 |
/* -------------------------------------------------------- */ |
| 20 |
if(defined('WB_PATH') == false)
|
|
| 21 |
{
|
|
| 22 |
// Stop this file being access directly |
|
| 23 |
die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
|
|
| 18 |
// Must include code to stop this file being accessed directly |
|
| 19 |
if(!defined('WB_PATH')) {
|
|
| 20 |
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php'); |
|
| 21 |
throw new IllegalFileException(); |
|
| 22 |
} else {
|
|
| 23 |
$sError = array(); |
|
| 24 |
// Create table |
|
| 25 |
if(!$database->SqlImport(dirname(__FILE__).'/sql/mod_captcha_control.sql','',false)){
|
|
| 26 |
$sError[] = $database->get_error(); |
|
| 27 |
} |
|
| 28 |
// Insert data |
|
| 29 |
if(!$database->SqlImport(dirname(__FILE__).'/sql/data_captcha_control.sql','',false)){
|
|
| 30 |
$sError[] = $database->get_error(); |
|
| 31 |
} |
|
| 24 | 32 |
} |
| 25 |
/* -------------------------------------------------------- */ |
|
| 26 |
|
|
| 27 |
$table = TABLE_PREFIX.'mod_captcha_control'; |
|
| 28 |
$database->query("DROP TABLE IF EXISTS `$table`");
|
|
| 29 |
|
|
| 30 |
$database->query("CREATE TABLE IF NOT EXISTS `$table` (
|
|
| 31 |
`enabled_captcha` VARCHAR(1) NOT NULL DEFAULT '1', |
|
| 32 |
`enabled_asp` VARCHAR(1) NOT NULL DEFAULT '0', |
|
| 33 |
`captcha_type` VARCHAR(255) NOT NULL DEFAULT 'calc_text', |
|
| 34 |
`asp_session_min_age` INT(11) NOT NULL DEFAULT '20', |
|
| 35 |
`asp_view_min_age` INT(11) NOT NULL DEFAULT '10', |
|
| 36 |
`asp_input_min_age` INT(11) NOT NULL DEFAULT '5', |
|
| 37 |
`ct_text` LONGTEXT NOT NULL |
|
| 38 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" |
|
| 39 |
); |
|
| 40 |
|
|
| 41 |
// add new row using the table default values defined above |
|
| 42 |
$database->query("
|
|
| 43 |
INSERT INTO `$table` |
|
| 44 |
(`enabled_captcha`, `enabled_asp`, `captcha_type`) |
|
| 45 |
VALUES |
|
| 46 |
('1', '1', 'calc_text')
|
|
| 47 |
"); |
|
| branches/2.8.x/wb/modules/captcha_control/upgrade.php | ||
|---|---|---|
| 14 | 14 |
* @lastmodified $Date$ |
| 15 | 15 |
* |
| 16 | 16 |
*/ |
| 17 |
|
|
| 18 |
// prevent this file from being accessed directly |
|
| 17 |
// Must include code to stop this file being access directly |
|
| 19 | 18 |
/* -------------------------------------------------------- */ |
| 20 |
if(defined('WB_PATH') == false)
|
|
| 21 |
{
|
|
| 22 |
// Stop this file being access directly
|
|
| 23 |
die('<head><title>Access denied</title></head><body><h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2></body></html>');
|
|
| 19 |
// Must include code to stop this file being accessed directly
|
|
| 20 |
if(!defined('WB_URL')) {
|
|
| 21 |
require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
|
|
| 22 |
throw new IllegalFileException();
|
|
| 24 | 23 |
} |
| 25 | 24 |
/* -------------------------------------------------------- */ |
| 26 |
$msg = ''; |
|
| 27 |
$sTable = TABLE_PREFIX.'mod_captcha_control'; |
|
| 28 |
if(($sOldType = $database->getTableEngine($sTable))) {
|
|
| 29 |
if(('myisam' != strtolower($sOldType))) {
|
|
| 30 |
if(!$database->query('ALTER TABLE `'.$sTable.'` Engine = \'MyISAM\' ')) {
|
|
| 31 |
$msg = $database->get_error(); |
|
| 25 |
|
|
| 26 |
function mod_captcha_control_upgrade($bDebug=false) {
|
|
| 27 |
global $OK ,$FAIL; |
|
| 28 |
$database=WbDatabase::getInstance(); |
|
| 29 |
$msg = array(); |
|
| 30 |
$callingScript = $_SERVER["SCRIPT_NAME"]; |
|
| 31 |
// check if upgrade startet by upgrade-script to echo a message |
|
| 32 |
$tmp = 'upgrade-script.php'; |
|
| 33 |
$globalStarted = substr_compare($callingScript, $tmp,(0-strlen($tmp)),strlen($tmp)) === 0; |
|
| 34 |
// check for missing tables, if true stop the upgrade |
|
| 35 |
$aTable = array('mod_captcha_control');
|
|
| 36 |
$aPackage = UpgradeHelper::existsAllTables($aTable); |
|
| 37 |
if( sizeof($aPackage) > 0){
|
|
| 38 |
$msg[] = 'TABLE '.implode(' missing! '.$FAIL.'<br />TABLE ',$aPackage).' missing! '.$FAIL;
|
|
| 39 |
$msg[] = 'Captcha control upgrade failed'." $FAIL"; |
|
| 40 |
if($globalStarted) {
|
|
| 41 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />';
|
|
| 42 |
} |
|
| 43 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
|
| 44 |
} else {
|
|
| 45 |
for($x=0; $x<sizeof($aTable);$x++) {
|
|
| 46 |
if(($sOldType = $database->getTableEngine($database->TablePrefix.$aTable[$x]))) {
|
|
| 47 |
if(('myisam' != strtolower($sOldType))) {
|
|
| 48 |
if(!$database->query('ALTER TABLE `'.$database->TablePrefix.$aTable[$x].'` Engine = \'MyISAM\' ')) {
|
|
| 49 |
$msg[] = $database->get_error(); |
|
| 50 |
} else{
|
|
| 51 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` changed to Engine = \'MyISAM\''." $OK"; |
|
| 52 |
} |
|
| 53 |
} else {
|
|
| 54 |
$msg[] = 'TABLE `'.$database->TablePrefix.$aTable[$x].'` has Engine = \'MyISAM\''." $OK"; |
|
| 55 |
} |
|
| 56 |
} else {
|
|
| 57 |
$msg[] = $database->get_error(); |
|
| 58 |
} |
|
| 59 |
} |
|
| 60 |
// change table structure |
|
| 61 |
$sTable = $database->TablePrefix.'mod_captcha_control'; |
|
| 62 |
$sDescription = 'int(11) NOT NULL DEFAULT \'1\''; |
|
| 63 |
$sFieldName = 'enabled_captcha'; |
|
| 64 |
if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 65 |
$msg[] = ''.$database->get_error(); |
|
| 66 |
} else {
|
|
| 67 |
$msg[] = 'Field ( `enabled_captcha` ) description has been changed successfully'." $OK"; |
|
| 68 |
} |
|
| 69 |
$sFieldName = 'enabled_asp'; |
|
| 70 |
if(!$database->field_modify($sTable,$sFieldName,$sDescription)) {
|
|
| 71 |
$msg[] = ''.$database->get_error(); |
|
| 72 |
} else {
|
|
| 73 |
$msg[] = 'Field ( `enabled_asp` ) description has been changed successfully'." $OK"; |
|
| 74 |
} |
|
| 75 |
// only for upgrade-script |
|
| 76 |
if($globalStarted) {
|
|
| 77 |
if($bDebug) {
|
|
| 78 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />';
|
|
| 79 |
} |
|
| 80 |
} |
|
| 32 | 81 |
} |
| 82 |
$msg[] = 'Captcha control upgrade successfull finished '." $OK"; |
|
| 83 |
if($globalStarted) {
|
|
| 84 |
echo "<strong>Captcha control upgrade successfull finished $OK</strong><br />"; |
|
| 85 |
} |
|
| 86 |
return ( ($globalStarted==true ) ? $globalStarted : $msg); |
|
| 33 | 87 |
} |
| 34 |
} else {
|
|
| 35 |
$msg = $database->get_error(); |
|
| 88 |
// ------------------------------------ |
|
| 89 |
|
|
| 90 |
$bDebugModus = ((isset($bDebugModus)) ? $bDebugModus : false); |
|
| 91 |
// Don't show the messages twice |
|
| 92 |
if( is_array($msg = mod_captcha_control_upgrade($bDebugModus)) ) {
|
|
| 93 |
echo '<strong>'.implode('<br />',$msg).'</strong><br />';
|
|
| 36 | 94 |
} |
| 37 |
// ------------------------------------ |
|
Also available in: Unified diff
! update captcha_control module set version to 1.2.1