Skip to content

Commit

Permalink
Fix news Edit \ Delete buttons
Browse files Browse the repository at this point in the history
Fix Email save while register process
Fix syntax errors in manual install sql file
Fix installation script
  • Loading branch information
NC22 committed Feb 13, 2014
1 parent 5fc5ae9 commit ecb1b10
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
11 changes: 6 additions & 5 deletions upload/install/CMS/sql/sql_common.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
`user_id` bigint(20) NOT NULL,
`dislikes` int(10) DEFAULT 0,
`likes` int(10) DEFAULT 0,
`hide_vote` tinyint(1) NOT NULL DEFAULT 0,
`vote` tinyint(1) NOT NULL DEFAULT 0,
`comments` int(10) NOT NULL DEFAULT 0,
`discus` tinyint(1) NOT NULL DEFAULT 1,
`hits` int(10) DEFAULT 0,
`title` char(255) NOT NULL,
`message` TEXT NOT NULL,
Expand Down Expand Up @@ -207,17 +209,16 @@
getDB()->ask("ALTER TABLE `{$bd_names['news']}` ADD `hits` int(10) DEFAULT 0;");
}

if (!getDB()->isColumnExist($bd_names['news'], 'hide_vote'))
getDB()->ask("ALTER TABLE `{$bd_names['news']}` ADD `hide_vote` tinyint(1) NOT NULL DEFAULT 0;");

/* 2.31 UPDATE */
if (!getDB()->isColumnExist($bd_names['comments'], 'item_type')) {

getDB()->ask("ALTER TABLE `{$bd_names['comments']}` ADD `item_type` smallint(3) DEFAULT " . ItemType::News . ";");
getDB()->ask("ALTER TABLE `{$bd_names['comments']}` DROP KEY `item_id`");
getDB()->ask("ALTER TABLE `{$bd_names['comments']}` ADD KEY `uniq_item` (`item_id`, `item_type`);");


if (getDB()->isColumnExist($bd_names['news'], 'hide_vote')) // change deprecated field name
getDB()->ask("ALTER TABLE `{$bd_names['news']}` CHANGE COLUMN `hide_vote` `vote` tinyint(1) NOT NULL DEFAULT 1;");

getDB()->ask("ALTER TABLE `{$bd_names['news']}` ADD `discus` tinyint(1) NOT NULL DEFAULT 1;");
getDB()->ask("ALTER TABLE `{$bd_names['news']}` ADD `comments` int(10) NOT NULL DEFAULT 0;");
}
Expand Down
5 changes: 3 additions & 2 deletions upload/install/ManualInstall/db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS `news` (
`likes` int(10) DEFAULT 0,
`title` char(255) NOT NULL,
`vote` tinyint(1) NOT NULL DEFAULT 0,
`hits` int(10) DEFAULT 0,
`discus` tinyint(1) NOT NULL DEFAULT 1,
`comments` int(10) NOT NULL DEFAULT 0,
`message` text NOT NULL,
Expand Down Expand Up @@ -136,7 +137,7 @@ CREATE TABLE IF NOT EXISTS `accounts` (

-- Игровая сессия --

`clientToken` varchar(255) default NULL
`clientToken` varchar(255) default NULL,
`session` varchar(255) default NULL,
`server` varchar(255) default NULL,

Expand Down Expand Up @@ -185,7 +186,7 @@ INSERT INTO `data` (`property`, `value`) VALUES
('rcon-pass', '0'),
('rcon-serv', '0');

INSERT INTO `property` (`property`, `value`) VALUES
INSERT INTO `data` (`property`, `value`) VALUES
('smtp-user', ''),
('smtp-pass', ''),
('smtp-host', 'localhost'),
Expand Down
4 changes: 2 additions & 2 deletions upload/instruments/catalog.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,13 @@ public function ShowNewsEditor()

include $this->GetView('news_admin_mess.html');
$error = ob_get_clean();
} elseif (Filter::input('delete', 'get', 'bool')) {
} elseif (Filter::input('delete', 'get', 'int')) {

$news_item = new News_Item(Filter::input('delete', 'get', 'int'));
$news_item->Delete();

header("Location: " . $this->work_link . "ok");
} elseif (Filter::input('edit', 'get', 'bool')) {
} elseif (Filter::input('edit', 'get', 'int')) {

$editorTitle = 'Обновить новость';
$editorButton = 'Изменить';
Expand Down
13 changes: 6 additions & 7 deletions upload/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function tryExit()

tryExit();

$verification = ((int) sqlConfigGet('email-verification')) ? true : false;
$verification = (bool) sqlConfigGet('email-verification');

if ($verification)
$group = 4;
Expand Down Expand Up @@ -176,12 +176,11 @@ function tryExit()
getDB()->ask("INSERT INTO `{$bd_names['ip_banning']}` (`IP`,`time_start`,`ban_until`) "
. "VALUES (:ip, NOW(), NOW()+INTERVAL $next_reg HOUR)", array('ip' => $_SERVER['REMOTE_ADDR']));


if ($tmp_user->changeEmail($input['email'], $verification) > 1)
aExit(14, lng('MAIL_FAIL'));

if (!$verification)
aExit(0, lng('REG_COMPLETE') . '. <a href="#" class="btn" onclick="Login();">' . lng('ENTER') . '</a>');
else {

if ($tmp_user->changeEmail($input['email'], true) > 1)
aExit(14, lng('MAIL_FAIL'));

else
aExit(0, lng('REG_COMPLETE') . '. ' . lng('REG_CONFIRM_INFO'));
}

0 comments on commit ecb1b10

Please sign in to comment.