forked from verdnatura/hedera-web
improved README, PHP linting, bugs fixed
This commit is contained in:
parent
d19438bad1
commit
91dec387fa
|
@ -1,3 +1,3 @@
|
|||
node_modules
|
||||
build/
|
||||
config.php
|
||||
config.my.php
|
||||
|
|
19
README.md
19
README.md
|
@ -1,3 +1,20 @@
|
|||
# Hedera
|
||||
|
||||
Hedera is the main page for Verdnatura.
|
||||
Hedera is the main web page for Verdnatura.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Required dependencies.
|
||||
* PHP >= 7.0
|
||||
* Node.js >= 8.0
|
||||
|
||||
Launch command line client.
|
||||
```
|
||||
$ php hedera-web.php -m method_path
|
||||
```
|
||||
|
||||
## Built with
|
||||
|
||||
* [Webpack](https://webpack.js.org/)
|
||||
* [MooTools](https://mootools.net/)
|
||||
* [TinyMCE](https://www.tinymce.com/)
|
||||
|
|
|
@ -14,16 +14,14 @@
|
|||
* - http://test.mydomain.org -> config.test.php
|
||||
*/
|
||||
return [
|
||||
|
||||
/**
|
||||
* Database parameters.
|
||||
**/
|
||||
'db' => [
|
||||
'host' => 'localhost'
|
||||
,'port' => 3306
|
||||
,'schema' => 'hedera-web'
|
||||
,'user' => 'hedera-web'
|
||||
,'pass' => ''
|
||||
]
|
||||
|
||||
/**
|
||||
* Database parameters.
|
||||
*/
|
||||
'db' => [
|
||||
'host' => 'localhost'
|
||||
,'port' => 3306
|
||||
,'schema' => 'hedera-web'
|
||||
,'user' => 'hedera-web'
|
||||
,'pass' => ''
|
||||
]
|
||||
];
|
|
@ -1,4 +1,4 @@
|
|||
hedera-web (1.406.04) stable; urgency=low
|
||||
hedera-web (1.406.05) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
conf/* etc/hedera-web
|
||||
apache.conf etc/hedera-web
|
||||
config.php etc/hedera-web
|
||||
web usr/share/php/vn
|
||||
doc/* usr/share/doc/hedera-web
|
||||
hedera-web.php usr/share/hedera-web
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
@include_once __DIR__.'/env.php';
|
||||
if (file_exists(__DIR__.'/env.php'))
|
||||
include_once __DIR__.'/env.php';
|
||||
|
||||
require_once 'vn-autoload.php';
|
||||
|
||||
$webApp = new Vn\Web\App('hedera-web');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "1.406.04",
|
||||
"version": "1.406.05",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
|
@ -22,7 +22,7 @@ $result = $db->query('SELECT name, content FROM metatag');
|
|||
<meta name="<?=$row->name?>" content="<?=$row->content?>"/>
|
||||
<?php endwhile ?>
|
||||
|
||||
<?php foreach(getWebpackAssets() as $js): ?>
|
||||
<?php foreach (getWebpackAssets() as $js): ?>
|
||||
<script type="text/javascript" src="<?=$js?>"></script>
|
||||
<?php endforeach ?>
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ class Account {
|
|||
$modifs = [];
|
||||
$curAttrs = ldap_get_attributes($ds, $entry);
|
||||
|
||||
foreach($attrs as $attribute => $value)
|
||||
foreach ($attrs as $attribute => $value)
|
||||
if (!empty($value)) {
|
||||
$modifs[] = [
|
||||
'attrib' => $attribute,
|
||||
|
@ -132,7 +132,7 @@ class Account {
|
|||
} else {
|
||||
$addAttrs = [];
|
||||
|
||||
foreach($attrs as $attribute => $value)
|
||||
foreach ($attrs as $attribute => $value)
|
||||
if (!empty($value))
|
||||
$addAttrs[$attribute] = $value;
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ class Clean extends Edi\Method {
|
|||
,$this->imapConf['error_folder']
|
||||
];
|
||||
|
||||
foreach($folders as $folder)
|
||||
foreach ($folders as $folder)
|
||||
if (imap_reopen($imap, "{$this->mailbox}$folder")) {
|
||||
if ($messages = imap_search($imap, $filter)) {
|
||||
foreach($messages as $message)
|
||||
foreach ($messages as $message)
|
||||
imap_delete($imap, $message);
|
||||
|
||||
imap_expunge($imap);
|
||||
|
|
|
@ -11,7 +11,7 @@ class Section {
|
|||
var $childs = [];
|
||||
|
||||
function getValue($name, $key, $type = NULL, $subname = NULL) {
|
||||
foreach($this->segments as $segment)
|
||||
foreach ($this->segments as $segment)
|
||||
if ($segment->name == $name
|
||||
&&(!$subname || $segment->values[1] == $subname))
|
||||
return $segment->getValue($key, $type);
|
||||
|
|
|
@ -18,7 +18,7 @@ class Load extends Edi\Method {
|
|||
$inbox = imap_search($this->imap, 'ALL');
|
||||
|
||||
if ($inbox) {
|
||||
foreach($inbox as $msg)
|
||||
foreach ($inbox as $msg)
|
||||
$this->loadMail($db, $msg);
|
||||
|
||||
$inboxCount = count($inbox);
|
||||
|
@ -55,7 +55,7 @@ class Load extends Edi\Method {
|
|||
$count = 0;
|
||||
$error = NULL;
|
||||
|
||||
foreach($result as $msgSection)
|
||||
foreach ($result as $msgSection)
|
||||
try {
|
||||
$part = imap_bodystruct($imap, $msg, $msgSection);
|
||||
$ediString = imap_fetchbody($imap, $msg, $msgSection);
|
||||
|
@ -87,8 +87,8 @@ class Load extends Edi\Method {
|
|||
$unb = $ediMessage->section;
|
||||
$unhs = $unb->childs['UNH'];
|
||||
|
||||
foreach($unhs as $unh)
|
||||
foreach($lins = $unh->childs['LIN'] as $lin) {
|
||||
foreach ($unhs as $unh)
|
||||
foreach ($lins = $unh->childs['LIN'] as $lin) {
|
||||
$ediValues = [];
|
||||
|
||||
// Gets the exchange params
|
||||
|
@ -194,7 +194,7 @@ class Load extends Edi\Method {
|
|||
else
|
||||
$result[] = '1';
|
||||
} elseif ($part->type == TYPEMULTIPART)
|
||||
foreach($part->parts as $i => $subpart) {
|
||||
foreach ($part->parts as $i => $subpart) {
|
||||
array_push($section, $i + 1);
|
||||
$this->imapFindParts($subpart, $matchTypes, $section, $result);
|
||||
array_pop($section);
|
||||
|
|
|
@ -71,7 +71,7 @@ class Update extends Vn\Lib\Method {
|
|||
unlink($zipFile);
|
||||
}
|
||||
|
||||
foreach(glob("$ucDir/$baseName*.txt") as $fileName)
|
||||
foreach (glob("$ucDir/$baseName*.txt") as $fileName)
|
||||
break;
|
||||
|
||||
if (!$fileName)
|
||||
|
|
|
@ -75,7 +75,7 @@ class Sync extends Vn\Lib\Method {
|
|||
|
||||
$this->cleanImages($schema, 'full', $map);
|
||||
|
||||
foreach($info['sizes'] as $size => $i)
|
||||
foreach ($info['sizes'] as $size => $i)
|
||||
$this->cleanImages($schema, $size, $map);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class Upload extends Vn\Web\JsonRequest {
|
|||
$image = Image::create($tmpName);
|
||||
Image::resizeSave($image, $fullFile, $info['maxHeight'], $info['maxWidth']);
|
||||
|
||||
foreach($info['sizes'] as $size => $i) {
|
||||
foreach ($info['sizes'] as $size => $i) {
|
||||
$dstFile = "$schemaPath/$size/$fileName";
|
||||
Image::resizeSave($image, $dstFile, $i['height'], $i['width'], $i['crop'], $symbolicSrc);
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ class ExchangeRate extends Vn\Lib\Method {
|
|||
$date = $db->getValue("SELECT MAX(date) fecha FROM reference_rate");
|
||||
$maxDate = $date ? DateTime::createFromFormat('Y-m-d', $date) : NULL;
|
||||
|
||||
foreach($xml->Cube[0]->Cube as $cube) {
|
||||
foreach ($xml->Cube[0]->Cube as $cube) {
|
||||
$xmlDate = new DateTime($cube['time']);
|
||||
|
||||
// Si existen datos más recientes de la máxima fecha los añade
|
||||
|
||||
if ($maxDate <= $xmlDate)
|
||||
foreach($cube->Cube as $subCube)
|
||||
foreach ($cube->Cube as $subCube)
|
||||
if ($subCube['currency'] == 'USD') {
|
||||
$params = [
|
||||
'date' => $xmlDate,
|
||||
|
|
|
@ -30,14 +30,14 @@ class ConfirmMail extends Vn\Lib\Method {
|
|||
$inbox = imap_search($imap, 'ALL');
|
||||
|
||||
if ($inbox)
|
||||
foreach($inbox as $msg) {
|
||||
foreach ($inbox as $msg) {
|
||||
// Decodes the mail body
|
||||
|
||||
$params = [];
|
||||
$body = imap_fetchbody($imap, $msg, '1');
|
||||
$strings = explode(';', $body);
|
||||
|
||||
foreach($strings as $string) {
|
||||
foreach ($strings as $string) {
|
||||
$x = explode(':', $string);
|
||||
$params[trim($x[0])] = trim($x[1]);
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ class ConfirmMail extends Vn\Lib\Method {
|
|||
$date->sub(new \DateInterval($imapConf->cleanPeriod));
|
||||
$filter = sprintf('BEFORE "%s"', $date->format('D, j M Y'));
|
||||
|
||||
foreach($folders as $folder)
|
||||
foreach ($folders as $folder)
|
||||
if (imap_reopen($imap, $mailbox.'.'.$folder))
|
||||
if ($messages = imap_search($imap, $filter)) {
|
||||
foreach($messages as $message)
|
||||
foreach ($messages as $message)
|
||||
imap_delete($imap, $message);
|
||||
|
||||
imap_expunge($imap);
|
||||
|
|
|
@ -38,7 +38,7 @@ function getWebpackAssets() {
|
|||
unset($wpAssets->manifest);
|
||||
unset($wpAssets->main);
|
||||
|
||||
foreach($wpAssets as $name => $asset)
|
||||
foreach ($wpAssets as $name => $asset)
|
||||
if (property_exists($asset, 'js'))
|
||||
$assets->$name = $asset->js;
|
||||
} else {
|
||||
|
@ -48,14 +48,14 @@ function getWebpackAssets() {
|
|||
|
||||
unset($wpConfig->entry->main);
|
||||
|
||||
foreach($wpConfig->entry as $asset => $files)
|
||||
foreach ($wpConfig->entry as $asset => $files)
|
||||
$assets->$asset = "$devServerPath/$asset.js";
|
||||
}
|
||||
|
||||
$jsFiles = [];
|
||||
$jsFiles[] = $manifestJs;
|
||||
|
||||
foreach($assets as $jsFile)
|
||||
foreach ($assets as $jsFile)
|
||||
$jsFiles[] = $jsFile;
|
||||
|
||||
$jsFiles[] = $mainJs;
|
||||
|
|
|
@ -43,7 +43,7 @@ class Mailer {
|
|||
|
||||
$mailList = explode(',', $mailTo);
|
||||
|
||||
foreach($mailList as $to)
|
||||
foreach ($mailList as $to)
|
||||
$mail->AddAddress($to);
|
||||
|
||||
return $mail;
|
||||
|
|
|
@ -64,7 +64,7 @@ abstract class Service {
|
|||
|
||||
preg_match_all($regexp, $_SERVER['HTTP_ACCEPT_LANGUAGE'], $languages);
|
||||
|
||||
foreach($languages[1] as $lang)
|
||||
foreach ($languages[1] as $lang)
|
||||
if (TRUE || stream_resolve_include_path("locale/$lang")) {
|
||||
$_SESSION['lang'] = $lang;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue