]> git.agnieray.net Git - galette.git/commitdiff
Replace KLogger with Analog; fixes #415 refs #414
authorJohan Cwiklinski <johan@x-tnd.be>
Sat, 1 Dec 2012 17:49:13 +0000 (18:49 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 23 Dec 2012 13:43:14 +0000 (14:43 +0100)
Also implements behavior configuration

69 files changed:
galette/ajax_attendance_sheet_details.php
galette/ajax_group.php
galette/ajax_group_members.php
galette/ajax_groups.php
galette/ajax_mailing_preview.php
galette/ajax_members.php
galette/ajax_photo.php
galette/ajax_plugins_initdb.php
galette/ajax_recipients.php
galette/ajax_unique_group.php
galette/ajouter_adherent.php
galette/attendance_sheet.php
galette/carte_adherent.php
galette/config/paths.inc.php
galette/config/versions.inc.php
galette/config_fields.php
galette/configurer_fiches.php
galette/editer_champ.php
galette/etiquettes_adherents.php
galette/gestion_groupes.php
galette/get_export.php
galette/includes/functions.inc.php
galette/includes/galette.inc.php
galette/includes/i18n.inc.php
galette/install/index.php
galette/lib/Galette/Common/KLogger.php [deleted file]
galette/lib/Galette/Common/XHProf.php
galette/lib/Galette/Core/Db.php
galette/lib/Galette/Core/Error.php
galette/lib/Galette/Core/GaletteMail.php
galette/lib/Galette/Core/History.php
galette/lib/Galette/Core/I18n.php
galette/lib/Galette/Core/Login.php
galette/lib/Galette/Core/Logo.php
galette/lib/Galette/Core/Mailing.php
galette/lib/Galette/Core/MailingHistory.php
galette/lib/Galette/Core/Pagination.php
galette/lib/Galette/Core/Password.php
galette/lib/Galette/Core/Picture.php
galette/lib/Galette/Core/Plugins.php
galette/lib/Galette/Core/Preferences.php
galette/lib/Galette/DynamicFieldsTypes/Choice.php
galette/lib/Galette/DynamicFieldsTypes/DynamicFieldType.php
galette/lib/Galette/DynamicFieldsTypes/Line.php
galette/lib/Galette/DynamicFieldsTypes/Separator.php
galette/lib/Galette/DynamicFieldsTypes/Text.php
galette/lib/Galette/Entity/Adherent.php
galette/lib/Galette/Entity/Contribution.php
galette/lib/Galette/Entity/ContributionsTypes.php
galette/lib/Galette/Entity/DynamicFields.php
galette/lib/Galette/Entity/FieldsCategories.php
galette/lib/Galette/Entity/FieldsConfig.php
galette/lib/Galette/Entity/Group.php
galette/lib/Galette/Entity/Politeness.php
galette/lib/Galette/Entity/Status.php
galette/lib/Galette/Entity/Texts.php
galette/lib/Galette/Entity/Transaction.php
galette/lib/Galette/Filters/AdvancedMembersList.php
galette/lib/Galette/Filters/MembersList.php
galette/lib/Galette/IO/Csv.php
galette/lib/Galette/IO/News.php
galette/lib/Galette/Repository/Contributions.php
galette/lib/Galette/Repository/Groups.php
galette/lib/Galette/Repository/Members.php
galette/lib/Galette/Repository/Transactions.php
galette/mailing_adherents.php
galette/preferences.php
galette/templates/default/export.tpl
galette/traduire_libelles.php

index d32016c456e674494dab6600122464f4dbb96603..bb21ef203625dffe256fbb270412e29c7afb81c3 100644 (file)
  * @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();
 }
index 550139340992dedafa20afd251f14ce6d3e61559..055c68eb8117a6c216feb74f25f06d943dec15d4 100644 (file)
  * @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();
 }
@@ -54,9 +54,9 @@ if ( !$id ) {
 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();
 }
@@ -89,9 +89,9 @@ if ( !isset($_POST['reorder']) ) {
         $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();
index 93ed9998a32a237d10a741fd110ac1df70efe479..ba1b22178525cec062b1cd01644ff1ec68bb2238 100644 (file)
  * @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();
 }
index e5460b3728d542fcf1613226c0aaf88f08aa5f30..b0f48de4fcf2bff378e354aa34d7b7f223f746cb 100644 (file)
  * @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();
 }
index 70480e47443ffc38991049799f80b83183b08153..5889a4309976058643a99ffa77fd8aae8c1ab8d0 100644 (file)
  * @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();
 }
index 6c24dd80920b7e86cbd5860d860132e425a62325..c8a2b8914585bfc9c874fe226b5851c3a8f557cf 100644 (file)
  */
 
 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();
 }
@@ -97,9 +97,9 @@ if ( !isset($_POST['from']) ) {
     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);
@@ -112,9 +112,9 @@ if ( !isset($_POST['from']) ) {
             } 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);
index 35e9fa6999a394cd14a91df87813b85a5b84f8fd..671bfc58ad497e90334261377b63bdf669b67811 100644 (file)
  * @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();
 }
index 51becb46aa197523f055307e9a917a94bded1d67..538a08784d53c97f58e30b01c562dc10d5488a4e 100644 (file)
  * @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();
 }
@@ -73,9 +73,9 @@ if ( $plugid !== null ) {
 }
 
 if ( $plugin === null ) {
-    $log->log(
+    Analog::log(
         'Unable to load plugin `' . $plugid . '`!',
-        KLogger::EMERG
+        Analog::URGENT
     );
     die();
 }
@@ -222,10 +222,10 @@ case 'u3':
                 $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)
index 7808de9ef4f4452ab9cab895f125ec790b9364ac..b6ee69e290bcc87f407e4d9f33bee374ff09fb0b 100644 (file)
  * @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();
 }
index cfbbdd9d55467ff721a9128e27567cc23bdcf283..28d86e1b73332d33d515838553b278d7cb2a64c5 100644 (file)
  * @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();
 }
index 70c6ddc5d426f476b238969c5c33036dc7217cda..1d579ac282b31829427af6641d4ab90c5a14e6bd 100644 (file)
@@ -36,7 +36,7 @@
  * @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;
@@ -236,24 +236,24 @@ if ( isset($_POST[array_shift($real_requireds)]) ) {
             }
             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 {
@@ -279,9 +279,9 @@ if ( isset($_POST[array_shift($real_requireds)]) ) {
                     }
                 }
             } 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']
@@ -293,9 +293,9 @@ if ( isset($_POST[array_shift($real_requireds)]) ) {
             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
                 );
             }
         }
index f975dc76cd5ab4433315793796b7e707815c886b..2a093f6570caaa2df42174ade2df84266d021274 100644 (file)
@@ -40,7 +40,7 @@
 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';
@@ -61,7 +61,7 @@ if ( isset($session['filters']['members']) ) {
 }
 
 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();
 }
index 73d5fc18fd71b9ad8e1719f393a9ce9ad3ba4822..4f600ea7c961f0ee8841fbd2b71fdfa97e8c8d19 100644 (file)
@@ -46,7 +46,7 @@
  */
 
 use Galette\IO\Pdf;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /** @ignore */
 require_once 'includes/galette.inc.php';
@@ -69,7 +69,7 @@ if ( isset($_GET[Galette\Entity\Adherent::PK])
     $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 {
@@ -94,7 +94,7 @@ $members = Galette\Repository\Members::getArrayList(
 );
 
 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();
 }
 
index 163de1c7ac4d5c58c78f1ee3eccc7dfdca23545c..77de9224d695ef00f3f86cf764f00c3eec3643f1 100644 (file)
@@ -44,6 +44,9 @@ if ( file_exists(GALETTE_ROOT . 'config/local_paths.inc.php') ) {
 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);
 }
index f2d00c390b8bc425696a76860a23a4c3206498ae..81b497fa8c15c2aaf0c9ddeda7ee4d88a001fef9 100644 (file)
@@ -37,6 +37,7 @@
  */
 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');
index e19efddea1732741cdcefae831d9c581da07e4d8..dbe55d0780c3dbc582bf068285a7d20d6fcc43c4 100644 (file)
@@ -37,7 +37,7 @@
  * @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;
@@ -66,9 +66,9 @@ case 'members':
     $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;
 }
index b1f67232d38a6bf83f1005dc79d7d40d3703697e..5d4ee2039c829b1290b3dac371d039c83980e376 100644 (file)
@@ -38,7 +38,7 @@
 
 use Galette\Entity\DynamicFields as DynamicFields;
 use Galette\DynamicFieldsTypes\DynamicFieldType as DynamicFieldType;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 
 /** @ignore */
@@ -130,10 +130,10 @@ if ( $form_name == '' ) {
                     }
                 } catch (Exception $e) {
                     /** FIXME */
-                    $log->log(
+                    Analog::log(
                         'An error occured adding new dynamic field. | ' .
                         $e->getMessage(),
-                        KLogger::ERR
+                        Analog::ERROR
                     );
                 }
             }
@@ -229,10 +229,10 @@ if ( $form_name == '' ) {
                 /** 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
                 );
             }
         }
index 83775184613492bcd98dded92fd46420cabc5a81..d6679dc21d36c9a6349956fda47912f67f9f001b 100644 (file)
@@ -36,7 +36,7 @@
  * @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;
 
@@ -102,9 +102,9 @@ if ( isset($_POST['valid']) ) {
             }
         } catch (Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'An error occured checking field duplicity' . $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
         }
 
@@ -141,9 +141,9 @@ if ( isset($_POST['valid']) ) {
                 );
             } 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.");
             }
@@ -176,10 +176,10 @@ if ( isset($_POST['valid']) ) {
             } 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");
             }
@@ -204,9 +204,9 @@ if ( isset($_POST['valid']) ) {
                 }catch (Exception $e) {
                     /** FIXME */
                     $zdb->db->rollBack();
-                    $log->log(
+                    Analog::log(
                         'Unable to store field ' . $field_id . ' values',
-                        KLogger::ERR
+                        Analog::ERROR
                     );
                 }
             }
index 12830de3a9e22fb3bcb178b389f5d5cc2d31f838..36e02a5334f2995c4fdb84ab1675ecfe7ac17c6c 100644 (file)
@@ -39,7 +39,7 @@
  */
 
 use Galette\IO\Pdf;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /** @ignore */
 require_once 'includes/galette.inc.php';
@@ -66,7 +66,7 @@ if ( isset($_GET['from']) && $_GET['from'] === 'mailing' ) {
     $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();
     }
index e20e1dd1ad5148bf3eafd41b8b40d6fdd99c1941..6fe5bb8f658b7c95de0eee3ab7b95e1087dd3338 100644 (file)
@@ -34,7 +34,7 @@
  * @link      http://galette.tuxfamily.org
  */
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 require_once 'includes/galette.inc.php';
 
@@ -58,9 +58,9 @@ if ( $id !== null ) {
     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();
     }
index 948f130f6442a4d6626240a7f4fd7ce5432a6d0c..312dcff1111db12909335208c4069d35b9967304 100644 (file)
  * @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();
@@ -63,18 +63,18 @@ if ( $login->isAdmin() || $login->isStaff() ) {
         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');
 }
index 42e1c178339a47193a4e8c39120cd45b9193ad84..4640d622bff82ed071c91b6036409be966756784 100644 (file)
@@ -40,7 +40,7 @@ if (!defined('GALETTE_ROOT')) {
        die("Sorry. You can't access directly to this file");
 }
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 function PasswordImageName($c)
 {
@@ -258,10 +258,10 @@ function get_numeric_form_value($name, $defval)
     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;
     }
index 284235d73930cc11d1646cbfa4a549930f5a00d5..0471cb2931e24c1a0b30473c583619825da64f4f 100644 (file)
@@ -68,6 +68,10 @@ if ( !$installed && !$installer ) {
     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';
 }
@@ -82,17 +86,19 @@ if (defined('GALETTE_XHPROF_PATH')
 }
 
 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
@@ -101,7 +107,9 @@ session_start();
 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');
@@ -114,7 +122,10 @@ if ( !isset($_COOKIE['show_galette_dashboard']) ) {
     );
 }
 
-@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 .
@@ -124,28 +135,68 @@ set_include_path(
 );
 
 /*------------------------------------------------------------------------------
-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
+        )
     )
 );
 
@@ -198,7 +249,9 @@ if ( !$installer ) { //If we're not working from installer
     */
     $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
index 66f2445b0d092f9c8ee88f94b6086bdea9414516..d11dd4ad1a130bb346dce789441fbbae70206f5b 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('GALETTE_ROOT')) {
        die("Sorry. You can't access directly to this file");
 }
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 $disable_gettext=true;
 
@@ -93,10 +93,10 @@ function addDynamicTranslation($text_orig, $error_detected)
                 $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,
@@ -119,10 +119,10 @@ function addDynamicTranslation($text_orig, $error_detected)
         }
     } 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;
     }
@@ -154,11 +154,11 @@ function deleteDynamicTranslation($text_orig, $error_detected)
         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;
     }
@@ -199,10 +199,10 @@ function updateDynamicTranslation(
         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;
     }
@@ -230,14 +230,14 @@ function getDynamicTranslation($text_orig, $text_locale)
         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;
     }
index 97ccf188ed230c18c57b57cce4f5f0992aca0b0b..0715404f1a92697ab25d8a5eaf6d77ba107e7d07 100644 (file)
@@ -932,10 +932,10 @@ case 'u7':
                 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() .
diff --git a/galette/lib/Galette/Common/KLogger.php b/galette/lib/Galette/Common/KLogger.php
deleted file mode 100644 (file)
index a130b41..0000000
+++ /dev/null
@@ -1,444 +0,0 @@
-<?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
index 4a286d764e27c451f5184f4a807456be75c7f5c5..4fac8476aa641664803762f6c46f6de6a69f3262 100644 (file)
@@ -40,6 +40,8 @@
 
 namespace Galette\Common;
 
+use Analog\Analog as Analog;
+
 /**
  * class XHProf
  *
@@ -113,9 +115,9 @@ 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;
@@ -145,9 +147,9 @@ class XHProf
             $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;
index 4942ed8478010665835113cc3b45bc83211c990a..b280be1bf17a84ececb416f06b9d6a1343908926 100644 (file)
@@ -36,7 +36,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\Klogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Zend_Db wrapper
@@ -67,8 +67,6 @@ class Db extends \Zend_Db
     */
     function __construct()
     {
-        global $log;
-
         $_type = null;
         try {
             if ( TYPE_DB === 'mysql' ) {
@@ -91,25 +89,25 @@ class Db extends \Zend_Db
             );
             $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;
         }
@@ -130,7 +128,6 @@ class Db extends \Zend_Db
      */
     public function checkDbVersion()
     {
-        global $log;
         try {
             $select = new \Zend_Db_Select($this->db);
             $select->from(
@@ -141,9 +138,9 @@ class Db extends \Zend_Db
             $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;
         }
@@ -210,8 +207,6 @@ class Db extends \Zend_Db
     */
     public static function testConnectivity($type, $user, $pass, $host, $port, $db)
     {
-        global $log;
-
         $_type = null;
         try {
             if ( $type === 'mysql' ) {
@@ -235,9 +230,9 @@ class Db extends \Zend_Db
             $_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) {
@@ -249,18 +244,18 @@ class Db extends \Zend_Db
                 $_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;
         }
@@ -274,15 +269,13 @@ class Db extends \Zend_Db
     */
     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
             );
         }
     }
@@ -298,11 +291,9 @@ class Db extends \Zend_Db
     */
     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(
@@ -326,7 +317,7 @@ class Db extends \Zend_Db
             $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;
@@ -341,9 +332,9 @@ class Db extends \Zend_Db
                     $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;
                 }
@@ -365,9 +356,9 @@ class Db extends \Zend_Db
                     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;
@@ -392,9 +383,9 @@ class Db extends \Zend_Db
                         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;
                 }
@@ -411,9 +402,9 @@ class Db extends \Zend_Db
                         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;
                 }
@@ -426,9 +417,9 @@ class Db extends \Zend_Db
                     );
                     $results['delete'] = true;
                 } catch (\Exception $e) {
-                    $log->log(
+                    Analog::log(
                         'Cannot DELETE records | ' .$e->getMessage(),
-                        KLogger::WARN
+                        Analog::WARNING
                     );
                     $results['delete'] = $e;
                 }
@@ -440,9 +431,9 @@ class Db extends \Zend_Db
                 $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;
             }
@@ -506,9 +497,9 @@ class Db extends \Zend_Db
                         ' 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
                     );
                 }
 
@@ -520,10 +511,10 @@ class Db extends \Zend_Db
             $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
             );
         }
     }
@@ -545,10 +536,10 @@ class Db extends \Zend_Db
             $this->_db->getConnection()->exec($query);
 
         }catch (\Exception $e) {
-            $log->log(
+            Analog::log(
                 'Cannot SET NAMES on table `' . $table . '`. ' .
                 $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
         }
 
@@ -618,10 +609,10 @@ class Db extends \Zend_Db
                 );
             }
         } 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
             );
         }
     }
index 9d92b9062a8d32565e7fe53cdb92b162ebba44a2..a1cc15d6e68b2933c21620208f89045e94b1ad29 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Error handler
@@ -72,73 +72,86 @@ class Error
 
         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");
         }
     }
 }
index d9179a5a0c89976570ef05d0db0efc948f91e0ae..0e6b65e338d28f87c8d26f322b49181b257ad26b 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /** @ignore */
 require_once 'class.phpmailer.php';
@@ -116,10 +116,10 @@ class GaletteMail
                     // 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;
                 }
@@ -186,10 +186,10 @@ class GaletteMail
                 //- 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;
@@ -275,10 +275,10 @@ class GaletteMail
             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;
@@ -287,17 +287,17 @@ class GaletteMail
                 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;
@@ -317,9 +317,9 @@ class GaletteMail
         global $log;
         $valid = \PHPMailer::ValidateAddress($address);
         if ( !$valid ) {
-            $log->log(
+            Analog::log(
                 '[GaletteMail] Adresss `' . $address . '` is not valid ',
-                KLogger::DEBUG
+                Analog::DEBUG
             );
         }
         return $valid;
@@ -340,9 +340,9 @@ class GaletteMail
             $url
         );
         if ( !$valid ) {
-            $log->log(
+            Analog::log(
                 '[GaletteMail] `' . $url . '` is not an url',
-                KLogger::DEBUG
+                Analog::DEBUG
             );
         }
         return $valid;
index 6e9cfb65aeb8f117d013754740eceec56f6ae2bc..a4faf4082657ba7b9db667cdf2cfb24c907bcb5f 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * History management
@@ -119,16 +119,16 @@ class History extends Pagination
 
             $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;
         }
@@ -149,9 +149,9 @@ class History extends Pagination
             $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;
@@ -160,9 +160,9 @@ class History extends Pagination
             return true;
         } catch (\Exception $e) {
             /** TODO */
-            $log->log(
+            Analog::log(
                 'Unable to flush logs. | ' . $e->getMessage(),
-                KLogger::WARN
+                Analog::WARNING
             );
         }
     }
@@ -180,7 +180,7 @@ class History extends Pagination
             $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;
@@ -197,13 +197,13 @@ class History extends Pagination
             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;
         }
@@ -228,13 +228,13 @@ class History extends Pagination
             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;
         }
@@ -251,9 +251,9 @@ class History extends Pagination
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[History] Getting property `' . $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         if ( in_array($name, $this->pagination_fields) ) {
@@ -270,10 +270,10 @@ class History extends Pagination
                         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;
                     }
@@ -283,9 +283,9 @@ class History extends Pagination
                     break;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[History] Unable to get proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
@@ -305,9 +305,9 @@ class History extends Pagination
         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();
@@ -324,9 +324,9 @@ class History extends Pagination
                     break;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[History] Unable to set proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
index 71b9b4eb682390afdb8974b557491ac4706d29a4..387cbf8a388497aea05b6b2a2c04c52a0566265a 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * i18n handling
@@ -112,7 +112,7 @@ class I18n
     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(
@@ -121,9 +121,9 @@ class I18n
 
         //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
index 61651973a4a32046b0a466354b6e07e7c8fe2467..9cdba940c75323286410014a568ec0abfbc7e7de 100644 (file)
@@ -41,7 +41,7 @@ use Galette\Repository\Groups as Groups;
 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
@@ -80,7 +80,7 @@ class Login extends Authentication
     */
     public function logIn($user, $passe)
     {
-        global $zdb, $log, $i18n;
+        global $zdb, $i18n;
 
         try {
             $select = new \Zend_Db_Select($zdb->db);
@@ -104,20 +104,20 @@ class Login extends Authentication
             );
             $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;
@@ -160,18 +160,18 @@ class Login extends Authentication
                 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;
         }
     }
@@ -186,7 +186,7 @@ class Login extends Authentication
     */
     public function loginExists($user)
     {
-        global $zdb, $log;
+        global $zdb;
 
         try {
             $select = new \Zend_Db_Select($zdb->db);
@@ -202,13 +202,13 @@ class Login extends Authentication
                 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;
index 2ed144ba1dd5325e2940b7475a405e9816343246..a9a9eb69e2a2152400bb0f84dfa484e71558f774 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * This class stores and serve the logo.
index 195b0f2b9401171a4c193bd49c9fb6fd016e439b..8b8f363f6f9c456f98f88ec6aa80197b1f932cc8 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Mailing features
@@ -169,19 +169,19 @@ class Mailing extends GaletteMail
                 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;
         }
@@ -211,11 +211,11 @@ class Mailing extends GaletteMail
             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;
@@ -234,18 +234,18 @@ class Mailing extends GaletteMail
             ) {
                 $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;
         }
index 207e55c3ed6db1ba1508a0f8461bcfe1d9357243..53379f09b6445b573ce16460083fa82ac960fc68 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Entity\Adherent;
 
 /**
@@ -81,10 +81,10 @@ class MailingHistory extends History
         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
             );
         }
     }
@@ -112,7 +112,7 @@ class MailingHistory extends History
             $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;
@@ -161,13 +161,13 @@ class MailingHistory extends History
             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;
         }
@@ -202,10 +202,10 @@ class MailingHistory extends History
             $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;
         }
@@ -231,10 +231,10 @@ class MailingHistory extends History
             $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;
         }
@@ -268,9 +268,9 @@ class MailingHistory extends History
             $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;
         }
@@ -317,18 +317,18 @@ class MailingHistory extends History
                 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;
         }
index 43b92b9fbe9fa51fe66f1a4c3f08a207e2da8cde..2ea092f70cb71c7f20cbd20cb88e268675dff301 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Pagination and ordering facilities
@@ -142,10 +142,10 @@ abstract class Pagination
         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;
         }
@@ -272,20 +272,20 @@ abstract class Pagination
     {
         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
             );
         }
     }
@@ -302,10 +302,10 @@ abstract class Pagination
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[' . get_class($this) . '|Pagination] Setting property `' .
             $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         $rname = '_' . $name;
@@ -314,12 +314,12 @@ abstract class Pagination
             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;
@@ -337,12 +337,12 @@ abstract class Pagination
             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;
@@ -353,19 +353,19 @@ abstract class Pagination
             ) {
                 $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;
         }
index 288749d72e62fbb2d1dec2d2a27788b18dbe5112..441285495133163583439d824f9c05cd9750f17a 100644 (file)
@@ -40,7 +40,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Entity\Adherent;
 
 /**
@@ -124,17 +124,17 @@ class Password
                 )
             );
             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;
         }
@@ -167,9 +167,9 @@ class Password
 
             $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;
@@ -178,17 +178,17 @@ class Password
                 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;
         }
@@ -215,17 +215,17 @@ class Password
                 )
             );
             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;
         }
@@ -251,9 +251,9 @@ class Password
             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;
         }
@@ -279,18 +279,18 @@ class Password
                 )
             );
             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;
         }
index 0ee65a521cb1dae362204e6231c840db6c00ae95..138ea967b2a3455cd477ab9043481c734abe9792 100644 (file)
@@ -38,7 +38,7 @@
 namespace Galette\Core;
 
 use Galette\Entity\Adherent;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Picture handling
@@ -361,9 +361,9 @@ class Picture
                     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 {
@@ -373,9 +373,9 @@ class Picture
                     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
@@ -389,10 +389,10 @@ class Picture
             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;
         }
@@ -423,9 +423,9 @@ class Picture
         $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' ) {
@@ -452,38 +452,38 @@ class Picture
                 $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
             );
         }
 
@@ -525,10 +525,10 @@ class Picture
             $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;
         }
@@ -562,30 +562,30 @@ class Picture
             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;
                 }
@@ -637,10 +637,10 @@ class Picture
                 break;
             }
         } else {
-            $log->log(
+            Analog::log(
                 '[' . $class . '] GD is not present - ' .
                 'pictures could not be resized!',
-                KLogger::ERR
+                Analog::ERROR
             );
         }
     }
index 4f815f5f5ad3df245d153d5b387592767fe92098..8f61dde38039f0dc0c4b53df4c72ab8820e6b164 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Plugins class for galette
@@ -172,10 +172,10 @@ class Plugins
 
         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,
@@ -183,11 +183,11 @@ class Plugins
             );
         } 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,
index 8050b0d85b2a3cc95a5e5fd662d56484e052f0c5..4e819d926c581c58e38099e4c6e927d3e0eb99e5 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Core;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Entity\Adherent as Adherent;
 
 /**
@@ -177,9 +177,9 @@ class Preferences
         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(
@@ -204,16 +204,16 @@ class Preferences
                     );
                 }
             } 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
             );
         }
     }
@@ -237,10 +237,10 @@ class Preferences
             }
             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;
         }
@@ -281,15 +281,15 @@ class Preferences
                 $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;
         }
@@ -322,26 +322,26 @@ class Preferences
             );
 
             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;
         }
@@ -481,9 +481,9 @@ class Preferences
                 return $this->_prefs[$name];
             }
         } else {
-            $log->log(
+            Analog::log(
                 'Preference `' . $name . '` is not set or is forbidden',
-                KLogger::INFO
+                Analog::INFO
             );
             return false;
         }
@@ -503,10 +503,10 @@ class Preferences
 
         //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;
         }
index 9d8d48c9dd3b15a340268c7983a5cd5af9d5afac..6ea5e711ede8eb659e2522780a517bec67cc5f07 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\DynamicFieldsTypes;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Choice field type
index 880ebbda8e11ae9d2df568d84edf0e48673dfcbb..8c4877674c367181b1717fae66b4f9107947ce31 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\DynamicFieldsTypes;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Entity\DynamicFields as DynamicFields;
 
 /**
@@ -118,10 +118,10 @@ abstract class DynamicFieldType
                 }
             } // $result != false
         } catch (Exception $e) {
-            $log->log(
+            Analog::log(
                 'Unable to retrieve fields types for field ' . $this->id . ' | ' .
                 $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
         }
     }
@@ -151,13 +151,13 @@ abstract class DynamicFieldType
                 }
             }
         } 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
             );
         }
     }
@@ -321,9 +321,9 @@ abstract class DynamicFieldType
         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;
         }
index 2a9f36d3b70a3ed345ecfb4cf8bba7985b5aa744..23151cc2005a5e6c319c196623b890fcc17b249d 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\DynamicFieldsTypes;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Line field type
index e16ca077d241f649eef06535f391393e68a6e14c..6729e98db572dfca2bd7d2e64cab1e033dde2c59 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\DynamicFieldsTypes;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Separator field type
index d708db0318b0191f1f149e52318d2e177df085c8..c447ed168467da594f386cbad4b4154e8f29c949 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\DynamicFieldsTypes;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Separator field type
index 52900f01583ce24550d4b91dc46ca72c9562284b..cd045a2e5ec0138b361e974f27d582a4e717798d 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
@@ -158,9 +158,9 @@ class Adherent
                 $deps
             );
         } else if ( $deps !== null ) {
-            $log->log(
+            Analog::log(
                 '$deps shoud be an array, ' . gettype($deps) . ' given!',
-                KLogger::WARN
+                Analog::WARNING
             );
         }
 
@@ -247,13 +247,13 @@ class Adherent
             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;
         }
@@ -284,14 +284,14 @@ class Adherent
             $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;
         }
@@ -619,14 +619,14 @@ class Adherent
                 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;
         }
@@ -650,17 +650,17 @@ class Adherent
                 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;
         }
@@ -762,11 +762,11 @@ class Adherent
                             }
                             $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(
@@ -805,13 +805,13 @@ class Adherent
                                     $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.");
                             }
@@ -858,13 +858,13 @@ class Adherent
                                         $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.");
                                 }
@@ -933,13 +933,13 @@ class Adherent
                                 );
                             }
                         } 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.");
                         }
@@ -966,16 +966,16 @@ class Adherent
         }
 
         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;
         }
@@ -1081,10 +1081,10 @@ class Adherent
             return false;
         } catch (\Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'Something went wrong :\'( | ' . $e->getMessage() . "\n" .
                 $e->getTraceAsString(),
-                KLogger::ERR
+                Analog::ERROR
             );
             return false;
         }
@@ -1107,10 +1107,10 @@ class Adherent
             );
             $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
             );
         }
     }
@@ -1147,10 +1147,10 @@ class Adherent
                         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;
                     }
index 37fc53346b59f0fe06f926f58ce089a235c095f8..e2c8eda2fbea04938819d95ed33ffc2055cb676c 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Contribution class for galette
@@ -245,10 +245,10 @@ class Contribution
             }
         } catch (\Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'An error occured attempting to load contribution #' . $id .
                 $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
             return false;
         }
@@ -344,11 +344,11 @@ class Contribution
                             }
                             $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(
@@ -432,16 +432,16 @@ class Contribution
         }
 
         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;
         }
@@ -489,13 +489,13 @@ class Contribution
             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;
         }
@@ -587,10 +587,10 @@ class Contribution
         } 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;
         }
@@ -621,11 +621,11 @@ class Contribution
             );
             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;
         }
@@ -662,10 +662,10 @@ class Contribution
             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;
         }
@@ -733,9 +733,9 @@ class Contribution
             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;
         }
@@ -764,18 +764,18 @@ class Contribution
                 );
                 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;
         }
@@ -801,10 +801,10 @@ class Contribution
             );
             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;
         }
@@ -875,10 +875,10 @@ class Contribution
                         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;
                     }
@@ -915,9 +915,9 @@ class Contribution
                     return _T("Paypal");
                     break;
                 default:
-                    $log->log(
+                    Analog::log(
                         'Unknown payment type ' . $this->_payment_type,
-                        KLogger::WARN
+                        Analog::WARNING
                     );
                     return '-';
                     break;
@@ -951,9 +951,9 @@ class Contribution
                 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;
@@ -968,9 +968,9 @@ class Contribution
                         $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;
@@ -982,11 +982,11 @@ class Contribution
                     }
                     $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(
@@ -1005,18 +1005,18 @@ class Contribution
                 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;
             }
index d9c8f39350b2fcfdffeed411fc94a4ac66a5d3e6..97dd37b48e4d0c815504ad522791536de678cbce 100644 (file)
@@ -37,7 +37,7 @@
 
 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.
@@ -119,14 +119,14 @@ class ContributionsTypes
             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;
         }
@@ -173,16 +173,16 @@ class ContributionsTypes
                 $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;
         }
@@ -219,13 +219,13 @@ class ContributionsTypes
             }
             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;
         }
@@ -250,9 +250,9 @@ class ContributionsTypes
             $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 ) {
@@ -265,13 +265,13 @@ class ContributionsTypes
             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;
         }
@@ -298,13 +298,13 @@ class ContributionsTypes
             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;
         }
@@ -341,10 +341,10 @@ class ContributionsTypes
             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;
         }
@@ -366,9 +366,9 @@ class ContributionsTypes
         $ret = $this->getidByLabel($label);
 
         if ( $ret !== false ) {
-            $log->log(
+            Analog::log(
                 'Contribution type `' . $label . '` already exists',
-                KLogger::WARN
+                Analog::WARNING
             );
             return -2;
         }
@@ -385,9 +385,9 @@ class ContributionsTypes
             );
 
             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,
@@ -398,10 +398,10 @@ class ContributionsTypes
             }
         } catch (\Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'Unable to add new contributions type `' . $label . '` | ' .
                 $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
             return false;
         }
@@ -435,7 +435,7 @@ class ContributionsTypes
             $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(
@@ -448,17 +448,17 @@ class ContributionsTypes
                 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;
         }
@@ -486,17 +486,17 @@ class ContributionsTypes
                 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;
         }
@@ -525,10 +525,10 @@ class ContributionsTypes
             }
         } 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;
index 02ad3276378cfa683b840bac5b52326a8f734f1a..1c588e4439ca676cf55641e87678130f3e14fb82 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
@@ -161,13 +161,13 @@ class DynamicFields
             }
             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
             );
         }
     }
@@ -268,13 +268,13 @@ class DynamicFields
                 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
             );
         }
     }
@@ -358,13 +358,13 @@ class DynamicFields
             }
         } 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
             );
         }
     }
@@ -440,20 +440,20 @@ class DynamicFields
                 }
 
                 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,
@@ -482,12 +482,12 @@ class DynamicFields
             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;
         }
@@ -578,10 +578,10 @@ class DynamicFields
                 return false;
             }
         } catch (\Exception $e) {
-            $log->log(
+            Analog::log(
                 __METHOD__ . ' | Unable to retrieve field `' . $id .
                 '` informations | ' . $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
             return false;
         }
index 0255626caa6e185532c5d023a1587db353d09a4a..22fd0efed66fae51f7f0b7d0f952b614d20345f2 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Fields categories class for galette
@@ -107,14 +107,14 @@ class FieldsCategories
             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;
         }
@@ -147,16 +147,16 @@ class FieldsCategories
                 $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;
         }
index 12da90e44a680166e6d64aaaf580d11bff23de72..9d4a9d8fef67d9b698a4cd2e17c54659dfdaecea 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Fields config class for galette :
@@ -138,12 +138,12 @@ class FieldsConfig
                 $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);
                 }
@@ -177,15 +177,15 @@ class FieldsConfig
 
             }
         } 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;
         }
@@ -207,16 +207,16 @@ class FieldsConfig
         $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 :)
@@ -227,10 +227,10 @@ class FieldsConfig
                 );
                 $t->installInit();
             } catch (\Exception $e) {
-                $log->log(
+                Analog::log(
                     'Unable to delete fields configuration for reinitialization' .
                     $e->getMessage(),
-                    KLogger::WARN
+                    Analog::WARNING
                 );
                 return false;
             }
@@ -283,29 +283,29 @@ class FieldsConfig
                 );
                 $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;
         }
@@ -428,33 +428,33 @@ class FieldsConfig
                 }
             }
 
-            $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;
         }
index 0fa9c782e6f123cecd91f643a687d25f279ff6c3..0cb9809d8f6667458642858e6a911b8240fafe39 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Group entity
@@ -109,13 +109,13 @@ class Group
             $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;
         }
@@ -198,13 +198,13 @@ class Group
                     $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
                 );
             }
         }
@@ -245,14 +245,14 @@ class Group
             }
             $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
             );
         }
     }
@@ -297,10 +297,10 @@ class Group
             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;
         }
@@ -333,12 +333,12 @@ class Group
 
             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 :("));
         }
@@ -406,10 +406,10 @@ class 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;
         }
@@ -615,10 +615,10 @@ class Group
                 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(
@@ -633,17 +633,17 @@ class Group
                     $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 . '` ' .
@@ -655,18 +655,18 @@ class Group
             //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;
         }
@@ -691,10 +691,10 @@ class Group
                 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(
@@ -709,17 +709,17 @@ class Group
                     $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 . '` ' .
@@ -731,18 +731,18 @@ class Group
             //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;
         }
index 818eb2361c5a07bfcf9476252517e57980321ef0..97b5b00555dbdeca6d6bf87a303d5889cb45a4fa 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Politeness class for galette
index 7eaaf3f493373195bf9c4d2b7525efee0cee1906..aae656e2d3b1b88d83cbab7c09930c9b8d684056 100644 (file)
@@ -37,7 +37,7 @@
 
 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.
@@ -121,15 +121,15 @@ class Status
                 $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;
         }
@@ -151,7 +151,7 @@ class Status
                 ->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);
@@ -160,13 +160,13 @@ class Status
             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
             );
         }
     }
@@ -189,7 +189,7 @@ class Status
             $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(
@@ -201,13 +201,13 @@ class Status
             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;
         }
@@ -234,13 +234,13 @@ class Status
             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;
         }
@@ -279,10 +279,10 @@ class Status
             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;
         }
@@ -304,9 +304,9 @@ class Status
         $ret = $this->getidByLabel($label);
 
         if ( $ret !== false ) {
-            $log->log(
+            Analog::log(
                 'Status `' . $label . '` already exists',
-                KLogger::WARN
+                Analog::WARNING
             );
             return -2;
         }
@@ -323,9 +323,9 @@ class Status
             );
 
             if ( $ret >  0) {
-                $log->log(
+                Analog::log(
                     'New status `' . $label . '` added successfully.',
-                    KLogger::INFO
+                    Analog::INFO
                 );
                 return $zdb->db->lastInsertId(
                     PREFIX_DB . self::TABLE,
@@ -336,10 +336,10 @@ class Status
             }
         } catch (\Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'Unable to add new status `' . $label . '` | ' .
                 $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
             return false;
         }
@@ -373,7 +373,7 @@ class Status
             $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(
@@ -386,13 +386,13 @@ class Status
                 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;
         }
@@ -420,16 +420,16 @@ class Status
                 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;
         }
@@ -458,10 +458,10 @@ class Status
             }
         } 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;
index f30b96a1c6b463a15cd942e3ebf721436038a453..536a95e2b2dd1e436ca9a64cb729542946d6fc70 100644 (file)
@@ -38,7 +38,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * Texts class for galette
@@ -273,31 +273,31 @@ class Texts
                         $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;
         }
@@ -338,10 +338,10 @@ class Texts
             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;
         }
@@ -368,14 +368,14 @@ class Texts
             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;
         }
@@ -445,16 +445,16 @@ class Texts
                     $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;
         }
index 0d1aff839d497d6a1eed1cca48eb3c38ffbda1e9..aa9d9b897f3c52124d22bbf220e1cadc1ed9b6b7 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\Entity;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Repository\Contributions as Contributions;
 
 /**
@@ -142,10 +142,10 @@ class Transaction
             }
         } catch (\Exception $e) {
             /** FIXME */
-            $log->log(
+            Analog::log(
                 'Cannot load transaction form id `' . $id . '` | ' .
                 $e->getMessage(),
-                KLogger::WARN
+                Analog::WARNING
             );
             return false;
         }
@@ -193,10 +193,10 @@ class Transaction
             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;
         }
@@ -261,11 +261,11 @@ class Transaction
                             }
                             $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(
@@ -323,16 +323,16 @@ class Transaction
         }
 
         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;
         }
@@ -398,10 +398,10 @@ class Transaction
         } 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;
         }
@@ -425,14 +425,14 @@ class Transaction
             $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
             );
         }
     }
@@ -455,14 +455,14 @@ class Transaction
             $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
             );
         }
     }
index ed4500b9c698ff72babdcdc7e57d066359a45eb2..6dc9fc2d16b0773054ef35d457f933449965bb0d 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
 
@@ -164,9 +164,9 @@ class AdvancedMembersList extends MembersList
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[AdvancedMembersList] Getting property `' . $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         if ( in_array($name, $this->pagination_fields)
@@ -192,10 +192,10 @@ class AdvancedMembersList extends MembersList
                         }
                     } 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;
                     }
@@ -212,9 +212,9 @@ class AdvancedMembersList extends MembersList
                 }
                 return $this->$rname;
             } else {
-                $log->log(
+                Analog::log(
                     '[AdvancedMembersList] Unable to get proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
@@ -237,9 +237,9 @@ class AdvancedMembersList extends MembersList
         ) {
             parent::__set($name, $value);
         } else {
-            $log->log(
+            Analog::log(
                 '[AdvancedMembersList] Setting property `' . $name . '`',
-                KLogger::DEBUG
+                Analog::DEBUG
             );
 
             $prop = '_' . $name;
@@ -258,9 +258,9 @@ class AdvancedMembersList extends MembersList
                     }
                     $this->$prop = $d->format('Y-m-d');
                 } catch ( \Exception $e ) {
-                    $log->log(
+                    Analog::log(
                         'Incorrect date format! was: ' . $value,
-                        KLogger::WARN
+                        Analog::WARNING
                     );
                 }
                 break;
@@ -268,10 +268,10 @@ class AdvancedMembersList extends MembersList
                 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;
@@ -288,16 +288,16 @@ class AdvancedMembersList extends MembersList
                         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
                         );
                     }
                 }
@@ -317,23 +317,23 @@ class AdvancedMembersList extends MembersList
                         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;
             }
index 52938b26fe3e4138976708fee52498c4e0604d4e..cb25a1303cd06d70d4800a5034ec28db8d942b06 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
@@ -128,9 +128,9 @@ class MembersList extends Pagination
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[MembersList] Getting property `' . $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         if ( in_array($name, $this->pagination_fields) ) {
@@ -144,9 +144,9 @@ class MembersList extends Pagination
                     return $this->$name;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[MembersList] Unable to get proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
@@ -167,9 +167,9 @@ class MembersList extends Pagination
         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) {
@@ -179,10 +179,10 @@ class MembersList extends Pagination
                     $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;
@@ -197,10 +197,10 @@ class MembersList extends Pagination
                     $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;
@@ -212,12 +212,12 @@ class MembersList extends Pagination
                     $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;
                 }
@@ -230,16 +230,16 @@ class MembersList extends Pagination
                     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;
@@ -247,9 +247,9 @@ class MembersList extends Pagination
                 $this->$name = $value;
                 break;
             default:
-                $log->log(
+                Analog::log(
                     '[MembersList] Unable to set proprety `' . $name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
                 break;
             }
index c49bbb34b44240c4183818e78d7f6743ff36581e..2fbaa23f178f260f5f9aa138f41c13854b65991b 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\IO;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * CSV exports
@@ -318,17 +318,17 @@ class Csv
                 $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;
         }
index c794f18484890aca7a3b18cbcd1893ed57f84a62..8c0dcaee1a92ddacd4176a77f18625597eb40824 100644 (file)
@@ -37,7 +37,7 @@
 
 namespace Galette\IO;
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /**
  * News class for galette
@@ -125,10 +125,10 @@ class News
                 $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 {
@@ -251,9 +251,9 @@ class News
 
             $this->_tweets = $tweets;
         } catch (\Exception $e) {
-            $log->log(
+            Analog::log(
                 'Unable to load Tweets :( | ' . $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
             $this->_tweets = array();
         }
@@ -296,9 +296,9 @@ class News
 
             $this->_gplus = $gposts;
         } catch ( \Exception $e ) {
-            $log->log(
+            Analog::log(
                 'Unable to load GooGlePlus posts :( | ' . $e->getMessage(),
-                KLogger::ERR
+                Analog::ERROR
             );
         }
     }
@@ -326,9 +326,9 @@ class News
 
             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 ) {
@@ -336,9 +336,9 @@ class News
                     foreach ( $errors as $e ) {
                         $msg .= "\n" . $e->message;
                     }
-                    $log->log(
+                    Analog::log(
                         $msg,
-                        KLogger::INFO
+                        Analog::INFO
                     );
                 }
                 libxml_clear_errors();
@@ -347,9 +347,9 @@ class News
             }
             return true;
         } else {
-            $log->log(
+            Analog::log(
                 'Required modules for Tweeter access are not present.',
-                KLogger::WARN
+                Analog::WARNING
             );
             return false;
         }
@@ -387,23 +387,23 @@ class News
                 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;
         }
index 045169f471edb92f0d354770a81f72c3b3dad333..84c0023d2b404ab28f96389bf85d3bedf7b06016 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
@@ -161,13 +161,13 @@ class Contributions extends Pagination
             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;
         }
@@ -214,13 +214,13 @@ class Contributions extends Pagination
             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;
         }
@@ -253,13 +253,13 @@ class Contributions extends Pagination
             }
         } 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;
         }
@@ -287,13 +287,13 @@ class Contributions extends Pagination
             $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;
         }
@@ -394,9 +394,9 @@ class Contributions extends Pagination
             $qry = $select->__toString();
         } catch (\Exception $e) {
             /** TODO */
-            $log->log(
+            Analog::log(
                 __METHOD__ . ' | ' . $e->getMessage(),
-                KLogger::WARN
+                Analog::WARNING
             );
         }
     }
@@ -472,18 +472,18 @@ class Contributions extends Pagination
                 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;
         }
@@ -501,9 +501,9 @@ class Contributions extends Pagination
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[Contributions] Getting property `' . $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         if ( in_array($name, $this->pagination_fields) ) {
@@ -535,9 +535,9 @@ class Contributions extends Pagination
                     break;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[Contributions] Unable to get proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
@@ -557,9 +557,9 @@ class Contributions extends Pagination
         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();
@@ -649,11 +649,11 @@ class Contributions extends Pagination
                             $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;
                     }
@@ -663,9 +663,9 @@ class Contributions extends Pagination
                     break;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[Contributions] Unable to set proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
index 970a26749d570d63788a375a029e0a36a284f0e9..5605774b2080b49bdfcbc5c1dc0756d68459f14c 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
 
@@ -80,13 +80,13 @@ class Groups
             }
             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
             );
 
         }
@@ -137,13 +137,13 @@ class Groups
             }
             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
             );
         }
     }
@@ -190,9 +190,9 @@ class Groups
                 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 ) {
@@ -205,14 +205,14 @@ class Groups
             }
             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;
         }
@@ -241,10 +241,10 @@ class Groups
                 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
@@ -261,17 +261,17 @@ class Groups
                     $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 .
@@ -289,11 +289,11 @@ class Groups
             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;
         }
@@ -319,13 +319,13 @@ class Groups
             $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
             );
         }
     }
index 7e5122d19e6e817230a19f16165ccba30bfc0b7c..cc17803ed3c55cecd4f4051dd8bb21124ad60968 100644 (file)
@@ -39,7 +39,7 @@ namespace Galette\Repository;
 
 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;
@@ -227,10 +227,10 @@ class Members
 
             $filters->query = $select->__toString();
 
-            $log->log(
+            Analog::log(
                 "The following query will be executed: \n" .
                 $filters->query,
-                KLogger::DEBUG
+                Analog::DEBUG
             );
 
             $members = array();
@@ -250,13 +250,13 @@ class Members
             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
             );
         }
     }
@@ -301,9 +301,9 @@ class Members
                     $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 ' .
@@ -355,18 +355,18 @@ class Members
                 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;
         }
@@ -422,10 +422,10 @@ class Members
                     '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 ) {
@@ -444,14 +444,14 @@ class Members
             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;
         }
@@ -472,7 +472,7 @@ class Members
         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;
         }
 
@@ -489,10 +489,10 @@ class Members
                 }
             }
 
-            $log->log(
+            Analog::log(
                 "The following query will be executed: \n" .
                 $select->__toString(),
-                KLogger::DEBUG
+                Analog::DEBUG
             );
 
             $result = $select->query();
@@ -509,13 +509,13 @@ class Members
             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
             );
         }
     }
@@ -638,13 +638,13 @@ class Members
             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;
         }
@@ -684,13 +684,13 @@ class Members
             }
         } 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;
         }
@@ -998,10 +998,10 @@ class Members
                             $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;
@@ -1034,9 +1034,9 @@ class Members
             }
         } catch (\Exception $e) {
             /** TODO */
-            $log->log(
+            Analog::log(
                 __METHOD__ . ' | ' . $e->getMessage(),
-                KLogger::WARN
+                Analog::WARNING
             );
         }
     }
@@ -1115,10 +1115,10 @@ class Members
             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;
         }
index 5b3b7aae76aec3cb0c56a21067d1f5ae14c35673..4e9b8370b6f0a2348ac5360ca6afa8488c5f1f2f 100644 (file)
@@ -37,7 +37,7 @@
 
 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;
@@ -129,13 +129,13 @@ class Transactions extends Pagination
             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;
         }
@@ -186,13 +186,13 @@ class Transactions extends Pagination
             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;
         }
@@ -225,13 +225,13 @@ class Transactions extends Pagination
             }
         } 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;
         }
@@ -311,9 +311,9 @@ class Transactions extends Pagination
             }
         } catch (\Exception $e) {
             /** TODO */
-            $log->log(
+            Analog::log(
                 __METHOD__ . ' | ' . $e->getMessage(),
-                KLogger::WARN
+                Analog::WARNING
             );
         }
     }
@@ -381,18 +381,18 @@ class Transactions extends Pagination
             } 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;
         }
@@ -409,9 +409,9 @@ class Transactions extends Pagination
     {
         global $log;
 
-        $log->log(
+        Analog::log(
             '[Transactions] Getting property `' . $name . '`',
-            KLogger::DEBUG
+            Analog::DEBUG
         );
 
         if ( in_array($name, $this->pagination_fields) ) {
@@ -426,9 +426,9 @@ class Transactions extends Pagination
                 $name = '_' . $name;
                 return $this->$name;
             } else {
-                $log->log(
+                Analog::log(
                     '[Transactions] Unable to get proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
@@ -448,9 +448,9 @@ class Transactions extends Pagination
         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();
@@ -476,9 +476,9 @@ class Transactions extends Pagination
                     break;
                 }
             } else {
-                $log->log(
+                Analog::log(
                     '[Transactions] Unable to set proprety `' .$name . '`',
-                    KLogger::WARN
+                    Analog::WARNING
                 );
             }
         }
index 4b13c71282d47df4247c93064e47815068a72b14..6d17bd30b3eaca49024b3ef0dc837a7cadd743c5 100644 (file)
@@ -47,7 +47,7 @@ if ( !$login->isAdmin() && !$login->isStaff() ) {
 }
 
 use Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 use Galette\Filters\MembersList as MembersList;
 
 //We're done :-)
@@ -99,9 +99,9 @@ if ( $preferences->pref_mail_method == Core\Mailing::METHOD_DISABLED
             && !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) ) {
@@ -151,10 +151,10 @@ if ( $preferences->pref_mail_method == Core\Mailing::METHOD_DISABLED
         $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;
@@ -162,9 +162,9 @@ if ( $preferences->pref_mail_method == Core\Mailing::METHOD_DISABLED
         } 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
index 75ba2a1cd183c889731557270ec0d2f258dc182a..871a446141a40ed4c92a201120175a6da781ca3b 100644 (file)
@@ -45,7 +45,7 @@
  */
 
 use Galette\Core;
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /** @ignore */
 require_once 'includes/galette.inc.php';
@@ -115,9 +115,9 @@ if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
             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) ) {
@@ -127,9 +127,9 @@ if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
                 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 ) {
@@ -184,9 +184,9 @@ if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
                 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 ) {
@@ -334,9 +334,9 @@ if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
                     }
                 }
             } 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']
@@ -368,9 +368,9 @@ if ( isset($_POST['valid']) && $_POST['valid'] == '1' ) {
                     }
                 }
             } 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']
index 9084d41b6de78d64d0555e8c3924bfda5f468a8c..e96d29e66019b3a7ddb9eaf0cf8500d8b13dc520 100644 (file)
                         </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>
index 1d8a5962854042503ed5363c395819c579665199..e6ba686970529dfd36c13c5d771f7c70907b8c80 100644 (file)
@@ -36,7 +36,7 @@
  * @since     Available since 0.62
  */
 
-use Galette\Common\KLogger as KLogger;
+use Analog\Analog as Analog;
 
 /** @ignore */
 require_once 'includes/galette.inc.php';
@@ -101,14 +101,14 @@ try {
     $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
     );
 }
 
@@ -149,14 +149,14 @@ if ( is_numeric($nb_fields) && $nb_fields > 0 ) {
         $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
         );
     }
 }