Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion app/modules/site-module/Resources/layouts/@organ.route.latte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
{/if}
</dd>
{/if}

{if $item['department']}
<dd>Resorty: {$item['department']}</dd>
{/if}
</dl>

</div>
Expand All @@ -73,6 +77,21 @@
{/define}

{if $data !== null}
{if isset($data['organization']['bank_account_number'])}
<div>
Transparentní účet: <a href="https://www.fio.cz/ib2/transparent?a={$data['organization']['bank_account_number']}">
{$data['organization']['bank_account_number']}/2010
</a>
</div>
{/if}

{if isset($data['organization']['homepage_url'])}
<div>
Webové stránky: <a href="{$data['organization']['homepage_url']}">
{$data['organization']['homepage_url']}
</a>
</div>
{/if}

{if count($data['president']) > 0}
<h2>Předseda</h2>
Expand All @@ -92,5 +111,4 @@

{include #items items => $data['members']}
{/if}

{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<hr />

{var $url = $presenter->link('//Route', array('route' => $presenter->route))}
{if $route->created <= DateTime::createFromFormat('Y-m-d', '2015-01-25')}
{if $presenter->route->created <= DateTime::createFromFormat('Y-m-d', '2015-01-25')}
{var $url = str_replace('https://', 'http://', $url)}
{/if}
<iframe src="//www.facebook.com/plugins/like.php?href={=urlencode($url)}&amp;width&amp;layout=standard&amp;action=like&amp;show_faces=true&amp;share=true&amp;height=80&amp;appId=332223310281975" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:80px;" allowTransparency="true"></iframe>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
<a href="{$basePath}/udalosti" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-chevron-right"></span> Další</a>

<div class="page-header">
<h2><a href="{$basePath}/clanky/stanoviska-strany">Stanoviska strany</a></h2>
<h2><a href="{$basePath}/clanky/stanoviska-strany">Stanoviska vedení strany</a></h2>
</div>
{element blog stanoviska, config => [ variant => 'stanoviska' ]}
<a href="{$basePath}/clanky/stanoviska-strany" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-chevron-right"></span> Další</a>
Expand Down
5 changes: 5 additions & 0 deletions app/modules/site-module/Resources/public/css/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,8 @@ footer .pull-right {
.dl-card dd {
margin-left: 45px;
}

.col-md-8 ul {
position: relative;
left: 10px;
}
33 changes: 11 additions & 22 deletions app/modules/site-module/SiteModule/Pages/Fio/PageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class PageService extends \Nette\Object
{

const FIO_API_URL = 'https://www.fio.cz/scgi-bin/hermes/dz-transparent.cgi';
const FIO_API_URL = 'https://www.fio.cz/ib2/transparent';

/** @var \SiteModule\Api\ApiClientFactory */
private $apiClientFactory;
Expand All @@ -46,28 +46,25 @@ public function getTransfers($accountNumber, $maxItems = null, DateTime $dateFro
{
$data = $this->getRawData($accountNumber, $dateFrom, $dateTo);

$transferData = substr($data, strpos($data, '<table class=\'main\'>'));
$transferData = substr($transferData, 0, strpos($transferData, '</table>') + 8);

$dom = new \DOMDocument();
$dom->loadHTML($transferData);
$dom->loadHTML($data);

$finder = new \DomXPath($dom);
$nodes = $finder->query('//table[@class="main"]//tbody//tr');
$nodes = $finder->query('//table[substring(@id, 1, 2) = "id"]/tbody/tr');

$transfers = array();
/** @var \DOMElement $node */
$i = 1;
$length = $nodes->length;
foreach ($nodes as $node) {
$value = str_replace(',', '.', trim($node->childNodes->item(2)->nodeValue));
$value = (float)str_replace(' ', '', $value);
$value = (float)preg_replace('~\x{00a0}~siu', '', $value);

$transfers[] = array(
\DateTime::createFromFormat('d.m.Y', $node->childNodes->item(0)->nodeValue),
$value,
$node->childNodes->item(12)->nodeValue,
$node->childNodes->item(14)->nodeValue,
$node->childNodes->item(6)->nodeValue,
$node->childNodes->item(8)->nodeValue,
);

if ($maxItems !== null && $i >= $maxItems) {
Expand All @@ -81,21 +78,15 @@ public function getTransfers($accountNumber, $maxItems = null, DateTime $dateFro
}
}


$stateData = substr($data, strpos($data, '<table class=\'summary\'>'));
$stateData = substr($stateData, 0, strpos($stateData, '</table>') + 8);

$dom = new \DOMDocument();
$dom->loadHTML($stateData);

$finder = new \DomXPath($dom);
$nodes = $finder->query('//table[@class="summary"]//tbody//tr//td[2]');
$nodes = $finder->query('//div[contains(concat(" ", normalize-space(@class), " "), " pohybySum ")]//table//tbody//tr//td[2]');

$value = trim($nodes->item(0)->nodeValue);

$value = substr(trim($value), 0, -3);
$value = str_replace(',', '.', $value);

return array(
'state' => (float)str_replace(' ', '', $value),
'state' => (float)preg_replace('~\x{00a0}~siu', '', $value),
'transfers' => $transfers,
);
}
Expand All @@ -116,9 +107,7 @@ private function getRawData($accountNumber, DateTime $dateFrom = null, DateTime
$dateTo = new DateTime();
}

$data = $this->getApiClient()->callRawApi('?ID_ucet=' . $accountNumber);
$data = iconv('windows-1250', 'UTF-8', $data);
$data = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
$data = $this->getApiClient()->callRawApi('?a=' . $accountNumber);

return $data;
}
Expand Down
64 changes: 64 additions & 0 deletions devenv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
apt-get update
apt-get install php5 php5-curl php5-mysql mysql-server

a2enmod ssl
a2enmod rewrite

cd /etc/ssl/certs/

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout apache.key -out apache.crt

Edit /etc/apache2/sites-enabled/000-default.conf:

<VirtualHost *:80>
DocumentRoot /home/shadow/src/svobodni-web/www

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:443>
DocumentRoot /home/shadow/src/svobodni-web/www

SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache.crt
SSLCertificateKeyFile /etc/ssl/certs/apache.key

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Edit /etc/apache2/apache2.conf:

ServerName localhost
ServerAdmin webmaster@localhost

<Directory /home/shadow/src>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

/etc/init.d/apache2 restart

Setup app/config/config.local.neon

cp app/config/config.local.neon app/config/config_localhost.neon

curl http://web.svobodni.cz/scripts/export-db.php > init.sql

mysql -u root

CREATE TABLE svobodni;
USE svobodni;
SET FOREIGN_KEY_CHECKS=0;
\. init.sql
SET FOREIGN_KEY_CHECKS=1;

chmod 777 www/cache
chmod 777 app/log

mkdir app/temp/proxies
chmod 777 app/temp/proxies

Visit https://localhost/
1 change: 0 additions & 1 deletion vendor/bin/doctrine

This file was deleted.

4 changes: 4 additions & 0 deletions vendor/bin/doctrine
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php

include('doctrine.php');
1 change: 0 additions & 1 deletion vendor/bin/doctrine.php

This file was deleted.

59 changes: 59 additions & 0 deletions vendor/bin/doctrine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

use Symfony\Component\Console\Helper\HelperSet;
use Doctrine\ORM\Tools\Console\ConsoleRunner;

(@include_once __DIR__ . '/../vendor/autoload.php') || @include_once __DIR__ . '/../../../autoload.php';

$directories = array(getcwd(), getcwd() . DIRECTORY_SEPARATOR . 'config');

$configFile = null;
foreach ($directories as $directory) {
$configFile = $directory . DIRECTORY_SEPARATOR . 'cli-config.php';

if (file_exists($configFile)) {
break;
}
}

if ( ! file_exists($configFile)) {
ConsoleRunner::printCliConfigTemplate();
exit(1);
}

if ( ! is_readable($configFile)) {
echo 'Configuration file [' . $configFile . '] does not have read permission.' . "\n";
exit(1);
}

$commands = array();

$helperSet = require $configFile;

if ( ! ($helperSet instanceof HelperSet)) {
foreach ($GLOBALS as $helperSetCandidate) {
if ($helperSetCandidate instanceof HelperSet) {
$helperSet = $helperSetCandidate;
break;
}
}
}

\Doctrine\ORM\Tools\Console\ConsoleRunner::run($helperSet, $commands);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chyba