diff --git a/application/modules/default/Bootstrap.php b/application/modules/default/Bootstrap.php index 95df0514f..862c3ffff 100644 --- a/application/modules/default/Bootstrap.php +++ b/application/modules/default/Bootstrap.php @@ -1,1256 +1,1268 @@ . **/ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { /** * @return Zend_Application_Module_Autoloader * @throws Zend_Loader_Exception */ protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'Default', 'basePath' => realpath(dirname(__FILE__)), )); $autoloader->addResourceType('formelements', 'forms/elements', 'Form_Element'); $autoloader->addResourceType('formvalidators', 'forms/validators', 'Form_Validator'); return $autoloader; } /** * @throws Zend_Exception * @throws Zend_Session_Exception */ protected function _initSessionManagement() { $config = $this->getOption('settings')['session']; $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; if ($config['saveHandler']['replace']['enabled']) { $cacheClass = 'Zend_Cache_Backend_' . $config['saveHandler']['cache']['type']; $_cache = new $cacheClass($config['saveHandler']['options']); Zend_Loader::loadClass($config['saveHandler']['class']); Zend_Session::setSaveHandler(new $config['saveHandler']['class']($_cache)); Zend_Session::setOptions(array( 'cookie_domain' => $domain, 'cookie_path' => $config['auth']['cookie_path'], 'cookie_lifetime' => $config['auth']['cookie_lifetime'], 'cookie_httponly' => $config['auth']['cookie_httponly']) ); Zend_Session::start(); } $session_namespace = new Zend_Session_Namespace($config['auth']['name']); $session_namespace->setExpirationSeconds($config['auth']['cookie_lifetime']); Zend_Auth::getInstance()->setStorage(new Zend_Auth_Storage_Session($session_namespace->getNamespace())); } protected function _initConfig() { /** $config Zend_Config */ $config = $this->getApplication()->getApplicationConfig(); Zend_Registry::set('config', $config); return $config; } /** * @return mixed|null|Zend_Cache_Core|Zend_Cache_Frontend * @throws Zend_Cache_Exception * @throws Zend_Exception */ protected function _initCache() { if (Zend_Registry::isRegistered('cache')) { return Zend_Registry::get('cache'); } $cache = null; $options = $this->getOption('settings'); if (true == $options['cache']['enabled']) { $cache = Zend_Cache::factory( $options['cache']['frontend']['type'], $options['cache']['backend']['type'], $options['cache']['frontend']['options'], $options['cache']['backend']['options'] ); } else { // Fallback settings for some (maybe development) environments which have no cache management installed. if (false === is_writeable(APPLICATION_CACHE)) { error_log('directory for cache files does not exists or not writable: ' . APPLICATION_CACHE); exit('directory for cache files does not exists or not writable: ' . APPLICATION_CACHE); } $frontendOptions = array( 'lifetime' => 600, 'automatic_serialization' => true, 'cache_id_prefix' => 'front_cache', 'cache' => true ); $backendOptions = array( 'cache_dir' => APPLICATION_CACHE, 'file_locking' => true, 'read_control' => true, 'read_control_type' => 'crc32', 'hashed_directory_level' => 1, 'hashed_directory_perm' => 0700, 'file_name_prefix' => 'ocs', 'cache_file_perm' => 0700 ); $cache = Zend_Cache::factory( 'Core', 'File', $frontendOptions, $backendOptions ); } Zend_Registry::set('cache', $cache); Zend_Locale::setCache($cache); Zend_Locale_Data::setCache($cache); Zend_Currency::setCache($cache); Zend_Translate::setCache($cache); Zend_Translate_Adapter::setCache($cache); Zend_Db_Table_Abstract::setDefaultMetadataCache($cache); Zend_Paginator::setCache($cache); return $cache; } /** * @throws Zend_Application_Bootstrap_Exception */ protected function _initViewConfig() { $view = $this->bootstrap('view')->getResource('view'); $view->addHelperPath(APPLICATION_PATH . '/modules/default/views/helpers', 'Default_View_Helper_'); $view->addHelperPath(APPLICATION_LIB . '/Zend/View/Helper', 'Zend_View_Helper_'); $options = $this->getOptions(); $docType = $options['resources']['view']['doctype'] ? $options['resources']['view']['doctype'] : 'XHTML1_TRANSITIONAL'; $view->doctype($docType); } /** * @throws Zend_Locale_Exception */ protected function _initLocale() { $configResources = $this->getOption('resources'); Zend_Locale::setDefault($configResources['locale']['default']); Zend_Registry::set($configResources['locale']['registry_key'], $configResources['locale']['default']); } /** * @return Zend_Translate * @throws Zend_Application_Resource_Exception * @throws Zend_Form_Exception * @throws Zend_Session_Exception * @throws Zend_Translate_Exception * @throws Zend_Validate_Exception */ protected function _initTranslate() { $options = $this->getOption('resources'); $options = $options['translate']; if (!isset($options['data'])) { throw new Zend_Application_Resource_Exception( 'not found the file'); } $adapter = isset($options['adapter']) ? $options['adapter'] : Zend_Translate::AN_ARRAY; $session = new Zend_Session_Namespace('aa'); if ($session->locale) { $locale = $session->locale; } else { $locale = isset($options['locale']) ? $options['locale'] : null; } $data = ''; if (isset($options['data'][$locale])) { $data = $options['data'][$locale]; } $translateOptions = isset($options['options']) ? $options['options'] : array(); $translate = new Zend_Translate($adapter, $data, $locale, $translateOptions); Zend_Form::setDefaultTranslator($translate); Zend_Validate_Abstract::setDefaultTranslator($translate); Zend_Registry::set('Zend_Translate', $translate); return $translate; } /** * @throws Zend_Application_Bootstrap_Exception */ protected function _initDbAdapter() { $db = $this->bootstrap('db')->getResource('db'); //( if ((APPLICATION_ENV == 'development') OR (APPLICATION_ENV == 'testing')) { // $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); // $profiler->setEnabled(true); // // // Attach the profiler to your db adapter // $db->setProfiler($profiler); // } Zend_Registry::set('db', $db); Zend_Db_Table::setDefaultAdapter($db); Zend_Db_Table_Abstract::setDefaultAdapter($db); } /** * @throws Zend_Log_Exception */ protected function _initLogger() { $settings = $this->getOption('settings'); $log = new Zend_Log(); $writer = new Zend_Log_Writer_Stream($settings['log']['path'] . 'all_' . date("Y-m-d")); $writer->addFilter(new Local_Log_Filter_MinMax(Zend_Log::WARN, Zend_Log::DEBUG)); $log->addWriter($writer); $errorWriter = new Zend_Log_Writer_Stream($settings['log']['path'] . 'err_' . date('Y-m-d')); $errorWriter->addFilter(new Zend_Log_Filter_Priority(Zend_Log::ERR)); $log->addWriter($errorWriter); Zend_Registry::set('logger', $log); if ((APPLICATION_ENV == 'development') OR (APPLICATION_ENV == 'testing')) { $firebugWriter = new Zend_Log_Writer_Firebug(); $firebugLog = new Zend_Log($firebugWriter); Zend_Registry::set('firebug_log', $firebugLog); } } protected function _initGlobals() { Zend_Paginator::setDefaultScrollingStyle('Elastic'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginationControl.phtml'); Zend_Filter::addDefaultNamespaces('Local_Filter'); $version = $this->getOption('version'); defined('APPLICATION_VERSION') || define('APPLICATION_VERSION', $version); } /** * @return Default_Plugin_AclRules|false|mixed * @throws Zend_Cache_Exception */ protected function _initAclRules() { /** @var Zend_Cache_Core $appCache */ $appCache = $this->getResource('cache'); if (false == ($aclRules = $appCache->load('AclRules'))) { $aclRules = new Default_Plugin_AclRules(); Zend_Registry::set('acl', $aclRules); $appCache->save($aclRules, 'AclRules', array('AclRules'), 14400); } return $aclRules; } /** * @throws Zend_Application_Bootstrap_Exception * @throws Zend_Loader_PluginLoader_Exception */ protected function _initPlugins() { /** @var $front Zend_Controller_Front */ $front = $this->bootstrap('frontController')->getResource('frontController'); $aclRules = $this->bootstrap('aclRules')->getResource('aclRules'); $front->unregisterPlugin('Zend_Controller_Plugin_ErrorHandler'); $front->registerPlugin(new Default_Plugin_ErrorHandler()); $front->registerPlugin(new Default_Plugin_RememberMe(Zend_Auth::getInstance())); $front->registerPlugin(new Default_Plugin_SignOn(Zend_Auth::getInstance())); $front->registerPlugin(new Default_Plugin_Acl(Zend_Auth::getInstance(), $aclRules)); $loader = new Zend_Loader_PluginLoader(); $loader->addPrefixPath('Zend_View_Helper', APPLICATION_LIB . '/Zend/View/Helper/') ->addPrefixPath('Zend_Form_Element', APPLICATION_LIB . '/Zend/Form/Element') ->addPrefixPath('Default_View_Helper', APPLICATION_PATH . '/modules/default/views/helpers') ->addPrefixPath('Default_Form_Helper', APPLICATION_PATH . '/modules/default/forms/helpers') ->addPrefixPath('Default_Form_Element', APPLICATION_PATH . '/modules/default/forms/elements') ->addPrefixPath('Default_Form_Decorator', APPLICATION_PATH . '/modules/default/forms/decorators') ->addPrefixPath('Default_Form_Validator', APPLICATION_PATH . '/modules/default/forms/validators'); } /** * @throws Zend_Session_Exception */ //protected function _initAuthSessionNamespace() //{ // $config = $this->getResource('config'); // $auth_config = $config->settings->auth_session; // // $objSessionNamespace = new Zend_Session_Namespace($auth_config->name); // $objSessionNamespace->setExpirationSeconds($auth_config->timeout); // // Zend_Auth::getInstance()->setStorage(new Zend_Auth_Storage_Session($auth_config->name)); //} protected function _initThirdParty() { $appConfig = $this->getResource('config'); $imageConfig = $appConfig->images; defined('IMAGES_UPLOAD_PATH') || define('IMAGES_UPLOAD_PATH', $imageConfig->upload->path); defined('IMAGES_MEDIA_SERVER') || define('IMAGES_MEDIA_SERVER', $imageConfig->media->server); // ppload $pploadConfig = $appConfig->third_party->ppload; defined('PPLOAD_API_URI') || define('PPLOAD_API_URI', $pploadConfig->api_uri); defined('PPLOAD_CLIENT_ID') || define('PPLOAD_CLIENT_ID', $pploadConfig->client_id); defined('PPLOAD_SECRET') || define('PPLOAD_SECRET', $pploadConfig->secret); defined('PPLOAD_DOWNLOAD_SECRET') || define('PPLOAD_DOWNLOAD_SECRET', $pploadConfig->download_secret); } /** * @return false|mixed|Zend_Controller_Router_Rewrite * @throws Zend_Application_Bootstrap_Exception * @throws Zend_Cache_Exception * @throws Zend_Controller_Exception * @throws Zend_Exception */ protected function _initRouter() { $this->bootstrap('frontController'); /** @var $front Zend_Controller_Front */ $front = $this->getResource('frontController'); /** @var Zend_Cache_Core $cache */ $cache = Zend_Registry::get('cache'); if (($router = $cache->load('ProjectRouter'))) { $front->setRouter($router); return $router; } /** @var $router Zend_Controller_Router_Rewrite */ $router = $front->getRouter(); /** RSS Feed */ $router->addRoute( 'rdf_store', new Zend_Controller_Router_Route( '/content.rdf', array( 'module' => 'default', 'controller' => 'rss', 'action' => 'rdf' ) ) ); $router->addRoute( 'rdf_events_hive', new Zend_Controller_Router_Route_Regex( '.*-events.rss', array( 'module' => 'default', 'controller' => 'rss', 'action' => 'rss' ) ) ); $router->addRoute( 'rdf_store_hive', new Zend_Controller_Router_Route_Regex( '.*-content.rdf', array( 'module' => 'default', 'controller' => 'rss', 'action' => 'rdf' ) ) ); $router->addRoute( 'rdf_store_hive_rss', new Zend_Controller_Router_Route_Regex( 'rss/.*-content.rdf', array( 'module' => 'default', 'controller' => 'rss', 'action' => 'rdf' ) ) ); /** new store dependent routing rules */ $router->addRoute( 'store_home', new Zend_Controller_Router_Route( '/s/:domain_store_id/', array( 'module' => 'default', 'controller' => 'home', 'action' => 'index' ) ) ); $router->addRoute( 'store_browse', new Zend_Controller_Router_Route( '/s/:domain_store_id/browse/*', array( 'module' => 'default', 'controller' => 'explore', 'action' => 'index' ) ) ); $router->addRoute( 'store_product', new Zend_Controller_Router_Route( '/s/:domain_store_id/p/:project_id/:action/*', array( 'module' => 'default', 'controller' => 'product', 'action' => 'show' ) ) ); $router->addRoute( 'store_user', new Zend_Controller_Router_Route( '/s/:domain_store_id/member/:member_id/:action/*', array( 'module' => 'default', 'controller' => 'user', 'action' => 'index' ) ) ); $router->addRoute( 'store_user_name', new Zend_Controller_Router_Route( '/s/:domain_store_id/u/:user_name/:action/*', array( 'module' => 'default', 'controller' => 'user', 'action' => 'index' ) ) ); /** general routing rules */ $router->addRoute( 'home', new Zend_Controller_Router_Route( '/', array( 'module' => 'default', 'controller' => 'home', 'action' => 'index' ) ) ); $router->addRoute( 'home_ajax', new Zend_Controller_Router_Route( '/showfeatureajax/*', array( 'module' => 'default', 'controller' => 'home', 'action' => 'showfeatureajax' ) ) ); $router->addRoute( 'backend', new Zend_Controller_Router_Route( '/backend/:controller/:action/*', array( 'module' => 'backend', 'controller' => 'index', 'action' => 'index' ) ) ); $router->addRoute( 'browse', new Zend_Controller_Router_Route( '/browse/*', array( 'module' => 'default', 'controller' => 'explore', 'action' => 'index' ) ) ); $router->addRoute( 'button_render', new Zend_Controller_Router_Route( '/button/:project_id/:size/', array( 'module' => 'default', 'controller' => 'button', 'action' => 'render', 'size' => 'large' ) ) ); $router->addRoute( 'button_action', new Zend_Controller_Router_Route( '/button/a/:action/', array( 'module' => 'default', 'controller' => 'button', 'action' => 'index' ) ) ); /* $router->addRoute( 'supporter_box_show', new Zend_Controller_Router_Route( '/supporterbox/:project_uuid/', array( 'module' => 'default', 'controller' => 'supporterbox', 'action' => 'render' ) ) ); */ $router->addRoute( 'pling_box_show', new Zend_Controller_Router_Route( '/supporterbox/:memberid/', array( 'module' => 'default', 'controller' => 'plingbox', 'action' => 'index' ) ) ); $router->addRoute( 'external_donation_list', new Zend_Controller_Router_Route( '/donationlist/:project_id/', array( 'module' => 'default', 'controller' => 'donationlist', 'action' => 'render' ) ) ); $router->addRoute( 'external_widget', new Zend_Controller_Router_Route( '/widget/:project_id/', array( 'module' => 'default', 'controller' => 'widget', 'action' => 'render' ) ) ); $router->addRoute( 'external_widget_save', new Zend_Controller_Router_Route( '/widget/save/*', array( 'module' => 'default', 'controller' => 'widget', 'action' => 'save' ) ) ); $router->addRoute( 'external_widget_save', new Zend_Controller_Router_Route( '/widget/config/:project_id/', array( 'module' => 'default', 'controller' => 'widget', 'action' => 'config' ) ) ); $router->addRoute( 'external_widget_save_default', new Zend_Controller_Router_Route( '/widget/savedefault/*', array( 'module' => 'default', 'controller' => 'widget', 'action' => 'savedefault' ) ) ); /** * Project/Product */ $router->addRoute( 'product_short_url', new Zend_Controller_Router_Route( '/p/:project_id/:action/*', array( 'module' => 'default', 'controller' => 'product', 'action' => 'show' ) ) ); $router->addRoute( 'product_referrer_url', new Zend_Controller_Router_Route( '/p/:project_id/er/:er/*', array( 'module' => 'default', 'controller' => 'product', 'action' => 'show' ) ) ); $router->addRoute( 'product_collectionid_url', new Zend_Controller_Router_Route( '/c/:collection_id', array( 'module' => 'default', 'controller' => 'product', 'action' => 'show' ) ) ); $router->addRoute( 'product_add', new Zend_Controller_Router_Route( '/product/add', array( 'module' => 'default', 'controller' => 'product', 'action' => 'add' ) ) ); $router->addRoute( 'search', new Zend_Controller_Router_Route( '/search/*', array( 'module' => 'default', 'controller' => 'product', 'action' => 'search' ) ) ); $router->addRoute( 'product_save', new Zend_Controller_Router_Route( '/p/save/*', array( 'module' => 'default', 'controller' => 'product', 'action' => 'saveproduct' ) ) ); /** * Member */ $router->addRoute( 'member_settings_old', new Zend_Controller_Router_Route( '/settings/:action/*', array( 'module' => 'default', 'controller' => 'settings', 'action' => 'index' ) ) ); $router->addRoute( 'user_show', new Zend_Controller_Router_Route( '/member/:member_id/:action/*', array( 'module' => 'default', 'controller' => 'user', 'action' => 'index' ) ) ); $router->addRoute( 'user_avatar', new Zend_Controller_Router_Route( '/member/avatar/:emailhash/:size', array( 'module' => 'default', 'controller' => 'user', 'action' => 'avatar' ) ) ); $router->addRoute( 'user_show_with_name', new Zend_Controller_Router_Route( '/u/:user_name/:action/*', array( 'module' => 'default', 'controller' => 'user', 'action' => 'index' ) ) ); $router->addRoute( 'user_recification', new Zend_Controller_Router_Route( '/r/:action/*', array( 'module' => 'default', 'controller' => 'rectification', 'action' => 'index' ) ) ); $router->addRoute( 'user_show_short', new Zend_Controller_Router_Route( '/me/:member_id/:action/*', array( 'module' => 'default', 'controller' => 'user', 'action' => 'index' ) ) ); $router->addRoute( 'register', new Zend_Controller_Router_Route_Static( '/register', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'register' ) ) ); $router->addRoute( 'register_validate', new Zend_Controller_Router_Route_Static( '/register/validate', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'validate' ) ) ); $router->addRoute( 'verification', new Zend_Controller_Router_Route( '/verification/:vid', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'verification' ) ) ); $router->addRoute( 'logout', new Zend_Controller_Router_Route_Static( '/logout', array( 'module' => 'default', 'controller' => 'logout', 'action' => 'logout' ) ) ); $router->addRoute( 'propagatelogout', new Zend_Controller_Router_Route_Static( '/logout/propagate', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'propagatelogout' ) ) ); $router->addRoute( 'checkuser', new Zend_Controller_Router_Route_Static( '/checkuser', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'checkuser' ) ) ); $router->addRoute( 'login', new Zend_Controller_Router_Route( '/login', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'login' ) ) ); $router->addRoute( 'login', new Zend_Controller_Router_Route( '/login/:action/*', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'login' ) ) ); + $router->addRoute( + 'LoginController', + new Zend_Controller_Router_Route( + '/l/:action/*', + array( + 'module' => 'default', + 'controller' => 'login', + 'action' => 'login' + ) + ) + ); + $router->addRoute( 'content', new Zend_Controller_Router_Route( '/content/:page', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index' ) ) ); $router->addRoute( 'categories_about', new Zend_Controller_Router_Route( '/cat/:page/about', array( 'module' => 'default', 'controller' => 'categories', 'action' => 'about' ) ) ); // **** static routes $router->addRoute( 'static_faq', new Zend_Controller_Router_Route_Static( '/faq', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'faq' ) ) ); $router->addRoute( 'static_terms', new Zend_Controller_Router_Route_Static( '/terms', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'terms' ) ) ); $router->addRoute( 'static_terms_general', new Zend_Controller_Router_Route_Static( '/terms/general', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'terms-general' ) ) ); $router->addRoute( 'static_terms_publish', new Zend_Controller_Router_Route_Static( '/terms/publishing', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'terms-publishing' ) ) ); $router->addRoute( 'static_terms_dmca', new Zend_Controller_Router_Route_Static( '/terms/dmca', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'terms-dmca' ) ) ); $router->addRoute( 'static_privacy', new Zend_Controller_Router_Route_Static( '/privacy', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'privacy' ) ) ); $router->addRoute( 'static_contact', new Zend_Controller_Router_Route_Static( '/contact', array( 'module' => 'default', 'controller' => 'content', 'action' => 'index', 'page' => 'contact' ) ) ); // **** ppload $router->addRoute( 'pploadlogin', new Zend_Controller_Router_Route( '/pploadlogin/*', array( 'module' => 'default', 'controller' => 'authorization', 'action' => 'pploadlogin' ) ) ); // OCS API $router->addRoute( 'ocs_providers_xml', new Zend_Controller_Router_Route( '/ocs/providers.xml', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'providers' ) ) ); $router->addRoute( 'ocs_v1_config', new Zend_Controller_Router_Route( '/ocs/v1/config', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'config' ) ) ); $router->addRoute( 'ocs_v1_person_check', new Zend_Controller_Router_Route( '/ocs/v1/person/check', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'personcheck' ) ) ); $router->addRoute( 'ocs_v1_person_data', new Zend_Controller_Router_Route( '/ocs/v1/person/data', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'persondata' ) ) ); $router->addRoute( 'ocs_v1_person_data_personid', new Zend_Controller_Router_Route( '/ocs/v1/person/data/:personid', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'persondata' ) ) ); $router->addRoute( 'ocs_v1_person_self', new Zend_Controller_Router_Route( '/ocs/v1/person/self', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'personself' ) ) ); $router->addRoute( 'ocs_v1_content_categories', new Zend_Controller_Router_Route( '/ocs/v1/content/categories', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'contentcategories' ) ) ); $router->addRoute( 'ocs_v1_content_data_contentid', new Zend_Controller_Router_Route( '/ocs/v1/content/data/:contentid', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'contentdata', 'contentid' => null ) ) ); $router->addRoute( 'ocs_v1_content_download_contentid_itemid', new Zend_Controller_Router_Route( '/ocs/v1/content/download/:contentid/:itemid', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'contentdownload' ) ) ); $router->addRoute( 'ocs_v1_content_previewpic_contentid', new Zend_Controller_Router_Route( '/ocs/v1/content/previewpic/:contentid', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'contentpreviewpic' ) ) ); $router->addRoute('ocs_v1_comments', new Zend_Controller_Router_Route( '/ocs/v1/comments/data/:comment_type/:content_id/:second_id', array( 'module' => 'default', 'controller' => 'ocsv1', 'action' => 'comments', 'comment_type' => -1, 'content_id' => null, 'second_id' => null )) ); // embed $router->addRoute( 'embed_v1_member_projects', new Zend_Controller_Router_Route( '/embed/v1/member/:memberid', array( 'module' => 'default', 'controller' => 'embedv1', 'action' => 'memberprojects' ) ) ); $router->addRoute( 'embed_v1_member_projects_files', new Zend_Controller_Router_Route( '/embed/v1/ppload/:ppload_collection_id', array( 'module' => 'default', 'controller' => 'embedv1', 'action' => 'ppload' ) ) ); $router->addRoute( 'embed_v1_member_projectscomments', new Zend_Controller_Router_Route( '/embed/v1/comments/:id', array( 'module' => 'default', 'controller' => 'embedv1', 'action' => 'comments' ) ) ); $router->addRoute( 'embed_v1_member_projectdetail', new Zend_Controller_Router_Route( '/embed/v1/project/:projectid', array( 'module' => 'default', 'controller' => 'embedv1', 'action' => 'projectdetail' ) ) ); $router->addRoute( 'clones', new Zend_Controller_Router_Route( '/clones', array( 'module' => 'default', 'controller' => 'credits', 'action' => 'index' ) ) ); $cache->save($router, 'ProjectRouter', array('router'), 14400); return $router; } /** * @throws Zend_Cache_Exception * @throws Zend_Exception * @throws exception */ protected function _initCss() { if (APPLICATION_ENV != "development" && APPLICATION_ENV != "staging") { return; } $appConfig = $this->getResource('config'); if ((boolean)$appConfig->settings->noLESScompile === true) { return; } $sLess = realpath(APPLICATION_PATH . '/../httpdocs/theme/flatui/less/stylesheet.less'); $sCss = realpath(APPLICATION_PATH . '/../httpdocs/theme/flatui/css/stylesheet.css'); /** * @var Zend_Cache_Core $cache */ $cache = Zend_Registry::get('cache'); if (md5_file($sLess) !== $cache->load('md5Less')) { require_once APPLICATION_PATH . "/../library/lessphp/lessc.inc.php"; $oLessc = new lessc($sLess); $oLessc->setFormatter('compressed'); file_put_contents($sCss, $oLessc->parse()); $cache->save(md5_file($sLess), 'md5Less'); } } protected function _initGlobalApplicationVars() { $modelDomainConfig = new Default_Model_DbTable_ConfigStore(); Zend_Registry::set('application_store_category_list', $modelDomainConfig->fetchAllStoresAndCategories()); Zend_Registry::set('application_store_config_list', $modelDomainConfig->fetchAllStoresConfigArray()); Zend_Registry::set('application_store_config_id_list', $modelDomainConfig->fetchAllStoresConfigByIdArray()); } /** * @throws Zend_Application_Bootstrap_Exception */ protected function _initStoreDependentVars() { /** @var $front Zend_Controller_Front */ $front = $this->bootstrap('frontController')->getResource('frontController'); $front->registerPlugin(new Default_Plugin_InitGlobalStoreVars()); } } \ No newline at end of file diff --git a/application/modules/default/controllers/LoginController.php b/application/modules/default/controllers/LoginController.php new file mode 100644 index 000000000..81f9c79cd --- /dev/null +++ b/application/modules/default/controllers/LoginController.php @@ -0,0 +1,35 @@ +. + * + * Created: 30.11.2018 + */ +class LoginController extends Local_Controller_Action_DomainSwitch +{ + + public function setthemeAction() + { + $this->_helper->layout()->disableLayout(); + //$this->_helper->viewRenderer->setNoRender(true); + + } + +} \ No newline at end of file diff --git a/application/modules/default/plugins/AclRules.php b/application/modules/default/plugins/AclRules.php index 6fa6ffe0b..11b143fd7 100644 --- a/application/modules/default/plugins/AclRules.php +++ b/application/modules/default/plugins/AclRules.php @@ -1,337 +1,339 @@ . **/ class Default_Plugin_AclRules extends Zend_Acl { const ROLENAME_GUEST = 'guest'; const ROLENAME_COOKIEUSER = 'cookieuser'; const ROLENAME_FEUSER = 'feuser'; const ROLENAME_MODERATOR = 'moderator'; const ROLENAME_STAFF = 'staff'; const ROLENAME_ADMIN = 'admin'; const ROLENAME_SYSUSER = 'sysuser'; function __construct() { $this->addRole(new Zend_Acl_Role (self::ROLENAME_GUEST)); $this->addRole(new Zend_Acl_Role (self::ROLENAME_COOKIEUSER), self::ROLENAME_GUEST); $this->addRole(new Zend_Acl_Role (self::ROLENAME_FEUSER), self::ROLENAME_COOKIEUSER); $this->addRole(new Zend_Acl_Role (self::ROLENAME_MODERATOR), self::ROLENAME_FEUSER); $this->addRole(new Zend_Acl_Role (self::ROLENAME_STAFF), self::ROLENAME_FEUSER); $this->addRole(new Zend_Acl_Role (self::ROLENAME_ADMIN)); $this->addRole(new Zend_Acl_Role (self::ROLENAME_SYSUSER)); $this->addResource(new Zend_Acl_Resource ('default_logout')); $this->addResource(new Zend_Acl_Resource ('default_oauth')); $this->addResource(new Zend_Acl_Resource ('default_authorization')); $this->addResource(new Zend_Acl_Resource ('default_button')); $this->addResource(new Zend_Acl_Resource ('default_categories')); $this->addResource(new Zend_Acl_Resource ('default_community')); $this->addResource(new Zend_Acl_Resource ('default_content')); $this->addResource(new Zend_Acl_Resource ('default_discovery')); $this->addResource(new Zend_Acl_Resource ('default_donationlist')); $this->addResource(new Zend_Acl_Resource ('default_support')); $this->addResource(new Zend_Acl_Resource ('default_error')); $this->addResource(new Zend_Acl_Resource ('default_explore')); $this->addResource(new Zend_Acl_Resource ('default_gateway')); $this->addResource(new Zend_Acl_Resource ('default_hive')); $this->addResource(new Zend_Acl_Resource ('default_home')); $this->addResource(new Zend_Acl_Resource ('default_ocsv1')); // OCS API $this->addResource(new Zend_Acl_Resource ('default_embedv1')); // embed API $this->addResource(new Zend_Acl_Resource ('default_productcategory')); $this->addResource(new Zend_Acl_Resource ('default_productcomment')); $this->addResource(new Zend_Acl_Resource ('default_product')); $this->addResource(new Zend_Acl_Resource ('default_report')); $this->addResource(new Zend_Acl_Resource ('default_rectification')); $this->addResource(new Zend_Acl_Resource ('default_rss')); $this->addResource(new Zend_Acl_Resource ('default_settings')); $this->addResource(new Zend_Acl_Resource ('default_supporterbox')); $this->addResource(new Zend_Acl_Resource ('default_plingbox')); $this->addResource(new Zend_Acl_Resource ('default_user')); $this->addResource(new Zend_Acl_Resource ('default_widget')); $this->addResource(new Zend_Acl_Resource ('default_file')); $this->addResource(new Zend_Acl_Resource ('default_plings')); $this->addResource(new Zend_Acl_Resource ('default_spam')); $this->addResource(new Zend_Acl_Resource ('default_moderation')); $this->addResource(new Zend_Acl_Resource ('default_duplicates')); $this->addResource(new Zend_Acl_Resource ('default_misuse')); $this->addResource(new Zend_Acl_Resource ('default_credits')); $this->addResource(new Zend_Acl_Resource ('default_ads')); $this->addResource(new Zend_Acl_Resource ('default_dl')); $this->addResource(new Zend_Acl_Resource ('default_password')); $this->addResource(new Zend_Acl_Resource ('default_verify')); + $this->addResource(new Zend_Acl_Resource ('default_login')); $this->addResource(new Zend_Acl_Resource ('default_stati')); $this->addResource(new Zend_Acl_Resource ('default_tag')); $this->addResource(new Zend_Acl_Resource ('backend_categories')); $this->addResource(new Zend_Acl_Resource ('backend_vcategories')); $this->addResource(new Zend_Acl_Resource ('backend_categorytag')); $this->addResource(new Zend_Acl_Resource ('backend_claim')); $this->addResource(new Zend_Acl_Resource ('backend_comments')); $this->addResource(new Zend_Acl_Resource ('backend_content')); $this->addResource(new Zend_Acl_Resource ('backend_faq')); $this->addResource(new Zend_Acl_Resource ('backend_hive')); $this->addResource(new Zend_Acl_Resource ('backend_hiveuser')); $this->addResource(new Zend_Acl_Resource ('backend_index')); $this->addResource(new Zend_Acl_Resource ('backend_mail')); $this->addResource(new Zend_Acl_Resource ('backend_member')); $this->addResource(new Zend_Acl_Resource ('backend_memberpayout')); $this->addResource(new Zend_Acl_Resource ('backend_memberpaypaladdress')); $this->addResource(new Zend_Acl_Resource ('backend_paypalvalidstatus')); $this->addResource(new Zend_Acl_Resource ('backend_payoutstatus')); $this->addResource(new Zend_Acl_Resource ('backend_operatingsystem')); $this->addResource(new Zend_Acl_Resource ('backend_project')); $this->addResource(new Zend_Acl_Resource ('backend_ranking')); $this->addResource(new Zend_Acl_Resource ('backend_reportcomments')); $this->addResource(new Zend_Acl_Resource ('backend_reportproducts')); $this->addResource(new Zend_Acl_Resource ('backend_search')); $this->addResource(new Zend_Acl_Resource ('backend_storecategories')); $this->addResource(new Zend_Acl_Resource ('backend_vstorecategories')); $this->addResource(new Zend_Acl_Resource ('backend_store')); $this->addResource(new Zend_Acl_Resource ('backend_tag')); $this->addResource(new Zend_Acl_Resource ('backend_user')); $this->addResource(new Zend_Acl_Resource ('backend_tags')); $this->addResource(new Zend_Acl_Resource ('backend_ghnsexcluded')); $this->addResource(new Zend_Acl_Resource ('backend_letteravatar')); $this->addResource(new Zend_Acl_Resource ('backend_group')); $this->addResource(new Zend_Acl_Resource ('backend_cdiscourse')); $this->addResource(new Zend_Acl_Resource ('backend_cgitlab')); $this->addResource(new Zend_Acl_Resource ('backend_cldap')); $this->addResource(new Zend_Acl_Resource ('backend_coauth')); $this->addResource(new Zend_Acl_Resource ('backend_cexport')); $this->addResource(new Zend_Acl_Resource ('statistics_data')); $this->allow(self::ROLENAME_GUEST, array( 'statistics_data' )); $this->allow(self::ROLENAME_GUEST, array( 'default_logout', 'default_authorization', 'default_button', 'default_categories', 'default_content', 'default_community', 'default_donationlist', 'default_error', 'default_explore', 'default_gateway', 'default_hive', 'default_home', 'default_ocsv1', // OCS API 'default_embedv1', // embed API 'default_productcategory', 'default_rss', 'default_supporterbox', 'default_plingbox', 'default_oauth', 'default_plings', 'default_ads', 'default_dl', 'default_stati', 'default_password', - 'default_verify' + 'default_verify', + 'default_login' )); $this->allow(self::ROLENAME_SYSUSER, array( 'default_authorization', 'default_button', 'default_categories', 'default_content', 'default_community', 'default_donationlist', 'default_error', 'default_explore', 'default_gateway', 'default_hive', 'default_home', 'default_ocsv1', // OCS API 'default_embedv1', // embed API 'default_productcategory', 'default_report', 'default_rss', 'default_supporterbox', 'default_plingbox', 'default_oauth', 'default_plings', 'default_ads', 'default_dl', 'default_stati', 'default_password' )); $this->allow(self::ROLENAME_COOKIEUSER, array( 'default_logout', 'default_productcomment', 'default_settings', 'default_support', 'default_tag', 'default_rectification' )); $this->allow(self::ROLENAME_STAFF, array( 'backend_index', 'backend_categories', 'backend_categorytag', 'backend_claim', 'backend_comments', 'backend_content', 'backend_store', 'backend_storecategories', 'backend_operatingsystem', 'backend_reportcomments', 'backend_reportproducts', 'backend_search', 'backend_group' )); $this->allow(self::ROLENAME_ADMIN); // resource access rights in detail $this->allow(self::ROLENAME_GUEST, 'backend_group', array('newgroup')); // resource default_product $this->allow(self::ROLENAME_GUEST, 'default_product', array( 'index', 'show', 'getupdatesajax', 'updates', 'follows', 'fetch', 'search', 'startdownload', 'ppload', 'loadratings', 'loadinstallinstruction' )); // resource default_product $this->allow(self::ROLENAME_SYSUSER, 'default_product', array( 'index', 'show', 'getupdatesajax', 'updates', 'follows', 'fetch', 'search', 'startdownload', 'ppload', 'loadratings' )); $this->allow(self::ROLENAME_COOKIEUSER, 'default_product', array( 'add', 'rating', 'follow', 'unfollow', 'plingproject', 'followproject', 'unplingproject', 'add', 'pling', 'pay', 'dwolla', 'paymentok', 'paymentcancel', 'saveproduct', 'claim' )); $this->allow(self::ROLENAME_MODERATOR, 'backend_project', array( 'doghnsexclude' )); $this->allow(self::ROLENAME_MODERATOR, 'default_moderation', array( 'index' )); $this->allow(self::ROLENAME_MODERATOR, 'default_duplicates', array( 'index' )); $this->allow(self::ROLENAME_COOKIEUSER, 'default_product', array( 'edit', 'saveupdateajax', 'deleteupdateajax', 'update', 'preview', 'delete', 'unpublish', 'publish', 'verifycode', 'makerconfig', 'addpploadfile', 'updatepploadfile', 'deletepploadfile', 'deletepploadfiles', 'updatepackagetype', 'updatearchitecture', ), new Default_Plugin_Acl_IsProjectOwnerAssertion()); // resource default_support $this->allow(self::ROLENAME_COOKIEUSER, 'default_support', array('index', 'pay', 'paymentok', 'paymentcancel')); // resource default_support $this->allow(self::ROLENAME_COOKIEUSER, 'default_report', array('comment', 'product', 'productfraud', 'productclone')); // resource default_widget $this->allow(self::ROLENAME_GUEST, 'default_widget', array('index', 'render')); $this->allow(self::ROLENAME_COOKIEUSER, 'default_widget', array('save', 'savedefault', 'config'), new Default_Plugin_Acl_IsProjectOwnerAssertion()); $this->allow(self::ROLENAME_COOKIEUSER, 'default_file', array( 'gitlink', 'link', ), new Default_Plugin_Acl_IsProjectOwnerAssertion()); // resource default_user $this->allow(self::ROLENAME_GUEST, 'default_home', array('baseurlajax','forumurlajax','blogurlajax','storenameajax','domainsajax', 'userdataajax', 'loginurlajax', 'metamenujs','metamenubundlejs','fetchforgit')); // resource default_user $this->allow(self::ROLENAME_GUEST, 'default_user', array('index', 'aboutme', 'share', 'report', 'about', 'tooltip', 'avatar', 'userdataajax')); $this->allow(self::ROLENAME_COOKIEUSER, 'default_user', array( 'follow', 'unfollow', 'settings', 'products', 'news', 'activities', 'payments', 'income', 'payout', 'plings', 'downloadhistory', 'likes' )); $this->allow(self::ROLENAME_COOKIEUSER, 'default_tag', array('filter', 'add', 'del', 'assign', 'remove')); } } diff --git a/application/modules/default/views/scripts/home/redirectme.phtml b/application/modules/default/views/scripts/home/redirectme.phtml index 35db45373..3b56db895 100644 --- a/application/modules/default/views/scripts/home/redirectme.phtml +++ b/application/modules/default/views/scripts/home/redirectme.phtml @@ -1,79 +1,68 @@ getRequest(); $http_scheme = $request->getScheme(); $baseurl = Zend_Registry::get('config')->settings->client->default->baseurl; $url_forum = Zend_Registry::get('config')->settings->client->default->url_forum; $url_gitlab = Zend_Registry::get('config')->settings->client->default->url_gitlab; $url_myopendesktop = Zend_Registry::get('config')->settings->client->default->url_myopendesktop; $config = Zend_Registry::get('config')->settings->domain; $getAuthUser = new Default_View_Helper_GetAuthUser(); $member = $getAuthUser->getAuthUser(); $phash = null; $ltat = ''; if (Zend_Auth::getInstance()->hasIdentity()) { $sess = new Zend_Session_Namespace('ocs_meta'); $phash = $sess->phash; $ltat = $sess->openid; } $info = new Default_Model_Info(); $domains = $info->getActiveStoresForCrossDomainLogin(); ?> phpSettings->session->name, Zend_Session::getId()); - $cookie = Local_LoginCookie::createJwt($data, 120); - $url = sprintf('https://%s/external/settheme.php?k=%s&XDEBUG_SESSION=PHPSTORM', $domain, $cookie); + $id = crc32($domain.Zend_Session::getId()); + $data = array('domain' => Zend_Registry::get('config')->phpSettings->session->name, 'id' => Zend_Session::getId()); + Zend_Registry::get('cache')->save($data, $id); + $cookie = Local_LoginCookie::createJwt($id, 120); + $url = sprintf('%s://%s/l/settheme?k=%s', $http_scheme, $domain, $cookie); echo(''.PHP_EOL); } ?>

Please Wait...

-member_id.'&name='.$member->username.'&mail='.$member->mail.'&avatar='.$this->Image($member->profile_image_url,array('width' => 210, 'height' => 210, 'crop' => 2)).'" height="0" width="0">'; - -} -?> - \ No newline at end of file diff --git a/application/modules/default/views/scripts/login/settheme.phtml b/application/modules/default/views/scripts/login/settheme.phtml new file mode 100644 index 000000000..6562b4db7 --- /dev/null +++ b/application/modules/default/views/scripts/login/settheme.phtml @@ -0,0 +1,18 @@ +load($id)) { + $cookie_params = session_get_cookie_params(); + setcookie($data['domain'], $data['id'], time()+31536000, $cookie_params['path'], $_SERVER['HTTP_HOST'], $cookie_params['secure'], true); + $cache->remove($id); + } + } +} +include APPLICATION_PATH . "/../httpdocs/theme/flatui/css/empty.css"; \ No newline at end of file diff --git a/httpdocs/external/settheme.php b/httpdocs/external/settheme.php deleted file mode 100644 index 43b8fdd73..000000000 --- a/httpdocs/external/settheme.php +++ /dev/null @@ -1,21 +0,0 @@ -