From 25c2e09a8346c92a06b93ee1216a3708e524098e Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Mon, 16 Feb 2015 18:41:47 -0300 Subject: [PATCH 1/2] Add git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..2b8f490e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +application/config/database.php From bdce1b9fd8da06fa267ab1cd4e7836dcb8ff03fc Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Mon, 16 Feb 2015 18:42:42 -0300 Subject: [PATCH 2/2] Fix category diplay in admin --- application/views/admin/dashboard/ideas.php | 2 +- application/views/admin/header.php | 3 - install/database_tables.sql | 88 ------------- install/index.php | 132 -------------------- install/index2.php | 75 ----------- install/install1.php | 120 ------------------ install/install2.php | 33 ----- 7 files changed, 1 insertion(+), 452 deletions(-) delete mode 100755 install/database_tables.sql delete mode 100755 install/index.php delete mode 100755 install/index2.php delete mode 100755 install/install1.php delete mode 100755 install/install2.php diff --git a/application/views/admin/dashboard/ideas.php b/application/views/admin/dashboard/ideas.php index 6c61549a..3fc38561 100755 --- a/application/views/admin/dashboard/ideas.php +++ b/application/views/admin/dashboard/ideas.php @@ -191,7 +191,7 @@ " target="_blank">title; ?> - categoryid - 1]->name; ?> + categoryid]->name; ?> votes; ?> Votes diff --git a/application/views/admin/header.php b/application/views/admin/header.php index e059a930..970f0eee 100755 --- a/application/views/admin/header.php +++ b/application/views/admin/header.php @@ -8,9 +8,6 @@ Admin Panel - PHPBack - - - diff --git a/install/database_tables.sql b/install/database_tables.sql deleted file mode 100755 index bbf50021..00000000 --- a/install/database_tables.sql +++ /dev/null @@ -1,88 +0,0 @@ -CREATE TABLE IF NOT EXISTS `categories` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext COLLATE utf8_unicode_ci NOT NULL, - `description` text COLLATE utf8_unicode_ci NOT NULL, - `ideas` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `comments` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `content` text COLLATE utf8_unicode_ci NOT NULL, - `ideaid` int(11) NOT NULL, - `userid` int(11) NOT NULL, - `date` tinytext COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `flags` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `toflagid` int(11) NOT NULL, - `userid` int(11) NOT NULL, - `date` tinytext COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `ideas` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` tinytext COLLATE utf8_unicode_ci NOT NULL, - `content` text COLLATE utf8_unicode_ci NOT NULL, - `authorid` int(11) NOT NULL, - `date` tinytext COLLATE utf8_unicode_ci NOT NULL, - `votes` int(11) NOT NULL, - `comments` int(11) NOT NULL, - `status` tinytext COLLATE utf8_unicode_ci NOT NULL, - `categoryid` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `logs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `content` tinytext COLLATE utf8_unicode_ci NOT NULL, - `date` tinytext COLLATE utf8_unicode_ci NOT NULL, - `type` tinytext COLLATE utf8_unicode_ci NOT NULL, - `toid` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `settings` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext COLLATE utf8_unicode_ci NOT NULL, - `value` tinytext COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` tinytext COLLATE utf8_unicode_ci NOT NULL, - `email` tinytext COLLATE utf8_unicode_ci NOT NULL, - `pass` tinytext COLLATE utf8_unicode_ci NOT NULL, - `votes` int(11) NOT NULL, - `isadmin` tinyint(1) NOT NULL, - `banned` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `votes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ideaid` int(11) NOT NULL, - `userid` int(11) NOT NULL, - `number` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -CREATE TABLE IF NOT EXISTS `_sessions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userid` int(11) NOT NULL, - `token` tinytext COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/install/index.php b/install/index.php deleted file mode 100755 index 846bae96..00000000 --- a/install/index.php +++ /dev/null @@ -1,132 +0,0 @@ - - - - PHPBack Installation - - - - - - - - - - - - - - - - - - - - diff --git a/install/index2.php b/install/index2.php deleted file mode 100755 index 04a8560d..00000000 --- a/install/index2.php +++ /dev/null @@ -1,75 +0,0 @@ - - - - PHPBack Installation - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/install/install1.php b/install/install1.php deleted file mode 100755 index 39df3a04..00000000 --- a/install/install1.php +++ /dev/null @@ -1,120 +0,0 @@ - -Copyright (c) 2014 PHPBack -http://www.phpback.org -Released under the GNU General Public License WITHOUT ANY WARRANTY. -See LICENSE.TXT for details. -**********************************************************************/ - -error_reporting(E_ALL); -ini_set('display_errors', 1); - -function redirectpost($url, array $data){ - - echo ' - - - Please Wait... - - - Please Wait...
-
'; - if ( !is_null($data) ) { - foreach ($data as $k => $v) { - echo ' '; - } - } - echo "
"; - ""; - ""; - exit; -} - -function exit_error($string){ - $data['error'] = $string; - redirectpost('index.php', $data); -} - -function create_file($hostname, $username, $password, $database){ - chmod('../application/config', 0777); - if(($file = fopen('../application/config/database.php', 'w')) == FALSE){ - $data['error'] == "Could not create the config file"; - $data['configfile'] == 1; - redirectpost('index.php', $data); - } - $content = 'connect_error) exit_error('Connection Error (' . $server->connect_errno . ') ' . $server->connect_error); - -if($_POST['database'] != ""){ - if(!file_exists('../application/config/database.php')) - create_file($_POST['hostname'], $_POST['username'], $_POST['password'], $_POST['database']); - include '../application/config/database.php'; - if(!($_POST['hostname'] == $db['default']['hostname'] && $_POST['username'] == $db['default']['username'] - && $_POST['password'] == $db['default']['password'] && $_POST['database'] == $db['default']['database'])) exit_error('Config file does not match with the given information'); - if ($server->select_db($_POST['database']) === FALSE) exit_error("Couldn't connect to database"); - $query = file_get_contents('database_tables.sql'); - if($server->multi_query($query) === FALSE) exit_error("Couldn't create the tables"); -}else{ - if(!file_exists('../application/config/database.php')) - create_file($_POST['hostname'], $_POST['username'], $_POST['password'], 'phpback'); - if(!$server->query("CREATE DATABASE IF NOT EXISTS phpback")){ - exit_error("Could not create database"); - } - if ($server->select_db('phpback') === FALSE) exit_error("Couldn't connect to database"); - $sql = file_get_contents('database_tables.sql'); - if($server->multi_query($sql) === FALSE) exit_error("Couldn't create the tables"); -} -do{ - if($r = $server->store_result()) $r->free(); -}while($server->next_result()); - -unlink('index.php'); -unlink('install1.php'); -unlink('database_tables.sql'); -$result = $server->query("SELECT id FROM settings WHERE name='title'"); -if($result->num_rows == 1){ - unlink('index2.php'); - unlink('install2.php'); - header('Location: ../admin'); - exit; -} -$server->query("INSERT INTO users(id,name,email,pass,votes,isadmin,banned) VALUES('','". $_POST['adminname'] ."','". $_POST['adminemail'] ."','". crypt($_POST['adminpass']) ."', 20, 3,0)"); -header('Location: index2.php'); -exit; diff --git a/install/install2.php b/install/install2.php deleted file mode 100755 index 56efcea6..00000000 --- a/install/install2.php +++ /dev/null @@ -1,33 +0,0 @@ - -Copyright (c) 2014 PHPBack -http://www.phpback.org -Released under the GNU General Public License WITHOUT ANY WARRANTY. -See LICENSE.TXT for details. -**********************************************************************/ - -include "../application/config/database.php"; - -$mysql = new mysqli($db['default']['hostname'], $db['default']['username'], $db['default']['password'], $db['default']['database']); - -if ($server->connect_error) echo('Connection Error (' . $server->connect_errno . ') ' . $server->connect_error . '
'); - -$mysql->multi_query("INSERT INTO `settings` (`id`, `name`, `value`) VALUES -('', 'recaptchapublic', '". $_POST['rpublic'] ."'), -('', 'recaptchaprivate', '". $_POST['rprivate'] ."'), -('', 'maxvotes', '20'), -('', 'mainmail', '". $_POST['mainmail'] ."'), -('', 'title', '". $_POST['title'] ."'), -('', 'max_results', '10'), -('', 'smtp-host', '". $_POST['smtp-host'] ."'), -('', 'smtp-port', '". $_POST['smtp-port'] ."'), -('', 'smtp-user', '". $_POST['smtp-user'] ."'), -('', 'smtp-pass', '". $_POST['smtp-password'] ."');"); - -unlink('index2.php'); -unlink('install2.php'); - -header('Location: ../admin'); -exit; \ No newline at end of file