1
TheFinni
Xoops core database $GLOBALS
  • 2009/3/31 5:32

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Would anyone be able to explain why several XOOPS core class files have been edited with a different way to associate to the Database class and connection?

In the newest core 2.3.3 the database connection is now defined as:

$this->db = $GLOBALS['xoopsDB'];

It used to be:

$this->db =& Database::getInstance();

I've read somewhere it's better security wise to avoid $GLOBALS. Is this at all a concern in the new XOOPS core?



2
TheFinni
Re: Lexikon bug error
  • 2009/3/19 23:55

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Don't have the lexicon module but:

I think you might be able to get rid of that error/notice by searching your module code for every instance of "XoopsTree" and then replacing it with: XoopsObjectTree.

For example:

$xt = new XoopsTree($this->table, 'topic_id', 'topic_pid');

REPLACE WITH:

$xt = new XoopsObjectTree($this->table, 'topic_id', 'topic_pid');

Now, I don't know if this relates to your difficulty in updating your database table. Sometimes what I do is watch the inline debug MySQL query and if it displays any red errors then it might be because of a poorly constructed db query. Then find the query and FIX it.

Hope that helps!



3
TheFinni
Profile module multi-step registration process logic
  • 2009/3/19 3:55

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I'm working on the profile module for XOOPS 2.3.3 and I've discovered some issues with the multi-step process.

For one, I removed any step that didn't contain any form elements...

Now I'm contemplating on the save process. As of now the first step needs to save the profile in order for other steps to work. My concern with this is if Activation is required, that the user will get the activation email before they fill in every step, and hence will not complete all the steps.

I've managed to fix this so that the first step doesn't have to be saved to the DB but rather will save on last step and transfer elements in hidden fields to the last step. I do validation both on the first step and last step.

This seems to work ok but I'm really thinking of switching the system to skip "Save on step" and just make it save on last step that contain form elements. (that should make it easier to understand in Admin too)

I'm also thinking about making the hidden fields temporary save in the session rather.

What are your thoughts on this? Would appreciate any constructive thoughts.

Thanks!



4
TheFinni
xoops module handler object join two tables
  • 2008/12/9 22:39

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Does anyone know how I could create a XOOPS module handler using the xoops_getmodulehandler function while actually joining two database tables?

I'm trying to understand the XOOPS object to put it in better use...but I haven't found any tutorial on it.

I would appreciate it if anyone is capable of explaining it to me.

Thanks in advance!



5
TheFinni
Re: Allow users to select the groups they belong to.
  • 2008/5/19 19:36

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


You could edit your edit profile page a little and include a select form field of different groups beside the webmasters group.

Then in the save process you would add something like:

$member_handler->addUserToGroup(group_id, $user_id);

for each group the user selected and had the rights to add themselves to.

If you wanted users to be able to choose groups to which they belong to in the Registration process it would probably be the safest to go with some RegCodes or invitations process.



6
TheFinni
Re: Using SSL with Xoops
  • 2008/5/19 19:25

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Btesec,

Xoops is able to run with SSL just as it does without it. The only difference is a secure server certificate installed on your server that allows information to be sent encrypted to the user from your site. There are a ton of different providers and COMODO seems to be the one you've chosen.

The only thing XOOPS doesn't do very well in my opinion is the ability to specify which requests/links are SSL and which are not. Since a SSL request is slower it doesn't make sense to use it unless the user is exchanging private or sensitive data between them and the server. I.e login, password changes, edit profile, ecommerce.

My method and I think this should be built in to the core has been to add a couple of constants to the mainfile.php.

One to force SSL and one to force non-SSL.

The respective constant names I've chosen are: XOOPS_URL_SSL and XOOPS_URL_NON_SSL.

Additionally I've needed a way to "adjust" the XOOPS_URL to either SSL or NON-SSL.

This is how my mainfile.php file looks like now:

// XOOPS Physical Path
    // Physical path to your main XOOPS directory WITHOUT trailing slash
    // Example: define('XOOPS_ROOT_PATH', 'C:/web/yoursite');
    
define('XOOPS_ROOT_PATH''C:/web/yoursite');
    
    
define('XOOPS_TRUST_PATH','C:/web/yoursite/trust_folder');//added for protector module
    
    
define('XOOPS_S_NAME''://www.yoursite.com');

    
$_SERVER['HTTPS'] = isset($_SERVER['HTTPS'])? $_SERVER['HTTPS'] : '';
    
$_SERVER['HTTP_X_FORWARDED_BY'] = isset($_SERVER['HTTP_X_FORWARDED_BY'])? $_SERVER['HTTP_X_FORWARDED_BY'] : '';
    
$_SERVER['HTTP_X_FORWARDED_HOST'] = isset($_SERVER['HTTP_X_FORWARDED_HOST'])? $_SERVER['HTTP_X_FORWARDED_HOST'] : '';
    
$_SERVER['SCRIPT_URI'] = isset($_SERVER['SCRIPT_URI'])? $_SERVER['SCRIPT_URI'] : '';
    
$_SERVER['HTTP_CLUSTER_HTTPS'] = isset($_SERVER['HTTP_CLUSTER_HTTPS'])? $_SERVER['HTTP_CLUSTER_HTTPS'] : '';
    
    
$connection_type = (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1' || 
strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_BY']),'SSL') || 
strstr(strtoupper($_SERVER['HTTP_X_FORWARDED_HOST']),'SSL') || 
strtolower(substr($_SERVER['SCRIPT_URI'], 06)) == 'https:' || $_SERVER['SERVER_PORT'] == '443' 
|| strtolower($_SERVER['HTTP_CLUSTER_HTTPS']) == 'on')
'SSL' 'NONSSL';

    
// XOOPS Virtual Path (URL)
    // Virtual path to your main XOOPS directory WITHOUT trailing slash
    
define('XOOPS_URL', (($connection_type == 'SSL') ? 'https' 'http').XOOPS_S_NAME);

    
//TN added for forcing either a secure or non-secure connection
    
define('XOOPS_ENABLE_SSL'false);//change to true to activate
    
define('XOOPS_URL_SSL''http'.(XOOPS_ENABLE_SSL == true 's' '').XOOPS_S_NAME);
    
define('XOOPS_URL_NON_SSL''http'.XOOPS_S_NAME);


I'm using several $connection_type tests to check if SSL is used. Different servers seem to use different constants. I've added most of them to check.

When you have your SSL installed on your server you can just edit XOOPS_ENABLE_SSL to true and then start using the constants in your modules or anywhere to force a SSL link or not.

To force SSL in a link you would write: echo XOOPS_URL_SSL . '/modules/news/index.php'; instead of XOOPS_URL . '/modules/news/index.php';

In a smarty template you could call <{$smarty.const.XOOPS_URL_SSL}> for SSL and <{$smarty.const.XOOPS_URL_NON_SSL}> for non-ssl.

Hope that helps!



7
TheFinni
Captcha attempts left change with js
  • 2008/4/21 17:18

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I was using the Captcha feature in one of my modules and noticed that the "Maximum attempts" didn't correspond to the actual attempts left after clicking the refresh image.

Here's what I did to fix it. Perhaps someone else would like to change this in their code. Small fix but more informative to the user.

In xoops_root/Frameworks/captcha/image.php

I edited the following functions as following:

function render()
    {
        
$form "<input type='text' name='".$this->config["name"]."' id='".$this->config["name"]."' size='" $this->config["num_chars"] . "' maxlength='" $this->config["num_chars"] . "' value='' /> &nbsp; "$this->loadImage();
        
$rule htmlspecialchars(XOOPS_CAPTCHA_REFRESHENT_QUOTES);
        if(
$this->config["maxattempt"]) {
            
//TN changed: $rule .=  " | ". sprintf( constant("XOOPS_CAPTCHA_MAXATTEMPTS"), $this->config["maxattempt"] );
            
$rule .=  " | "constant("XOOPS_CAPTCHA_MAXATTEMPTS"). ' <span id="captcha_attempts">'.$this->config["maxattempt"].'</span>';
        }
        
$form .= "&nbsp;&nbsp;<small>{$rule}</small>";
        
        return 
$form;
    }


    function 
loadImage()
    {
        
$rule $this->config["casesensitive"] ? constant("XOOPS_CAPTCHA_RULE_CASESENSITIVE") : constant("XOOPS_CAPTCHA_RULE_CASEINSENSITIVE");
        
//TN edited: $ret = "<img id='captcha' src='" . XOOPS_URL. "/". $this->config["imageurl"]. "' onclick="this.src='" . XOOPS_URL. "/". $this->config["imageurl"]. "?refresh='+Math.random()"."" align='absmiddle'  style='cursor: pointer;' alt='".htmlspecialchars($rule, ENT_QUOTES)."' />";
        //TN added javascript to change attempts numbers:
        
$ret '';
        
$ret .= '<script type="text/javascript">function changeAttemptsN(){
        var captchaNholder = document.getElementById("captcha_attempts");
        var capthcaN = captchaNholder.childNodes[0].nodeValue;
        var newcaptchaN = capthcaN - 1;
        captchaNholder.childNodes[0].nodeValue = newcaptchaN;
         }</script>'
;
        
$ret .= "<img id='captcha' src='" XOOPS_URL"/"$this->config["imageurl"]. "' onclick="this.src='" . XOOPS_URL. "/". $this->config["imageurl"]. "?refresh='+Math.random()".";changeAttemptsN()" align='absmiddle'  style='cursor: pointer;' alt='".htmlspecialchars($ruleENT_QUOTES)."' />";
        return 
$ret;
    }


You will also need to change the language definition file:

xoops_root/Frameworks/captcha/language/english.php (or whichever language)

to:

define("XOOPS_CAPTCHA_MAXATTEMPTS""Maximum attempts:");//TN Used to be Maximum attempts: %d



8
TheFinni
Re: diashow module
  • 2007/2/14 22:27

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


Hi Anton,

I don't know exactly what the diashow does as I couldn't seem to find a demo. However there are at least a couple of XOOPS photo gallery modules that allow you to view images in a slideshow. You could always modify the presentation a little bit to work for your needs.

The two galleries I have some experience with are 1.xoopsgallery and 2. xcGallery.

You can download them here:

https://xoops.org/modules/repository/viewcat.php?cid=36



9
TheFinni
transfer Session var through login
  • 2007/2/14 22:19

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


I was wondering if anyone knows how I could transfer a selected session variable of my choice through the login process?

As of now XOOPS seems to terminate any session vars that were created before login.

Thanks,

Thomas



10
TheFinni
Re: osCommerce Logo
  • 2007/2/12 22:27

  • TheFinni

  • Just popping in

  • Posts: 75

  • Since: 2003/11/25


In osCommerce the header logo in a default shop is within /oscommerce/includes/header.php

That's where you will see the osC related navigation too. Depending on the module you are running the default osC logo might have been removed as it's sort of redundant since the shop is integrated in your theme.

You can of course add one as you wish (file that I mentioned above)

Good luck!




TopTop
(1) 2 3 4 ... 7 »



Login

Who's Online

227 user(s) are online (157 user(s) are browsing Support Forums)


Members: 0


Guests: 227


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits