Skip to content

Commit

Permalink
Coding Style PSR-2
Browse files Browse the repository at this point in the history
  • Loading branch information
vuthao committed Jan 18, 2016
1 parent 6d152a1 commit a8eed1d
Show file tree
Hide file tree
Showing 35 changed files with 1,284 additions and 1,410 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.settings
/.project
/.htaccess
/.buildpath
/.gitattributes
/composer.json
/config.php
Expand Down
6 changes: 4 additions & 2 deletions modules/weblinks/action_mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @Createdate 2-10-2010 20:59
*/

if ( ! defined( 'NV_IS_FILE_MODULES' ) ) die( 'Stop!!!' );
if (! defined('NV_IS_FILE_MODULES')) {
die('Stop!!!');
}

$sql_drop_module = array();

Expand Down Expand Up @@ -93,4 +95,4 @@
('sortoption', 'byid'),
('imgwidth', '100'),
('imgheight', '74'),
('timeout', '1')";
('timeout', '1')";
107 changes: 54 additions & 53 deletions modules/weblinks/admin.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@
* @Createdate 12/31/2009 2:29
*/

if( ! defined( 'NV_ADMIN' ) or ! defined( 'NV_MAINFILE' ) or ! defined( 'NV_IS_MODADMIN' ) ) die( 'Stop!!!' );
if (! defined('NV_ADMIN') or ! defined('NV_MAINFILE') or ! defined('NV_IS_MODADMIN')) {
die('Stop!!!');
}

$allow_func = array(
'alias',
'main',
'cat',
'change_cat',
'del_cat',
'content',
'del_link',
'config',
'multidel',
'checklink',
'brokenlink',
'delbroken'
'alias',
'main',
'cat',
'change_cat',
'del_cat',
'content',
'del_link',
'config',
'multidel',
'checklink',
'brokenlink',
'delbroken'
);

define( 'NV_IS_FILE_ADMIN', true );
define('NV_IS_FILE_ADMIN', true);

require_once ( NV_ROOTDIR . '/modules/' . $module_file . '/global.functions.php' );
require_once(NV_ROOTDIR . '/modules/' . $module_file . '/global.functions.php');


/**
Expand All @@ -36,22 +38,21 @@
* @param mixed $parentid
* @return
*/
function nv_fix_cat( $parentid )
function nv_fix_cat($parentid)
{
global $db, $module_data;
global $db, $module_data;

$sql = 'SELECT catid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_cat WHERE parentid=' . $parentid . ' ORDER BY weight ASC';
$result = $db->query( $sql );
$sql = 'SELECT catid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_cat WHERE parentid=' . $parentid . ' ORDER BY weight ASC';
$result = $db->query($sql);

$weight = 0;
while( $row = $result->fetch() )
{
++$weight;
$sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $weight . ' WHERE catid=' . intval( $row['catid'] );
$db->query( $sql );
}
$weight = 0;
while ($row = $result->fetch()) {
++$weight;
$sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $weight . ' WHERE catid=' . intval($row['catid']);
$db->query($sql);
}

$result->closeCursor();
$result->closeCursor();
}

/**
Expand All @@ -64,16 +65,15 @@ function nv_fix_cat( $parentid )
* @param string $func_onchange
* @return
*/
function drawselect_number( $select_name = '', $number_start = 0, $number_end = 1, $number_curent = 0, $func_onchange = '' )
function drawselect_number($select_name = '', $number_start = 0, $number_end = 1, $number_curent = 0, $func_onchange = '')
{
$html = '<select class="form-control" name="' . $select_name . '" onchange="' . $func_onchange . '">';
for( $i = $number_start; $i <= $number_end; ++$i )
{
$select = ( $i == $number_curent ) ? ' selected="selected"' : '';
$html .= '<option value="' . $i . '"' . $select . '>' . $i . '</option>';
}
$html .= '</select>';
return $html;
$html = '<select class="form-control" name="' . $select_name . '" onchange="' . $func_onchange . '">';
for ($i = $number_start; $i <= $number_end; ++$i) {
$select = ($i == $number_curent) ? ' selected="selected"' : '';
$html .= '<option value="' . $i . '"' . $select . '>' . $i . '</option>';
}
$html .= '</select>';
return $html;
}

/**
Expand All @@ -85,15 +85,16 @@ function drawselect_number( $select_name = '', $number_start = 0, $number_end =
* @param string $xkey
* @return
*/
function getlevel( $pid, $array_cat, $numxtitle = 5, $xkey = '&nbsp;' )
function getlevel($pid, $array_cat, $numxtitle = 5, $xkey = '&nbsp;')
{
$html = '';
for( $i = 0; $i < $numxtitle; ++$i )
{
$html .= $xkey;
}
if( $array_cat[$pid]['parentid'] != 0 ) $html .= getlevel( $array_cat[$pid]['parentid'], $array_cat );
return $html;
$html = '';
for ($i = 0; $i < $numxtitle; ++$i) {
$html .= $xkey;
}
if ($array_cat[$pid]['parentid'] != 0) {
$html .= getlevel($array_cat[$pid]['parentid'], $array_cat);
}
return $html;
}

/**
Expand All @@ -106,13 +107,13 @@ function getlevel( $pid, $array_cat, $numxtitle = 5, $xkey = '&nbsp;' )
* @param string $func_onchange
* @return
*/
function drawselect_yesno( $select_name = '', $curent = 1, $lang_no = '', $lang_yes = '', $func_onchange = '' )
function drawselect_yesno($select_name = '', $curent = 1, $lang_no = '', $lang_yes = '', $func_onchange = '')
{
$html = '<select class="form-control" name="' . $select_name . '" onchange="' . $func_onchange . '">';
$select_yes = ( $curent == 1 ) ? ' selected="selected"' : '';
$select_no = ( $curent == 0 ) ? ' selected="selected"' : '';
$html .= '<option value="0"' . $select_no . '>' . $lang_no . '</option>';
$html .= '<option value="1"' . $select_yes . '>' . $lang_yes . '</option>';
$html .= '</select>';
return $html;
}
$html = '<select class="form-control" name="' . $select_name . '" onchange="' . $func_onchange . '">';
$select_yes = ($curent == 1) ? ' selected="selected"' : '';
$select_no = ($curent == 0) ? ' selected="selected"' : '';
$html .= '<option value="0"' . $select_no . '>' . $lang_no . '</option>';
$html .= '<option value="1"' . $select_yes . '>' . $lang_yes . '</option>';
$html .= '</select>';
return $html;
}
6 changes: 4 additions & 2 deletions modules/weblinks/admin.menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
* @Createdate 07/30/2013 10:27
*/

if( ! defined( 'NV_ADMIN' ) ) die( 'Stop!!!' );
if (! defined('NV_ADMIN')) {
die('Stop!!!');
}

$submenu['content'] = $lang_module['weblink_add_link'];
$submenu['cat'] = $lang_module['weblink_catlist'];
$submenu['brokenlink'] = $lang_module['weblink_link_broken'];
$submenu['config'] = $lang_module['weblink_config'];
$submenu['config'] = $lang_module['weblink_config'];
10 changes: 6 additions & 4 deletions modules/weblinks/admin/alias.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
* @Createdate 2-10-2010 18:49
*/

if( ! defined( 'NV_IS_FILE_ADMIN' ) ) die( 'Stop!!!' );
if (! defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}

$title = $nv_Request->get_title( 'title', 'post', '' );
$alias = change_alias( $title );
$title = $nv_Request->get_title('title', 'post', '');
$alias = change_alias($title);

include NV_ROOTDIR . '/includes/header.php';
echo $alias;
include NV_ROOTDIR . '/includes/footer.php';
include NV_ROOTDIR . '/includes/footer.php';
63 changes: 30 additions & 33 deletions modules/weblinks/admin/brokenlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,56 @@
* @Createdate 2-9-2010 14:43
*/

if( ! defined( 'NV_IS_FILE_ADMIN' ) ) die( 'Stop!!!' );
if (! defined('NV_IS_FILE_ADMIN')) {
die('Stop!!!');
}

$page_title = $lang_module['weblink_link_broken'];

$xtpl = new XTemplate( 'link_broken.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file );
$xtpl->assign( 'LANG', $lang_module );
$xtpl = new XTemplate('link_broken.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);

$base_url = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;

$per_page = 10;

$page = $nv_Request->get_int( 'page', 'get', 0 );
$page = $nv_Request->get_int('page', 'get', 0);

$all_page = $db->query( 'SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows a INNER JOIN ' . NV_PREFIXLANG . '_' . $module_data . '_report b ON a.id=b.id' )->fetchColumn();
$all_page = $db->query('SELECT COUNT(*) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows a INNER JOIN ' . NV_PREFIXLANG . '_' . $module_data . '_report b ON a.id=b.id')->fetchColumn();

$sql = 'SELECT a.url, a.title, b.type, a.id FROM ' . NV_PREFIXLANG . '_' . $module_data . '_rows a INNER JOIN ' . NV_PREFIXLANG . '_' . $module_data . '_report b ON a.id=b.id LIMIT ' . $page . ', ' . $per_page;

// GROUP BY a.url

if( $all_page > 0 )
{
$xtpl->assign( 'FORM_ACTION', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=delbroken' );
if ($all_page > 0) {
$xtpl->assign('FORM_ACTION', NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=delbroken');

$result = $db->query( $sql );
while( $row = $result->fetch() )
{
$xtpl->assign( 'ROW', array(
'id' => $row['id'],
'title' => $row['title'],
'url' => $row['url'],
'type' => $row['type'] == 1 ? $lang_module['weblink_link_broken_die'] : $lang_module['weblink_link_broken_bad'],
'url_edit' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=content&amp;id=' . $row['id'] ) );
$result = $db->query($sql);
while ($row = $result->fetch()) {
$xtpl->assign('ROW', array(
'id' => $row['id'],
'title' => $row['title'],
'url' => $row['url'],
'type' => $row['type'] == 1 ? $lang_module['weblink_link_broken_die'] : $lang_module['weblink_link_broken_bad'],
'url_edit' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=content&amp;id=' . $row['id'] ));

$xtpl->parse( 'main.data.loop' );
}
$xtpl->parse('main.data.loop');
}

$xtpl->parse( 'main.data' );
}
else
{
$xtpl->parse( 'main.empty' );
$xtpl->parse('main.data');
} else {
$xtpl->parse('main.empty');
}

$generate_page = nv_generate_page( $base_url, $all_page, $per_page, $page );
if( ! empty( $generate_page ) )
{
$xtpl->assign( 'GENERATE_PAGE', $generate_page );
$xtpl->parse( 'main.generate_page' );
$generate_page = nv_generate_page($base_url, $all_page, $per_page, $page);
if (! empty($generate_page)) {
$xtpl->assign('GENERATE_PAGE', $generate_page);
$xtpl->parse('main.generate_page');
}

$xtpl->parse( 'main' );
$contents = $xtpl->text( 'main' );
$xtpl->parse('main');
$contents = $xtpl->text('main');

include NV_ROOTDIR . '/includes/header.php';
echo nv_admin_theme( $contents );
include NV_ROOTDIR . '/includes/footer.php';
echo nv_admin_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Loading

0 comments on commit a8eed1d

Please sign in to comment.