Cleanup unused methods and code formatting

This commit is contained in:
Gilles Crettenand
2015-05-21 16:04:36 +02:00
parent 0d6841d106
commit 6afa8b55f7
5 changed files with 32 additions and 134 deletions

View File

@@ -1,4 +1,5 @@
<?php
require_once('DbMapping.php');
class BookNotFoundException extends WebException {
@@ -7,13 +8,6 @@ class BookNotFoundException extends WebException {
}
}
function convertMSChar($src)
{
$text = preg_replace('/([\xc0-\xdf].)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 192) * 64 + (ord(substr('$1', 1, 1)) - 128)) . ';'", $src);
$text = preg_replace('/([\xe0-\xef]..)/se', "'&#' . ((ord(substr('$1', 0, 1)) - 224) * 4096 + (ord(substr('$1', 1, 1)) - 128) * 64 + (ord(substr('$1', 2, 1)) - 128)) . ';'", $text);
return $text;
}
/**
* AudioBook is mapped on a Notice from NetBiblio
*
@@ -168,24 +162,6 @@ class AudioBook extends DbMapping
return $multiple ? $books : reset($books);
}
/**
* @param $code
* @return int
* @throws BookNotFoundException
* @throws SqlException
*/
public static function findIdByCode($code)
{
$sql = "SELECT NoticeId FROM Notices WHERE LTRIM(RTRIM(NoticeNr)) = '$code';";
$result = Connection::execute($sql, false);
if ($result === false || $result->length == 0) {
throw new BookNotFoundException($code);
}
$row = $result->current();
return $row['NoticeId'];
}
/**
* Retrieve the list of all readers (volunteers) having read at least 4 books (2 notices per book).
* Returns an associative array containing $lastname and $firstname