Skip to content

Commit

Permalink
Merge pull request #2 from mambax7/master
Browse files Browse the repository at this point in the history
PSR-2 updates
  • Loading branch information
mambax7 committed May 2, 2015
2 parents 9156ab2 + 3623ffc commit 8d9d1a7
Show file tree
Hide file tree
Showing 66 changed files with 5,768 additions and 4,522 deletions.
211 changes: 105 additions & 106 deletions logcounterx/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,132 +29,131 @@
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //

$admin_mydirname = basename( dirname( dirname( __FILE__ ) ) ) ;
$admin_mydirname = basename(dirname(__DIR__));

$fct = empty( $_POST['fct'] ) ? '' : trim( $_POST['fct'] ) ;
$fct = empty( $_GET['fct'] ) ? $fct : trim( $_GET['fct'] ) ;
if( empty( $fct ) ) $fct = 'preferences' ;
$fct = empty($_POST['fct']) ? '' : trim($_POST['fct']);
$fct = empty($_GET['fct']) ? $fct : trim($_GET['fct']);
if (empty($fct)) {
$fct = 'preferences';
}
//if (isset($fct) && $fct == "users") {
// $xoopsOption['pagetype'] = "user";
//}
include "../../../mainfile.php";
// include "../../mainfile.php"; GIJ
include XOOPS_ROOT_PATH."/include/cp_functions.php";
include XOOPS_ROOT_PATH . "/include/cp_functions.php";

include_once XOOPS_ROOT_PATH."/class/xoopsmodule.php";
include_once "../include/gtickets.php" ;// GIJ
include_once XOOPS_ROOT_PATH . "/class/xoopsmodule.php";
include_once "../include/gtickets.php";// GIJ

$admintest = 0;

if (is_object($xoopsUser)) {
$xoopsModule =& XoopsModule::getByDirname("system");
if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
exit();
}
$admintest=1;
$xoopsModule =& XoopsModule::getByDirname("system");
if (!$xoopsUser->isAdmin($xoopsModule->mid())) {
redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
exit();
}
$admintest = 1;
} else {
redirect_header(XOOPS_URL.'/user.php',3,_NOPERM);
exit();
redirect_header(XOOPS_URL . '/user.php', 3, _NOPERM);
exit();
}

// include system category definitions
include_once XOOPS_ROOT_PATH."/modules/system/constants.php";
include_once XOOPS_ROOT_PATH . "/modules/system/constants.php";
$error = false;
if ($admintest != 0) {
if (isset($fct) && $fct != '') {
if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php")) {

if ( file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php") ) {
include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin.php";
} else {
include XOOPS_ROOT_PATH."/modules/system/language/english/admin.php";
}
if (isset($fct) && $fct != '') {
if (file_exists(XOOPS_ROOT_PATH . "/modules/system/admin/" . $fct . "/xoops_version.php")) {
if (file_exists(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php")) {
include XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin.php";
} else {
include XOOPS_ROOT_PATH . "/modules/system/language/english/admin.php";
}

if (file_exists(XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php")) {
include XOOPS_ROOT_PATH."/modules/system/language/".$xoopsConfig['language']."/admin/".$fct.".php";
} elseif (file_exists(XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php")) {
include XOOPS_ROOT_PATH."/modules/system/language/english/admin/".$fct.".php";
}
include XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/xoops_version.php";
$sysperm_handler =& xoops_gethandler('groupperm');
$category = !empty($modversion['category']) ? intval($modversion['category']) : 0;
unset($modversion);
if ($category > 0) {
$groups = $xoopsUser->getGroups();
if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))){
// if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) {
// include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php"; GIJ
if (file_exists("../include/{$fct}.inc.php")) {
include_once "../include/{$fct}.inc.php" ;
} else {
$error = true;
}
} else {
$error = true;
}
} elseif ($fct == 'version') {
if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/version/main.php")) {
include_once XOOPS_ROOT_PATH."/modules/system/admin/version/main.php";
} else {
$error = true;
}
} else {
$error = true;
}
} else {
$error = true;
}
} else {
$error = true;
}
if (file_exists(XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/" . $fct . ".php")) {
include XOOPS_ROOT_PATH . "/modules/system/language/" . $xoopsConfig['language'] . "/admin/" . $fct . ".php";
} elseif (file_exists(XOOPS_ROOT_PATH . "/modules/system/language/english/admin/" . $fct . ".php")) {
include XOOPS_ROOT_PATH . "/modules/system/language/english/admin/" . $fct . ".php";
}
include XOOPS_ROOT_PATH . "/modules/system/admin/" . $fct . "/xoops_version.php";
$sysperm_handler =& xoops_gethandler('groupperm');
$category = !empty($modversion['category']) ? (int)($modversion['category']) : 0;
unset($modversion);
if ($category > 0) {
$groups = $xoopsUser->getGroups();
if (in_array(XOOPS_GROUP_ADMIN, $groups) || false != $sysperm_handler->checkRight('system_admin', $category, $groups, $xoopsModule->getVar('mid'))) {
// if (file_exists(XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php")) {
// include_once XOOPS_ROOT_PATH."/modules/system/admin/".$fct."/main.php"; GIJ
if (file_exists("../include/{$fct}.inc.php")) {
include_once "../include/{$fct}.inc.php";
} else {
$error = true;
}
} else {
$error = true;
}
} elseif ($fct == 'version') {
if (file_exists(XOOPS_ROOT_PATH . "/modules/system/admin/version/main.php")) {
include_once XOOPS_ROOT_PATH . "/modules/system/admin/version/main.php";
} else {
$error = true;
}
} else {
$error = true;
}
} else {
$error = true;
}
} else {
$error = true;
}
}

if (false != $error) {
xoops_cp_header();
echo "<h4>System Configuration</h4>";
echo '<table class="outer" cellpadding="4" cellspacing="1">';
echo '<tr>';
$groups = $xoopsUser->getGroups();
$all_ok = false;
if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
$sysperm_handler =& xoops_gethandler('groupperm');
$ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups);
} else {
$all_ok = true;
}
$admin_dir = XOOPS_ROOT_PATH."/modules/system/admin";
$handle = opendir($admin_dir);
$counter = 0;
$class = 'even';
while ($file = readdir($handle)) {
if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir.'/'.$file)) {
include $admin_dir.'/'.$file.'/xoops_version.php';
if ($modversion['hasAdmin']) {
$category = isset($modversion['category']) ? intval($modversion['category']) : 0;
if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) {
echo "<td class='$class' align='center' valign='bottom' width='19%'>";
echo "<a href='".XOOPS_URL."/modules/system/admin.php?fct=".$file."'><b>" .trim($modversion['name'])."</b></a>\n";
echo "</td>";
$counter++;
$class = ($class == 'even') ? 'odd' : 'even';
}
if ( $counter > 4 ) {
$counter = 0;
echo "</tr>";
echo "<tr>";
}
}
unset($modversion);
}
}
while ($counter < 5) {
echo '<td class="'.$class.'">&nbsp;</td>';
$class = ($class == 'even') ? 'odd' : 'even';
$counter++;
}
echo '</tr></table>';
xoops_cp_header();
echo "<h4>System Configuration</h4>";
echo '<table class="outer" cellpadding="4" cellspacing="1">';
echo '<tr>';
$groups = $xoopsUser->getGroups();
$all_ok = false;
if (!in_array(XOOPS_GROUP_ADMIN, $groups)) {
$sysperm_handler =& xoops_gethandler('groupperm');
$ok_syscats = $sysperm_handler->getItemIds('system_admin', $groups);
} else {
$all_ok = true;
}
$admin_dir = XOOPS_ROOT_PATH . "/modules/system/admin";
$handle = opendir($admin_dir);
$counter = 0;
$class = 'even';
while ($file = readdir($handle)) {
if (strtolower($file) != 'cvs' && !preg_match("/[.]/", $file) && is_dir($admin_dir . '/' . $file)) {
include $admin_dir . '/' . $file . '/xoops_version.php';
if ($modversion['hasAdmin']) {
$category = isset($modversion['category']) ? (int)($modversion['category']) : 0;
if (false != $all_ok || in_array($modversion['category'], $ok_syscats)) {
echo "<td class='$class' align='center' valign='bottom' width='19%'>";
echo "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=" . $file . "'><b>" . trim($modversion['name']) . "</b></a>\n";
echo "</td>";
$counter++;
$class = ($class == 'even') ? 'odd' : 'even';
}
if ($counter > 4) {
$counter = 0;
echo "</tr>";
echo "<tr>";
}
}
unset($modversion);
}
}
while ($counter < 5) {
echo '<td class="' . $class . '">&nbsp;</td>';
$class = ($class == 'even') ? 'odd' : 'even';
$counter++;
}
echo '</tr></table>';
xoops_cp_footer();
}

?>
1 change: 0 additions & 1 deletion logcounterx/admin/admin_footer.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<?php
xoops_cp_footer();
?>
45 changes: 27 additions & 18 deletions logcounterx/admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,52 @@
include_once '../../../include/cp_header.php';

if (file_exists("../language/{$xoopsConfig['language']}/modinfo.php")) {
include_once "../language/{$xoopsConfig['language']}/modinfo.php";
include_once "../language/{$xoopsConfig['language']}/modinfo.php";
} else {
include_once "../language/english/modinfo.php";
include_once "../language/english/modinfo.php";
}

// Get Configulation Data from Database
$CONF = array();
// $xoopsDB->queryF("DELETE FROM ".$xoopsDB->prefix('logcounterx_cfg')." WHERE cfgvalue = ''");
$sql = "SELECT cfgname, cfgvalue FROM ".$xoopsDB->prefix('logcounterx_cfg');
$sql = "SELECT cfgname, cfgvalue FROM " . $xoopsDB->prefix('logcounterx_cfg');
$res = $xoopsDB->query($sql);
while (list($key, $val) = $xoopsDB->fetchRow($res)) { $CONF[$key] = $val; }
while (list($key, $val) = $xoopsDB->fetchRow($res)) {
$CONF[$key] = $val;
}

// Get Count from Database
$sql1 = "SELECT cnt FROM ".$xoopsDB->prefix('logcounterx_count')." WHERE ymd = '1111-11-11'";
$sql1 = "SELECT cnt FROM " . $xoopsDB->prefix('logcounterx_count') . " WHERE ymd = '1111-11-11'";
$res1 = $xoopsDB->query($sql1);
list($cnt) = $xoopsDB->fetchRow($res1);
$cnt = intval($cnt);
$cnt = (int)($cnt);

// Unlink (Delete) Block Cache
if (function_exists('glob')) {
$blockcachefiles = glob(XOOPS_CACHE_PATH.'/blk_*lcx_block_display.html');
if (!empty($blockcachefiles)) { foreach ($blockcachefiles as $f) { @unlink($f); } }
$blockcachefiles = glob(XOOPS_CACHE_PATH . '/blk_*lcx_block_display.html');
if (!empty($blockcachefiles)) {
foreach ($blockcachefiles as $f) {
@unlink($f);
}
}
}

xoops_cp_header();

if (is_object($xoopsModule)) {
$MyModVer = sprintf('%0.2f', $xoopsModule->getVar('version') / 100);
$MyModName = $xoopsModule->getVar('name');
$MyModVer = sprintf('%0.2f', $xoopsModule->getVar('version') / 100);
$MyModName = $xoopsModule->getVar('name');
}

// Display Header Menu
print '<h4><a href="./">'.$MyModName._LCX_ADM_CONFIG.'</a> &nbsp;(LogCounterX ver.'.$MyModVer.')</h4>';
print '<span style="float:right; margin-bottom:16px;">&nbsp;|&nbsp;';
include './menu.php';
foreach ($adminmenu as $eachmenu) {
print '<a href="'.XOOPS_URL.'/modules/logcounterx/'.$eachmenu['link'].'">'.$eachmenu['title'].'</a>&nbsp;|&nbsp;';
global $xoopsModuleConfig;

if (isset($xoopsModuleConfig['system_menu']) && 1 == $xoopsModuleConfig['system_menu']) {
// Display Header Menu
print '<h4><a href="./">' . $MyModName . _LCX_ADM_CONFIG . '</a> &nbsp;(LogCounterX ver.' . $MyModVer . ')</h4>';
print '<span style="float:right; margin-bottom:16px;">&nbsp;|&nbsp;';
include './menu.php';
foreach ($adminmenu as $eachmenu) {
print '<a href="' . XOOPS_URL . '/modules/logcounterx/' . $eachmenu['link'] . '">' . $eachmenu['title'] . '</a>&nbsp;|&nbsp;';
}
print '</span><br /><br />';
}
print '</span><br /><br />';
?>
40 changes: 19 additions & 21 deletions logcounterx/admin/code_test.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
include_once './admin_header.php';

$query = (isset($_GET['query']) ? $_GET['query'] : '');
$query = urldecode($query);
$query = (isset($_GET['query']) ? $_GET['query'] : '');
$query = urldecode($query);
$escaped = htmlspecialchars($query);

$toutf = mb_convert_encoding($query, 'UTF-8', 'auto');
Expand All @@ -13,29 +13,27 @@
$freuc = mb_convert_encoding($query, _CHARSET, 'EUC-JP');
$frsjs = mb_convert_encoding($query, _CHARSET, 'SJIS');

print '<br />';
print '<br />';

print '<form action="./code_test.php" method="get">';
print '<input type="text" name="query" value="'.$escaped.'" />';
print '<input type="submit" />';
print '</form>';
print '<form action="./code_test.php" method="get">';
print '<input type="text" name="query" value="' . $escaped . '" />';
print '<input type="submit" />';
print '</form>';

print '<br />';
print '<br />';

print '<table><tr><th colspan="3">Converted to</th></tr>';
print '<tr><td>UTF</td><td>'.htmlspecialchars($toutf).' </td><td>'.urlencode($toutf).'</td></tr>';
print '<tr><td>EUC</td><td>'.htmlspecialchars($toeuc).' </td><td>'.urlencode($toeuc).'</td></tr>';
print '<tr><td>SJIS</td><td>'.htmlspecialchars($tosjs).' </td><td>'.urlencode($tosjs).'</td></tr>';
print '</table>';
print '<table><tr><th colspan="3">Converted to</th></tr>';
print '<tr><td>UTF</td><td>' . htmlspecialchars($toutf) . ' </td><td>' . urlencode($toutf) . '</td></tr>';
print '<tr><td>EUC</td><td>' . htmlspecialchars($toeuc) . ' </td><td>' . urlencode($toeuc) . '</td></tr>';
print '<tr><td>SJIS</td><td>' . htmlspecialchars($tosjs) . ' </td><td>' . urlencode($tosjs) . '</td></tr>';
print '</table>';

print '<br />';
print '<br />';

print '<table><tr><th colspan="3">Converted from</th></tr>';
print '<tr><td>UTF</td><td>'.htmlspecialchars($frutf).' </td><td>'.urlencode($frutf).'</td></tr>';
print '<tr><td>EUC</td><td>'.htmlspecialchars($freuc).' </td><td>'.urlencode($freuc).'</td></tr>';
print '<tr><td>SJIS</td><td>'.htmlspecialchars($frsjs).' </td><td>'.urlencode($frsjs).'</td></tr>';
print '</table>';
print '<table><tr><th colspan="3">Converted from</th></tr>';
print '<tr><td>UTF</td><td>' . htmlspecialchars($frutf) . ' </td><td>' . urlencode($frutf) . '</td></tr>';
print '<tr><td>EUC</td><td>' . htmlspecialchars($freuc) . ' </td><td>' . urlencode($freuc) . '</td></tr>';
print '<tr><td>SJIS</td><td>' . htmlspecialchars($frsjs) . ' </td><td>' . urlencode($frsjs) . '</td></tr>';
print '</table>';

xoops_cp_footer();

?>
Loading

0 comments on commit 8d9d1a7

Please sign in to comment.