$index = array();\r
$textes = array();\r
foreach($pages as $book_page => $infos) {\r
- $file = ROOT . '/docs/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt';\r
- $text = file_get_contents($file);\r
- $text = mb_strtolower($text);\r
- $words = cubeSearch::getWords($text, false, true, false);\r
+ $tfile = ROOT . '/docs/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.txt';\r
+ $ifile = ROOT . '/docs/' . $infos['document_id'] . '/i' . $infos['document_page'] . '.txt';\r
+ $text = file_get_contents($tfile);\r
+ $ipage = file_get_contents($ifile);\r
\r
- $this->fillIndexWithWords($index, $book_page, $words);\r
- $textes[$book_page] = cubeText::removeAccents(cubeText::condenseWhite($text));\r
+ $this->fillIndexWithWords($index, $book_page, $ipage);\r
+ $textes[$book_page] = $text;\r
}\r
ksort($index);\r
}\r
\r
- protected function fillIndexWithWords(&$index, $page, $words)\r
+ protected function fillIndexWithWords(&$index, $page, $ipage)\r
{\r
- foreach($words as $word) {\r
- $woa = cubeText::removeAccents($word);\r
- if (!isset($index[$woa])) {\r
- $index[$woa] = array('total' => 0, 'words' => array());\r
- }\r
- if (!isset($index[$woa]['words'][$word])) {\r
- $index[$woa]['words'][$word] = array('total' => 0, 'pages' => array());\r
+ $words = explode('|', $ipage);\r
+\r
+ foreach($words as $worddatas) {\r
+ list($word, $count) = explode(',', $worddatas);\r
+\r
+ if (!isset($index[$word])) {\r
+ $index[$word] = array('total' => 0, 'pages' => array());\r
}\r
- if (!isset($index[$woa]['words'][$word]['pages'][$page])) {\r
- $index[$woa]['words'][$word]['pages'][$page] = 0;\r
+ if (!isset($index[$word]['pages'][$page])) {\r
+ $index[$word]['pages'][$page] = 0;\r
}\r
- $index[$woa]['total']++;\r
- $index[$woa]['words'][$word]['total']++;\r
- $index[$woa]['words'][$word]['pages'][$page]++;\r
+ $index[$word]['total'] += $count;\r
+ $index[$word]['pages'][$page] += $count;\r
}\r
}\r
\r
$size = $firstDoc->generalInfos['size'];\r
\r
$daoTheme = new wsDAOTheme($this->con);\r
- $theme = $daoTheme->getThemeOfBook($book_id);\r
+ $theme = $daoTheme->getThemeOfBook($book_id,true);\r
\r
- $index='';\r
- $textes='';\r
+ $index = '';\r
+ $textes = '';\r
\r
$this->makeTextsIndexes($book_id, $index, $textes);\r
\r
$flex->addVariable('links', $book->links);\r
$flexLight->addVariable('datas', $book->parametres->toStandardObject());\r
$flexLight->addVariable('id', $book_id, false, true, 'uint');\r
+\r
$flex->addVariable('traductions', wsLang::getTraductionWithId($book->traductions));\r
$flex->addVariable('chapters', $book->chapters);\r
$flex->addVariable('extras', '<extras>' . $book->extras . '</extras>', false, true, 'XML');\r
// Fonts\r
$flex->addFont(FONT_PATH . '/FFFATLAN_0.TTF', 'CreditsFont', 'ASCII');\r
$flex->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFont', 'Latin');\r
- $flexLight->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFont', 'Numerals');\r
+ $flexLight->addFont(FONT_PATH . '/DIN Medium_0.ttf', 'GeneralFontLight', 'Numerals');\r
$res .= $flex->compile() . "\n\n-------------------\n\n";\r
$flexLight->addVariable('datasSize', filesize(ROOT . '/books/datasCompiler/' . $book_id . '/FluidbookDatas.swf'));\r
$res .= $flexLight->compile();\r
$theme->nom = $r->nom;\r
$theme->date = $r->date;\r
$theme->proprietaire = $r->proprietaire;\r
- $theme->books = explode(',', $r->books);\r
- $theme->nbBooks = $r->nb_books;\r
+ if ($r->exists('books')) {\r
+ $theme->books = explode(',', $r->books);\r
+ $theme->nbBooks = $r->nb_books;\r
+ }\r
$theme->signature = $r->signature;\r
$theme->icones = $r->icones;\r
$p = unserialize($r->parametres);\r
return $this->singleton($r);\r
}\r
\r
- public function getThemeOfBook($book_id)\r
+ public function getThemeOfBook($book_id, $basic = false)\r
{\r
- $r = $this->con->select('SELECT * FROM themes_vue WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
+ if ($basic) {\r
+ $table = 'themes';\r
+ } else {\r
+ $table = 'theme_vue';\r
+ }\r
+ $r = $this->con->select('SELECT * FROM '.$table.' WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
return $this->singleton($r);\r
}\r
\r
$p = new wsThemeParametres($parent);\r
foreach($data as $k => $v) {\r
try {\r
- if(!isset($p->$k)){\r
+ if (!isset($p->$k)) {\r
continue;\r
}\r
$p->$k = $v;\r
- fb($v,$k);\r
+ fb($v, $k);\r
}\r
catch(Exception $e) {\r
fb($e);\r