/**
* Define the following constant to ignore the default configuration file.
*/
-define ('K_TCPDF_EXTERNAL_CONFIG', true);
+define('K_TCPDF_EXTERNAL_CONFIG', true);
/**
* Installation path (/var/www/tcpdf/).
* By default it is automatically calculated but you can also set it as a fixed string to improve performances.
*/
-define ('K_PATH_MAIN', GALETTE_TCPDF_PATH);
+define('K_PATH_MAIN', GALETTE_TCPDF_PATH);
/**
* URL path to tcpdf installation folder (http://localhost/tcpdf/).
* Path for PDF fonts.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
-define ('K_PATH_FONTS', GALETTE_TCPDF_PATH.'/fonts/');
+define('K_PATH_FONTS', GALETTE_TCPDF_PATH . '/fonts/');
/**
* Default images directory.
* By default it is automatically set but you can also set it as a fixed string to improve performances.
*/
-define ('K_PATH_IMAGES', GALETTE_PHOTOS_PATH);
+define('K_PATH_IMAGES', GALETTE_PHOTOS_PATH);
/**
* Deafult image logo used be the default Header() method.
/**
* Cache directory for temporary files (full path).
*/
-define ('K_PATH_CACHE', GALETTE_CACHE_DIR);
+define('K_PATH_CACHE', GALETTE_CACHE_DIR);
/**
* Generic name for a blank image.
*/
-define ('K_BLANK_IMAGE', '_blank.png');
+define('K_BLANK_IMAGE', '_blank.png');
/**
* Page format.
*/
-define ('PDF_PAGE_FORMAT', 'A4');
+define('PDF_PAGE_FORMAT', 'A4');
/**
* Page orientation (P=portrait, L=landscape).
*/
-define ('PDF_PAGE_ORIENTATION', 'P');
+define('PDF_PAGE_ORIENTATION', 'P');
/**
* Document creator.
*/
-define ('PDF_CREATOR', 'TCPDF');
+define('PDF_CREATOR', 'TCPDF');
/**
* Document author.
*/
-define ('PDF_AUTHOR', 'TCPDF');
+define('PDF_AUTHOR', 'TCPDF');
/**
* Header title.
*/
-define ('PDF_HEADER_TITLE', 'TCPDF Example');
+define('PDF_HEADER_TITLE', 'TCPDF Example');
/**
* Header description string.
*/
-define ('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
+define('PDF_HEADER_STRING', "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org");
/**
* Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
*/
-define ('PDF_UNIT', 'mm');
+define('PDF_UNIT', 'mm');
/**
* Header margin.
*/
-define ('PDF_MARGIN_HEADER', 5);
+define('PDF_MARGIN_HEADER', 5);
/**
* Footer margin.
*/
-define ('PDF_MARGIN_FOOTER', 10);
+define('PDF_MARGIN_FOOTER', 10);
/**
* Top margin.
*/
-define ('PDF_MARGIN_TOP', 27);
+define('PDF_MARGIN_TOP', 27);
/**
* Bottom margin.
*/
-define ('PDF_MARGIN_BOTTOM', 25);
+define('PDF_MARGIN_BOTTOM', 25);
/**
* Left margin.
*/
-define ('PDF_MARGIN_LEFT', 15);
+define('PDF_MARGIN_LEFT', 15);
/**
* Right margin.
*/
-define ('PDF_MARGIN_RIGHT', 15);
+define('PDF_MARGIN_RIGHT', 15);
/**
* Default main font name.
*/
-define ('PDF_FONT_NAME_MAIN', 'DejaVuSans');
+define('PDF_FONT_NAME_MAIN', 'DejaVuSans');
/**
* Default main font size.
*/
-define ('PDF_FONT_SIZE_MAIN', 10);
+define('PDF_FONT_SIZE_MAIN', 10);
/**
* Default data font name.
*/
-define ('PDF_FONT_NAME_DATA', 'DejaVuSans');
+define('PDF_FONT_NAME_DATA', 'DejaVuSans');
/**
* Default data font size.
*/
-define ('PDF_FONT_SIZE_DATA', 8);
+define('PDF_FONT_SIZE_DATA', 8);
/**
* Default monospaced font name.
*/
-define ('PDF_FONT_MONOSPACED', 'courier');
+define('PDF_FONT_MONOSPACED', 'courier');
/**
* Ratio used to adjust the conversion of pixels to user units.
*/
-define ('PDF_IMAGE_SCALE_RATIO', 1.25);
+define('PDF_IMAGE_SCALE_RATIO', 1.25);
/**
* Magnification factor for titles.
if ($c->get('login')->isAdmin() && $c->get('preferences')->pref_telemetry_date) {
$now = new \DateTime();
$sent = new \DateTime($c->get('preferences')->pref_telemetry_date);
- $sent->add(new \DateInterval('P1Y'));// ask to resend telemetry after one year
+ $sent->add(new \DateInterval('P1Y')); // ask to resend telemetry after one year
if ($now > $sent && !$_COOKIE['renew_telemetry']) {
$smarty->assign('renew_telemetry', true);
}
$acls = $acls + $c->get('plugins')->getAcls();
//load user defined ACLs
- if (file_exists(GALETTE_CONFIG_PATH . 'local_acls.inc.php')) {
+ if (file_exists(GALETTE_CONFIG_PATH . 'local_acls.inc.php')) {
//use array_merge here, we want $local_acls to override core ones.
$acls = array_merge($acls, $local_acls);
}
};
$container['cache'] = function ($c) {
- $adapter = null;
+ $adapter = null;
if (function_exists('wincache_ucache_add')) {
//since APCu is not known to work on windows
$adapter = 'wincache';
'nom_adh' => array(
'label' => _T("Name:"),
'propname' => 'name',
- 'required' => true ,
+ 'required' => true,
'visible' => FieldsConfig::USER_WRITE,
'position' => 3,
'category' => FieldsCategories::ADH_CATEGORY_IDENTITY
'societe_adh' => array(
'label' => _T("Company:"),
'propname' => 'company_name',
- 'required' => false ,
+ 'required' => false,
'visible' => FieldsConfig::USER_WRITE,
'position' => 5,
'category' => FieldsCategories::ADH_CATEGORY_IDENTITY
// check required PHP version...
if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
echo 'Galette is NOT compliant with your current PHP version. ' .
- 'Galette requires PHP ' . GALETTE_PHP_MIN .
+ 'Galette requires PHP ' . GALETTE_PHP_MIN .
' minimum and current version is ' . phpversion();
die(1);
}
setcookie(
'show_galette_dashboard',
true,
- time()+31536000 //valid for a year
+ time() + 31536000 //valid for a year
);
}
if (GALETTE_LOG_LVL >= Analog::INFO) {
$now = new \DateTime();
$dbg_log_path = GALETTE_LOGS_PATH . 'galette_debug_' .
- $now->format('Y-m-d') . '.log';
+ $now->format('Y-m-d') . '.log';
$galette_debug_log = LevelName::init(Handler\File::init($dbg_log_path));
} else {
$galette_debug_log = Handler\Ignore::init();
Analog::handler(
Handler\Multi::init(
- array (
+ array(
Analog::NOTICE => Handler\Threshold::init(
$galette_run_log,
GALETTE_LOG_LVL
use Galette\Repository\Members;
use Galette\Filters\MembersList;
-$app->group('/ajax', function () use ($authenticate) {
+$app->group('/ajax', function() use ($authenticate) {
$this->get(
'/messages',
- function ($request, $response) {
+ function($request, $response) {
$this->view->render(
$response,
'ajax_messages.tpl'
$this->post(
'photo',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
$ret = ['result' => false];
$this->post(
'/suggest/towns',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
$ret = [];
$this->post(
'/suggest/countries',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
$ret = [];
$this->get(
'/telemetry/infos',
- function ($request, $response) {
+ function($request, $response) {
$telemetry = new \Galette\Util\Telemetry(
$this->zdb,
$this->preferences,
$this->plugins
);
$body = $response->getBody();
- $body->write('<pre>' . json_encode($telemetry->getTelemetryInfos(), JSON_PRETTY_PRINT) . '</pre>');
+ $body->write('<pre>' . json_encode($telemetry->getTelemetryInfos(), JSON_PRETTY_PRINT) . '</pre>');
return $response;
}
)->setName('telemetryInfos')->add($authenticate);
$this->post(
'/telemetry/send',
- function ($request, $response) {
+ function($request, $response) {
$telemetry = new \Galette\Util\Telemetry(
$this->zdb,
$this->preferences,
$this->get(
'/telemetry/registered',
- function ($request, $response) {
+ function($request, $response) {
$this->preferences->pref_registration_date = date('Y-m-d H:i:s');
$this->preferences->store();
return $response->withJson(['message' => _T('Thank you for registering!')]);
$this->post(
'/contribution/dates',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
$contrib = new Contribution(
$this->post(
'/contribution/members[/{page:\d+}[/{search}]]',
- function ($request, $response, $args) {
+ function($request, $response, $args) {
$post = $request->getParsedBody();
$filters = new MembersList();
if (isset($post['page'])) {
$this->post(
'/password/strength',
- function ($request, $response) {
+ function($request, $response) {
//post params may be passed from security tab test password
$post = $request->getParsedBody();
)->setName('doEditTransaction')->add($authenticate);
$app->get(
- '/{type:contributions|transactions}/remove' .'/{id:\d+}',
+ '/{type:contributions|transactions}/remove' . '/{id:\d+}',
Crud\ContributionsController::class . ':confirmDelete'
)->setName('removeContribution')->add($authenticate);
//system information - keep old route with typo ('s' on 'information') for now (0.9.4)
$app->get(
'/system-informations',
- function ($request, $response, $args) {
+ function($request, $response, $args) {
return $response
->withStatus(302)
->withHeader('Location', $this->router->pathFor('sysinfos'));
$app->get(
'/texts[/{lang}/{ref}]',
- function ($request, $response, $args) {
+ function($request, $response, $args) {
if (!isset($args['lang'])) {
$args['lang'] = $this->preferences->pref_lang;
}
$app->post(
'/texts/change',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
return $response
->withStatus(301)
$app->post(
'/texts',
- function ($request, $response) {
+ function($request, $response) {
$post = $request->getParsedBody();
$texts = new Texts($this->preferences, $this->router);
$app->group(
'/plugins',
- function () use ($authenticate, $app) {
+ function() use ($authenticate, $app) {
$container = $this->getContainer();
$modules = $container->plugins->getModules();
//Global route to access plugin resources (CSS, JS, images, ...)
$this->get(
'/{plugin}/res/{path:.*}',
- function ($request, $response, $args) {
+ function($request, $response, $args) {
$plugin = $args['plugin'];
$path = $args['path'];
$ext = pathinfo($args['path'])['extension'];
//Declare configured routes for each plugin
foreach ($modules as $module_id => $module) {
- $container['Plugin ' . $module['name']] = function ($c) use ($module_id) {
+ $container['Plugin ' . $module['name']] = function($c) use ($module_id) {
return $module_id;
};
$this->group(
'/' . $module['route'],
- function () use ($module, $module_id, $authenticate) {
+ function() use ($module, $module_id, $authenticate) {
//Plugin home: give information
$this->get(
'',
- function ($request, $response) use ($module) {
+ function($request, $response) use ($module) {
$params = [
'page_title' => $module['name'],
'name' => $module['name'],
use Galette\Repository\Members;
use Galette\Filters\MembersList;
-$showPublicPages = function ($request, $response, $next) use ($container) {
+$showPublicPages = function($request, $response, $next) use ($container) {
$login = $container->login;
$preferences = $container->preferences;
return $next($request, $response);
};
-$app->group('/public', function () {
+$app->group('/public', function() {
//public members list
$this->get(
'/{type:list|trombi}[/{option:page|order}/{value:\d+}]',
$this->get(
'/members[/{option:page|order}/{value:\d+}]',
- function ($request, $response, $args = []) {
+ function($request, $response, $args = []) {
$args['type'] = 'list';
return $response
->withStatus(301)
$this->get(
'/trombinoscope',
- function ($request, $response, $args = []) {
+ function($request, $response, $args = []) {
$args['type'] = 'trombi';
return $response
->withStatus(301)
'files'
);
- if ( !file_exists(GALETTE_ROOT . 'data') ) {
+ if (!file_exists(GALETTE_ROOT . 'data')) {
$created = @mkdir(GALETTE_ROOT . 'data');
- if ( !$created ) {
+ if (!$created) {
$this->addError(
str_replace(
'%path',
}
}
- foreach ( $dirs as $dir ) {
+ foreach ($dirs as $dir) {
$path = GALETTE_ROOT . 'data/' . $dir;
- if ( !file_exists($path) ) {
+ if (!file_exists($path)) {
$created = @mkdir($path);
- if ( !$created ) {
+ if (!$created) {
$this->addError(
str_replace(
'%dir',
$go = false;
//move directory contents
switch ( $dirname ) {
- case 'logs':
- if ( GALETTE_LOGS_PATH === $destdir && file_exists($origdir) ) {
- $go = true;
- }
- break;
- case 'exports':
- if ( GALETTE_EXPORTS_PATH === $destdir && file_exists($origdir) ) {
- $go = true;
- }
- break;
- case 'imports':
- if ( GALETTE_IMPORTS_PATH === $destdir && file_exists($origdir) ) {
- $go = true;
- }
- break;
- case 'photos':
- if ( GALETTE_PHOTOS_PATH === $destdir && file_exists($origdir) ) {
- $go = true;
- }
- break;
- case 'attachments':
- if ( GALETTE_ATTACHMENTS_PATH === $destdir
- && file_exists($origdir)
- ) {
- $go = true;
- }
- break;
- case 'files':
- if ( GALETTE_FILES_PATH === $destdir && file_exists($origdir) ) {
- $go = true;
- }
- break;
+ case 'logs':
+ if ( GALETTE_LOGS_PATH === $destdir && file_exists($origdir) ) {
+ $go = true;
+ }
+ break;
+ case 'exports':
+ if ( GALETTE_EXPORTS_PATH === $destdir && file_exists($origdir) ) {
+ $go = true;
+ }
+ break;
+ case 'imports':
+ if ( GALETTE_IMPORTS_PATH === $destdir && file_exists($origdir) ) {
+ $go = true;
+ }
+ break;
+ case 'photos':
+ if ( GALETTE_PHOTOS_PATH === $destdir && file_exists($origdir) ) {
+ $go = true;
+ }
+ break;
+ case 'attachments':
+ if ( GALETTE_ATTACHMENTS_PATH === $destdir
+ && file_exists($origdir)
+ ) {
+ $go = true;
+ }
+ break;
+ case 'files':
+ if ( GALETTE_FILES_PATH === $destdir && file_exists($origdir) ) {
+ $go = true;
+ }
+ break;
}
if ( $go ) {
}
$d->close();
- if ( $moved ) {
+ if ($moved) {
$this->addReportEntry(
str_replace(
'%dir',
<legend class="ui-state-active ui-corner-top"><?php echo _T("Please chose the parameters of the admin account on Galette"); ?></legend>
<p>
<label for="install_adminlogin" class="bline"><?php echo _T("Username:"); ?></label>
- <input type="text" name="install_adminlogin" id="install_adminlogin" value="<?php if(isset($_POST['install_adminlogin'])) echo $_POST['install_adminlogin']; ?>" required autofocus/>
+ <input type="text" name="install_adminlogin" id="install_adminlogin" value="<?php if (isset($_POST['install_adminlogin'])) echo $_POST['install_adminlogin']; ?>" required autofocus/>
</p>
<p>
<label for="install_adminpass" class="bline"><?php echo _T("Password:"); ?></label>
$files_perms_class = '';
// check required PHP version...
-if ( version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<') ) {
+if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
$php_ok = false;
}
// check date settings
$date_ok = false;
-if ( !version_compare(PHP_VERSION, '5.2.0', '<') ) {
+if (!version_compare(PHP_VERSION, '5.2.0', '<')) {
try {
$test_date = new DateTime();
$date_ok = true;
- } catch ( Exception $e ) {
+ } catch (Exception $e) {
//do nothing
}
}
// check file permissions
$perms_ok = true;
-$files_need_rw = array (
+$files_need_rw = array(
_T("Compilation") => GALETTE_COMPILE_DIR,
_T("Photos") => GALETTE_PHOTOS_PATH,
_T("Cache") => GALETTE_CACHE_DIR,
foreach ($files_need_rw as $label=>$file) {
$writable = is_writable($file);
- if ( !$writable ) {
+ if (!$writable) {
$perms_ok = false;
}
}
-if ( $perms_ok && $modules_ok && $php_ok && $date_ok ) {
+if ($perms_ok && $modules_ok && $php_ok && $date_ok) {
echo '<p id="infobox">' . _T("Galette requirements are met :)") . '</p>';
}
-if ( !$date_ok ) {
+if (!$date_ok) {
echo '<p class="error">' . _T("Your PHP date settings are not correct. Maybe you've missed the timezone settings that is mandatory since PHP 5.3?") . '</p>';
}
?>
<h3><?php echo _T("PHP Modules"); ?></h3>
<?php
-if ( !$modules_ok ) {
- echo '<p class="error">' . _T("Some PHP modules are missing. Please install them or contact your support.<br/>More information on required modules may be found in the documentation.") . '</p>';
+if (!$modules_ok) {
+ echo '<p class="error">' . _T("Some PHP modules are missing. Please install them or contact your support.<br/>More information on required modules may be found in the documentation.") . '</p>';
}
?>
<ul class="leaders">
?>
</ul>
<?php
-if ( !$perms_ok ) {
+if (!$perms_ok) {
?>
<article id="files_perms" class="<?php echo $files_perms_class; ?>">
<div>
<h4 class="error"><?php echo _T("Files permissions are not OK!"); ?></h4>
<p><?php
- if ( $install->isInstall() ) {
+ if ($install->isInstall()) {
echo _T("To work as excpected, Galette needs write permission on files listed above.");
- } else if ( $install->isUpgrade() ) {
+ } else if ($install->isUpgrade()) {
echo _T("In order to be updated, Galette needs write permission on files listed above.");
}
?></p>
<?php
}
-if ( !$perms_ok || !$modules_ok || !$php_ok || !$date_ok ) {
+if (!$perms_ok || !$modules_ok || !$php_ok || !$date_ok) {
?>
<form action="installer.php" method="post">
<p id="btn_box">
<p>
<label class="bline" for="install_dbtype"><?php echo _T("Database type:"); ?></label>
<select name="install_dbtype" id="install_dbtype">
- <option value="mysql"<?php if ( $install->getDbType() === GaletteDb::MYSQL ) {echo ' selected="selected"';} ?>>Mysql</option>
- <option value="pgsql"<?php if ( $install->getDbType() === GaletteDb::PGSQL ) {echo ' selected="selected"';} ?>>Postgresql</option>
+ <option value="mysql"<?php if ($install->getDbType() === GaletteDb::MYSQL) {echo ' selected="selected"'; } ?>>Mysql</option>
+ <option value="pgsql"<?php if ($install->getDbType() === GaletteDb::PGSQL) {echo ' selected="selected"'; } ?>>Postgresql</option>
</select>
</p>
<div id="install_dbconfig">
<p>
<label class="bline" for="install_dbhost"><?php echo _T("Host:"); ?></label>
- <input type="text" name="install_dbhost" id="install_dbhost" value="<?php echo ($install->getDbHost() !== null)?$install->getDbHost():'localhost'; ?>" required/>
+ <input type="text" name="install_dbhost" id="install_dbhost" value="<?php echo ($install->getDbHost() !== null) ? $install->getDbHost() : 'localhost'; ?>" required/>
</p>
<p>
<label class="bline" for="install_dbport"><?php echo _T("Port:"); ?></label>
- <input type="text" name="install_dbport" id="install_dbport" value="<?php echo ($install->getDbPort() !== null)?$install->getDbPort():$default_dbport; ?>" required/>
+ <input type="text" name="install_dbport" id="install_dbport" value="<?php echo ($install->getDbPort() !== null) ? $install->getDbPort() : $default_dbport; ?>" required/>
</p>
<p>
<label class="bline" for="install_dbuser"><?php echo _T("User:"); ?></label>
</p>
<p>
<label class="bline" for="install_dbprefix"><?php echo _T("Table prefix:"); ?></label>
- <input type="text" name="install_dbprefix" id="install_dbprefix" value="<?php echo ($install->getTablesPrefix() !== null)?$install->getTablesPrefix():'galette_'; ?>" required/>
+ <input type="text" name="install_dbprefix" id="install_dbprefix" value="<?php echo ($install->getTablesPrefix() !== null) ? $install->getTablesPrefix() : 'galette_'; ?>" required/>
</p>
<?php
if ($install->isUpgrade()) {
?>
<h2><?php echo $install->getStepTitle(); ?></h2>
<?php
-if ( $db_installed === false ) {
+if ($db_installed === false) {
$msg = _T("Database has not been installed!");
- if ( $install->isUpgrade() ) {
+ if ($install->isUpgrade()) {
$msg = _T("Database has not been upgraded!");
}
echo '<p id="errorbox">' . $msg . '</p>';
} else {
$msg = _T("Database has been installed :)");
- if ( $install->isUpgrade() ) {
+ if ($install->isUpgrade()) {
$msg = _T("Database has been upgraded :)");
}
echo '<p id="infobox">' . $msg . '</p>';
?>
<ul class="leaders">
<?php
-foreach ( $install->getDbInstallReport() as $r ) {
+foreach ($install->getDbInstallReport() as $r) {
?>
<li>
<span><?php echo $r['message']; ?></span>
<form action="installer.php" method="POST">
<p id="btn_box">
<?php
-if ( !$db_installed ) {
+if (!$db_installed) {
?>
<input type="submit" id="retry_btn" value="<?php echo _T("Retry"); ?>"/>
<?php
}
?>
- <input id="next_btn" type="submit" value="<?php echo _T("Next step"); ?>"<?php if ( !$db_installed ) { echo ' disabled="disabled"'; } ?>/>
+ <input id="next_btn" type="submit" value="<?php echo _T("Next step"); ?>"<?php if (!$db_installed) { echo ' disabled="disabled"'; } ?>/>
<?php
-if ( $db_installed ) {
+if ($db_installed) {
?>
<input type="hidden" name="install_dbwrite_ok" value="1"/>
<?php
}
-if ( !$db_installed ) {
+if (!$db_installed) {
//once DB is installed, that does not make sense to go back
?>
<input type="submit" id="btnback" name="stepback_btn" value="<?php echo _T("Back"); ?>"/>
?>
<h2><?php echo $install->getStepTitle(); ?></h2>
<p><?php
-if ( $install->isInstall() ) {
+if ($install->isInstall()) {
echo _T("Galette has been successfully installed!");
}
-if ( $install->isUpgrade() ) {
+if ($install->isUpgrade()) {
echo _T("Galette has been successfully updated!");
}
?></p>
<h2><?php echo $install->getStepTitle(); ?></h2>
<?php
-if ( $config_file_ok === true && $objects_ok === true ) {
+if ($config_file_ok === true && $objects_ok === true) {
echo '<p id="infobox">' . _T("Configuration file created!") .
'<br/>' . _T("Data initialized.") . '</p>';
} else {
?>
<ul class="leaders">
<?php
-foreach ( $install->getInitializationReport() as $r ) {
+foreach ($install->getInitializationReport() as $r) {
?>
<li>
<span><?php echo $r['message']; ?></span>
<form action="installer.php" method="POST">
<p id="btn_box">
<?php
-if ( !$config_file_ok || !$objects_ok ) {
+if (!$config_file_ok || !$objects_ok) {
?>
<input type="submit" id="retry_btn" value="<?php echo _T("Retry"); ?>"/>
<?php
}
?>
- <input id="next_btn" type="submit" value="<?php echo _T("Next step"); ?>"<?php if ( !$config_file_ok || !$objects_ok ) { echo ' disabled="disabled"'; } ?>/>
+ <input id="next_btn" type="submit" value="<?php echo _T("Next step"); ?>"<?php if (!$config_file_ok || !$objects_ok) { echo ' disabled="disabled"'; } ?>/>
<?php
-if ( $config_file_ok && $objects_ok ) {
+if ($config_file_ok && $objects_ok) {
?>
<input type="hidden" name="install_prefs_ok" value="1"/>
<?php
}
-if ( !$config_file_ok || !$objects_ok ) {
+if (!$config_file_ok || !$objects_ok) {
//once DB is installed, that does not make sense to go back
?>
<input type="submit" id="btnback" name="stepback_btn" value="<?php echo _T("Back"); ?>"/>
<div id="installation_mode">
<article id="mode_new" class="installation_mode">
<h3>
- <input type="radio" name="install_type" value="<?php echo GaletteInstall::INSTALL; ?>"<?php if ( $install->isInstall() || !$install->isUpgrade() ) { echo ' checked="checked"'; } ?> id="install"/>
+ <input type="radio" name="install_type" value="<?php echo GaletteInstall::INSTALL; ?>"<?php if ($install->isInstall() || !$install->isUpgrade()) { echo ' checked="checked"'; } ?> id="install"/>
<label for="install"><?php echo _T("New installation"); ?></label>
</h3>
<ul>
</article>
<article id="mode_update" class="installation_mode">
<h3>
- <input type="radio" name="install_type" value="<?php echo GaletteInstall::UPDATE; ?>"<?php if ( $install->isUpgrade() ) { echo ' checked="checked"'; } ?> id="update"/>
+ <input type="radio" name="install_type" value="<?php echo GaletteInstall::UPDATE; ?>"<?php if ($install->isUpgrade()) { echo ' checked="checked"'; } ?> id="update"/>
<label for="update"><?php echo _T("Update"); ?></label>
</h3>
<ul>
public function __construct($ns = null, $includePath = null)
{
if (!file_exists($includePath)) {
- throw new \RuntimeException('Include path "'.$includePath.'" doesn\'t exists');
+ throw new \RuntimeException('Include path "' . $includePath . '" doesn\'t exists');
}
$this->namespace = $ns;
*/
public function loadClass($className)
{
- if ($this->namespace !== null && strpos($className, $this->namespace.$this->namespaceSeparator) !== 0) {
+ if ($this->namespace !== null && strpos($className, $this->namespace . $this->namespaceSeparator) !== 0) {
return false;
}
*/
public function canLoadClass($className)
{
- if ($this->namespace !== null && strpos($className, $this->namespace.$this->namespaceSeparator) !== 0) {
+ if ($this->namespace !== null && strpos($className, $this->namespace . $this->namespaceSeparator) !== 0) {
return false;
}
$data = xhprof_disable();
$incl = (defined('XHPROF_PATH') ? XHPROF_PATH : self::XHPROF_PATH);
- include_once $incl.'/utils/xhprof_lib.php';
- include_once $incl.'/utils/xhprof_runs.php';
+ include_once $incl . '/utils/xhprof_lib.php';
+ include_once $incl . '/utils/xhprof_runs.php';
$runs = new \XHProfRuns_Default();
$id = $runs->save_run($data, 'galette-' . GALETTE_VERSION);
$url = (defined('XHPROF_URL') ? XHPROF_URL : self::XHPROF_URL);
$host = (defined('XHPROF_HOST') ? XHPROF_HOST : $_SERVER['HTTP_HOST']);
- $link = 'http://' . $host .$url . '/index.php?run=' .
+ $link = 'http://' . $host . $url . '/index.php?run=' .
$id . '&source=galette-' . GALETTE_VERSION;
Analog::log(
'Stop profiling with XHProf, result URL: ' . $link,
$tpl_vars = [
'page_title' => $raw_type === 'contributions' ?
- _T("Contributions management") :
- _T("Transactions management"),
+ _T("Contributions management") : _T("Transactions management"),
'contribs' => $contrib,
'list' => $contribs_list,
'nb' => $contrib->getCount(),
//member card link is present in mail model, let's add it
$links = new Links($this->zdb);
if ($hash = $links->generateNewLink(Links::TARGET_MEMBERCARD, $contrib->member)) {
- $link_card = $this->preferences->getURL() .
+ $link_card = $this->preferences->getURL() .
$this->router->pathFor('directlink', ['hash' => $hash]);
}
}
$links = new Links($this->zdb);
$ltype = $contrib->type->isExtension() ? Links::TARGET_INVOICE : Links::TARGET_RECEIPT;
if ($hash = $links->generateNewLink($ltype, $contrib->id)) {
- $link_pdf = $this->preferences->getURL() .
+ $link_pdf = $this->preferences->getURL() .
$this->router->pathFor('directlink', ['hash' => $hash]);
}
}
if ($ret !== true) {
$msg_type = 'error_detected';
$msg = $args['action'] === 'add' ?
- _T("%type has not been added :(") :
- _T("%type #%id has not been updated");
+ _T("%type has not been added :(") : _T("%type #%id has not been updated");
} else {
$msg_type = 'success_detected';
$msg = $args['action'] === 'add' ?
- _T("%type has been successfully added!") :
- _T("%type #%id has been successfully updated!");
+ _T("%type has been successfully added!") : _T("%type #%id has been successfully updated!");
}
$this->flash->addMessage(
if (isset($this->session->filter_mailing)) {
$filters = $this->session->filter_mailing;
} elseif (isset($this->session->filter_members)) {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
} else {
$filters = new MembersList();
}
}
$redirect_url = ($this->session->redirect_mailing !== null) ?
- $this->session->redirect_mailing :
- $this->router->pathFor('members');
+ $this->session->redirect_mailing : $this->router->pathFor('members');
return $response
->withStatus(301)
$goto = $this->router->pathFor('mailings');
$redirect_url = ($this->session->redirect_mailing !== null) ?
- $this->session->redirect_mailing :
- $this->router->pathFor('members');
+ $this->session->redirect_mailing : $this->router->pathFor('members');
//We're done :-)
if (isset($post['mailing_done'])
$goto = $this->router->pathFor('slash');
} else {
if (isset($this->session->filter_members)) {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
} else {
$filters = new MembersList();
}
MailingHistory::loadFrom($this->zdb, (int)$args['id'], $mailing, false);
$attachments = $mailing->attachments;
$attachment = $attachments[$args['pos']];
- $filepath = $attachment->getDestDir() . $attachment->getFileName();
+ $filepath = $attachment->getDestDir() . $attachment->getFileName();
$ext = pathinfo($attachment->getFileName())['extension'];
$response = $response->withHeader('Content-type', $attachment->getMimeType($filepath));
} else {
Analog::log(
'A request has been made to get an exported file named `' .
- $filename .'` that does not exists.',
+ $filename . '` that does not exists.',
Analog::WARNING
);
if ($pos = array_search(Status::PK, array_keys($fields))) {
$fields = array_slice($fields, 0, $pos, true) +
['status_label' => ['label' => _T('Status label')]] +
- array_slice($fields, $pos, count($fields) -1, true);
+ array_slice($fields, $pos, count($fields) - 1, true);
}
//dynamic fields
*/
public function massChange(Request $request, Response $response, array $args = []) :Response
{
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
$data = [
'id' => $filters->selected,
}
}
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
$data = [
'id' => $filters->selected,
'redirect_uri' => $this->router->pathFor('members')
'%s',
$member->sname . ' (' . $member->getEmail() . ')',
($new) ?
- _T("New account email sent to '%s'.") :
- _T("Account modification email sent to '%s'.")
+ _T("New account email sent to '%s'.") : _T("Account modification email sent to '%s'.")
);
$this->history->add($msg);
$success_detected[] = $msg;
if (isset($post['del_photo'])) {
if (!$member->picture->delete($member->id)) {
$error_detected[] = _T("Delete failed");
- $str_adh = $member->id . ' (' . $member->sname . ' ' . ')';
+ $str_adh = $member->id . ' (' . $member->sname . ' ' . ')';
Analog::log(
'Unable to delete picture for member ' . $str_adh,
Analog::ERROR
if (isset($args['id'])) {
return $args['id'];
} else {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
return $filters->selected;
}
}
);
} else {
//batch members removal
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
return str_replace(
'%count',
count($filters->selected),
protected function doDelete(array $args, array $post)
{
if (isset($this->session->filter_members)) {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
} else {
$filters = new MembersList();
}
return _T('Remove saved search');
} else {
//batch saved search removal
- $filters = $this->session->filter_savedsearch;
+ $filters = $this->session->filter_savedsearch;
return str_replace(
'%count',
count($filters->selected),
protected function doDelete(array $args, array $post)
{
if (isset($this->session->filter_savedsearch)) {
- $filters = $this->session->filter_savedsearch;
+ $filters = $this->session->filter_savedsearch;
} else {
$filters = new SavedSearchesList();
}
} else {
Analog::log(
'A request has been made to get a CSV file named `' .
- $filename .'` that does not exists (' . $filepath . ').',
+ $filename . '` that does not exists (' . $filepath . ').',
Analog::WARNING
);
$notFound = $this->notFoundHandler;
$csv = new CsvIn($this->zdb);
if (isset($_FILES['new_file'])) {
if ($_FILES['new_file']['error'] === UPLOAD_ERR_OK) {
- if ($_FILES['new_file']['tmp_name'] !='') {
+ if ($_FILES['new_file']['tmp_name'] != '') {
if (is_uploaded_file($_FILES['new_file']['tmp_name'])) {
$res = $csv->store($_FILES['new_file']);
if ($res < 0) {
//admins or staff members
if ($this->login->isAdmin() || $this->login->isStaff()) {
$filepath = $args['type'] === 'export' ?
- CsvOut::DEFAULT_DIRECTORY :
- CsvIn::DEFAULT_DIRECTORY;
+ CsvOut::DEFAULT_DIRECTORY : CsvIn::DEFAULT_DIRECTORY;
$filepath .= $filename;
return $this->sendResponse($response, $filepath, $filename);
} else {
$success = false;
$uri = isset($post['redirect_uri']) ?
- $post['redirect_uri'] :
- $this->router->pathFor('slash');
+ $post['redirect_uri'] : $this->router->pathFor('slash');
if (!isset($post['confirm'])) {
$this->flash->addMessage(
);
} else {
$csv = $args['type'] === 'export' ?
- new CsvOut() :
- new CsvIn($this->zdb);
+ new CsvOut() : new CsvIn($this->zdb);
$res = $csv->remove($args['file']);
if ($res === true) {
$success = true;
$success = false;
$uri = isset($post['redirect_uri']) ?
- $post['redirect_uri'] :
- $this->router->pathFor('slash');
+ $post['redirect_uri'] : $this->router->pathFor('slash');
if (!isset($post['confirm'])) {
$this->flash->addMessage(
public function membersCards(Request $request, Response $response, array $args = []) :Response
{
if ($this->session->filter_members) {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
} else {
$filters = new MembersList();
}
$ajax = true;
//retrieve selected members
- $selection = (isset($post['selection']) ) ? $post['selection'] : array();
+ $selection = (isset($post['selection'])) ? $post['selection'] : array();
$filters->selected = $selection;
$this->session->filter_members = $filters;
}
//retrieve selected members
- $selection = (isset($post['selection']) ) ? $post['selection'] : array();
+ $selection = (isset($post['selection'])) ? $post['selection'] : array();
$filters->selected = $selection;
$this->session->filter_members = $filters;
&& (strcasecmp(trim($w1), 'rename') != 0)
) {
$error_detected[] = $w1 . ' ' . $w2 . ' ' . $w3 . ' ' . $extra;
- $error_detected[] = $e->getMessage() . '<br/>(' . $query . ')';
+ $error_detected[] = $e->getMessage() . '<br/>(' . $query . ')';
} else {
//if error are on drop, DROP, rename or RENAME we can continue
$warning_detected[] = $w1 . ' ' . $w2 . ' ' . $w3 . ' ' . $extra;
- $warning_detected[] = $e->getMessage() . '<br/>(' . $query . ')';
+ $warning_detected[] = $e->getMessage() . '<br/>(' . $query . ')';
}
}
}
}
$pass = '';
$i = 0;
- while ($i <= $size-1) {
- $num = mt_rand(0, 32) % 33;
+ while ($i <= $size - 1) {
+ $num = mt_rand(0, 32)%33;
$pass .= substr($this->chars, $num, 1);
$i++;
}
private $cron = false;
/**
- * Logs in user.
- *
- * @param string $user user's login
- * @param string $passe user's password
- *
- * @return boolean
- */
+ * Logs in user.
+ *
+ * @param string $user user's login
+ * @param string $passe user's password
+ *
+ * @return boolean
+ */
abstract public function logIn($user, $passe);
/**
- * Does this login already exists ?
- * These function should be used for setting admin login into Preferences
- *
- * @param string $user the username
- *
- * @return true if the username already exists, false otherwise
- */
+ * Does this login already exists ?
+ * These function should be used for setting admin login into Preferences
+ *
+ * @param string $user the username
+ *
+ * @return true if the username already exists, false otherwise
+ */
abstract public function loginExists($user);
/**
- * Login for the superuser
- *
- * @param string $login name
- * @param Preferences $preferences Preferences instance
- *
- * @return void
- */
+ * Login for the superuser
+ *
+ * @param string $login name
+ * @param Preferences $preferences Preferences instance
+ *
+ * @return void
+ */
public function logAdmin($login, Preferences $preferences)
{
$this->logged = true;
}
/**
- * Log out user and unset variables
- *
- * @return void
- */
+ * Log out user and unset variables
+ *
+ * @return void
+ */
public function logOut()
{
$this->id = null;
}
/**
- * Is user logged-in?
- *
- * @return bool
- */
+ * Is user logged-in?
+ *
+ * @return bool
+ */
public function isLogged()
{
return $this->logged;
}
/**
- * Is user admin?
- *
- * @return bool
- */
+ * Is user admin?
+ *
+ * @return bool
+ */
public function isAdmin()
{
return $this->admin;
}
/**
- * Is user super admin?
- *
- * @return bool
- */
+ * Is user super admin?
+ *
+ * @return bool
+ */
public function isSuperAdmin()
{
return $this->superadmin;
}
/**
- * Is user active?
- *
- * @return bool
- */
+ * Is user active?
+ *
+ * @return bool
+ */
public function isActive()
{
return $this->active;
}
/**
- * Global getter method
- *
- * @param string $name name of the property we want to retrieve
- *
- * @return false|object the called property
- */
+ * Global getter method
+ *
+ * @param string $name name of the property we want to retrieve
+ *
+ * @return false|object the called property
+ */
public function __get($name)
{
$forbidden = array('logged', 'admin', 'active');
}
/**
- * Global setter method
- *
- * @param string $name name of the property we want to assign a value to
- * @param object $value a relevant value for the property
- *
- * @return void
- */
+ * Global setter method
+ *
+ * @param string $name name of the property we want to assign a value to
+ * @param object $value a relevant value for the property
+ *
+ * @return void
+ */
public function __set($name, $value)
{
$this->$name = $value;
if (count($this->missing) > 0) {
$ko = ($translated ? _T('Ko') : 'Ko');
foreach ($this->missing as $m) {
- $html .= '<li><span>' . $m . '</span><span><img src="' .
- $img_dir . 'icon-invalid.png" alt="' .
+ $html .= '<li><span>' . $m . '</span><span><img src="' .
+ $img_dir . 'icon-invalid.png" alt="' .
$ko . '"/></span></li>';
}
}
if (count($this->good) > 0) {
$ok = ($translated ? _T('Ok') : 'Ok');
foreach ($this->good as $m) {
- $html .= '<li><span>' . $m . '</span><span><img src="' .
- $img_dir . 'icon-valid.png" alt="' .
+ $html .= '<li><span>' . $m . '</span><span><img src="' .
+ $img_dir . 'icon-valid.png" alt="' .
$ok . '"/></span></li>';
}
}
if (count($this->should) > 0) {
foreach ($this->should as $m) {
- $html .= '<li><span>' . $m . '</span><span><img src="' .
- $img_dir . 'icon-warning.png" alt=""' .
+ $html .= '<li><span>' . $m . '</span><span><img src="' .
+ $img_dir . 'icon-warning.png" alt=""' .
'/></span></li>';
}
}
}
} catch (\Exception $e) {
Analog::log(
- 'Cannot INSERT records | ' .$e->getMessage(),
+ 'Cannot INSERT records | ' . $e->getMessage(),
Analog::WARNING
);
//if we cannot insert records, some others tests cannot be done
}
} catch (\Exception $e) {
Analog::log(
- 'Cannot UPDATE records | ' .$e->getMessage(),
+ 'Cannot UPDATE records | ' . $e->getMessage(),
Analog::WARNING
);
$results['update'] = $e;
$results['delete'] = true;
} catch (\Exception $e) {
Analog::log(
- 'Cannot DELETE records | ' .$e->getMessage(),
+ 'Cannot DELETE records | ' . $e->getMessage(),
Analog::WARNING
);
$results['delete'] = $e;
);
Analog::log(
- 'Charset successfully changed for table `' . $table .'`',
+ 'Charset successfully changed for table `' . $table . '`',
Analog::DEBUG
);
}
//build where
foreach ($pkeys as $k) {
- $where[] = $k . ' = "' . $row->$k .'"';
+ $where[] = $k . ' = "' . $row->$k . '"';
}
//build data
$sql = 'SELECT pg_database_size(\'' . NAME_DB . '\')';
$result = $this->db->query($sql, Adapter::QUERY_MODE_EXECUTE)
->current();
- $infos['size'] = (string)round($result['pg_database_size'] / 1024 / 1024);
+ $infos['size'] = (string)round($result['pg_database_size']/1024/1024);
} else {
$sql = 'SELECT @@sql_mode as mode, @@version AS version, @@version_comment AS version_comment';
$result = $this->db->query($sql, Adapter::QUERY_MODE_EXECUTE)
$infos['sql_mode'] = $result['mode'];
$size_sql = 'SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) AS dbsize' .
- ' FROM information_schema.tables WHERE table_schema="' . NAME_DB .'"';
+ ' FROM information_schema.tables WHERE table_schema="' . NAME_DB . '"';
$result = $this->db->query($size_sql, Adapter::QUERY_MODE_EXECUTE)
->current();
- $infos['size'] = $result['dbsize'];
+ $infos['size'] = $result['dbsize'];
}
return $infos;
$version .= '-git';
}
- if (is_dir(GALETTE_ROOT.'../.git')) {
+ if (is_dir(GALETTE_ROOT . '../.git')) {
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));
$commitDate = new \DateTime(trim(exec('git log -n1 --pretty=%ci HEAD')));
$this->mail->AltBody .= $tsign;
//then apply email sign to html version
$sign_style = 'color:grey;border-top:1px solid #ccc;margin-top:2em';
- $hsign = '<div style="' . $sign_style. '">' .
+ $hsign = '<div style="' . $sign_style . '">' .
nl2br($sign) . '</div>';
$this->mail->Body .= $hsign;
} else {
}
} else {
Analog::log(
- '[History] Unable to get proprety `' .$name . '`',
+ '[History] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
} else {
Analog::log(
- '[History] Unable to set proprety `' .$name . '`',
+ '[History] Unable to set proprety `' . $name . '`',
Analog::WARNING
);
}
$img_name = ($arg === true) ? 'valid' : 'invalid';
$src = GALETTE_THEME_DIR . 'images/icon-' . $img_name . '.png';
$alt = ($arg === true) ? _T("Ok") : _T("Ko");
- $img = '<img src="' . $src . '" alt="' . $alt . '"/>';
+ $img = '<img src="' . $src . '" alt="' . $alt . '"/>';
return $img;
}
public function atPreviousStep()
{
if ($this->_step > 0) {
- if ($this->_step -1 !== self::STEP_DB_INSTALL
+ if ($this->_step - 1 !== self::STEP_DB_INSTALL
&& $this->_step !== self::STEP_END
) {
if ($this->_step === self::STEP_DB_INSTALL) {
if ($this->_step === self::STEP_DB_UPGRADE) {
$this->setInstalledVersion(null);
}
- $this->_step = $this->_step -1;
+ $this->_step = $this->_step - 1;
}
} else {
$msg = null;
&& isset($existing['db_user'])
&& $existing['db_user'] == $this->_db_user
&& isset($existing['pwd_db'])
- && $existing['pwd_db'] == $this->_db_pass
+ && $existing['pwd_db'] == $this->_db_pass
&& isset($existing['db_name'])
&& $existing['db_name'] == $this->_db_name
&& isset($existing['prefix'])
- && $existing['prefix'] == $this->_db_prefix
+ && $existing['prefix'] == $this->_db_prefix
) {
Analog::log(
'Config file is already up-to-date, nothing to do.',
$del = $this->zdb->execute($delete);
if ($del) {
Analog::log(
- 'Temporary link for `' . $target .'-' . $id . '` has been removed.',
+ 'Temporary link for `' . $target . '-' . $id . '` has been removed.',
Analog::DEBUG
);
}
}
/**
- * Login for the superuser
- *
- * @param string $login name
- * @param Preferences $preferences Preferences instance
- *
- * @return void
- */
+ * Login for the superuser
+ *
+ * @param string $login name
+ * @param Preferences $preferences Preferences instance
+ *
+ * @return void
+ */
public function logAdmin($login, Preferences $preferences)
{
parent::logAdmin($login, $preferences);
}
/**
- * Log out user and unset variables
- *
- * @return void
- */
+ * Log out user and unset variables
+ *
+ * @return void
+ */
public function logOut()
{
parent::logOut();
) {
foreach ($this->attachments as &$attachment) {
$old_path = $attachment->getDestDir() . $attachment->getFileName();
- $new_path = GALETTE_ATTACHMENTS_PATH . $this->id .'/' .
+ $new_path = GALETTE_ATTACHMENTS_PATH . $this->id . '/' .
$attachment->getFileName();
if (!file_exists(GALETTE_ATTACHMENTS_PATH . $this->id)) {
mkdir(GALETTE_ATTACHMENTS_PATH . $this->id);
break;
case 'current_step':
if (is_int($value)
- && ( $value == self::STEP_START
+ && ($value == self::STEP_START
|| $value == self::STEP_PREVIEW
|| $value == self::STEP_SEND
- || $value == self::STEP_SENT )
+ || $value == self::STEP_SENT)
) {
$this->current_step = (int)$value;
} else {
private $senders;
- /**
+ /**
* Default constructor
*
* @param Db $zdb Database
}
$sender = ($this->sender === 0) ?
- new Expression('NULL') :
- $this->sender;
+ new Expression('NULL') : $this->sender;
$sender_name = ($this->sender_name === null) ?
- new Expression('NULL') :
- $this->sender_name;
+ new Expression('NULL') : $this->sender_name;
$sender_address = ($this->sender_address === null) ?
- new Expression('NULL') :
- $this->sender_address;
+ new Expression('NULL') : $this->sender_address;
$values = array(
'mailing_sender' => $sender,
$sender = $this->sender;
}
$sender_name = ($this->sender_name === null) ?
- new Expression('NULL') :
- $this->sender_name;
+ new Expression('NULL') : $this->sender_name;
$sender_address = ($this->sender_address === null) ?
- new Expression('NULL') :
- $this->sender_address;
+ new Expression('NULL') : $this->sender_address;
$values = array(
'mailing_sender' => $sender,
*/
public function invertorder()
{
- $actual=$this->ordered;
+ $actual = $this->ordered;
if ($actual == self::ORDER_ASC) {
$this->ordered = self::ORDER_DESC;
}
if ($this->show !== 0) {
$select->limit($this->show);
$select->offset(
- ($this->current_page - 1) * $this->show
+ ($this->current_page - 1)*$this->show
);
}
}
protected function countPages()
{
if ($this->show !== 0) {
- if ($this->counter % $this->show == 0) {
- $this->pages = intval($this->counter / $this->show);
+ if ($this->counter%$this->show == 0) {
+ $this->pages = intval($this->counter/$this->show);
} else {
- $this->pages = intval($this->counter / $this->show) + 1;
+ $this->pages = intval($this->counter/$this->show) + 1;
}
} else {
$this->pages = 0;
//Create pagination links
if ($this->current_page < 11) {
- $idepart=1;
+ $idepart = 1;
} else {
$idepart = $this->current_page - 10;
}
} else {
Analog::log(
'[' . get_class($this) .
- '|Pagination] Unable to get proprety `' .$name . '`',
+ '|Pagination] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
protected function cleanExpired()
{
$dh = @opendir(GALETTE_TEMPIMAGES_PATH);
- while ($file=readdir($dh)) {
+ while ($file = readdir($dh)) {
if (substr($file, 0, 3) == 'pw_'
&& time() - filemtime(GALETTE_TEMPIMAGES_PATH . '/' . $file) > 60
) {
$this->generateNewPassword();
$pass = $this->getNewPassword();
- $png = imagecreate(10 + 7.5 * strlen($pass), 18);
+ $png = imagecreate(10 + 7.5*strlen($pass), 18);
$bg = imagecolorallocate($png, 160, 160, 160);
imagestring($png, 3, 5, 2, $pass, imagecolorallocate($png, 0, 0, 0));
$file = GALETTE_TEMPIMAGES_PATH . '/' . $this->getImageName();
if ($this->height > $this->width) {
if ($this->height > $this->max_height) {
- $ratio = $this->max_height / $this->height;
+ $ratio = $this->max_height/$this->height;
$this->optimal_height = $this->max_height;
- $this->optimal_width = $this->width * $ratio;
+ $this->optimal_width = $this->width*$ratio;
}
} else {
if ($this->width > $this->max_width) {
- $ratio = $this->max_width / $this->width;
+ $ratio = $this->max_width/$this->width;
$this->optimal_width = $this->max_width;
- $this->optimal_height = $this->height * $ratio;
+ $this->optimal_height = $this->height*$ratio;
}
}
}
*/
public function display()
{
- header('Content-type: '.$this->mime);
+ header('Content-type: ' . $this->mime);
ob_clean();
flush();
$this->getContents();
$err_msg .= 'Invalid extension for file ' . $name . '.';
$ret = self::INVALID_EXTENSION;
} else {
- $err_msg = 'Invalid filename `' . $name . '` (Tip: ';
+ $err_msg = 'Invalid filename `' . $name . '` (Tip: ';
$err_msg .= preg_replace(
'|%s|',
htmlentities($this->getBadChars()),
}
//Second, let's check file size
- if ($file['size'] > ( $this->maxlenght * 1024 )) {
+ if ($file['size'] > ($this->maxlenght*1024)) {
Analog::log(
- '[' . $class . '] File is too big (' . ( $file['size'] * 1024 ) .
- 'Ko for maximum authorized ' . ( $this->maxlenght * 1024 ) .
+ '[' . $class . '] File is too big (' . ($file['size']*1024) .
+ 'Ko for maximum authorized ' . ($this->maxlenght*1024) .
'Ko',
Analog::ERROR
);
{
$f = fopen($file, 'r');
$picture = '';
- while ($r=fread($f, 8192)) {
+ while ($r = fread($f, 8192)) {
$picture .= $r;
}
fclose($f);
list($cur_width, $cur_height, $cur_type, $curattr)
= getimagesize($source);
- $ratio = $cur_width / $cur_height;
+ $ratio = $cur_width/$cur_height;
// calculate image size according to ratio
- if ($cur_width>$cur_height) {
+ if ($cur_width > $cur_height) {
$h = $w/$ratio;
} else {
$w = $h*$ratio;
public function atPreviousStep()
{
if ($this->_step > 0) {
- if ($this->_step -1 !== self::STEP_DB_INSTALL
+ if ($this->_step - 1 !== self::STEP_DB_INSTALL
&& $this->_step !== self::STEP_END
) {
if ($this->_step === self::STEP_DB_INSTALL) {
if ($this->_step === self::STEP_DB_UPGRADE) {
$this->setInstalledVersion(null);
}
- $this->_step = $this->_step -1;
+ $this->_step = $this->_step - 1;
}
} else {
$msg = null;
Analog::WARNING
);
$this->setDisabled(self::DISABLED_MISS);
- } elseif (!file_exists($full_entry.'/_disabled')) {
+ } elseif (!file_exists($full_entry . '/_disabled')) {
include $full_entry . '/_define.php';
$this->id = null;
$this->mroot = null;
'acls' => $acls,
'date' => $release_date,
'priority' => $priority === null ?
- 1000 :
- (integer) $priority,
+ 1000 : (integer)$priority,
'root_writable' => is_writable($this->mroot),
'route' => $route
);
throw new \Exception(_T("Cannot activate plugin."));
}
- if (@unlink($this->disabled[$id]['root'].'/_disabled') === false) {
+ if (@unlink($this->disabled[$id]['root'] . '/_disabled') === false) {
throw new \Exception(_T("Cannot activate plugin."));
}
}
if (isset($values[$fieldname])) {
$value = trim($values[$fieldname]);
} else {
- $value="";
+ $value = "";
}
// now, check validity
case 'pref_card_hspace':
case 'pref_card_vspace':
// prevent division by zero
- if ($fieldname=='pref_numrows' && $value=='0') {
+ if ($fieldname == 'pref_numrows' && $value == '0') {
$value = '10';
}
if (!is_numeric($value) || $value < 0) {
break;
case 'pref_card_tcol':
// Set strip text color to white
- if (! preg_match("/#([0-9A-F]{6})/i", $value)) {
+ if (!preg_match("/#([0-9A-F]{6})/i", $value)) {
$value = '#FFFFFF';
}
break;
&& isset($insert_values['pref_membership_ext'])
&& $insert_values['pref_membership_ext'] != ''
) {
- $this->errors[] =_T("- Default membership extention and beginning of membership are mutually exclusive.");
+ $this->errors[] = _T("- Default membership extention and beginning of membership are mutually exclusive.");
}
if (isset($insert_values['pref_membership_offermonths'])
&& isset($insert_values['pref_membership_ext'])
&& $insert_values['pref_membership_ext'] != ''
) {
- $this->errors[] =_T("- Offering months is only compatible with beginning of membership.");
+ $this->errors[] = _T("- Offering months is only compatible with beginning of membership.");
}
// missing required fields?
|| (!$login->isSuperAdmin()
&& ($champ != 'pref_admin_pass' && $champ != 'pref_admin_login'))
) {
- if (($champ == "pref_admin_pass" && $_POST['pref_admin_pass'] != '')
+ if (($champ == "pref_admin_pass" && $_POST['pref_admin_pass'] != '')
|| ($champ != "pref_admin_pass")
) {
$this->$champ = $valeur;
public function getPostalAddress()
{
$regs = array(
- '/%name/',
- '/%complement/',
- '/%address/',
- '/%zip/',
- '/%town/',
- '/%country/',
+ '/%name/',
+ '/%complement/',
+ '/%address/',
+ '/%zip/',
+ '/%town/',
+ '/%country/',
);
$replacements = null;
}
foreach ($addresses as $address) {
if (!GaletteMail::isValidEmail($address)) {
- $msg = str_replace('%s', $address, _T("Invalid E-Mail address: %s"));
+ $msg = str_replace('%s', $address, _T("Invalid E-Mail address: %s"));
Analog::log($msg, Analog::WARNING);
$this->errors[] = $msg;
}
//check page width
$max = 210;
//margins
- $size = $this->pref_card_marges_h * 2;
+ $size = $this->pref_card_marges_h*2;
//cards
- $size += PdfMembersCards::getWidth() * PdfMembersCards::getCols();
+ $size += PdfMembersCards::getWidth()*PdfMembersCards::getCols();
//spacing
- $size += $this->pref_card_hspace * (PdfMembersCards::getCols() - 1);
+ $size += $this->pref_card_hspace*(PdfMembersCards::getCols() - 1);
if ($size > $max) {
$warning_detected[] = _T('Current cards configuration may exceed page width!');
}
$max = 297;
//margins
- $size = $this->pref_card_marges_v * 2;
+ $size = $this->pref_card_marges_v*2;
//cards
- $size += PdfMembersCards::getHeight() * PdfMembersCards::getRows();
+ $size += PdfMembersCards::getHeight()*PdfMembersCards::getRows();
//spacing
- $size += $this->pref_card_vspace * (PdfMembersCards::getRows() - 1);
+ $size += $this->pref_card_vspace*(PdfMembersCards::getRows() - 1);
if ($size > $max) {
$warning_detected[] = _T('Current cards configuration may exceed page height!');
}
$php_conf .= str_pad("\n $key:", 25, '.') . ' ' . $value;
}
- $str = str_pad('Galette version:', 20, '.') . ' ' . \Galette\Core\Galette::gitVersion(true) . "\n";
- $str .= str_pad('PHP version:', 20, '.') . ' ' . PHP_VERSION . " " . php_sapi_name() . "\n";
- $str .= 'PHP config:' . $php_conf . "\n";
- $str .= str_pad('Database:', 20, '.') . ' ' . $db_version . "\n";
- $str .= str_pad('OS:', 20, '.') . ' ' . php_uname() . "\n";
- $str .= str_pad('Browser:', 20, '.') . ' ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
+ $str = str_pad('Galette version:', 20, '.') . ' ' . \Galette\Core\Galette::gitVersion(true) . "\n";
+ $str .= str_pad('PHP version:', 20, '.') . ' ' . PHP_VERSION . " " . php_sapi_name() . "\n";
+ $str .= 'PHP config:' . $php_conf . "\n";
+ $str .= str_pad('Database:', 20, '.') . ' ' . $db_version . "\n";
+ $str .= str_pad('OS:', 20, '.') . ' ' . php_uname() . "\n";
+ $str .= str_pad('Browser:', 20, '.') . ' ' . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$str .= 'Modules:' . "\n";
$mods = new CheckModules();
$str .= "\n" . 'Plugins:' . "\n";
foreach ($plugins->getModules() as $p) {
- $str .= ' ' . $p['name'] . ' ' . $p['version'] .
+ $str .= ' ' . $p['name'] . ' ' . $p['version'] .
' (' . $p['author'] . ")\n";
}
$str .= "\n" . 'PHP loaded modules:';
$i = 0;
foreach (get_loaded_extensions() as $e) {
- if ($i % 10 === 0) {
+ if ($i%10 === 0) {
$str .= "\n ";
}
$str .= $e . ", ";
$this->width = $values['field_width'];
}
- if ($this->hasHeight() && isset($values['field_height']) && trim($values['field_height']) != '') {
+ if ($this->hasHeight() && isset($values['field_height']) && trim($values['field_height']) != '') {
$this->height = $values['field_height'];
}
$select = $this->zdb->select(self::TABLE);
$select->columns(
array(
- 'cnt' => new \Laminas\Db\Sql\Expression('COUNT('. self::PK.')')
+ 'cnt' => new \Laminas\Db\Sql\Expression('COUNT(' . self::PK . ')')
)
)->where(
array(
$old_rank = $this->index;
- $direction = $action == 'up' ? -1: 1;
+ $direction = $action == 'up' ? -1 : 1;
$new_rank = $old_rank + $direction;
$update = $this->zdb->update(self::TABLE);
$update->set([
$results = $this->zdb->execute($select);
- if ($results->count() > 0) {
+ if ($results->count() > 0) {
foreach ($results as $row) {
$deps = $this->_deps;
$deps['children'] = false;
} else {
$date_end = new \DateTime($this->_due_date);
$date_diff = $date_now->diff($date_end);
- $this->_days_remaining = ( $date_diff->invert == 1 )
- ? $date_diff->days * -1
+ $this->_days_remaining = ($date_diff->invert == 1)
+ ? $date_diff->days*-1
: $date_diff->days;
if ($this->_days_remaining == 0) {
$patterns = array('/%days/', '/%date/');
$ddate = new \DateTime($this->_due_date);
$replace = array(
- $this->_days_remaining *-1,
+ $this->_days_remaining*-1,
$ddate->format(__("Y-m-d"))
);
if ($this->_active) {
if ($mandatory_missing === true) {
$this->errors[] = str_replace(
'%field',
- '<a href="#' . $key . '">' . $this->getFieldLabel($key) .'</a>',
+ '<a href="#' . $key . '">' . $this->getFieldLabel($key) . '</a>',
_T("- Mandatory field %field empty.")
);
}
$diff = $now->diff($d);
$days = (integer)$diff->format('%R%a');
if ($days >= 0) {
- $this->errors[] =_T('- Birthdate must be set in the past!');
+ $this->errors[] = _T('- Birthdate must be set in the past!');
}
$years = (integer)$diff->format('%R%Y');
if ($years <= -200) {
$this->errors[] = str_replace(
'%years',
- $years * -1,
+ $years*-1,
_T('- Members must be less than 200 years old (currently %years)!')
);
}
}
$results = $this->zdb->execute($select);
- if ($results->count() !== 0) {
+ if ($results->count() !== 0) {
$this->errors[] = _T("- This E-Mail address is already used by another member!");
}
} catch (\Exception $e) {
}
$results = $this->zdb->execute($select);
- if ($results->count() !== 0
+ if ($results->count() !== 0
|| $value == $preferences->pref_admin_login
) {
$this->errors[] = _T("- This username is already in use, please choose another one!");
) {
$this->errors[] = _T("- The passwords don't match!");
} elseif ($this->_self_adh === true
- && !crypt($value, $values['mdp_crypt'])==$values['mdp_crypt']
+ && !crypt($value, $values['mdp_crypt']) == $values['mdp_crypt']
) {
$this->errors[] = _T("Password misrepeated: ");
} else {
// picture upload
if (isset($files['photo'])) {
if ($files['photo']['error'] === UPLOAD_ERR_OK) {
- if ($files['photo']['tmp_name'] !='') {
+ if ($files['photo']['tmp_name'] != '') {
if (is_uploaded_file($files['photo']['tmp_name'])) {
$res = $this->picture->store($files['photo']);
if ($res < 0) {
return true;
} else {
throw new \Exception(
- 'No contribution #' . $id . ' (user ' .$this->login->id . ')'
+ 'No contribution #' . $id . ' (user ' . $this->login->id . ')'
);
}
} catch (\Exception $e) {
) {
$this->errors[] = str_replace(
'%field',
- '<a href="#' . $key . '">' . $this->getFieldLabel($key) .'</a>',
+ '<a href="#' . $key . '">' . $this->getFieldLabel($key) . '</a>',
_T("- Mandatory field %field empty.")
);
}
*/
public function getRowClass()
{
- return ( $this->_end_date != $this->_begin_date && $this->_is_cotis) ?
- 'cotis-normal' :
- 'cotis-give';
+ return ($this->_end_date != $this->_begin_date && $this->_is_cotis) ?
+ 'cotis-normal' : 'cotis-give';
}
/**
$date_end = new \DateTime($this->_end_date);
$date_start = new \DateTime($this->_begin_date);
$diff = $date_end->diff($date_start);
- return $diff->format('%y') * 12 + $diff->format('%m');
+ return $diff->format('%y')*12 + $diff->format('%m');
} else {
return '';
}
return null;
}
return ($this->isCotis()) ?
- PdfModel::INVOICE_MODEL :
- PdfModel::RECEIPT_MODEL;
+ PdfModel::INVOICE_MODEL : PdfModel::RECEIPT_MODEL;
break;
default:
return $this->$rname;
'where2' => $value['field_id'],
'where3' => $value['field_form'],
'where4' => isset($value['old_val_index']) ?
- $value['old_val_index'] :
- $value['val_index']
+ $value['old_val_index'] : $value['val_index']
];
$this->update_stmt->execute($params);
$this->has_changed = true;
if (($perm == DynamicField::PERM_MANAGER &&
$access_level < Authentication::ACCESS_MANAGER) ||
($perm == DynamicField::PERM_STAFF &&
- $access_level < Authentication::ACCESS_STAFF) ||
+ $access_level < Authentication::ACCESS_STAFF) ||
($perm == DynamicField::PERM_ADMIN &&
$access_level < Authentication::ACCESS_ADMIN)
) {
}
list($field_id, $val_index) = explode('_', substr($key, 11));
- if (! is_numeric($field_id) || ! is_numeric($val_index)) {
+ if (!is_numeric($field_id) || !is_numeric($val_index)) {
continue;
}
$max_size =
$fields[$field_id]->getSize() ?
- $fields[$field_id]->getSize() * 1024 :
- File::DEFAULT_MAX_FILE_SIZE * 1024;
+ $fields[$field_id]->getSize()*1024 : File::DEFAULT_MAX_FILE_SIZE*1024;
if ($file['size'] > $max_size) {
Analog::log(
"file too large: " . $file['size'] . " Ko, vs $max_size Ko allowed",
}
} catch (\Exception $e) {
Analog::log(
- 'Cannot load ' . $this->getType() . ' from id `' . $id . '` | ' .
+ 'Cannot load ' . $this->getType() . ' from id `' . $id . '` | ' .
$e->getMessage(),
Analog::WARNING
);
}
Analog::log(
- 'Defaults (' . $this->getType() .
+ 'Defaults (' . $this->getType() .
') were successfully stored into database.',
Analog::INFO
);
return true;
} catch (\Exception $e) {
Analog::log(
- 'Unable to initialize defaults (' . $this->getType() . ').' .
+ 'Unable to initialize defaults (' . $this->getType() . ').' .
$e->getMessage(),
Analog::WARNING
);
if ($results->count() == 0) {
Analog::log(
- 'No entries (' . $this->getType() . ') defined in database.',
+ 'No entries (' . $this->getType() . ') defined in database.',
Analog::INFO
);
} else {
}
} catch (\Exception $e) {
Analog::log(
- 'Unable to retrieve ' . $this->getType() . ' from label `' .
+ 'Unable to retrieve ' . $this->getType() . ' from label `' .
$label . '` | ' . $e->getMessage(),
Analog::ERROR
);
$ret = $this->zdb->execute($insert);
- if ($ret->count() > 0) {
+ if ($ret->count() > 0) {
Analog::log(
- 'New ' . $this->getType() .' `' . $label .
+ 'New ' . $this->getType() . ' `' . $label .
'` added successfully.',
Analog::INFO
);
$this->addTranslation($label);
} else {
- throw new \Exception('New ' . $this->getType() .' not added.');
+ throw new \Exception('New ' . $this->getType() . ' not added.');
}
$this->zdb->connection->commit();
return true;
} catch (\Exception $e) {
$this->zdb->connection->rollBack();
Analog::log(
- 'Unable to update ' . $this->getType() . ' #' . $id . ' | ' .
+ 'Unable to update ' . $this->getType() . ' #' . $id . ' | ' .
$e->getMessage(),
Analog::ERROR
);
} catch (\Exception $e) {
$this->zdb->connection->rollBack();
Analog::log(
- 'Unable to delete ' . $this->getType() . ' ' . $id .
+ 'Unable to delete ' . $this->getType() . ' ' . $id .
' | ' . $e->getMessage(),
Analog::ERROR
);
}
} catch (\Exception $e) {
Analog::log(
- 'Unable to check if ' . $this->getType . ' `' . $id .
+ 'Unable to check if ' . $this->getType . ' `' . $id .
'` is used. | ' . $e->getMessage(),
Analog::ERROR
);
if ($cat_label === null) {
$cat_label = $c->category;
}
- $cat = (object) array(
+ $cat = (object)array(
'id' => (int)$c->$cpk,
'label' => $cat_label,
'elements' => array()
if ($cat_label === null) {
$cat_label = $c->category;
}
- $cat = (object) array(
+ $cat = (object)array(
'id' => (int)$c->$cpk,
'label' => $cat_label,
'elements' => array()
$stmt->execute(
array(
'required' => ($or->required === false) ?
- ($this->zdb->isPostgres() ? 'false' : 0) :
- true,
+ ($this->zdb->isPostgres() ? 'false' : 0) : true,
'where1' => $or->field_id
)
);
} catch (\Exception $e) {
Analog::log(
'Cannot load import model | ' . $e->getMessage() .
- "\n" . $e->__toString(),
+ "\n" . $e->__toString(),
Analog::ERROR
);
return false;
$this->comment = $rs->reminder_comment;
} catch (\Exception $e) {
Analog::log(
- __METHOD__ . ': incorrect ResultSet. Error: ' .$e->getMessage(),
+ __METHOD__ . ': incorrect ResultSet. Error: ' . $e->getMessage(),
Analog::ERROR
);
Analog::log(
$this->nomail = false;
}
if ($this->type === self::LATE) {
- $this->replaces['days_expired'] = $value->days_remaining *-1;
+ $this->replaces['days_expired'] = $value->days_remaining*-1;
}
if ($this->type === self::IMPENDING) {
$this->replaces['days_remaining'] = $value->days_remaining;
break;
default:
Analog::log(
- 'Unable to set property ' .$name,
+ 'Unable to set property ' . $name,
Analog::WARNING
);
break;
$this->errors = array_merge($this->errors, $mandatory);
}
- if ($this->id === null &&! $this->login->isSuperAdmin()) {
+ if ($this->id === null && !$this->login->isSuperAdmin()) {
//set author for new searches
$this->author_id = $this->login->id;
}
->limit(1);
$results = $this->zdb->execute($select);
- if ($results->count() !== 0) {
+ if ($results->count() !== 0) {
$result = $results->current();
//search already exists
Analog::log(
}
}
- if (count($missing) >0) {
+ if (count($missing) > 0) {
$this->insert($zdb, $missing);
Analog::log(
break;
default:
Analog::log(
- 'Unable to set property ' .$name,
+ 'Unable to set property ' . $name,
Analog::WARNING
);
break;
if (!isset($disabled[$key]) && !isset($this->$prop)) {
$this->errors[] = str_replace(
'%field',
- '<a href="#' . $key . '">' . $this->getFieldLabel($key) .'</a>',
+ '<a href="#' . $key . '">' . $this->getFieldLabel($key) . '</a>',
_T("- Mandatory field %field empty.")
);
}
*/
public function getRowClass()
{
- return ( $this->getMissingAmount() == 0 ) ?
- 'transaction-normal' :
- 'transaction-uncomplete';
+ return ($this->getMissingAmount() == 0) ?
+ 'transaction-normal' : 'transaction-uncomplete';
}
/**
return $this->$rname;
} else {
Analog::log(
- '[AdvancedMembersList] Unable to get proprety `' .$name . '`',
+ '[AdvancedMembersList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
} else {
if ($value !== null) {
Analog::log(
- 'Incorrect amount for ' . $name . '! ' .
+ 'Incorrect amount for ' . $name . '! ' .
'Should be a float (' . gettype($value) . ' given)',
Analog::WARNING
);
} else {
Analog::log(
'[AdvancedMembersList] Value for group filter logical operator should be '
- .' in [0,1] (' . gettype($value) . '-> '.$value.' given )',
+ .' in [0,1] (' . gettype($value) . '-> ' . $value . ' given )',
Analog::WARNING
);
}
}
} else {
Analog::log(
- '[ContributionsList] Unable to get proprety `' .$name . '`',
+ '[ContributionsList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
$ym = \DateTime::createFromFormat(__("Y-m"), $value);
- if ($y === false && $ym !== false) {
+ if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
$day = $ym->format('t');
}
$d = \DateTime::createFromFormat(__("Y-m-d"), $value);
- if ($y === false && $ym === false && $d !== false) {
+ if ($y === false && $ym === false && $d !== false) {
$this->$name = $d->format('Y-m-d');
}
}
} else {
Analog::log(
- '[HistoryList] Unable to get proprety `' .$name . '`',
+ '[HistoryList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
$ym = \DateTime::createFromFormat(__("Y-m"), $value);
- if ($y === false && $ym !== false) {
+ if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
$day = $ym->format('t');
}
$d = \DateTime::createFromFormat(__("Y-m-d"), $value);
- if ($y === false && $ym === false && $d !== false) {
+ if ($y === false && $ym === false && $d !== false) {
$this->$name = $d->format('Y-m-d');
}
}
} else {
Analog::log(
- '[MailingsList] Unable to get proprety `' .$name . '`',
+ '[MailingsList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
$ym = \DateTime::createFromFormat(__("Y-m"), $value);
- if ($y === false && $ym !== false) {
+ if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
$day = $ym->format('t');
}
$d = \DateTime::createFromFormat(__("Y-m-d"), $value);
- if ($y === false && $ym === false && $d !== false) {
+ if ($y === false && $ym === false && $d !== false) {
$this->$name = $d->format('Y-m-d');
}
}
} else {
Analog::log(
- '[MembersList] Unable to get proprety `' .$name . '`',
+ '[MembersList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
} else {
Analog::log(
- '[TransactionsList] Unable to get proprety `' .$name . '`',
+ '[TransactionsList] Unable to get proprety `' . $name . '`',
Analog::WARNING
);
}
}
$ym = \DateTime::createFromFormat(__("Y-m"), $value);
- if ($y === false && $ym !== false) {
+ if ($y === false && $ym !== false) {
$day = 1;
if ($name === 'end_date_filter') {
$day = $ym->format('t');
}
$d = \DateTime::createFromFormat(__("Y-m-d"), $value);
- if ($y === false && $ym === false && $d !== false) {
+ if ($y === false && $ym === false && $d !== false) {
$this->$name = $d->format('Y-m-d');
}
public function __construct(Smarty $view, $displayErrorDetails = false)
{
$this->view = $view;
- $this->displayErrorDetails = (bool) $displayErrorDetails;
+ $this->displayErrorDetails = (bool)$displayErrorDetails;
}
$raw_size = filesize($file);
$size = 0;
if ($raw_size >= 1024*1024*1024) { // Go
- $size = round(($raw_size / 1024)/1024/1024, 2) . ' Go';
+ $size = round(($raw_size/1024)/1024/1024, 2) . ' Go';
} elseif ($raw_size >= 1024*1024) { // Mo
- $size = round(($raw_size / 1024)/1024, 2) . ' Mo';
+ $size = round(($raw_size/1024)/1024, 2) . ' Mo';
} elseif ($raw_size >= 1024) { // ko
- $size = round(($raw_size / 1024), 2) . ' Ko';
+ $size = round(($raw_size/1024), 2) . ' Ko';
} else { // octets
$size = $raw_size . ' octets';
}
{
//let's ensure we do not have a path here
$name = basename($name);
- $filename=$this->default_directory . $name;
+ $filename = $this->default_directory . $name;
if (file_exists($filename)) {
$removed = unlink($filename);
{
$class = get_class($this);
Analog::log(
- '[' . $class . '] ' . $msg,
+ '[' . $class . '] ' . $msg,
Analog::ERROR
);
$this->errors[] = $msg;
if (isset($this->emails[$column])) {
$existing = $this->emails[$column];
$extra = ($existing == -1 ?
- _T("from another member in import") :
- str_replace('%id_adh', $existing, _T("from member %id_adh"))
+ _T("from another member in import") : str_replace('%id_adh', $existing, _T("from member %id_adh"))
);
$this->addError(
str_replace(
$member->dynamicsValidate($dfields);
$errors = $member->getErrors();
if (count($errors) > $errcnt) {
- $lcnt = ($errcnt > 0 ? $errcnt -1 : 0);
+ $lcnt = ($errcnt > 0 ? $errcnt - 1 : 0);
for ($i = $lcnt; $i < count($errors); ++$i) {
$this->addError($errors[$i]);
}
|| $this->_fields[$col] == 'activite_adh')
&& ($column == null || trim($column) == '')
) {
- $values[$this->_fields[$col]] = 0;//defaults to 0 as in Adherent
+ $values[$this->_fields[$col]] = 0; //defaults to 0 as in Adherent
}
if ($this->_fields[$col] == Status::PK && empty(trim($column))) {
) . $this->quote;
}
$this->result .= implode($this->separator, $fields) . self::NEWLINE;
- } elseif ($titles && is_array($titles) && count($titles)>1) {
+ } elseif ($titles && is_array($titles) && count($titles) > 1) {
foreach ($titles as $field) {
$field = str_replace(
array(':', ' '),
{
if ($last && $this->file
|| !$last && $this->file
- && ($this->current_line % self::BUFLINES) == 0
+ && ($this->current_line%self::BUFLINES) == 0
) {
if ($this->file === true) {
echo $this->result;
Adapter::QUERY_MODE_EXECUTE
);
- $filename=self::DEFAULT_DIRECTORY . $export['filename'];
+ $filename = self::DEFAULT_DIRECTORY . $export['filename'];
$fp = fopen($filename, 'w');
if ($fp) {
- $separator = ( $export->separator )
+ $separator = ($export->separator)
? $export->separator
: self::DEFAULT_SEPARATOR;
- $quote = ( $export->quote ) ? $export->quote : self::DEFAULT_QUOTE;
+ $quote = ($export->quote) ? $export->quote : self::DEFAULT_QUOTE;
if ($export->headers->none) {
//No title
$title = false;
//get stderr, if any
$errors = stream_get_contents($pipes[2]);
if (trim($errors) !== '') {
- $this->output .="\n\nStdErr:\n" . $errors;
+ $this->output .= "\n\nStdErr:\n" . $errors;
}
//closes pipes and process
$err_msg .= 'Invalid extension for file ' . $this->name . '.';
$ret = self::INVALID_EXTENSION;
} else {
- $err_msg = 'Invalid filename `' . $this->name . '` (Tip: ';
+ $err_msg = 'Invalid filename `' . $this->name . '` (Tip: ';
$err_msg .= preg_replace(
'|%s|',
htmlentities($this->getBadChars()),
}
//Second, let's check file size
- if ($file['size'] > ($this->maxlenght * 1024)) {
+ if ($file['size'] > ($this->maxlenght*1024)) {
Analog::log(
- '[' . $class . '] File is too big (' . ( $file['size'] * 1024 ) .
- 'Ko for maximum authorized ' . ( $this->maxlenght * 1024 ) .
+ '[' . $class . '] File is too big (' . ($file['size']*1024) .
+ 'Ko for maximum authorized ' . ($this->maxlenght*1024) .
'Ko',
Analog::ERROR
);
}
Analog::log(
- '[' . $class . '] Found mimetype : ' . $mime . ' for file ' . $file,
+ '[' . $class . '] Found mimetype : ' . $mime . ' for file ' . $file,
Analog::INFO
);
return $mime;
public function exportMembers(MembersList $filters)
{
$export_fields = null;
- if (file_exists(GALETTE_CONFIG_PATH . 'local_export_fields.inc.php')) {
- include_once GALETTE_CONFIG_PATH . 'local_export_fields.inc.php';
+ if (file_exists(GALETTE_CONFIG_PATH . 'local_export_fields.inc.php')) {
+ include_once GALETTE_CONFIG_PATH . 'local_export_fields.inc.php';
$export_fields = $fields;
}
*/
private function getCacheFilename()
{
- return GALETTE_CACHE_DIR .str_replace(
+ return GALETTE_CACHE_DIR . str_replace(
'%feed',
md5($this->feed_url),
$this->cache_filename
$this->posts = $posts;
} catch (\Exception $e) {
Analog::log(
- 'Unable to load feed from "' . $this->feed_url .
+ 'Unable to load feed from "' . $this->feed_url .
'" :( | ' . $e->getMessage(),
Analog::ERROR
);
global $container;
Analog::log(
- 'PDF error: ' .$msg,
+ 'PDF error: ' . $msg,
Analog::ERROR
);
);
$redirect = (isset($_SERVER['HTTP_REFERER']) ?
- $_SERVER['HTTP_REFERER'] :
- $container->get('router')->pathFor('slash'));
+ $_SERVER['HTTP_REFERER'] : $container->get('router')->pathFor('slash'));
header('Location: ' . $redirect);
die();
}
*/
protected function parsegif($file)
{
- $a=GetImageSize($file);
+ $a = GetImageSize($file);
if (empty($a)) {
$this->Error(_T("Missing or incorrect image file ") . $file);
}
- if ($a[2]!=1) {
+ if ($a[2] != 1) {
$this->Error(_T("Not a GIF file ") . $file);
}
// Test d'échec & Affichage d'un message d'erreur
if (!$data) {
- $this->Error(_T("Error loading ").$file);
+ $this->Error(_T("Error loading ") . $file);
}
if (imagepng($data, GALETTE_ROOT . 'tempimages/gif2png.png')) {
return $this->_parsepng(GALETTE_ROOT . 'tempimages/gif2png.png');
} else {
- $this->Error(_T("Error creating temporary png file from ").$file);
+ $this->Error(_T("Error creating temporary png file from ") . $file);
}
} else {
- $this->Error(_T("Unable to convert GIF file ").$file);
+ $this->Error(_T("Unable to convert GIF file ") . $file);
}
}
if (trim($this->model->hstyles) !== '') {
$html .= "<style>\n" . $this->model->hstyles . "\n</style>\n\n";
}
- $html .= "<div dir=\"".($this->i18n->isRTL() ? 'rtl' : 'ltr')."\">" . $this->model->hheader . "</div>";
+ $html .= "<div dir=\"" . ($this->i18n->isRTL() ? 'rtl' : 'ltr') . "\">" . $this->model->hheader . "</div>";
$this->writeHtml($html, true, false, true, false, '');
if ($title !== null) {
if ($title !== null) {
$this->Cell(0, 6, $title, 0, 1, ($this->i18n->isRTL() ? 'R' : 'L'), 0);
}
- $yend = $this->getY();//store position at the end of the text
+ $yend = $this->getY(); //store position at the end of the text
$this->SetY($ystart);
if ($this->i18n->isRTL()) {
*/
protected function cut($str, $length)
{
- $length = $length -2; //keep a margin
+ $length = $length - 2; //keep a margin
if ($this->GetStringWidth($str) > $length) {
while ($this->GetStringWidth($str . '...') > $length) {
$str = mb_substr($str, 0, -1, 'UTF-8');
parent::__construct($prefs, $model);
$this->filename = $adh ?
- __("adherent_form") . '.' . $adh->id . '.pdf' :
- __("adherent_form") . '.pdf';
+ __("adherent_form") . '.' . $adh->id . '.pdf' : __("adherent_form") . '.pdf';
$this->Open();
$main_group = $member_groups[0]->getName();
$group_list = '<ul>';
foreach ($member_groups as $group) {
- $group_list .= '<li>' . $group->getName() . '</li>';
+ $group_list .= '<li>' . $group->getName() . '</li>';
}
$group_list .= '</ul>';
}
switch ($field_type) {
case DynamicField::TEXT:
$value .= '<textarea' .
- ' id="' . $field_name . '"' .
- ' name="' . $field_name . '"' .
+ ' id="' . $field_name . '"' .
+ ' name="' . $field_name . '"' .
' value="' . $field_value['field_val'] . '"' .
'/>';
break;
case DynamicField::LINE:
$value .= '<input type="text"' .
- ' id="' . $field_name . '"' .
- ' name="' . $field_name . '"' .
+ ' id="' . $field_name . '"' .
+ ' name="' . $field_name . '"' .
' value="' . $field_value['field_val'] . '"' .
' size="20" maxlength="30"/>';
break;
$choice_values = $dynamic_fields[$field_id]->getValues();
foreach ($choice_values as $choice_idx => $choice_value) {
$value .= '<input type="radio"' .
- ' id="' . $field_name . '"' .
- ' name="' . $field_name . '"' .
+ ' id="' . $field_name . '"' .
+ ' name="' . $field_name . '"' .
' value="' . $choice_value . '"';
if ($choice_idx == $field_values[0]['field_val']) {
$value .= ' checked="checked"';
break;
case DynamicField::DATE:
$value .= '<input type="text" name="' .
- $field_name . '" value="' .
+ $field_name . '" value="' .
$field_value . '" />';
break;
case DynamicField::BOOLEAN:
$value .= '<input type="checkbox"' .
- ' name="' . $field_name . '"' .
+ ' name="' . $field_name . '"' .
' value="1"';
if ($field_value['field_val'] == 1) {
$value .= ' checked="checked"';
break;
case DynamicField::FILE:
$value .= '<input type="text" name="' .
- $field_name . '" value="' .
+ $field_name . '" value="' .
$field_value['field_val'] . '" />';
break;
}
class PdfAttendanceSheet extends Pdf
{
- const SHEET_FONT = self::FONT_SIZE-2;
+ const SHEET_FONT = self::FONT_SIZE - 2;
public $doc_title = null;
public $sheet_title = null;
// Set colors
$this->SetDrawColor(160, 160, 160);
$this->SetTextColor(0);
- $this->SetFont(Pdf::FONT, '', Pdf::FONT_SIZE-2);
+ $this->SetFont(Pdf::FONT, '', Pdf::FONT_SIZE - 2);
}
/**
if ($this->i18n->isRTL()) {
$ximg = $this->getPageWidth() - $x - $wlogo;
}
- $this->Cell($wlogo+2, 16, '', ($this->i18n->isRTL() ? 'R' : 'L') . 'TB', 0);
+ $this->Cell($wlogo + 2, 16, '', ($this->i18n->isRTL() ? 'R' : 'L') . 'TB', 0);
$this->Image($p, $ximg, $y, $wlogo, $hlogo);
} else {
$x = $this->getX() + 1;
$main_group = $member_groups[0]->getName();
$group_list = '<ul>';
foreach ($member_groups as $group) {
- $group_list .= '<li>' . $group->getName() . '</li>';
+ $group_list .= '<li>' . $group->getName() . '</li>';
}
$group_list .= '</ul>';
}
*/
public function drawCards($members)
{
- $nb_card=0;
+ $nb_card = 0;
foreach ($members as $member) {
// Detect page breaks
- if ($nb_card % ($this->nbcol * $this->nbrow)==0) {
+ if ($nb_card%($this->nbcol*$this->nbrow) == 0) {
$this->AddPage();
}
// Compute card position on page
- $col = $nb_card % $this->nbcol;
- $row = ($nb_card/$this->nbcol) % $this->nbrow;
+ $col = $nb_card%$this->nbcol;
+ $row = ($nb_card/$this->nbcol)%$this->nbrow;
// Set origin
- $x0 = $this->xorigin + $col*(round($this->wi)+round($this->hspacing));
- $y0 = $this->yorigin + $row*(round($this->he)+round($this->vspacing));
+ $x0 = $this->xorigin + $col*(round($this->wi) + round($this->hspacing));
+ $y0 = $this->yorigin + $row*(round($this->he) + round($this->vspacing));
// Logo X position
$xl = round($x0 + $this->wi - $this->wlogo);
// Get data
$xid = $x0 + $this->wi - $this->GetStringWidth($member->id, self::FONT, 'B', 8) - 0.2;
$this->SetXY($xid, $y0 + 28);
- $this->writeHTML('<strong>' . $member->id . '</strong>', false, 0);
+ $this->writeHTML('<strong>' . $member->id . '</strong>', false, 0);
$this->SetFontSize($this->year_font_size);
$xan_cot = $xan_cot - 0.3;
$this->SetXY($xan_cot, $y0 + $this->hlogo - 0.3);
// Label heigth
$this->lh = round($this->preferences->pref_etiq_vsize);
// Line heigth
- $this->line_h=round($this->lh/5);
+ $this->line_h = round($this->lh/5);
}
/**
*/
public function drawLabels($members)
{
- $nb_etiq=0;
+ $nb_etiq = 0;
foreach ($members as $member) {
// Detect page breaks
$colsrows = $this->preferences->pref_etiq_cols
* $this->preferences->pref_etiq_rows;
- if ($nb_etiq % $colsrows == 0) {
+ if ($nb_etiq%$colsrows == 0) {
$this->AddPage();
}
// Set font
$this->SetFont(self::FONT, 'B', $this->preferences->pref_etiq_corps);
// Compute label position
- $col = $nb_etiq % $this->preferences->pref_etiq_cols;
- $row = ($nb_etiq / $this->preferences->pref_etiq_cols)
+ $col = $nb_etiq%$this->preferences->pref_etiq_cols;
+ $row = ($nb_etiq/$this->preferences->pref_etiq_cols)
% $this->preferences->pref_etiq_rows;
// Set label origin
$x = $this->xorigin + $col*(
//calculte font size to display address and address continuation
$max_text_size = $this->preferences->pref_etiq_hsize;
$text = mb_strlen($member->address) > mb_strlen($member->address_continuation) ?
- $member->address :
- $member->address_continuation;
+ $member->address : $member->address_continuation;
$this->fixSize(
$text,
$max_text_size,
}
if (isset($this->session->filter_members)) {
- $filters = $this->session->filter_members;
+ $filters = $this->session->filter_members;
} else {
$filters = new MembersList();
}
$navigate = array(
'cur' => $m['id_adh'],
'count' => count($ids),
- 'pos' => $k+1
+ 'pos' => $k + 1
);
if ($k > 0) {
- $navigate['prev'] = $ids[$k-1]['id_adh'];
+ $navigate['prev'] = $ids[$k - 1]['id_adh'];
}
- if ($k < count($ids)-1) {
- $navigate['next'] = $ids[$k+1]['id_adh'];
+ if ($k < count($ids) - 1) {
+ $navigate['next'] = $ids[$k + 1]['id_adh'];
}
break;
}
private function buildSelect($fields, $count = false)
{
try {
- $fieldsList = ( $fields != null )
- ? (( !is_array($fields) || count($fields) < 1 ) ? (array)'*'
+ $fieldsList = ($fields != null)
+ ? ((!is_array($fields) || count($fields) < 1) ? (array)'*'
: implode(', ', $fields)) : (array)'*';
$select = $this->zdb->select(self::TABLE, 'a');
if (($perm == DynamicField::PERM_MANAGER &&
$access_level < Authentication::ACCESS_MANAGER) ||
($perm == DynamicField::PERM_STAFF &&
- $access_level < Authentication::ACCESS_STAFF) ||
+ $access_level < Authentication::ACCESS_STAFF) ||
($perm == DynamicField::PERM_ADMIN &&
$access_level < Authentication::ACCESS_ADMIN)
) {
global $zdb;
try {
$join_table = ($managed) ?
- Group::GROUPSMANAGERS_TABLE :
- Group::GROUPSUSERS_TABLE;
+ Group::GROUPSMANAGERS_TABLE : Group::GROUPSUSERS_TABLE;
$select = $zdb->select(Group::TABLE, 'a');
$select->join(
foreach ($results as $member) {
$str_adh = $member->id_adh . ' (' . $member->nom_adh . ' ' .
$member->prenom_adh . ')';
- $infos .= $str_adh . "\n";
+ $infos .= $str_adh . "\n";
$p = new Picture($member->id_adh);
if ($p->hasPicture()) {
if ($fields != null && is_array($fields) && !in_array('id_adh', $fields)) {
$fields[] = 'id_adh';
}
- $fieldsList = ( $fields != null )
- ? (( !is_array($fields) || count($fields) < 1 ) ? (array)'*'
+ $fieldsList = ($fields != null)
+ ? ((!is_array($fields) || count($fields) < 1) ? (array)'*'
: $fields) : (array)'*';
$select = $zdb->select(self::TABLE, 'a');
return true;
} else {
Analog::log(
- 'Trying to order by ' . $field_name . ' while it is not in ' .
+ 'Trying to order by ' . $field_name . ' while it is not in ' .
'selected fields.',
Analog::WARNING
);
} else {
$sep = ', " ", ';
$pre = 'CONCAT(';
- $post=')';
+ $post = ')';
}
//$sep = ( TYPE_DB === 'pgsql' ) ? " || ' ' || " : ', " ", ';
$select->where(
'(' .
$pre . 'LOWER(nom_adh)' . $sep .
'LOWER(prenom_adh)' . $sep .
- 'LOWER(pseudo_adh)' . $post . ' LIKE ' .
+ 'LOWER(pseudo_adh)' . $post . ' LIKE ' .
$token
. ' OR ' .
$pre . 'LOWER(prenom_adh)' . $sep .
'LOWER(nom_adh)' . $sep .
- 'LOWER(pseudo_adh)' . $post . ' LIKE ' .
+ 'LOWER(pseudo_adh)' . $post . ' LIKE ' .
$token
. ')'
);
'dfc.field_id = ' . $k . ' AND ';
$field = 'field_val';
$qry .= 'LOWER(' . $prefix . $field . ') ' .
- $qop . ' ' ;
- $select->where($qry . $zdb->platform->quoteValue('%' .strtolower($cd) . '%'));
+ $qop . ' ';
+ $select->where($qry . $zdb->platform->quoteValue('%' . strtolower($cd) . '%'));
}
}
}
if ($dyn_field && $dyn_field instanceof \Galette\DynamicFields\Boolean) {
if ($fs['search'] != 0) {
- $qry .= $prefix . $fs['field'] . $qop . ' ' .
- $fs['search'] ;
+ $qry .= $prefix . $fs['field'] . $qop . ' ' .
+ $fs['search'];
} else {
$qry .= $prefix . $fs['field'] . ' IS NULL';
}
} elseif (!strncmp($fs['field'], 'bool_', strlen('bool_'))) {
- $qry .= $prefix . $fs['field'] . $qop . ' ' .
- $fs['search'] ;
+ $qry .= $prefix . $fs['field'] . $qop . ' ' .
+ $fs['search'];
} elseif ($fs['qry_op'] === AdvancedMembersList::OP_BEFORE
|| $fs['qry_op'] === AdvancedMembersList::OP_AFTER
) {
if ($prefix === 'a.') {
//dates are OK in the main fields. no cast, just query!
- $qry .= $prefix . $fs['field'] . $qop . ' ' .
+ $qry .= $prefix . $fs['field'] . $qop . ' ' .
$zdb->platform->quoteValue($fs['search']);
} else {
//dynamic dates are stored in their localized format :/
$qry .= 'STR_TO_DATE(' . $prefix . $fs['field'] . ', \'' . $store_fmt . '\') ';
}
- $qry .= $qop . ' ' . $fs['search'] ;
+ $qry .= $qop . ' ' . $fs['search'];
}
} elseif ($fs['field'] == 'status_label') {
$qry_pattern = '%p%field %op %value';
);
} else {
$qry .= 'LOWER(' . $prefix . $fs['field'] . ') ' .
- $qop . ' ' . $zdb->platform->quoteValue($fs['search']);
+ $qop . ' ' . $zdb->platform->quoteValue($fs['search']);
}
if ($fs['log_op'] === AdvancedMembersList::OP_AND) {
}
}
- if (count($missing) >0) {
+ if (count($missing) > 0) {
$this->zdb->connection->beginTransaction();
$this->insert($ent::TABLE, $missing);
Analog::log(
private function buildSelect($fields, $count = false)
{
try {
- $fieldsList = ( $fields != null )
- ? (( !is_array($fields) || count($fields) < 1 ) ? (array)'*'
+ $fieldsList = ($fields != null)
+ ? ((!is_array($fields) || count($fields) < 1) ? (array)'*'
: implode(', ', $fields)) : (array)'*';
$select = $this->zdb->select(self::TABLE, 's');
private function buildSelect($fields, $count = false)
{
try {
- $fieldsList = ( $fields != null )
- ? (( !is_array($fields) || count($fields) < 1 ) ? (array)'*'
+ $fieldsList = ($fields != null)
+ ? ((!is_array($fields) || count($fields) < 1) ? (array)'*'
: implode(', ', $fields)) : (array)'*';
$select = $this->zdb->select(self::TABLE, 't');
}
}
- if ($count !=0 && $done != 0) {
+ if ($count != 0 && $done != 0) {
if ($done === $count) {
$this->addSuccess(
str_replace('%count', $count, _T("%count groups created"))
}
}
- if ($count !=0 && $done != 0) {
+ if ($count != 0 && $done != 0) {
if ($done === $count) {
$this->addSuccess(
str_replace('%count', $count, _T("%count members created"))
$this->status = array_keys($status->getList());
}
- $data= [
+ $data = [
'nom_adh' => $faker->lastName(),
'prenom_adh' => $faker->firstName(),
'ville_adh' => $faker->city(),
}
for ($i = 0; $i < $count; $i++) {
- $data= [
+ $data = [
'trans_date' => $faker->dateTimeBetween($startDate = '-1 years', $endDate = 'now')->format(_T("Y-m-d")),
Adherent::PK => $faker->randomElement($mids),
'trans_amount' => $faker->numberBetween($min = 50, $max = 2000),
}
}
- if ($count !=0 && $done != 0) {
+ if ($count != 0 && $done != 0) {
if ($done === $count) {
$this->addSuccess(
str_replace('%count', $count, _T("%count transactions created"))
]
),
'info_cotis' => ($this->seed !== null ?
- 'FAKER' . $this->seed :
- $faker->optional($weight = 0.1)->realText($maxNbChars = 500)),
+ 'FAKER' . $this->seed : $faker->optional($weight = 0.1)->realText($maxNbChars = 500)),
'date_enreg' => $faker->dateTimeBetween($startDate = '-1 years', $endDate = 'now')->format(_T("Y-m-d")),
'date_debut_cotis' => $begin_date->format(_T("Y-m-d")),
'date_fin_cotis' => $end_date->format(_T("Y-m-d"))
$args = array();
$internal = false;
-if (defined('STDIN') ) {
+if (defined('STDIN')) {
//we're called from command line
$args = stream_get_contents(STDIN);
-} else if ( count($_POST) > 0 ) {
+} else if (count($_POST) > 0) {
//we're called from HTTP POST
$args = $_POST;
//check if we're called from galette internal
- if ( isset($_POST['galette_internal']) ) {
+ if (isset($_POST['galette_internal'])) {
$internal = true;
include_once 'includes/galette.inc.php';
unset($_POST['galette_internal']);
} else {
echo 'Requested as HTTP POST with parameters:<br/>';
}
-} else if ( count($_GET) > 0 ) {
+} else if (count($_GET) > 0) {
//we're called from HTTP GET
echo 'Requested as HTTP GET with parameters:<br/>';
$args = $_GET;
}
-if ( count($args) == 0 ) {
+if (count($args) == 0) {
//we're called without arguments => exit.
die('No arguments.');
}
-if (defined('STDIN') ) {
+if (defined('STDIN')) {
//a successfull script returns 0, we do not output anything
$fp = fopen(__DIR__ . '/cache/galette_post_contrib_file.txt', 'w');
fwrite($fp, $args);
fclose($fp);
} else {
$json_args = json_decode($args);
- foreach ( $json_args as $k=>$v ) {
+ foreach ($json_args as $k=>$v) {
echo 'key: ' . $k . ' | value: ' . $v;
}
}
$now = new \DateTime();
$dbg_log_path = GALETTE_LOGS_PATH . 'galette_debug_' .
- $now->format('Y-m-d') . '.log';
+ $now->format('Y-m-d') . '.log';
$galette_debug_log = LevelName::init(Handler\File::init($dbg_log_path));
if (defined('GALETTE_SYS_LOG') && GALETTE_SYS_LOG === true) {
Analog::handler(
Handler\Multi::init(
- array (
+ array(
Analog::NOTICE => Handler\Threshold::init(
$galette_run_log,
GALETTE_LOG_LVL
if ($_POST['install_adminpass'] == '') {
$error_detected[] = _T("No password");
}
- if (! isset($_POST['install_passwdverified'])
+ if (!isset($_POST['install_passwdverified'])
&& strcmp(
$_POST['install_adminpass'],
$_POST['install_adminpass_verif']
<li<?php if ($install->isDbStep()) echo ' class="current"'; ?>><?php echo _T("Database"); ?> - </li>
<li<?php if ($install->isDbCheckStep()) echo ' class="current"'; ?>><?php echo _T("Database access/permissions"); ?> - </li>
<?php
-if ( $install->isUpgrade() ) {
+if ($install->isUpgrade()) {
?>
<li<?php if ($install->isVersionSelectionStep()) echo ' class="current"'; ?>><?php echo _T("Version selection"); ?> - </li>
<li<?php if ($install->isDbUpgradeStep()) echo ' class="current"'; ?>><?php echo _T("Database upgrade"); ?> - </li>
<?php
}
-if ( !$install->isUpgrade() ) {
+if (!$install->isUpgrade()) {
?>
<li<?php if ($install->isAdminStep()) echo ' class="current"'; ?>><?php echo _T("Admin parameters"); ?> - </li>
<?php