diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..446e97f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.env +.htaccess +/writable/session +/writable/logs diff --git a/app/Config/Database.php b/app/Config/Database.php index 5c0f6f2..af1d3ec 100644 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -31,10 +31,10 @@ class Database extends Config public array $default = [ 'DSN' => '', - 'hostname' => 'db_host', - 'username' => 'db_user', - 'password' => 'db_pass', - 'database' => 'db_name', + 'hostname' => 'localhost', + 'username' => 'root', + 'password' => '', + 'database' => 'whatpanel', 'DBDriver' => 'MySQLi', 'DBPrefix' => 'hd_', 'pConnect' => false, diff --git a/app/Config/alldone.txt b/app/Config/alldone.txt index e69de29..8ad96f8 100644 --- a/app/Config/alldone.txt +++ b/app/Config/alldone.txt @@ -0,0 +1 @@ +Done \ No newline at end of file diff --git a/app/Controllers/Installer.php b/app/Controllers/Installer.php index 627cbfc..aea715d 100644 --- a/app/Controllers/Installer.php +++ b/app/Controllers/Installer.php @@ -120,12 +120,15 @@ class Installer extends MX_Controller session()->set('key', $apiKey); $body = [ 'action' => 'check_license', - 'domain_name' => $trim, - //'domain_name' => "uat.whatpanel.com", + //'domain_name' => $trim, + 'domain_name' => "sanyog.com", 'license' => $apiKey ]; try { + $client = new \GuzzleHttp\Client([ + 'verify' => false, // or use a path to cacert.pem for a more secure approach + ]); // Make the GET request with the Authorization header $response = $client->post($url, [ 'headers' => [ @@ -196,8 +199,6 @@ class Installer extends MX_Controller public function done() { - // $this->load->view('installed'); - // Define the file path $filePath = APPPATH."/Config/alldone.txt"; @@ -234,7 +235,18 @@ class Installer extends MX_Controller ['id' => 29, 'name' => 'Domain Names', 'settings' => '', 'param' => 'faq_39', 'type' => 'Module', 'module' => 'FAQ'] ]; - $builder->insertBatch($data); + foreach ($data as $row) { + // Check if the record exists + $existingRecord = $builder->where('id', $row['id'])->get()->getRowArray(); + + if ($existingRecord) { + // Update the existing record + $builder->where('id', $row['id'])->update($row); + } else { + // Insert the new record + $builder->insert($row); + } + } return view('installed'); } @@ -429,7 +441,7 @@ class Installer extends MX_Controller $this->clearCache(); // Path to your SQL file - $fileUrl = $baseURL . 'public/sql/whatpanel_' . $version . '.sql'; + $fileUrl = $baseURL . '/public/sql/whatpanel_' . $version . '.sql'; $tempFilePath = WRITEPATH . 'temp_sql_file.sql'; // Fetch the SQL file using cURL diff --git a/app/Libraries/AppLib.php b/app/Libraries/AppLib.php index ecae792..6b4eb87 100644 --- a/app/Libraries/AppLib.php +++ b/app/Libraries/AppLib.php @@ -19,6 +19,7 @@ use App\Models\App; use App\Models\Field; use App\Models\Invoice; use App\Models\Fields; +use DateTime; class AppLib { @@ -873,7 +874,7 @@ class AppLib date_default_timezone_set($custom->getconfig_item('timezone')); $etime = time() - $ptime; - if ($etime < 1) { + if ($etime < 1) { return '0 seconds'; } @@ -903,6 +904,36 @@ class AppLib } } + static function timeAgo($timestamp) + { + $now = new DateTime(); + $past = new DateTime($timestamp); + $interval = $now->diff($past); + + $format = array(); + + if ($interval->y > 0) { + $format[] = $interval->y . ' year' . ($interval->y > 1 ? 's' : ''); + } + if ($interval->m > 0) { + $format[] = $interval->m . ' month' . ($interval->m > 1 ? 's' : ''); + } + if ($interval->d > 0) { + $format[] = $interval->d . ' day' . ($interval->d > 1 ? 's' : ''); + } + if ($interval->h > 0) { + $format[] = $interval->h . ' hour' . ($interval->h > 1 ? 's' : ''); + } + if ($interval->i > 0) { + $format[] = $interval->i . ' minute' . ($interval->i > 1 ? 's' : ''); + } + if ($interval->s > 0) { + $format[] = $interval->s . ' second' . ($interval->s > 1 ? 's' : ''); + } + + // Combine all the parts + return implode(', ', $format) . ' ago'; + } public static function curl_exec_follow($ch, &$maxredirect = null) diff --git a/app/Models/Domain.php b/app/Models/Domain.php index e6d4052..1a78592 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -91,11 +91,10 @@ class Domain extends Model ->where($type) ->where($array) ->where('o_id', 0) + ->distinct('domain') ->orderBy('id', 'desc'); $result = $query->get()->getResult(); - - // echo $db->getLastQuery();die; return $result; } diff --git a/app/Modules/settings/controllers/Settings.php b/app/Modules/settings/controllers/Settings.php index 680f2be..a91d28b 100644 --- a/app/Modules/settings/controllers/Settings.php +++ b/app/Modules/settings/controllers/Settings.php @@ -915,8 +915,7 @@ class Settings extends WhatPanel return redirect()->to('settings/system'); break; case 'theme': - echo 343;die; - if ($request->getFile('iconfile')) { + if ($request->getFile('iconfile')) { $stat = $this->upload_favicon($request->getPost()); return redirect()->to($stat); } @@ -929,9 +928,7 @@ class Settings extends WhatPanel if ($request->getFile('loginbg')) { $this->upload_login_bg($request->getPost()); } - echo 132;die; $this->_update_theme_settings('theme'); - echo 123;die; return redirect()->to('settings/theme'); break; case 'crons': @@ -1268,7 +1265,7 @@ class Settings extends WhatPanel $session->setFlashdata('response_status', 'success'); $session->setFlashdata('message', lang('hd_lang.settings_updated_successfully')); //return redirect()->to('settings/theme'); - //$return_url = base_url() . 'settings/theme'; + $return_url = base_url() . 'settings/theme'; return $return_url; } @@ -1599,8 +1596,8 @@ class Settings extends WhatPanel $this->form_validation->set_rules('email_invoice_message', 'Invoice Message', 'required'); $this->form_validation->set_rules('reminder_message', 'Reminder Message', 'required'); if ($this->form_validation->run() == FALSE) { - $this->session->set_flashdata('response_status', 'error'); - $this->session->set_flashdata('message', lang('hd_lang.settings_update_failed')); + session()->setFlashdata('response_status', 'error'); + session()->setFlashdata('message', lang('hd_lang.settings_update_failed')); $_POST = ''; $this->update('email'); } else { @@ -1609,13 +1606,13 @@ class Settings extends WhatPanel $this->db->where('config_key', $key)->update('config', $data); } - $this->session->set_flashdata('response_status', 'success'); - $this->session->set_flashdata('message', lang('hd_lang.settings_updated_successfully')); + session()->setFlashdata('response_status', 'success'); + session()->setFlashdata('message', lang('hd_lang.settings_updated_successfully')); redirect('settings/update/email'); } } else { - $this->session->set_flashdata('response_status', 'error'); - $this->session->set_flashdata('message', lang('hd_lang.settings_update_failed')); + session()->setFlashdata('response_status', 'error'); + session()->setFlashdata('message', lang('hd_lang.settings_update_failed')); redirect('settings/update/email'); } } @@ -1637,16 +1634,25 @@ class Settings extends WhatPanel // Get the uploaded file(s) $file = $request->getFile('iconfile'); - + // Validate the uploaded file $validationRules = [ - 'iconfile' => 'uploaded[iconfile]|max_size[iconfile,1024]|is_image[iconfile]|ext_in[iconfile,jpg,jpeg,png,ico,svg]', + 'iconfile' => [ + 'rules' => 'uploaded[iconfile]|is_image[iconfile]|ext_in[iconfile,jpg,jpeg,png,ico]|max_size[iconfile,1024]|max_dims[iconfile,300,300]', + 'errors' => [ + 'uploaded' => 'No file was uploaded.', + 'is_image' => 'The file is not a valid image.', + 'ext_in' => 'Invalid file extension.', + 'max_size' => 'File size exceeds the limit of 1MB.', + 'max_dims' => 'Image dimensions exceed the limit of 300x300 pixels.' + ] + ] ]; - //if ($this->validate($validationRules)) { + if ($this->validate($validationRules)) { // Move the uploaded file to the desired directory $newName = $file->getRandomName(); - + // Use the move method to upload the file to the specified folder $file->move($uploadPath, $newName); @@ -1657,11 +1663,11 @@ class Settings extends WhatPanel // Assuming $db is an instance of the database class $db->table('hd_config')->where('config_key', 'site_favicon')->update($data); - - echo $_POST['return_url']; + + return $_POST['return_url']; //return TRUE; - //} + } } diff --git a/app/Views/installed.php b/app/Views/installed.php index c4009a0..38b3f97 100644 --- a/app/Views/installed.php +++ b/app/Views/installed.php @@ -18,43 +18,49 @@ " rel="stylesheet"> + " rel="stylesheet"> + - - - - +
+
+ Installed Successfully + Installed Successfully + Installed Successfully +
+
+

Installed...!

+ Thank you for installing Hosting Billing + " class="checkBtn">Check it out +
+
+ + + + + - -
-
-

Installed!

-

Thank you for installing WHAT PANEL !

-
- " class="btn btn-dark btn-lg">Check it out -
-
- - - - - - - - - - - + + diff --git a/app/Views/modules/invoices/invoices.php b/app/Views/modules/invoices/invoices.php index 9b1b70a..b54c575 100644 --- a/app/Views/modules/invoices/invoices.php +++ b/app/Views/modules/invoices/invoices.php @@ -55,6 +55,16 @@ $session = session(); .edit-link:hover .edit-name { opacity: 1; } + +.clrBtn{ + font-size: 1.6rem !important; + border-radius: 0.5rem !important; + padding: 0.8rem 1.2rem !important; + text-align: center !important; + color: #fff !important; + cursor: pointer !important; + border: 0 !important; +}
diff --git a/app/Views/modules/tickets/create_ticket.php b/app/Views/modules/tickets/create_ticket.php index f64661e..44865ad 100644 --- a/app/Views/modules/tickets/create_ticket.php +++ b/app/Views/modules/tickets/create_ticket.php @@ -1,4 +1,4 @@ - - @@ -196,7 +196,8 @@ $custom = new custom_name_helper(); - + + - - endSection() ?> diff --git a/app/Views/modules/tickets/view.php b/app/Views/modules/tickets/view.php index f0cc3f4..e2b538b 100644 --- a/app/Views/modules/tickets/view.php +++ b/app/Views/modules/tickets/view.php @@ -1,12 +1,12 @@ - - + - - + + @@ -183,37 +183,37 @@ $db = \Config\Database::connect(); status) { - case 'open': - $status_lang = 'open'; - break; - case 'closed': - $status_lang = 'closed'; - break; - case 'pending': - $status_lang = 'pending'; - break; - case 'resolved': - $status_lang = 'resolved'; - break; - default: - // Handle cases where $info->status doesn't match any of the above cases - $status_lang = ''; // or assign some default value - break; - } - ?> -
  • - - - -
  • + $status_lang = ''; // Initialize the variable + switch ($info->status) { + case 'open': + $status_lang = 'open'; + break; + case 'closed': + $status_lang = 'closed'; + break; + case 'pending': + $status_lang = 'pending'; + break; + case 'resolved': + $status_lang = 'resolved'; + break; + default: + // Handle cases where $info->status doesn't match any of the above cases + $status_lang = ''; // or assign some default value + break; + } + ?> +
  • + + + +
  • priority ?>
  • - + getconfig_item('date_format') . " %H:%M", strtotime($info->created)); ?> @@ -277,108 +277,65 @@ $db = \Config\Database::connect();
    - - 0) { - foreach (Ticket::view_replies($id) as $key => $r) { - $role = User::get_role($r->replierid); - $role_label = ($role == 'admin') ? 'danger' : 'info'; - ?> - - - - - + - + - + - - - - - - + getconfig_item('date_format') . " %H:%M:%S", strtotime($r->time)); ?> + getconfig_item('show_time_ago') == 'TRUE') { + echo ' - ' . AppLib::timeAgo($r->time); + } + ?> - - + + + - -
    -
    - replierid); ?> - replierid)) ?> -
    -
    + - body ?> - - - attachment != NULL) { - echo '
    '; - $replyfiles = ''; - if (json_decode($r->attachment)) { - $replyfiles = json_decode($r->attachment); - foreach ($replyfiles as $rf) { ?> -
    - - attachment ?>
    - + body ?> +
    + attachment != NULL) { + echo '
    '; + $replyfiles = ''; + if (json_decode($r->attachment)) { + $replyfiles = json_decode($r->attachment); + foreach ($replyfiles as $rf) { ?> +
    + + attachment ?>
    -
    - - - getconfig_item('date_format') . " %H:%M:%S", strtotime($r->time)); ?> - getconfig_item('show_time_ago') == 'TRUE') { - echo ' - ' . AppLib::time_elapsed_string(strtotime($r->time)); - } - ?> + + + + - -

    + + +

    + + + + +
    @@ -421,7 +378,7 @@ $db = \Config\Database::connect(); -