From 7d6110b117e3afc6f359471b158eb2f0c55e42d3 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 28 Dec 2015 13:48:40 +0000 Subject: [PATCH] added new stdClass() in various places --- codepot/src/codepot/controllers/issue.php | 6 +++++- codepot/src/codepot/controllers/project.php | 3 +++ codepot/src/codepot/controllers/user.php | 8 ++++++-- codepot/src/codepot/models/loginmodel.php | 3 ++- codepot/src/codepot/views/user_home.php | 9 +++++---- codepot/src/codepot/views/user_settings.php | 1 + 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/codepot/src/codepot/controllers/issue.php b/codepot/src/codepot/controllers/issue.php index 105549d1..79182cb6 100644 --- a/codepot/src/codepot/controllers/issue.php +++ b/codepot/src/codepot/controllers/issue.php @@ -56,6 +56,7 @@ class Issue extends Controller if ($filter == '') { + $search = new stdClass(); $search->type = ''; $search->status = ''; $search->priority = ''; @@ -78,7 +79,6 @@ class Issue extends Controller $this->load->library ('pagination'); - if ($filter == '' && $offset == '') { $offset = 0; @@ -181,6 +181,7 @@ class Issue extends Controller $change_post = $this->input->post('issue_change'); if ($change_post == 'change') { + $change = new stdClass(); $change->type = $this->input->post('issue_change_type'); $change->status = $this->input->post('issue_change_status'); $change->owner = $this->input->post('issue_change_owner'); @@ -317,6 +318,7 @@ class Issue extends Controller if ($this->input->post('issue')) { + $issue = new stdClass(); $issue->projectid = $this->input->post('issue_projectid'); $issue->id = $this->input->post('issue_id'); $issue->summary = $this->input->post('issue_summary'); @@ -374,6 +376,7 @@ class Issue extends Controller } else { + $issue = new stdClass(); $issue->projectid = $projectid; $issue->id = $id; $issue->summary = ''; @@ -456,6 +459,7 @@ class Issue extends Controller if($this->input->post('issue')) { + $issue = new stdClass(); $issue->projectid = $this->input->post('issue_projectid'); $issue->id = $this->input->post('issue_id'); $data['issue_confirm'] = $this->input->post('issue_confirm'); diff --git a/codepot/src/codepot/controllers/project.php b/codepot/src/codepot/controllers/project.php index c3a0e73b..fdbff3ba 100644 --- a/codepot/src/codepot/controllers/project.php +++ b/codepot/src/codepot/controllers/project.php @@ -197,6 +197,7 @@ class Project extends Controller // recompose the project information from POST data. unset ($project); + $project = new stdClass(); $project->id = $tmpid; $project->name = $this->input->post('project_name'); $project->summary = $this->input->post('project_summary'); @@ -259,6 +260,7 @@ class Project extends Controller if ($login['id'] == '') redirect ("main/signin/" . $this->converter->AsciiTohex(current_url())); + $project = new stdClass(); $project->id = $projectid; $project->name = ''; $project->summary = ''; @@ -486,6 +488,7 @@ class Project extends Controller if ($filter == '') { + $search = new stdClass(); $search->id = ''; $search->name = ''; $search->summary = ''; diff --git a/codepot/src/codepot/controllers/user.php b/codepot/src/codepot/controllers/user.php index 4169bec2..91f719ef 100644 --- a/codepot/src/codepot/controllers/user.php +++ b/codepot/src/codepot/controllers/user.php @@ -77,6 +77,8 @@ class User extends Controller } $this->load->model ('ProjectModel', 'projects'); + + $user = new stdClass(); $user->id = $login['id']; $myprojs = $this->projects->getMyProjects ($login['id']); @@ -100,7 +102,7 @@ class User extends Controller $numprojs = count($myprojs); for ($i = 0; $i < $numprojs; $i++) $projids[$i] = $myprojs[$i]->id; - + $num_log_entries = $this->logs->getNumEntries ($projids); if ($num_log_entries === FALSE) { @@ -190,7 +192,7 @@ class User extends Controller $this->load->library ('upload'); $this->upload->initialize ($config); - + if ($this->upload->do_upload ('icon_img_file_name')) { $upload = $this->upload->data (); @@ -199,6 +201,7 @@ class User extends Controller } } + // // make sure that these field also exist in the database // also change the sanity check in LoginModel/getUser() @@ -232,6 +235,7 @@ class User extends Controller if ($settings === FALSE || $settings === NULL) { if ($settings === FALSE) $data['message'] = 'DATABASE ERROR'; + $settings = new stdClass(); $settings->code_hide_line_num = ' '; $settings->code_hide_metadata = ' '; $settings->icon_name = ''; diff --git a/codepot/src/codepot/models/loginmodel.php b/codepot/src/codepot/models/loginmodel.php index b83a648b..90ce8a5e 100644 --- a/codepot/src/codepot/models/loginmodel.php +++ b/codepot/src/codepot/models/loginmodel.php @@ -42,7 +42,8 @@ class LoginModel extends Model if ($settings !== NULL) { $settings = @unserialize ($settings); - if ($settings === FALSE) $settings = NULL; + if ($settings === FALSE || $settings === NULL) + $settings = new stdObject(); // Sanity check on the session/cookie data // See Controller/User->settings() for required fields. diff --git a/codepot/src/codepot/views/user_home.php b/codepot/src/codepot/views/user_home.php index 519228c8..b0d73bc4 100644 --- a/codepot/src/codepot/views/user_home.php +++ b/codepot/src/codepot/views/user_home.php @@ -35,11 +35,12 @@ $(function () { id = $login['id']; $this->load->view ( - 'projectbar', - array ( + 'projectbar', + array ( 'banner' => NULL, 'page' => array ( @@ -48,8 +49,8 @@ $this->load->view ( 'user' => $user, ), - 'ctxmenuitems' => array () - ) + 'ctxmenuitems' => array () + ) ); ?> diff --git a/codepot/src/codepot/views/user_settings.php b/codepot/src/codepot/views/user_settings.php index a311db0b..98d248fa 100644 --- a/codepot/src/codepot/views/user_settings.php +++ b/codepot/src/codepot/views/user_settings.php @@ -27,6 +27,7 @@ id = $login['id']; $this->load->view (