FoolCode / FoOlSlide

[NO LONGER MAINTAINED] Online Comics Publishing Software for Authors and Teams
http://foolcode.github.com/FoOlSlide/
Other
115 stars 64 forks source link

Can't Install #63

Open kavin-90 opened 7 years ago

kavin-90 commented 7 years ago

I tried to install it i got DB error this and that field is default value none given.

After fix that i logged in got 404 error on admin page , DB BUGS. can't create series, can't edit series,can't create admin user(In Installation), Can't create session db entry, can't update preference DB Errors,

:cry: :cry: :cry: :cry:

oohnoitz commented 7 years ago

@kavin-90 Could you provide more details or logs? I'm unable to reproduce this issue on 5.6.x and 7.0.x.

kavin-90 commented 7 years ago

PHP 5.6.x Mysql 5.5.x Nginx Latest

Its Related to DB errors so you might faced it in installation.

Installation show error in can't session entry, after i fix that in Database Table which FoolSlide created it success install but admin user never created same with profile.

On Series Create i face Database Errors this and that column default value is not given.

First Error in Installation

A Database Error Occurred

Error Number: 1364

Field 'user_data' doesn't have a default value

INSERT INTO `fs_ci_sessions` (`session_id`, `ip_address`, `user_agent`, `last_activity`) VALUES ('1ddf129c416e68a4c3a2a48e3beb66ef', '127.0.0.1', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0', 1477660487)

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330

No User is created in Installation so on Register Page 2nd Error

A Database Error Occurred

Error Number: 1364

Field 'updated' doesn't have a default value

INSERT INTO `fs_users` (`username`, `password`, `email`, `last_ip`, `new_email_key`, `created`, `activated`) VALUES ('admin', '$P$B1wcbRnjHQyq5bG2d3ITIl6YJsWHEU.', 'admin@localhost.com', '127.0.0.1', '3cd10c1d5c19f5fbc4c0d258d0ae65b3', '2016-10-28 22:18:54', 0)

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330

**3rd Error Related to Thumbnail, Updated if you don't provide you will get Database Error in Series Create Errors

3rd Error is Important "Incorrect integer value: '' for column 'id'"**

A Database Error Occurred

Error Number: 1364

Field 'thumbnail' doesn't have a default value

INSERT INTO `fs_comics` (`id`, `name`, `stub`, `uniqid`, `hidden`, `author`, `artist`, `description`, `customchapter`, `format`, `adult`, `created`, `creator`, `editor`) VALUES ('', 'Test', 'test', '581351c98d8b7', 0, 'Oh', 'Oh', '', '', '0', 0, '2016-10-28 13:25:29 +0000', '1', '1')

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330

A Database Error Occurred

Error Number: 1364

Field 'updated' doesn't have a default value

INSERT INTO `fs_comics` (`id`, `name`, `stub`, `uniqid`, `hidden`, `author`, `artist`, `description`, `customchapter`, `format`, `adult`, `created`, `creator`, `editor`) VALUES ('', 'Test', 'test', '581351eddb71c', 0, 'Oh', 'Oh', '', '', '0', 0, '2016-10-28 13:26:05 +0000', '1', '1')

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330

A Database Error Occurred

Error Number: 1366

Incorrect integer value: '' for column 'id' at row 1

INSERT INTO `fs_comics` (`id`, `name`, `stub`, `uniqid`, `hidden`, `author`, `artist`, `description`, `customchapter`, `format`, `adult`, `created`, `creator`, `editor`) VALUES ('', 'Test', 'test', '5813525b8a74d', 0, 'Oh', 'Oh', '', '', '0', 0, '2016-10-28 13:27:55 +0000', '1', '1')

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330
oohnoitz commented 7 years ago

Looks like the only way to replicate your problem is to have the MySQL instance configured with sql_mode set to STRICT_TRANS_TABLES or STRICT_ALL_TABLES. If you remove that setting from your config, it should be fine.

kavin-90 commented 7 years ago

Thanks it works but i don't wanna remove STRICT_TRANS_TABLES

I got errors on Reader

Route : /admin/preferences/reader/

A Database Error Occurred

Error Number: 1048

Column 'value' cannot be null

INSERT INTO `fs_preferences` (`name`, `value`) VALUES ('fs_dl_volume_enabled', NULL)

Filename: G:\public_html\FoOlSlide\system\database\DB_driver.php

Line Number: 330
oohnoitz commented 7 years ago

Since you don't want to disable strict mode and we never really had the intention to support it from the start (as it wasn't shipped enabled by default until recently), the only option would be to review every query and update them to work with strict mode enabled.

With regards to the error you mentioned, take a look at the following _submit function. This is used to handle the POST requests for all of the forms on that controller. One of the "hackish" solutions would be to do the following:

1) Use an additional key/value pair to state the dataType of the input. Something like:

$form[] = array(
  _('Settings'),
  array(
    'type' => 'checkbox',
    'name' => 'fs_dl_options',
    'value' => array(
      array(
        'name' => 'fs_dl_enabled',
        'preferences' => 'fs_dl',
        'text' => _('Enable Direct Downloads')
        'dataType' => 'boolean'
      ),
      array(
        'name' => 'fs_dl_volume_enabled',
        'preferences' => 'fs_dl',
        'text' => _('Enable Volume Downloads'),
        'dataType' => 'boolean'
      )
    ),
    'help' => _('Note: Direct downloads usually increase bandwidth usage by one-third. The issue is whether you have enough space to keep both images and ZIP archives. FoOlSlide tries to avoid this problem by using on-the-fly ZIP compression and caching.')
  )
);

2) Add a new function to accept a value and dataType as arguments and return a casted value. This is just some example code, but should give you a general idea of what it should do.

function sanitize($value, $dataType) {
  switch ($dataType) {
    case 'boolean':
      return $value === null ? false : boolval($value);
    default:
      return $value;
  }
}

3) Update the following lines to handle the new dataType key pair in the associated array with the function you added: https://github.com/FoolCode/FoOlSlide/blob/03559f481c1487958a8455c1cf36d8cf3f7c062a/application/controllers/admin/preferences.php#L55-L58

$field = $item[1];
if (isset($post[$field['name']])) {
  $value = sanitize($field['name'], $field['dataType']);
} else {
  $value = sanitize(null, $field['dataType']);
}

Don't particularly like this solution, but it should work with some modifications.

kavin-90 commented 7 years ago

I study FoolSlide and found it follow Form data not own array of data which cause those error because php does not add empty field in $_POST so those empty field show error

I will update it :)