public function __construct(Context $context) { $this->context = $context; $this->dc = $context->getService('doctrine'); $this->radix_coll = $context->getService('foolfuuka.radix_collection'); $this->board_stats = $context->getService('foolfuuka-plugin.board_statistics'); parent::__construct(); }
public static function getEnvironment(Context $context) { $environment = []; $environment['server'] = ['title' => _i('Server Information'), 'data' => [['title' => _i('Web Server Software'), 'value' => $_SERVER['SERVER_SOFTWARE'], 'alert' => ['type' => 'warning', 'condition' => (bool) preg_match('/nginx/i', $_SERVER['SERVER_SOFTWARE']), 'title' => 'Warning', 'string' => _i('The nginx web server has its own internal file size limit variable for uploads. It is recommended that this value be set at the same value set in the PHP configuration file.')]], ['title' => _i('PHP Version'), 'value' => PHP_VERSION, 'alert' => ['type' => 'important', 'condition' => version_compare(PHP_VERSION, '5.4.0') < 0, 'title' => _i('Please Update Immediately'), 'string' => _i('The minimum requirements to run this software is 5.4.0.')]]]]; $environment['software'] = ['title' => _i('Software Information'), 'data' => [['title' => _i('FoolFrame Version'), 'value' => $context->getService('config')->get('foolz/foolframe', 'package', 'main.version'), 'alert' => ['type' => 'info', 'condition' => true, 'title' => _i('New Update Available'), 'string' => _i('There is a new version of the software available for download.')]]]]; $environment['php-configuration'] = ['title' => _i('PHP Configuration'), 'data' => [['title' => _i('Config Location'), 'value' => php_ini_loaded_file(), 'description' => _i('This is the path to the location of the php.ini configuration file.')], ['title' => 'allow_url_fopen', 'value' => ini_get('allow_url_fopen') ? _i('On') : _i('Off'), 'description' => _i('This option enables the URL-aware fopen wrappers that allows access to remote files using the FTP or HTTP protocol.'), 'alert' => ['type' => 'important', 'condition' => (bool) (!ini_get('allow_url_fopen')), 'title' => _i('Critical'), 'string' => _i('The PHP configuration on the server currently has URL-aware fopen wrappers disabled. The software will be operating at limited functionality.')]], ['title' => 'max_execution_time', 'value' => ini_get('max_execution_time'), 'description' => _i('This sets the maximum time in seconds a script is allowed to run before it is terminated by the parser.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(ini_get('max_execution_time')) < 60), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum execution time is below the suggested value.')]], ['title' => 'file_uploads', 'value' => ini_get('file_uploads') ? _i('On') : _i('Off'), 'description' => _i('This sets whether or not to allow HTTP file uploads.'), 'alert' => ['type' => 'important', 'condition' => (bool) (!ini_get('file_uploads')), 'title' => _i('Critical'), 'string' => _i('The PHP configuration on the server currently has file uploads disabled. This option must be enabled for the software to fully function.')]], ['title' => 'post_max_size', 'value' => ini_get('post_max_size'), 'description' => _i('This sets the maximum size of POST data allowed.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(substr(ini_get('post_max_size'), 0, -1)) < 16), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum POST data size is below the suggested value.')]], ['title' => 'upload_max_filesize', 'value' => ini_get('upload_max_filesize'), 'description' => _i('This sets the maximum size allowed to be uploaded.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(substr(ini_get('upload_max_filesize'), 0, -1)) < 16), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum upload file size is below the suggested value.')]], ['title' => 'max_file_uploads', 'value' => ini_get('max_file_uploads'), 'description' => _i('This sets the maximum number of files allowed to be uploaded concurrently.'), 'alert' => ['type' => 'warning', 'condition' => (bool) (intval(ini_get('max_file_uploads')) < 60), 'title' => _i('Warning'), 'string' => _i('Your current value for maximum number of concurrent uploads is below the suggested value.')]]]]; $environment['php-extensions'] = ['title' => _i('PHP Extensions'), 'data' => [['title' => 'APC', 'value' => extension_loaded('apc') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'warning', 'condition' => (bool) (!extension_loaded('apc')), 'title' => _i('Warning'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'APC')]], ['title' => 'cURL', 'value' => extension_loaded('curl') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('curl')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'cURL')]], ['title' => 'FileInfo', 'value' => extension_loaded('fileinfo') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('fileinfo')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'FileInfo')]], ['title' => 'JSON', 'value' => extension_loaded('json') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('json')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'JSON')]], ['title' => 'Multi-byte String', 'value' => extension_loaded('mbstring') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('mbstring')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'Multi-byte String')]], ['title' => 'MySQLi', 'value' => extension_loaded('mysqli') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('mysqli')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'MySQLi')]], ['title' => 'PDO MySQL', 'value' => extension_loaded('pdo_mysql') ? _i('Installed') : _i('Unavailable'), 'alert' => ['type' => 'important', 'condition' => (bool) (!extension_loaded('pdo_mysql')), 'title' => _i('Critical'), 'string' => _i('Your PHP environment shows that you do not have the "%s" extension installed. This may limit the functionality of the software.', 'PDO MySQL')]]]]; $environment = Hook::forge('Foolz\\FoolFrame\\Model\\System::getEnvironment#var.environment')->setParam('environment', $environment)->execute()->get($environment); usort($environment['php-extensions']['data'], array('System', 'sortByTitle')); return $environment; }
public function loadRoutes(RouteCollection $route_collection) { Hook::forge('Foolz\\Foolslide\\Model\\Context.loadRoutes.before')->setObject($this)->setParam('route_collection', $route_collection)->execute(); $route_collection->add('foolslide.root', new Route('/', ['_controller' => '\\Foolz\\Foolslide\\Controller\\Reader::index'])); $route_collection->add('404', new Route('', ['_controller' => '\\Foolz\\Foolslide\\Controller\\Chan::404'])); $route = \Foolz\Plugin\Hook::forge('Foolz\\Foolslide\\Model\\Content::routes.collection')->setParams(['default_suffix' => 'page', 'suffix' => 'page', 'controller' => '\\Foolz\\Foolslide\\Controller\\Chan::*'])->execute(); /** @var Radix[] $radix_all */ $radix_all = $this->context->getService('foolslide.radix_collection')->getAll(); foreach ($radix_all as $radix) { $route_collection->add('foolslide.chan.radix.' . $radix->shortname, new Route('/' . $radix->shortname . '/{_suffix}', ['_default_suffix' => $route->getParam('default_suffix'), '_suffix' => $route->getParam('suffix'), '_controller' => $route->getParam('controller'), 'radix_shortname' => $radix->shortname], ['_suffix' => '.*'])); } $route_collection->add('foolslide.chan.api', new Route('/_/api/chan/{_suffix}', ['_suffix' => '', '_controller' => '\\Foolz\\Foolslide\\Controller\\Api\\Chan::*'], ['_suffix' => '.*'])); $route_collection->add('foolslide.chan._', new Route('/_/{_suffix}', ['_suffix' => '', '_controller' => '\\Foolz\\Foolslide\\Controller\\Chan::*'], ['_suffix' => '.*'])); foreach (['reader', 'boards', 'moderation'] as $location) { $route_collection->add('foolslide.admin.' . $location, new Route('/admin/' . $location . '/{_suffix}', ['_suffix' => '', '_controller' => '\\Foolz\\Foolslide\\Controller\\Admin\\' . ucfirst($location) . '::*'], ['_suffix' => '.*'])); } Hook::forge('Foolz\\Foolslide\\Model\\Context.loadRoutes.after')->setObject($this)->setParam('route_collection', $route_collection)->execute(); }
public static function load(\Foolz\Foolframe\Model\Context $context, SchemaManager $sm) { /** @var DoctrineConnection $dc */ $dc = $context->getService('doctrine'); $charset = 'utf8mb4'; $collate = 'utf8mb4_unicode_ci'; $schema = $sm->getCodedSchema(); $banned_md5 = $schema->createTable($dc->p('banned_md5')); $banned_md5->addColumn('md5', 'string', ['length' => 24]); $banned_md5->setPrimaryKey(['md5']); $banned_posters = $schema->createTable($dc->p('banned_posters')); if ($dc->getConnection()->getDriver()->getName() == 'pdo_mysql') { $banned_posters->addOption('charset', $charset); $banned_posters->addOption('collate', $collate); } $banned_posters->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]); $banned_posters->addColumn('ip', 'decimal', ['unsigned' => true, 'precision' => 39, 'scale' => 0]); $banned_posters->addColumn('reason', 'text', ['length' => 65532]); $banned_posters->addColumn('start', 'integer', ['unsigned' => true, 'default' => 0]); $banned_posters->addColumn('length', 'integer', ['unsigned' => true, 'default' => 0]); $banned_posters->addColumn('board_id', 'integer', ['unsigned' => true, 'default' => 0]); $banned_posters->addColumn('creator_id', 'integer', ['unsigned' => true, 'default' => 0]); $banned_posters->addColumn('appeal', 'text', ['length' => 65532]); $banned_posters->addColumn('appeal_status', 'integer', ['unsigned' => true, 'default' => 0]); $banned_posters->setPrimaryKey(['id']); $banned_posters->addIndex(['ip'], 'ip_index'); $banned_posters->addIndex(['creator_id'], 'creator_id_index'); $banned_posters->addIndex(['appeal_status'], 'appeal_status_index'); $boards = $schema->createTable($dc->p('boards')); if ($dc->getConnection()->getDriver()->getName() == 'pdo_mysql') { $boards->addOption('charset', $charset); $boards->addOption('collate', $collate); } $boards->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]); $boards->addColumn('shortname', 'string', ['length' => 32]); $boards->addColumn('name', 'string', ['length' => 256]); $boards->addColumn('archive', 'smallint', ['unsigned' => true, 'default' => 0]); $boards->addColumn('sphinx', 'smallint', ['unsigned' => true, 'default' => 0]); $boards->addColumn('hidden', 'smallint', ['unsigned' => true, 'default' => 0]); $boards->addColumn('hide_thumbnails', 'smallint', ['unsigned' => true, 'default' => 0]); $boards->addColumn('directory', 'text', ['length' => 65532, 'notnull' => false]); $boards->addColumn('max_indexed_id', 'integer', ['unsigned' => true, 'default' => 0]); $boards->addColumn('max_ancient_id', 'integer', ['unsigned' => true, 'default' => 0]); $boards->setPrimaryKey(['id']); $boards->addUniqueIndex(['shortname'], 'shortname_index'); $boards_preferences = $schema->createTable($dc->p('boards_preferences')); if ($dc->getConnection()->getDriver()->getName() == 'pdo_mysql') { $boards_preferences->addOption('charset', $charset); $boards_preferences->addOption('collate', $collate); } $boards_preferences->addColumn('board_preference_id', 'integer', ['unsigned' => true, 'autoincrement' => true]); $boards_preferences->addColumn('board_id', 'integer', ['unsigned' => true]); $boards_preferences->addColumn('name', 'string', ['length' => 64]); $boards_preferences->addColumn('value', 'text', ['notnull' => false, 'length' => 65532]); $boards_preferences->setPrimaryKey(['board_preference_id']); $boards_preferences->addIndex(['board_id', 'name'], 'board_id_name_index'); $reports = $schema->createTable($dc->p('reports')); if ($dc->getConnection()->getDriver()->getName() == 'pdo_mysql') { $reports->addOption('charset', $charset); $reports->addOption('collate', $collate); } $reports->addColumn('id', 'integer', ['unsigned' => true, 'autoincrement' => true]); $reports->addColumn('board_id', 'integer', ['unsigned' => true]); $reports->addColumn('doc_id', 'integer', ['unsigned' => true, 'notnull' => false, 'default' => null]); $reports->addColumn('media_id', 'integer', ['unsigned' => true, 'notnull' => false, 'default' => null]); $reports->addColumn('reason', 'text', ['length' => 65532]); $reports->addColumn('ip_reporter', 'decimal', ['unsigned' => true, 'precision' => 39, 'scale' => 0]); $reports->addColumn('created', 'integer', ['unsigned' => true]); $reports->setPrimaryKey(['id']); $reports->addIndex(['board_id', 'doc_id'], 'board_id_doc_id_index'); $reports->addIndex(['board_id', 'media_id'], 'board_id_media_id_index'); }
/** * @param Context $context */ public function __construct(Context $context) { $this->context = $context; $this->config = $context->getService('config'); $this->token = uniqid('', true); }
/** * @return Auth */ public function getAuth() { return $this->context->getService('auth'); }