Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ writeable/templates_compile/*
# htaccess or generic index file.
app/cache/*
!app/cache/.htaccess
!app/cache/index.html
!app/cache/index.html
writeable/routes.php
45 changes: 23 additions & 22 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
Options +FollowSymlinks

<FilesMatch "\.(txml|thtml|htaccess|htpasswd|protected|txt)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<FilesMatch "\.(txml|thtml|htaccess|htpasswd|protected|txt)$">
Order Allow,Deny
Deny from all
</FilesMatch>

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 index.php
ErrorDocument 404 index.php
</IfModule>
3 changes: 2 additions & 1 deletion 1.htaccess
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options +FollowSymlinks

<FilesMatch "\.(txml|thtml|htaccess|htpasswd|protected|txt)$">
Order Allow,Deny
Deny from all
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Hero

Please ensure that your hosting environment meets the following specifications:

* PHP 5.1+
* One available MySQL 3.23+ database.
* PHP 5.6+ and PHP 7.0+
* One available MySQL database with mysqli or mysqlnd driver.
* Apache or Apache-like server that can parse .htaccess files with mod_rewrite rules.
* Ability to create one cronjob or scheduled process.

Expand Down
8 changes: 4 additions & 4 deletions app/config/database.format.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
$active_record = TRUE;

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = '';
$db['default']['username'] = "hero";
$db['default']['password'] = 'framework';
$db['default']['database'] = "hero";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbdriver'] = "mysqli";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
Expand All @@ -52,4 +52,4 @@


/* End of file database.php */
/* Location: ./app/config/database.php */
/* Location: ./app/config/database.php */
6 changes: 4 additions & 2 deletions app/controllers/admincp/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

class Dashboard extends Admincp_Controller {

function __construct() {
parent::__construct();

Expand Down Expand Up @@ -91,8 +92,9 @@ function index() {
// system stats
$system = array();

$system['PHP'] = phpversion();
$system['MySQL'] = mysql_get_server_info();
$system['PHP'] = explode('~',phpversion())[0];
$this->load->database();
$system['MySQL'] = $this->db->conn_id->server_info;
$system[$this->config->item('app_name')] = $this->config->item('app_version');
$system['CodeIgniter'] = CI_VERSION;
$system['Theme'] = setting('theme');
Expand Down
81 changes: 24 additions & 57 deletions app/controllers/install.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* Install Controller
Expand All @@ -11,7 +14,7 @@
*/
class Install extends CI_Controller {

function Install()
function __construct()
{
parent::__construct();

Expand All @@ -38,16 +41,10 @@ function index() {
// check for submission
if ($this->input->post('base_url') != '') {
// we have a submission

$this->load->model('install_model');

// validate MySQL info
$valid_mysql = FALSE;
if ($dbh = @mysql_connect($this->input->post('db_host'),$this->input->post('db_user'),$this->input->post('db_pass')))
{
if (@mysql_select_db($this->input->post('db_name'), $dbh))
{
$valid_mysql = TRUE;
}
}
$valid_mysql = $this->install_model->validate_creds();

if ($valid_mysql == FALSE) {
$error_mysql = TRUE;
Expand Down Expand Up @@ -93,39 +90,7 @@ function index() {

// import initial database structure
// note - all update files will be run before the next step loads (because auto_updater will be invoked)
$structure = read_file(APPPATH . 'updates/install.php');
$structure = str_replace('<?php if (!defined(\'BASEPATH\')) exit(\'No direct script access allowed\'); ?>','',$structure);

// break into newlines
$structure = explode("\n",$structure);

// run mysql queries
$query = "";
$querycount = 0;
foreach ($structure as $sql_line)
{
if (trim($sql_line) != "" and substr($sql_line,0,2) != "--")
{
$query .= $sql_line;
if (substr(trim($query), -1, 1) == ";")
{
// this query is finished, execute it
if (@mysql_query($query, $dbh))
{
$query = "";
$querycount++;
}
else {
show_error('There was a critical error importing the initial database structure. Please contact support.<br /><br />Query:<br /><br />' . $query);
die();
}
}
}
}

// update settings
mysql_query('UPDATE `settings` SET `setting_value`=\'' . $this->input->post('site_name') . '\' WHERE `setting_name`=\'site_name\' or `setting_name`=\'email_name\'');
mysql_query('UPDATE `settings` SET `setting_value`=\'' . $this->input->post('site_email') . '\' WHERE `setting_name`=\'site_email\'');
$this->install_model->run_setup_queries();

// send to administrator account setup
if (strstr($this->current_url(),'/index')) {
Expand All @@ -143,18 +108,18 @@ function index() {

// which folders/files should be writeable?
$file_permissions = array(
str_replace('system/','',BASEPATH) . 'writeable',
APPPATH . 'config',
APPPATH . 'config/config.php'
);
str_replace('system/','',BASEPATH) . 'writeable',
APPPATH . 'config',
APPPATH . 'config/config.php'
);

$file_permission_errors = array();
foreach ($file_permissions as $file) {
if (!is_writable($file)) {
$file_permission_errors[] = array(
'file' => $file,
'folder' => (is_dir($file)) ? TRUE : FALSE
);
'file' => $file,
'folder' => (is_dir($file)) ? TRUE : FALSE
);
}
}

Expand Down Expand Up @@ -214,6 +179,8 @@ function current_url() {
function admin () {
$this->load->library('session');
$this->load->helper('url');
$this->load->library('auto_updater');


if ($this->input->post('username')) {
if ($this->input->post('password') != $this->input->post('password2')) {
Expand Down Expand Up @@ -275,12 +242,12 @@ function complete () {
write_file(APPPATH . 'config/installed.php', '<?php /* App is installed */ ?>','w');

$vars = array(
'username' => $this->session->userdata('username'),
'email' => $this->session->userdata('email'),
'password' => $this->session->userdata('password'),
'cron_key' => $this->config->item('cron_key'),
'cp_link' => site_url('admincp')
);
'username' => $this->session->userdata('username'),
'email' => $this->session->userdata('email'),
'password' => $this->session->userdata('password'),
'cron_key' => $this->config->item('cron_key'),
'cp_link' => site_url('admincp')
);

$this->load->view(branded_view('install/complete.php'), $vars);
}
Expand Down
8 changes: 4 additions & 4 deletions app/core/MY_Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ function __construct () {
* Customized loader methods, which will use define_module
* to load the module definition file if necessary.
*/
function helper ($helper) {
function helper ($helper = array()) {
if (!is_array($helper)) {
self::define_module($helper);
}

return parent::helper($helper);
}

function library ($library, $params = NULL, $object_name = NULL) {
function library ($library = '', $params = NULL, $object_name = NULL) {
if (!is_array($library)) {
self::define_module($library);
}
Expand Down Expand Up @@ -54,7 +54,7 @@ function plugin ($plugin) {
* @param string $path The path to the file being loaded, e.g., "settings/settings_model.php"
*
*/
function define_module ($path) {
public function define_module ($path) {
if (strpos($path, '/') !== FALSE) {
// normally, we'd do this in the constructor, but that way left us with
// some issues in that module_model was NULL in certain instances
Expand Down Expand Up @@ -111,4 +111,4 @@ function define_module ($path) {
}
}
}
}
}
16 changes: 10 additions & 6 deletions app/helpers/admincp/get_notices_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ function get_notices () {
$CI =& get_instance();

$errors = $CI->notices->GetErrors();
$notices = $CI->notices->GetNotices();

$return = '';
while (list(,$error) = each($errors)) {
$return .= '<div class="error">' . $error . '</div>';
$eCount = count($errors);
for($i = 0; $i < $eCount; $i++){
$return .= '<div class="error">' . $errors[$i] . '</div>';
}
unset($eCount);
reset($errors);

while (list(,$notice) = each($notices)) {
$return .= '<div class="notice">' . $notice . '</div>';

$notices = $CI->notices->GetNotices();
$nCount = count($notices);
for($i = 0; $i < $nCount; $i++){
$return .= '<div class="notice">' . $notices[$i] . '</div>';
}
unset($nCount);
reset($notices);

return $return;
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/file_extension_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
* @author Electric Function, Inc.
*/
function file_extension ($file) {
return strtolower(end(explode(".", $file)));
$exFile = explode('.', $file);
return strtolower(end($exFile));
}
3 changes: 1 addition & 2 deletions app/helpers/get_available_image_library_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ function get_available_image_library () {

if (class_exists('Imagick')) {
return 'ImageMagick';
}
elseif (function_exists('imagecreatetruecolor')) {
} elseif (function_exists('imagecreatetruecolor')) {
$gd = gd_info();

// get the pure version number
Expand Down
7 changes: 5 additions & 2 deletions app/helpers/template_files_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@

function parse_template_files_array ($files, $return = array(), $prefix = '') {
foreach ($files as $key => $file) {
$extension = (!is_array($file) and strpos($file, '.') !== FALSE) ? end(explode('.', $file)) : '';

$extension = '';
if (!is_array($file) and strpos($file, '.') !== FALSE){
$exFile = explode('.', $file);
$extension = end($exFile);
}
if (is_array($file)) {
$return = array_merge($return,parse_template_files_array($file, $return, $prefix . $key . '/'));
}
Expand Down
2 changes: 1 addition & 1 deletion app/libraries/MY_Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function message ($message) {
parent::message($message);
}

function from ($from_email, $from_name) {
function from ($from_email, $from_name='') {
$this->_plaintext_from_name = $from_name;
$this->_plaintext_from_email = $from_email;

Expand Down
2 changes: 1 addition & 1 deletion app/libraries/admin_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ function custom_fields ($custom_fields = array(), $values = array(), $no_default

foreach ($custom_fields as $field) {
$CI->load->library('custom_fields/fieldtype');
$field_object =& $CI->fieldtype->load($field);
$field_object = $CI->fieldtype->load($field);

// set value
if (!empty($values) and isset($values[$field_object->name])) {
Expand Down
3 changes: 2 additions & 1 deletion app/libraries/auto_updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
*/

class Auto_updater {
function Auto_updater () {

function __construct(){
$CI =& get_instance();

$software_version = $CI->config->item('app_version');
Expand Down
3 changes: 2 additions & 1 deletion app/libraries/controllers/Admincp_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ function __construct () {
$this->module_definitions = new stdClass();

foreach ($modules as $module) {
MY_Loader::define_module($module . '/');
$myloader = new MY_Loader();
$myloader->define_module($module . '/');
}

// define WYSIWYG session variables for file uploading
Expand Down
Loading