1
0
Fork 0
forked from deblan/gist

Compare commits

...

5 commits

7 changed files with 159 additions and 43 deletions

View file

@ -40,41 +40,41 @@ Requirements
Git can maybe be downloaded from your system's repositories. Git can maybe be downloaded from your system's repositories.
$ git config --global user.email "you@example.com" $ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name" $ git config --global user.name "Your Name"
### Composer ### Composer
Composer can maybe be downloaded from your system's repositories. Composer can maybe be downloaded from your system's repositories.
Else, follow the next instructions: Else, follow the next instructions:
# With cURL # With cURL
$ curl -sS https://getcomposer.org/installer | php $ curl -sS https://getcomposer.org/installer | php
# With Wget # With Wget
$ wget -O - -q https://getcomposer.org/installer | php $ wget -O - -q https://getcomposer.org/installer | php
$ chmod +x composer.phar $ chmod +x composer.phar
# For a local installation and if the envvar PATH contains "$HOME/bin/" # For a local installation and if the envvar PATH contains "$HOME/bin/"
$ mv composer.phar ~/bin/composer $ mv composer.phar ~/bin/composer
# For a global installation # For a global installation
$ sudo mv composer.phar /usr/local/bin/composer $ sudo mv composer.phar /usr/local/bin/composer
### Bower ### Bower
$ sudo apt-get install npm $ sudo apt-get install npm
$ sudo npm install -g bower $ sudo npm install -g bower
Installation Installation
------------ ------------
$ cd /path/to/www/ $ cd /path/to/www/
$ git clone https://gitnet.fr/deblan/gist $ git clone https://gitnet.fr/deblan/gist
$ cd gist $ cd gist
$ make $ make
$ cp propel-dist.yaml propel.yaml $ cp propel-dist.yaml propel.yaml
Edit `propel.yaml`. **Use spaces instead of tabulations**. Edit `propel.yaml`. **Use spaces instead of tabulations**.
@ -120,12 +120,12 @@ See the [configuration section](#configuration) for more information about confi
The web server must have permission to write into `data`. The web server must have permission to write into `data`.
$ sudo chown -R www-data:www-data data $ sudo chown -R www-data:www-data data
Your webserver must be configured to serve `web/` as document root. If you use nginx, all virtual paths must be rooted with `web/index.php` or `web/app_dev.php` ([documentation](https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/)). If you use apache, you must enable the `rewrite` module and restart: Your webserver must be configured to serve `web/` as document root. If you use nginx, all virtual paths must be rooted with `web/index.php` or `web/app_dev.php` ([documentation](https://www.nginx.com/resources/wiki/start/topics/recipes/symfony/)). If you use apache, you must enable the `rewrite` module and restart:
$ sudo a2enmod rewrite $ sudo a2enmod rewrite
$ sudo service apache2 restart $ sudo service apache2 restart
`app_dev.php` is the development router. Access is granted for an IP range defined in the same file. `app_dev.php` is the development router. Access is granted for an IP range defined in the same file.
@ -134,8 +134,8 @@ Upgrade
If your version is less than v1.4.2, run: `test -d app && git add app && git commit -m "Configuration"`. If your version is less than v1.4.2, run: `test -d app && git add app && git commit -m "Configuration"`.
$ make update $ make update
$ make propel $ make propel
If you upgrade to v1.4.1 or more: `app/console migrate:to:v1.4.1`. If you upgrade to v1.4.1 or more: `app/console migrate:to:v1.4.1`.
@ -282,7 +282,7 @@ Response example:
"file": "55abcfa7771e0", "file": "55abcfa7771e0",
"createdAt": "2015-07-19T16:26:15Z", "createdAt": "2015-07-19T16:26:15Z",
"updatedAt": "2015-07-19T16:30:15Z" "updatedAt": "2015-07-19T16:30:15Z"
"url": "https:\/\/gist.deblan.org\/en\/view\/55abcfa7771e0\/abcgi72967dd95e3461490dcaa310d728d6adef", "url": "https:\/\/gist.deblan.org\/en\/view\/55abcfa7771e0\/abcgi72967dd95e3461490dcaa310d728d6adef",
}, },
{ {
"id": 67, "id": 67,
@ -292,9 +292,9 @@ Response example:
"file": "xyzbcfa7771e0", "file": "xyzbcfa7771e0",
"createdAt": "2015-08-19T16:26:15Z", "createdAt": "2015-08-19T16:26:15Z",
"updatedAt": "2015-08-19T16:30:15Z" "updatedAt": "2015-08-19T16:30:15Z"
"url": "https:\/\/gist.deblan.org\/en\/view\/5byzbcfa7771e0\/def72967dd95e346koq0dcaa310d728d6artu", "url": "https:\/\/gist.deblan.org\/en\/view\/5byzbcfa7771e0\/def72967dd95e346koq0dcaa310d728d6artu",
}, },
... ...
] ]
``` ```
@ -386,21 +386,21 @@ Gist uses [Magallanes](http://magephp.com/) to manage deployment.
**Global installation** **Global installation**
$ composer global require andres-montanez/magallanes $ composer global require andres-montanez/magallanes
# if the envvar PATH contains "$HOME/bin/" # if the envvar PATH contains "$HOME/bin/"
$ ln -s ~/.composer/vendor/bin/mage ~/bin/mage $ ln -s ~/.composer/vendor/bin/mage ~/bin/mage
**Local installation** **Local installation**
$ composer require andres-montanez/magallanes $ composer require andres-montanez/magallanes
There is an example of the configuration of an environment in `.mage/config/environment/prod.yml.dist`. There is an example of the configuration of an environment in `.mage/config/environment/prod.yml.dist`.
# global installation # global installation
$ mage deploy to:prod $ mage deploy to:prod
# local installation # local installation
$ ./vendor/andres-montanez/magallanes/bin/mage deploy to:prod $ ./vendor/andres-montanez/magallanes/bin/mage deploy to:prod
Contributors Contributors
------------ ------------
@ -416,3 +416,4 @@ Contributors
* Marjorie Da Silva * Marjorie Da Silva
* Mélanie Chanat * Mélanie Chanat
* Showfom * Showfom
* Tavin

View file

@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Cookie;
$app->register(new TranslationServiceProvider(), array( $app->register(new TranslationServiceProvider(), array(
'locale' => 'en', 'locale' => 'en',
'locale_fallback' => 'en', 'locale_fallback' => 'en',
'locales' => array('en', 'fr', 'es', 'de', 'cn'), 'locales' => array('en', 'fr', 'es', 'de', 'cn', 'pl'),
)); ));
$app['translator'] = $app->extend('translator', function ($translator, $app) { $app['translator'] = $app->extend('translator', function ($translator, $app) {

108
app/locales/pl.yml Normal file
View file

@ -0,0 +1,108 @@
app:
title: '#!GIST'
title_prefix: '#!GIST - '
menu:
home:
title: 'Home'
about:
title: 'O projekcie'
my:
login:
title: 'Logowanie'
logout:
title: 'Wylogowanie'
register:
title: 'Rejestracja'
my:
title: 'Konta'
my:
title: 'Moje wklejki'
nothing: 'Nie ma jeszcze nic!'
api:
title: 'API'
warning: 'Trzymaj to w <strong>sekrecie!</strong>'
form:
generate: 'Wygeneruj nowy'
gist:
untitled: 'Bez tytułu'
404:
title: 'Oops!'
message: 'Wklejka nie została znaleziona...'
action:
view: 'Podgląd'
history: 'Commit(s)'
raw: 'RAW'
download: 'Pobierz'
clone: 'Sklonuj'
embed: 'Embed'
add: 'Nowa'
date:
format: 'Y-m-d h:i:s'
footer:
text: '<p>Napędzane przez <a href="https://gitnet.fr/deblan/gist">GIST</a>, to jest open source :) - <a href="https://gitnet.fr/deblan/gist#api">API</a></p>'
login:
login:
title: 'Logowanie'
invalid: 'Nie prawidłowy login lub hasło.'
form:
username:
placeholder: 'Login'
password:
placeholder: 'Hasło'
remember_me:
label: 'Pamiętaj'
register:
title: 'Nowe konto'
already_exists: 'Ta nazwa użytkownika jest już zarejestrowana!'
registred: 'Gratulacje, twoje konto zostało utworzone!'
form:
username:
placeholder: 'Login'
current_password:
placeholder: 'Obecne hasło'
password:
placeholder: 'Hasło'
form:
error:
password: 'Nie prawidłowe hasło.'
not_blank: 'To pole nie powinno być puste!'
title:
placeholder: 'Tytuł'
cipher:
label: 'Szyfrowanie: %value%'
choice:
anyway: 'Tak czy inaczej'
yes: 'Tak'
no: 'Nie'
submit: 'Wyślij'
filter: 'Filtr'
confirm: 'Potwierdzasz?'
success:
password: 'Hasło zostało zaktualizowane.'
gist: 'Wklejka została usunięta.'
type:
label: 'Język: %value%'
choice:
all: 'All'
html: 'HTML'
xml: 'XML'
css: 'CSS'
javascript: 'JAVASCRIPT'
php: 'PHP'
sql: 'SQL'
yaml: 'YAML'
perl: 'PERL'
c: 'C/C++'
asp: 'ASP'
python: 'PYTHON'
bash: 'BASH'
actionscript3: 'ACTION SCRIPT'
text: 'TEXT'

View file

@ -1,4 +1,7 @@
{ {
"name": "deblan/gist",
"license": "GPL-3.0-only",
"type": "project",
"require": { "require": {
"silex/silex": "1.3.x-dev", "silex/silex": "1.3.x-dev",
"symfony/yaml": "~2.6", "symfony/yaml": "~2.6",

View file

@ -88,7 +88,7 @@ class Client extends BaseClient
public function update($gist, $content) public function update($gist, $content)
{ {
$response = $this->post( $response = $this->post(
str_replace('{gist}', $gist, $this->mergeApiKey(self::LIST)), str_replace('{gist}', $gist, $this->mergeApiKey(self::UPDATE)),
array( array(
'form_params' => array( 'form_params' => array(
'form' => array( 'form' => array(

View file

@ -158,12 +158,16 @@ class ApiController extends Controller
return $this->invalidMethodResponse('POST method is required.'); return $this->invalidMethodResponse('POST method is required.');
} }
$gist = GistQuery::create() $query = GistQuery::create()
->filterByCipher(false) ->filterByCipher(false);
->filterById((int) $gist)
->_or() if (ctype_digit($gist)) {
->filterByFile($gist) $query->filterById((int) $gist);
->findOne(); } else {
$query->filterByFile($gist);
}
$gist = $query->findOne();
if (!$gist) { if (!$gist) {
return $this->invalidRequestResponse('Invalid Gist'); return $this->invalidRequestResponse('Invalid Gist');

View file

@ -81,7 +81,7 @@
</ul> </ul>
{% block langs %} {% block langs %}
<p class="navbar-text navbar-right"> <p class="navbar-text navbar-right">
{% for locale, flag in {'en': 'gb', 'fr': 'fr', 'es': 'es', 'de': 'de', 'cn': 'cn'} %} {% for locale, flag in {'en': 'gb', 'fr': 'fr', 'es': 'es', 'de': 'de', 'cn': 'cn', 'pl': 'pl'} %}
<a class="lang btn btn-xs cipher-link" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge({_locale: locale})) }}"> <a class="lang btn btn-xs cipher-link" href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge({_locale: locale})) }}">
<span class="flag-icon flag-icon-{{ flag }}"></span> <span class="flag-icon flag-icon-{{ flag }}"></span>
</a> </a>