if (! $this->store->isInstalled()) {
$this->install();
}
+ $this->store->checkTags();
}
}
switch ($action)
{
case 'add':
- $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed');
+ $options = array('http' => array('user_agent' => 'poche'));
+ $context = stream_context_create($options);
+ $json = file_get_contents(Tools::getPocheUrl() . '/inc/3rdparty/makefulltextfeed.php?url='.urlencode($url->getUrl()).'&max=5&links=preserve&exc=&format=json&submit=Create+Feed', false, $context);
$content = json_decode($json, true);
$title = $content['rss']['channel']['item']['title'];
$body = $content['rss']['channel']['item']['description'];
$themes = $this->getInstalledThemes();
$languages = $this->getInstalledLanguages();
$token = $this->user->getConfigValue('token');
- $http_auth = (isset($_SERVER['PHP_AUTH_USER']))?true:false;
+ $http_auth = (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER'])) ? true : false;
$tpl_vars = array(
'themes' => $themes,
'languages' => $languages,
* it redirects the user to the $referer link
* @return array
*/
- private function credentials() {
- if(isset($_SERVER['PHP_AUTH_USER'])) {
- return array($_SERVER['PHP_AUTH_USER'],'php_auth');
- }
- if(!empty($_POST['login']) && !empty($_POST['password'])) {
- return array($_POST['login'],$_POST['password']);
- }
- return array(false,false);
+ private function credentials() {
+ if(isset($_SERVER['PHP_AUTH_USER'])) {
+ return array($_SERVER['PHP_AUTH_USER'],'php_auth');
+ }
+ if(!empty($_POST['login']) && !empty($_POST['password'])) {
+ return array($_POST['login'],$_POST['password']);
+ }
+ if(isset($_SERVER['REMOTE_USER'])) {
+ return array($_SERVER['REMOTE_USER'],'http_auth');
+ }
+
+ return array(false,false);
}
/**
$user = $this->store->login($login, Tools::encodeString($password . $login));
if ($user != array()) {
# Save login into Session
- Session::login($user['username'], $user['password'], $login, Tools::encodeString($password . $login), array('poche_user' => new User($user)));
+ $longlastingsession = isset($_POST['longlastingsession']);
+ Session::login($user['username'], $user['password'], $login, Tools::encodeString($password . $login), $longlastingsession, array('poche_user' => new User($user)));
$this->messages->add('s', _('welcome to your poche'));
Tools::logm('login successful');
Tools::redirect($referer);
$url = NULL;
$favorite = FALSE;
$archive = FALSE;
- foreach ($value as $attr => $attr_value) {
- if ($attr == 'article__url') {
- $url = new Url(base64_encode($attr_value));
- }
- $sequence = '';
- if (STORAGE == 'postgres') {
- $sequence = 'entries_id_seq';
- }
- if ($attr_value == 'true') {
- if ($attr == 'favorite') {
- $favorite = TRUE;
+ foreach ($value as $item) {
+ foreach ($item as $attr => $value) {
+ if ($attr == 'article__url') {
+ $url = new Url(base64_encode($value));
}
- if ($attr == 'archive') {
- $archive = TRUE;
+ $sequence = '';
+ if (STORAGE == 'postgres') {
+ $sequence = 'entries_id_seq';
+ }
+ if ($value == 'true') {
+ if ($attr == 'favorite') {
+ $favorite = TRUE;
+ }
+ if ($attr == 'archive') {
+ $archive = TRUE;
+ }
}
}
- }
- # we can add the url
- if (!is_null($url) && $url->isCorrect()) {
- $this->action('add', $url, 0, TRUE);
- $count++;
- if ($favorite) {
- $last_id = $this->store->getLastId($sequence);
- $this->action('toggle_fav', $url, $last_id, TRUE);
- }
- if ($archive) {
- $last_id = $this->store->getLastId($sequence);
- $this->action('toggle_archive', $url, $last_id, TRUE);
+
+ # we can add the url
+ if (!is_null($url) && $url->isCorrect()) {
+ $this->action('add', $url, 0, TRUE);
+ $count++;
+ if ($favorite) {
+ $last_id = $this->store->getLastId($sequence);
+ $this->action('toggle_fav', $url, $last_id, TRUE);
+ }
+ if ($archive) {
+ $last_id = $this->store->getLastId($sequence);
+ $this->action('toggle_archive', $url, $last_id, TRUE);
+ }
}
}
}
if (count($entries) > 0) {
foreach ($entries as $entry) {
$newItem = $feed->createNewItem();
- $newItem->setTitle(htmlentities($entry['title']));
+ $newItem->setTitle($entry['title']);
$newItem->setLink(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']);
$newItem->setDate(time());
$newItem->setDescription($entry['content']);