@@ -192,7 +192,7 @@ |
||
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @param ColumnMap $column |
| 195 | - * @param ModelCriteria $quwuery |
|
| 195 | + * @param ModelCriteria $query |
|
| 196 | 196 | * @param mixed $value |
| 197 | 197 | */ |
| 198 | 198 | private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null) { |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | $fDto = self::generatePasswordField($field, $required); |
| 46 | 46 | } elseif (in_array($mappedColumn->getType(), [PropelTypes::TIMESTAMP])) { |
| 47 | 47 | $fDto = self::createField($field, Field::TEXT_TYPE, $required); |
| 48 | - } elseif(in_array($mappedColumn->getType(), [PropelTypes::ENUM, PropelTypes::SET])) { |
|
| 48 | + } elseif (in_array($mappedColumn->getType(), [PropelTypes::ENUM, PropelTypes::SET])) { |
|
| 49 | 49 | $fDto = self::generateEnumField($field, $required); |
| 50 | - foreach($mappedColumn->getValueSet() as $value) { |
|
| 50 | + foreach ($mappedColumn->getValueSet() as $value) { |
|
| 51 | 51 | $fDto->data[] = [ |
| 52 | 52 | $field => $value, |
| 53 | 53 | "Label" => _($value), |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if(null !== $fDto) { |
|
| 58 | + if (null !== $fDto) { |
|
| 59 | 59 | $form->addField($fDto); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $fDto->entity = $relatedModel; |
| 79 | 79 | $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName()); |
| 80 | 80 | $fDto->relatedField = $relatedField->getPhpName(); |
| 81 | - $fDto->url = Router::getInstance()->getRoute('api-' . $relatedModel); |
|
| 81 | + $fDto->url = Router::getInstance()->getRoute('api-'.$relatedModel); |
|
| 82 | 82 | return $fDto; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | public static function checkFieldExists(TableMap $tableMap, $field) { |
| 184 | 184 | try { |
| 185 | 185 | $column = $tableMap->getColumnByPhpName($field); |
| 186 | - } catch(\Exception $e) { |
|
| 186 | + }catch (\Exception $e) { |
|
| 187 | 187 | Logger::log($e->getMessage(), LOG_ERR); |
| 188 | 188 | $column = null; |
| 189 | 189 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param ModelCriteria $quwuery |
| 196 | 196 | * @param mixed $value |
| 197 | 197 | */ |
| 198 | - private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null) { |
|
| 198 | + private static function addQueryFilter(ColumnMap $column, ModelCriteria & $query, $value = null) { |
|
| 199 | 199 | $tableField = $column->getPhpName(); |
| 200 | 200 | if (preg_match('/^<=/', $value)) { |
| 201 | 201 | $query->filterBy($tableField, substr($value, 2, strlen($value)), Criteria::LESS_EQUAL); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $text = preg_replace('/(\'|\")/', '', $value); |
| 210 | 210 | $text = preg_replace('/\ /', '%', $text); |
| 211 | 211 | $query->filterBy($tableField, '%'.$text.'%', Criteria::LIKE); |
| 212 | - } else { |
|
| 212 | + }else { |
|
| 213 | 213 | $query->filterBy($tableField, $value, Criteria::EQUAL); |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -220,23 +220,23 @@ discard block |
||
| 220 | 220 | * @param array $extraColumns |
| 221 | 221 | * @param mixed $value |
| 222 | 222 | */ |
| 223 | - public static function composerComboField(TableMap $tableMap, ModelCriteria &$query, array $extraColumns = [], $value = null) { |
|
| 223 | + public static function composerComboField(TableMap $tableMap, ModelCriteria & $query, array $extraColumns = [], $value = null) { |
|
| 224 | 224 | $exp = 'CONCAT('; |
| 225 | 225 | $sep = ''; |
| 226 | - foreach($tableMap->getColumns() as $column) { |
|
| 227 | - if($column->isText()) { |
|
| 228 | - $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")'; |
|
| 226 | + foreach ($tableMap->getColumns() as $column) { |
|
| 227 | + if ($column->isText()) { |
|
| 228 | + $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")'; |
|
| 229 | 229 | $sep = ', " ", '; |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | - foreach($extraColumns as $extra => $name) { |
|
| 233 | - $exp .= $sep . $extra; |
|
| 232 | + foreach ($extraColumns as $extra => $name) { |
|
| 233 | + $exp .= $sep.$extra; |
|
| 234 | 234 | $sep = ', " ", '; |
| 235 | 235 | } |
| 236 | 236 | $exp .= ")"; |
| 237 | 237 | $text = preg_replace('/(\'|\")/', '', $value); |
| 238 | 238 | $text = preg_replace('/\ /', '%', $text); |
| 239 | - $query->where($exp . Criteria::LIKE . '"%' . $text . '%"'); |
|
| 239 | + $query->where($exp.Criteria::LIKE.'"%'.$text.'%"'); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @param string $field |
| 247 | 247 | * @param mixed $value |
| 248 | 248 | */ |
| 249 | - public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null) { |
|
| 249 | + public static function addModelField(TableMap $tableMap, ModelCriteria & $query, $field, $value = null) { |
|
| 250 | 250 | if ($column = self::checkFieldExists($tableMap, $field)) { |
| 251 | 251 | self::addQueryFilter($column, $query, $value); |
| 252 | 252 | } |
@@ -4,17 +4,17 @@ |
||
| 4 | 4 | |
| 5 | 5 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
| 6 | 6 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 9 | -} else { |
|
| 10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 7 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
| 8 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
| 9 | +}else { |
|
| 10 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
| 11 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
| 12 | 12 | } |
| 13 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 14 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 15 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 16 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 17 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 13 | +if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
| 14 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
| 15 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
| 16 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
| 17 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
| 18 | 18 | |
| 19 | 19 | //Cargamos en memoria la función de desarrollo PRE |
| 20 | 20 | if (!function_exists('pre')) { |
@@ -1,20 +1,42 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (defined('PSFS_BOOTSTRAP_LOADED')) return; |
|
| 2 | +if (defined('PSFS_BOOTSTRAP_LOADED')) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 3 | 5 | use Symfony\Component\Finder\Finder; |
| 4 | 6 | |
| 5 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
| 7 | +if (!defined('SOURCE_DIR')) { |
|
| 8 | + define('SOURCE_DIR', __DIR__); |
|
| 9 | +} |
|
| 6 | 10 | if (preg_match('/vendor/', SOURCE_DIR)) { |
| 7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 9 | -} else { |
|
| 10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 12 | -} |
|
| 13 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 14 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 15 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 16 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 17 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 11 | + if (!defined('BASE_DIR')) { |
|
| 12 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
| 13 | + } |
|
| 14 | + if (!defined('CORE_DIR')) { |
|
| 15 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
| 16 | + } |
|
| 17 | + } else { |
|
| 18 | + if (!defined('BASE_DIR')) { |
|
| 19 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
| 20 | + } |
|
| 21 | + if (!defined('CORE_DIR')) { |
|
| 22 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
| 23 | + } |
|
| 24 | + } |
|
| 25 | +if (!defined('VENDOR_DIR')) { |
|
| 26 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
| 27 | +} |
|
| 28 | +if (!defined('LOG_DIR')) { |
|
| 29 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
| 30 | +} |
|
| 31 | +if (!defined('CACHE_DIR')) { |
|
| 32 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
| 33 | +} |
|
| 34 | +if (!defined('CONFIG_DIR')) { |
|
| 35 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
| 36 | +} |
|
| 37 | +if (!defined('WEB_DIR')) { |
|
| 38 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
| 39 | +} |
|
| 18 | 40 | |
| 19 | 41 | //Cargamos en memoria la función de desarrollo PRE |
| 20 | 42 | if (!function_exists('pre')) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public static function sortByLabel(array $elementA, array $elementB) { |
| 16 | 16 | $labelA = array_key_exists('label', $elementA) ? $elementA['label'] : ''; |
| 17 | 17 | $labelB = array_key_exists('label', $elementB) ? $elementB['label'] : ''; |
| 18 | - if($labelA == $labelB) { |
|
| 18 | + if ($labelA == $labelB) { |
|
| 19 | 19 | return 0; |
| 20 | 20 | } |
| 21 | 21 | return $labelA < $labelB ? -1 : 1; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if (preg_match('/^\/admin(\/|$)/', $routePattern)) { |
| 34 | 34 | if (preg_match('/^\\\?PSFS/', $params["class"])) { |
| 35 | 35 | $profile = "superadmin"; |
| 36 | - } else { |
|
| 36 | + }else { |
|
| 37 | 37 | $profile = "admin"; |
| 38 | 38 | } |
| 39 | 39 | if (!empty($params["default"]) && preg_match('/(GET|ALL)/i', $httpMethod)) { |