From: <be...@us...> - 2012-01-24 02:47:13
|
Revision: 8800 http://xoops.svn.sourceforge.net/xoops/?rev=8800&view=rev Author: beckmi Date: 2012-01-24 02:47:07 +0000 (Tue, 24 Jan 2012) Log Message: ----------- - fixing cURL problem in adminclass.php - code clean-up Modified Paths: -------------- XoopsModules/smallworld/trunk/smallworld/admin/admin_header.php XoopsModules/smallworld/trunk/smallworld/admin/index.php XoopsModules/smallworld/trunk/smallworld/class/adminclass.php Modified: XoopsModules/smallworld/trunk/smallworld/admin/admin_header.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/admin/admin_header.php 2012-01-23 20:38:11 UTC (rev 8799) +++ XoopsModules/smallworld/trunk/smallworld/admin/admin_header.php 2012-01-24 02:47:07 UTC (rev 8800) @@ -28,18 +28,15 @@ global $xoopsModule; $pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); -if (file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) { - include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); +$pathIcon16 = '../' . $xoopsModule->getInfo('icons16'); +$pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); +if (file_exists($GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'))) { + include_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'); } else { redirect_header("../../../admin.php", 5, _AM_MODULEADMIN_MISSING, false); - } -$pathIcon16 = '../' . $xoopsModule->getInfo('icons16'); -$pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); -$pathModuleAdmin = $xoopsModule->getInfo('dirmoduleadmin'); - if ($xoopsUser) { $xoopsModule = XoopsModule::getByDirname("smallworld"); if (!$xoopsUser->isAdmin($xoopsModule->mid())) { Modified: XoopsModules/smallworld/trunk/smallworld/admin/index.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/admin/index.php 2012-01-23 20:38:11 UTC (rev 8799) +++ XoopsModules/smallworld/trunk/smallworld/admin/index.php 2012-01-24 02:47:07 UTC (rev 8800) @@ -20,13 +20,13 @@ **/ -//require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; +require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/include/cp_header.php'; include_once dirname(__FILE__) . '/admin_header.php'; xoops_cp_header(); global $xoTheme; -$xoTheme->addStylesheet(XOOPS_URL . '/modules/smallworld/css/SmallworldAdmin.css'); -$xoTheme->addScript(XOOPS_URL . '/modules/smallworld/js/adminsmallworld.js'); +$xoTheme->addStylesheet(XOOPS_URL . '/modules/smallworld/css/SmallworldAdmin.css'); +$xoTheme->addScript(XOOPS_URL . '/modules/smallworld/js/adminsmallworld.js'); $indexAdmin = new ModuleAdmin(); @@ -51,10 +51,8 @@ $installversion = $admin->ModuleInstallVersion (); // Smallworld install date $installdate = $admin->ModuleInstallDate (); - //check current version of Smallworld, return desc,link,version if new available $installCheck = $admin->doCheckUpdate (); - // Count members using Smallworld $sumallusers = $admin->TotalUsers (); // Find list of most active users (total) @@ -82,7 +80,6 @@ } else { $maAllround = 0; } - // Find list of most active users (24 hours) $maToday = $admin->mostactiveusers_today(); if (!empty($maToday)) { @@ -107,7 +104,6 @@ } else { $mat = 0; } - // FInd list of best rated users overall $topusers = $admin->topratedusers('up'); if (!empty($topusers)){ @@ -158,17 +154,8 @@ $low = 0; } - - //----------------------- -// Smallworld version number -$installversion = $admin->ModuleInstallVersion (); -// Smallworld install date -$installdate = $admin->ModuleInstallDate (); -//check current version of Smallworld, return desc,link,version if new available -$installCheck = $admin->doCheckUpdate (); - // template assignments $xoopsTpl->assign('lang_moduleinfo', _AM_SMALLWORLD_MODULEINFO); $xoopsTpl->assign('lang_installversion', _AM_SMALLWORLD_MODULEINSTALL); @@ -187,7 +174,6 @@ $indexAdmin->addInfoBoxLine(_AM_SMALLWORLD_MODULEINFO, "<class='smallworldadmin'>"._AM_SMALLWORLD_INSTALLDATE.": %s",$installdate,'Green','default'); $indexAdmin->addInfoBoxLine(_AM_SMALLWORLD_MODULEINFO, "<class='smallworldadmin'>"."%s",$installCheck,'Green','default'); - $indexAdmin->addInfoBox(_AM_SMALLWORLD_USERSTATS); $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<class='smallworldadmin'>"._AM_SMALLWORLD_DATEOFFIRSTMESSAGE." : %s</br>",$dateoffirstmessage,'Green','default'); $indexAdmin->addInfoBoxLine( _AM_SMALLWORLD_USERSTATS, "<class='smallworldadmin'>"._AM_SMALLWORLD_TOTALUSERS." : %s</br>",$sumallusers, 'Red','default'); Modified: XoopsModules/smallworld/trunk/smallworld/class/adminclass.php =================================================================== --- XoopsModules/smallworld/trunk/smallworld/class/adminclass.php 2012-01-23 20:38:11 UTC (rev 8799) +++ XoopsModules/smallworld/trunk/smallworld/class/adminclass.php 2012-01-24 02:47:07 UTC (rev 8800) @@ -232,10 +232,9 @@ $critical = FALSE; $update = FALSE; $rt = ''; - $url = "http://www.culex.dk/updates/smallworld_version.csv"; - $fileC = $this->fetchURL($url,array('fopen', 'curl', 'socket')); - $read = explode(";", $fileC); + $fileC = $this->fetchURL($url,array('fopen', 'curl', 'socket')); + $read = explode(";", $fileC); $upd_img = $pathIcon16.'/on.png'; @@ -282,7 +281,7 @@ switch($method) { case 'fopen': - //uses file_get_contents in place of fopen + //uses file_get_contents in place of fopen //allow_url_fopen must still be enabled if(ini_get('allow_url_fopen')) { @@ -292,12 +291,17 @@ } break; case 'curl': - if(function_exists('curl_init')) + if(function_exists('curl_init')) { - $ch = curl_init(); + $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); - return curl_exec($ch); + // return the value instead of printing the response to browser + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + $result = curl_exec($ch); + curl_close($ch); + //return curl_exec($ch); + return $result; } break; case 'socket': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |