* @since Available since 0.7dev - 2011-11-26
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_attendance_sheet_details.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2012-01-19
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
$id = get_numeric_form_value(Galette\Entity\Group::PK, '');
if ( !$id ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_group.php without groups specified',
- KLogger::INFO
+ Analog::INFO
);
die();
}
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff()
&& !$login->isGroupManager($id)
) {
- $log->log(
+ Analog::log(
'Trying to display ajax_group.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
$group->store();
echo json_encode(array('success' => 'true'));
} else {
- $log->log(
+ Analog::log(
'Trying to reorder without target specified',
- KLogger::INFO
+ Analog::INFO
);
echo json_encode(array('success' => false));
die();
* @since Available since 0.7dev - 2011-10-29
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
$ids = $_POST['persons'];
$mode = $_POST['person_mode'];
if ( !$ids || !$mode ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_group_members.php without persons or mode specified',
- KLogger::INFO
+ Analog::INFO
);
die();
}
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_group_members.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2011-11-01
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff()
&& !$login->isGroupManager()
) {
- $log->log(
+ Analog::log(
'Trying to display ajax_groups.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2011-08-28
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_mailing_preview.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
*/
use Galette\Filters\MembersList as MembersList;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_members.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
switch ( $_POST['from'] ) {
case 'groups':
if ( !isset($_POST['gid']) ) {
- $log->log(
+ Analog::log(
'Trying to list group members with no group id provided',
- KLogger::ERR
+ Analog::ERROR
);
throw new Exception('A group id is required.');
exit(0);
} else if ( $_POST['mode'] == 'managers' ) {
$selected_members = $group->getManagers();
} else {
- $log->log(
+ Analog::log(
'Trying to list group members with unknown mode',
- KLogger::ERR
+ Analog::ERROR
);
throw new Exception('Unknown mode.');
exit(0);
* @since Available since 0.62
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_members.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2012-12-17
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\Db as Db;
require_once 'includes/galette.inc.php';
if ( GALETTE_MODE === 'DEMO' ) {
- $log->log(
+ Analog::log(
'Trying to access ajax_plugins_initdb.php in DEMO mode.',
- KLogger::WARN
+ Analog::WARNING
);
die();
}
if ( !$login->isLogged() || !$login->isAdmin() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_members.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
}
if ( $plugin === null ) {
- $log->log(
+ Analog::log(
'Unable to load plugin `' . $plugid . '`!',
- KLogger::EMERG
+ Analog::URGENT
);
die();
}
$success_detected[] = $w1 . ' ' . $w2 . ' ' . $w3 .
' ' . $extra;
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Error executing query | ' . $e->getMessage() .
' | Query was: ' . $query,
- KLogger::WARN
+ Analog::WARNING
);
if ( (strcasecmp(trim($w1), 'drop') != 0)
&& (strcasecmp(trim($w1), 'rename') != 0)
* @since Available since 0.7dev - 2011-09-13
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_recipients.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2012-01-22
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
$name = $_POST['gname'];
if ( !$name ) {
- $log->log(
+ Analog::log(
'Trying to check if group name is unique without name specified',
- KLogger::INFO
+ Analog::INFO
);
die();
}
if ( !$login->isLogged() || !$login->isAdmin() && !$login->isStaff() ) {
- $log->log(
+ Analog::log(
'Trying to display ajax_group.php without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.62
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\GaletteMail as GaletteMail;
use Galette\Entity\Adherent as Adherent;
use Galette\Entity\FieldsConfig as FieldsConfig;
}
if ( $add_groups === true ) {
if ( isset ($_POST['groups_adh']) ) {
- $log->log(
+ Analog::log(
'Member .' . $member->sname . ' has been added to groups ' .
print_r($_POST['groups_adh'], true),
- KLogger::INFO
+ Analog::INFO
);
} else {
- $log->log(
+ Analog::log(
'Member .' . $member->sname . ' has not been added to groups ' .
print_r($_POST['groups_adh'], true),
- KLogger::ERR
+ Analog::ERROR
);
$error_detected[] = _T("An error occured adding member to its groups.");
}
} else {
- $log->log(
+ Analog::log(
'Member .' . $member->sname . ' has been detached of ' .
'his groups.',
- KLogger::INFO
+ Analog::INFO
);
}
} else {
}
}
} else if ($_FILES['photo']['error'] !== UPLOAD_ERR_NO_FILE) {
- $log->log(
+ Analog::log(
$member->picture->getPhpErrorMessage($_FILES['photo']['error']),
- KLogger::WARN
+ Analog::WARNING
);
$error_detected[] = $member->picture->getPhpErrorMessage(
$_FILES['photo']['error']
if ( !$member->picture->delete($member->id) ) {
$error_detected[] = _T("Delete failed");
$str_adh = $member->id . ' (' . $member->sname . ' ' . ')';
- $log->log(
+ Analog::log(
'Unable to delete picture for member ' . $str_adh,
- KLogger::ERR
+ Analog::ERROR
);
}
}
use Galette\IO\Pdf;
use Galette\Repository\Members;
use Galette\Filters\MembersList;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
}
if ( count($filters->selected) == 0 ) {
- $log->log('No member selected to generate attendance sheet', KLogger::INFO);
+ Analog::log('No member selected to generate attendance sheet', Analog::INFO);
header('location:gestion_adherents.php');
die();
}
*/
use Galette\IO\Pdf;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
$unique = $_GET[Galette\Entity\Adherent::PK];
} else {
if ( count($filters->selected) == 0 ) {
- $log->log('No member selected to generate members cards', KLogger::INFO);
+ Analog::log('No member selected to generate members cards', Analog::INFO);
if ( $login->isAdmin() || $login->isStaff() ) {
header('location:gestion_adherents.php');
} else {
);
if ( !is_array($members) || count($members) < 1 ) {
- $log->log('An error has occured, unable to get members list.', KLogger::ERR);
+ Analog::log('An error has occured, unable to get members list.', Analog::ERROR);
die();
}
if ( !defined('GALETTE_ZEND_PATH') ) {
define('GALETTE_ZEND_PATH', GALETTE_ROOT . 'includes/Zend-' . ZEND_VERSION);
}
+if ( !defined('GALETTE_ANALOG_PATH') ) {
+ define('GALETTE_ANALOG_PATH', GALETTE_ROOT . 'includes/Analog-' . ANALOG_VERSION);
+}
if ( !defined('GALETTE_PHP_MAILER_PATH') ) {
define('GALETTE_PHP_MAILER_PATH', GALETTE_ROOT . 'includes/phpMailer-' . PHP_MAILER_VERSION);
}
*/
define('SMARTY_VERSION', '3.1.12');
define('ZEND_VERSION', '1.11.11');
+define('ANALOG_VERSION', '1.0.0.git876d8a3bb');
define('TCPDF_VERSION', '5.9.202');
define('JQUERY_VERSION', '1.6.2');
define('JQUERY_UI_VERSION', '1.8.14');
* @since Availaible since 0.7dev - 2009-04-11
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Adherent as Adherent;
use Galette\Entity\FieldsCategories as FieldsCategories;
use Galette\Entity\FieldsConfig as FieldsConfig;
$fc = new FieldsConfig(Adherent::TABLE, $a->fields);
break;
default:
- $log->log(
+ Analog::log(
'Trying to configure fields on unknown table (' . $current . ')',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
use Galette\Entity\DynamicFields as DynamicFields;
use Galette\DynamicFieldsTypes\DynamicFieldType as DynamicFieldType;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
}
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured adding new dynamic field. | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
/** FIXME */
//this one does not seem to work :'(
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to change field ' . $field_id . ' rank | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
* @since Available since 0.62
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\DynamicFields as DynamicFields;
use Galette\DynamicFieldsTypes\DynamicFieldType as DynamicFieldType;
}
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured checking field duplicity' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
);
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured storing field | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
$error_detected[] = _T("An error occured storing the field.");
}
} catch (Exception $e) {
/** FIXME */
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to manage fields values table ' .
$contents_table . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
$error_detected[] = _T("An error occured storing managing fields values table");
}
}catch (Exception $e) {
/** FIXME */
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to store field ' . $field_id . ' values',
- KLogger::ERR
+ Analog::ERROR
);
}
}
*/
use Galette\IO\Pdf;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
$members = $mailing->unreachables;
} else {
if ( count($filters->selected) == 0 ) {
- $log->log('No member selected to generate labels', KLogger::INFO);
+ Analog::log('No member selected to generate labels', Analog::INFO);
header('location:gestion_adherents.php');
die();
}
* @link http://galette.tuxfamily.org
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
require_once 'includes/galette.inc.php';
if ( $login->isGroupManager($id) ) {
$group->load($id);
} else {
- $log->log(
+ Analog::log(
'Trying to display group ' . $id . ' without appropriate permissions',
- KLogger::INFO
+ Analog::INFO
);
die();
}
* @since Available since 0.7dev - 2011-11-05
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
if ( !isset($_GET['file']) ) {
- $log->log(
+ Analog::log(
'No requested file',
- KLogger::INFO
+ Analog::INFO
);
header("HTTP/1.1 500 Internal Server Error");
die();
header('Pragma: no-cache');
readfile(Csv::DEFAULT_DIRECTORY . $filename);
} else {
- $log->log(
+ Analog::log(
'A request has been made to get an exported file named `' .
$filename .'` that does not exists.',
- KLogger::WARN
+ Analog::WARNING
);
header('HTTP/1.0 404 Not Found');
}
} else {
- $log->log(
+ Analog::log(
'A non authorized person asked to retrieve exported file named `' .
$filename . '`. Access ha not been granted.',
- KLogger::WARN
+ Analog::WARNING
);
header('HTTP/1.0 403 Forbidden');
}
die("Sorry. You can't access directly to this file");
}
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
function PasswordImageName($c)
{
global $log;
$val = get_form_value($name, $defval);
if ( !is_numeric($val) ) {
- $log->log(
+ Analog::log(
'[get_numeric_form_value] not a numeric value! (value was: `' .
$val . '`)',
- KLogger::INFO
+ Analog::INFO
);
$val = $defval;
}
header('location: install/index.php');
}
+if ( file_exists(GALETTE_CONFIG_PATH . 'behavior.inc.php') ) {
+ include_once GALETTE_CONFIG_PATH . 'behavior.inc.php';
+}
+
if ( !$installer || $installed ) { //If we're not working from installer
require_once GALETTE_CONFIG_PATH . 'config.inc.php';
}
}
use Galette\Common\ClassLoader;
-use Galette\Common\KLogger;
+use Analog\Analog as Analog;
use Galette\Core;
require_once GALETTE_ROOT . 'lib/Galette/Common/ClassLoader.php';
$galetteLoader = new ClassLoader('Galette', GALETTE_ROOT . 'lib');
$zendLoader = new ClassLoader('Zend', GALETTE_ZEND_PATH);
$zendLoader->setNamespaceSeparator('_');
+$analogLoader = new ClassLoader('Analog', GALETTE_ANALOG_PATH);
$smartyLoader = new ClassLoader(null, GALETTE_SMARTY_PATH);
$smartyLoader->setFileExtension('.class.php');
//register loaders
$galetteLoader->register();
$zendLoader->register();
+$analogLoader->register();
$smartyLoader->register();
//we start a php session
define('GALETTE_VERSION', 'v0.7.3dev');
define('GALETTE_COMPAT_VERSION', '0.7.3');
define('GALETTE_DB_VERSION', '0.701');
-define('GALETTE_MODE', 'PROD'); //DEV or PROD
+if ( !defined('GALETTE_MODE') ) {
+ define('GALETTE_MODE', 'PROD'); //DEV, PROD or DEMO
+}
define('GALETTE_TWITTER', 'galette_soft');
define('GALETTE_GPLUS', '116977415489200387309');
define('GALETTE_GAPI_KEY', 'AIzaSyDT8Xkud_SdSHdvaagjePrpPoji2ySIZ7Q');
);
}
-@ini_set('display_errors', 0);
+if ( !defined('GALETTE_DISPLAY_ERRORS') ) {
+ define('GALETTE_DISPLAY_ERRORS', 0);
+}
+ini_set('display_errors', GALETTE_DISPLAY_ERRORS);
set_include_path(
GALETTE_ZEND_PATH . PATH_SEPARATOR .
);
/*------------------------------------------------------------------------------
-Error severity, from low to high. From BSD syslog RFC, secion 4.1.1
-@link http://www.faqs.org/rfcs/rfc3164.html
-
-KLogger::EMERG => System is unusable
-KLogger::ALERT => Immediate action required
-KLogger::CRIT => Critical conditions
-KLogger::ERR => Error conditions
-KLogger::WARN => Warning conditions
-KLogger::NOTICE => Normal but significant
-KLogger::INFO => Informational messages
-KLogger::DEBUG => Debug-level messages
+Logger stuff
------------------------------------------------------------------------------*/
-if ( !isset($logfile) ) {
- $logfile = 'galette_run';
+if ( !defined('GALETTE_HANDLE_ERRORS')
+ || GALETTE_HANDLE_ERRORS === true
+) {
+ //set custom error handler
+ set_error_handler(
+ array(
+ "Galette\Core\Error",
+ "errorHandler"
+ )
+ );
+}
+
+$now = new \DateTime();
+$galette_run_log = null;
+$galette_null_log = \Analog\Handler\Null::init();
+$dbg_log_path = GALETTE_LOGS_PATH . 'galette_debug_' .
+ $now->format('Y-m-d') . '.log';
+$galette_debug_log = \Analog\Handler\File::init($dbg_log_path);
+
+if ( GALETTE_MODE === 'DEV'
+ || ( defined('GALETTE_SYS_LOG') && GALETTE_SYS_LOG === true )
+) {
+ //logs everything in PHP logs (per chance /var/log/http/error_log)
+ $galette_run_log = \Analog\Handler\Stderr::init();
+} else {
+ //logs everything in galette log file
+ if ( !isset($logfile) ) {
+ //if no filename has been setetd (ie. from install), set default one
+ $logfile = 'galette_run';
+ }
+ $log_path = GALETTE_LOGS_PATH . $logfile . '_' .
+ $now->format('Y-m-d') . '.log';
+ $galette_run_log = \Analog\Handler\File::init($log_path);
+}
+
+//Log level cannot be <= 3, would be ignored.
+if ( !defined('GALETTE_LOG_LVL') ) {
+ if ( GALETTE_MODE === 'DEV' ) {
+ define('GALETTE_LOG_LVL', 10);
+ } else {
+ define('GALETTE_LOG_LVL', 5);
+ }
}
-$log = new KLogger(GALETTE_LOGS_PATH, KLogger::INFO, $logfile);
-//set custom error handler
-set_error_handler(
- array(
- "Galette\Core\Error",
- "errorHandler"
+Analog::handler(
+ \Analog\Handler\Multi::init(
+ array (
+ Analog::URGENT => $galette_run_log,
+ Analog::ALERT => $galette_run_log,
+ Analog::CRITICAL => $galette_run_log,
+ Analog::ERROR => $galette_run_log,
+ Analog::WARNING => (GALETTE_LOG_LVL >= Analog::WARNING)
+ ? $galette_run_log : $galette_null_log,
+ Analog::NOTICE => (GALETTE_LOG_LVL >= Analog::NOTICE)
+ ? $galette_run_log : $galette_null_log,
+ Analog::INFO => (GALETTE_LOG_LVL >= Analog::INFO)
+ ? $galette_run_log : $galette_null_log,
+ Analog::DEBUG => (GALETTE_LOG_LVL >= Analog::DEBUG)
+ ? $galette_debug_log : $galette_null_log
+ )
)
);
*/
$zdb = new Core\Db();
- if ( $zdb->checkDbVersion() || strpos($_SERVER['PHP_SELF'], 'picture.php') !== false ) {
+ if ( $zdb->checkDbVersion()
+ || strpos($_SERVER['PHP_SELF'], 'picture.php') !== false
+ ) {
/**
* Load preferences
die("Sorry. You can't access directly to this file");
}
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
$disable_gettext=true;
$values = array(
'text_nref' => new Zend_Db_Expr('text_nref+1')
);
- $log->log(
+ Analog::log(
'Entry for `' . $text_orig .
'` dynamic translation already exists.',
- KLogger::INFO
+ Analog::INFO
);
$zdb->db->update(
$l10n_table,
}
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured adding dynamic translation for `' .
$text_orig . '` | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return true;
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured deleting dynamic translation for `' .
$text_orig . '` (lang `' . $lang->getLongID() . '`) | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return true;
} catch (Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured updating dynamic translation for `' .
$text_orig . '` | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $select->query()->fetch()->text_trans;
} catch (Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured retrieving l10n entry. text_orig=' . $text_orig .
', text_locale=' . $text_locale . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
echo '<li class="install-ok">' . $w1 . ' ' . $w2 . ' ' . $w3 .
' ' . $extra . '</li>';
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Error executing query | ' . $e->getMessage() .
' | Query was: ' . $query,
- Galette\Common\KLogger::WARN
+ Galette\Common\Analog::WARNING
);
echo '<li class="install-bad debuginfos">' . $w1 . ' ' . $w2 .
' ' . $w3 . ' ' . $extra . '<span>' . $e->getMessage() .
+++ /dev/null
-<?php\r
-\r
-/**\r
- * Finally, a light, permissions-checking logging class.\r
- * Originally inspired from:\r
- * https://github.com/katzgrau/KLogger/\r
- *\r
- * Originally written for use with wpSearch\r
- * Minimally refactored to be used with Galette\r
- *\r
- * Usage:\r
- * $log = new KLogger('/var/log/', KLogger::INFO );\r
- * $log->logInfo('Returned a million search results'); //Prints to the log file\r
- * $log->logFatal('Oh dear.'); //Prints to the log file\r
- * $log->logDebug('x = 5'); //Prints nothing due to current severity threshhold\r
- *\r
- * PHP VERSION 5\r
- *\r
- * @category Libraries\r
- * @package Logger\r
- * @author Kenny Katzgrau <katzgrau@gmail.com>\r
- * @author Johan Cwiklinski <johan@x-tnd.be>\r
- * @license MIT http://en.wikipedia.org/wiki/MIT_License\r
- * @version SVN: $id$\r
- * @link http://codefury.net - http://galette.tuxfamily.org\r
- * @since July 26, 2008 - 0.7.1dev 2012-05-07\r
- */\r
-\r
-namespace Galette\Common;\r
-\r
-/**\r
- * Class documentation\r
- *\r
- * @category Libraries\r
- * @package Logger\r
- * @author Kenny Katzgrau <katzgrau@gmail.com>\r
- * @author Johan Cwiklinski <johan@x-tnd.be>\r
- * @license MIT http://en.wikipedia.org/wiki/MIT_License\r
- * @version Release: 0.1\r
- * @link http://codefury.net - http://galette.tuxfamily.org\r
- * @since July 26, 2008 - 0.7.1dev 2012-05-07\r
- */\r
-class KLogger\r
-{\r
- /**\r
- * Error severity, from low to high. From BSD syslog RFC, secion 4.1.1\r
- * @link http://www.faqs.org/rfcs/rfc3164.html\r
- */\r
- const EMERG = 0; // Emergency: system is unusable\r
- const ALERT = 1; // Alert: action must be taken immediately\r
- const CRIT = 2; // Critical: critical conditions\r
- const ERR = 3; // Error: error conditions\r
- const WARN = 4; // Warning: warning conditions\r
- const NOTICE = 5; // Notice: normal but significant condition\r
- const INFO = 6; // Informational: informational messages\r
- const DEBUG = 7; // Debug: debug messages\r
-\r
- //custom logging level\r
- /**\r
- * Log nothing at all\r
- */\r
- const OFF = 8;\r
- /**\r
- * Alias for CRIT\r
- * @deprecated\r
- */\r
- const FATAL = 2;\r
-\r
- /**\r
- * Internal status codes\r
- */\r
- const STATUS_LOG_OPEN = 1;\r
- const STATUS_OPEN_FAILED = 2;\r
- const STATUS_LOG_CLOSED = 3;\r
-\r
- /**\r
- * Current status of the log file\r
- * @var integer\r
- */\r
- private $_logStatus = self::STATUS_LOG_CLOSED;\r
- /**\r
- * Holds messages generated by the class\r
- * @var array\r
- */\r
- private $_messageQueue = array();\r
- /**\r
- * Path to the log file\r
- * @var string\r
- */\r
- private $_logFilePath = null;\r
- /**\r
- * Log filename\r
- * @var string\r
- */\r
- private $_logFileName = 'log';\r
- /**\r
- * Current minimum logging threshold\r
- * @var integer\r
- */\r
- private $_severityThreshold = self::INFO;\r
- /**\r
- * This holds the file handle for this instance's log file\r
- * @var resource\r
- */\r
- private $_fileHandle = null;\r
-\r
- /**\r
- * Standard messages produced by the class. Can be modified for il8n\r
- * @var array\r
- */\r
- private $_messages = array(\r
- //'writefail' => 'The file exists, but could not be opened for writing. Check that appropriate permissions have been set.',\r
- 'writefail' => 'The file could not be written to. Check that appropriate permissions have been set.',\r
- 'opensuccess' => 'The log file was opened successfully.',\r
- 'openfail' => 'The file could not be opened. Check permissions.',\r
- );\r
-\r
- /**\r
- * Default severity of log messages, if not specified\r
- * @var integer\r
- */\r
- private static $_defaultSeverity = self::DEBUG;\r
- /**\r
- * Valid PHP date() format string for log timestamps\r
- * @var string\r
- */\r
- private static $_dateFormat = 'Y-m-d G:i:s';\r
- /**\r
- * Octal notation for default permissions of the log file\r
- * @var integer\r
- */\r
- private static $_defaultPermissions = 0777;\r
- /**\r
- * Array of KLogger instances, part of Singleton pattern\r
- * @var array\r
- */\r
- private static $instances = array();\r
-\r
- /**\r
- * Partially implements the Singleton pattern. Each $logDirectory gets one\r
- * instance.\r
- *\r
- * @param string $logDirectory File path to the logging directory\r
- * @param integer $severity One of the pre-defined severity constants\r
- *\r
- * @return KLogger\r
- */\r
- public static function instance($logDirectory = false, $severity = false)\r
- {\r
- if ($severity === false) {\r
- $severity = self::$_defaultSeverity;\r
- }\r
-\r
- if ($logDirectory === false) {\r
- if (count(self::$instances) > 0) {\r
- return current(self::$instances);\r
- } else {\r
- $logDirectory = dirname(__FILE__);\r
- }\r
- }\r
-\r
- if (in_array($logDirectory, self::$instances)) {\r
- return self::$instances[$logDirectory];\r
- }\r
-\r
- self::$instances[$logDirectory] = new self($logDirectory, $severity);\r
-\r
- return self::$instances[$logDirectory];\r
- }\r
-\r
- /**\r
- * Class constructor\r
- *\r
- * @param string $logDirectory File path to the logging directory\r
- * @param integer $severity One of the pre-defined severity constants\r
- * @param string $logFileName Log's filename\r
- *\r
- * @return void\r
- */\r
- public function __construct($logDirectory, $severity, $logFileName = null)\r
- {\r
- $logDirectory = rtrim($logDirectory, '\\/');\r
-\r
- if ($severity === self::OFF) {\r
- return;\r
- }\r
-\r
- if ( $logFileName !== null ) {\r
- $this->_logFileName = $logFileName;\r
- }\r
- $this->_logFilePath = $logDirectory\r
- . DIRECTORY_SEPARATOR\r
- . $this->_logFileName . '_'\r
- . date('Y-m-d')\r
- . '.log';\r
-\r
- $this->_severityThreshold = $severity;\r
- if (!file_exists($logDirectory)) {\r
- mkdir($logDirectory, self::$_defaultPermissions, true);\r
- }\r
-\r
- if (file_exists($this->_logFilePath) && !is_writable($this->_logFilePath)) {\r
- $this->_logStatus = self::STATUS_OPEN_FAILED;\r
- $this->_messageQueue[] = $this->_messages['writefail'];\r
- return;\r
- }\r
-\r
- if (($this->_fileHandle = fopen($this->_logFilePath, 'a'))) {\r
- $this->_logStatus = self::STATUS_LOG_OPEN;\r
- $this->_messageQueue[] = $this->_messages['opensuccess'];\r
- } else {\r
- $this->_logStatus = self::STATUS_OPEN_FAILED;\r
- $this->_messageQueue[] = $this->_messages['openfail'];\r
- }\r
- }\r
-\r
- /**\r
- * Class destructor\r
- */\r
- public function __destruct()\r
- {\r
- if ($this->_fileHandle) {\r
- fclose($this->_fileHandle);\r
- }\r
- }\r
- /**\r
- * Writes a $line to the log with a severity level of DEBUG\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logDebug($line)\r
- {\r
- $this->log($line, self::DEBUG);\r
- }\r
-\r
- /**\r
- * Returns (and removes) the last message from the queue.\r
- *\r
- * @return string\r
- */\r
- public function getMessage()\r
- {\r
- return array_pop($this->_messageQueue);\r
- }\r
-\r
- /**\r
- * Returns the entire message queue (leaving it intact)\r
- *\r
- * @return array\r
- */\r
- public function getMessages()\r
- {\r
- return $this->_messageQueue;\r
- }\r
-\r
- /**\r
- * Empties the message queue\r
- *\r
- * @return void\r
- */\r
- public function clearMessages()\r
- {\r
- $this->_messageQueue = array();\r
- }\r
-\r
- /**\r
- * Sets the date format used by all instances of KLogger\r
- * \r
- * @param string $dateFormat Valid format string for date()\r
- *\r
- * @return void\r
- */\r
- public static function setDateFormat($dateFormat)\r
- {\r
- self::$_dateFormat = $dateFormat;\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of INFO. Any information\r
- * can be used here, or it could be used with E_STRICT errors\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logInfo($line)\r
- {\r
- $this->log($line, self::INFO);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of NOTICE. Generally\r
- * corresponds to E_STRICT, E_NOTICE, or E_USER_NOTICE errors\r
- *\r
- * @param string $line Information to log\r
- * \r
- * @return void\r
- */\r
- public function logNotice($line)\r
- {\r
- $this->log($line, self::NOTICE);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of WARN. Generally\r
- * corresponds to E_WARNING, E_USER_WARNING, E_CORE_WARNING, or \r
- * E_COMPILE_WARNING\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logWarn($line)\r
- {\r
- $this->log($line, self::WARN);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of ERR. Most likely used\r
- * with E_RECOVERABLE_ERROR\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logError($line)\r
- {\r
- $this->log($line, self::ERR);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of FATAL. Generally\r
- * corresponds to E_ERROR, E_USER_ERROR, E_CORE_ERROR, or E_COMPILE_ERROR\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- * @deprecated Use logCrit\r
- */\r
- public function logFatal($line)\r
- {\r
- $this->log($line, self::FATAL);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of ALERT.\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logAlert($line)\r
- {\r
- $this->log($line, self::ALERT);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of CRIT.\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logCrit($line)\r
- {\r
- $this->log($line, self::CRIT);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with a severity level of EMERG.\r
- *\r
- * @param string $line Information to log\r
- *\r
- * @return void\r
- */\r
- public function logEmerg($line)\r
- {\r
- $this->log($line, self::EMERG);\r
- }\r
-\r
- /**\r
- * Writes a $line to the log with the given severity\r
- *\r
- * @param string $line Text to add to the log\r
- * @param integer $severity Severity level of log message (use constants)\r
- *\r
- * @return void\r
- */\r
- public function log($line, $severity)\r
- {\r
- if ($this->_severityThreshold >= $severity) {\r
- $status = $this->_getTimeLine($severity);\r
- $this->writeFreeFormLine("$status $line \n");\r
- }\r
- }\r
-\r
- /**\r
- * Writes a line to the log without prepending a status or timestamp\r
- *\r
- * @param string $line Line to write to the log\r
- *\r
- * @return void\r
- */\r
- public function writeFreeFormLine($line)\r
- {\r
- if ($this->_logStatus == self::STATUS_LOG_OPEN\r
- && $this->_severityThreshold != self::OFF\r
- ) {\r
- if (fwrite($this->_fileHandle, $line) === false) {\r
- $this->_messageQueue[] = $this->_messages['writefail'];\r
- }\r
- }\r
- }\r
-\r
- private function _getTimeLine($level)\r
- {\r
- $time = date(self::$_dateFormat);\r
-\r
- switch ($level) {\r
- case self::EMERG:\r
- return "$time - EMERG -->";\r
- case self::ALERT:\r
- return "$time - ALERT -->";\r
- case self::CRIT:\r
- return "$time - CRIT -->";\r
- case self::FATAL: // FATAL is an alias of CRIT\r
- return "$time - FATAL -->";\r
- case self::NOTICE:\r
- return "$time - NOTICE -->";\r
- case self::INFO:\r
- return "$time - INFO -->";\r
- case self::WARN:\r
- return "$time - WARN -->";\r
- case self::DEBUG:\r
- return "$time - DEBUG -->";\r
- case self::ERR:\r
- return "$time - ERROR -->";\r
- default:\r
- return "$time - LOG -->";\r
- }\r
- }\r
-}\r
namespace Galette\Common;
+use Analog\Analog as Analog;
+
/**
* class XHProf
*
) {
xhprof_enable(XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_CPU | XHPROF_FLAGS_MEMORY);
if ( $log ) {
- $log->log(
+ Analog::log(
'Start profiling with XHProf ' . $msg,
- KLogger::INFO
+ Analog::INFO
);
}
self::$_run = true;
$host = (defined('XHPROF_HOST') ? XHPROF_HOST : $_SERVER['HTTP_HOST']);
$link = 'http://' . $host .$url . '/index.php?run=' .
$id . '&source=galette-' . GALETTE_VERSION;
- $log->log(
+ Analog::log(
'Stop profiling with XHProf, result URL: ' . $link,
- KLogger::INFO
+ Analog::INFO
);
self::$_run = false;
namespace Galette\Core;
-use Galette\Common\Klogger as KLogger;
+use Analog\Analog as Analog;
/**
* Zend_Db wrapper
*/
function __construct()
{
- global $log;
-
$_type = null;
try {
if ( TYPE_DB === 'mysql' ) {
);
$this->_db->getConnection();
$this->_db->setFetchMode(\Zend_Db::FETCH_OBJ);
- $log->log(
- '[ZendDb] Database connection was successfull!',
- KLogger::DEBUG
+ Analog::log(
+ '[Db] Database connection was successfull!',
+ Analog::DEBUG
);
} catch (\Zend_Db_Adapter_Exception $e) {
// perhaps a failed login credential, or perhaps the RDBMS is not running
$ce = $e->getChainedException();
- $log->log(
- '[ZendDb] No connexion (' . $ce->getCode() . '|' .
+ Analog::log(
+ '[Db] No connexion (' . $ce->getCode() . '|' .
$ce->getMessage() . ')',
- KLogger::ALERT
+ Analog::ALERT
);
throw $e;
} catch (\Exception $e) {
// perhaps factory() failed to load the specified Adapter class
- $log->log(
- '[ZendDb] Error (' . $e->getCode() . '|' .
+ Analog::log(
+ '[Db] Error (' . $e->getCode() . '|' .
$e->getMessage() . ')',
- KLogger::ALERT
+ Analog::ALERT
);
throw $e;
}
*/
public function checkDbVersion()
{
- global $log;
try {
$select = new \Zend_Db_Select($this->db);
$select->from(
$res = $select->query()->fetch();
return $res->version === GALETTE_DB_VERSION;
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Cannot check database version: ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
*/
public static function testConnectivity($type, $user, $pass, $host, $port, $db)
{
- global $log;
-
$_type = null;
try {
if ( $type === 'mysql' ) {
$_db->getConnection();
$_db->setFetchMode(\Zend_Db::FETCH_OBJ);
$_db->closeConnection();
- $log->log(
+ Analog::log(
'[' . __METHOD__ . '] Database connection was successfull!',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
} catch (\Zend_Db_Adapter_Exception $e) {
$_code = $ce->getCode();
$_msg = $ce->getMessage();
}
- $log->log(
+ Analog::log(
'[' . __METHOD__ . '] No connexion (' . $_code . '|' .
$_msg . ')',
- KLogger::ALERT
+ Analog::ALERT
);
return $e;
} catch (\Exception $e) {
// perhaps factory() failed to load the specified Adapter class
- $log->log(
+ Analog::log(
'[' . __METHOD__ . '] Error (' . $e->getCode() . '|' .
$e->getMessage() . ')',
- KLogger::ALERT
+ Analog::ALERT
);
return $e;
}
*/
public function dropTestTable()
{
- global $log;
-
try {
$this->_db->query('DROP TABLE IF EXISTS galette_test');
- $log->log('Test table successfully dropped.', KLogger::DEBUG);
+ Analog::log('Test table successfully dropped.', Analog::DEBUG);
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot drop test table! ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
}
*/
public function grantCheck($mode = 'i')
{
- global $log;
-
- $log->log(
+ Analog::log(
'Check for database rights (mode ' . $mode . ')',
- KLogger::DEBUG
+ Analog::DEBUG
);
$stop = false;
$results = array(
$this->_db->getConnection()->exec($sql);
$results['create'] = true;
} catch (\Exception $e) {
- $log->log('Cannot CREATE TABLE', KLogger::WARN);
+ Analog::log('Cannot CREATE TABLE', Analog::WARNING);
//if we cannot create tables, we cannot check other permissions
$stop = true;
$results['create'] = $e;
$this->_db->getConnection()->exec($sql);
$results['alter'] = true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot ALTER TABLE | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
$results['alter'] = $e;
}
throw new \Exception('No row inserted!');
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot INSERT records | ' .$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
//if we cannot insert records, some others tests cannot be done
$stop = true;
throw new \Exception('No row updated!');
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot UPDATE records | ' .$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
$results['update'] = $e;
}
throw new \Exception('Select is empty!');
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot SELECT records | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
$results['select'] = $e;
}
);
$results['delete'] = true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot DELETE records | ' .$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
$results['delete'] = $e;
}
$this->_db->getConnection()->exec($sql);
$results['drop'] = true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot DROP TABLE | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
$results['drop'] = $e;
}
' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
$this->_db->getConnection()->exec($query);
- $log->log(
+ Analog::log(
'Charset successfully changed for table `' . $table .'`',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
$this->_db->commit();
} catch (\Exception $e) {
$this->_db->rollBack();
- $log->log(
+ Analog::log(
'An error occured while converting to utf table ' .
$table . ' (' . $e->getMessage() . ')',
- KLogger::ERR
+ Analog::ERROR
);
}
}
$this->_db->getConnection()->exec($query);
}catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot SET NAMES on table `' . $table . '`. ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
);
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured while converting contents to UTF-8 for table ' .
$table . ' (' . $e->getMessage() . ')',
- KLogger::ERR
+ Analog::ERROR
);
}
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Error handler
switch ($errno) {
case E_STRICT:
- $log->log(
+ Analog::log(
str_replace(
$patterns,
array('Strict standards', $errstr, $errfile, $errline),
$str
),
- KLogger::INFO
+ Analog::NOTICE
);
break;
case E_DEPRECATED:
case E_USER_DEPRECATED:
- $log->log(
+ Analog::log(
str_replace(
$patterns,
array('Deprecated', $errstr, $errfile, $errline),
$str
),
- KLogger::INFO
+ Analog::NOTICE
);
break;
case E_NOTICE:
case E_USER_NOTICE:
//do not log smarty's annonying 'undefined index' notices
if ( !preg_match('/^Undefined index/', $errstr)
- && !preg_match('/\.tpl\.php$/', $errfile) ) {
- $log->log(
+ && !preg_match('/\.tpl\.php$/', $errfile)
+ ) {
+ Analog::log(
str_replace(
$patterns,
array('Notice', $errstr, $errfile, $errline),
$str
),
- KLogger::INFO
+ Analog::NOTICE
);
}
break;
case E_WARNING:
case E_USER_WARNING:
- $log->log(
+ Analog::log(
str_replace(
$patterns,
array('Warning', $errstr, $errfile, $errline),
$str
),
- KLogger::WARN
+ Analog::WARNING
);
break;
case E_ERROR:
case E_USER_ERROR:
- $log->log(
+ Analog::log(
str_replace(
$patterns,
array('Fatal', $errstr, $errfile, $errline),
$str
),
- KLogger::ERR
+ Analog::ERROR
);
+ throw new ErrorException(
+ 'Fatal error: ' . $errstr,
+ $errno,
+ $errfile,
+ $errline
+ );
+
exit("FATAL error $errstr at $errfile:$errline");
default:
- $log->log(
+ Analog::log(
str_replace(
$patterns,
array('Unknown', $errstr, $errfile, $errline),
$str
),
- KLogger::ERR
+ Analog::ERROR
+ );
+ throw new ErrorException(
+ 'Unknown error: ' . $errstr,
+ $errno,
+ $errfile,
+ $errline
);
- exit("Unknown error at $errfile:$errline");
}
}
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'class.phpmailer.php';
// set the SMTP port for the SMTP server
$this->_mail->Port = $preferences->pref_mail_smtp_port;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) .
']No SMTP port provided. Switch to default (25).',
- KLogger::INFO
+ Analog::INFO
);
$this->_mail->Port = 25;
}
//- clear BCCs
//- log an INFO
$res = false;
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'] One of recipients adress is not valid.',
- KLogger::INFO
+ Analog::INFO
);
$this->_mail->ClearBCCs();
break;
if ( !$this->_mail->Send() ) {
$m = $this->_mail;
$this->_errors[] = $this->_mail->ErrorInfo;
- $log->log(
+ Analog::log(
'An error occured sending mail to: ' .
implode(', ', array_keys($this->_recipients)),
- KLogger::INFO
+ Analog::INFO
);
$this->_mail = null;
return self::MAIL_ERROR;
foreach ( $this->_recipients as $k=>$v ) {
$txt .= $v . ' (' . $k . '), ';
}
- $log->log(
+ Analog::log(
'A mail has been sent to: ' . $txt,
- KLogger::INFO
+ Analog::INFO
);
$this->_mail = null;
return self::MAIL_SENT;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Error sending message: ' . $e.getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
$this->errors[] = $e->getMessage();
$this->_mail = null;
global $log;
$valid = \PHPMailer::ValidateAddress($address);
if ( !$valid ) {
- $log->log(
+ Analog::log(
'[GaletteMail] Adresss `' . $address . '` is not valid ',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
return $valid;
$url
);
if ( !$valid ) {
- $log->log(
+ Analog::log(
'[GaletteMail] `' . $url . '` is not an url',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
return $valid;
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* History management
$zdb->db->insert(PREFIX_DB . self::TABLE, $values);
} catch (\Zend_Db_Adapter_Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize add log entry into database.' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
"An error occured trying to add log entry. " . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$result = $zdb->db->query('TRUNCATE TABLE ' . $this->getTableName());
if ( !$result ) {
- $log->log(
+ Analog::log(
'An error occured cleaning history. ',
- KLogger::WARN
+ Analog::WARNING
);
$this->add('Arror flushing logs');
return false;
return true;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Unable to flush logs. | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
}
$c = $this->getCount();
if ($c == 0) {
- $log->log('No entry in history (yet?).', KLogger::DEBUG);
+ Analog::log('No entry in history (yet?).', Analog::DEBUG);
return;
} else {
$this->counter = (int)$c;
return $select->query(\Zend_Db::FETCH_ASSOC)->fetchAll();
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Unable to get history. | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $select->query()->fetchObject()->counter;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Unable to get history count. | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
{
global $log;
- $log->log(
+ Analog::log(
'[History] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields) ) {
return $d->format(_T("Y-m-d H:i:s"));
} catch (\Exception $e) {
//oops, we've got a bad date :/
- $log->log(
+ Analog::log(
'Bad date (' . $this->$rname . ') | ' .
$e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
return $this->$rname;
}
break;
}
} else {
- $log->log(
+ Analog::log(
'[History] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
if ( in_array($name, $this->pagination_fields) ) {
parent::__set($name, $value);
} else {
- $log->log(
+ Analog::log(
'[History] Setting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
$forbidden = array();
break;
}
} else {
- $log->log(
+ Analog::log(
'[History] Unable to set proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* i18n handling
public function changeLanguage($id)
{
global $log;
- $log->log('Trying to set locale to ' . $id, KLogger::DEBUG);
+ Analog::log('Trying to set locale to ' . $id, Analog::DEBUG);
$xml = simplexml_load_file($this->_file);
$current = $xml->xpath(
//if no match, switch to default
if ( !isset($current[0]) ) {
- $log->log(
+ Analog::log(
$id . ' does not exist in XML file, switching to default.',
- KLogger::WARN
+ Analog::WARNING
);
$id = self::DEFAULT_LANG;
//do not forget to reload informations from the xml file
use Galette\Repository\Members as Members;
use Galette\Entity\Adherent as Adherent;
use Galette\Entity\Status as Status;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Default authentication class for galette
*/
public function logIn($user, $passe)
{
- global $zdb, $log, $i18n;
+ global $zdb, $i18n;
try {
$select = new \Zend_Db_Select($zdb->db);
);
$select->where(self::PK . ' = ?', $user);
$select->where('mdp_adh = ?', $passe);
- $log->log(
+ Analog::log(
'Login query: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
$row = $zdb->db->fetchRow($select);
if ( $row === false ) {
- $log->log(
+ Analog::log(
'No entry found for login `' . $user . '`',
- KLogger::WARN
+ Analog::WARNING
);
return false;
} else {
- $log->log('User `' . $user . '` logged in.', KLogger::INFO);
+ Analog::log('User `' . $user . '` logged in.', Analog::INFO);
$this->id = $row->id_adh;
$this->login = $user;
$this->passe = $row->mdp_adh;
return true;
}
} catch (\Zend_Db_Adapter_Exception $e) {
- $log->log(
+ Analog::log(
'An error occured: ' . $e->getChainedException()->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log($e->getTrace(), KLogger::ERR);
+ Analog::log($e->getTrace(), Analog::ERROR);
return false;
} catch(\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured: ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log($e->getTrace(), KLogger::ERR);
+ Analog::log($e->getTrace(), Analog::ERROR);
return false;
}
}
*/
public function loginExists($user)
{
- global $zdb, $log;
+ global $zdb;
try {
$select = new \Zend_Db_Select($zdb->db);
return false;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot check if login exists | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
/* If an error occurs, we consider that username already exists */
return true;
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* This class stores and serve the logo.
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Mailing features
break;
default:
$rname = '_' . $name;
- $log->log(
+ Analog::log(
'[' . get_class($this) . 'Trying to get ' . $name .
' renamed: ' . $rname,
- KLogger::DEBUG
+ Analog::DEBUG
);
return $this->$rname;
break;
}
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) . 'Unable to get ' . $name .
' renamed: ' . $rname,
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
if ( is_bool($value) ) {
$this->isHTML($value);
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) . '] Value for field `' . $name .
'` should be boolean - (' . gettype($value) . ')' .
$value . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
) {
$this->_current_step = (int)$value;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) . '] Value for field `' . $name .
'` should be integer and know - (' . gettype($value) . ')' .
$value . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
default:
- $log->log(
+ Analog::log(
'[' . get_class($this) . '] Unable to set proprety `' . $name . '`',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Adherent;
/**
if ( $mailing instanceof Mailing ) {
$this->_mailing = $mailing;
} else if ( $mailing !== null ) {
- $log->log(
+ Analog::log(
'[' . __METHOD__ .
'] Mailing should be either null or an instance of Mailing',
- KLogger::ERR
+ Analog::ERROR
);
}
}
$c = $this->getCount();
if ($c == 0) {
- $log->log('No entry in history (yet?).', KLogger::DEBUG);
+ Analog::log('No entry in history (yet?).', Analog::DEBUG);
return;
} else {
$this->counter = (int)$c;
return $ret;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Unable to get history. | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$mailing->message = $res->mailing_body;
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to load mailing model #' . $id . ' | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
$this->_date = date('Y-m-d H:i:s');
$this->store();
} else {
- $log->log(
+ Analog::log(
'[' . __METHOD__ .
'] Mailing should be either null or an instance of Mailing',
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$zdb->db->insert(PREFIX_DB . self::TABLE, $values);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occurend storing Mailing | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to delete selected mailing history entries |' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
} else {
//not numeric and not an array: incorrect.
- $log->log(
+ Analog::log(
'Asking to remove mailing entries, but without providing an array or a single numeric value.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Pagination and ordering facilities
if ( $direction == self::ORDER_ASC || $direction == self::ORDER_DESC ) {
$this->_ordered = $direction;
} else {
- $log->log(
+ Analog::log(
'Trying to set a sort direction that is not know (`' .
$direction . '`). Reverting to default value.',
- KLogger::WARN
+ Analog::WARNING
);
$this->_ordered == self::ORDER_ASC;
}
{
global $log;
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'|Pagination] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields) ) {
$name = '_' . $name;
return $this->$name;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'|Pagination] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
{
global $log;
- $log->log(
+ Analog::log(
'[' . get_class($this) . '|Pagination] Setting property `' .
$name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
$rname = '_' . $name;
if ( $value == self::ORDER_ASC || $value == self::ORDER_DESC ) {
$this->$rname = $value;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'|Pagination] Possibles values for field `' .
$name . '` are: `' . self::ORDER_ASC . '` or `' .
self::ORDER_DESC . '` - `' . $value . '` given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
if ( is_int($value) && $value > 0 ) {
$this->$rname = $value;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'|Pagination] Value for field `' .
$name . '` should be a positive integer - (' .
gettype($value) . ')' . $value . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
) {
$this->$rname = (int)$value;
} else {
- $log->log(
+ Analog::log(
'[' . get_class($this) . '|Pagination] Value for `' .
$name . '` should be a positive integer or \'all\' - (' .
gettype($value) . ')' . $value . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
default:
- $log->log(
+ Analog::log(
'[' . get_class($this) .
'|Pagination] Unable to set proprety `' . $name . '`',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Adherent;
/**
)
);
if ( $del ) {
- $log->log(
+ Analog::log(
'Temporary passwords for `' . $id_adh . '` has been removed.',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error has occured removing old tmppasswords ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$add = $zdb->db->insert(PREFIX_DB . self::TABLE, $values);
if ( $add ) {
- $log->log(
+ Analog::log(
'New passwords temporary set for `' . $id_adh . '`.',
- KLogger::DEBUG
+ Analog::DEBUG
);
$this->_new_password = $password;
$this->_hash = $hash;
return false;
}
} catch (\Zend_Db_Adapter_Exception $e) {
- $log->log(
+ Analog::log(
'Unable to add add new password entry into database.' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
"An error occured trying to add temporary password entry. " .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
)
);
if ( $del ) {
- $log->log(
+ Analog::log(
'Old Temporary passwords has been deleted.',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured deleting expired temporary passwords. ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
return $select->query()->fetchColumn();
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured getting requested hash. ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
)
);
if ( $del ) {
- $log->log(
+ Analog::log(
'Used hash has been successfully remove',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error ocured attempting to delete used hash' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
namespace Galette\Core;
use Galette\Entity\Adherent;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Picture handling
if ( $transaction === true ) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'The file ' . $_file . ' was found on the disk but cannot be removed.',
- KLogger::ERR
+ Analog::ERROR
);
return false;
} else {
return true;
}
} else {
- $log->log(
+ Analog::log(
'Unable to remove picture database entry for ' . $this->db_id,
- KLogger::ERR
+ Analog::ERROR
);
if ( $transaction === true ) {
//properly ends transaction
if ( $transaction === true ) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'An error occured attempting to delete picture ' . $this->db_id .
'from database | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$reg = "/^(.[^" . implode('', $this->_bad_chars) . "]+)\.(" .
implode('|', $this->_allowed_extensions) . ")$/i";
if ( preg_match($reg, $name, $matches) ) {
- $log->log(
+ Analog::log(
'[' . $class . '] Filename and extension are OK, proceed.',
- KLogger::DEBUG
+ Analog::DEBUG
);
$extension = strtolower($matches[2]);
if ( $extension == 'jpeg' ) {
$ret = self::INVALID_FILE;
}
- $log->log(
+ Analog::log(
$err_msg,
- KLogger::ERR
+ Analog::ERROR
);
return $ret;
}
//Second, let's check file size
if ( $file['size'] > ( $class::MAX_FILE_SIZE * 1024 ) ) {
- $log->log(
+ Analog::log(
'[' . $class . '] File is too big (' . ( $file['size'] * 1024 ) .
'Ko for maximum authorized ' . ( $class::MAX_FILE_SIZE * 1024 ) .
'Ko',
- KLogger::ERR
+ Analog::ERROR
);
return self::FILE_TOO_BIG;
} else {
- $log->log('[' . $class . '] Filesize is OK, proceed', KLogger::DEBUG);
+ Analog::log('[' . $class . '] Filesize is OK, proceed', Analog::DEBUG);
}
$current = getimagesize($tmpfile);
if ( !in_array($current['mime'], $this->_allowed_mimes) ) {
- $log->log(
+ Analog::log(
'[' . $class . '] Mimetype `' . $current['mime'] . '` not allowed',
- KLogger::ERR
+ Analog::ERROR
);
return self::MIME_NOT_ALLOWED;
} else {
- $log->log(
+ Analog::log(
'[' . $class . '] Mimetype is allowed, proceed',
- KLogger::DEBUG
+ Analog::DEBUG
);
}
$stmt->execute();
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured storing picture in database: ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return self::SQL_ERROR;
}
switch(strtolower($ext)) {
case 'jpg':
if (!$gdinfo['JPEG Support']) {
- $log->log(
+ Analog::log(
'[' . $class . '] GD has no JPEG Support - ' .
'pictures could not be resized!',
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
break;
case 'png':
if (!$gdinfo['PNG Support']) {
- $log->log(
+ Analog::log(
'[' . $class . '] GD has no PNG Support - ' .
'pictures could not be resized!',
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
break;
case 'gif':
if (!$gdinfo['GIF Create Support']) {
- $log->log(
+ Analog::log(
'[' . $class . '] GD has no GIF Support - ' .
'pictures could not be resized!',
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
break;
}
} else {
- $log->log(
+ Analog::log(
'[' . $class . '] GD is not present - ' .
'pictures could not be resized!',
- KLogger::ERR
+ Analog::ERROR
);
}
}
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Plugins class for galette
if ( $compver === null ) {
//plugin compatibility missing!
- $log->log(
+ Analog::log(
'Plugin ' . $name . ' does not contains mandatory version ' .
'compatiblity informations. Please contact the author.',
- KLogger::ERR
+ Analog::ERROR
);
$this->disabled[$this->id] = array(
'root' => $this->mroot,
);
} elseif ( version_compare($compver, GALETTE_COMPAT_VERSION, '<') ) {
//plugin is not compatible with that version of galette.
- $log->log(
+ Analog::log(
'Plugin ' . $name . ' is known to be compatible with Galette ' .
$compver . ' only, but you current installation require a ' .
'plugin compatible with at least ' . GALETTE_COMPAT_VERSION,
- KLogger::WARN
+ Analog::WARNING
);
$this->disabled[$this->id] = array(
'root' => $this->mroot,
namespace Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Adherent as Adherent;
/**
foreach ( self::$_defaults as $k=>$v ) {
if ( !isset($this->_prefs[$k]) ) {
$this->_prefs[$k] = $v;
- $log->log(
+ Analog::log(
'The field `' . $k . '` does not exists, Galette will attempt to create it.',
- KLogger::INFO
+ Analog::INFO
);
$proceed = true;
$params[] = array(
);
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to add missing preferences.' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
- $log->log(
+ Analog::log(
'Missing preferences were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
}
}
}
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Preferences cannot be loaded. Galette should not work without ' .
'preferences. Exiting.',
- KLogger::EMERG
+ Analog::URGENT
);
return false;
}
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Default preferences were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize default preferences.' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return $e;
}
);
foreach ( self::$_defaults as $k=>$v ) {
- $log->log('Storing ' . $k, KLogger::DEBUG);
+ Analog::log('Storing ' . $k, Analog::DEBUG);
$stmt->bindValue(':value', $this->_prefs[$k], \PDO::PARAM_STR);
$stmt->bindValue(':name', $k, \PDO::PARAM_STR);
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Preferences were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Unable to store preferences | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
$e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $this->_prefs[$name];
}
} else {
- $log->log(
+ Analog::log(
'Preference `' . $name . '` is not set or is forbidden',
- KLogger::INFO
+ Analog::INFO
);
return false;
}
//does this pref exists ?
if ( !array_key_exists($name, self::$_defaults) ) {
- $log->log(
+ Analog::log(
'Trying to set a preference value which does not seem to exist ('
. $name . ')',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
namespace Galette\DynamicFieldsTypes;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Choice field type
namespace Galette\DynamicFieldsTypes;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\DynamicFields as DynamicFields;
/**
}
} // $result != false
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Unable to retrieve fields types for field ' . $this->id . ' | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
}
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $val_select->__toString() . ' ' . $e->__toString(),
- KLogger::INFO
+ Analog::INFO
);
}
}
if ( $this->fixed_values ) {
return implode("\n", $this->values);
} else {
- $log->log(
+ Analog::log(
'Field do not have fixed values, cannot retrieve values.',
- KLogger::INFO
+ Analog::INFO
);
return false;
}
namespace Galette\DynamicFieldsTypes;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Line field type
namespace Galette\DynamicFieldsTypes;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Separator field type
namespace Galette\DynamicFieldsTypes;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Separator field type
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\Picture as Picture;
use Galette\Core\GaletteMail as GaletteMail;
use Galette\Core\Password as Password;
$deps
);
} else if ( $deps !== null ) {
- $log->log(
+ Analog::log(
'$deps shoud be an array, ' . gettype($deps) . ' given!',
- KLogger::WARN
+ Analog::WARNING
);
}
return true;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot load member form id `' . $id . '` | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$this->_loadFromRS($result);
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot load member form login `' . $login . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
ucfirst(mb_strtolower($row->prenom_adh, 'UTF-8'));
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot get formatted name for member form id `' . $id . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
array('mdp_adh' => md5($pass)),
$zdb->db->quoteInto(self::PK . ' = ?', $id_adh)
);
- $log->log(
+ Analog::log(
'Password for `' . $id_adh . '` has been updated.',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured while updating password for `' . $id_adh .
'` | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
$this->$prop = $d->format('Y-m-d');
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Wrong date format. field: ' . $key .
', value: ' . $value . ', expected fmt: ' .
_T("Y-m-d") . ' | ' . $e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = str_replace(
array(
$errors[] = _T("- This E-Mail address is already used by another member!");
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured checking member email unicity.',
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = _T("An error has occured while looking if login already exists.");
}
$errors[] = _T("- This username is already used by another member!");
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured checking member login unicity.',
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = _T("An error has occured while looking if login already exists.");
}
);
}
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'An error occured checking status unicity: ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = _T("An error has occured while looking if status is already in use.");
}
}
if ( count($errors) > 0 ) {
- $log->log(
+ Analog::log(
'Some errors has been throwed attempting to edit/store a member' .
print_r($errors, true),
- KLogger::DEBUG
+ Analog::DEBUG
);
return $errors;
} else {
- $log->log(
+ Analog::log(
'Member checked successfully.',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
}
return false;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
);
$this->_modification_date = date('Y-m-d');
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Something went wrong updating modif date :\'( | ' .
$e->getMessage() . "\n" . $e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
return $d->format(_T("Y-m-d"));
} catch (\Exception $e) {
//oops, we've got a bad date :/
- $log->log(
+ Analog::log(
'Bad date (' . $this->$rname . ') | ' .
$e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
return $this->$rname;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Contribution class for galette
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured attempting to load contribution #' . $id .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
$this->$prop = $d->format('Y-m-d');
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Wrong date format. field: ' . $key .
', value: ' . $value . ', expected fmt: ' .
_T("Y-m-d") . ' | ' . $e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = str_replace(
array(
}
if ( count($errors) > 0 ) {
- $log->log(
+ Analog::log(
'Some errors has been throwed attempting to edit/store a contribution' .
print_r($errors, true),
- KLogger::DEBUG
+ Analog::DEBUG
);
return $errors;
} else {
- $log->log(
+ Analog::log(
'Contribution checked successfully.',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
}
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured checking overlaping fee. ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
return false;
}
} catch (\Exception $e) {
/** FIXME */
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured updating member ' . $this->_member .
'\'s deadline |' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
if ( $transaction ) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'An error occured trying to remove contribution #' .
$this->_id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $due_date;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error occured trying to retrieve member\'s due date',
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
);
return true;
} else {
- $log->log(
+ Analog::log(
'Contribution #' . $contrib_id .
' is not actually part of transaction #' . $trans_id,
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to detach contribution #' . $contrib_id .
' to transaction #' . $trans_id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to attach contribution #' . $contrib_id .
' to transaction #' . $trans_id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $d->format(_T("Y-m-d"));
} catch (\Exception $e) {
//oops, we've got a bad date :/
- $log->log(
+ Analog::log(
'Bad date (' . $his->$rname . ') | ' .
$e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
return $this->$rname;
}
return _T("Paypal");
break;
default:
- $log->log(
+ Analog::log(
'Unknown payment type ' . $this->_payment_type,
- KLogger::WARN
+ Analog::WARNING
);
return '-';
break;
if ( is_int($value) ) {
$this->$rname = new Transaction($value);
} else {
- $log->log(
+ Analog::log(
'Trying to set a transaction from an id that is not an integer.',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
$this->_is_cotis = false;
}
} else {
- $log->log(
+ Analog::log(
'Trying to set a type from an id that is not an integer.',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
}
$this->_begin_date = $d->format('Y-m-d');
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Wrong date format. field: ' . $key .
', value: ' . $value . ', expected fmt: ' .
_T("Y-m-d") . ' | ' . $e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = str_replace(
array(
if (is_numeric($value) && $value > 0 ) {
$this->$rname = $value;
} else {
- $log->log(
+ Analog::log(
'Trying to set an amount with a non numeric value, ' .
'or with a zero value',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
default:
- $log->log(
+ Analog::log(
'[' . __CLASS__ . ']: Trying to set an unknown property (' .
$name . ')',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/* TODO: Most of the code is duplicated in Galette\Entity\Status. Should
* probably use a superclass for genericity.
return true;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot load contribution type form id `' . $id . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Default contributions types were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize default contributions types.' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return $e;
}
}
return $list;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured. ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
return false;
}
$types = $select->query()->fetchAll();
if ( count($types) == 0 ) {
- $log->log(
+ Analog::log(
'No contributions types defined in database.',
- KLogger::INFO
+ Analog::INFO
);
} else {
foreach ( $types as $type ) {
return $list;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list contribution types | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $result;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $result = $select->query()->fetchColumn();
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to retrieve contributions type from label `' .
$label . '` | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$ret = $this->getidByLabel($label);
if ( $ret !== false ) {
- $log->log(
+ Analog::log(
'Contribution type `' . $label . '` already exists',
- KLogger::WARN
+ Analog::WARNING
);
return -2;
}
);
if ( $ret > 0) {
- $log->log(
+ Analog::log(
'New contributions type `' . $label . '` added successfully.',
- KLogger::INFO
+ Analog::INFO
);
return $zdb->db->lastInsertId(
PREFIX_DB . self::TABLE,
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to add new contributions type `' . $label . '` | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$fieldtype = 'integer';
}
- $log->log("Setting field $field to $value for ctype $id", KLogger::INFO);
+ Analog::log("Setting field $field to $value for ctype $id", Analog::INFO);
try {
$values= array(
self::PK . ' = ' . $id
);
- $log->log(
+ Analog::log(
'Contributions type ' . $id . ' updated successfully.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to update contributions types ' . $id . ' | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
PREFIX_DB . self::TABLE,
self::PK . ' = ' . $id
);
- $log->log(
+ Analog::log(
'Contributions type ' . $id . ' deleted successfully.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to delete contributions type ' . $id . ' | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to check if contribution `' . $id . '` is used. | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
//in case of error, we consider that type is used, to avoid errors
return true;
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\DynamicFieldsTypes\Separator as Separator;
use Galette\DynamicFieldsTypes\Text as Text;
use Galette\DynamicFieldsTypes\Line as Line;
}
return $fixed_values;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $val_select->__toString() . ' ' . $e->__toString(),
- KLogger::INFO
+ Analog::INFO
);
}
}
return false;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::INFO
+ Analog::INFO
);
}
}
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::INFO
+ Analog::INFO
);
}
}
}
if ( trim($field_val) == '' ) {
- $log->log(
+ Analog::log(
'Field ' . $field_id . ' is empty (index:' .
$val_index . ')',
- KLogger::DEBUG
+ Analog::DEBUG
);
$zdb->db->delete(
PREFIX_DB . self::TABLE,
$where
);
} else {
- $log->log(
+ Analog::log(
'Field ' . $field_id . ' will be set to value: ' .
$field_val . ' (index: ' . $val_index . ')',
- KLogger::DEBUG
+ Analog::DEBUG
);
$zdb->db->update(
PREFIX_DB . self::TABLE,
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'An error occured storing dynamic field. Form name: ' . $form_name .
'; item_id:' . $item_id . '; field_id: ' . $field_id .
'; val_index: ' . $val_index . '; field_val:' . $field_val .
' | Error was: ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return false;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
__METHOD__ . ' | Unable to retrieve field `' . $id .
'` informations | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Fields categories class for galette
return $select->query()->fetchAll();
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'[' . get_class($this) . '] Cannot get fields categories list | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Default fields configurations were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize default fields configuration.' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return $e;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Fields config class for galette :
$meta = Adherent::getDbFields();
if ( count($meta) != count($result) ) {
- $log->log(
+ Analog::log(
'[' . $class . '] Count for `' . $this->_table .
'` columns does not match records. Is : ' .
count($result) . ' and should be ' .
count($meta) . '. Reinit.',
- KLogger::INFO
+ Analog::INFO
);
$this->init(true);
}
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'[' . $class . '] An error occured while checking update for ' .
'fields configuration for table `' . $this->_table . '`. ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
throw $e;
}
$class = get_class($this);
$t = new FieldsCategories();
- $log->log(
+ Analog::log(
'[' . $class . '] Initializing fields configuration for table `' .
PREFIX_DB . $this->_table . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( $reinit ) {
- $log->log(
+ Analog::log(
'[' . $class . '] Reinit mode, we delete config content for ' .
'table `' . PREFIX_DB . $this->_table . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
//Delete all entries for current table. Existing entries are
//already stored, new ones will be added :)
);
$t->installInit();
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to delete fields configuration for reinitialization' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
);
$stmt->execute($params);
}
- $log->log(
+ Analog::log(
'[' . $class . '] Initialisation seem successfull, we reload ' .
'the object',
- KLogger::DEBUG
+ Analog::DEBUG
);
- $log->log(
+ Analog::log(
str_replace(
'%s',
PREFIX_DB . $this->_table,
'[' . $class . '] Fields configuration for table %s '.
'initialized successfully.'
),
- KLogger::INFO
+ Analog::INFO
);
$this->_checkUpdate(false);
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'[' . $class . '] An error occured trying to initialize fields ' .
'configuration for table `' . PREFIX_DB . $this->_table . '`.' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
}
- $log->log(
+ Analog::log(
'[' . $class . '] Fields configuration stored successfully! ',
- KLogger::DEBUG
+ Analog::DEBUG
);
- $log->log(
+ Analog::log(
str_replace(
'%s',
$this->_table,
'[' . $class . '] Fields configuration for table %s stored ' .
'successfully.'
),
- KLogger::INFO
+ Analog::INFO
);
$zdb->db->commit();
return true;
} catch (Exception $e) {
$zdb->db->rollBacak();
- $log->log(
+ Analog::log(
'[' . $class . '] An error occured while storing fields ' .
'configuration for table `' . $this->_table . '`.' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Group entity
$this->_loadFromRS($result);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot load group form id `' . $id . '` | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$this->_managers = $members;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot get group persons | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
}
$this->_groups = $groups;
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Cannot get subgroup for group ' . $this->_group_name .
' (' . $this->_id . ')| ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to delete group ' . $this->_group_name .
' (' . $this->_id . ') |' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return true;
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Something went wrong detaching group `' . $this->_group_name .
'` (' . $this->_id . ') from its parent:\'( | ' .
$e->getMessage() . "\n" .
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
throw new \Exception(_T("Unable to detach group :("));
}
/** FIXME: also store members and managers? */
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
PREFIX_DB . self::GROUPSUSERS_TABLE,
self::PK . ' = ' . $this->_id
);
- $log->log(
+ Analog::log(
'Group members has been removed for `' . $this->_group_name .
', we can now store new ones.',
- KLogger::INFO
+ Analog::INFO
);
$stmt = $zdb->db->prepare(
$stmt->bindValue(':adh', $m->id, \PDO::PARAM_INT);
if ( $stmt->execute() ) {
- $log->log(
+ Analog::log(
'Member `' . $m->sname . '` attached to group `' .
$this->_group_name . '`.',
- KLogger::DEBUG
+ Analog::DEBUG
);
} else {
- $log->log(
+ Analog::log(
'An error occured trying to attach member `' .
$m->sname . '` to group `' . $this->_group_name .
'` (' . $this->_id . ').',
- KLogger::ERR
+ Analog::ERROR
);
throw new \Exception(
'Unable to attach `' . $m->sname . '` ' .
//commit all changes
$zdb->db->commit();
- $log->log(
+ Analog::log(
'Group members updated successfully.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to attach members to group `' . $this->_group_name .
'` (' . $this->_id . ')|' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
PREFIX_DB . self::GROUPSMANAGERS_TABLE,
self::PK . ' = ' . $this->_id
);
- $log->log(
+ Analog::log(
'Group managers has been removed for `' . $this->_group_name .
', we can now store new ones.',
- KLogger::INFO
+ Analog::INFO
);
$stmt = $zdb->db->prepare(
$stmt->bindValue(':adh', $m->id, \PDO::PARAM_INT);
if ( $stmt->execute() ) {
- $log->log(
+ Analog::log(
'Manager `' . $m->sname . '` attached to group `' .
$this->_group_name . '`.',
- KLogger::DEBUG
+ Analog::DEBUG
);
} else {
- $log->log(
+ Analog::log(
'An error occured trying to attach manager `' .
$m->sname . '` to group `' . $this->_group_name .
'` (' . $this->_id . ').',
- KLogger::ERR
+ Analog::ERROR
);
throw new \Exception(
'Unable to attach `' . $m->sname . '` ' .
//commit all changes
$zdb->db->commit();
- $log->log(
+ Analog::log(
'Groups managers updated successfully.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to attach managers to group `' . $this->_group_name .
'` (' . $this->_id . ')|' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Politeness class for galette
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/* TODO: Most of the code is duplicated in Galette\Entity\ContributionsTypes. Should
* probably use a superclass for genericity.
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Default status were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize default status.' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return $e;
}
->order(self::ORDER_FIELD, self::PK);
$statuses = $select->query()->fetchAll();
if ( count($statuses) == 0 ) {
- $log->log('No status defined in database.', KLogger::INFO);
+ Analog::log('No status defined in database.', Analog::INFO);
} else {
foreach ( $statuses as $status ) {
$list[$status->id_statut] = _T($status->libelle_statut);
return $list;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
$statuses = $select->query()->fetchAll();
if ( count($statuses) == 0 ) {
- $log->log('No status defined in database.', KLogger::INFO);
+ Analog::log('No status defined in database.', Analog::INFO);
} else {
foreach ( $statuses as $status ) {
$list[$status->id_statut] = array(
return $list;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list statuses | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $result;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $result = $select->query()->fetchColumn();
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to retrieve status from label `' . $label . '` | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$ret = $this->getidByLabel($label);
if ( $ret !== false ) {
- $log->log(
+ Analog::log(
'Status `' . $label . '` already exists',
- KLogger::WARN
+ Analog::WARNING
);
return -2;
}
);
if ( $ret > 0) {
- $log->log(
+ Analog::log(
'New status `' . $label . '` added successfully.',
- KLogger::INFO
+ Analog::INFO
);
return $zdb->db->lastInsertId(
PREFIX_DB . self::TABLE,
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to add new status `' . $label . '` | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$fieldtype = 'integer';
}
- $log->log("Setting field $field to $value for ctype $id", KLogger::INFO);
+ Analog::log("Setting field $field to $value for ctype $id", Analog::INFO);
try {
$values= array(
self::PK . ' = ' . $id
);
- $log->log('Status ' . $id . ' updated successfully.', KLogger::INFO);
+ Analog::log('Status ' . $id . ' updated successfully.', Analog::INFO);
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to update status ' . $id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
PREFIX_DB . self::TABLE,
self::PK . ' = ' . $id
);
- $log->log(
+ Analog::log(
'Status ' . $id . ' deleted successfully.',
- KLogger::INFO
+ Analog::INFO
);
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to delete status ' . $id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Unable to check if status `' . $id . '` is used. | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
//in case of error, we consider that status is used, to avoid errors
return true;
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* Texts class for galette
$zdb->db->insert(PREFIX_DB . self::TABLE, $values);
return $this->getTexts($ref, $lang);
} catch( \Exception $e ) {
- $log->log(
+ Analog::log(
'Unable to add missing requested text "' . $ref .
' (' . $lang . ') | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
} else {
- $log->log(
+ Analog::log(
'Unable to find missing requested text "' . $ref .
' (' . $lang . ')',
- KLogger::WARN
+ Analog::WARNING
);
}
}
return $this->_all_texts;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot get text `' . $ref . '` for lang `' . $lang . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return true;
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'An error has occured while storing mail text. | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $select->query(\Zend_Db::FETCH_ASSOC)->fetchAll();
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot get refs for lang `' . $lang . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$stmt->execute();
}
- $log->log(
+ Analog::log(
'Default texts were successfully stored into database.',
- KLogger::INFO
+ Analog::INFO
);
return true;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to initialize default texts.' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return $e;
}
namespace Galette\Entity;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Repository\Contributions as Contributions;
/**
}
} catch (\Exception $e) {
/** FIXME */
- $log->log(
+ Analog::log(
'Cannot load transaction form id `' . $id . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
if ( $transaction ) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'An error occured trying to remove transaction #' .
$this->_id . ' | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
$this->$prop = $d->format('Y-m-d');
} catch (Exception $e) {
- $log->log(
+ Analog::log(
'Wrong date format. field: ' . $key .
', value: ' . $value . ', expected fmt: ' .
_T("Y-m-d") . ' | ' . $e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
$errors[] = str_replace(
array(
}
if ( count($errors) > 0 ) {
- $log->log(
+ Analog::log(
'Some errors has been throwed attempting to edit/store a transaction' .
print_r($errors, true),
- KLogger::DEBUG
+ Analog::DEBUG
);
return $errors;
} else {
- $log->log(
+ Analog::log(
'Transaction checked successfully.',
- KLogger::DEBUG
+ Analog::DEBUG
);
return true;
}
} catch (\Exception $e) {
/** FIXME */
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
$e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$dispatched_amount = $select->query()->fetchColumn();
return (double)$dispatched_amount;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured retrieving dispatched amounts | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
}
}
$dispatched_amount = $select->query()->fetchColumn();
return (double)$this->_amount - (double)$dispatched_amount;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured retrieving missing amounts | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
}
}
namespace Galette\Filters;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Status as Status;
use Galette\Repository\Members as Members;
{
global $log;
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields)
}
} catch (\Exception $e) {
//oops, we've got a bad date :/
- $log->log(
+ Analog::log(
'Bad date (' . $this->$rname . ') | ' .
$e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
return $this->$rname;
}
}
return $this->$rname;
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
) {
parent::__set($name, $value);
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Setting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
$prop = '_' . $name;
}
$this->$prop = $d->format('Y-m-d');
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Incorrect date format! was: ' . $value,
- KLogger::WARN
+ Analog::WARNING
);
}
break;
if ( is_numeric($value) ) {
$this->$prop = $value;
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Value for property `' . $name .
'` should be an integer (' . gettype($value) . ' given)',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
if ( $res !== false ) {
$this->_status[] = $v;
} else {
- $log->log(
+ Analog::log(
'Status #' . $v . ' does not exists!',
- KLogger::WARN
+ Analog::WARNING
);
}
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Value for status filter should be an '
.'integer (' . gettype($v) . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
}
unset($value['idx']);
$this->_free_search[$id] = $value;
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] bad construct for free filter',
- KLogger::WARN
+ Analog::WARNING
);
}
} else {
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Value for free filter should be an '
.'array (' . gettype($value) . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
default:
- $log->log(
+ Analog::log(
'[AdvancedMembersList] Unable to set proprety `' . $name . '`',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
namespace Galette\Filters;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\Pagination as Pagination;
use Galette\Entity\Group as Group;
use Galette\Repository\Members as Members;
{
global $log;
- $log->log(
+ Analog::log(
'[MembersList] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields) ) {
return $this->$name;
}
} else {
- $log->log(
+ Analog::log(
'[MembersList] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
if ( in_array($name, $this->pagination_fields) ) {
parent::__set($name, $value);
} else {
- $log->log(
+ Analog::log(
'[MembersList] Setting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
switch($name) {
$name = '_' . $name;
$this->$name = $value;
} else {
- $log->log(
+ Analog::log(
'[MembersList] Value for property `' . $name .
'` should be an array (' . gettype($value) . ' given)',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
$name = '_' . $name;
$this->$name = $value;
} else {
- $log->log(
+ Analog::log(
'[MembersList] Value for property `' . $name .
'` should be an integer (' . gettype($value) . ' given)',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
$this->_email_filter = $value;
break;
default:
- $log->log(
+ Analog::log(
'[MembersList] Value for email filter should be either ' .
Members::FILTER_DC_EMAIL . ', ' .
Members::FILTER_W_EMAIL . ' or ' .
Members::FILTER_WO_EMAIL . ' (' . $value . ' given)',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
if ( $res === true ) {
$this->_group_filter = $value;
} else {
- $log->log(
+ Analog::log(
'Group #' . $value . ' does not exists!',
- KLogger::WARN
+ Analog::WARNING
);
}
} else {
- $log->log(
+ Analog::log(
'[MembersList] Value for group filter should be an '
.'integer (' . gettype($value) . ' given',
- KLogger::WARN
+ Analog::WARNING
);
}
break;
$this->$name = $value;
break;
default:
- $log->log(
+ Analog::log(
'[MembersList] Unable to set proprety `' . $name . '`',
- KLogger::WARN
+ Analog::WARNING
);
break;
}
namespace Galette\IO;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* CSV exports
$this->export($result, $separator, $quote, $title, $fp);
fclose($fp);
} else {
- $log->log(
+ Analog::log(
'File ' . $filename . ' is not writeable.',
- KLogger::ERR
+ Analog::ERROR
);
return self::FILE_NOT_WRITABLE;
}
return $export['filename'];
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'An error occured while exporting | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return self::DB_ERROR;
}
namespace Galette\IO;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/**
* News class for galette
$has_expired = $now > $expire;
return !$has_expired;
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Unable chack cache expiracy. Are you sure you have ' .
'properly configured PHP timezone settings on your server?',
- KLogger::WARN
+ Analog::WARNING
);
}
} else {
$this->_tweets = $tweets;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Unable to load Tweets :( | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
$this->_tweets = array();
}
$this->_gplus = $gposts;
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Unable to load GooGlePlus posts :( | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
if ( count($errors) > 0 || $xml === false ) {
//something went wrong :/
- $log->log(
+ Analog::log(
'Unable to load twitter URI ' . $this->_twitter_url,
- KLogger::WARN
+ Analog::WARNING
);
if ( count($errors) > 0 ) {
foreach ( $errors as $e ) {
$msg .= "\n" . $e->message;
}
- $log->log(
+ Analog::log(
$msg,
- KLogger::INFO
+ Analog::INFO
);
}
libxml_clear_errors();
}
return true;
} else {
- $log->log(
+ Analog::log(
'Required modules for Tweeter access are not present.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
if ( count($activities['items']) > 0 ) {
return true;
} else {
- $log->log(
+ Analog::log(
'No Google+ posts has been loaded :(',
- KLogger::WARN
+ Analog::WARNING
);
}
} catch ( \Exception $e ) {
- $log->log(
+ Analog::log(
'Unable to load GooGlePlus posts :( | ' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
}
return true;
} else {
- $log->log(
+ Analog::log(
'Required modules for Google+ access are not present.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
namespace Galette\Repository;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\Pagination as Pagination;
use Galette\Entity\Contribution as Contribution;
use Galette\Entity\Adherent as Adherent;
return $contributions;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list contributions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $select;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot build SELECT clause for contributions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot count contributions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $countSelect->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$this->_sum = round($result->contribsum, 2);
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot calculate contributions sum | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $sumSelect->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$qry = $select->__toString();
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
}
if ( $transaction ) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'An error occured trying to remove contributions | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
} else {
//not numeric and not an array: incorrect.
- $log->log(
+ Analog::log(
'Asking to remove contribution, but without providing an array or a single numeric value.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
{
global $log;
- $log->log(
+ Analog::log(
'[Contributions] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields) ) {
break;
}
} else {
- $log->log(
+ Analog::log(
'[Contributions] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
if ( in_array($name, $this->pagination_fields) ) {
parent::__set($name, $value);
} else {
- $log->log(
+ Analog::log(
'[Contributions] Setting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
$forbidden = array();
$this->$rname = null;
}
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Wrong date format. field: ' . $key .
', value: ' . $value . ', expected fmt: ' .
_T("Y-m-d") . ' | ' . $e->getMessage(),
- KLogger::INFO
+ Analog::INFO
);
throw $e;
}
break;
}
} else {
- $log->log(
+ Analog::log(
'[Contributions] Unable to set proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
namespace Galette\Repository;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Group as Group;
use Galette\Entity\Adherent as Adherent;
}
return $groups;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot list groups (simple) | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
return $groups;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot list groups | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
array()
)->where('b.' . Adherent::PK . ' = ?', $id);
$result = $select->query()->fetchAll();
- $log->log(
+ Analog::log(
'Exectued query: ' . $select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
$groups = array();
foreach ( $result as $r ) {
}
return $groups;
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot load member groups for id `' . $id . '` | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
PREFIX_DB . Group::GROUPSUSERS_TABLE,
Adherent::PK . ' = ' . $adh->id
);
- $log->log(
+ Analog::log(
'Member `' . $adh->sname . '` has been detached of its groups' .
', we can now store new ones.',
- KLogger::INFO
+ Analog::INFO
);
//we proceed, if groups has been specified
$stmt->bindValue(':id', $gid, \PDO::PARAM_INT);
if ( $stmt->execute() ) {
- $log->log(
+ Analog::log(
'Member `' . $adh->sname . '` attached to group `' .
$gname . '` (' . $gid . ').',
- KLogger::DEBUG
+ Analog::DEBUG
);
} else {
- $log->log(
+ Analog::log(
'An error occured trying to attach member `' .
$adh->sname . '` (' . $adh->id . ') to group `' .
$gname . '` (' . $gid . ').',
- KLogger::ERR
+ Analog::ERROR
);
throw new \Exception(
'Unable to attach `' . $adh->sname . '` (' . $adh->id .
if ( $transaction === false) {
$zdb->db->rollBack();
}
- $log->log(
+ Analog::log(
'Unable to add member `' . $adh->sname . '` (' . $adh->id .
') to specified groups |' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$res = $select->query()->fetchAll();
return !(count($res) > 0);
} catch (\Exception $e) {
- $log->log(
+ Analog::log(
'Cannot list groups (simple) | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->getTraceAsString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
use Galette\Entity\DynamicFields;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Entity\Adherent as Adherent;
use Galette\Entity\Contribution as Contribution;
use Galette\Entity\Transaction as Transaction;
$filters->query = $select->__toString();
- $log->log(
+ Analog::log(
"The following query will be executed: \n" .
$filters->query,
- KLogger::DEBUG
+ Analog::DEBUG
);
$members = array();
return $members;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list members | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
$p = new Picture($member->id_adh);
if ( $p->hasPicture() ) {
if ( !$p->delete(false) ) {
- $log->log(
+ Analog::log(
'Unable to delete picture for member ' . $str_adh,
- KLogger::ERR
+ Analog::ERROR
);
throw new \Exception(
'Unable to delete picture for member ' .
return true;
} catch (\Exception $e) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'Unable to delete selected member(s) |' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
} else {
//not numeric and not an array: incorrect.
- $log->log(
+ Analog::log(
'Asking to remove members, but without providing an array or a single numeric value.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
'date_echeance > ? OR bool_exempt_adh = true',
date('Y-m-d')
);
- $log->log(
+ Analog::log(
"The following query will be executed: \n" .
$select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( $filters ) {
return $members;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list members with public informations (photos: '
. $with_photos . ') | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
global $zdb, $log;
if ( !is_array($ids) || count($ids) < 1 ) {
- $log->log('No member selected for labels.', KLogger::INFO);
+ Analog::log('No member selected for labels.', Analog::INFO);
return false;
}
}
}
- $log->log(
+ Analog::log(
"The following query will be executed: \n" .
$select->__toString(),
- KLogger::DEBUG
+ Analog::DEBUG
);
$result = $select->query();
return $members;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot load members form ids array | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}
return $select;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot build SELECT clause for members | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot count members | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $countSelect->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
$fs['search'] = '%' . $fs['search'];
break;
default:
- $log->log(
+ Analog::log(
'Unknown query operator: ' . $fs['qry_op'] .
' (will fallback to equals)',
- KLogger::WARN
+ Analog::WARNING
);
$qop = '=';
break;
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
}
return true;
} catch ( Exception $e ) {
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'An error occured trying to retrieve members with ' .
'empty logins/passwords (' . $e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
namespace Galette\Repository;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Core\Pagination as Pagination;
use Galette\Entity\Transaction as Transaction;
use Galette\Entity\Adherent as Adherent;
return $transactions;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot list transactions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
return $select;
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot build SELECT clause for transactions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'Cannot count transactions | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $countSelect->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
}
} catch (\Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
__METHOD__ . ' | ' . $e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
}
}
} catch (\Exception $e) {
/** FIXME */
$zdb->db->rollBack();
- $log->log(
+ Analog::log(
'An error occured trying to remove transactions | ' .
$e->getMessage(),
- KLogger::ERR
+ Analog::ERROR
);
return false;
}
} else {
//not numeric and not an array: incorrect.
- $log->log(
+ Analog::log(
'Asking to remove transaction, but without providing an array or a single numeric value.',
- KLogger::WARN
+ Analog::WARNING
);
return false;
}
{
global $log;
- $log->log(
+ Analog::log(
'[Transactions] Getting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
if ( in_array($name, $this->pagination_fields) ) {
$name = '_' . $name;
return $this->$name;
} else {
- $log->log(
+ Analog::log(
'[Transactions] Unable to get proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
if ( in_array($name, $this->pagination_fields) ) {
parent::__set($name, $value);
} else {
- $log->log(
+ Analog::log(
'[Transactions] Setting property `' . $name . '`',
- KLogger::DEBUG
+ Analog::DEBUG
);
$forbidden = array();
break;
}
} else {
- $log->log(
+ Analog::log(
'[Transactions] Unable to set proprety `' .$name . '`',
- KLogger::WARN
+ Analog::WARNING
);
}
}
}
use Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
use Galette\Filters\MembersList as MembersList;
//We're done :-)
&& !isset($_GET['mailing_new'])
&& !isset($_GET['reminder'])
) {
- $log->log(
+ Analog::log(
'[mailing_adherents.php] No member selected for mailing',
- KLogger::WARN
+ Analog::WARNING
);
if ( isset($profiler) ) {
$sent = $mailing->send();
if ( $sent == Core\Mailing::MAIL_ERROR ) {
$mailing->current_step = Core\Mailing::STEP_START;
- $log->log(
+ Analog::log(
'[mailing_adherents.php] Message was not sent. Errors: ' .
print_r($mailing->errors, true),
- KLogger::ERR
+ Analog::ERROR
);
foreach ( $mailing->errors as $e ) {
$error_detected[] = $e;
} else {
$mlh = new Core\MailingHistory($mailing);
$mlh->storeMailing(true);
- $log->log(
+ Analog::log(
'[mailing_adherents.php] Message has been sent.',
- KLogger::INFO
+ Analog::INFO
);
$mailing->current_step = Core\Mailing::STEP_SENT;
//cleanup
*/
use Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
switch ( $fieldname ) {
case 'pref_email':
if ( GALETTE_MODE === 'DEMO' ) {
- $log->log(
+ Analog::log(
'Trying to set pref_email while in DEMO.',
- KLogger::WARN
+ Analog::WARNING
);
} else {
if ( !Core\GaletteMail::isValidEmail($value) ) {
break;
case 'pref_admin_login':
if ( GALETTE_MODE === 'DEMO' ) {
- $log->log(
+ Analog::log(
'Trying to set superadmin login while in DEMO.',
- KLogger::WARN
+ Analog::WARNING
);
} else {
if ( strlen($value) < 4 ) {
break;
case 'pref_admin_pass':
if ( GALETTE_MODE == 'DEMO' ) {
- $log->log(
+ Analog::log(
'Trying to set superadmin pass while in DEMO.',
- KLogger::WARN
+ Analog::WARNING
);
} else {
if ( strlen($value) < 4 ) {
}
}
} else if ($_FILES['logo']['error'] !== UPLOAD_ERR_NO_FILE) {
- $log->log(
+ Analog::log(
$logo->getPhpErrorMessage($_FILES['logo']['error']),
- KLogger::WARN
+ Analog::WARNING
);
$error_detected[] = $logo->getPhpErrorMessage(
$_FILES['logo']['error']
}
}
} else if ($_FILES['card_logo']['error'] !== UPLOAD_ERR_NO_FILE) {
- $log->log(
+ Analog::log(
$print_logo->getPhpErrorMessage($_FILES['card_logo']['error']),
- KLogger::WARN
+ Analog::WARNING
);
$error_detected[] = $print_logo->getPhpErrorMessage(
$_FILES['card_logo']['error']
</tbody>
</table>
</fieldset>
-{if $show_fields eq 'true'}
- <table id="fields_list">
- </table>
-{/if}
<div class="button-container">
<input type="submit" name="valid" value="{_T string="Continue"}"/>
</div>
* @since Available since 0.62
*/
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
/** @ignore */
require_once 'includes/galette.inc.php';
$nb_fields = $select->query()->fetch()->nb;
} catch (Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured counting l10n entries | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
$tpl->assign('trans', $trans);
} catch (Exception $e) {
/** TODO */
- $log->log(
+ Analog::log(
'An error occured retrieving l10n entries | ' .
$e->getMessage(),
- KLogger::WARN
+ Analog::WARNING
);
- $log->log(
+ Analog::log(
'Query was: ' . $select->__toString() . ' ' . $e->__toString(),
- KLogger::ERR
+ Analog::ERROR
);
}
}