Skip to content

Commit

Permalink
bugs fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
bertugfahriozer committed Oct 14, 2024
1 parent cc7f2dc commit ff6af32
Show file tree
Hide file tree
Showing 15 changed files with 101 additions and 75 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"melbahja/seo": "^2.0",
"bertugfahriozer/ci4commonmodel": "^1.0",
"phpoffice/phpspreadsheet": "^1.27",
"studio-42/elfinder": "2.1.62",
"studio-42/elfinder": "2.1.64",
"claviska/simpleimage": "4.0.6"
},
"require-dev": {
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions modules/Backend/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// Login/out
$routes->get('login', 'Auth\AuthController::login', ['as' => 'login']);
$routes->post('login', 'Auth\AuthController::attemptLogin', []);
$routes->post('login', 'Auth\AuthController::attemptLogin');
$routes->get('logout', 'Auth\AuthController::logout', ['as' => 'logout']);

// Activation
Expand All @@ -32,9 +32,9 @@
$routes->get('update_user/(:any)', 'UserController::update_user/$1', ['as' => 'update_user']);
$routes->post('update_user/(:any)', 'UserController::update_user_post/$1', []);
$routes->get('user_del/(:any)', 'UserController::user_del/$1', ['as' => 'user_del']);
$routes->post('blackList', 'UserController::ajax_blackList_post', ['as'=>'blackList',]);
$routes->post('blackList', 'UserController::ajax_blackList_post', ['as' => 'blackList']);
$routes->post('removeFromBlacklist', 'UserController::ajax_remove_from_blackList_post', []);
$routes->post('forceResetPassword', 'UserController::ajax_force_reset_password', ['as'=>'forceResetPassword']);
$routes->post('forceResetPassword', 'UserController::ajax_force_reset_password', ['as' => 'forceResetPassword']);
$routes->get('user_perms/(:any)', 'PermgroupController::user_perms/$1', ['as' => 'user_perms']);
$routes->post('user_perms/(:any)', 'PermgroupController::user_perms_post/$1', []);

Expand Down
11 changes: 5 additions & 6 deletions modules/Backend/Controllers/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,19 @@ public function autoLookSeflinks()
*/
public function isActive()
{
if ($this->request->isAJAX()) {
if (!$this->request->isAJAX()) return $this->failForbidden();
$valData = ([
'id' => ['label' => 'id', 'rules' => 'required'],
'isActive' => ['label' => 'isActive', 'rules' => 'required'],
'where' => ['label' => 'where', 'rules' => 'required']
]);

if ($this->validate($valData) == false) return redirect('403');
if ($this->validate($valData) == false) return $this->fail($this->validator->getErrors());

if ($this->commonModel->edit($this->request->getPost('where'), ['isActive' => (bool)$this->request->getPost('isActive')], ['id' => $this->request->getPost('id')]))
return $this->respond(['result' => true], 200);
else
return $this->fail(['result' => false]);
} else return $this->failForbidden();
return $this->failForbidden();
}

public function maintenance()
Expand All @@ -109,7 +108,7 @@ public function maintenance()
]);
if ($this->validate($valData) == false) return redirect('403');
if ($this->commonModel->edit('settings', ['content' => (bool)$this->request->getPost('isActive')], ['option' => 'maintenanceMode']))
return $this->respond(['result' => (bool)$this->request->getPost('isActive')], 200);
return $this->respond(['result' => (bool)$this->request->getPost('isActive')],200);
else
return $this->fail(['pr' => false]);
} else return $this->failForbidden();
Expand All @@ -124,7 +123,7 @@ public function elfinderConvertWebp()
]);
if ($this->validate($valData) == false) return redirect('403');
if ($this->commonModel->edit('settings', ['content' => (int)$this->request->getPost('isActive')], ['id' => $this->request->getPost('id')]))
return $this->respond(['result' => (bool)$this->request->getPost('isActive')], 200);
return $this->respond(['result' => (bool)$this->request->getPost('isActive')],200);
else
return $this->fail(['pr' => false]);
} else return $this->failForbidden();
Expand Down
4 changes: 2 additions & 2 deletions modules/Backend/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public function attemptForgot()
if (is_null($user)) return redirect()->back()->with('error', lang('Auth.forgotNoUser'));

// Save the reset hash /
$this->commonModel->updateOne('users', ['_id' => new ObjectId($user->_id)], ['reset_hash' => $this->authLib->generateActivateHash(), 'reset_expires' => date('Y-m-d H:i:s', time() + $this->config->resetTime)]);
$user = $this->commonModel->getOne('users', ['_id' => new ObjectId($user->_id)]);
$this->commonModel->updateOne('users', ['id' => $user->_id], ['reset_hash' => $this->authLib->generateActivateHash(), 'reset_expires' => date('Y-m-d H:i:s', time() + $this->config->resetTime)]);
$user = $this->commonModel->getOne('users', ['id' => $user->_id]);
$commonLibrary = new CommonLibrary();
$mailResult = $commonLibrary->phpMailer('[email protected]', '[email protected]',
['mail' => $user->email],
Expand Down
2 changes: 1 addition & 1 deletion modules/Backend/Controllers/Auth/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BaseController extends Controller
*
* @var array
*/
protected $helpers = ['html'];
protected $helpers = [];

/**
* Constructor.
Expand Down
3 changes: 0 additions & 3 deletions modules/Backend/Controllers/Blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
use JasonGrimes\Paginator;
use Modules\Backend\Libraries\CommonTagsLibrary;
use Modules\Backend\Models\AjaxModel;
use CodeIgniter\API\ResponseTrait;

class Blog extends BaseController
{
use ResponseTrait;

/**
* @var CommonTagsLibrary
*/
Expand Down
4 changes: 1 addition & 3 deletions modules/Backend/Controllers/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ public function create()
$valData['pageIMGWidth'] = ['label' => 'Görsel Genişliği', 'rules' => 'required|is_natural_no_zero'];
$valData['pageIMGHeight'] = ['label' => 'Görsel Yüksekliği', 'rules' => 'required|is_natural_no_zero'];
}
if (!empty($this->request->getPost('pageimg'))) $valData['pageimg'] = ['label' => 'Görsel URL', 'rules' => 'valid_url'];
if ($this->validate($valData) == false) return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
if ($this->commonModel->isHave('categories',['seflink' => $this->request->getPost('seflink')]) === 0) {
$data = ['title' => $this->request->getPost('title'), 'seflink' => $this->request->getPost('seflink'),'isActive' => $this->request->getPost('isActive')];
if (!empty($this->request->getPost('parent'))) $data['parent'] = new ObjectId($this->request->getPost('parent'));
if (!empty($this->request->getPost('parent'))) $data['parent'] = $this->request->getPost('parent');
$seo = [];
if (!empty($this->request->getPost('description'))) $seo['description'] = $this->request->getPost('description');
if (!empty($this->request->getPost('pageimg'))) $seo['coverImage'] = $this->request->getPost('pageimg');
Expand Down Expand Up @@ -67,7 +66,6 @@ public function update(string $id)
$valData['pageIMGWidth'] = ['label' => 'Görsel Genişliği', 'rules' => 'required|is_natural_no_zero'];
$valData['pageIMGHeight'] = ['label' => 'Görsel Yüksekliği', 'rules' => 'required|is_natural_no_zero'];
}
if (!empty($this->request->getPost('pageimg'))) $valData['pageimg'] = ['label' => 'Görsel URL', 'rules' => 'valid_url'];
if ($this->validate($valData) == false) return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
$info = $this->commonModel->selectOne('categories', ['id' => $id]);
if ($info->seflink != $this->request->getPost('seflink') && $this->commonModel->get_where(['seflink' => $this->request->getPost('seflink')], 'categories') === 1) return redirect()->back()->withInput()->with('error', 'Kategori seflink adresi daha önce kullanılmış. lütfen kontrol ederek bir daha oluşturmayı deneyeyiniz.');
Expand Down
5 changes: 2 additions & 3 deletions modules/Backend/Controllers/Locked.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ public function index()
$paginator->setMaxPagesToShow(5);
$bpk = ($this->request->getUri()->getSegment(3, 1) - 1) * $itemsPerPage;

//dd($clearData);
$this->defData = array_merge($this->defData, [
'paginator' => $paginator,
'locks' => $this->commonModel->lists('locked','*', $filterData,'id ASC', $itemsPerPage,$bpk,['username' => (isset($clearData['email'])) ? $clearData['email']: null,
'ip_address' => (isset($clearData['ip'])) ?$clearData['ip'] : null]),
'locks' => $this->commonModel->lists('locked','*', $filterData,'id ASC', $itemsPerPage,$bpk,['username' => (isset($clearData['email'])) ? $clearData['email']: '',
'ip_address' => (isset($clearData['ip'])) ?$clearData['ip'] : '']),
'totalCount' => $totalItems,
'filteredData' => $clearData ?? null,
]);
Expand Down
2 changes: 1 addition & 1 deletion modules/Backend/Controllers/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function update_post($id)

if ($this->validate($valData) == false) return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());
$info = $this->commonModel->selectOne('pages', ['id' => $id]);
if ($info->seflink != $this->request->getPost('seflink') && $this->commonModel->isHave(['seflink' => $this->request->getPost('seflink')], 'pages') === 1) return redirect()->back()->withInput()->with('error', 'Sayfa seflink adresi daha önce kullanılmış. lütfen kontrol ederek bir daha oluşturmayı deneyeyiniz.');
if ($info->seflink != $this->request->getPost('seflink') && $this->commonModel->isHave('pages',['seflink' => $this->request->getPost('seflink'),'id!='=>$id]) === 1) return redirect()->back()->withInput()->with('error', 'Sayfa seflink adresi daha önce kullanılmış. lütfen kontrol ederek bir daha oluşturmayı deneyeyiniz.');
$data = ['title' => $this->request->getPost('title'),
'content' => $this->request->getPost('content'),
'isActive' => (bool)$this->request->getPost('isActive'),
Expand Down
1 change: 0 additions & 1 deletion modules/Backend/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public function create_user_post()
if ($this->validate($valData) == false) return redirect()->back()->withInput()->with('errors', $this->validator->getErrors());

if ($this->commonModel->isHave('users',['email' => $this->request->getPost('email')]) === 1) return redirect()->back()->withInput()->with('errors', ['E-posta adresi daha önce kayıt edilmiş lütfen üye listesini kontrol ediniz.']);
d(session()->get('logged_in'));
$data = [
'email' => $this->request->getPost('email'),
'firstname' => $this->request->getPost('firstname'),
Expand Down
6 changes: 3 additions & 3 deletions modules/Backend/Helpers/ci4ms_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function nestable($menus, $parent = null)

echo '<span class="float-left">' . $menu->title . '</span>
<div class="dd-nodrag btn-group float-right">
<button class="removeFromMenu btn btn-secondary btn-sm" onclick="removeFromMenu(\''.$menu->id . '\',\'' . $menu->urlType.
'\')" type="button"><i class="fas fa-trash"></i></button>
<button class="removeFromMenu btn btn-secondary btn-sm" onclick="removeFromMenu(\'' . $menu->id . '\',\'' . $menu->urlType .
'\')" type="button"><i class="fas fa-trash"></i></button>
</div>
</div>
</div>';
Expand All @@ -37,7 +37,7 @@ function nestable($menus, $parent = null)
}
}

if(!function_exists('format_number')){
if (!function_exists('format_number')) {
function format_number($n = '')
{
return ($n === '') ? '' : number_format((float)$n, 2, '.', ',');
Expand Down
Loading

0 comments on commit ff6af32

Please sign in to comment.