Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Commit

Permalink
v2.0.0-RC2
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnadoO committed Aug 22, 2018
1 parent be93605 commit c8dee90
Show file tree
Hide file tree
Showing 35 changed files with 200 additions and 390 deletions.
4 changes: 2 additions & 2 deletions adm/style/acp_dir_cat.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ <h3>{{ lang('WARNING') }}</h3>
// <![CDATA[
var close_waitscreen = 0;
// no scrollbars...
popup('{{ UA_PROGRESS_BAR|e("js") }}', 400, 240, '_sync');
popup('{{ U_PROGRESS_BAR|e("js") }}', 400, 240, '_sync');
// ]]>
</script>

Expand All @@ -194,7 +194,7 @@ <h1>{{ lang('DIR_CAT_ADMIN') }}</h1>
{
var close_waitscreen = 0;
// no scrollbars...
popup('{{ UA_PROGRESS_BAR|e("js") }}', 400, 240, '_sync');
popup('{{ U_PROGRESS_BAR|e("js") }}', 400, 240, '_sync');
}
// ]]>
</script>
Expand Down
6 changes: 3 additions & 3 deletions adm/style/event/acp_overall_header_head_append.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script type="text/javascript">
// <![CDATA[
var dir_url_ajax_date = '{{ U_DATE }}';
var dir_url_ajax_slug = '{{ U_SLUG }}';
var dir_icon_path = '{{ DIR_ICON_PATH }}';
var dir_url_ajax_date = '{{ U_DATE|e("js") }}';
var dir_url_ajax_slug = '{{ U_SLUG|e("js") }}';
var dir_icon_path = '{{ DIR_ICON_PATH|e("js") }}';
var xhr;
// ]]>
</script>
Expand Down
6 changes: 3 additions & 3 deletions controller/acp/cat.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public function action_sync()
meta_refresh(0, $url);

$this->template->assign_vars(array(
'UA_PROGRESS_BAR' => $this->u_action . "&amp;action=progress_bar&amp;start=$links_done&amp;total={$row['cat_links']}",
'U_PROGRESS_BAR' => $this->u_action . "&amp;action=progress_bar&amp;start=$links_done&amp;total={$row['cat_links']}",
'S_CONTINUE_SYNC' => true,
'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', $links_done, $row['cat_links']))
);
Expand All @@ -373,7 +373,7 @@ public function action_sync()
meta_refresh(0, $url);

$this->template->assign_vars(array(
'UA_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar',
'U_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar',
'S_CONTINUE_SYNC' => true,
'L_PROGRESS_EXPLAIN' => $this->language->lang('SYNC_IN_PROGRESS_EXPLAIN', 0, $row['cat_links']))
);
Expand Down Expand Up @@ -501,7 +501,7 @@ public function display_cats()
'U_SEL_ACTION' => $this->u_action,
'U_ACTION' => $this->u_action . '&amp;parent_id=' . $this->parent_id,

'UA_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar',
'U_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar',
));
}

Expand Down
17 changes: 4 additions & 13 deletions controller/acp/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,7 @@ public function exec_action($action)
switch ($action)
{
case 'votes':
switch ($this->db->get_sql_layer())
{
case 'sqlite':
case 'firebird':
$this->db->sql_query('DELETE FROM ' . $this->votes_table);
break;

default:
$this->db->sql_query('TRUNCATE TABLE ' . $this->votes_table);
break;
}
$this->db->sql_query('DELETE FROM ' . $this->votes_table);

$sql = 'UPDATE ' . $this->links_table . '
SET link_vote = 0, link_note = 0';
Expand Down Expand Up @@ -289,8 +279,8 @@ private function _orphan_files($delete = false)
{
$physical_files[] = $img;
}
$sql = 'SELECT link_banner FROM ' . $this->links_table . '
WHERE link_banner <> \'\'';
$sql = 'SELECT link_banner FROM ' . $this->links_table . "
WHERE link_banner <> ''";
$result = $this->db->sql_query($sql);

while ($row = $this->db->sql_fetchrow($result))
Expand Down Expand Up @@ -318,5 +308,6 @@ private function _orphan_files($delete = false)
@unlink($this->get_banner_path($file));
}
}
closedir($dh);
}
}
2 changes: 1 addition & 1 deletion controller/acp/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function _generate_config()
'dir_allow_flash' => array('lang' => 'DIR_ALLOW_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'dir_allow_links' => array('lang' => 'DIR_ALLOW_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'dir_allow_smilies' => array('lang' => 'DIR_ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'dir_length_comments' => array('lang' => 'DIR_LENGTH_COMMENTS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => true),
'dir_length_comments' => array('lang' => 'DIR_LENGTH_COMMENTS', 'validate' => 'int:1:999', 'type' => 'number:1:999', 'explain' => false),
'dir_comments_per_page' => array('lang' => 'DIR_COMM_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false),

'legend6' => 'DIR_BANN_PARAM',
Expand Down
7 changes: 5 additions & 2 deletions controller/acp/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class validation extends helper
/** @var \phpbb\pagination */
protected $pagination;

/** @var \phpbb\language\language */
protected $language;

/** @var \phpbb\log\log */
protected $phpbb_log;

Expand Down Expand Up @@ -369,7 +372,7 @@ private function _action_disapproved()
/**
* Get informations about links selected
*
* @param $mark Website selected for (dis)approval
* @param array $mark Website selected for (dis)approval
* @return null
*/
private function _get_infos_links($mark)
Expand Down Expand Up @@ -408,7 +411,7 @@ private function _get_infos_links($mark)
/**
* Notify users which watch categories
*
* @param $row Informations about website
* @param array $row Informations about website
* @return null
*/
private function _notify_suscribers($row)
Expand Down
8 changes: 3 additions & 5 deletions controller/categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use Symfony\Component\HttpFoundation\RedirectResponse;
use \ernadoo\phpbbdirectory\core\helper;
use E1379\SpeakingUrl\SpeakingUrl;
use \E1379\SpeakingUrl\SpeakingUrl;

class categories extends helper
{
Expand Down Expand Up @@ -78,8 +78,6 @@ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config
$this->categorie = $categorie;
$this->link = $link;

$language->add_lang('directory', 'ernadoo/phpbbdirectory');

$template->assign_vars(array(
'S_PHPBB_DIRECTORY' => true,
));
Expand Down Expand Up @@ -282,7 +280,7 @@ public function view_route($cat_id, $page = 1, $sort_days = 0, $sort_key = '', $
'ON' => 'l.link_user_id = u.user_id'
),
),
'WHERE' => "l.link_cat = $cat_id
'WHERE' => 'l.link_cat = ' . (int) $cat_id . "
AND l.link_active = 1
$sql_limit_time",
'ORDER_BY' => $sql_sort_order
Expand Down Expand Up @@ -360,7 +358,6 @@ public function view_route($cat_id, $page = 1, $sort_days = 0, $sort_key = '', $
'VOTE_LIST' => ($votes_status) ? $s_vote : '',

'IMG_FLAG' => $s_flag,
'ON_CLICK' => "onclick=\"window.open('".$this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $site['link_id']))."'); return false;\"",

'S_NEW_LINK' => (((time() - $site['link_time']) / 86400) <= $this->config['dir_new_time']) ? true : false,

Expand All @@ -370,6 +367,7 @@ public function view_route($cat_id, $page = 1, $sort_days = 0, $sort_key = '', $
'U_FORM_VOTE' => ($votes_status) ? $this->helper->route('ernadoo_phpbbdirectory_vote_controller', array('cat_id' => (int) $site['link_cat'], 'link_id' => (int) $site['link_id'])) : '',
'U_LINK' => $site['link_url'],
'U_THUMB' => $s_thumb,
'U_VIEW' => $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $site['link_id']))
));
}
}
Expand Down
11 changes: 5 additions & 6 deletions controller/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config
$this->root_path = $root_path;
$this->php_ext = $php_ext;

$language->add_lang('directory', 'ernadoo/phpbbdirectory');
$user->add_lang(array('ucp', 'posting'));

$template->assign_vars(array(
'S_PHPBB_DIRECTORY' => true,
'S_SIMPLE_MESSAGE' => true,
Expand Down Expand Up @@ -266,7 +263,7 @@ public function view($link_id, $page, $mode = 'new')
),
array(
'FROM' => array(ZEBRA_TABLE => 'z'),
'ON' => 'z.user_id = ' . $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id'
'ON' => 'z.user_id = ' . (int) $this->user->data['user_id'] . ' AND z.zebra_id = a.comment_user_id'
)
),
'WHERE' => 'a.comment_link_id = ' . (int) $link_id,
Expand Down Expand Up @@ -302,8 +299,8 @@ public function view($link_id, $page, $mode = 'new')
'U_DELETE' => ($delete_allowed) ? $this->helper->route('ernadoo_phpbbdirectory_comment_delete_controller', array('link_id' => (int) $link_id, 'comment_id' => (int) $comments['comment_id'], '_referer' => $this->helper->get_current_url())) : '',

'S_IGNORE_POST' => ($comments['foe'] && ($view != 'show' || $comment_id != $comments['comment_id'])) ? true : false,
'L_IGNORE_POST' => ($comments['foe']) ? $this->language->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour']), '<a href="'.$this->helper->url('directory/link/'.$link_id.'/comment'.(($page > 1) ? '/'.$page : '').'?view=show#c'.(int) $comments['comment_id']).'">', '</a>') : '',
'L_POST_DISPLAY' => ($comments['foe']) ? $this->language->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->url('directory/link/'.$link_id.'/comment'.(($page > 1) ? '/'.$page : '').'?c='.(int) $comments['comment_id'] . '&view=show#c'.(int) $comments['comment_id']).'">', '</a>') : '',
'L_IGNORE_POST' => ($comments['foe']) ? $this->language->lang('POST_BY_FOE', get_username_string('full', $comments['comment_user_id'], $comments['username'], $comments['user_colour'])) : '',
'L_POST_DISPLAY' => ($comments['foe']) ? $this->language->lang('POST_DISPLAY', '<a class="display_post" data-post-id="' . $comments['comment_id'] . '" href="' . $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $link_id, 'page' => $page)).'?c='.(int) $comments['comment_id'] . '&view=show#c'.(int) $comments['comment_id'].'">', '</a>') : '',

'S_INFO' => $this->auth->acl_get('m_info'),
));
Expand Down Expand Up @@ -458,6 +455,8 @@ private function _check_comments_enable($link_id)
*/
private function _populate_form($link_id, $mode)
{
$this->user->add_lang(array('ucp', 'posting'));

if (!$this->user->data['is_registered'] && $this->config['dir_visual_confirm'] && $mode != 'edit')
{
$this->s_hidden_fields = array_merge($this->s_hidden_fields, $this->captcha->get_hidden_fields());
Expand Down
2 changes: 0 additions & 2 deletions controller/links.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config
$this->root_path = $root_path;
$this->php_ext = $php_ext;

$language->add_lang('directory', 'ernadoo/phpbbdirectory');

$template->assign_vars(array(
'S_PHPBB_DIRECTORY' => true,
));
Expand Down
37 changes: 27 additions & 10 deletions controller/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config
$this->categorie = $categorie;
$this->link = $link;

$language->add_lang('directory', 'ernadoo/phpbbdirectory');
$language->add_lang('search');

$template->assign_vars(array(
'S_PHPBB_DIRECTORY' => true,
));
Expand All @@ -104,6 +101,8 @@ public function main($page)
throw new \phpbb\exception\http_exception(403, 'DIR_ERROR_NOT_AUTH');
}

$this->language->add_lang('search');

$cat_id = $this->request->variable('cat_id', 0);
$keywords = $this->request->variable('keywords', '', true);
$search_terms = $this->request->variable('terms', 'all');
Expand Down Expand Up @@ -164,12 +163,30 @@ public function main($page)

$u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit)));

($u_hilit) ? $u_search['keywords'] = urlencode(htmlspecialchars_decode($keywords)) : '';
($search_terms != 'all') ? $u_search['terms'] = $search_terms : '';
($cat_id) ? $u_search['cat_id'] = $cat_id : '';
($search_category) ? $u_search['cid'] = $search_category : '';
(!$search_child) ? $u_search['sc'] = 0 : '';
($search_fields != 'all') ? $u_search['sf'] = $search_fields : '';
if ($u_hilit)
{
$u_search['keywords'] = urlencode(htmlspecialchars_decode($keywords));
}
if ($search_terms != 'all')
{
$u_search['terms'] = $search_terms;
}
if ($cat_id)
{
$u_search['cat_id'] = $cat_id;
}
if ($search_category)
{
$u_search['cid'] = $search_category;
}
if (!$search_child)
{
$u_search['sc'] = 0;
}
if ($search_fields != 'all')
{
$u_search['sf'] = $search_fields;
}

$base_url = array(
'routes' => 'ernadoo_phpbbdirectory_search_controller',
Expand Down Expand Up @@ -267,13 +284,13 @@ public function main($page)
'THUMB' => '<img src="'.$s_thumb.'" alt="'.$this->language->lang('DIR_THUMB').'" title="'.$data['link_name'].'"/>',
'IMG_BANNER' => $s_banner,
'IMG_FLAG' => $this->config['dir_activ_flag'] ? $s_flag : '',
'ON_CLICK' => "onclick=\"window.open('".$this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $data['link_id']))."'); return false;\"",

'L_DIR_SEARCH_NB_CLICKS' => $this->language->lang('DIR_SEARCH_NB_CLICKS', (int) $data['link_view']),
'L_DIR_SEARCH_NB_COMMS' => $this->language->lang('DIR_SEARCH_NB_COMMS', (int) $data['link_comment']),

'U_COMMENT' => $this->helper->route('ernadoo_phpbbdirectory_comment_view_controller', array('link_id' => (int) $data['link_id'])),
'U_SITE' => $data['link_url'],
'U_VIEW' => $this->helper->route('ernadoo_phpbbdirectory_view_controller', array('link_id' => (int) $data['link_id'])),
'LINK_ID' => $data['link_id'],
));
}
Expand Down
23 changes: 13 additions & 10 deletions core/categorie.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace ernadoo\phpbbdirectory\core;

use \ernadoo\phpbbdirectory\core\helper;

class categorie extends helper
{
/** @var \phpbb\db\driver\driver_interface */
Expand Down Expand Up @@ -441,9 +439,9 @@ public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_
{
if ($mode == 'unwatch')
{
$sql = 'DELETE FROM ' . $this->watch_table . "
WHERE cat_id = $cat_id
AND user_id = $user_id";
$sql = 'DELETE FROM ' . $this->watch_table . '
WHERE cat_id = ' . (int) $cat_id . '
AND user_id = ' . (int) $user_id;
$this->db->sql_query($sql);

$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id);
Expand All @@ -464,9 +462,9 @@ public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_
if ($notify_status != NOTIFY_YES)
{
$sql = 'UPDATE ' . $this->watch_table . '
SET notify_status = ' . NOTIFY_YES . "
WHERE cat_id = $cat_id
AND user_id = $user_id";
SET notify_status = ' . NOTIFY_YES . '
WHERE cat_id = '. (int) $cat_id . '
AND user_id = ' . (int) $user_id;
$this->db->sql_query($sql);
}
}
Expand All @@ -475,8 +473,13 @@ public function watch_categorie($mode, &$s_watching, $user_id, $cat_id, $notify_
{
if ($mode == 'watch')
{
$sql = 'INSERT INTO ' . $this->watch_table . " (user_id, cat_id, notify_status)
VALUES ($user_id, $cat_id, " . NOTIFY_YES . ')';
$data = array(
'user_id' => (int) $user_id,
'cat_id' => (int) $cat_id,
'notify_status' => NOTIFY_YES
);

$sql = 'INSERT INTO ' . $this->watch_table . ' ' . $this->db->sql_build_array('INSERT', $data);
$this->db->sql_query($sql);

$redirect_url = $this->helper->route('ernadoo_phpbbdirectory_dynamic_route_' . $cat_id);
Expand Down
2 changes: 0 additions & 2 deletions core/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace ernadoo\phpbbdirectory\core;

use \ernadoo\phpbbdirectory\core\helper;

class comment extends helper
{
/** @var \phpbb\db\driver\driver_interface $db */
Expand Down
Loading

0 comments on commit c8dee90

Please sign in to comment.