├── src ├── app │ └── index.html ├── store │ ├── storage │ │ ├── index.html │ │ └── lang │ │ │ ├── index.html │ │ │ └── en │ │ │ └── doc.yaml │ ├── packages │ │ ├── dev │ │ │ ├── index.html │ │ │ └── apixDevPackageIllustration │ │ │ │ ├── devpack │ │ │ │ ├── model │ │ │ │ │ ├── index.html │ │ │ │ │ ├── sudb │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ ├── adapter │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ └── userAdapter.php │ │ │ │ │ │ ├── builder │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ └── userBuilder.php │ │ │ │ │ │ └── user.php │ │ │ │ │ ├── tables.yaml │ │ │ │ │ └── modelVar.php │ │ │ │ ├── migrations │ │ │ │ │ ├── index.html │ │ │ │ │ ├── schemas │ │ │ │ │ │ └── index.html │ │ │ │ │ └── seeds │ │ │ │ │ │ └── index.html │ │ │ │ └── repository │ │ │ │ │ └── index.html │ │ │ │ ├── source │ │ │ │ └── bundle │ │ │ │ │ ├── index.html │ │ │ │ │ └── apixDevPackageSourceIllustration │ │ │ │ │ ├── index.html │ │ │ │ │ ├── src │ │ │ │ │ └── index.html │ │ │ │ │ ├── apixDevPackageSourceIllustrationInterface.php │ │ │ │ │ └── index.php │ │ │ │ ├── developer.php │ │ │ │ ├── toolBox.php │ │ │ │ ├── serviceConf.php │ │ │ │ ├── getServiceInterface.php │ │ │ │ ├── getService.php │ │ │ │ └── app.php │ │ ├── index.html │ │ ├── providers │ │ │ ├── index.html │ │ │ ├── database │ │ │ │ ├── index.html │ │ │ │ ├── sudb │ │ │ │ │ ├── index.html │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── README.md │ │ │ │ │ ├── composer.json │ │ │ │ │ ├── src │ │ │ │ │ │ ├── utils.php │ │ │ │ │ │ ├── model.php │ │ │ │ │ │ ├── joinBuilderOperation.php │ │ │ │ │ │ └── whereBuilderOperation.php │ │ │ │ │ └── test.php │ │ │ │ ├── doctrine │ │ │ │ │ ├── index.html │ │ │ │ │ ├── bootstrap.dist.php │ │ │ │ │ ├── config.php │ │ │ │ │ └── DoctrineEntityManager.php │ │ │ │ ├── eloquent │ │ │ │ │ ├── index.html │ │ │ │ │ ├── eloquentCapsule.php │ │ │ │ │ └── eloquentConnection.php │ │ │ │ └── mongodb │ │ │ │ │ └── builder.php │ │ │ ├── webservice │ │ │ │ ├── README.md │ │ │ │ └── src │ │ │ │ │ ├── soapClient.php │ │ │ │ │ ├── simpleXml.php │ │ │ │ │ └── jsonClient.php │ │ │ ├── search │ │ │ │ ├── searchInterface.php │ │ │ │ └── search.php │ │ │ ├── auth │ │ │ │ └── src │ │ │ │ │ ├── register │ │ │ │ │ ├── redis.php │ │ │ │ │ ├── config.php │ │ │ │ │ └── session.php │ │ │ │ │ ├── driver │ │ │ │ │ ├── mongo.php │ │ │ │ │ ├── redis.php │ │ │ │ │ └── database.php │ │ │ │ │ ├── encrypt │ │ │ │ │ └── math.php │ │ │ │ │ ├── authenticate.php │ │ │ │ │ └── builder │ │ │ │ │ └── sudb.php │ │ │ └── migrations │ │ │ │ └── consoleColors.php │ │ └── auto │ │ │ ├── csrf │ │ │ ├── README.md │ │ │ └── csrf.php │ │ │ ├── translations │ │ │ ├── README.md │ │ │ └── translations.php │ │ │ ├── login │ │ │ └── login.php │ │ │ ├── logout │ │ │ └── logout.php │ │ │ ├── facebook │ │ │ └── facebook.php │ │ │ └── app │ │ │ └── app.php │ ├── services │ │ ├── index.html │ │ ├── outputResolver.php │ │ ├── search.php │ │ ├── sparseFilter.php │ │ ├── httpCsrfToken.php │ │ ├── date.php │ │ ├── mobileDetect.php │ │ ├── pipeline.php │ │ ├── repository.php │ │ ├── guzzle.php │ │ ├── event.php │ │ ├── fileProcess.php │ │ ├── settings.php │ │ ├── httpSession.php │ │ ├── rabbitMQ.php │ │ ├── platform.php │ │ ├── pushNotifications.php │ │ ├── httprequest.php │ │ ├── cache.php │ │ ├── faker.php │ │ └── appcollection.php │ ├── migrations │ │ ├── seeds │ │ │ ├── index.html │ │ │ └── users_seed.php │ │ └── schemas │ │ │ └── index.html │ ├── config │ │ ├── storeRepository.php │ │ ├── runner.php │ │ ├── statusCodes.php │ │ └── dbConnector.php │ └── server │ │ └── requirements.php ├── boot │ ├── VerifyCsrfToken.php │ ├── OnceForKernel.php │ └── EncryptKeyForUser.php ├── kernel.php └── helpers.php ├── external └── public │ ├── admin │ ├── index.html │ ├── board │ │ └── index.html │ ├── config │ │ ├── app.js │ │ └── env.js │ ├── template │ │ └── index.html │ └── widgets │ │ └── index.html │ └── declarations │ └── apidoc_files │ ├── api_project.js │ ├── locale.js │ ├── de.js │ ├── prettify.css │ ├── polyfill.js │ ├── css │ ├── index.js │ └── send_sample_request.js ├── _config.yml ├── favicon.ico ├── phpmig.phar ├── README.md ├── tests └── FooTest.php ├── .env.example ├── .travis.yml ├── .gitignore ├── phpunit.xml ├── .htaccess ├── cli-config.php ├── package.json ├── LICENSE ├── index.php ├── node-cli.js ├── node.js ├── composer.json └── api /src/app/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/storage/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /external/public/admin/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/services/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/storage/lang/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /external/public/admin/board/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /external/public/admin/config/app.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /external/public/admin/config/env.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/migrations/seeds/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /external/public/admin/template/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /external/public/admin/widgets/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/migrations/schemas/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/webservice/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/doctrine/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/eloquent/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aligurbuz/apix/HEAD/favicon.ico -------------------------------------------------------------------------------- /phpmig.phar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aligurbuz/apix/HEAD/phpmig.phar -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/source/bundle/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/migrations/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/repository/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/migrations/schemas/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/migrations/seeds/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/adapter/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/builder/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/tables.yaml: -------------------------------------------------------------------------------- 1 | tables: 2 | - users 3 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/source/bundle/apixDevPackageSourceIllustration/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/source/bundle/apixDevPackageSourceIllustration/src/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/README.md: -------------------------------------------------------------------------------- 1 | # Sudb-Orm 2 | ``` 3 | composer require aligurbuz/sudb-orm 4 | 5 | ``` 6 | 7 | -------------------------------------------------------------------------------- /src/store/packages/auto/csrf/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Usage 3 | 4 | ``` 5 | http://ip/folder_name/service/project_name/csrf/index 6 | 7 | ``` -------------------------------------------------------------------------------- /src/store/packages/auto/translations/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Usage 3 | 4 | ``` 5 | http://ip/folder_name/service/project_name/translations/index?lang=:lang&yaml=:yamlFile 6 | 7 | ``` -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/developer.php: -------------------------------------------------------------------------------- 1 | null 9 | ]; 10 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/toolBox.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'url'=>null 10 | ] 11 | ]; 12 | -------------------------------------------------------------------------------- /tests/FooTest.php: -------------------------------------------------------------------------------- 1 | assertEquals(0, count($stack)); 10 | } 11 | } 12 | ?> -------------------------------------------------------------------------------- /src/boot/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'php api project create mobi', 10 | 'php api service create mobi:stk', 11 | 'php api model create mobi file:user table:users' 12 | ] 13 | ]; 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # see http://about.travis-ci.org/docs/user/languages/php/ for more hints 2 | language: php 3 | 4 | # list any PHP version you want to test against 5 | php: 6 | - 7.0 7 | 8 | 9 | before_script: 10 | - composer update 11 | - cp .env.example .env 12 | - php api project create mobi 13 | - php api service create mobi:stk -------------------------------------------------------------------------------- /src/boot/OnceForKernel.php: -------------------------------------------------------------------------------- 1 | false, 16 | 17 | ]; 18 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/getServiceInterface.php: -------------------------------------------------------------------------------- 1 | [ 10 | 'sudo apt-get install -y nodejs', 11 | 'sudo apt-get install npm', 12 | 'sudo npm cache clean -f', 13 | 'sudo npm install -g n', 14 | 'sudo n stable', 15 | 'sudo n latest' 16 | ] 17 | 18 | ]; -------------------------------------------------------------------------------- /src/kernel.php: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | tests 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/store/storage/lang/en/doc.yaml: -------------------------------------------------------------------------------- 1 | general : Home 2 | services : Api Services 3 | noService : No Service 4 | homeintro : Project Version Api Documentation 5 | homeintrosub : Documentation Versioning Information 6 | contentintro : Service Api Declaration 7 | contentintrosub : Service Introduce 8 | contentintrosubdesc : Service description 9 | example_usage : Example Usage 10 | get_param : Get Parameter 11 | field : Field 12 | type : Type 13 | description : Description 14 | response_object : Response Objects 15 | error_response : Error Response Objects 16 | header_param : Header Client Parameter 17 | post_param : Post Parameter 18 | value : Value -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/src/utils.php: -------------------------------------------------------------------------------- 1 | get($class); 17 | } 18 | 19 | } 20 | } -------------------------------------------------------------------------------- /src/store/packages/providers/search/searchInterface.php: -------------------------------------------------------------------------------- 1 | '?@@?@@?@@?@@?@@?', 23 | 'execute'=>'1@@usertest@@123456@@test@gmail.com@@1504016953@@1504016953' 24 | ]; 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/source/bundle/apixDevPackageSourceIllustration/apixDevPackageSourceIllustrationInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | 7 | RewriteEngine On 8 | 9 | RewriteRule ^(vendor/|src/|lib/|docs/|tests/|testApplication/|node/) - [F,L,NC] 10 | 11 | # Redirect Trailing Slashes If Not A Folder... 12 | RewriteCond %{REQUEST_FILENAME} !-d 13 | RewriteRule ^(.*)/$ /$1 [L,R=301] 14 | 15 | # Handle Front Controller... 16 | RewriteCond %{REQUEST_FILENAME} !-d 17 | RewriteCond %{REQUEST_FILENAME} !-f 18 | RewriteRule ^ index.php [L] 19 | 20 | # Handle Authorization Header 21 | RewriteCond %{HTTP:Authorization} . 22 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 23 | 24 | -------------------------------------------------------------------------------- /src/store/services/outputResolver.php: -------------------------------------------------------------------------------- 1 | data=$data; 29 | } 30 | 31 | /** 32 | * get run. 33 | * 34 | */ 35 | public function getResult(){ 36 | return $this->data; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/store/packages/auto/login/login.php: -------------------------------------------------------------------------------- 1 | persistent()===false && auth()->check()===false){ 15 | 16 | //attempt auth 17 | if(auth()->attempt()!==false){ 18 | 19 | return [ 20 | 'result'=>auth()->getToken() 21 | ]; 22 | } 23 | throw new \InvalidArgumentException('Incorrect credentials'); 24 | } 25 | 26 | //if auth is true,you logged exception 27 | throw new \LogicException('you are already logged'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/store/config/statusCodes.php: -------------------------------------------------------------------------------- 1 | 200, 15 | 'POST' =>201, 16 | 'PUT' =>200, 17 | 'PATCH' =>200, 18 | 'DELETE' =>200 19 | ]; 20 | -------------------------------------------------------------------------------- /src/store/packages/auto/logout/logout.php: -------------------------------------------------------------------------------- 1 | persistent()){ 24 | 25 | //logout auth 26 | return ['logout'=>auth()->logout()]; 27 | } 28 | 29 | //if auth is false,you are not logged 30 | throw new \LogicException('Any logged procces is not available'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/api_project.js: -------------------------------------------------------------------------------- 1 | define({ 2 | "name": "apidoc-example", 3 | "version": "0.3.0", 4 | "description": "apiDoc example project", 5 | "template": { 6 | "withCompare": true, 7 | "withGenerator": true 8 | }, 9 | "header": { 10 | "content": "

Welcome to apiDoc

\n

Please visit apidocjs.com with the full documentation.

\n" 11 | }, 12 | "footer": { 13 | "content": "

Epilogue

\n

Suggestions, contact, support and error reporting on GitHub

\n" 14 | }, 15 | "order": [ 16 | "GetUser", 17 | "PostUser" 18 | ], 19 | "generator": { 20 | "version": "0.9.0", 21 | "time": "2014-11-28T14:51:50.677Z" 22 | }, 23 | "apidoc": "0.2.0" 24 | }); -------------------------------------------------------------------------------- /cli-config.php: -------------------------------------------------------------------------------- 1 | search=new searchEngine(); 33 | } 34 | 35 | /** 36 | * get run. 37 | * 38 | */ 39 | public function driver($driver=null){ 40 | return $this->search->runEngineHandle($driver); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/store/packages/auto/translations/translations.php: -------------------------------------------------------------------------------- 1 | (https://github.com/aligurbuz)", 18 | "license": "ISC", 19 | "bugs": { 20 | "url": "https://github.com/aligurbuz/apix/issues" 21 | }, 22 | "homepage": "https://github.com/aligurbuz/apix#readme", 23 | "keywords": [ 24 | "apix" 25 | ], 26 | "dependencies": { 27 | "async": "^2.5.0", 28 | "body-parser": "^1.17.2", 29 | "express": "^4.15.4", 30 | "n-cli": "^1.2.15", 31 | "request": "^2.81.0", 32 | "serve-favicon": "^2.4.3", 33 | "socket.io": "^2.0.3", 34 | "ws": "^3.1.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/store/services/sparseFilter.php: -------------------------------------------------------------------------------- 1 | request=new Request(); 34 | } 35 | /** 36 | * @param $callback 37 | * @return string 38 | */ 39 | public function filter($callback){ 40 | 41 | //$call=call_user_func($callback); 42 | return [ 43 | 'key'=>'sparse' 44 | ]; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/doctrine/bootstrap.dist.php: -------------------------------------------------------------------------------- 1 | 'driver', 18 | 'host'=>'host', 19 | 'user'=>'user', 20 | 'password'=>'password', 21 | 'dbname'=>'dbname', 22 | ); 23 | 24 | $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); 25 | $driver = new AnnotationDriver(new AnnotationReader(), $paths); 26 | 27 | // registering noop annotation autoloader - allow all annotations by default 28 | AnnotationRegistry::registerLoader('class_exists'); 29 | $config->setMetadataDriverImpl($driver); 30 | $entityManager = EntityManager::create($dbParams, $config); 31 | 32 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/doctrine/config.php: -------------------------------------------------------------------------------- 1 | dbParams = array( 33 | 'driver' => 'pdo_'.$dbConfig['driver'], 34 | 'host' => $dbConfig['host'], 35 | 'user' => $dbConfig['user'], 36 | 'password' => $dbConfig['password'], 37 | 'dbname' => $dbConfig['database'], 38 | ); 39 | 40 | } 41 | 42 | 43 | } -------------------------------------------------------------------------------- /src/store/packages/auto/csrf/csrf.php: -------------------------------------------------------------------------------- 1 | session=app("session"); 25 | } 26 | 27 | /** 28 | * csrf route is main method. 29 | * 30 | * @return array 31 | */ 32 | public function indexAction(){ 33 | 34 | //check session for postToken 35 | if($this->session->has("postToken")===false){ 36 | $token=new csrfToken(); 37 | $tokenSet=$this->session->set("postToken",$token->GenerateToken()); 38 | } 39 | return ['postToken'=>$this->session->get("postToken")]; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/builder/userBuilder.php: -------------------------------------------------------------------------------- 1 | [ 16 | 'id'=>'desc' 17 | ] 18 | ]; 19 | } 20 | 21 | /** 22 | * @var paginator. 23 | * 24 | * @info your result is automatically paginated 25 | * @status optional 26 | * @return array 27 | */ 28 | public function paginator(){ 29 | 30 | return [ 31 | 'auto'=>10 32 | ]; 33 | } 34 | 35 | /** 36 | * @var resultDataInfo. 37 | * 38 | * @info this value changes default result data info 39 | * @example coultAllData=>'total' 40 | * @status optional 41 | * @return array 42 | */ 43 | public function resultDataInfo(){ 44 | 45 | return []; 46 | } 47 | } -------------------------------------------------------------------------------- /src/store/services/httpCsrfToken.php: -------------------------------------------------------------------------------- 1 | setUp(); 31 | 32 | } 33 | public static function setUpBeforeClass() 34 | { 35 | self::$bytes = base64_decode('aMf+Tct/RLn2WQ=='); 36 | } 37 | protected function setUp() 38 | { 39 | $this->generator = new UriSafeTokenGenerator(self::ENTROPY); 40 | } 41 | protected function tearDown() 42 | { 43 | $this->generator = null; 44 | } 45 | public function GenerateToken() 46 | { 47 | return $this->generator->generateToken(); 48 | 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/store/packages/providers/search/search.php: -------------------------------------------------------------------------------- 1 | search; 41 | } 42 | else{ 43 | $searchDriver=$driver; 44 | } 45 | 46 | $search='src\store\\packages\\providers\\search\\'.$searchDriver.'\\search'; 47 | return utils::resolve($search); 48 | } 49 | 50 | 51 | 52 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | <<<<<<< HEAD 4 | Copyright (c) 2016 Ali Gürbüz 5 | ======= 6 | Copyright (c) 2017 apixphp 7 | >>>>>>> ce5169b146df6fdacc24ab9e0d1a253725ab05c7 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in all 17 | copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/register/redis.php: -------------------------------------------------------------------------------- 1 | config =$config; 40 | $this->data =$this->config->query['results'][0]; 41 | $this->session =app('session'); 42 | } 43 | 44 | /** 45 | * @method register 46 | */ 47 | public function register(){ 48 | 49 | //make something 50 | } 51 | 52 | 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/store/services/date.php: -------------------------------------------------------------------------------- 1 | timezone(date_default_timezone_get())->diffForHumans(); 34 | } 35 | 36 | /** 37 | * carbon date get data. 38 | * 39 | * @return carbon class 40 | */ 41 | public function date($int) 42 | { 43 | Carbon::setLocale('en'); 44 | //date_default_timezone_set('Europe/London'); 45 | return Carbon::createFromTimestamp($int)->timezone(date_default_timezone_get()); 46 | } 47 | 48 | public function test(){ 49 | return 'test'; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/eloquent/eloquentConnection.php: -------------------------------------------------------------------------------- 1 | capsule = new Capsule; 16 | $config="\\src\\app\\".app."\\".version."\\config\\database"; 17 | $configdb=$config::dbsettings(); 18 | 19 | $this->capsule->addConnection([ 20 | 'driver' => $configdb['driver'], 21 | 'host' => $configdb['host'], 22 | 'database' => $configdb['database'], 23 | 'username' => $configdb['user'], 24 | 'password' => $configdb['password'], 25 | 'charset' => 'utf8', 26 | 'collation' => 'utf8_unicode_ci', 27 | 'prefix' => '', 28 | ]); 29 | 30 | // Make this Capsule instance available globally via static methods... (optional) 31 | $this->capsule->setAsGlobal(); 32 | 33 | // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) 34 | $this->capsule->bootEloquent(); 35 | } 36 | } -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/de.js: -------------------------------------------------------------------------------- 1 | define({ 2 | de: { 3 | 'Allowed values:' : 'Erlaubte Werte:', 4 | 'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern', 5 | 'compare changes to:' : 'vergleiche Änderungen mit:', 6 | 'compared to' : 'verglichen mit', 7 | 'Default value:' : 'Standardwert:', 8 | 'Description' : 'Beschreibung', 9 | 'Field' : 'Feld', 10 | 'General' : 'Allgemein', 11 | 'Generated with' : 'Erstellt mit', 12 | 'Name' : 'Name', 13 | 'No response values.' : 'Keine Rückgabewerte.', 14 | 'optional' : 'optional', 15 | 'Parameter' : 'Parameter', 16 | 'Permission:' : 'Berechtigung:', 17 | 'Response' : 'Antwort', 18 | 'Send' : 'Senden', 19 | 'Send a Sample Request' : 'Eine Beispielanfrage senden', 20 | 'show up to version:' : 'zeige bis zur Version:', 21 | 'Size range:' : 'Größenbereich:', 22 | 'Type' : 'Typ', 23 | 'url' : 'url' 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/getService.php: -------------------------------------------------------------------------------- 1 | source->apixDevPackageSourceIllustration()->get(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/store/services/mobileDetect.php: -------------------------------------------------------------------------------- 1 | mobile=new \Mobile_Detect; 33 | 34 | } 35 | 36 | /** 37 | * get isMobile. 38 | * 39 | * @return bool true|false 40 | */ 41 | public function isMobile(){ 42 | 43 | return $this->mobile->isMobile(); 44 | } 45 | 46 | /** 47 | * get isTable. 48 | * 49 | * @return bool true|false 50 | */ 51 | public function isTablet(){ 52 | 53 | return $this->mobile->isTablet(); 54 | } 55 | 56 | /** 57 | * @method is 58 | * @param $data 59 | * @return bool true|false 60 | */ 61 | public function is($data){ 62 | 63 | return $this->mobile->is($data); 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/source/bundle/apixDevPackageSourceIllustration/index.php: -------------------------------------------------------------------------------- 1 | pipeline=StaticPathModel::getAppServicePipeline(); 26 | } 27 | 28 | /** 29 | * @param $name 30 | * @param $args 31 | * @return mixed 32 | */ 33 | public function __call($name,$args){ 34 | 35 | $this->pipe=$name; 36 | return $this->callPipes(); 37 | } 38 | 39 | 40 | public function callPipes(){ 41 | 42 | $callPipes=$this->pipeline->{$this->pipe}(); 43 | 44 | $pipelineList=[]; 45 | $pipelineCallBack=[]; 46 | foreach ($callPipes as $key=>$pipelines){ 47 | 48 | foreach ($pipelines as $pipelineClass=>$pipelineMethod){ 49 | 50 | if(count($pipelineList)){ 51 | 52 | $pipelineCallBack[]=call_user_func([Utils::makeBind($pipelineClass),$pipelineMethod],end($pipelineList)); 53 | } 54 | 55 | $pipelineList[]=Utils::makeBind($pipelineClass)->$pipelineMethod(); 56 | } 57 | } 58 | 59 | return end($pipelineCallBack); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/doctrine/DoctrineEntityManager.php: -------------------------------------------------------------------------------- 1 | paths, $this->isDevMode); 21 | $driver = new AnnotationDriver(new AnnotationReader(), $this->paths); 22 | 23 | // registering noop annotation autoloader - allow all annotations by default 24 | AnnotationRegistry::registerLoader('class_exists'); 25 | $config->setMetadataDriverImpl($driver); 26 | $entityManager = EntityManager::create($this->dbParams(), $config); 27 | 28 | if(defined('devPackage')){ 29 | return $entityManager->getRepository('src\\store\\packages\\dev\\'.service.'\\devpack\\model\\doctrine\\'.$model); 30 | } 31 | 32 | return $entityManager->getRepository('src\app\\'.app.'\\'.version.'\model\doctrine\\'.$model); 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /src/store/services/repository.php: -------------------------------------------------------------------------------- 1 | $name($arguments); 59 | } 60 | throw new \BadFunctionCallException('Not available repo you want'); 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/adapter/userAdapter.php: -------------------------------------------------------------------------------- 1 | builder=$builder; 21 | } 22 | 23 | /** 24 | * model user get method 25 | * @return array @method 26 | */ 27 | public function get() 28 | { 29 | return $this->builder->get(); 30 | } 31 | 32 | /** 33 | * model user create method 34 | * @return array @method 35 | */ 36 | public function create($post=array()) 37 | { 38 | return $this->builder->create($post); 39 | } 40 | 41 | /** 42 | * model user update method 43 | * @return array @method 44 | */ 45 | public function update($post=array()) 46 | { 47 | return $this->builder->update($post); 48 | } 49 | 50 | /** 51 | * model user delete method 52 | * @return array @method 53 | */ 54 | public function delete($post=array()) 55 | { 56 | return $this->builder->delete($post); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/app.php: -------------------------------------------------------------------------------- 1 | source=\branch::source(); 38 | $this->model=\branch::query(); 39 | $this->main=\branch::main(); 40 | parent::__construct(); 41 | } 42 | 43 | 44 | /** 45 | * service restrictions method. 46 | * 47 | * @param prepared functions and objects 48 | * request method : super service call 49 | * main overloading method as restrictions 50 | * @return array 51 | */ 52 | public function restrictions() 53 | { 54 | $list=[]; 55 | return $list; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/driver/mongo.php: -------------------------------------------------------------------------------- 1 | config=$config; 34 | } 35 | 36 | /** 37 | * @param array $credentials 38 | * @return null 39 | */ 40 | public function attempt($credentials=array()){ 41 | 42 | //make somethings 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/driver/redis.php: -------------------------------------------------------------------------------- 1 | config=$config; 34 | } 35 | 36 | /** 37 | * @param array $credentials 38 | * @return null 39 | */ 40 | public function attempt($credentials=array()){ 41 | 42 | //make somethings 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/encrypt/math.php: -------------------------------------------------------------------------------- 1 | config=$config; 45 | $this->data_id=$this->config->data['id']; 46 | $this->request=new Request(); 47 | } 48 | 49 | /** 50 | * @method register 51 | */ 52 | public function register(){ 53 | 54 | return $this->data_id * \ip2long($this->request->getClientIp()); 55 | } 56 | 57 | /** 58 | * @param $id 59 | * @method resolve 60 | * @return mixed 61 | */ 62 | public function resolve($id){ 63 | 64 | return $id / \ip2long($this->request->getClientIp()); 65 | } 66 | 67 | 68 | } 69 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | register(); 46 | 47 | //get connection 48 | echo \Apix\connection::run(); -------------------------------------------------------------------------------- /node-cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env '+this.argv['dir']+' 2 | 3 | /** 4 | * boardDir is path that in external/public,that is admin directory 5 | * widgetFile is path that in external/public/boardDir/widgets,that is admin widgets 6 | * boardFile is path that in external/public/boardDir/board,that is admin board -- dashboard 7 | * partChangeAble starts with @@@ --- it is for boardFile 8 | * 9 | */ 10 | //using : node node-cli board --app boardDir --widgets widgetFile --board boardFile --change partChangeAble 11 | 12 | "use strict"; 13 | 14 | var path = require('path'); 15 | var appDir = path.dirname(require.main.filename); 16 | 17 | var Cli = new require("n-cli"); 18 | var cli = new Cli({ 19 | silent: false, 20 | handleUncaughtException : true 21 | }); 22 | 23 | cli.on("board", function(){ 24 | 25 | var fs = require('fs'); 26 | fs = require('fs'); 27 | 28 | var app=this.argv['app']; 29 | var widget=this.argv['widgets']; 30 | var board=this.argv['board']; 31 | var change=this.argv['change']; 32 | 33 | var boardFile='./external/public/'+app+'/board/'+board; 34 | var widgetFile='./external/public/'+app+'/widgets/'+widget; 35 | 36 | fs.readFile(widgetFile, 'utf8', function (err,data) { 37 | if (err) { 38 | return console.log(err); 39 | } 40 | 41 | fs.readFile(boardFile, 'utf8', function (err,boardData) { 42 | if (err) { 43 | return console.log(err); 44 | } 45 | 46 | var changeData=boardData.replace(new RegExp("@@@"+change, "g"),data); 47 | 48 | 49 | fs.writeFile(boardFile, changeData, function (err) { 50 | if (err) return console.log(err); 51 | console.log('board ok'); 52 | 53 | }); 54 | 55 | }); 56 | 57 | 58 | }); 59 | 60 | }); 61 | -------------------------------------------------------------------------------- /src/helpers.php: -------------------------------------------------------------------------------- 1 | getLocalization(),$getbase->getLocalization()); 61 | } 62 | return \Apix\LanguageDefinitor::get($data,$langname,$getbase->getLocalization()); 63 | 64 | } 65 | return null; 66 | } 67 | } -------------------------------------------------------------------------------- /node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | /** 3 | * get path for main directory. 4 | * 5 | * @param {object} req 6 | * @public 7 | */ 8 | 9 | /** 10 | * get path for main directory. 11 | * 12 | * @param {object} req 13 | * @public 14 | */ 15 | global.path = require('path'); 16 | global.appDir = path.dirname(require.main.filename); 17 | 18 | /** 19 | * Start express project. 20 | * 21 | * @param {object} req 22 | * @public 23 | */ 24 | var express=require("express"); 25 | 26 | /** 27 | * get express method--top level 28 | * 29 | * @param {object} req 30 | * @public 31 | */ 32 | var app=express(); 33 | 34 | /** 35 | * Get config for app settings. 36 | * 37 | * @param {object} req 38 | * @public config.js 39 | */ 40 | global.async = require("async"); 41 | 42 | var http = require('http').Server(app); 43 | 44 | /** 45 | * express route body parser . 46 | * 47 | * @param {object} req 48 | * @public 49 | */ 50 | var bodyParser = require('body-parser'); 51 | app.use(bodyParser.json()); // support json encoded bodies 52 | app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies 53 | 54 | var favicon = require('serve-favicon'); 55 | app.use(favicon(__dirname + '/favicon.ico')); 56 | 57 | /** 58 | * express route . 59 | * 60 | * @param {object} req 61 | * @public 62 | */ 63 | app.all("/:app/:node/:token",function (request,response,next){ 64 | 65 | if(request.params.name=="favicon.ico") 66 | { 67 | response.send("favicon.ico") 68 | } 69 | 70 | /** 71 | * Get base config for app. 72 | * 73 | * @param {object} req 74 | * @public config.js 75 | */ 76 | global.base = require("./src/app/"+request.params.app+"/kernel/node/app.js"); 77 | 78 | response.setHeader('Content-Type', 'application/json'); 79 | base.config(request,function(resultData){ 80 | response.json(resultData); 81 | }) 82 | }); 83 | 84 | http.listen(3000); -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aligurbuz/apix", 3 | "description": "Simple restful API service with php", 4 | "type": "json", 5 | "authors": [ 6 | { 7 | "name": "aligurbuz", 8 | "email": "galiant781@gmail.com" 9 | } 10 | ], 11 | "repositories": { 12 | "packagist": { "url": "https://packagist.org", "type": "composer" } 13 | }, 14 | "require": { 15 | "apixphp/restapixlib":"dev-master", 16 | "php-di/php-di": "^5.4", 17 | "ocramius/proxy-manager": "~1.0|~2.0", 18 | "symfony/yaml": "2.*", 19 | "sinergi/browser-detector": "^6.1", 20 | "nesbot/carbon": "^1.21", 21 | "symfony/http-foundation": "^3.2", 22 | "mobiledetect/mobiledetectlib": "^2.8", 23 | "predis/predis": "^1.0", 24 | "symfony/var-dumper": "*", 25 | "monolog/monolog": "^1.22", 26 | "symfony/console": "^3.2", 27 | "symfony/debug": "^3.2", 28 | "vlucas/phpdotenv": "^2.4", 29 | "guzzlehttp/guzzle": "^6.2", 30 | "symfony/finder": "^3.3", 31 | "symfony/security-csrf": "^3.2", 32 | "symfony/filesystem": "^3.2", 33 | "elasticsearch/elasticsearch": "~5.0", 34 | "twig/twig": "~1.0", 35 | "symfony/cache": "^3.2", 36 | "respect/validation": "^1.1", 37 | "tightenco/collect": "^5.4", 38 | "illuminate/database": "^5.4", 39 | "illuminate/pagination": "^5.4", 40 | "symfony/event-dispatcher": "^3.2", 41 | "fzaninotto/faker": "^1.6", 42 | "spatie/array-to-xml": "^2.3", 43 | "facebook/graph-sdk": "^5.5", 44 | "league/pipeline": "^0.3.0", 45 | "phpunit/phpunit": "^6.3" 46 | }, 47 | "autoload": { 48 | "files": ["src/helpers.php"] 49 | }, 50 | "require-dev": { 51 | "mockery/mockery": "^0.9.7", 52 | "symfony/process": "^3.2", 53 | "phploc/phploc": "^4.0" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/prettify.css: -------------------------------------------------------------------------------- 1 | /* Pretty printing styles. Used with prettify.js. */ 2 | /* Vim sunburst theme by David Leibovic */ 3 | pre .str { 4 | color: #65B042; 5 | } 6 | /* string - green */ 7 | pre .kwd { 8 | color: #E28964; 9 | } 10 | /* keyword - dark pink */ 11 | pre .com { 12 | color: #AEAEAE; 13 | font-style: italic; 14 | } 15 | /* comment - gray */ 16 | pre .typ { 17 | color: #89bdff; 18 | } 19 | /* type - light blue */ 20 | pre .lit { 21 | color: #3387CC; 22 | } 23 | /* literal - blue */ 24 | pre .pun { 25 | color: #fff; 26 | } 27 | /* punctuation - white */ 28 | pre .pln { 29 | color: #fff; 30 | } 31 | /* plaintext - white */ 32 | pre .tag { 33 | color: #89bdff; 34 | } 35 | /* html/xml tag - light blue */ 36 | pre .atn { 37 | color: #bdb76b; 38 | } 39 | /* html/xml attribute name - khaki */ 40 | pre .atv { 41 | color: #65B042; 42 | } 43 | /* html/xml attribute value - green */ 44 | pre .dec { 45 | color: #3387CC; 46 | } 47 | /* decimal - blue */ 48 | /* Specify class=linenums on a pre to get line numbering */ 49 | ol.linenums { 50 | margin-top: 0; 51 | margin-bottom: 0; 52 | color: #AEAEAE; 53 | } 54 | /* IE indents via margin-left */ 55 | li.L0, 56 | li.L1, 57 | li.L2, 58 | li.L3, 59 | li.L5, 60 | li.L6, 61 | li.L7, 62 | li.L8 { 63 | list-style-type: none; 64 | } 65 | /* Alternate shading for lines */ 66 | @media print { 67 | pre .str { 68 | color: #060; 69 | } 70 | pre .kwd { 71 | color: #006; 72 | font-weight: bold; 73 | } 74 | pre .com { 75 | color: #600; 76 | font-style: italic; 77 | } 78 | pre .typ { 79 | color: #404; 80 | font-weight: bold; 81 | } 82 | pre .lit { 83 | color: #044; 84 | } 85 | pre .pun { 86 | color: #440; 87 | } 88 | pre .pln { 89 | color: #000; 90 | } 91 | pre .tag { 92 | color: #006; 93 | font-weight: bold; 94 | } 95 | pre .atn { 96 | color: #404; 97 | } 98 | pre .atv { 99 | color: #060; 100 | } 101 | } -------------------------------------------------------------------------------- /src/store/services/guzzle.php: -------------------------------------------------------------------------------- 1 | client=new Client(); 34 | } 35 | 36 | 37 | /** 38 | * guzzle http request get data. 39 | * 40 | * @return guzzle class 41 | */ 42 | public function get($url=null,$responseObject=null,$params=array()){ 43 | 44 | //get response guzzle 45 | try { 46 | $response = $this->client->request("GET",$url,$params); 47 | } 48 | catch (\GuzzleHttp\Exception\ClientException $e) { 49 | throw new \LogicException('Webservice caught response: ' . $e->getResponse()->getBody()); 50 | } 51 | 52 | 53 | define('guzzleOutPutter',$responseObject,true); 54 | 55 | if($responseObject==null OR $responseObject=='json'){ 56 | return json_decode($response->getBody()->getContents(),1); 57 | } 58 | return $response->getBody()->getContents(); 59 | } 60 | 61 | /** 62 | * guzzle http request post data. 63 | * 64 | * @return guzzle class 65 | */ 66 | public function post($url=null,$postdata=array(),$responseObject=null){ 67 | //get response guzzle 68 | $response = $this->client->request("POST",$url,[ 69 | 'form_params'=>$postdata 70 | ]); 71 | 72 | if($responseObject==null OR $responseObject=='json'){ 73 | return json_decode($response->getBody()->getContents(),1); 74 | } 75 | } 76 | 77 | 78 | 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/src/model.php: -------------------------------------------------------------------------------- 1 | getSubClassOf($subClassOf); 34 | return $instance->getQuery($name,$args); 35 | } 36 | 37 | /** 38 | * getQuery method is main method. 39 | * 40 | * @return array 41 | */ 42 | public function getQuery($name,$args){ 43 | $model=utils::resolve("\\src\\store\\packages\providers\\database\\sudb\\src\\builder"); 44 | $model->subClassOf($this->subClassOf); 45 | if($name=="where"){ 46 | if(array_key_exists(0,$args)){ 47 | if(!is_callable($args[0])){ 48 | if(array_key_exists(1,$args) && array_key_exists(2,$args)){ 49 | return $model->where($args[0],$args[1],$args[2],$model); 50 | } 51 | else{ 52 | return $model->where(null,null,null,$model); 53 | } 54 | 55 | } 56 | else{ 57 | return $model->where($args[0],$model); 58 | } 59 | } 60 | else{ 61 | return $model->where(null,null,null,$model); 62 | } 63 | 64 | 65 | } 66 | 67 | return $model->$name($args,$model); 68 | 69 | 70 | } 71 | 72 | 73 | /** 74 | * getQuery method is main method. 75 | * 76 | * @return array 77 | */ 78 | public function getSubClassOf($class=null){ 79 | if($class!==null){ 80 | $this->subClassOf=utils::resolve($class); 81 | } 82 | 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /src/store/packages/providers/database/mongodb/builder.php: -------------------------------------------------------------------------------- 1 | connection=(new \MongoDB\Client)->$database; 42 | } 43 | 44 | public function collection($collection=null){ 45 | 46 | if($collection===null){ 47 | throw new \InvalidArgumentException('document as table is not available'); 48 | } 49 | 50 | $this->collection=$this->connection->$collection; 51 | 52 | return $this; 53 | } 54 | 55 | public function get(){ 56 | 57 | $data = $this->collection->find()->toArray(); 58 | return $this->resolve($data); 59 | } 60 | 61 | private function resolve($data){ 62 | 63 | $dataArray=json_decode(json_encode($data),1); 64 | $list=[]; 65 | foreach($dataArray as $key=>$value){ 66 | foreach($value as $column=>$columnValue){ 67 | 68 | if($column=="_id"){ 69 | $column='id'; 70 | $columnValue=$dataArray[$key]['_id']['$oid']; 71 | } 72 | 73 | $list[$key][$column]=$columnValue; 74 | } 75 | } 76 | 77 | return $list; 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/test.php: -------------------------------------------------------------------------------- 1 | 10]; 14 | 15 | //this value is run for auto order by desc 16 | public $orderBy=['auto'=>['id'=>'desc']]; 17 | 18 | //query result with this value is called from redis 19 | public $redis=['status'=>false,'expire'=>60]; 20 | 21 | //this value is created and updated time for values it will be inserted 22 | public $createdAndUpdatedFields=['created_at'=>'createdAt','updated_at'=>'updatedAt']; 23 | 24 | //this value is run for auto join type (left|inner) 25 | //protected $joiner=['auto'=>"left"]; 26 | 27 | //this value is similar field that on the joined tables 28 | /*protected $joinField=['books'=>['match'=>'BookId','joinField'=>['bookname','status/bookstatus']], 29 | 'chats'=>['hasOne'=>'userid','joinField'=>['message']] 30 | ];*/ 31 | 32 | //this value hiddens to select field 33 | //public $selectHidden=['id']; 34 | 35 | //this scope is automatically run 36 | //public $scope=['auto'=>'active']; 37 | 38 | //scope query 39 | /** 40 | * @param $data 41 | * @param $query 42 | */ 43 | public function modelScope($data,$query){ 44 | 45 | //get id 46 | if($data=="id"){ 47 | $query->where(function($model){ 48 | if(\app::checkUrlParam("id")){ 49 | $model->where("id","=",\app::getUrlParam("id")); 50 | } 51 | }); 52 | } 53 | 54 | //scopes 55 | if($data=="active"){ 56 | $query->where("status","=",1); 57 | } 58 | 59 | } 60 | 61 | //insert conditions 62 | public $insertConditions=[ 63 | 'status'=>false, 64 | 'wantedFields'=>[], 65 | 'exceptFields'=>[], 66 | 'obligatoryFields'=>[], 67 | 'queueFields'=>[] 68 | ]; 69 | 70 | //select permissions for client 71 | //header select id::username 72 | public $selectPermissions=[ 73 | 'status'=>false, 74 | 'authorized'=>'*', 75 | 'forbidden'=>[], 76 | 'tokens'=>'*', 77 | 'seperator'=>'::' 78 | ]; 79 | } -------------------------------------------------------------------------------- /src/store/services/event.php: -------------------------------------------------------------------------------- 1 | queue_path=staticPathModel::getJobPath().'\apix'; 39 | } 40 | 41 | /** 42 | * @param null $name 43 | * @param callable|null $callback 44 | * @return mixed 45 | */ 46 | public function queue($name=null, callable $callback=null){ 47 | 48 | // if name variable is a closure value 49 | // it throws an error as invalidArgumentException 50 | if($name instanceof \Closure){ 51 | throw new \InvalidArgumentException('queue name is invalid'); 52 | } 53 | 54 | // check for task according name 55 | // if an task is available called name variable 56 | if($this->checkForTaskAccordingName($name)){ 57 | 58 | // if checkForTaskAccordingName is true 59 | // queue is run 60 | $this->queueRun($name); 61 | } 62 | 63 | //callback return 64 | return call_user_func($callback); 65 | } 66 | 67 | 68 | /** 69 | * @param $name 70 | * @return boolean 71 | */ 72 | private function checkForTaskAccordingName($name){ 73 | 74 | //if a task is available for name 75 | // boolean true other boolean false 76 | if(class_exists($task=$this->queue_path.'\\'.$name.'\task')){ 77 | return true; 78 | } 79 | return false; 80 | } 81 | 82 | /** 83 | * @param $name 84 | * process runner 85 | * @return void 86 | */ 87 | private function queueRun($name){ 88 | 89 | $process = new Process('php api job run '.app.' '.$name); 90 | $process->run(); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/store/packages/auto/facebook/facebook.php: -------------------------------------------------------------------------------- 1 | accessToken=$appFacebook['accessToken']; 36 | $this->appId=$appFacebook['appId']; 37 | $this->appSecret=$appFacebook['appSecret']; 38 | $this->appVersion=$appFacebook['appVersion']; 39 | } 40 | 41 | /** 42 | * facebook route is main method. 43 | * 44 | * @return array 45 | */ 46 | public function indexAction() 47 | { 48 | $fb = new \Facebook\Facebook([ 49 | 'app_id' => $this->appId, 50 | 'app_secret' => $this->appSecret, 51 | 'default_graph_version' => $this->appVersion, 52 | 'default_access_token' => $this->accessToken, // optional 53 | ]); 54 | 55 | try { 56 | 57 | // Get the \Facebook\GraphNodes\GraphUser object for the current user. 58 | // If you provided a 'default_access_token', the '{access-token}' is optional. 59 | $response = $fb->get('/me',$this->accessToken); 60 | 61 | } catch(\Facebook\Exceptions\FacebookResponseException $e) { 62 | 63 | // When Graph returns an error 64 | return [ 65 | 66 | 'facebookSdkResult'=>'Graph returned an error: ' . $e->getMessage() 67 | ]; 68 | 69 | } catch(\Facebook\Exceptions\FacebookSDKException $e) { 70 | 71 | // When validation fails or other local issues 72 | return [ 73 | 74 | 'facebookSdkResult'=>'Facebook SDK returned an error: ' . $e->getMessage() 75 | ]; 76 | } 77 | 78 | return [ 79 | 'facebookSdkResult'=>$response->getGraphUser() 80 | ]; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/store/packages/providers/webservice/src/soapClient.php: -------------------------------------------------------------------------------- 1 | 1, 55 | 'exceptions'=>0 56 | ]); 57 | 58 | } 59 | 60 | return new static; 61 | } 62 | 63 | /** 64 | * @method __call 65 | */ 66 | public function __call($method,$args){ 67 | self::$method=$method; 68 | return new static; 69 | } 70 | 71 | 72 | /** 73 | * @method get 74 | */ 75 | public static function get($data){ 76 | 77 | /** 78 | * simple define load 79 | * return string 80 | */ 81 | define('guzzleOutPutter',app('base')->response); 82 | 83 | $soapFunction=self::$method; 84 | 85 | if($soapFunction===null){ 86 | throw new \InvalidArgumentException('Soap Function Error'); 87 | } 88 | 89 | if(method_exists(self::$soap,$soapFunction)){ 90 | return self::$soap->$soapFunction(); 91 | } 92 | 93 | dd(self::$soap->__getFunctions()); 94 | 95 | $soapData=self::$soap->$soapFunction($data); 96 | 97 | return $soapData; 98 | 99 | } 100 | 101 | 102 | /** 103 | * @method __callStatic 104 | */ 105 | public static function __callStatic($group,$args){ 106 | self::$group=$group; 107 | self::url(\app::getWebServiceConfigUrl(self::$group)); 108 | return new static; 109 | } 110 | 111 | } 112 | -------------------------------------------------------------------------------- /src/store/packages/auto/app/app.php: -------------------------------------------------------------------------------- 1 | request=$request; 32 | } 33 | 34 | /** 35 | * app route is main method. 36 | * 37 | * @return array 38 | */ 39 | public function indexAction() 40 | { 41 | /** 42 | * app settings is an array. 43 | * 44 | * @return array 45 | */ 46 | $app=[ 47 | 'app'=>[ 48 | 'app'=>app, 49 | 'version'=>version, 50 | 'host'=>$this->request->getHost(), 51 | 'isSecure'=>$this->request->isSecure() 52 | ] 53 | 54 | ]; 55 | 56 | 57 | /** 58 | * node settings is an array. 59 | * 60 | * @return array 61 | */ 62 | $node=[ 63 | 'node'=>$this->getNodeForApp() 64 | ]; 65 | 66 | /** 67 | * array_merge for result. 68 | * 69 | * @return array 70 | */ 71 | return array_merge($app,$node); 72 | } 73 | 74 | 75 | /** 76 | * @var method node service 77 | * @return array 78 | */ 79 | public function getNodeForApp(){ 80 | 81 | $query= $this->request->query(); 82 | 83 | $request=(isset($query['request'])) ? $query['request'] : 'get'; 84 | 85 | $node=staticPathModel::getServiceNamespace('node',$request); 86 | 87 | if(class_exists($node)){ 88 | $methods=utils::getClassMethods($node,true); 89 | 90 | $nodes=[]; 91 | foreach($methods as $method){ 92 | $methodAction=$method.'Action'; 93 | $nodeClass=utils::resolve($node); 94 | $nodes[$method]=$nodeClass->$methodAction(); 95 | } 96 | return $nodes; 97 | } 98 | return []; 99 | 100 | 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /api: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | register(); 34 | 35 | /** 36 | * set config 37 | */ 38 | require (\Apix\staticPathModel::$apixClassAliasPath); 39 | \Apix\environment::config(); 40 | use Apix\StaticPathModel as staticPath; 41 | use Apix\Utils; 42 | 43 | 44 | /** 45 | * System cli command main file 46 | * this snippet calls really command file for system 47 | * return class method 48 | */ 49 | if(file_exists(staticPath::$binCommandsPath.''.$argv[1].''.utils::$extension)){ 50 | 51 | /** 52 | * System cli command for spl function 53 | * this snippet calls really spl command for system 54 | * return spl method 55 | */ 56 | $commandNamespaceSpl=staticPath::$binCommandsNameSpace.''.$argv[1]; 57 | $commandFile=new $commandNamespaceSpl(); 58 | 59 | /** 60 | * System cli main class file 61 | * this snippet calls really main class file for system 62 | * return class method 63 | */ 64 | $method=$argv[2]; 65 | echo $commandFile->$method(utils::getArgForConsoleParameters($argv)).''.PHP_EOL; 66 | } 67 | else{ 68 | 69 | /** 70 | * System cli custom command main file 71 | * return class method 72 | * get base properties 73 | */ 74 | echo utils::getBaseConsoleStaticProperties($argv); 75 | 76 | 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/register/config.php: -------------------------------------------------------------------------------- 1 | config=$config; 47 | 48 | /** 49 | * push to array auth credentials 50 | * push to array auth client ip 51 | * push to array auth client http browser info 52 | */ 53 | $this->dataForHash =$this->config->getCredentials(); 54 | $this->dataForHash['ip'] =(new Request())->getClientIp(); 55 | $this->dataForHash['agent'] =$_SERVER['HTTP_USER_AGENT']; 56 | 57 | //set context hash variable 58 | $this->contextHash=$this->dataForHash; 59 | $this->setContextHash('time',time()); 60 | 61 | //id algorithm 62 | //it is for that we do not directly register auth id 63 | $this->setIdAlgorithm(); 64 | 65 | //set hash for dataForHash 66 | //it hashes md5 and sha1 67 | return $this->getContextHash(); 68 | 69 | } 70 | 71 | /** 72 | * @param $key 73 | * @param $value 74 | */ 75 | protected function setContextHash($key, $value){ 76 | 77 | //check context Hash 78 | //if it is empty,then set key value 79 | if(!isset($this->contextHash[$key])){ 80 | 81 | $this->contextHash[$key]=$value; 82 | } 83 | 84 | } 85 | 86 | /** 87 | * @method getContextHash 88 | */ 89 | protected function getContextHash(){ 90 | 91 | //context hash with id algorithm 92 | return $this->id.'_'.md5(sha1(implode(',',$this->contextHash))); 93 | } 94 | 95 | /** 96 | * @method setIdAlgorithm 97 | */ 98 | protected function setIdAlgorithm(){ 99 | 100 | //set encrypt model for id 101 | $this->id=$this->config->getAuthEncryptModel(); 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/store/config/dbConnector.php: -------------------------------------------------------------------------------- 1 | driver=$configdb['driver']; 36 | $this->host=$configdb['host']; 37 | $this->database=$configdb['database']; 38 | $this->user=$configdb['user']; 39 | $this->password=$configdb['password']; 40 | 41 | /** @var TYPE_NAME $this */ 42 | try { 43 | 44 | if(self::$instance===null){ 45 | $this->db = new \PDO(''.$this->driver.':host='.$this->host.';dbname='.$this->database.'', $this->user,$this->password); 46 | $this->db->exec("SET NAMES utf8"); 47 | $this->db->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); 48 | $this->db->setAttribute(\PDO::ATTR_EMULATE_PREPARES,false); 49 | //$this->db->setAttribute(\PDO::ATTR_PERSISTENT,true); 50 | 51 | self::$instance=$this->db; 52 | } 53 | 54 | $this->db=self::$instance; 55 | } 56 | catch (\PDOException $e) { 57 | if(environment()=="local"){ 58 | $connectionError=[ 59 | 'status'=>false, 60 | 'result'=>[ 61 | 'error'=>true, 62 | 'code'=>$e->getCode(), 63 | 'message'=>'Database Connection Error', 64 | 'trace'=>$e->getTrace() 65 | ] 66 | 67 | ]; 68 | echo json_encode($connectionError); 69 | } 70 | else{ 71 | 72 | throw new \LogicException('Production Connection Settings Error'); 73 | } 74 | 75 | exit(); 76 | } 77 | } 78 | 79 | } 80 | 81 | 82 | public function get(){ 83 | 84 | return $this->db; 85 | 86 | } 87 | 88 | public function getDriver(){ 89 | return $this->driver; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/store/services/fileProcess.php: -------------------------------------------------------------------------------- 1 | fs = new Filesystem(); 23 | } 24 | 25 | /** 26 | * filesystem mkdir method. 27 | * mkdir() creates a directory. 28 | * On POSIX filesystems, directories are created with a default mode value 0777. 29 | * You can use the second argument to set your own mode 30 | * 31 | * @return filesystem class 32 | */ 33 | public function mkdir($path=null,$dir=null,$chmod=0777) 34 | { 35 | if($path!==null && $dir!==null){ 36 | try { 37 | $this->fs->mkdir($path.'/'.$dir,$chmod); 38 | } catch (IOExceptionInterface $e) { 39 | echo "An error occurred while creating your directory at ".$e->getPath(); 40 | } 41 | } 42 | return false; 43 | } 44 | 45 | 46 | /** 47 | * filesystem exists method. 48 | * exists() checks for the presence of all files or directories and returns false if a file is missing: 49 | * You can pass an array or any Traversable object as the first argument. 50 | * @return filesystem class 51 | */ 52 | public function exists($path=null) 53 | { 54 | if($path!==null){ 55 | return $this->fs->exists($path); 56 | } 57 | return false; 58 | } 59 | 60 | 61 | /** 62 | * copy() is used to copy files. If the target already exists, the file is copied only if the 63 | * source modification date is later than the target. 64 | * This behavior can be overridden by the third boolean argument: 65 | * @return filesystem class 66 | */ 67 | public function copy($copied=null,$copying=null) 68 | { 69 | if($copied!==null && $copying!==null){ 70 | return $this->fs->copy($copied,$copying,true); 71 | } 72 | } 73 | 74 | 75 | /** 76 | * touch() sets access and modification time for a file. The current time is used by default. 77 | * You can set your own with the second argument. The third argument is the access time: 78 | * @return filesystem class 79 | */ 80 | public function touch($touch=null,$own=null,$access=null) 81 | { 82 | if($touch!==null){ 83 | $this->fs->touch($touch); 84 | } 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/store/services/settings.php: -------------------------------------------------------------------------------- 1 | optionalPath=StaticPathModel::optionalPath(true); 16 | $this->settingsPath=$this->optionalPath.'/Settings'; 17 | 18 | if(!file_exists($this->settingsPath)){ 19 | 20 | mkdir($this->settingsPath,0777); 21 | touch($this->settingsPath.'/app.dist'); 22 | } 23 | 24 | } 25 | 26 | /** 27 | * @param $file string 28 | * @param $key 29 | * @param $value 30 | * @return string 31 | */ 32 | public static function set($file, $key, $value){ 33 | 34 | //get instance 35 | $instance=new self; 36 | 37 | //new data 38 | $new=[]; 39 | $new[$key]=$value; 40 | 41 | /** 42 | * @var $old array 43 | */ 44 | $old=(self::get($file)===null) ? [] : self::get($file); 45 | 46 | //join new data and old data 47 | $data=array_merge($old,$new); 48 | 49 | //yaml process 50 | $yaml = Yaml::dump($data); 51 | file_put_contents($instance->settingsPath.'/'.ucfirst($file).'.yml', $yaml); 52 | 53 | } 54 | 55 | /** 56 | * @param $file string 57 | * @param $default 58 | * @return string 59 | */ 60 | public static function get($file,$default=null){ 61 | 62 | //get instance 63 | $instance=new self; 64 | 65 | //file parse 66 | $fileParse=explode(".",$file); 67 | 68 | //get file 69 | $file=$fileParse[0]; 70 | 71 | if(isset($fileParse[1])){ 72 | 73 | //get key 74 | $key=$fileParse[1]; 75 | } 76 | 77 | 78 | //get yaml path 79 | $yamlPath=$instance->settingsPath.'/'.$file.'.yml'; 80 | 81 | if($default!==null){ 82 | 83 | $value=(self::get($file)===null) ? [] : self::get($file); 84 | 85 | if(isset($key) AND !isset($value[$key])){ 86 | return $default; 87 | } 88 | } 89 | 90 | //if there is no yaml path 91 | if(!file_exists($yamlPath)){ 92 | 93 | return null; 94 | } 95 | 96 | 97 | //get yaml data 98 | $value = Yaml::parse(file_get_contents($yamlPath)); 99 | 100 | if(isset($key)){ 101 | 102 | //return with key 103 | return (isset($value[$key])) ? $value[$key] : null; 104 | } 105 | 106 | //all data 107 | return $value; 108 | 109 | } 110 | 111 | public static function has($file){ 112 | 113 | return (self::get($file)===null) ? false : true; 114 | } 115 | 116 | } 117 | -------------------------------------------------------------------------------- /src/store/packages/providers/webservice/src/simpleXml.php: -------------------------------------------------------------------------------- 1 | point(pointer)->get() 20 | * call2 : \Xml::url()->get() 21 | * call3 : \Xml::groupName()->point(pointer)->get() 22 | * return type string 23 | * 24 | */ 25 | 26 | class simpleXml { 27 | 28 | /** 29 | * @var $url 30 | */ 31 | public static $url=false; 32 | 33 | /** 34 | * @var $url 35 | */ 36 | public static $xml; 37 | 38 | /** 39 | * @var pointer 40 | */ 41 | public static $pointer=false; 42 | 43 | /** 44 | * @var $group 45 | */ 46 | public static $group=null; 47 | 48 | 49 | /** 50 | * return mixed 51 | */ 52 | public static function url($url=false,$pointer=false){ 53 | 54 | if($url){ 55 | self::$url=true; 56 | self::$xml=app('guzzle')->get($url,'xml'); 57 | 58 | if($pointer){ 59 | return self::$xml; 60 | } 61 | } 62 | 63 | self::$pointer=true; 64 | 65 | return new static; 66 | } 67 | 68 | public static function point($point=false){ 69 | 70 | if(self::$url===false){ 71 | self::$pointer=true; 72 | } 73 | 74 | if($point && self::$pointer){ 75 | static::url(\app::getWebServiceConfigUrl(self::$group,$point),true); 76 | } 77 | 78 | return new static; 79 | } 80 | 81 | /** 82 | * @method test 83 | */ 84 | public static function get($loadData=false){ 85 | 86 | /** 87 | * simple Xml load 88 | * return xml 89 | */ 90 | define('guzzleOutPutter',app('base')->response); 91 | 92 | /** 93 | * @var $xml 94 | * get url xml data 95 | */ 96 | $xml = simplexml_load_string(self::$xml, "SimpleXMLElement", LIBXML_NOCDATA); 97 | 98 | /** 99 | * @var $json 100 | * get to array xml data 101 | */ 102 | $json = json_encode($xml); 103 | 104 | /** 105 | * get finally output 106 | */ 107 | return (object)json_decode($json,TRUE); 108 | 109 | 110 | } 111 | 112 | 113 | /** 114 | * @method test 115 | */ 116 | public static function toArray($data){ 117 | 118 | $xmlToArrayResolve=new \SimpleXMLElement($data); 119 | return json_decode(json_encode($xmlToArrayResolve),1); 120 | 121 | } 122 | 123 | 124 | /** 125 | * @method __callStatic 126 | */ 127 | public static function __callStatic($group,$args){ 128 | self::$group=$group; 129 | return new static; 130 | } 131 | 132 | } 133 | -------------------------------------------------------------------------------- /src/store/services/httpSession.php: -------------------------------------------------------------------------------- 1 | session = new Session($storage); 30 | self::$instance=$this->session; 31 | }else{ 32 | $this->session=self::$instance; 33 | } 34 | 35 | } 36 | 37 | /** 38 | * {@set} . 39 | * Sets an attribute by key. 40 | */ 41 | public function set($key=null,$value=null) 42 | { 43 | if($key!==null && $value!==null){ 44 | return $this->session->set($key,$value); 45 | } 46 | return false; 47 | } 48 | 49 | 50 | /** 51 | * {@get} . 52 | * Gets an attribute by key. 53 | */ 54 | public function get($key=null) 55 | { 56 | if($key!==null){ 57 | return $this->session->get($key); 58 | } 59 | return null; 60 | } 61 | 62 | /** 63 | * {@has} 64 | * Returns true if the attribute exists. 65 | */ 66 | public function has($name=null) 67 | { 68 | if($name!==null){ 69 | return $this->session->has($name); 70 | } 71 | return false; 72 | } 73 | 74 | /** 75 | * {@all} 76 | * Gets all attributes as an array of key => value. 77 | */ 78 | public function all() 79 | { 80 | return $this->session->all(); 81 | } 82 | 83 | /** 84 | * {@remove} 85 | * Deletes an attribute by key. 86 | */ 87 | public function remove($name=null) 88 | { 89 | if($name!==null){ 90 | return $this->session->remove($name); 91 | } 92 | return null; 93 | } 94 | 95 | 96 | /** 97 | * {@clear} 98 | * Clear all attributes. 99 | */ 100 | public function clear() 101 | { 102 | return $this->session->clear(); 103 | } 104 | 105 | 106 | 107 | } -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/authenticate.php: -------------------------------------------------------------------------------- 1 | guard=($guard===null) ? $this->guard: $guard; 26 | 27 | return $this; 28 | } 29 | 30 | /** 31 | * @param array $credentials 32 | * @return mixed|null|string 33 | * login post attempt 34 | */ 35 | public function attempt($credentials=array()){ 36 | 37 | //destroy if there is auth session 38 | //then,set register process 39 | $this->getAuthRegisterModel('destroy'); 40 | 41 | /** 42 | * @var $this->getAuthDriverModel 43 | * get driver and model query 44 | */ 45 | $this->getAuthDriverModel($credentials,'attempt'); 46 | 47 | return $this->result; 48 | 49 | } 50 | 51 | 52 | /** 53 | * @method check 54 | * @return null 55 | */ 56 | public function check(){ 57 | 58 | /** 59 | * @var $this->getAuthDriverModel 60 | * get driver and model query 61 | */ 62 | $this->getAuthDriverModel([],'check'); 63 | 64 | return $this->result; 65 | 66 | } 67 | 68 | /** 69 | * @method persistent 70 | * @return null 71 | */ 72 | public function persistent(){ 73 | 74 | /** 75 | * @var $this->getAuthDriverModel 76 | * get driver and model query 77 | */ 78 | $this->getAuthDriverModel([],'persistent'); 79 | 80 | return $this->result; 81 | 82 | } 83 | 84 | 85 | /** 86 | * @method user 87 | * @return object 88 | */ 89 | public function user(){ 90 | 91 | //take data 92 | $this->check(); 93 | 94 | //check returned query 95 | if(isset($this->query['results'])){ 96 | 97 | //get user information as object 98 | return (object)$this->query['results'][0]; 99 | } 100 | 101 | return null; 102 | 103 | 104 | } 105 | 106 | /** 107 | * @method logout 108 | * @return mixed 109 | */ 110 | public function logout(){ 111 | 112 | //auth register model destroy 113 | return $this->getAuthDriverModel([],'logout'); 114 | } 115 | 116 | /** 117 | * @method getToken 118 | * @return mixed 119 | */ 120 | public function getToken(){ 121 | 122 | //if the user is not null 123 | if($this->user()!==null){ 124 | 125 | //get token from user 126 | return $this->user()->{$this->getTokenField()}; 127 | } 128 | 129 | return null; 130 | } 131 | 132 | 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/polyfill.js: -------------------------------------------------------------------------------- 1 | // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys 2 | if (!Object.keys) { 3 | Object.keys = (function () { 4 | 'use strict'; 5 | var hasOwnProperty = Object.prototype.hasOwnProperty, 6 | hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), 7 | dontEnums = [ 8 | 'toString', 9 | 'toLocaleString', 10 | 'valueOf', 11 | 'hasOwnProperty', 12 | 'isPrototypeOf', 13 | 'propertyIsEnumerable', 14 | 'constructor' 15 | ], 16 | dontEnumsLength = dontEnums.length; 17 | 18 | return function (obj) { 19 | if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { 20 | throw new TypeError('Object.keys called on non-object'); 21 | } 22 | 23 | var result = [], prop, i; 24 | 25 | for (prop in obj) { 26 | if (hasOwnProperty.call(obj, prop)) { 27 | result.push(prop); 28 | } 29 | } 30 | 31 | if (hasDontEnumBug) { 32 | for (i = 0; i < dontEnumsLength; i++) { 33 | if (hasOwnProperty.call(obj, dontEnums[i])) { 34 | result.push(dontEnums[i]); 35 | } 36 | } 37 | } 38 | return result; 39 | }; 40 | }()); 41 | } 42 | 43 | //Production steps of ECMA-262, Edition 5, 15.4.4.18 44 | //Reference: http://es5.github.com/#x15.4.4.18 45 | if (!Array.prototype.forEach) { 46 | 47 | Array.prototype.forEach = function (callback, thisArg) { 48 | 49 | var T, k; 50 | 51 | if (this == null) { 52 | throw new TypeError(" this is null or not defined"); 53 | } 54 | 55 | // 1. Let O be the result of calling ToObject passing the |this| value as the argument. 56 | var O = Object(this); 57 | 58 | // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". 59 | // 3. Let len be ToUint32(lenValue). 60 | var len = O.length >>> 0; 61 | 62 | // 4. If IsCallable(callback) is false, throw a TypeError exception. 63 | // See: http://es5.github.com/#x9.11 64 | if (typeof callback !== "function") { 65 | throw new TypeError(callback + " is not a function"); 66 | } 67 | 68 | // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. 69 | if (arguments.length > 1) { 70 | T = thisArg; 71 | } 72 | 73 | // 6. Let k be 0 74 | k = 0; 75 | 76 | // 7. Repeat, while k < len 77 | while (k < len) { 78 | 79 | var kValue; 80 | 81 | // a. Let Pk be ToString(k). 82 | // This is implicit for LHS operands of the in operator 83 | // b. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk. 84 | // This step can be combined with c 85 | // c. If kPresent is true, then 86 | if (k in O) { 87 | 88 | // i. Let kValue be the result of calling the Get internal method of O with argument Pk. 89 | kValue = O[k]; 90 | 91 | // ii. Call the Call internal method of callback with T as the this value and 92 | // argument list containing kValue, k, and O. 93 | callback.call(T, kValue, k, O); 94 | } 95 | // d. Increase k by 1. 96 | k++; 97 | } 98 | // 8. return undefined 99 | }; 100 | } 101 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/driver/database.php: -------------------------------------------------------------------------------- 1 | config=$config; 34 | } 35 | 36 | /** 37 | * @param array $credentials 38 | * @return mixed 39 | */ 40 | public function attempt($credentials=array()){ 41 | 42 | //$credentials is array true and must be password 43 | if(count($this->config->credentials=$credentials)){ 44 | 45 | //config auth model properties 46 | $this->config->getAuthDriverBuilder(); 47 | } 48 | 49 | //check login and if it is true 50 | //set register process 51 | $this->config->setAuthRegister(); 52 | 53 | } 54 | 55 | 56 | /** 57 | * @method updateAppToken 58 | * @return mixed 59 | */ 60 | public function updateAppToken(){ 61 | 62 | //config auth model properties 63 | $this->config->getAuthDriverBuilder('updateAppToken'); 64 | 65 | } 66 | 67 | 68 | /** 69 | * @method check 70 | */ 71 | public function check(){ 72 | 73 | //check auth in register model 74 | $this->config->getAuthDriverBuilder('check'); 75 | 76 | //check login and if it is true 77 | //set register process 78 | $this->config->setAuthRegister(false); 79 | 80 | } 81 | 82 | 83 | /** 84 | * @method persistent 85 | */ 86 | public function persistent(){ 87 | 88 | //check auth in register model 89 | $this->config->getAuthDriverBuilder('persistent'); 90 | 91 | //check login and if it is true 92 | //set register process 93 | $this->config->setAuthRegister(false); 94 | 95 | } 96 | 97 | /** 98 | * @method logout 99 | */ 100 | public function logout(){ 101 | 102 | //get token 103 | $token=$this->config->getAuthRegisterModel('getAuthSession'); 104 | 105 | //get security authenticate data 106 | $this->config->getSecurityCredentials($token); 107 | 108 | //app token 109 | $this->config->token=$this->config->getAuthRegisterModel('getAuthHashConfigReference'); 110 | 111 | //update app token from driver model 112 | $this->config->getAuthDriverModel([],'updateAppToken'); 113 | 114 | return $this->config->getAuthRegisterModel('destroy'); 115 | 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/src/joinBuilderOperation.php: -------------------------------------------------------------------------------- 1 | querySqlFormatter=$querySqlFormatter; 34 | } 35 | 36 | /** 37 | * getSelect method is main method. 38 | * 39 | * @return array 40 | */ 41 | public function joinMainProcess($data,$model){ 42 | 43 | $joinerModel=$model['model']->joiner; 44 | 45 | $joinerArray=[]; 46 | 47 | if(!isset($data['joiner'])){ 48 | $data=$this->callWithModel($joinerModel); 49 | } 50 | 51 | if(array_key_exists('joiner',$data)){ 52 | 53 | foreach ($data['joiner'][0] as $myJoin) { 54 | 55 | $myJoinBuilder="\\src\\app\\".app."\\".version."\\model\\sudb\\".$myJoin.""; 56 | $myJoinClass=new $myJoinBuilder(); 57 | $myJoinTable=$myJoinClass->table; 58 | 59 | foreach ($joinerModel[$myJoin]['relations'] as $key => $value) { 60 | $joinerArray['join'][] = strtoupper($data['type']) . ' JOIN ' . $myJoinTable . ' ON ' . $model['model']->table . '.' . $key . '=' . $myJoinTable . '.' . $value; 61 | } 62 | 63 | if (array_key_exists("select",$data) && array_key_exists($myJoin, $data['select'])) { 64 | 65 | foreach ($data['select'][$myJoin] as $selectVal) { 66 | $joinerArray['select'][] = $myJoinTable . '.' . $selectVal; 67 | } 68 | } else { 69 | $joinerArray['select'][] =null; 70 | } 71 | 72 | } 73 | } 74 | 75 | return $joinerArray; 76 | 77 | } 78 | 79 | 80 | /** 81 | * @param $data 82 | * @return array 83 | */ 84 | public function callWithModel($data){ 85 | 86 | $callWithModelArray=[]; 87 | foreach ($data as $model=>$value){ 88 | $callWithModelArray=($value['auto']) ? $this->callWithModelArray($model,$value) : $this->sparseFieldsModelJoin($data); 89 | } 90 | return $callWithModelArray; 91 | } 92 | 93 | /** 94 | * @param $data 95 | * @return array 96 | */ 97 | public function sparseFieldsModelJoin($data){ 98 | 99 | $queryString=(new Request())->getQueryString(); 100 | $callWithModelArray=[]; 101 | 102 | if(isset($queryString['relations'])){ 103 | 104 | $models=explode("-",$queryString['relations']); 105 | 106 | foreach ($data as $model=>$value){ 107 | 108 | if(in_array($model,$models)){ 109 | $callWithModelArray=$this->callWithModelArray($model,$value); 110 | } 111 | 112 | } 113 | 114 | } 115 | 116 | return $callWithModelArray; 117 | 118 | 119 | } 120 | 121 | 122 | /** 123 | * @param $model 124 | * @param $value 125 | * @return array 126 | */ 127 | private function callWithModelArray($model, $value){ 128 | 129 | $callWithModelArray=[]; 130 | $callWithModelArray['joiner'][0][]=$model; 131 | $callWithModelArray['joiner'][1][$model]=$value['fields']; 132 | $callWithModelArray['type']=$value['join']; 133 | $callWithModelArray['select'][$model]=$value['fields']; 134 | 135 | return $callWithModelArray; 136 | } 137 | 138 | 139 | } -------------------------------------------------------------------------------- /src/store/services/rabbitMQ.php: -------------------------------------------------------------------------------- 1 | app=$app; 45 | $this->declare=$declare; 46 | } 47 | else{ 48 | $projectConfig="\\src\\app\\".app."\\".version."\\config\\rabbitMQ"; 49 | $this->app=app; 50 | $this->declare=app; 51 | } 52 | 53 | 54 | $rabbitMQ=$projectConfig::rmqSettings(); 55 | 56 | $this->connection=new AMQPStreamConnection($rabbitMQ['rabbitMQ']['host'], $rabbitMQ['rabbitMQ']['port'], $rabbitMQ['rabbitMQ']['user'], $rabbitMQ['rabbitMQ']['password']); 57 | $this->channel=$this->connection->channel(); 58 | 59 | } 60 | 61 | 62 | 63 | public function publisher(){ 64 | 65 | $this->channel->exchange_declare($this->declare, 'fanout', false, false, false); 66 | 67 | $task='\\src\\app\\'.$this->app.'\\'.utils::getAppVersion($this->app).'\\optional\\jobs\\rabbitmq\\'.$this->declare.'\\task'; 68 | 69 | $msg = new AMQPMessage((new $task())->execute()); 70 | 71 | $this->channel->basic_publish($msg, $this->declare); 72 | 73 | $this->channel->close(); 74 | $this->connection->close(); 75 | } 76 | 77 | 78 | public function subscriber(){ 79 | 80 | //cli command : nohup php api job pusher rabbitmq mobi user subscriber > /dev/null 2>&1 & 81 | // nohup kill : kill -9 pid 82 | 83 | $this->channel->exchange_declare($this->declare, 'fanout', false, false, false); 84 | 85 | list($queue_name, ,) = $this->channel->queue_declare("", false, false, true, false); 86 | 87 | $this->channel->queue_bind($queue_name, $this->declare); 88 | 89 | $callback = function($msg){}; 90 | 91 | $this->channel->basic_consume($queue_name, '', false, true, false, false, $callback); 92 | 93 | while(count($this->channel->callbacks)) { 94 | 95 | $process = new Process('php api job run rabbitmq '.$this->app.' '.$this->declare.' publisher'); 96 | $process->run(); 97 | 98 | // executes after the command finishes 99 | if (!$process->isSuccessful()) { 100 | throw new ProcessFailedException($process); 101 | } 102 | echo $process->getOutput(); 103 | sleep(5); 104 | } 105 | 106 | $this->channel->close(); 107 | $this->connection->close(); 108 | } 109 | 110 | 111 | public function run(){ 112 | 113 | $process = new Process('nohup php api job run rabbitmq '.$this->app.' '.$this->declare.' subscriber > '.root.'/src/app/'.$this->app.'/'.utils::getAppVersion($this->app).'/optional/jobs/rabbitmq/'.$this->declare.'/nohup 2>&1 & echo $! > '.root.'/src/app/'.$this->app.'/'.utils::getAppVersion($this->app).'/optional/jobs/rabbitmq/'.$this->declare.'/save_pid.txt'); 114 | $process->run(); 115 | 116 | // executes after the command finishes 117 | if (!$process->isSuccessful()) { 118 | throw new ProcessFailedException($process); 119 | } 120 | 121 | echo $process->getOutput(); 122 | } 123 | 124 | 125 | } 126 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/css: -------------------------------------------------------------------------------- 1 | /* latin-ext */ 2 | @font-face { 3 | font-family: 'Source Code Pro'; 4 | font-style: normal; 5 | font-weight: 400; 6 | src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(http://fonts.gstatic.com/s/sourcecodepro/v6/mrl8jkM18OlOQN8JLgasD4a1YDtoarzwSXxTHggEXMw.woff2) format('woff2'); 7 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 8 | } 9 | /* latin */ 10 | @font-face { 11 | font-family: 'Source Code Pro'; 12 | font-style: normal; 13 | font-weight: 400; 14 | src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(http://fonts.gstatic.com/s/sourcecodepro/v6/mrl8jkM18OlOQN8JLgasD5bPFduIYtoLzwST68uhz_Y.woff2) format('woff2'); 15 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 16 | } 17 | /* vietnamese */ 18 | @font-face { 19 | font-family: 'Source Sans Pro'; 20 | font-style: normal; 21 | font-weight: 400; 22 | src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlCxe5Tewm2_XWfbGchcXw4g.woff2) format('woff2'); 23 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 24 | } 25 | /* latin-ext */ 26 | @font-face { 27 | font-family: 'Source Sans Pro'; 28 | font-style: normal; 29 | font-weight: 400; 30 | src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlIa1YDtoarzwSXxTHggEXMw.woff2) format('woff2'); 31 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 32 | } 33 | /* latin */ 34 | @font-face { 35 | font-family: 'Source Sans Pro'; 36 | font-style: normal; 37 | font-weight: 400; 38 | src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/ODelI1aHBYDBqgeIAH2zlJbPFduIYtoLzwST68uhz_Y.woff2) format('woff2'); 39 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 40 | } 41 | /* vietnamese */ 42 | @font-face { 43 | font-family: 'Source Sans Pro'; 44 | font-style: normal; 45 | font-weight: 600; 46 | src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGMZXFz2iDKd7GJNSaxRYiSj3rGVtsTkPsbDajuO5ueQw.woff2) format('woff2'); 47 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 48 | } 49 | /* latin-ext */ 50 | @font-face { 51 | font-family: 'Source Sans Pro'; 52 | font-style: normal; 53 | font-weight: 600; 54 | src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGKyGJhAh-RE0BxGcd_izyev3rGVtsTkPsbDajuO5ueQw.woff2) format('woff2'); 55 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 56 | } 57 | /* latin */ 58 | @font-face { 59 | font-family: 'Source Sans Pro'; 60 | font-style: normal; 61 | font-weight: 600; 62 | src: local('Source Sans Pro Semibold'), local('SourceSansPro-Semibold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGMzFoXZ-Kj537nB_-9jJhlA.woff2) format('woff2'); 63 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 64 | } 65 | /* vietnamese */ 66 | @font-face { 67 | font-family: 'Source Sans Pro'; 68 | font-style: normal; 69 | font-weight: 700; 70 | src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGMms7UHsIbjUxEJqIwog-i_3rGVtsTkPsbDajuO5ueQw.woff2) format('woff2'); 71 | unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB; 72 | } 73 | /* latin-ext */ 74 | @font-face { 75 | font-family: 'Source Sans Pro'; 76 | font-style: normal; 77 | font-weight: 700; 78 | src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGO4s1Ux4PuImWPk5fSr6HPL3rGVtsTkPsbDajuO5ueQw.woff2) format('woff2'); 79 | unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; 80 | } 81 | /* latin */ 82 | @font-face { 83 | font-family: 'Source Sans Pro'; 84 | font-style: normal; 85 | font-weight: 700; 86 | src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(http://fonts.gstatic.com/s/sourcesanspro/v9/toadOcfmlt9b38dHJxOBGJkF8H8ye47wsfpWywda8og.woff2) format('woff2'); 87 | unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215; 88 | } 89 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/register/session.php: -------------------------------------------------------------------------------- 1 | config =$config; 45 | $this->session =app('session'); 46 | $this->persistent =$this->config->persistent; 47 | } 48 | 49 | /** 50 | * @method register 51 | */ 52 | public function register(){ 53 | 54 | //check session 55 | if(!$this->hasAuthSession()){ 56 | 57 | //get hash for auth 58 | $authHash=$this->getAuthHash($this->config); 59 | 60 | //check persistent and then real authHash 61 | $authHash=($this->persistent===null) ? $authHash : $this->persistent; 62 | 63 | //session register for authHash 64 | $this->session->set('auth',$authHash); 65 | 66 | //app token 67 | $this->config->token=$this->session->get('auth'); 68 | 69 | //update app token from driver model 70 | $this->config->getAuthDriverModel([],'updateAppToken'); 71 | 72 | } 73 | 74 | //query result 75 | $this->config->result=[ 76 | 'authToken'=>$this->session->get('auth') 77 | ]; 78 | } 79 | 80 | /** 81 | * @method check 82 | * @return array 83 | */ 84 | public function check(){ 85 | 86 | if($this->hasAuthSession()){ 87 | 88 | //session auth parse 89 | $authExplode=$this->sessionAuthParse(); 90 | 91 | //get authMath 92 | $authMath=(int)$authExplode[0]; 93 | 94 | //get auth id resolved via encrypt model 95 | $authId=$this->config->getAuthEncryptModel('resolve',(int)$authExplode[0]); 96 | 97 | //get auth token 98 | $authData=(isset($authExplode[1])) ? $authExplode[1] : null; 99 | 100 | //get token from session 101 | $token=$this->session->get('auth'); 102 | 103 | //return compact for array 104 | return compact('authMath','authId','authData','token'); 105 | } 106 | 107 | return []; 108 | } 109 | 110 | 111 | /** 112 | * @method destroy 113 | * auth destroy 114 | */ 115 | public function destroy(){ 116 | 117 | if($this->hasAuthSession()){ 118 | 119 | //session auth destroy 120 | $this->session->remove('auth'); 121 | 122 | return true; 123 | } 124 | 125 | return false; 126 | 127 | } 128 | 129 | /** 130 | * @method sessionAuthParse 131 | */ 132 | private function sessionAuthParse(){ 133 | 134 | //session auth parse 135 | return explode('_',$this->session->get('auth')); 136 | 137 | } 138 | 139 | 140 | /** 141 | * @method hasAuthSession 142 | */ 143 | private function hasAuthSession(){ 144 | 145 | //get session auth 146 | return $this->session->has('auth'); 147 | 148 | } 149 | 150 | 151 | /** 152 | * @method getAuthSession 153 | */ 154 | public function getAuthSession(){ 155 | 156 | if($this->hasAuthSession()){ 157 | 158 | //get session auth 159 | return $this->session-> get('auth'); 160 | } 161 | 162 | return null; 163 | 164 | 165 | } 166 | 167 | /** 168 | * @method getAuthHashConfigReference 169 | * @return string 170 | */ 171 | public function getAuthHashConfigReference() 172 | { 173 | return parent::getAuthHash($this->config); 174 | } 175 | 176 | 177 | } 178 | -------------------------------------------------------------------------------- /src/store/packages/dev/apixDevPackageIllustration/devpack/model/sudb/user.php: -------------------------------------------------------------------------------- 1 | false,'expire'=>60]; 50 | 51 | /** 52 | * @var createdAndUpdatedFields. 53 | * 54 | * @info this value is created and updated time for values it will be inserted 55 | * @status obligatory 56 | */ 57 | public $createdAndUpdatedFields=['created_at'=>'createdAt','updated_at'=>'updatedAt']; 58 | 59 | 60 | /** 61 | * @var resultDataInfo. 62 | * 63 | * @info this value changes default result data info 64 | * @example coultAllData=>'total' 65 | * @status optional 66 | */ 67 | public $resultDataInfo=[]; 68 | 69 | 70 | /** 71 | * @var joiner relationship. 72 | * 73 | * @info joiner table is relationship 74 | * @status it is array 75 | * @param tableName=>['childRelation'=>'tableNameRelation'] 76 | */ 77 | public $joiner=[]; 78 | 79 | 80 | /** 81 | * @var selectHidden. 82 | * 83 | * @info your table columns is hidden 84 | * @status optional 85 | */ 86 | public $selectHidden=[]; 87 | 88 | /** 89 | * @var insertConditions. 90 | * 91 | * @info restrictions for data inserted by client 92 | * @status optional - it is run for status true 93 | */ 94 | public $insertConditions=[ 95 | 'status'=>false, 96 | 'wantedFields'=>[], 97 | 'exceptFields'=>[], 98 | 'obligatoryFields'=>[], 99 | 'queueFields'=>[] 100 | ]; 101 | 102 | /** 103 | * @var updateConditions. 104 | * 105 | * @info restrictions for data updated by client 106 | * @status optional - it is run for status true 107 | */ 108 | public $updateConditions=[ 109 | 'status'=>false, 110 | 'wantedFields'=>[], 111 | 'exceptFields'=>[], 112 | 'obligatoryFields'=>[], 113 | 'queueFields'=>[] 114 | ]; 115 | 116 | /** 117 | * @var selectPermissions. 118 | * 119 | * @info client can select to data 120 | * @status optional - it is run for status true 121 | */ 122 | public $selectPermissions=[ 123 | 'status'=>false, 124 | 'authorized'=>'*', 125 | 'forbidden'=>[], 126 | 'tokens'=>'*', 127 | 'seperator'=>'::' 128 | ]; 129 | 130 | 131 | /** 132 | * @var scope. 133 | * 134 | * @info specific where conditional 135 | * @status optional 136 | */ 137 | public $scope=['auto'=>[]]; 138 | 139 | 140 | /** 141 | * @var modelScope. 142 | * 143 | * @info specific where conditional snippet 144 | * @status optional 145 | */ 146 | public function modelScope($data, $query) 147 | { 148 | 149 | //get id 150 | if ($data=="id") { 151 | $query->where(function ($model) { 152 | if (\app::checkUrlParam("id")) { 153 | $model->where("id", "=", \app::getUrlParam("id")); 154 | } 155 | }); 156 | } 157 | 158 | //scopes 159 | if ($data=="active") { 160 | $query->where("status", "=", 1); 161 | } 162 | } 163 | 164 | /** 165 | * @var specific field . 166 | * 167 | * @info your table columns is value 168 | * @status optional 169 | */ 170 | /*public function fieldPassword(){ 171 | return md5(\app::post("password")); 172 | }*/ 173 | 174 | 175 | public function __construct(){ 176 | 177 | $this->resultDataInfo=$this->resultDataInfo(); 178 | $this->paginator=$this->paginator(); 179 | $this->orderBy=$this->orderBy(); 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /src/store/services/platform.php: -------------------------------------------------------------------------------- 1 | instance==null){ 36 | if($name!==null){ 37 | $this->platform=$name; 38 | $this->instance=1; 39 | } 40 | } 41 | else{ 42 | if($this->instance==1){ 43 | if($name!==null){ 44 | $this->service=service; 45 | $this->instance=2; 46 | } 47 | } 48 | else{ 49 | if($name!==null){ 50 | $this->filename=method; 51 | $this->instance=3; 52 | } 53 | } 54 | 55 | } 56 | 57 | return $this; 58 | } 59 | 60 | 61 | 62 | /** 63 | * get platform get. 64 | * 65 | * @return array 66 | */ 67 | public function take($callback=null){ 68 | 69 | if($this->service==null && $this->filename==null){ 70 | $this->service=service; 71 | $this->filename=method; 72 | } 73 | 74 | if(defined("devPackage")){ 75 | 76 | $config='\\src\\store\\packages\\dev\\'.service.'\\platform\\config'; 77 | $status=false; 78 | $instance=true; 79 | $configMethodMain=''.$this->platform; 80 | $configMethod=''.$this->platform.'_'.$this->service.'_'.$this->filename; 81 | if(method_exists($config,$configMethod)){ 82 | $status=\Apix\utils::resolve($config)->$configMethod(); 83 | $instance=false; 84 | } 85 | 86 | if($instance && method_exists($config,$configMethodMain)){ 87 | $status=\Apix\utils::resolve($config)->$configMethodMain(); 88 | } 89 | 90 | if($method!==null && $status){ 91 | $classplatform=root.'/src/packages/dev/'.service.'/platform/'.$this->platform.'/'.$this->service.'/'.$this->filename.'.php'; 92 | if(file_exists($classplatform)){ 93 | $platformname='\\src\\store\\packages\\dev\\'.service.'\\platform\\'.$this->platform.'\\'.$this->service.'\\'.$this->filename; 94 | return \Apix\utils::resolve($platformname)->$method(); 95 | } 96 | if(is_callable($callback)){ 97 | return call_user_func($callback); 98 | } 99 | return false; 100 | 101 | 102 | } 103 | } 104 | else{ 105 | 106 | $config='\\src\\app\\'.app.'\\'.version.'\\optional\\platform\\config'; 107 | $status=false; 108 | $instance=true; 109 | $configMethodMain=''.$this->platform; 110 | $configMethod=''.$this->platform.'_'.$this->service.'_'.$this->filename; 111 | if(method_exists($config,'handle')){ 112 | $platformResolve=\Apix\utils::resolve($config)->handle(); 113 | $this->platform=$platformResolve; 114 | $instance=false; 115 | $status=true; 116 | } 117 | 118 | if($status){ 119 | 120 | $classplatform=root.'/src/app/'.app.'/'.version.'/optional/platform/'.$this->platform.'/'.$this->service.'/'.request.'Service.php'; 121 | if(file_exists($classplatform)){ 122 | $platformname='\\src\\app\\'.app.'\\'.version.'\\optional\\platform\\'.$this->platform.'\\'.$this->service.'\\'.request.'Service'; 123 | $method=method; 124 | $appPlatform=\Apix\utils::resolve($platformname); 125 | if(method_exists($appPlatform,$method)){ 126 | return \Apix\utils::resolve($platformname)->$method(); 127 | } 128 | 129 | } 130 | if(is_callable($callback)){ 131 | return call_user_func($callback); 132 | } 133 | return false; 134 | 135 | 136 | } 137 | 138 | if(is_callable($callback)){ 139 | return call_user_func($callback); 140 | } 141 | return false; 142 | 143 | } 144 | 145 | } 146 | 147 | 148 | } 149 | -------------------------------------------------------------------------------- /src/store/packages/providers/auth/src/builder/sudb.php: -------------------------------------------------------------------------------- 1 | config =$config; 34 | $this->model =$this->config->getModel(); 35 | } 36 | 37 | /** 38 | * @param $pure 39 | * @method register 40 | * @return mixed 41 | */ 42 | public function attempt($pure=false){ 43 | 44 | //get model 45 | $model=$this->model; 46 | 47 | /** 48 | * @var $credentials 49 | * get credentials 50 | */ 51 | $credentials=$this->config->credentials; 52 | 53 | //pure model query 54 | //credentials coming from client 55 | $query=$model::where(function($query) use($credentials) { 56 | 57 | foreach ($credentials as $key=>$value){ 58 | $query->where($key,'=',$value); 59 | } 60 | }); 61 | 62 | //pure true 63 | if($pure){ 64 | 65 | //get pure query 66 | //for update 67 | return $query; 68 | } 69 | 70 | //sudb orm query 71 | $this->config->query =$query->get(); 72 | 73 | if(isset($this->config->query['results'])){ 74 | $this->config->data =$this->config->query['results'][0]; 75 | } 76 | 77 | } 78 | 79 | /** 80 | * @method updateAppToken 81 | */ 82 | public function updateAppToken(){ 83 | 84 | //app token update 85 | $this->attempt(true)->update([$this->config->getTokenField()=>$this->config->token]); 86 | } 87 | 88 | 89 | /** 90 | * @param $token 91 | * @return mixed 92 | */ 93 | public function getSecurityDataForToken($token){ 94 | 95 | //get model 96 | $model=$this->model; 97 | 98 | $query=$model::where($this->config->getTokenField(),'=',$token)->get(); 99 | 100 | return $query; 101 | } 102 | 103 | 104 | /** 105 | * @method check 106 | * check auth from driver 107 | */ 108 | public function check(){ 109 | 110 | //get model 111 | $model=$this->model; 112 | 113 | //check register method for auth 114 | $auth=$this->config->getAuthRegisterModel('check'); 115 | 116 | //check authId from session 117 | if(isset($auth['authId'])){ 118 | 119 | //set config data id 120 | $this->config->data['id']=$auth['authId']; 121 | } 122 | 123 | //check driver for auth and auth math as real calculating via client ip 124 | if(isset($auth['authMath']) && $auth['authMath']==$this->config->getAuthEncryptModel()){ 125 | 126 | //get query for auth id 127 | $this->config->query=$model::where(function($query) use($auth) { 128 | 129 | $query->where('id','=',$auth['authId']); 130 | $query->where($this->config->getTokenField(),'=',$auth['token']); 131 | 132 | })->get(); 133 | 134 | } 135 | } 136 | 137 | 138 | /** 139 | * @method persistent 140 | * check auth from driver 141 | */ 142 | public function persistent(){ 143 | 144 | //get model 145 | $model=$this->model; 146 | 147 | //get query for auth id 148 | $persistentQuery=$model::where(function($query) { 149 | 150 | $query->where($this->config->getTokenField(),'=',$this->config->getTokenPersistent()); 151 | 152 | })->get(); 153 | 154 | if(!isset($persistentQuery['error'])){ 155 | 156 | //persistent data 157 | $persistentData=$persistentQuery['results'][0]; 158 | 159 | //call check method 160 | $this->check(); 161 | 162 | //if query is null 163 | if($this->config->query===null){ 164 | 165 | //set credentials 166 | $attemptCredentials=[]; 167 | 168 | //config credentials key 169 | foreach ($this->config->getCredentialsKey() as $credent){ 170 | 171 | //set key credentials from config/auth 172 | $attemptCredentials[$credent]=$persistentData[$credent]; 173 | } 174 | 175 | //set config persistent get token field from driver 176 | $this->config->persistent=$persistentData[$this->config->getTokenField()]; 177 | 178 | //set new auth credentials attempt 179 | $this->config->getAuthDriverModel($attemptCredentials,'attempt'); 180 | } 181 | } 182 | 183 | 184 | } 185 | 186 | 187 | 188 | 189 | } 190 | -------------------------------------------------------------------------------- /src/store/services/pushNotifications.php: -------------------------------------------------------------------------------- 1 | $data['mtitle'], 33 | 'message' => $data['mdesc'], 34 | 'subtitle' => '', 35 | 'tickerText' => '', 36 | 'msgcnt' => 1, 37 | 'vibrate' => 1 38 | ); 39 | 40 | $headers = array( 41 | 'Authorization: key=' .self::$API_ACCESS_KEY, 42 | 'Content-Type: application/json' 43 | ); 44 | 45 | $fields = array( 46 | 'registration_ids' => array($reg_id), 47 | 'data' => $message, 48 | ); 49 | 50 | return $this->useCurl($url, $headers, json_encode($fields)); 51 | } 52 | 53 | // Sends Push's toast notification for Windows Phone 8 users 54 | public function WP($data, $uri) { 55 | $delay = 2; 56 | $msg = "" . 57 | "" . 58 | "" . 59 | "".htmlspecialchars($data['mtitle'])."" . 60 | "".htmlspecialchars($data['mdesc'])."" . 61 | "" . 62 | ""; 63 | 64 | $sendedheaders = array( 65 | 'Content-Type: text/xml', 66 | 'Accept: application/*', 67 | 'X-WindowsPhone-Target: toast', 68 | "X-NotificationClass: $delay" 69 | ); 70 | 71 | $response = $this->useCurl($uri, $sendedheaders, $msg); 72 | 73 | $result = array(); 74 | foreach(explode("\n", $response) as $line) { 75 | $tab = explode(":", $line, 2); 76 | if (count($tab) == 2) 77 | $result[$tab[0]] = trim($tab[1]); 78 | } 79 | 80 | return $result; 81 | } 82 | 83 | // Sends Push notification for iOS users 84 | public function iOS($data, $devicetoken) { 85 | 86 | $deviceToken = $devicetoken; 87 | 88 | $ctx = stream_context_create(); 89 | // ck.pem is your certificate file 90 | stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); 91 | stream_context_set_option($ctx, 'ssl', 'passphrase', self::$passphrase); 92 | 93 | // Open a connection to the APNS server 94 | $fp = stream_socket_client( 95 | 'ssl://gateway.sandbox.push.apple.com:2195', $err, 96 | $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); 97 | 98 | if (!$fp) 99 | exit("Failed to connect: $err $errstr" . PHP_EOL); 100 | 101 | // Create the payload body 102 | $body['aps'] = array( 103 | 'alert' => array( 104 | 'title' => $data['mtitle'], 105 | 'body' => $data['mdesc'], 106 | ), 107 | 'sound' => 'default' 108 | ); 109 | 110 | // Encode the payload as JSON 111 | $payload = json_encode($body); 112 | 113 | // Build the binary notification 114 | $msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload; 115 | 116 | // Send it to the server 117 | $result = fwrite($fp, $msg, strlen($msg)); 118 | 119 | // Close the connection to the server 120 | fclose($fp); 121 | 122 | if (!$result) 123 | return 'Message not delivered' . PHP_EOL; 124 | else 125 | return 'Message successfully delivered' . PHP_EOL; 126 | 127 | } 128 | 129 | // Curl 130 | private function useCurl(&$model, $url, $headers, $fields = null) { 131 | // Open connection 132 | $ch = curl_init(); 133 | if ($url) { 134 | // Set the url, number of POST vars, POST data 135 | curl_setopt($ch, CURLOPT_URL, $url); 136 | curl_setopt($ch, CURLOPT_POST, true); 137 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 138 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 139 | 140 | // Disabling SSL Certificate support temporarly 141 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 142 | if ($fields) { 143 | curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); 144 | } 145 | 146 | // Execute post 147 | $result = curl_exec($ch); 148 | if ($result === FALSE) { 149 | die('Curl failed: ' . curl_error($ch)); 150 | } 151 | 152 | // Close connection 153 | curl_close($ch); 154 | 155 | return $result; 156 | } 157 | } 158 | 159 | } -------------------------------------------------------------------------------- /src/store/packages/providers/webservice/src/jsonClient.php: -------------------------------------------------------------------------------- 1 | point(pointer)->get() 20 | * call2 : \jsonClient::url()->get() 21 | * call3 : \jsonClient::groupName()->point(pointer)->get() 22 | * return type string 23 | * 24 | */ 25 | 26 | class jsonClient { 27 | 28 | /** 29 | * @var $url 30 | */ 31 | public static $url=false; 32 | 33 | /** 34 | * @var $url 35 | */ 36 | public static $json; 37 | 38 | /** 39 | * @var pointer 40 | */ 41 | public static $pointer=false; 42 | 43 | /** 44 | * @var $group 45 | */ 46 | public static $group=null; 47 | 48 | /** 49 | * @var $query 50 | */ 51 | public static $param=[]; 52 | 53 | /** 54 | * @var $namelist 55 | */ 56 | public static $namelist=[]; 57 | 58 | 59 | /** 60 | * construct method 61 | */ 62 | public function __construct(){ 63 | 64 | /** 65 | * @var set config param 66 | */ 67 | if(count(self::$param)===0){ 68 | 69 | self::webServiceConfigMethod('setUrlGetQuery','query'); 70 | self::webServiceConfigMethod('setHeaders','headers'); 71 | 72 | } 73 | } 74 | 75 | 76 | /** 77 | * return mixed 78 | */ 79 | public static function url($url=false,$pointer=false){ 80 | 81 | if($url){ 82 | self::$url=$url; 83 | self::$json=app('guzzle'); 84 | 85 | if($pointer){ 86 | return self::$json; 87 | } 88 | } 89 | 90 | self::$pointer=true; 91 | 92 | return new static; 93 | } 94 | 95 | public static function point($point=false){ 96 | 97 | if(self::$url===false){ 98 | self::$pointer=true; 99 | } 100 | 101 | if($point && self::$pointer){ 102 | static::url(\app::getWebServiceConfigUrl(self::$group,$point),true); 103 | } 104 | 105 | return new static; 106 | } 107 | 108 | public static function query($query=array()){ 109 | 110 | self::$param['query']=$query; 111 | return new static; 112 | } 113 | 114 | public static function headers($headers=array()){ 115 | 116 | self::$param['headers']=$headers; 117 | return new static; 118 | } 119 | 120 | 121 | /** 122 | * @method get 123 | */ 124 | public static function get(){ 125 | 126 | /** 127 | * simple jsonClient load 128 | * return json 129 | */ 130 | define('guzzleOutPutter',app('base')->response); 131 | 132 | self::namelist(); 133 | 134 | /** 135 | * get finally output 136 | */ 137 | return self::$json->get(self::$url,'json',self::$param); 138 | 139 | 140 | } 141 | 142 | /** 143 | * @method post 144 | */ 145 | public static function post($post=[]){ 146 | 147 | /** 148 | * simple jsonClient load 149 | * return json 150 | */ 151 | define('guzzleOutPutter',app('base')->response); 152 | 153 | /** 154 | * get finally output 155 | */ 156 | 157 | self::httpBuildQuery(); 158 | 159 | return self::$json->post(self::$url,$post,'json'); 160 | 161 | 162 | } 163 | 164 | /** 165 | * @method __callStatic 166 | */ 167 | public function __call($namelist,$args){ 168 | 169 | self::$namelist[$namelist]=$args[0]; 170 | return new static; 171 | } 172 | 173 | /** 174 | * @method __callStatic 175 | */ 176 | public static function __callStatic($group,$args){ 177 | 178 | self::$group=$group; 179 | return new static; 180 | } 181 | 182 | /** 183 | * 184 | */ 185 | public static function webServiceConfigMethod($method,$type){ 186 | 187 | $webServiceConfig=staticPathModel::getWebServiceConfig(); 188 | if(method_exists($webServiceConfig,$method)){ 189 | 190 | $queryList=$webServiceConfig->$method(); 191 | 192 | 193 | if(self::$group===null){ 194 | self::$param[$type]=$queryList; 195 | } 196 | 197 | if(isset($queryList[self::$group])){ 198 | self::$param[$type]=$queryList[self::$group]; 199 | } 200 | 201 | 202 | } 203 | } 204 | 205 | /** 206 | * 207 | */ 208 | private static function firstSeperate (){ 209 | 210 | $firstSeperate='?'; 211 | if(preg_match('@\?@is',self::$url)){ 212 | $firstSeperate='&'; 213 | } 214 | return $firstSeperate; 215 | } 216 | 217 | /** 218 | * 219 | */ 220 | private static function httpBuildQuery(){ 221 | 222 | if(count(self::$param)){ 223 | self::$url=self::$url.''.self::firstSeperate().''.http_build_query(self::$param['query']); 224 | } 225 | } 226 | 227 | /** 228 | * 229 | */ 230 | private static function namelist(){ 231 | 232 | foreach (self::$namelist as $namekey=>$namevalue){ 233 | 234 | if(in_array(':'.$namekey,self::$param['query'])){ 235 | $queryNeedle=array_search(':'.$namekey,self::$param['query']); 236 | self::$param['query'][$queryNeedle]=self::$namelist[$namekey]; 237 | } 238 | } 239 | } 240 | 241 | } 242 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Expose `pathtoRegexp`. 3 | */ 4 | //module.exports = pathtoRegexp; 5 | 6 | /** 7 | * The main path matching regexp utility. 8 | * 9 | * @type {RegExp} 10 | */ 11 | var PATH_REGEXP = new RegExp([ 12 | // Match already escaped characters that would otherwise incorrectly appear 13 | // in future matches. This allows the user to escape special characters that 14 | // shouldn't be transformed. 15 | '(\\\\.)', 16 | // Match Express-style parameters and un-named parameters with a prefix 17 | // and optional suffixes. Matches appear as: 18 | // 19 | // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?"] 20 | // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined] 21 | '([\\/.])?(?:\\:(\\w+)(?:\\(((?:\\\\.|[^)])*)\\))?|\\(((?:\\\\.|[^)])*)\\))([+*?])?', 22 | // Match regexp special characters that should always be escaped. 23 | '([.+*?=^!:${}()[\\]|\\/])' 24 | ].join('|'), 'g'); 25 | 26 | /** 27 | * Escape the capturing group by escaping special characters and meaning. 28 | * 29 | * @param {String} group 30 | * @return {String} 31 | */ 32 | function escapeGroup (group) { 33 | return group.replace(/([=!:$\/()])/g, '\\$1'); 34 | } 35 | 36 | /** 37 | * Attach the keys as a property of the regexp. 38 | * 39 | * @param {RegExp} re 40 | * @param {Array} keys 41 | * @return {RegExp} 42 | */ 43 | var attachKeys = function (re, keys) { 44 | re.keys = keys; 45 | 46 | return re; 47 | }; 48 | 49 | /** 50 | * Normalize the given path string, returning a regular expression. 51 | * 52 | * An empty array should be passed in, which will contain the placeholder key 53 | * names. For example `/user/:id` will then contain `["id"]`. 54 | * 55 | * @param {(String|RegExp|Array)} path 56 | * @param {Array} keys 57 | * @param {Object} options 58 | * @return {RegExp} 59 | */ 60 | function pathtoRegexp (path, keys, options) { 61 | if (keys && !Array.isArray(keys)) { 62 | options = keys; 63 | keys = null; 64 | } 65 | 66 | keys = keys || []; 67 | options = options || {}; 68 | 69 | var strict = options.strict; 70 | var end = options.end !== false; 71 | var flags = options.sensitive ? '' : 'i'; 72 | var index = 0; 73 | 74 | if (path instanceof RegExp) { 75 | // Match all capturing groups of a regexp. 76 | var groups = path.source.match(/\((?!\?)/g) || []; 77 | 78 | // Map all the matches to their numeric keys and push into the keys. 79 | keys.push.apply(keys, groups.map(function (match, index) { 80 | return { 81 | name: index, 82 | delimiter: null, 83 | optional: false, 84 | repeat: false 85 | }; 86 | })); 87 | 88 | // Return the source back to the user. 89 | return attachKeys(path, keys); 90 | } 91 | 92 | if (Array.isArray(path)) { 93 | // Map array parts into regexps and return their source. We also pass 94 | // the same keys and options instance into every generation to get 95 | // consistent matching groups before we join the sources together. 96 | path = path.map(function (value) { 97 | return pathtoRegexp(value, keys, options).source; 98 | }); 99 | 100 | // Generate a new regexp instance by joining all the parts together. 101 | return attachKeys(new RegExp('(?:' + path.join('|') + ')', flags), keys); 102 | } 103 | 104 | // Alter the path string into a usable regexp. 105 | path = path.replace(PATH_REGEXP, function (match, escaped, prefix, key, capture, group, suffix, escape) { 106 | // Avoiding re-escaping escaped characters. 107 | if (escaped) { 108 | return escaped; 109 | } 110 | 111 | // Escape regexp special characters. 112 | if (escape) { 113 | return '\\' + escape; 114 | } 115 | 116 | var repeat = suffix === '+' || suffix === '*'; 117 | var optional = suffix === '?' || suffix === '*'; 118 | 119 | keys.push({ 120 | name: key || index++, 121 | delimiter: prefix || '/', 122 | optional: optional, 123 | repeat: repeat 124 | }); 125 | 126 | // Escape the prefix character. 127 | prefix = prefix ? '\\' + prefix : ''; 128 | 129 | // Match using the custom capturing group, or fallback to capturing 130 | // everything up to the next slash (or next period if the param was 131 | // prefixed with a period). 132 | capture = escapeGroup(capture || group || '[^' + (prefix || '\\/') + ']+?'); 133 | 134 | // Allow parameters to be repeated more than once. 135 | if (repeat) { 136 | capture = capture + '(?:' + prefix + capture + ')*'; 137 | } 138 | 139 | // Allow a parameter to be optional. 140 | if (optional) { 141 | return '(?:' + prefix + '(' + capture + '))?'; 142 | } 143 | 144 | // Basic parameter support. 145 | return prefix + '(' + capture + ')'; 146 | }); 147 | 148 | // Check whether the path ends in a slash as it alters some match behaviour. 149 | var endsWithSlash = path[path.length - 1] === '/'; 150 | 151 | // In non-strict mode we allow an optional trailing slash in the match. If 152 | // the path to match already ended with a slash, we need to remove it for 153 | // consistency. The slash is only valid at the very end of a path match, not 154 | // anywhere in the middle. This is important for non-ending mode, otherwise 155 | // "/test/" will match "/test//route". 156 | if (!strict) { 157 | path = (endsWithSlash ? path.slice(0, -2) : path) + '(?:\\/(?=$))?'; 158 | } 159 | 160 | // In non-ending mode, we need prompt the capturing groups to match as much 161 | // as possible by using a positive lookahead for the end or next path segment. 162 | if (!end) { 163 | path += strict && endsWithSlash ? '' : '(?=\\/|$)'; 164 | } 165 | 166 | return attachKeys(new RegExp('^' + path + (end ? '$' : ''), flags), keys); 167 | }; 168 | -------------------------------------------------------------------------------- /src/store/services/httprequest.php: -------------------------------------------------------------------------------- 1 | request=Request::createFromGlobals(); 36 | } 37 | 38 | /** 39 | * get client ip. 40 | * @return mixed 41 | */ 42 | public function getClientIp(){ 43 | 44 | return $this->request->getClientIp(); 45 | } 46 | 47 | /** 48 | * get client headers. 49 | * @return mixed 50 | */ 51 | public function getHeaders(){ 52 | 53 | return $this->request->headers->all(); 54 | } 55 | 56 | /** 57 | * get client header key. 58 | * @return mixed 59 | */ 60 | public function getHeader($data){ 61 | 62 | return $this->request->headers->get($data); 63 | } 64 | 65 | /** 66 | * get add headers. 67 | * @param $header array 68 | * @return mixed 69 | */ 70 | public function addHeader($header=array()){ 71 | 72 | return $this->request->headers->add($header); 73 | } 74 | 75 | /** 76 | * get full url. 77 | * @return mixed 78 | */ 79 | public function fullUrl(){ 80 | 81 | return $this->request->getUri(); 82 | } 83 | 84 | /** 85 | * get http host. 86 | * @return mixed 87 | */ 88 | public function getHost(){ 89 | 90 | return $this->request->getHttpHost(); 91 | } 92 | 93 | /** 94 | * get base path. 95 | * @return mixed 96 | */ 97 | public function getBasePath(){ 98 | 99 | return $this->request->getBasePath(); 100 | } 101 | 102 | /** 103 | * get base url. 104 | * @return mixed 105 | */ 106 | public function getBaseUrl(){ 107 | 108 | return $this->request->getBaseUrl(); 109 | } 110 | 111 | /** 112 | * get isSecure url. 113 | * Checks whether the request is secure or not. 114 | * This method can read the client protocol from the "X-Forwarded-Proto" header 115 | * when trusted proxies were set via "setTrustedProxies()". 116 | * The "X-Forwarded-Proto" header must contain the protocol: "https" or "http". 117 | * If your reverse proxy uses a different header name than "X-Forwarded-Proto" ("SSL_HTTPS" for instance), 118 | * configure it via "setTrustedHeaderName()" with the "client-proto" key. 119 | * @return bool 120 | */ 121 | public function isSecure(){ 122 | 123 | return $this->request->isSecure(); 124 | } 125 | 126 | 127 | /** 128 | * get getDefaultLocale url. 129 | * @return bool 130 | */ 131 | public function getDefaultLocale(){ 132 | 133 | return $this->request->getDefaultLocale(); 134 | } 135 | 136 | /** 137 | * get getDefaultLocale url. 138 | * @param $locale null|string 139 | * @return mixed 140 | */ 141 | public function setLocale($locale=null){ 142 | if($locale!==null){ 143 | return $this->request->setLocale($locale); 144 | } 145 | return null; 146 | 147 | } 148 | 149 | /** 150 | * get input. 151 | * @return mixed 152 | */ 153 | public function input(){ 154 | 155 | return $this->request->request->all(); 156 | } 157 | 158 | /** 159 | * get query. 160 | * @return mixed 161 | */ 162 | public function query(){ 163 | 164 | return $this->request->query->all(); 165 | } 166 | 167 | /** 168 | * get content. 169 | * @return mixed 170 | */ 171 | public function content(){ 172 | 173 | return $this->request->getContent(); 174 | } 175 | 176 | 177 | /** 178 | * get input. 179 | * @return array 180 | */ 181 | public function getQueryString($param=null){ 182 | 183 | $list=[]; 184 | if($this->request->getQueryString()!==null){ 185 | $getQueryString=explode("&",$this->request->getQueryString()); 186 | foreach ($getQueryString as $value){ 187 | $valueexplode=explode("=",$value); 188 | $list[$valueexplode[0]]=$valueexplode[1]; 189 | } 190 | } 191 | 192 | if($param===null){ 193 | return $list; 194 | } 195 | 196 | if(array_key_exists($param,$list)){ 197 | return $list[$param]; 198 | } 199 | return null; 200 | 201 | } 202 | 203 | /** 204 | * get only client header. 205 | * @return array 206 | */ 207 | public function getClientHeaders(){ 208 | 209 | $headers=$this->getHeaders(); 210 | $httpHeaders=['host','connection','cache-control','accept','upgrade-insecure-requests','user-agent', 211 | 'accept-encoding','accept-language','cookie','postman-token','content-length','origin','content-type','clientToken']; 212 | $list=[]; 213 | foreach ($headers as $key=>$value) { 214 | if(!in_array($key,$httpHeaders)){ 215 | $list[$key]=$value; 216 | } 217 | } 218 | return $list; 219 | 220 | } 221 | 222 | 223 | /** 224 | * get only client header. 225 | * @param $key string 226 | * @return boolean 227 | */ 228 | public function existHeader($key){ 229 | 230 | $header=$this->getHeaders(); 231 | 232 | if(isset($header[$key])){ 233 | 234 | return true; 235 | } 236 | 237 | return false; 238 | } 239 | 240 | 241 | } 242 | -------------------------------------------------------------------------------- /external/public/declarations/apidoc_files/send_sample_request.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'jquery' 3 | ], function($) { 4 | 5 | var initDynamic = function() { 6 | // Button send 7 | $(".sample-request-send").off("click"); 8 | $(".sample-request-send").on("click", function(e) { 9 | e.preventDefault(); 10 | var $root = $(this).parents("article"); 11 | var group = $root.data("group"); 12 | var name = $root.data("name"); 13 | var version = $root.data("version"); 14 | sendSampleRequest(group, name, version, $(this).data("sample-request-type")); 15 | }); 16 | 17 | // Button clear 18 | $(".sample-request-clear").off("click"); 19 | $(".sample-request-clear").on("click", function(e) { 20 | e.preventDefault(); 21 | var $root = $(this).parents("article"); 22 | var group = $root.data("group"); 23 | var name = $root.data("name"); 24 | var version = $root.data("version"); 25 | clearSampleRequest(group, name, version); 26 | }); 27 | }; // initDynamic 28 | 29 | function sendSampleRequest(group, name, version, type) 30 | { 31 | var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); 32 | 33 | // Optional header 34 | var header = {}; 35 | $root.find(".sample-request-header:checked").each(function(i, element) { 36 | var group = $(element).data("sample-request-header-group-id"); 37 | $root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) { 38 | var key = $(element).data("sample-request-header-name"); 39 | var value = element.value; 40 | header[key] = $.type(value) === "string" ? escapeHtml(value) : value; 41 | }); 42 | }); 43 | 44 | // create JSON dictionary of parameters 45 | var param = {}; 46 | $root.find(".sample-request-param:checked").each(function(i, element) { 47 | var group = $(element).data("sample-request-param-group-id"); 48 | $root.find("[data-sample-request-param-group=\"" + group + "\"]").each(function(i, element) { 49 | var key = $(element).data("sample-request-param-name"); 50 | var value = element.value; 51 | param[key] = $.type(value) === "string" ? escapeHtml(value) : value; 52 | }); 53 | }); 54 | 55 | // grab user-inputted URL 56 | var url = $root.find(".sample-request-url").val(); 57 | 58 | // Insert url parameter 59 | var pattern = pathtoRegexp(url, null); 60 | var matches = pattern.exec(url); 61 | for (var i = 1; i < matches.length; i++) { 62 | var key = matches[i].substr(1); 63 | if (param[key] !== undefined) { 64 | url = url.replace(matches[i], encodeURIComponent(param[key])); 65 | 66 | // remove URL parameters from list 67 | delete param[key]; 68 | } 69 | } // for 70 | 71 | // send AJAX request, catch success or error callback 72 | $.ajax({ 73 | url: url, 74 | dataType: "json", 75 | contentType: "application/json", 76 | data: JSON.stringify(param), 77 | headers: header, 78 | type: type.toUpperCase(), 79 | success: displaySuccess, 80 | error: displayError 81 | }); 82 | 83 | function displaySuccess(data) { 84 | var jsonResponse; 85 | try { 86 | jsonResponse = JSON.stringify(data, null, 4); 87 | } catch (e) { 88 | jsonResponse = data; 89 | } 90 | $root.find(".sample-request-response").fadeTo(250, 1); 91 | $root.find(".sample-request-response-json").html(jsonResponse); 92 | refreshScrollSpy(); 93 | }; 94 | 95 | function displayError(jqXHR, textStatus, error) { 96 | var message = "Error " + jqXHR.status + ": " + error; 97 | var jsonResponse; 98 | try { 99 | jsonResponse = JSON.parse(jqXHR.responseText); 100 | jsonResponse = JSON.stringify(jsonResponse, null, 4); 101 | } catch (e) { 102 | jsonResponse = jqXHR.responseText; 103 | } 104 | 105 | if (jsonResponse) 106 | message += "
" + jsonResponse; 107 | 108 | // flicker on previous error to make clear that there is a new response 109 | if($root.find(".sample-request-response").is(":visible")) 110 | $root.find(".sample-request-response").fadeTo(1, 0.1); 111 | 112 | $root.find(".sample-request-response").fadeTo(250, 1); 113 | $root.find(".sample-request-response-json").html(message); 114 | refreshScrollSpy(); 115 | }; 116 | } 117 | 118 | function clearSampleRequest(group, name, version) 119 | { 120 | var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); 121 | 122 | // hide sample response 123 | $root.find(".sample-request-response-json").html(""); 124 | $root.find(".sample-request-response").hide(); 125 | 126 | // reset value of parameters 127 | $root.find(".sample-request-param").each(function(i, element) { 128 | element.value = ""; 129 | }); 130 | 131 | // restore default URL 132 | var $urlElement = $root.find(".sample-request-url"); 133 | $urlElement.val($urlElement.prop("defaultValue")); 134 | 135 | refreshScrollSpy(); 136 | } 137 | 138 | function refreshScrollSpy() 139 | { 140 | $('[data-spy="scroll"]').each(function () { 141 | $(this).scrollspy("refresh"); 142 | }); 143 | } 144 | 145 | function escapeHtml(str) { 146 | var div = document.createElement("div"); 147 | div.appendChild(document.createTextNode(str)); 148 | return div.innerHTML; 149 | } 150 | 151 | /** 152 | * Exports. 153 | */ 154 | return { 155 | initDynamic: initDynamic 156 | }; 157 | 158 | }); 159 | -------------------------------------------------------------------------------- /src/store/packages/providers/database/sudb/src/whereBuilderOperation.php: -------------------------------------------------------------------------------- 1 | querySqlFormatter=$querySqlFormatter; 33 | } 34 | 35 | /** 36 | * getSelect method is main method. 37 | * 38 | * @return array 39 | */ 40 | public function whereMainProcess($whereData,$model){ 41 | $list=[]; 42 | if(count($whereData)){ 43 | foreach ($whereData['field'] as $key=>$value){ 44 | if($whereData['operator'][$key]=="LIKE"){ 45 | $list['where'][]=''.$value.' '.$whereData['operator'][$key].' :'.str_replace(".","_",$value).''; 46 | $list['execute'][':'.str_replace(".","_",$value).'']='%'.$whereData['value'][$key].'%'; 47 | } 48 | else{ 49 | if(preg_match('@^between_@is',$value)){ 50 | $value=str_replace("between_","",$value); 51 | $list['where'][]=''.$value.' BETWEEN :'.$value.'_'.md5($whereData['operator'][$key]).' AND :'.$value.'_'.md5($whereData['value'][$key]).''; 52 | $list['execute'][':'.$value.'_'.md5($whereData['operator'][$key]).'']=$whereData['operator'][$key]; 53 | $list['execute'][':'.$value.'_'.md5($whereData['value'][$key]).'']=$whereData['value'][$key]; 54 | } 55 | elseif(preg_match('@^notbetween_@is',$value)){ 56 | $value=str_replace("notbetween_","",$value); 57 | $list['where'][]=''.$value.'<:'.$value.'_'.md5($whereData['operator'][$key]).' OR '.$value.'>:'.$value.'_'.md5($whereData['value'][$key]).''; 58 | $list['execute'][':'.$value.'_'.md5($whereData['operator'][$key]).'']=$whereData['operator'][$key]; 59 | $list['execute'][':'.$value.'_'.md5($whereData['value'][$key]).'']=$whereData['value'][$key]; 60 | } 61 | elseif($value=="today"){ 62 | if(property_exists($model['model'],"createdAndUpdatedFields") && array_key_exists("created_at",$model['model']->createdAndUpdatedFields)){ 63 | $list['where'][]='FROM_UNIXTIME('.$model['model']->createdAndUpdatedFields['created_at'].',"%Y-%m-%d")="'.date("Y-m-d").'"'; 64 | } 65 | 66 | } 67 | elseif($value=="yesterday"){ 68 | if(property_exists($model['model'],"createdAndUpdatedFields") && array_key_exists("created_at",$model['model']->createdAndUpdatedFields)){ 69 | $today=strtotime(date("Y-m-d")); 70 | $yesterdayProcess=60*60*24; 71 | $yesterday=$today-$yesterdayProcess; 72 | $yesterday=date("Y-m-d",$yesterday); 73 | 74 | $list['where'][]='FROM_UNIXTIME('.$model['model']->createdAndUpdatedFields['created_at'].',"%Y-%m-%d")="'.$yesterday.'"'; 75 | } 76 | 77 | } 78 | elseif($value=="weekly"){ 79 | if(property_exists($model['model'],"createdAndUpdatedFields") && array_key_exists("created_at",$model['model']->createdAndUpdatedFields)){ 80 | $today=strtotime(date("Y-m-d")); 81 | $weeklyProcess=60*60*24*7; 82 | $weekly=$today-$weeklyProcess; 83 | $weekly=date("Y-m-d",$weekly); 84 | 85 | $list['where'][]='FROM_UNIXTIME('.$model['model']->createdAndUpdatedFields['created_at'].',"%Y-%m-%d")<="'.date("Y-m-d").'" AND FROM_UNIXTIME('.$model['model']->createdAndUpdatedFields['created_at'].',"%Y-%m-%d")>="'.$weekly.'"'; 86 | } 87 | 88 | } 89 | else{ 90 | 91 | $list['where'][]=''.$value.''.$whereData['operator'][$key].':'.str_replace(".","_",$value).''; 92 | $list['execute'][':'.str_replace(".","_",$value).'']=$whereData['value'][$key]; 93 | } 94 | 95 | } 96 | 97 | } 98 | 99 | 100 | } 101 | 102 | 103 | if(count($model['whereIn'])){ 104 | $valueEx=explode(",",$model['whereIn']['value']); 105 | $paramValueEx=[]; 106 | foreach ($valueEx as $v=>$vv) { 107 | $paramValueEx[]=':'.md5($vv).''; 108 | $list['execute'][':'.md5($vv).'']=$vv; 109 | } 110 | 111 | $list['where'][]=''.$model['whereIn']['field'].' IN ('.implode(",",$paramValueEx).')'; 112 | 113 | 114 | } 115 | 116 | 117 | if(count($model['whereNotIn'])){ 118 | $valueEx=explode(",",$model['whereNotIn']['value']); 119 | $paramValueEx=[]; 120 | foreach ($valueEx as $v=>$vv) { 121 | $paramValueEx[]=':'.md5($vv).''; 122 | $list['execute'][':'.md5($vv).'']=$vv; 123 | } 124 | 125 | $list['where'][]=''.$model['whereNotIn']['field'].' NOT IN ('.implode(",",$paramValueEx).')'; 126 | 127 | 128 | } 129 | 130 | 131 | if(array_key_exists('where',$list) && is_array($list['where'])){ 132 | $list['where']='WHERE '.implode(" AND ",$list['where']); 133 | } 134 | else{ 135 | $list['where']=''; 136 | } 137 | 138 | return (object)$list; 139 | } 140 | 141 | 142 | } -------------------------------------------------------------------------------- /src/store/services/cache.php: -------------------------------------------------------------------------------- 1 | adapter=$base->cacheAdapter; 45 | 46 | 47 | } 48 | /** 49 | * cache adapter data. 50 | * 51 | * @return cache adapter method 52 | */ 53 | public function adapter($adapter=null) 54 | { 55 | //adapter set 56 | if($adapter!==null){ 57 | $this->adapter=$adapter; 58 | } 59 | return $this; 60 | } 61 | 62 | 63 | 64 | /** 65 | * cache expire data. 66 | * 67 | * @return cache expire method 68 | */ 69 | public function expire($expire=null) 70 | { 71 | //expire set 72 | if($expire!==null){ 73 | $this->cacheExpire=$expire; 74 | } 75 | return $this; 76 | } 77 | 78 | 79 | /** 80 | * cache name data. 81 | * 82 | * @return cache name method 83 | */ 84 | public function name($name=null) 85 | { 86 | //name set 87 | if($name!==null){ 88 | $this->name=$name; 89 | } 90 | return $this; 91 | } 92 | 93 | 94 | /** 95 | * cache name data. 96 | * 97 | * @return cache name method 98 | */ 99 | public function getName() 100 | { 101 | //get Item 102 | if($this->name===null){ 103 | $name="".request."_".service."_".method; 104 | } 105 | else{ 106 | $name=$this->name; 107 | } 108 | 109 | return 'cache'.$name; 110 | } 111 | 112 | public function cachePath(){ 113 | if($this->adapter==="file"){ 114 | if(defined("devPackage")){ 115 | $this->directoryPath ='./src/packages/dev/'.service.'/cache'; 116 | } 117 | else{ 118 | $this->directoryPath = application.'/storage/resourches/cache/'.service; 119 | $file=new file(); 120 | if(!$file->exists($this->directoryPath)){ 121 | $file->mkdir(application.'/storage/resourches','cache'); 122 | $file->mkdir(application.'/storage/resourches/cache',service); 123 | } 124 | } 125 | } 126 | } 127 | 128 | 129 | /** 130 | * cache get data. 131 | * 132 | * @return cache class 133 | */ 134 | public function get($callback) 135 | { 136 | $this->cachePath(); 137 | 138 | //adapter set 139 | $adapterMethod=$this->adapter.'CacheAdapter'; 140 | 141 | if($this->adapter==='file'){ 142 | $this->$adapterMethod(); 143 | } 144 | else{ 145 | return $this->$adapterMethod($callback); 146 | } 147 | 148 | 149 | $name=$this->getName(); 150 | 151 | $nameSet=$this->cache->getItem($name); 152 | 153 | //check is hit 154 | if (!$nameSet->isHit()) { 155 | // ... item does not exists in the cache 156 | $data=call_user_func($callback); 157 | $nameSet->set($data); 158 | $this->cache->save($nameSet); 159 | return $data; 160 | } 161 | return $nameSet->get(); 162 | 163 | } 164 | 165 | 166 | /** 167 | * file cache adapter. 168 | * 169 | * @return file adapter class 170 | */ 171 | public function fileCacheAdapter() 172 | { 173 | 174 | 175 | $this->cache = new FilesystemAdapter( 176 | // the subdirectory of the main cache directory where cache items are stored 177 | $namespace = '', 178 | // in seconds; applied to cache items that don't define their own lifetime 179 | // 0 means to store the cache items indefinitely (i.e. until the files are deleted) 180 | $defaultLifetime = $this->cacheExpire, 181 | // the main cache directory (the application needs read-write permissions on it) 182 | // if none is specified, a directory is created inside the system temporary directory 183 | $directory=$this->directoryPath 184 | 185 | ); 186 | } 187 | 188 | 189 | /** 190 | * php file cache adapter. 191 | * 192 | * @return php file adapter class 193 | */ 194 | public function phpCacheAdapter() 195 | { 196 | $this->cache = new PhpFilesAdapter( 197 | // the subdirectory of the main cache directory where cache items are stored 198 | $namespace = '', 199 | // in seconds; applied to cache items that don't define their own lifetime 200 | // 0 means to store the cache items indefinitely (i.e. until the files are deleted) 201 | $defaultLifetime = $this->fileExpire, 202 | // the main cache directory (the application needs read-write permissions on it) 203 | // if none is specified, a directory is created inside the system temporary directory 204 | $directory=$this->directoryPath 205 | ); 206 | } 207 | 208 | 209 | /** 210 | * redis cache adapter. 211 | * 212 | * @return redis adapter class 213 | */ 214 | public function redisCacheAdapter($callback) 215 | { 216 | $redisConnection=app('redis'); 217 | $name=$this->getName(); 218 | if(!$redisConnection->exists($name)){ 219 | $data=call_user_func($callback); 220 | $redisConnection->set([$name,json_encode($data)]); 221 | if($this->cacheExpire!==null){ 222 | $redisConnection->expire($name,$this->cacheExpire); 223 | } 224 | } 225 | return json_decode($redisConnection->get($name),1); 226 | } 227 | 228 | 229 | 230 | } 231 | -------------------------------------------------------------------------------- /src/store/services/faker.php: -------------------------------------------------------------------------------- 1 | faker=\Faker\Factory::create('tr_TR'); 30 | } 31 | 32 | /** 33 | * faker call_static get data. 34 | * 35 | * @return faker class 36 | */ 37 | public static function __callStatic($name,$arg=array()) 38 | { 39 | $instance=new self; 40 | $method='get'.ucfirst($name).''; 41 | return $instance->$method($arg); 42 | } 43 | 44 | /** 45 | * faker call_static get data. 46 | * 47 | * @return faker class 48 | */ 49 | public function getName($arg=array()) 50 | { 51 | return $this->faker->name(); 52 | } 53 | 54 | /** 55 | * faker call_static get data. 56 | * 57 | * @return faker class 58 | */ 59 | public function getLastName($arg=array()) 60 | { 61 | return $this->faker->lastName(); 62 | } 63 | 64 | /** 65 | * faker call_static get data. 66 | * 67 | * @return faker class 68 | */ 69 | public function getUsername($arg=array()) 70 | { 71 | return $this->faker->userName(); 72 | } 73 | 74 | /** 75 | * faker call_static get data. 76 | * 77 | * @return faker class 78 | */ 79 | public function getPassword($arg=array()) 80 | { 81 | if(count($arg)){ 82 | if(array_key_exists(1,$arg)){ 83 | return $this->faker->password($arg[0],$arg[1]); 84 | } 85 | 86 | return $this->faker->password($arg[0]); 87 | 88 | } 89 | return $this->faker->password(); 90 | } 91 | 92 | /** 93 | * faker call_static get data. 94 | * 95 | * @return faker class 96 | */ 97 | public function getPhoneNumber($arg=array()) 98 | { 99 | return $this->faker->phoneNumber(); 100 | } 101 | 102 | /** 103 | * faker call_static get data. 104 | * 105 | * @return faker class 106 | */ 107 | public function getText($arg=array()) 108 | { 109 | if(count($arg)){ 110 | return $this->faker->text($arg[0]); 111 | } 112 | return $this->faker->text(); 113 | } 114 | 115 | /** 116 | * faker call_static get data. 117 | * 118 | * @return faker class 119 | */ 120 | public function getAddress($arg=array()) 121 | { 122 | return $this->faker->address(); 123 | } 124 | 125 | /** 126 | * faker call_static get data. 127 | * 128 | * @return faker class 129 | */ 130 | public function getCity($arg=array()) 131 | { 132 | return $this->faker->city(); 133 | } 134 | 135 | /** 136 | * faker call_static get data. 137 | * 138 | * @return faker class 139 | */ 140 | public function getCitySuffix($arg=array()) 141 | { 142 | return $this->faker->citySuffix(); 143 | } 144 | 145 | /** 146 | * faker call_static get data. 147 | * 148 | * @return faker class 149 | */ 150 | public function getPostcode($arg=array()) 151 | { 152 | return $this->faker->postcode(); 153 | } 154 | 155 | /** 156 | * faker call_static get data. 157 | * 158 | * @return faker class 159 | */ 160 | public function getCountry($arg=array()) 161 | { 162 | return $this->faker->country(); 163 | } 164 | 165 | /** 166 | * faker call_static get data. 167 | * 168 | * @return faker class 169 | */ 170 | public function getCountryCode($arg=array()) 171 | { 172 | return $this->faker->countryCode(); 173 | } 174 | 175 | /** 176 | * faker call_static get data. 177 | * 178 | * @return faker class 179 | */ 180 | public function getLatitude($arg=array()) 181 | { 182 | return $this->faker->latitude(); 183 | } 184 | 185 | 186 | /** 187 | * faker call_static get data. 188 | * 189 | * @return faker class 190 | */ 191 | public function getLongitude($arg=array()) 192 | { 193 | return $this->faker->longitude(); 194 | } 195 | 196 | /** 197 | * faker call_static get data. 198 | * 199 | * @return faker class 200 | */ 201 | public function getUnixTime($arg=array()) 202 | { 203 | return $this->faker->unixTime(); 204 | } 205 | 206 | /** 207 | * faker call_static get data. 208 | * 209 | * @return faker class 210 | */ 211 | public function getBoolean($arg=array()) 212 | { 213 | return $this->faker->boolean(); 214 | } 215 | 216 | /** 217 | * faker call_static get data. 218 | * 219 | * @return faker class 220 | */ 221 | public function getDate($arg=array()) 222 | { 223 | if(count($arg)){ 224 | if(array_key_exists(1,$arg)){ 225 | return $this->faker->date($arg[0],$arg[1]); 226 | } 227 | 228 | return $this->faker->date($arg[0]); 229 | 230 | } 231 | return $this->faker->date(); 232 | } 233 | 234 | /** 235 | * faker call_static get data. 236 | * 237 | * @return faker class 238 | */ 239 | public function getTime($arg=array()) 240 | { 241 | if(count($arg)){ 242 | if(array_key_exists(1,$arg)){ 243 | return $this->faker->time($arg[0],$arg[1]); 244 | } 245 | 246 | return $this->faker->time($arg[0]); 247 | 248 | } 249 | return $this->faker->time(); 250 | } 251 | 252 | 253 | /** 254 | * faker call_static get data. 255 | * 256 | * @return faker class 257 | */ 258 | public function getRandomNumber($arg=array()) 259 | { 260 | if(count($arg)){ 261 | if(array_key_exists(1,$arg)){ 262 | return $this->faker->randomNumber($arg[0],$arg[1]); 263 | } 264 | 265 | return $this->faker->randomNumber($arg[0]); 266 | 267 | } 268 | return $this->faker->randomNumber(); 269 | } 270 | 271 | /** 272 | * faker call_static get data. 273 | * 274 | * @return faker class 275 | */ 276 | public function getRandomFloat($arg=array()) 277 | { 278 | if(count($arg)){ 279 | if(array_key_exists(1,$arg)){ 280 | return $this->faker->randomFloat(2,$arg[0],$arg[1]); 281 | } 282 | 283 | return $this->faker->randomFloat(2,$arg[0]); 284 | 285 | } 286 | return $this->faker->randomFloat(2,0,NULL); 287 | } 288 | 289 | 290 | 291 | } 292 | -------------------------------------------------------------------------------- /src/store/packages/providers/migrations/consoleColors.php: -------------------------------------------------------------------------------- 1 | foreground_colors['black'] = '0;30'; 21 | $this->foreground_colors['dark_gray'] = '1;30'; 22 | $this->foreground_colors['blue'] = '0;34'; 23 | $this->foreground_colors['light_blue'] = '1;34'; 24 | $this->foreground_colors['green'] = '0;32'; 25 | $this->foreground_colors['light_green'] = '1;32'; 26 | $this->foreground_colors['cyan'] = '0;36'; 27 | $this->foreground_colors['light_cyan'] = '1;36'; 28 | $this->foreground_colors['red'] = '0;31'; 29 | $this->foreground_colors['light_red'] = '1;31'; 30 | $this->foreground_colors['purple'] = '0;35'; 31 | $this->foreground_colors['light_purple'] = '1;35'; 32 | $this->foreground_colors['brown'] = '0;33'; 33 | $this->foreground_colors['yellow'] = '1;33'; 34 | $this->foreground_colors['light_gray'] = '0;37'; 35 | $this->foreground_colors['white'] = '1;37'; 36 | 37 | $this->background_colors['black'] = '40'; 38 | $this->background_colors['red'] = '41'; 39 | $this->background_colors['green'] = '42'; 40 | $this->background_colors['yellow'] = '43'; 41 | $this->background_colors['blue'] = '44'; 42 | $this->background_colors['magenta'] = '45'; 43 | $this->background_colors['cyan'] = '46'; 44 | $this->background_colors['light_gray'] = '47'; 45 | } 46 | 47 | // Returns colored string 48 | public function getColoredString($string, $foreground_color = null, $background_color = null) { 49 | $colored_string = ""; 50 | 51 | // Check if given foreground color found 52 | if (isset($this->foreground_colors[$foreground_color])) { 53 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 54 | } 55 | // Check if given background color found 56 | if (isset($this->background_colors[$background_color])) { 57 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 58 | } 59 | 60 | // Add string and end coloring 61 | $colored_string .= $string . "\033[0m"; 62 | 63 | return $colored_string; 64 | } 65 | 66 | 67 | // Returns colored string information 68 | public function info($string, $foreground_color = 'blue', $background_color = 'white') { 69 | $colored_string = ""; 70 | 71 | // Check if given foreground color found 72 | if (isset($this->foreground_colors[$foreground_color])) { 73 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 74 | } 75 | // Check if given background color found 76 | if (isset($this->background_colors[$background_color])) { 77 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 78 | } 79 | 80 | // Add string and end coloring 81 | $colored_string .= $string . "\033[0m"; 82 | 83 | return '' . PHP_EOL.''.$colored_string.'' . PHP_EOL; 84 | } 85 | 86 | // Returns colored string information 87 | public function error($string, $foreground_color = 'white', $background_color = 'red') { 88 | $colored_string = ""; 89 | 90 | // Check if given foreground color found 91 | if (isset($this->foreground_colors[$foreground_color])) { 92 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 93 | } 94 | // Check if given background color found 95 | if (isset($this->background_colors[$background_color])) { 96 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 97 | } 98 | 99 | // Add string and end coloring 100 | $colored_string .= "!!!! Error : ".$string . " \033[0m"; 101 | 102 | return '' . PHP_EOL.''.$colored_string.'' . PHP_EOL; 103 | } 104 | 105 | 106 | // Returns colored string information 107 | public function success($string, $foreground_color = 'white', $background_color = 'yellow') { 108 | $colored_string = ""; 109 | 110 | // Check if given foreground color found 111 | if (isset($this->foreground_colors[$foreground_color])) { 112 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 113 | } 114 | // Check if given background color found 115 | if (isset($this->background_colors[$background_color])) { 116 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 117 | } 118 | 119 | // Add string and end coloring 120 | $colored_string .= $string . "\033[0m"; 121 | 122 | return ''.$colored_string.'' . PHP_EOL; 123 | } 124 | 125 | 126 | // Returns colored string information 127 | public function classical($string, $foreground_color = 'red', $background_color = 'white') { 128 | $colored_string = ""; 129 | 130 | // Check if given foreground color found 131 | if (isset($this->foreground_colors[$foreground_color])) { 132 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 133 | } 134 | // Check if given background color found 135 | if (isset($this->background_colors[$background_color])) { 136 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 137 | } 138 | 139 | // Add string and end coloring 140 | $colored_string .= $string . "\033[0m"; 141 | 142 | return ''.$colored_string.'' . PHP_EOL; 143 | } 144 | 145 | 146 | 147 | 148 | 149 | // Returns colored string information 150 | public function warning($string, $foreground_color = 'white', $background_color = 'magenta') { 151 | $colored_string = ""; 152 | 153 | // Check if given foreground color found 154 | if (isset($this->foreground_colors[$foreground_color])) { 155 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 156 | } 157 | // Check if given background color found 158 | if (isset($this->background_colors[$background_color])) { 159 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 160 | } 161 | 162 | // Add string and end coloring 163 | $colored_string .= "".$string . " \033[0m"; 164 | 165 | return '' . PHP_EOL.''.$colored_string.'' . PHP_EOL; 166 | } 167 | 168 | 169 | // Returns colored string information 170 | public function done($string, $foreground_color = 'white', $background_color = 'yellow') { 171 | $colored_string = ""; 172 | 173 | // Check if given foreground color found 174 | if (isset($this->foreground_colors[$foreground_color])) { 175 | $colored_string .= "\033[" . $this->foreground_colors[$foreground_color] . "m"; 176 | } 177 | // Check if given background color found 178 | if (isset($this->background_colors[$background_color])) { 179 | $colored_string .= "\033[" . $this->background_colors[$background_color] . "m"; 180 | } 181 | 182 | // Add string and end coloring 183 | $colored_string .= "".$string . " \033[0m"; 184 | 185 | return '' . PHP_EOL.''.$colored_string.'' . PHP_EOL; 186 | } 187 | 188 | // Returns all foreground color names 189 | public function getForegroundColors() { 190 | return array_keys($this->foreground_colors); 191 | } 192 | 193 | // Returns all background color names 194 | public function getBackgroundColors() { 195 | return array_keys($this->background_colors); 196 | } 197 | } 198 | 199 | -------------------------------------------------------------------------------- /src/store/services/appcollection.php: -------------------------------------------------------------------------------- 1 | all(); 33 | } 34 | return null; 35 | } 36 | 37 | /** 38 | * collection avg get data. 39 | * The avg method returns the average of all items in the collection: 40 | * If the collection contains nested arrays or objects, 41 | * you should pass a key to use for determining which values to calculate the average: 42 | * @return collection class 43 | */ 44 | public function avg($data=array(),$key=null) 45 | { 46 | if(count($data)){ 47 | if($key==null){ 48 | return collect($data)->avg(); 49 | } 50 | return collect($data)->avg($key); 51 | } 52 | return null; 53 | } 54 | 55 | /** 56 | * collection chunk get data. 57 | * The chunk method breaks the collection into multiple, smaller collections of a given size: 58 | * @return collection class 59 | */ 60 | public function chunk($data=array(),$chunk) 61 | { 62 | if(count($data)){ 63 | $collect=collect($data)->chunk($chunk); 64 | return $collect->toArray(); 65 | } 66 | return null; 67 | } 68 | 69 | /** 70 | * collection collapse get data. 71 | * The collapse method collapses a collection of arrays into a single, flat collection: 72 | * @return collection class 73 | */ 74 | public function collapse($data=array()) 75 | { 76 | if(count($data)){ 77 | $collect=collect($data)->collapse(); 78 | return $collect->all(); 79 | } 80 | return null; 81 | } 82 | 83 | /** 84 | * collection combine get data. 85 | * The combine method combines the keys of the collection with the values of another array or collection: 86 | * @return collection class 87 | */ 88 | public function combine($data=array(),$combineArray=array()) 89 | { 90 | if(count($data)){ 91 | $collect=collect($data)->combine($combineArray); 92 | return $collect->all(); 93 | } 94 | return null; 95 | } 96 | 97 | 98 | /** 99 | * collection contains get data. 100 | * The contains method determines whether the collection contains a given item: 101 | * You may also pass a key / value pair to the contains method, which will determine if the given pair exists in the collection: 102 | * Finally, you may also pass a callback to the contains method to perform your own truth test 103 | * @return collection class 104 | */ 105 | public function contains($data=array(),$containvalue,$containkey=null) 106 | { 107 | if(count($data)){ 108 | 109 | //collect data 110 | $collect=collect($data); 111 | 112 | if($containkey==null){ 113 | 114 | //callback $containvalue 115 | if(is_callable($containvalue)){ 116 | return $collect->contains($containvalue); 117 | } 118 | //$containkey is null 119 | return $collect->contains($containvalue); 120 | } 121 | 122 | //$containkey is not null 123 | return $collect->contains($containkey,$containvalue); 124 | 125 | } 126 | return null; 127 | } 128 | 129 | /** 130 | * collection count get data. 131 | * The count method returns the total number of items in the collection: 132 | * @return collection class 133 | */ 134 | public function count($data=array()) 135 | { 136 | if(count($data)){ 137 | return collect($data)->count(); 138 | } 139 | return null; 140 | } 141 | 142 | /** 143 | * collection diff get data. 144 | * The diff method compares the collection against another collection or a plain PHP array based on its values. 145 | * This method will return the values in the original collection that are not present in the given collection: 146 | * @return collection class 147 | */ 148 | public function diff($data=array(),$diffArray=array()) 149 | { 150 | if(count($data)){ 151 | $collect=collect($data)->diff($diffArray); 152 | return $collect->all(); 153 | } 154 | return null; 155 | } 156 | 157 | /** 158 | * collection max get data. 159 | * The max method returns the maximum value of a given key: 160 | * @return collection class 161 | */ 162 | public function max($data=array(),$key=null) 163 | { 164 | if(count($data)){ 165 | if($key===null){ 166 | return collect($data)->max(); 167 | } 168 | return collect($data)->max($key); 169 | 170 | } 171 | return null; 172 | } 173 | 174 | /** 175 | * collection min get data. 176 | * The max method returns the minimum value of a given key: 177 | * @return collection class 178 | */ 179 | public function min($data=array(),$key=null) 180 | { 181 | if(count($data)){ 182 | if($key===null){ 183 | return collect($data)->min(); 184 | } 185 | return collect($data)->min($key); 186 | 187 | } 188 | return null; 189 | } 190 | 191 | /** 192 | * collection sum get data. 193 | * The sum method returns the sum of all items in the collection: 194 | * @return collection class 195 | */ 196 | public function sum($data=array(),$callback=null) 197 | { 198 | if(count($data)){ 199 | if(is_callable($callback)){ 200 | return collect($data)->sum($callback); 201 | } 202 | 203 | if($callback===null){ 204 | return collect($data)->sum(); 205 | } 206 | return collect($data)->sum($callback); 207 | 208 | 209 | } 210 | return null; 211 | } 212 | 213 | /** 214 | * collection diffKeys get data. 215 | * The diffKeys method compares the collection against another collection or a plain PHP array based on its keys. 216 | * This method will return the key / value pairs in the original collection that are not present in the given collection. 217 | * @return collection class 218 | */ 219 | public function diffKeys($data=array(),$diffKeysArray=array()) 220 | { 221 | if(count($data)){ 222 | $collect=collect($data)->diffKeys($diffKeysArray); 223 | return $collect->all(); 224 | } 225 | return null; 226 | } 227 | 228 | /** 229 | * collection except get data. 230 | * The except method returns all items in the collection except for those with the specified keys 231 | * @return collection class 232 | */ 233 | public function except($data=array(),$exceptArray=array()) 234 | { 235 | if(count($data)){ 236 | $collect=collect($data)->except($diffKeysArray); 237 | return $collect->all(); 238 | } 239 | return null; 240 | } 241 | 242 | /** 243 | * collection filter get data. 244 | * The filter method filters the collection using the given callback, keeping only those items that pass a given truth test: 245 | * @return collection class 246 | */ 247 | public function filter($data=array(),$callback=null) 248 | { 249 | if(count($data)){ 250 | if(is_callable($callback)){ 251 | $collect=collect($data)->filter($callback); 252 | } 253 | else{ 254 | $collect=collect($data)->filter(); 255 | } 256 | 257 | return $collect->all(); 258 | } 259 | return null; 260 | } 261 | 262 | /** 263 | * collection first get data. 264 | * The first method returns the first element in the collection that passes a given truth test: 265 | * @return mixed 266 | */ 267 | public function first($data=array(),$callback=null) 268 | { 269 | if(count($data)){ 270 | if(is_callable($callback)){ 271 | return collect($data)->first($callback); 272 | } 273 | else{ 274 | return collect($data)->first(); 275 | } 276 | 277 | } 278 | return null; 279 | } 280 | 281 | 282 | /** 283 | * @param $data array 284 | * @param $search 285 | * @param $loose 286 | * The search method searches the collection for the given value and returns its key if found. 287 | * If the item is not found, false is returned. 288 | * @return mixed 289 | */ 290 | public function search($data=array(),$search,$loose=false) 291 | { 292 | if(count($data)){ 293 | return collect($data)->search($search,$loose); 294 | } 295 | return null; 296 | } 297 | 298 | 299 | 300 | } 301 | --------------------------------------------------------------------------------