diff --git a/.gitignore b/.gitignore index 86bef27cc..e3511cb69 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ _ide_helper.php .DS_Store package-lock.json /node_modules +.qodo diff --git a/config/cms.php b/config/cms.php index 4d31d1fcf..9c1a7ce76 100644 --- a/config/cms.php +++ b/config/cms.php @@ -11,7 +11,7 @@ return [ | */ - 'activeTheme' => 'modern', + 'activeTheme' => 'modern2', /* |-------------------------------------------------------------------------- @@ -36,7 +36,7 @@ return [ | */ - 'backendUri' => 'privatecontrolcenter', //howpsuzlyk + 'backendUri' => 'backend', //howpsuzlyk /* |-------------------------------------------------------------------------- @@ -131,7 +131,7 @@ return [ | */ - 'disableCoreUpdates' => false, + 'disableCoreUpdates' => true, /* |-------------------------------------------------------------------------- diff --git a/plugins/ahmadfatoni/apigenerator/Plugin.php b/plugins/ahmadfatoni/apigenerator/Plugin.php deleted file mode 100644 index 575a4fdf1..000000000 --- a/plugins/ahmadfatoni/apigenerator/Plugin.php +++ /dev/null @@ -1,18 +0,0 @@ - October CMS plugin to build RESTful APIs. - -## Features - - - Auto generate routes - - Auto Generate Controller (CRUD) - - Support relationship restful API - -## Install -``` -composer require AhmadFatoni.ApiGenerator -``` - -## Usage - -### Form -- API Name : Name of your API module -- Base Endpoint : Base endpoint of your API, ex : api/v1/modulename -- Short Description : Describe your API -- Model : select model that will be created API -- Custom Condition : Build customer response using JSON modeling - -### Custom Condition Example -``` -{ - 'fillable': 'id,title,content', - 'relation': [{ - 'name': 'user', - 'fillable': 'id,first_name' - }, { - 'name': 'categories', - 'fillable': 'id,name - }] -} -``` -* please replace single quote with quote - -## Contribute - -Pull Requests accepted. - -## Contact - -You can communicate with me using [linkedin](https://www.linkedin.com/in/ahmad-fatoni) - -## License -The OctoberCMS platform is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/plugins/ahmadfatoni/apigenerator/controllers/ApiGeneratorController.php b/plugins/ahmadfatoni/apigenerator/controllers/ApiGeneratorController.php deleted file mode 100644 index 1eea0a4c4..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/ApiGeneratorController.php +++ /dev/null @@ -1,336 +0,0 @@ -files = $files; - } - - /** - * delete selected data (multiple delete) - * @return [type] [description] - */ - public function index_onDelete() - { - if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { - - foreach ($checkedIds as $id) { - if ((!$item = ApiGenerator::find($id))) - continue; - $name = $item->name; - if($item->delete()){ - $this->deleteApi($name); - } - } - - Flash::success('Successfully deleted those data.'); - } - - return $this->listRefresh(); - } - - /** - * generate API - * @param Request $request [description] - * @return [type] [description] - */ - public function generateApi(Request $request){ - - $data['model'] = $request->model; - $modelname = explode("\\", $request->model); - $modelname = $modelname[count($modelname)-1]; - $data['modelname'] = $modelname; - $data['controllername'] = str_replace(" ", "", $request->name); - $data['endpoint'] = $request->endpoint; - $data['custom_format'] = $request->custom_format; - - if( strpos($data['controllername'], ".") OR strpos($data['controllername'], "/") ){ - - Flash::success('Failed to create data, invalid API name.'); - return Redirect::to( Backend::url($this->homePage)); - - } - - if( isset($request->id) ){ - $this->deleteApi($request->oldname, 'false'); - } - - $this->files->put(__DIR__ . $this->path . $data['controllername'].'Controller.php', $this->compile($data)); - - $this->files->put(__DIR__ . '/'.'../routes.php', $this->compileRoute($data)); - - return Redirect::to( Backend::url($this->homePage)); - - } - - /** - * delete available API - * @param [type] $name [description] - * @param [type] $redirect [description] - * @return [type] [description] - */ - public function deleteApi($name, $redirect = null){ - - $fileLocation = __DIR__ . $this->path.$name; - $fileLocation = str_replace(".", "", $fileLocation); - - if( ! file_exists($fileLocation.'Controller.php') ){ - - Flash::success('Failed to delete data, invalid file location.'); - return Redirect::to( Backend::url($this->homePage)); - - } - - if( strpos( strtolower($name), 'apigenerator' ) === false){ - $data = []; - - //generate new route - $this->files->put(__DIR__ . '/'.'../routes.php', $this->compileRoute($data)); - - //remove controller - if (file_exists( __DIR__ . $this->path.$name.'Controller.php' )) { - - unlink(__DIR__ . $this->path.$name.'Controller.php'); - - } - - if( $redirect != null ){ - return 'success without redirect'; - } - } - - return Redirect::to( Backend::url($this->homePage)); - - } - - public function updateApi($name){ - - } - - /** - * compile controller from template - * @param [type] $data [description] - * @return [type] [description] - */ - public function compile($data){ - if( $data['custom_format'] != ''){ - - $template = $this->files->get(__DIR__ .'/../template/customcontroller.dot'); - $template = $this->replaceAttribute($template, $data); - $template = $this->replaceCustomAttribute($template, $data); - }else{ - $template = $this->files->get(__DIR__ .'/../template/controller.dot'); - $template = $this->replaceAttribute($template, $data); - } - return $template; - } - - /** - * replace attribute - * @param [type] $template [description] - * @param [type] $data [description] - * @return [type] [description] - */ - public function replaceAttribute($template, $data){ - if( isset( $data['model'] ) ){ - $template = str_replace('{{model}}', $data['model'], $template); - } - $template = str_replace('{{modelname}}', $data['modelname'], $template); - $template = str_replace('{{controllername}}', $data['controllername'], $template); - return $template; - } - - /** - * replace custom attribute - * @param [type] $template [description] - * @param [type] $data [description] - * @return [type] [description] - */ - public function replaceCustomAttribute($template, $data){ - - $arr = str_replace('\t', '', $data['custom_format']); - $arr = json_decode($arr); - $select = str_replace('
', '', $this->compileOpenIndexFunction($data['modelname'], 'index')); - $show = str_replace('
', '', $this->compileOpenIndexFunction($data['modelname'], 'show')); - $fillableParent = ''; - - if( isset($arr->fillable) AND $arr->fillable != null ) { - $fillableParent = $this->compileFillableParent($arr->fillable); - } - - if( isset($arr->relation) AND $arr->relation != null AND is_array($arr->relation) AND count($arr->relation) > 0) { - $select .= str_replace('
', '', $this->compileFillableChild($arr->relation)); - $show .= str_replace('
', '', $this->compileFillableChild($arr->relation)); - } - - $select .= "->select(".$fillableParent.")"; - $show .= "->select(".$fillableParent.")->where('id', '=', \$id)->first();"; - - ( $fillableParent != '') ? $select .= "->get()->toArray();" : $select .= "->toArray();" ; - - $closeFunction = str_replace('
', '', nl2br( - " - return \$this->helpers->apiArrayResponseBuilder(200, 'success', \$data); - }")); - $select .= $closeFunction; - $show .= $closeFunction; - - $template = str_replace('{{select}}', $select, $template); - $template = str_replace('{{show}}', $show, $template); - - return $template; - } - - public function compileOpenIndexFunction($modelname, $type){ - if( $type == 'index'){ - return nl2br(" - public function index(){ - \$data = \$this->".$modelname); - }else{ - return nl2br(" - public function show(\$id){ - \$data = \$this->".$modelname); - } - - } - - public function compileFillableParent($fillable){ - - $fillableParentArr = explode(",", $fillable); - $fillableParent = ''; - - foreach ($fillableParentArr as $key) { - - $fillableParent .= ",'".$key."'"; - - } - - $fillableParent = substr_replace($fillableParent, '', 0 , 1); - - return $fillableParent; - } - - public function compileFillableChild($fillable){ - - $select = "->with(array("; - - foreach ($fillable as $key) { - - $fillableChild = ""; - - if( isset($key->fillable) AND $key->fillable != null ){ - $fillableChildArr = explode(",", $key->fillable); - - - foreach ($fillableChildArr as $key2) { - - $fillableChild .= ",'".$key2."'"; - - } - - $fillableChild = substr_replace($fillableChild, '', 0 , 1); - } - - $select .= nl2br( - " - '".$key->name."'=>function(\$query){ - \$query->select(".$fillableChild."); - },"); - - } - - $select .= " ))"; - - return $select; - } - - public function compileRoute($data){ - - $oldData = ApiGenerator::all(); - $routeList = ""; - - if( count($oldData) > 0 ){ - - $routeList .= $this->parseRouteOldData($oldData, $data); - - } - - if( count($data) > 0 ){ - $data['modelname'] = $data['endpoint']; - if( $data['modelname'][0] == "/" ){ - $data['modelname'] = substr_replace($data['modelname'], '', 0 , 1); - } - $routeList .= $this->parseRoute($data); - } - - $route = $this->files->get(__DIR__ .'/../template/routes.dot'); - $route = str_replace('{{route}}', $routeList, $route); - - return $route; - - } - - public function parseRouteOldData($oldData, $data = null){ - - $routeList = ""; - - if( count($data) == 0 ) $data['modelname']=''; - - foreach ( $oldData as $key ) { - - $modelname = explode("\\", $key->model); - $modelname = $modelname[count($modelname)-1]; - $old['modelname'] = $key->endpoint; - $old['controllername'] = $key->name; - - if( $data['modelname'] != $modelname ){ - - if( $old['modelname'][0] == "/" ){ - $old['modelname'] = substr_replace($old['modelname'], '', 0 , 1); - } - - $routeList .= $this->parseRoute($old); - } - } - - return $routeList; - - } - - public function parseRoute($data){ - - $template = $this->files->get(__DIR__ .'/../template/route.dot'); - $template = $this->replaceAttribute($template, $data); - return $template; - } - - - public static function getAfterFilters() {return [];} - public static function getBeforeFilters() {return [];} - public function callAction($method, $parameters=false) { - return call_user_func_array(array($this, $method), $parameters); - } -} diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/readme.txt b/plugins/ahmadfatoni/apigenerator/controllers/api/readme.txt deleted file mode 100644 index f972e8de0..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/readme.txt +++ /dev/null @@ -1 +0,0 @@ -api controller here \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_list_toolbar.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_list_toolbar.htm deleted file mode 100644 index 82a362239..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_list_toolbar.htm +++ /dev/null @@ -1,18 +0,0 @@ -
- - -
diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_reorder_toolbar.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_reorder_toolbar.htm deleted file mode 100644 index 59b78d088..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/_reorder_toolbar.htm +++ /dev/null @@ -1,3 +0,0 @@ -
- -
\ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_form.yaml b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_form.yaml deleted file mode 100644 index 9317c6bd1..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_form.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: ApiGeneratorController -form: $/ahmadfatoni/apigenerator/models/apigenerator/fields.yaml -modelClass: AhmadFatoni\ApiGenerator\Models\ApiGenerator -defaultRedirect: ahmadfatoni/apigenerator/apigeneratorcontroller -create: - redirect: 'ahmadfatoni/apigenerator/apigeneratorcontroller/update/:id' - redirectClose: ahmadfatoni/apigenerator/apigeneratorcontroller -update: - redirect: ahmadfatoni/apigenerator/apigeneratorcontroller - redirectClose: ahmadfatoni/apigenerator/apigeneratorcontroller diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_list.yaml b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_list.yaml deleted file mode 100644 index d36a63f51..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_list.yaml +++ /dev/null @@ -1,11 +0,0 @@ -list: $/ahmadfatoni/apigenerator/models/apigenerator/columns.yaml -modelClass: AhmadFatoni\ApiGenerator\Models\ApiGenerator -title: ApiGeneratorController -noRecordsMessage: 'backend::lang.list.no_records' -showSetup: true -showCheckboxes: true -toolbar: - buttons: list_toolbar - search: - prompt: 'backend::lang.list.search_prompt' -recordUrl: 'ahmadfatoni/apigenerator/apigeneratorcontroller/update/:id' diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_reorder.yaml b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_reorder.yaml deleted file mode 100644 index 70fda7be8..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/config_reorder.yaml +++ /dev/null @@ -1,4 +0,0 @@ -title: ApiGeneratorController -modelClass: AhmadFatoni\ApiGenerator\Models\ApiGenerator -toolbar: - buttons: reorder_toolbar diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/create.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/create.htm deleted file mode 100644 index 22322c523..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/create.htm +++ /dev/null @@ -1,97 +0,0 @@ - - - - -fatalError): ?> - - 'layout']) ?> - -
- formRender() ?> -
- - - -
-
- - - - - - - Cancel - -
-
- - - - - - -

fatalError)) ?>

-

- - - \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/index.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/index.htm deleted file mode 100644 index ea43a3636..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/index.htm +++ /dev/null @@ -1 +0,0 @@ -listRender() ?> diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/preview.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/preview.htm deleted file mode 100644 index f259af345..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/preview.htm +++ /dev/null @@ -1,22 +0,0 @@ - - - - -fatalError): ?> - -
- formRenderPreview() ?> -
- - -

fatalError) ?>

- - -

- - - -

\ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/reorder.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/reorder.htm deleted file mode 100644 index 9813ab46a..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/reorder.htm +++ /dev/null @@ -1,8 +0,0 @@ - - - - -reorderRender() ?> \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/update.htm b/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/update.htm deleted file mode 100644 index dc6594a46..000000000 --- a/plugins/ahmadfatoni/apigenerator/controllers/apigeneratorcontroller/update.htm +++ /dev/null @@ -1,133 +0,0 @@ - - - - -fatalError): ?> - - 'layout']) ?> - -
- formRender() ?> -
- - -
-
- - -
Cancel
- - - - - - - -
-
- - - -

fatalError)) ?>

-

- - - - - - - - \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/lang/en/lang.php b/plugins/ahmadfatoni/apigenerator/lang/en/lang.php deleted file mode 100644 index 9ade59ec2..000000000 --- a/plugins/ahmadfatoni/apigenerator/lang/en/lang.php +++ /dev/null @@ -1,6 +0,0 @@ - [ - 'name' => 'API-Generator', - 'description' => 'Generate API base on Builder Plugin' - ] -]; \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/models/ApiGenerator.php b/plugins/ahmadfatoni/apigenerator/models/ApiGenerator.php deleted file mode 100644 index 531bfd111..000000000 --- a/plugins/ahmadfatoni/apigenerator/models/ApiGenerator.php +++ /dev/null @@ -1,76 +0,0 @@ - 'required|unique:ahmadfatoni_apigenerator_data,name|regex:/^[\pL\s\-]+$/u', - 'endpoint' => 'required|unique:ahmadfatoni_apigenerator_data,endpoint', - 'custom_format' => 'json' - ]; - - public $customMessages = [ - 'custom_format.json' => 'Invalid Json Format Custom Condition' - ]; - - /* - * Disable timestamps by default. - * Remove this line if timestamps are defined in the database table. - */ - public $timestamps = false; - - /** - * @var string The database table used by the model. - */ - public $table = 'ahmadfatoni_apigenerator_data'; - - /** - * get model List - * @return [type] [description] - */ - public function getModelOptions(){ - - return ComponentHelper::instance()->listGlobalModels(); - } - - /** - * [setCustomFormatAttribute description] - * @param [type] $value [description] - */ - public function setCustomFormatAttribute($value){ - - $json = str_replace('\t', '', $value); - $json = json_decode($json); - - if( $json != null){ - - if( ! isset($json->fillable) AND ! isset($json->relation) ){ - - return $this->attributes['custom_format'] = 'invalid format'; - - } - - if( isset($json->relation) AND $json->relation != null ){ - foreach ($json->relation as $key) { - if( !isset($key->name) OR $key->name == null ){ - return $this->attributes['custom_format'] = 'invalid format'; - } - } - } - } - - return $this->attributes['custom_format'] = $value; - - } - -} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/models/apigenerator/columns.yaml b/plugins/ahmadfatoni/apigenerator/models/apigenerator/columns.yaml deleted file mode 100644 index 58ce8eb61..000000000 --- a/plugins/ahmadfatoni/apigenerator/models/apigenerator/columns.yaml +++ /dev/null @@ -1,9 +0,0 @@ -columns: - name: - label: 'API NAME' - type: text - searchable: true - sortable: true - endpoint: - label: 'BASE ENDPOINT' - type: text diff --git a/plugins/ahmadfatoni/apigenerator/models/apigenerator/fields.yaml b/plugins/ahmadfatoni/apigenerator/models/apigenerator/fields.yaml deleted file mode 100644 index a8e6e0bce..000000000 --- a/plugins/ahmadfatoni/apigenerator/models/apigenerator/fields.yaml +++ /dev/null @@ -1,33 +0,0 @@ -fields: - name: - label: 'API Name' - oc.commentPosition: '' - span: auto - placeholder: 'Name of your API' - required: 1 - type: text - endpoint: - label: 'Base Endpoint' - oc.commentPosition: '' - span: auto - placeholder: api/v1/modulename - required: 1 - type: text - description: - label: 'Short Description' - oc.commentPosition: '' - span: auto - placeholder: 'Descript your API' - type: text - model: - label: 'Select Model' - oc.commentPosition: '' - span: auto - required: 1 - type: dropdown - custom_format: - label: 'Custom Condition (Fillable and Relation)' - size: large - oc.commentPosition: '' - span: full - type: textarea diff --git a/plugins/ahmadfatoni/apigenerator/plugin.yaml b/plugins/ahmadfatoni/apigenerator/plugin.yaml deleted file mode 100644 index b656c76bf..000000000 --- a/plugins/ahmadfatoni/apigenerator/plugin.yaml +++ /dev/null @@ -1,17 +0,0 @@ -plugin: - name: 'ahmadfatoni.apigenerator::lang.plugin.name' - description: 'ahmadfatoni.apigenerator::lang.plugin.description' - author: AhmadFatoni - icon: oc-icon-bolt - homepage: '' -#navigation: -# api-generator: -# label: 'API Generator' -# url: ahmadfatoni/apigenerator/apigeneratorcontroller -# icon: icon-cogs -# permissions: -# - ahmadfatoni.apigenerator.manage -permissions: - ahmadfatoni.apigenerator.manage: - tab: 'API Generator' - label: 'Manage the API Generator' diff --git a/plugins/ahmadfatoni/apigenerator/routes.php b/plugins/ahmadfatoni/apigenerator/routes.php deleted file mode 100644 index d92aa57ba..000000000 --- a/plugins/ahmadfatoni/apigenerator/routes.php +++ /dev/null @@ -1,21 +0,0 @@ - 'fatoni.generate.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@generateApi')); -Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi')); -Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi')); -//postlar bilen categorialar -Route::resource('api/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesController', ['except' => ['destroy', 'create', 'edit']]); -Route::resource('api/advetisements', 'AhmadFatoni\ApiGenerator\Controllers\API\AdvertisementsController', ['except' => ['destroy', 'create', 'edit']]); -Route::get('api/group/advertisements', 'AhmadFatoni\ApiGenerator\Controllers\API\AdvertisementsController@getByGroup'); - -Route::resource('{locale}/api/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\postsController', ['except' => ['destroy', 'create', 'edit']]); - - -Route::get('api/v2/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesV2Controller@index'); -Route::get('api/v2/media', 'AhmadFatoni\ApiGenerator\Controllers\API\MediaController@index'); -//Route::get('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController@index'); -Route::resource('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController', ['except' => ['destroy', 'create', 'edit']]); - -Route::get('api/version',function (){ - return '2.0.8'; -}); diff --git a/plugins/ahmadfatoni/apigenerator/template/controller.dot b/plugins/ahmadfatoni/apigenerator/template/controller.dot deleted file mode 100644 index ff20ea3aa..000000000 --- a/plugins/ahmadfatoni/apigenerator/template/controller.dot +++ /dev/null @@ -1,99 +0,0 @@ -{{modelname}} = ${{modelname}}; - $this->helpers = $helpers; - } - - public function index(){ - - $data = $this->{{modelname}}->all()->toArray(); - - return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); - } - - public function show($id){ - - $data = $this->{{modelname}}::find($id); - - if ($data){ - return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); - } else { - $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); - } - - } - - public function store(Request $request){ - - $arr = $request->all(); - - while ( $data = current($arr)) { - $this->{{modelname}}->{key($arr)} = $data; - next($arr); - } - - $validation = Validator::make($request->all(), $this->{{modelname}}->rules); - - if( $validation->passes() ){ - $this->{{modelname}}->save(); - return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->{{modelname}}->id]); - }else{ - return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); - } - - } - - public function update($id, Request $request){ - - $status = $this->{{modelname}}->where('id',$id)->update($data); - - if( $status ){ - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); - - }else{ - - return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); - - } - } - - public function delete($id){ - - $this->{{modelname}}->where('id',$id)->delete(); - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); - } - - public function destroy($id){ - - $this->{{modelname}}->where('id',$id)->delete(); - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); - } - - - public static function getAfterFilters() {return [];} - public static function getBeforeFilters() {return [];} - public static function getMiddleware() {return [];} - public function callAction($method, $parameters=false) { - return call_user_func_array(array($this, $method), $parameters); - } - -} \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/template/controller.php b/plugins/ahmadfatoni/apigenerator/template/controller.php deleted file mode 100644 index f78dde065..000000000 --- a/plugins/ahmadfatoni/apigenerator/template/controller.php +++ /dev/null @@ -1,35 +0,0 @@ -{{modelname}} = ${{modelname}}; - } - - public static function getAfterFilters() {return [];} - public static function getBeforeFilters() {return [];} - public static function getMiddleware() {return [];} - public function callAction($method, $parameters=false) { - return call_user_func_array(array($this, $method), $parameters); - } - - // public function create(Request $request){ - - // $arr = $request->all(); - - // while ( $data = current($arr)) { - // $this-> - // } - // return json_encode($this->{{modelname}}->store($request)); - - // } -} diff --git a/plugins/ahmadfatoni/apigenerator/template/customcontroller.dot b/plugins/ahmadfatoni/apigenerator/template/customcontroller.dot deleted file mode 100644 index be5cf6ff2..000000000 --- a/plugins/ahmadfatoni/apigenerator/template/customcontroller.dot +++ /dev/null @@ -1,83 +0,0 @@ -{{modelname}} = ${{modelname}}; - $this->helpers = $helpers; - } - - {{select}} - - {{show}} - - public function store(Request $request){ - - $arr = $request->all(); - - while ( $data = current($arr)) { - $this->{{modelname}}->{key($arr)} = $data; - next($arr); - } - - $validation = Validator::make($request->all(), $this->{{modelname}}->rules); - - if( $validation->passes() ){ - $this->{{modelname}}->save(); - return $this->helpers->apiArrayResponseBuilder(201, 'created', ['id' => $this->{{modelname}}->id]); - }else{ - return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validation->errors() ); - } - - } - - public function update($id, Request $request){ - - $status = $this->{{modelname}}->where('id',$id)->update($data); - - if( $status ){ - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been updated successfully.'); - - }else{ - - return $this->helpers->apiArrayResponseBuilder(400, 'bad request', 'Error, data failed to update.'); - - } - } - - public function delete($id){ - - $this->{{modelname}}->where('id',$id)->delete(); - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); - } - - public function destroy($id){ - - $this->{{modelname}}->where('id',$id)->delete(); - - return $this->helpers->apiArrayResponseBuilder(200, 'success', 'Data has been deleted successfully.'); - } - - - public static function getAfterFilters() {return [];} - public static function getBeforeFilters() {return [];} - public static function getMiddleware() {return [];} - public function callAction($method, $parameters=false) { - return call_user_func_array(array($this, $method), $parameters); - } - -} diff --git a/plugins/ahmadfatoni/apigenerator/template/route.dot b/plugins/ahmadfatoni/apigenerator/template/route.dot deleted file mode 100644 index 515cb53c9..000000000 --- a/plugins/ahmadfatoni/apigenerator/template/route.dot +++ /dev/null @@ -1,3 +0,0 @@ - -Route::resource('{{modelname}}', 'AhmadFatoni\ApiGenerator\Controllers\API\{{controllername}}Controller', ['except' => ['destroy', 'create', 'edit']]); -Route::get('{{modelname}}/{id}/delete', ['as' => '{{modelname}}.delete', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\API\{{controllername}}Controller@destroy']); \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/template/routes.dot b/plugins/ahmadfatoni/apigenerator/template/routes.dot deleted file mode 100644 index b199c8af5..000000000 --- a/plugins/ahmadfatoni/apigenerator/template/routes.dot +++ /dev/null @@ -1,12 +0,0 @@ - 'fatoni.generate.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@generateApi')); -Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi')); -Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi')); -//postlar bilen categorialar -Route::resource('api/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesController', ['except' => ['destroy', 'create', 'edit']]); -Route::resource('{locale}/api/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\postsController', ['except' => ['destroy', 'create', 'edit']]); -Route::get('api/version',function (){ - return '2.0.8'; -}); -{{route}} diff --git a/plugins/ahmadfatoni/apigenerator/updates/builder_table_create_ahmadfatoni_apigenerator_data.php b/plugins/ahmadfatoni/apigenerator/updates/builder_table_create_ahmadfatoni_apigenerator_data.php deleted file mode 100644 index 44cdc81e3..000000000 --- a/plugins/ahmadfatoni/apigenerator/updates/builder_table_create_ahmadfatoni_apigenerator_data.php +++ /dev/null @@ -1,26 +0,0 @@ -engine = 'InnoDB'; - $table->increments('id'); - $table->string('name'); - $table->string('endpoint'); - $table->string('model'); - $table->string('description')->nullable(); - $table->text('custom_format')->nullable(); - }); - } - - public function down() - { - Schema::dropIfExists('ahmadfatoni_apigenerator_data'); - } -} diff --git a/plugins/ahmadfatoni/apigenerator/updates/version.yaml b/plugins/ahmadfatoni/apigenerator/updates/version.yaml deleted file mode 100644 index 966ff307a..000000000 --- a/plugins/ahmadfatoni/apigenerator/updates/version.yaml +++ /dev/null @@ -1,15 +0,0 @@ -1.0.1: - - 'Initialize plugin.' -1.0.2: - - 'Database implementation' -1.0.3: - - 'add builder plugin on requirements dependency' - - builder_table_create_ahmadfatoni_apigenerator_data.php -1.0.4: - - 'fixing bug on PHP 7' -1.0.5: - - 'fixing bug on request delete data' -1.0.6: - - 'fixing bug on generate endpoint' -1.0.7: - - 'fixing bug on October CMS v1.0.456' \ No newline at end of file diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/AdvertisementsController.php b/plugins/tps/tps/controllers/api/AdvertisementsController.php similarity index 95% rename from plugins/ahmadfatoni/apigenerator/controllers/api/AdvertisementsController.php rename to plugins/tps/tps/controllers/api/AdvertisementsController.php index 4abdadc99..ed787a1cc 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/AdvertisementsController.php +++ b/plugins/tps/tps/controllers/api/AdvertisementsController.php @@ -1,12 +1,10 @@ - 'fatoni.generate.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@generateApi')); +Route::post('fatoni/update/api/{id}', array('as' => 'fatoni.update.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@updateApi')); +Route::get('fatoni/delete/api/{id}', array('as' => 'fatoni.delete.api', 'uses' => 'AhmadFatoni\ApiGenerator\Controllers\ApiGeneratorController@deleteApi')); +//postlar bilen categorialar +Route::resource('api/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesController', ['except' => ['destroy', 'create', 'edit']]); +Route::resource('api/advetisements', 'AhmadFatoni\ApiGenerator\Controllers\API\AdvertisementsController', ['except' => ['destroy', 'create', 'edit']]); +Route::get('api/group/advertisements', 'AhmadFatoni\ApiGenerator\Controllers\API\AdvertisementsController@getByGroup'); + +Route::resource('{locale}/api/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\postsController', ['except' => ['destroy', 'create', 'edit']]); + + +Route::get('api/v2/categories', 'AhmadFatoni\ApiGenerator\Controllers\API\CategoriesV2Controller@index'); +Route::get('api/v2/media', 'AhmadFatoni\ApiGenerator\Controllers\API\MediaController@index'); +//Route::get('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController@index'); +Route::resource('api/v2/afisha', 'AhmadFatoni\ApiGenerator\Controllers\API\AfishaController', ['except' => ['destroy', 'create', 'edit']]); + +Route::get('api/version',function (){ + return '2.0.8'; +}); \ No newline at end of file diff --git a/server.php b/server.php index 36c6c749b..97bcfc66b 100644 --- a/server.php +++ b/server.php @@ -8,52 +8,10 @@ $uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) ); - - -/** - * October - The PHP platform that gets back to basics. - * - * @package October - * @author Alexey Bobkov, Samuel Georges - */ - -/* -|-------------------------------------------------------------------------- -| Register composer -|-------------------------------------------------------------------------- -| -| Composer provides a generated class loader for the application. -| -*/ - -require __DIR__.'/bootstrap/autoload.php'; - -/* -|-------------------------------------------------------------------------- -| Load framework -|-------------------------------------------------------------------------- -| -| This загружает фреймворк и инициализирует приложение. -| -*/ - -$app = require_once __DIR__.'/bootstrap/app.php'; - -/* -|-------------------------------------------------------------------------- -| Process request -|-------------------------------------------------------------------------- -| -| Выполняем запрос и отправляем ответ клиенту. -| -*/ - -$kernel = $app->make('Illuminate\Contracts\Http\Kernel'); - -$response = $kernel->handle( - $request = Illuminate\Http\Request::capture() -); - -$response->send(); - -$kernel->terminate($request, $response); +// This file allows us to emulate Apache's "mod_rewrite" functionality from the +// built-in PHP web server. This provides a convenient way to test a Laravel +// application without having installed a "real" web server software here. +if ($uri !== '/' && file_exists(__DIR__.'/'.$uri)) { + return false; +} +require_once __DIR__.'/index.php'; \ No newline at end of file diff --git a/storage/framework/pac871D.tmp b/storage/framework/pac871D.tmp new file mode 100644 index 000000000..f4b885e64 --- /dev/null +++ b/storage/framework/pac871D.tmp @@ -0,0 +1,30 @@ + + array ( + 'providers' => + array ( + 0 => 'Laravel\\Scout\\ScoutServiceProvider', + ), + ), + 'laravel/tinker' => + array ( + 'providers' => + array ( + 0 => 'Laravel\\Tinker\\TinkerServiceProvider', + ), + ), + 'meilisearch/meilisearch-laravel-scout' => + array ( + 'providers' => + array ( + 0 => 'Meilisearch\\Scout\\MeilisearchServiceProvider', + ), + ), + 'nesbot/carbon' => + array ( + 'providers' => + array ( + 0 => 'Carbon\\Laravel\\ServiceProvider', + ), + ), +); \ No newline at end of file diff --git a/tests/fixtures/plugins/testvendor/goto/Plugin.php b/tests/fixtures/plugins/testvendor/goto/Plugin.php deleted file mode 100644 index 3d1b816a6..000000000 --- a/tests/fixtures/plugins/testvendor/goto/Plugin.php +++ /dev/null @@ -1,15 +0,0 @@ - 'Invalid Test Plugin', - 'description' => 'Test plugin used by unit tests to detect plugins with invalid namespaces.', - 'author' => 'Test Vendor' - ]; - } -} diff --git a/tests/fixtures/plugins/testvendor/test/Plugin.php b/tests/fixtures/plugins/testvendor/test/Plugin.php deleted file mode 100644 index cb9921a56..000000000 --- a/tests/fixtures/plugins/testvendor/test/Plugin.php +++ /dev/null @@ -1,25 +0,0 @@ - 'Another Test Plugin', - 'description' => 'Test plugin used by unit tests with the same name.', - 'author' => 'Test Vendor' - ]; - } - - public function registerFormWidgets() - { - return [ - 'TestVendor\Test\FormWidgets\Sample' => [ - 'label' => 'Sample', - 'code' => 'sample' - ] - ]; - } -} diff --git a/tests/fixtures/plugins/testvendor/test/formwidgets/Sample.php b/tests/fixtures/plugins/testvendor/test/formwidgets/Sample.php deleted file mode 100644 index 1507d3118..000000000 --- a/tests/fixtures/plugins/testvendor/test/formwidgets/Sample.php +++ /dev/null @@ -1,7 +0,0 @@ -path(); - - {% partial 'new/mobile-search' %}
@@ -149,8 +137,8 @@ $this['canonical'] = 'https://orient.tm/'.request()->path(); {% partial 'new/footer' %} - - + + {% framework extras %} @@ -169,6 +157,18 @@ $this['canonical'] = 'https://orient.tm/'.request()->path(); gtag('config', 'G-HHRB3PCSBQ'); + + diff --git a/themes/modern2/pages/media.htm b/themes/modern2/pages/media.htm new file mode 100644 index 000000000..1deb8210d --- /dev/null +++ b/themes/modern2/pages/media.htm @@ -0,0 +1,105 @@ +title = "Media" +url = "/media/:slug?" +layout = "new/master-inside" +description = "media materials" +is_hidden = 0 +robot_index = "index" +robot_follow = "follow" +== +orderBy('published_at', 'DESC') + //->with(['media_view' ]) + ->withCount(['media_view AS view' => function ($query) { + $query->select(DB::raw("SUM(view) as media_view")); + } + ]) + ->paginate(9); + }else{ + $this['mediaPostsFilter'] = Tps\Tps\Models\Media::orderBy('published_at', 'DESC')->paginate(9); + } +} +?> +== + +
+
+
+ +
+ {% for post in mediaPostsFilter %} + {% if post.type == 'photo' %} + {% partial 'newHome/photo-item' post=post %} + {% else %} + {% partial 'newHome/video-item' post=post %} + {% endif %} + {% else %} +
  • {{ 'no Records' }}
  • + {% endfor %} +
    + {% partial 'new/pagination' items = mediaPostsFilter %} + + + +
    +
    +
    + + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + + + +
    +
    +
    + + + {% put scripts %} + + + + + + {% endput %} \ No newline at end of file diff --git a/themes/modern2/pages/new/afisha.htm b/themes/modern2/pages/new/afisha.htm deleted file mode 100644 index f7e932c9d..000000000 --- a/themes/modern2/pages/new/afisha.htm +++ /dev/null @@ -1,39 +0,0 @@ -title = "Рубрика Афиша" -url = "/new/afisha/:slug" -layout = "new/master-inside" -is_hidden = 0 -robot_index = "index" -robot_follow = "follow" - -[blogPosts] -pageNumber = "{{ :page }}" -categoryFilter = "{{ :slug }}" -postsPerPage = 10 -noPostsMessage = "No posts found" -sortOrder = "published_at desc" -categoryPage = 404 -postPage = 404 -== -
    -
    -
    - -
    - - {% for post in blogPosts.posts %} - {% partial 'new/afisha-item' post = post %} - {% else %} -

    No posts found

    - {% endfor %} - - -
    - - {% partial 'new/pagination' items = blogPosts.posts %} - -
    -
    -
    \ No newline at end of file diff --git a/themes/modern2/pages/new/contact.htm b/themes/modern2/pages/new/contact.htm deleted file mode 100644 index 32a739816..000000000 --- a/themes/modern2/pages/new/contact.htm +++ /dev/null @@ -1,418 +0,0 @@ -title = "new/contact" -url = "/new/contact" -layout = "new/master-inside" -meta_title = "Обратная связь" -is_hidden = 1 -robot_index = "index" -robot_follow = "follow" - -[contactForm] -== - - -
    -
    -
    - -
    -

    Контакты

    -
    -
    -
    -
    -
    -
    -
    -

    Свяжитесь с нами

    -

    Есть идея или сообщение для нашего агентства? Заполните форму ниже, и мы обязательно с вами свяжемся. Ваши предложения и вопросы помогают нам становиться лучше!

    -
    -
    -
    - - -
    -
    - - -
    -
    -
    - - -
    - -
    -
    -
    - -
    -
    -

    Контактные данные Orient

    -

    - Наши контактные данные, адрес офиса и режим работы. Мы всегда на - связи, чтобы ответить на ваши вопросы и предложения. Ждем вас! -

    -
    - -
    - -
    -

    Офис расположен по адресу:

    -
    - - - -
    -

    {{ this.theme.officeIsLocated }}

    -
    -
    -
    - -
    -

    Режим работы:

    -
    - - - - -
    -

    {{ this.theme.workingHours }}

    -
    -
    -
    - -
    - -
    - -
    -

    Контакты редакции:

    -
    - - - - -
    -

    Email редакции:

    - -

    {{ this.theme.editorialEmail }}

    -
    -
    - -
    - - - - - -
    -

    Телефон редакции:

    - -

    {{ this.theme.editorialPhone }}

    -
    -
    -
    - -
    -

    Контакты администрации:

    -
    - - - - -
    -

    Email администрации:

    - -

    {{ this.theme.emailTheAdministration }}

    -
    -
    - -
    - - - - - -
    -

    Телефон администрации:

    - -

    {{ this.theme.administrationPhone }}

    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -{% put scripts %} - - -{% endput %} \ No newline at end of file diff --git a/themes/modern2/pages/new/contact_test.htm b/themes/modern2/pages/new/contact_test.htm deleted file mode 100644 index 9dd386704..000000000 --- a/themes/modern2/pages/new/contact_test.htm +++ /dev/null @@ -1,164 +0,0 @@ -title = "new/contact_test" -url = "/new/contact_test" -layout = "new/master-inside" -is_hidden = 1 -robot_index = "index" -robot_follow = "follow" -== - - - -
    -
    -
    - -
    -

    Контакты

    -

    Свяжитесь с нами удобным для вас способом! Ниже вы найдете наши контакты или можете заполнить форму, чтобы оставить свои предложения и комментарии. Мы всегда рады вашему мнению!

    -
    -
    - -

    Инстаграм:{{ this.theme.instagram }}

    -
    -
    - -

    Email: {{ this.theme.eMail }}

    -
    -
    - -

    Телефон: {{ this.theme.phone }}

    -
    -
    - -

    Адрес:{{ this.theme.address }}

    -
    -
    -

    Свяжитесь с нами

    -

    Есть идея или сообщение для нашего агентства? Заполните форму ниже, и мы обязательно с вами свяжемся. Ваши предложения и вопросы помогают нам становиться лучше!

    -
    - - -
    - - - -
    -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - -
    - -
    - -
    -
    -
    -
    -
    -
    - - {% put scripts %} - - - {% endput %} \ No newline at end of file diff --git a/themes/modern2/pages/new/demosearch.htm b/themes/modern2/pages/new/demosearch.htm deleted file mode 100644 index a4ad57b39..000000000 --- a/themes/modern2/pages/new/demosearch.htm +++ /dev/null @@ -1,25 +0,0 @@ -title = "demosearch" -url = "new/demosearch" -layout = "new/master-inside" -is_hidden = 0 -robot_index = "noindex" -robot_follow = "follow" - -[meilisearch] -== - -
    -
    -
    - - - - {% component 'meilisearch' %} - - -
    -
    -
    \ No newline at end of file diff --git a/themes/modern2/pages/new/group.htm b/themes/modern2/pages/new/group.htm index bca11e67e..f329f1e9c 100644 --- a/themes/modern2/pages/new/group.htm +++ b/themes/modern2/pages/new/group.htm @@ -19,16 +19,9 @@ categoryPage = "new/category" postPage = "new/newPost" [mediaView] - -[expertForm] == param('id'); - // $currentPost = RainLab\Blog\Models\Post::where('id', $postId)->with(['category_groups'])->first(); $currentLocale = $this->activeLocale; @@ -166,7 +159,16 @@ function onStart(){
    diff --git a/themes/modern2/pages/new/newPost.htm b/themes/modern2/pages/new/newPost.htm index 3a71e11f2..e382781cf 100644 --- a/themes/modern2/pages/new/newPost.htm +++ b/themes/modern2/pages/new/newPost.htm @@ -192,6 +192,6 @@ function onStart() { } }); - + {% endput %} \ No newline at end of file