forked from agriya/groupdeal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
agriya#2 Core folder Structureand App Folder files Changes
- Loading branch information
ahsan
committed
Jun 28, 2019
1 parent
55ab74e
commit 64e0664
Showing
2,008 changed files
with
144,631 additions
and
258,256 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?php | ||
/** | ||
* Group Deal | ||
* | ||
* PHP version 5 | ||
* | ||
* @category PHP | ||
* @package GroupDeal | ||
* @subpackage Core | ||
* @author Agriya <[email protected]> | ||
* @copyright 2018 Agriya Infoway Private Ltd | ||
* @license http://www.agriya.com/ Agriya Infoway Licence | ||
* @link http://www.agriya.com | ||
*/ | ||
/** | ||
* Short description for file. | ||
* | ||
* Long description for file | ||
* | ||
* PHP versions 4 and 5 | ||
* | ||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org) | ||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) | ||
* | ||
* Licensed under The MIT License | ||
* Redistributions of files must retain the above copyright notice. | ||
* | ||
* @filesource | ||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org) | ||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project | ||
* @package cake | ||
* @subpackage cake.app.config | ||
* @since CakePHP(tm) v 0.10.8.2117 | ||
* @version $Revision: 7805 $ | ||
* @modifiedby $LastChangedBy: AD7six $ | ||
* @lastmodified $Date: 2008-10-30 23:00:26 +0530 (Thu, 30 Oct 2008) $ | ||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License | ||
*/ | ||
/** | ||
* | ||
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded | ||
* This is an application wide file to load any function that is not used within a class define. | ||
* You can also use this to include or require any files in your application. | ||
* | ||
*/ | ||
/** | ||
* The settings below can be used to set additional paths to models, views and controllers. | ||
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470) | ||
* | ||
* $modelPaths = array('full path to models', 'second full path to models', 'etc...'); | ||
* $viewPaths = array('this path to views', 'second full path to views', 'etc...'); | ||
* $controllerPaths = array('this path to controllers', 'second full path to controllers', 'etc...'); | ||
* | ||
*/ | ||
date_default_timezone_set(date_default_timezone_get()); | ||
App::import('Lib', 'CmsHook'); | ||
App::uses('PhpReader', 'Configure'); | ||
App::import('Core', 'config/PhpReader'); | ||
App::uses('CakeLog', 'Log'); | ||
App::uses('CmsPlugin', 'Extensions.Lib'); | ||
App::uses('CmsEventManager', 'Event'); | ||
App::import('Lib', 'Cms'); | ||
App::import('Lib', 'CmsNav'); | ||
CakePlugin::load(array( | ||
'Extensions' | ||
) , array( | ||
'bootstrap' => true | ||
)); | ||
CakePlugin::load(array( | ||
'DebugKit' | ||
)); | ||
Configure::config('default', new PhpReader()); | ||
Configure::load('config'); | ||
define('DEFAULT_LANGUAGE', 'en'); | ||
$user_preferred_city = ''; | ||
// Chekcing whether user ahev alreday visited our site | ||
$user_preferred_city = (!empty($_COOKIE['CakeCookie']['city_slug'])) ? $_COOKIE['CakeCookie']['city_slug'] : Cache::read('site.default_city', 'long'); | ||
// For Subdoamin concept | ||
if (Cache::read('site.city_url', 'long') == 'subdomain') { | ||
$tmp_city = substr(env('HTTP_HOST') , 0, strpos(env('HTTP_HOST') , '.')); | ||
if (!isset($_GET['url'])) { | ||
$_GET['url'] = 'deals/index'; | ||
} | ||
if (strlen($tmp_city) > 0) { | ||
$site_domain = substr(env('HTTP_HOST') , strpos(env('HTTP_HOST') , '.')); | ||
ini_set('session.cookie_domain', $site_domain); | ||
if ($tmp_city == 'www' or $tmp_city == 'm' or $tmp_city == Configure::read('site.domain')) { | ||
$_GET['url'].= !empty($user_preferred_city) ? '/city:' . $user_preferred_city : ''; | ||
} else { | ||
$_GET['url'].= '/city:' . $tmp_city; | ||
} | ||
} else { | ||
$_GET['url'].= !empty($user_preferred_city) ? '/city:' . $user_preferred_city : ''; | ||
} | ||
} | ||
if (Cache::read('site.city_url', 'long') == 'prefix') { | ||
if (!function_exists('router_url_city')) { | ||
function router_url_city($url, $named = null) | ||
{ | ||
$user_preferred_city = (!empty($_COOKIE['CakeCookie']['city_slug'])) ? $_COOKIE['CakeCookie']['city_slug'] : Cache::read('site.default_city', 'long'); | ||
if ($city_url = (!empty($url['city']) ? $url['city'] : (!empty($named['city']) ? $named['city'] : $user_preferred_city))) { | ||
if ($city_url == '/') $city_url = $user_preferred_city; | ||
if (is_array($url)) { | ||
$url['city'] = htmlentities($city_url, ENT_QUOTES); | ||
} else if ($url == '/') { | ||
$url = array( | ||
'city' => htmlentities($city_url, ENT_QUOTES) | ||
); | ||
} | ||
} | ||
return $url; | ||
} | ||
} | ||
$GLOBALS['_city']['icm'] = 0; | ||
if (!isset($_GET['url'])) { | ||
if (stripos(getenv('HTTP_HOST') , 'touch.') === false) { | ||
if (!empty($user_preferred_city)) { | ||
$_GET['url'] = $user_preferred_city; | ||
$GLOBALS['_city']['icm'] = 1; | ||
} | ||
} | ||
} else { | ||
$controllers = Cache::read('controllers_list', 'default'); | ||
$controller_arr = explode('|', $controllers); | ||
// hardcoded for view pages | ||
array_push($controller_arr, 'company', 'deal', 'page', 'user', 'admin', 'deal_user', 'contactus', 'sitemap', 'robots', 'sitemap.xml', 'robots.txt'); | ||
$url_arr = explode('/', $_GET['url']); | ||
$check_welcome_page = preg_match('/welcome_to_/', $_GET['url']); | ||
if (in_array($url_arr[0], $controller_arr) && empty($check_welcome_page)) { | ||
// quick fix. need to discuss. | ||
if (preg_match('/city:([^\/]*)(\/)*/', $_GET['url'], $matches)) { | ||
$current_tmp_city = $matches[1]; | ||
} | ||
$tmp_url = $_GET['url']; | ||
unset($_GET['url']); | ||
if (!empty($current_tmp_city)) { | ||
$_GET['url'] = $current_tmp_city . '/' . $tmp_url; | ||
} else if (!empty($user_preferred_city)) { | ||
$_GET['url'] = $user_preferred_city . '/' . $tmp_url; | ||
$GLOBALS['_city']['icm'] = 1; | ||
} | ||
} | ||
} | ||
} | ||
require 'constants.php'; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
<?php | ||
/** | ||
* FP Platform | ||
* | ||
* PHP version 5 | ||
* | ||
* @category PHP | ||
* @package FPPlatform | ||
* @subpackage Core | ||
* @author Agriya <[email protected]> | ||
* @copyright 2018 Agriya Infoway Private Ltd | ||
* @license http://www.agriya.com/ Agriya Infoway Licence | ||
* @link http://www.agriya.com | ||
*/ | ||
/** | ||
* Default Acl plugin. Custom Acl plugin should override this value. | ||
*/ | ||
Configure::write('Site.acl_plugin', 'Acl'); | ||
/** | ||
* Locale | ||
*/ | ||
Configure::write('Config.language', 'eng'); | ||
/** | ||
* Admin theme | ||
*/ | ||
//Configure::write('Site.admin_theme', 'sample'); | ||
|
||
/** | ||
* Cache configuration | ||
*/ | ||
$cacheConfig = array( | ||
'duration' => '+1 hour', | ||
'path' => CACHE . 'queries', | ||
'engine' => 'File', | ||
); | ||
// models | ||
Cache::config('setting_write_configuration', $cacheConfig); | ||
// components | ||
Cache::config('cms_blocks', $cacheConfig); | ||
Cache::config('cms_menus', $cacheConfig); | ||
Cache::config('cms_nodes', $cacheConfig); | ||
Cache::config('cms_types', $cacheConfig); | ||
Cache::config('cms_vocabularies', $cacheConfig); | ||
// controllers | ||
Cache::config('nodes_view', $cacheConfig); | ||
Cache::config('nodes_promoted', $cacheConfig); | ||
Cache::config('nodes_term', $cacheConfig); | ||
Cache::config('nodes_index', $cacheConfig); | ||
Cache::config('contacts_view', $cacheConfig); | ||
/** | ||
* Failed login attempts | ||
* | ||
* Default is 5 failed login attempts in every 5 minutes | ||
*/ | ||
Configure::write('User.failed_login_limit', 5); | ||
Configure::write('User.failed_login_duration', 300); | ||
Cache::config('users_login', array_merge($cacheConfig, array( | ||
'duration' => '+' . Configure::read('User.failed_login_duration') . ' seconds', | ||
))); | ||
/** | ||
* Plugins | ||
*/ | ||
$aclPlugin = Configure::read('Site.acl_plugin'); | ||
$pluginBootstraps = Configure::read('Hook.bootstraps'); | ||
$plugins = array_filter(explode(',', $pluginBootstraps)); | ||
if (!in_array($aclPlugin, $plugins)) { | ||
$plugins = Set::merge($aclPlugin, $plugins); | ||
} | ||
foreach($plugins AS $plugin) { | ||
$pluginName = Inflector::camelize($plugin); | ||
if (!file_exists(APP . 'Plugin' . DS . $pluginName)) { | ||
CakeLog::write(LOG_ERR, 'Plugin not found during bootstrap: ' . $pluginName); | ||
continue; | ||
} | ||
$bootstrapFile = APP . 'Plugin' . DS . $pluginName . DS . 'Config' . DS . 'bootstrap.php'; | ||
$bootstrap = file_exists($bootstrapFile); | ||
$routesFile = APP . 'Plugin' . DS . $pluginName . DS . 'Config' . DS . 'routes.php'; | ||
$routes = file_exists($routesFile); | ||
$option = array( | ||
$pluginName => array( | ||
'bootstrap' => $bootstrap, | ||
'routes' => $routes, | ||
) | ||
); | ||
CmsPlugin::load($option); | ||
_pluginControllerCache($pluginName); | ||
} | ||
_pluginControllerCache('Extensions'); | ||
function _pluginControllerCache($pluginName) | ||
{ | ||
$plugins_controllers = Cache::read($pluginName . '_controllers_list', 'long'); | ||
if ($plugins_controllers != 'null' || $plugins_controllers === false) { | ||
$plugins_controllers = App::objects($pluginName . '.Controller'); | ||
// alternate name | ||
$job_alternate_name = strtolower(Configure::read('job.job_alternate_name')); | ||
$job_alternate_name = !empty($job_alternate_name) ? $job_alternate_name : 'jobs'; | ||
$job_alternate_name_plural = Inflector::pluralize($job_alternate_name); | ||
$job_alternate_name_singular = Inflector::singularize($job_alternate_name); | ||
$job_array = array( | ||
'jobs', | ||
'job_orders', | ||
'job_favorites', | ||
'job_categories', | ||
'job_feedbacks', | ||
'job_flags', | ||
'job_flag_categories', | ||
'job_views', | ||
'job_types', | ||
); | ||
// Possible controllers for with name request | ||
$request_alternate_name = strtolower(Configure::read('request.request_alternate_name')); | ||
$request_alternate_name = !empty($request_alternate_name) ? $request_alternate_name : 'requests'; | ||
$request_alternate_name_plural = Inflector::pluralize($request_alternate_name); | ||
$request_alternate_name_singular = Inflector::singularize($request_alternate_name); | ||
$request_array = array( | ||
'requests', | ||
'request_orders', | ||
'request_favorites', | ||
'request_categories', | ||
'request_feedbacks', | ||
'request_flags', | ||
'request_flag_categories', | ||
'request_views', | ||
); | ||
// | ||
foreach($plugins_controllers as $value) { | ||
$value = str_replace('_controller', '', Inflector::underscore($value)); | ||
$new_plugins_controllers[] = '\/' . $value; | ||
if(in_array($value, $request_array)) { | ||
if($value == 'requests') { | ||
$new_plugins_controllers[] = '\/' .$request_alternate_name_plural; | ||
} else { | ||
$url_exploded= explode('_', $value); | ||
unset($url_exploded[0]); | ||
$new_plugins_controllers[] = '\/' . $request_alternate_name_singular . '_' . implode('_', $url_exploded); | ||
} | ||
} | ||
if(in_array($value, $job_array)) { | ||
if($value == 'jobs') { | ||
$new_plugins_controllers[] = '\/' . $job_alternate_name_plural; | ||
} else { | ||
$url_exploded= explode('_', $value); | ||
unset($url_exploded[0]); | ||
$new_plugins_controllers[] = '\/' . $job_alternate_name_singular . '_' . implode('_', $url_exploded); | ||
} | ||
} | ||
} | ||
foreach($new_plugins_controllers as $key) { | ||
$new_plugins_controllers[] = Inflector::singularize($key) . '\/'; | ||
} | ||
$plugins_controllers = implode('|', $new_plugins_controllers); | ||
Cache::write($pluginName . '_controllers_list', $plugins_controllers, 'long'); | ||
} | ||
Configure::write('plugins.' . strtolower(Inflector::underscore($pluginName)) , $plugins_controllers); | ||
} | ||
CmsEventManager::loadListeners(); |
Oops, something went wrong.