define ('POCHE_VERSION', '0.3');
define ('MODE_DEMO', FALSE);
+define ('DEBUG_POCHE', TRUE);
define ('CONVERT_LINKS_FOOTNOTES', FALSE);
define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE);
define ('DOWNLOAD_PICTURES', FALSE);
# /!\ Be careful if you change the lines below /!\
-require_once 'poche/pocheTool.class.php';
+require_once 'poche/pocheTools.class.php';
require_once 'poche/pocheCore.php';
require_once '3rdparty/Readability.php';
require_once '3rdparty/Encoding.php';
function display_view($view, $id = 0, $full_head = 'yes')
{
- global $tpl, $store, $msg;
+ global $tpl, $store;
switch ($view)
{
+ case 'install':
+ pocheTool::logm('install mode');
+ break;
+ case 'import';
+ pocheTool::logm('import mode');
+ break;
case 'export':
$entries = $store->retrieveAll();
$tpl->assign('export', pocheTool::renderJson($entries));
break;
case 'view':
$entry = $store->retrieveOneById($id);
-
if ($entry != NULL) {
+ pocheTool::logm('view link #' . $id);
$tpl->assign('id', $entry['id']);
$tpl->assign('url', $entry['url']);
$tpl->assign('title', $entry['title']);
else {
pocheTool::logm('error in view call : entry is NULL');
}
-
- pocheTool::logm('view link #' . $id);
break;
default: # home view
$entries = $store->getEntriesByView($view);
-
$tpl->assign('entries', $entries);
if ($full_head == 'yes') {
}
$tpl->draw('entries');
-
if ($full_head == 'yes') {
$tpl->draw('js');
$tpl->draw('footer');
}
/**
- * Appel d'une action (mark as fav, archive, delete)
+ * Call action (mark as fav, archive, delete, etc.)
*/
function action_to_do($action, $url, $id = 0)
{
- global $store, $msg;
+ global $store;
switch ($action)
{
{
$matches = array();
preg_match_all('#<\s*(img)[^>]+src="([^"]*)"[^>]*>#Si', $content, $matches, PREG_SET_ORDER);
- foreach($matches as $i => $link)
- {
+ foreach($matches as $i => $link) {
$link[1] = trim($link[1]);
- if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1]) )
- {
+ if (!preg_match('#^(([a-z]+://)|(\#))#', $link[1])) {
$absolute_path = get_absolute_link($link[2],$url);
$filename = basename(parse_url($absolute_path, PHP_URL_PATH));
$directory = create_assets_directory($id);
/**
* Retourne le lien absolu
*/
-function get_absolute_link($relative_link, $url)
-{
+function get_absolute_link($relative_link, $url) {
/* return if already absolute URL */
if (parse_url($relative_link, PHP_URL_SCHEME) != '') return $relative_link;
/**
* Téléchargement des images
*/
-
function download_pictures($absolute_path, $fullpath)
{
$rawdata = get_external_file($absolute_path);
}
return rmdir($directory);
}
-}
+}
\ No newline at end of file
public static function logm($message)
{
- $t = strval(date('Y/m/d_H:i:s')).' - '.$_SERVER["REMOTE_ADDR"].' - '.strval($message)."\n";
- file_put_contents('./log.txt',$t,FILE_APPEND);
+ if (DEBUG_POCHE) {
+ $t = strval(date('Y/m/d_H:i:s')) . ' - ' . $_SERVER["REMOTE_ADDR"] . ' - ' . strval($message) . "\n";
+ file_put_contents('./log.txt', $t, FILE_APPEND);
+ }
}
}
\ No newline at end of file