Пример #1
0
 /**
  * @Request({"config": "array"}, csrf=true)
  * @Access(admin=true)
  */
 public function saveAction($config = [])
 {
     if (count($config)) {
         App::config('tipbutton')->set("stripe_settings", $config["stripe_settings"]);
     }
     return ['message' => 'success'];
 }
Пример #2
0
 /**
  * @param int        $category_id
  * @param bool|false $base
  * @return string|bool
  */
 public function getUrl($category_id = 0, $base = false)
 {
     $category_id = $category_id ?: $this->get('primary_category', 0);
     if (!$category_id || App::config('bixie/download')->get('routing') == 'item') {
         return App::url('@download/id', ['id' => $this->id ?: 0], $base);
     } else {
         return App::url('@download/category/file/' . $category_id, ['id' => $this->id ?: 0], $base);
     }
 }
Пример #3
0
 /**
  * @Route(defaults={"_maintenance"=true})
  * @Request({"redirect"})
  */
 public function loginAction($redirect = '')
 {
     if (!$redirect) {
         $redirect = App::url(App::config('system/user')['login_redirect']);
     }
     if (App::user()->isAuthenticated()) {
         return App::redirect($redirect);
     }
     return ['$view' => ['title' => __('Login'), 'name' => 'system/user/login.php'], 'last_username' => App::session()->get(Auth::LAST_USERNAME), 'redirect' => $redirect];
 }
 /**
  * @Request({"redirect": "string"}, csrf=true)
  */
 public function migrateAction($redirect = null)
 {
     if ($updates = $this->scripts->hasUpdates()) {
         $this->scripts->update();
         $message = __('Your Pagekit database has been updated successfully.');
     } else {
         $message = __('Your database is up to date.');
     }
     App::config('system')->set('version', App::version());
     if ($redirect) {
         App::message()->success($message);
         return App::redirect($redirect);
     }
     return App::response()->json(compact('status', 'message'));
 }
Пример #5
0
 /**
  * @Request({"redirect": "string"}, csrf=true)
  */
 public function migrateAction($redirect = null)
 {
     $config = App::config('system');
     $manager = new PackageManager();
     $scripts = $manager->loadScripts(null, __DIR__ . '/../../scripts.php');
     if (isset($scripts['updates'])) {
         $updates = $manager->filterUpdates($scripts['updates'], $config->get('version'));
         $manager->execute($updates);
     }
     $config->set('version', App::version());
     $message = __('Your Pagekit database has been updated successfully.');
     if ($redirect) {
         App::message()->success($message);
         return App::redirect($redirect);
     }
     return App::response()->json(compact('status', 'message'));
 }
Пример #6
0
 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('shoutzor');
     $config = array_merge($config, $_POST);
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new DivField("Permission Check", $config['mediaDir'] . (is_writable($config['mediaDir']) ? " is writable" : " is not writable! chown manually to www-data:www-data"), "", is_writable($config['mediaDir']) ? "uk-alert uk-alert-success" : "uk-alert uk-alert-danger"));
     $form->addField(new DivField("Permission Check", App::module('shoutzor')->config('root_path') . $config['imageDir'] . (is_writable(App::module('shoutzor')->config('root_path') . $config['imageDir']) ? " is writable" : " is not writable! chown manually to www-data:www-data"), "", is_writable(App::module('shoutzor')->config('root_path') . $config['imageDir']) ? "uk-alert uk-alert-success" : "uk-alert uk-alert-danger"));
     $form->addField(new DividerField());
     $form->addField(new SelectField("upload", "upload", "Allow Uploads", "text", $config['upload'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Changing this setting will not delete uploaded content"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new SelectField("request", "request", "Allow Requests", "text", $config['request'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Changing this setting will allow / deny user requests"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("mediaDir", "mediaDir", "Media Storage Directory", "text", $config['mediaDir'], "The directory where uploads should be stored", "uk-form-width-large"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("imageDir", "imageDir", "Image Storage Directory", "text", $config['imageDir'], "The directory where downloaded images should be stored", "uk-form-width-large"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("parserLastRun", "parserLastRun", "Parser Last Run Timestamp", "text", $config['parserLastRun'], "The timestamp of when the parser last ran - in general you will not have to make any changes to this value"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("parserMaxItems", "parserMaxItems", "Parser Max Items", "text", $config['parserMaxItems'], "The maximum amount of items the parser should parse on each run"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("userRequestDelay", "userRequestDelay", "User Request Delay", "text", $config['userRequestDelay'], "The delay in minutes that a user has to wait to be able to request a media object again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("mediaRequestDelay", "mediaRequestDelay", "Media Request Delay", "text", $config['mediaRequestDelay'], "The delay in minutes before a media object can be played again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("artistRequestDelay", "artistRequestDelay", "Artist Request Delay", "text", $config['artistRequestDelay'], "The delay in minutes before a media object from the same artist can be played again"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("uploadDurationLimit", "uploadDurationLimit", "Media Duration Limit (Minutes)", "text", $config['uploadDurationLimit'], "The limit of the duration from uploaded media files in minutes - changing this will have no effect on already uploaded files"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new SelectField("useFilenameIfUntitled", "useFilenameIfUntitled", "Use Filename If Untitled", "text", $config['useFilenameIfUntitled'], array(['value' => 0, 'title' => 'Disabled'], ['value' => 1, 'title' => 'Enabled']), false, "Use the filename as title when no title could be detected and/or found"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                 }
             }
             App::config('shoutzor')->set('shoutzor', $configValues);
             //Do stuff
             $alert = array('type' => 'success', 'msg' => __('Changes saved. Make sure the applicable liquidsoap scripts are restarted for the changes to take effect'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Shoutzor Settings'), 'name' => 'shoutzor:views/admin/shoutzor.php'], 'form' => $content, 'alert' => $alert];
 }
 /**
  * {@inheritdoc}
  */
 public function generate(array $parameters = [])
 {
     $id = $parameters['id'];
     $category_id = isset($parameters['category_id']) ? $parameters['category_id'] : 0;
     if (!isset($this->cacheEntries[$id . '-' . $category_id])) {
         if (!($file = File::find($id))) {
             throw new RouteNotFoundException('File not found.');
         }
         if ($category_id && !($category = Category::find($category_id))) {
             throw new RouteNotFoundException('Category not found.');
         }
         $this->addCache($file, $category_id, isset($category) ? $category->slug : App::config('bixie/download')->get('root_category', 'root'));
     }
     $meta = $this->cacheEntries[$id . '-' . $category_id];
     $parameters['slug'] = $meta['slug'];
     unset($parameters['id']);
     unset($parameters['category_id']);
     return $parameters;
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app['node'] = function ($app) {
         if ($id = $app['request']->attributes->get('_node') and $node = Node::find($id, true)) {
             return $node;
         }
         return Node::create();
     };
     $app['menu'] = function ($app) {
         $menus = new MenuManager($app->config($app['theme']->name), $this->config('menus'));
         foreach ($app['theme']->get('menus', []) as $name => $label) {
             $menus->register($name, $label);
         }
         return $menus;
     };
     $app->extend('view', function ($view) use($app) {
         return $view->addHelper(new MenuHelper($app['menu']));
     });
 }
Пример #9
0
 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('lastfm');
     $config = array_merge($config, $_POST);
     //Set the value to the new POST data
     $liquidsoapManager = new LiquidsoapManager();
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new DivField("Notice", "Make sure to have provided a working Application API Key before enabling LastFM to prevent any issues", "", "uk-alert uk-alert-info"));
     $form->addField(new CheckboxField("enabled", "enabled", "Enable LastFM", array($config['enabled']), array(['value' => "1", 'title' => 'enabled'], ['value' => "0", 'title' => 'disabled']), false, "Enable the LastFM Integration"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('1', '0')));
     $form->addField(new InputField("apikey", "apikey", "Application API Key", "text", $config['apikey'], "The Application Key for LastFM, if you don't have one, get one at: <a href='hhttp://www.last.fm/api/account/create'>http://www.last.fm/api/account/create</a>"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("secret", "secret", "Application Secret", "text", $config['secret'], "The Application Secret for LastFM, if you don't have one, get one at: <a href='http://www.last.fm/api/account/create'>http://www.last.fm/api/account/create</a>"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                 }
             }
             //Save our config changes
             App::config('shoutzor')->set('lastfm', $configValues);
             //Show success message
             $alert = array('type' => 'success', 'msg' => __('Changes saved'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Shoutzor LastFM'), 'name' => 'shoutzor:views/admin/lastfm.php'], 'form' => $content, 'alert' => $alert];
 }
Пример #10
0
 /**
  * @Route("/", name="index")
  */
 public function indexAction()
 {
     $request = App::request();
     $config = App::module('shoutzor')->config('liquidsoap');
     $config = array_merge($config, $_POST);
     //Set the value to the new POST data
     $form = new FormGenerator('', 'POST', 'uk-form uk-form-horizontal');
     $form->addField(new InputField("pidFileDirectory", "pidFileDirectory", "Pid File Directory", "text", $config['pidFileDirectory'], "The directory where liquidsoap stores its script PID files"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("logDirectoryPath", "logDirectoryPath", "Log Directory Path", "text", $config['logDirectoryPath'], "The directory where to store the logs (without ending slash)"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("socketPath", "socketPath", "Socket Path", "text", $config['socketPath'], "The directory where to create the socket files (without ending slash)"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("socketPermissions", "socketPermissions", "Socket Permissions", "text", $config['socketPermissions'], "The permissions to set to the created socket files"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new CheckboxField("wrapperLogStdout", "wrapperLogStdout", "Wrapper Log Stdout", array($config['wrapperLogStdout']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Show stdout output in the logs"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("wrapperServerTelnet", "wrapperServerTelnet", "Wrapper Enable Telnet", array($config['wrapperServerTelnet']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable telnet access to the wrapper"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("wrapperServerSocket", "wrapperServerSocket", "Wrapper Enable Socket", array($config['wrapperServerSocket']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable socket access to the wrapper - REQUIRED FOR CONTROLS TO WORK"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new DividerField());
     $form->addField(new CheckboxField("shoutzorLogStdout", "shoutzorLogStdout", "Shoutzor Log Stdout", array($config['shoutzorLogStdout']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Show stdout output in the logs"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("shoutzorServerTelnet", "shoutzorServerTelnet", "Shoutzor Enable Telnet", array($config['shoutzorServerTelnet']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable telnet access to shoutzor"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new CheckboxField("shoutzorServerSocket", "shoutzorServerSocket", "Shoutzor Enable Socket", array($config['shoutzorServerSocket']), array(['value' => "true", 'title' => 'enable'], ['value' => "false", 'title' => 'disable']), false, "Enable socket access to shoutzor - REQUIRED FOR CONTROLS TO WORK"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY, FormValidation::REQ_VALUE => array('true', 'false')));
     $form->addField(new DividerField());
     $form->addField(new InputField("wrapperInputListeningMount", "wrapperInputListeningMount", "Wrapper Input Listening Mount", "text", $config['wrapperInputListeningMount'], "The mount that the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperInputListeningPort", "wrapperInputListeningPort", "Wrapper Input Listening Port", "text", $config['wrapperInputListeningPort'], "The port the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperInputListeningPassword", "wrapperInputListeningPassword", "Wrapper Input Listening Password", "password", $config['wrapperInputListeningPassword'], "The password the wrapper and shoutzor should be using to communicate locally"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("wrapperOutputHost", "wrapperOutputHost", "Wrapper Output Host", "text", $config['wrapperOutputHost'], "The IP of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputMount", "wrapperOutputMount", "Wrapper Output Mount", "text", $config['wrapperOutputMount'], "The mount of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputPort", "wrapperOutputPort", "Wrapper Output Port", "text", $config['wrapperOutputPort'], "The port of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_NUMERIC)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new InputField("wrapperOutputPassword", "wrapperOutputPassword", "Wrapper Output Password", "password", $config['wrapperOutputPassword'], "The password of the icecast server to stream to"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("shoutzorUrl", "shoutzorUrl", "Shoutzor Website URL", "text", $config['shoutzorUrl'], "The hostname of the url this website is running on, example: 'https://shoutzor.com' NO ENDING SLASH"))->setValidationType(FormValidation::TYPE_STRING)->setValidationRequirements(array(FormValidation::REQ_NOTEMPTY));
     $form->addField(new DividerField());
     $form->addField(new InputField("encodingBitrate", "encodingBitrate", "Encoding bitrate", "text", $config['encodingBitrate'], "The bitrate of our audio stream"));
     $form->addField(new InputField("encodingQuality", "encodingQuality", "LAME Encoding Quality", "text", $config['encodingQuality'], "The quality to be used by the LAME encoder, 0 - 9 where 0 is the highest quality"));
     $form->addField(new DividerField());
     $form->addField(new InputField("submit", "", "Save Changes", "submit", "Save Changes", "", "uk-button uk-button-primary"));
     $alert = array();
     //Check if a POST request has been made
     if ($request->isMethod('POST')) {
         $form->validate();
         //Make sure no errors have occured during validation
         if ($form->hasErrors() === false) {
             $replace_values = array();
             $configValues = array();
             foreach ($form->getFields() as $field) {
                 if (!empty($field->getName())) {
                     $configValues[$field->getName()] = $field->getValue();
                     $replace_values['%' . $field->getName() . '%'] = $field->getValue();
                 }
             }
             //Save our config changes
             App::config('shoutzor')->set('liquidsoap', $configValues);
             //Generate our new config file
             $liquidsoapManager = new liquidsoapManager();
             $liquidsoapManager->generateConfigFile($replace_values);
             //Show success message
             $alert = array('type' => 'success', 'msg' => __('Changes saved. Make sure the applicable liquidsoap scripts are restarted for the changes to take effect'));
         } else {
             $alert = array('type' => 'error', 'msg' => __('Not all fields passed validation, correct the problems and try again'));
         }
     }
     $content = $form->render();
     return ['$view' => ['title' => __('Liquidsoap Settings'), 'name' => 'shoutzor:views/admin/liquidsoap.php'], 'form' => $content, 'alert' => $alert];
 }
Пример #11
0
 /**
  * @Request({"entries": "array"}, csrf=true)
  * @Access(admin=true)
  */
 public function saveAction($entries = [])
 {
     App::config('todo')->set('entries', $entries);
     return ['message' => 'success'];
 }
 /**
  * @Route("/frontpage", methods="POST")
  * @Request({"id": "int"}, csrf=true)
  */
 public function frontpageAction($id)
 {
     if (!($node = Node::find($id)) or !($type = App::module('system/site')->getType($node->type))) {
         App::abort(404, __('Node not found.'));
     }
     if (isset($type['frontpage']) and !$type['frontpage']) {
         App::abort(400, __('Invalid node type.'));
     }
     App::config('system/site')->set('frontpage', $id);
     return ['message' => 'success'];
 }
Пример #13
0
 /**
  * @Request({"config": "array", "option": "array", "user": "******"})
  */
 public function installAction($config = [], $option = [], $user = [])
 {
     $status = $this->checkAction($config);
     $message = $status['message'];
     $status = $status['status'];
     try {
         if ('no-connection' == $status) {
             App::abort(400, __('No database connection.'));
         }
         if ('tables-exist' == $status) {
             App::abort(400, $message);
         }
         $scripts = new PackageScripts(App::path() . '/app/system/scripts.php');
         $scripts->install();
         App::db()->insert('@system_user', ['name' => $user['username'], 'username' => $user['username'], 'password' => App::get('auth.password')->hash($user['password']), 'status' => 1, 'email' => $user['email'], 'registered' => date('Y-m-d H:i:s'), 'roles' => '2,3']);
         $option['system']['version'] = App::version();
         $option['system']['extensions'] = ['blog'];
         $option['system']['site']['theme'] = 'theme-one';
         foreach ($option as $name => $values) {
             App::config()->set($name, App::config($name)->merge($values));
         }
         if ($this->packages) {
             $installer = new PackageManager(new NullOutput());
             $installer->install($this->packages);
         }
         if (file_exists(__DIR__ . '/../../install.php')) {
             require_once __DIR__ . '/../../install.php';
         }
         if (!$this->config) {
             $configuration = new Config();
             $configuration->set('application.debug', false);
             foreach ($config as $key => $value) {
                 $configuration->set($key, $value);
             }
             $configuration->set('system.secret', App::get('auth.random')->generateString(64));
             if (!file_put_contents($this->configFile, $configuration->dump())) {
                 $status = 'write-failed';
                 App::abort(400, __('Can\'t write config.'));
             }
         }
         App::module('system/cache')->clearCache();
         $status = 'success';
     } catch (DBALException $e) {
         $status = 'db-sql-failed';
         $message = __('Database error: %error%', ['%error%' => $e->getMessage()]);
     } catch (\Exception $e) {
         $message = $e->getMessage();
     }
     return ['status' => $status, 'message' => $message];
 }
Пример #14
0
 /**
  * @param  $package
  * @return string
  */
 protected function doInstall($package)
 {
     $this->getScripts($package)->install();
     $version = $this->getVersion($package);
     App::config('system')->set('packages.' . $package->get('module'), $version);
     return $version;
 }
Пример #15
0
<?php

use Pagekit\Application as App;
App::config()->set('system/site', App::config('system/site')->merge(['frontpage' => 1, 'view' => ['logo' => 'storage/pagekit-logo.svg']]));
App::db()->insert('@system_config', ['name' => 'theme-one', 'value' => '{"logo_contrast":"storage\\/pagekit-logo-contrast.svg","_menus":{"main":"main","offcanvas":"main"},"_positions":{"hero":[1],"footer":[2]},"_widgets":{"1":{"title_hide":true,"title_size":"uk-panel-title","alignment":true,"html_class":"","panel":""},"2":{"title_hide":true,"title_size":"uk-panel-title","alignment":"","html_class":"","panel":""}},"_nodes":{"1":{"title_hide":true,"title_large":false,"alignment":true,"html_class":"","sidebar_first":false,"hero_image":"storage\\/home-hero.jpg","hero_viewport":true,"hero_contrast":true,"navbar_transparent":true}}}']);
App::db()->insert('@system_node', ['priority' => 1, 'status' => 1, 'title' => 'Home', 'slug' => 'home', 'path' => '/home', 'link' => '@page/1', 'type' => 'page', 'menu' => 'main', 'data' => "{\"defaults\":{\"id\":1}}"]);
App::db()->insert('@system_node', ['priority' => 2, 'status' => 1, 'title' => 'Blog', 'slug' => 'blog', 'path' => '/blog', 'link' => '@blog', 'type' => 'blog', 'menu' => 'main']);
App::db()->insert('@system_widget', ['title' => 'Hello, I\'m Pagekit', 'type' => 'system/text', 'status' => 1, 'nodes' => 1, 'data' => '{"content":"<h1 class=\\"uk-heading-large uk-margin-large-bottom\\">Hello, I\'m Pagekit,<br class=\\"uk-hidden-small\\"> your new favorite CMS.<\\/h1>\\n\\n<a class=\\"uk-button uk-button-large\\" href=\\"http:\\/\\/www.pagekit.com\\">Get started<\\/a>"}']);
App::db()->insert('@system_widget', ['title' => 'Socials', 'type' => 'system/text', 'status' => 1, 'data' => '{"content":"<ul class=\\"uk-grid uk-grid-medium uk-flex uk-flex-center\\">\\n    <li><a href=\\"https:\\/\\/github.com\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-github\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/twitter.com\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-twitter\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/gitter.im\\/pagekit\\/pagekit\\" class=\\"uk-icon-hover uk-icon-small uk-icon-comment-o\\"><\\/a><\\/li>\\n    <li><a href=\\"https:\\/\\/plus.google.com\\/communities\\/104125443335488004107\\" class=\\"uk-icon-hover uk-icon-small uk-icon-google-plus\\"><\\/a><\\/li>\\n<\\/ul>"}']);
App::db()->insert('@system_page', ['title' => 'Home', 'content' => "<div class=\"uk-width-medium-3-4 uk-container-center\">\n    \n<h3 class=\"uk-h1 uk-margin-large-bottom\">Uniting fresh design and clean code<br class=\"uk-hidden-small\"> to create beautiful websites.</h3>\n\n<p class=\"uk-width-medium-4-6 uk-container-center\">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>\n\n</div>", 'data' => '{"title":true}']);
App::db()->insert('@blog_post', ['user_id' => 1, 'slug' => 'hello-pagekit', 'title' => 'Hello Pagekit', 'status' => 2, 'date' => date('Y-m-d H:i:s'), 'modified' => date('Y-m-d H:i:s'), 'content' => "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 'excerpt' => '', 'comment_status' => 1, 'data' => '{"title":null,"markdown":true}']);
Пример #16
0
 /**
  * @Route("/disconnect", methods="DELETE")
  */
 public function disconnectAction()
 {
     unset(App::config('analytics')['profile']);
     unset(App::config('analytics')['token']);
     return App::response()->json(array());
 }
Пример #17
0
 /**
  * @Route("/{id}", methods="DELETE")
  * @Request({"id"}, csrf=true)
  */
 public function deleteAction($id)
 {
     App::config('system/site')->remove('menus.' . $id);
     Node::where(['menu = :id'], [':id' => $id])->update(['menu' => 'trash', 'status' => 0]);
     return ['message' => 'success'];
 }
Пример #18
0
 /**
  * Updates the user in the corresponding session.
  */
 public function onUserChange()
 {
     App::config('system/user')->set('auth.refresh_token', App::get('auth.random')->generateString(16));
 }
 /**
  * @Access("system: access settings")
  * @Request({"config": "array"}, csrf=true)
  */
 public function configAction($config = [])
 {
     App::config('bixie/portfolio')->merge($config, true)->set('datafields', $config['datafields']);
     return ['message' => 'success'];
 }
 /**
  * @Request({"name", "config": "array"}, csrf=true)
  */
 public function configAction($name, $config = [])
 {
     App::config($name)->merge($config, true);
     return ['message' => 'success'];
 }
 /**
  * @Access("system: access settings")
  * @Request({"config": "array"}, csrf=true)
  */
 public function configAction($config = [])
 {
     App::config('bixie/userprofile')->merge($config, true);
     App::config('bixie/userprofile')->merge($config, true)->set('list', $config['list'])->set('details', $config['details']);
     return ['message' => 'success'];
 }
Пример #22
0
 /**
  * Save widgets on user.
  *
  * @param array $widgets
  */
 public function saveWidgets(array $widgets)
 {
     App::config()->set('system/dashboard', $widgets);
 }
Пример #23
0
 /**
  * Automatically parses music files that have not been parsed yet
  * @method autoparse
  */
 public function autoparse()
 {
     //Make sure it's the server that requested this method
     if ($this->ensureLocalhost() === false) {
         return $this->formatOutput(__('You have no access to this method'), self::METHOD_NOT_AVAILABLE);
     }
     //Get our configuration values
     $config = App::module('shoutzor')->config('shoutzor');
     $lastRun = $config['parserLastRun'];
     //Check if the last-run time was more then 1 minute ago to make sure no other parser processes are running
     if ($lastRun > strtotime("-1 minute")) {
         return $this->formatOutput(__('A parser is already running or has been running too recently'), self::ERROR_IN_REQUEST);
     }
     //Get a list of items that need to be parsed
     $toParse = Media::where(['status = :status'], ['status' => Media::STATUS_UPLOADED])->where(['status = :status'], ['status' => Media::STATUS_ERROR])->limit($config['parserMaxItems'])->get();
     //Parse each item
     foreach ($toParse as $item) {
         //Update the parserLastRun value to the current time
         App::config('shoutzor')->set('shoutzor', ['parserLastRun' => time()]);
         //Parse the item
         $this->parse(['id' => $item->id]);
     }
     //Return true
     return $this->formatOutput(true);
 }