update
This commit is contained in:
35
inc/Hura8/Components/User/Controller/bUserController.php
Normal file
35
inc/Hura8/Components/User/Controller/bUserController.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Components\User\Controller;
|
||||
|
||||
|
||||
use Hura8\Components\User\Model\UserModel;
|
||||
use Hura8\System\Controller\aEntityBaseController;
|
||||
use Hura8\System\Security\Cookie;
|
||||
|
||||
|
||||
class bUserController extends aEntityBaseController
|
||||
{
|
||||
|
||||
protected $web_user_id = '';
|
||||
|
||||
protected $objUserModel;
|
||||
|
||||
public function __construct() {
|
||||
$this->web_user_id = self::getWebUserId();
|
||||
$this->objUserModel = new UserModel($this->web_user_id );
|
||||
parent::__construct($this->objUserModel);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description this value is set by hura.js for anonymous web users
|
||||
* @return string
|
||||
*/
|
||||
public static function getWebUserId() {
|
||||
return Cookie::get("uID", '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Components\User\Controller;
|
||||
|
||||
use Hura8\Components\User\Model\UserReviewModel;
|
||||
use Hura8\Components\User\PublicController\UUserController;
|
||||
use Hura8\System\Controller\aEntityBaseController;
|
||||
|
||||
|
||||
class bUserReviewController extends aEntityBaseController
|
||||
{
|
||||
protected $web_user_id = '';
|
||||
|
||||
protected $objUserReviewModel;
|
||||
|
||||
public function __construct($item_type, $item_id = 0) {
|
||||
|
||||
$this->web_user_id = UUserController::getWebUserId();
|
||||
|
||||
$this->objUserReviewModel = new UserReviewModel($item_type, $item_id);
|
||||
|
||||
parent::__construct($this->objUserReviewModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Hura8\Components\User\Controller;
|
||||
|
||||
use Hura8\Components\Customer\PublicController\UCustomerLoginController;
|
||||
use Hura8\Components\User\AdminController\AUserController;
|
||||
use Hura8\Components\User\Model\UserUploadModel;
|
||||
use Hura8\System\Controller\aEntityBaseController;
|
||||
|
||||
class bUserUploadController extends aEntityBaseController
|
||||
{
|
||||
protected $web_user_id = '';
|
||||
protected $customer_id = 0;
|
||||
protected $item_type = '';
|
||||
protected $item_id = '';
|
||||
|
||||
public function __construct($item_type='', $item_id=0) {
|
||||
$this->web_user_id = AUserController::getWebUserId();
|
||||
$this->customer_id = UCustomerLoginController::getLoggedInCustomerId();
|
||||
|
||||
$this->item_type = $item_type;
|
||||
$this->item_id = $item_id;
|
||||
|
||||
parent::__construct(new UserUploadModel($this->web_user_id, $this->customer_id, $item_type, $item_id));
|
||||
}
|
||||
|
||||
protected function deleteFileBeforeDeleteItem($item_id): bool
|
||||
{
|
||||
// delete thumb files
|
||||
$item_info = $this->getInfo($item_id);
|
||||
|
||||
if($item_info['file_path']) {
|
||||
$file_local_path = PUBLIC_DIR . "/". $item_info['file_path'];
|
||||
@unlink($file_local_path);
|
||||
}
|
||||
|
||||
// ok
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user