21
robstockley
Re: Hack - Display User Avatar

Nope, more complex than that but only a little. From memory you need to modify the script that populates the template to load the avatar url first. Then you can hack the template and include the avatar as a smarty tag.

I don't have myalbumn-P so I can't really help you anymore than that.
Rob



22
robstockley
Re: login and update messages etc

You'll need to modify the system_redirect template to make the changes you suggest. The file is located in /modules/system/templates although on my site I would modify the template directly through the admin -> templates page.

When done don't forget to delete all the files in /templates_c except for index.html so that your template changes take effect.

Rob



23
robstockley
Re: extcal not working correctly?

Perhaps you could start with telling us which versions of extcal and XOOPS you are using.

Does the file /devildogs/modules/extcal/eventmember.php exist on your server?

Does your server have a fully qualified domain name? Has this been entered correctly in /path-to-xoops/mainfile.php

We'll get to the bottom of this.
Rob



24
robstockley
Re: Converting email addresses as images

Cool Glad to hear someone found it useful. When you've got it up and running PM me a link. I'd be keen to see it in action.
Rob



25
robstockley
Re: Converting email addresses as images

With all the recent comment about phpmailer vulnerabilities I took another look at my hack. I use Protector 3.x so in order to take advantage of Protector's spam filtering I need to include ../mainfile.php in swirl.php rather that the direct reference to functions.php.



26
robstockley
Re: To Admin - Spammer Targeting Xoops sites

Can you point me to a guide to updating Protector from v2.57 to v3.x. Is it a directory overwrite or a uninstall/reinstall type affair?

Update: The module comes with clear instructions - thanks.
Update: Worked a treat. 2.57-3.03 as per instructions without a hitch.



27
robstockley
Re: To Admin - Spammer Targeting Xoops sites

Quote:

BDW wrote:
Did you set anti-SPAM: URLs for normal users to 5 within preferences?

Where did you set this? If the answer is within Protector, which version?
Rob



28
robstockley
Re: Make default block view = yes

I did the same thing a while back but I also wanted the default group to be anonymous users. This is just as easy to do. In the very next line you just have to change XOOPS_GROUP_USERS to XOOPS_GROUP_ANONYMOUS like this.
function list_blocks()
    {
        global 
$xoopsUser$xoopsConfig;
        include_once 
XOOPS_ROOT_PATH.'/class/xoopslists.php';
        
//OpenTable();
        
$selmod = isset($_GET['selmod']) ? intval($_GET['selmod']) : 0;
        
$selvis = isset($_GET['selvis']) ? intval($_GET['selvis']) : 1;
        [
b][u]$selgrp = isset($_GET['selgrp']) ? intval($_GET['selgrp']) : XOOPS_GROUP_ANONYMOUS;[/u][/b]

Both XOOPS_GROUP_USERS and XOOPS_GROUP_ANONYMOUS are defined in /mainfile.php.
Enjoy!
Rob



29
robstockley
Re: Converting email addresses as images

Thanks skenow. I also found gd_info() works. In the end I've decided not to do this right now.

The extension to the XoopsObject::getVar() in /kernel/object.php is as follows
function getVar($key$format 's')
{
...
    case 
XOBJ_DTYPE_TXTBOX:
        switch (
strtolower($format)) {
        
//the next six lines added by Rob Stockley for image conversion
        
case 'i':
        case 
'image':
            
$ts =& MyTextSanitizer::getInstance();
            
$e_enc strencode($ts->htmlSpecialChars($ret).'|8');
            return 
'<img src="'.XOOPS_URL.'/include/swirl.php?data='.$e_enc.'">';
            break 
1;
        case 
's':
        case 
'show':
...


Essentially all I've done is add a new output format for XOBJ_DTYPE_TXTBOX type fields. If you use the format on other types it will be ignored and the default option output instead. Email, ICQ, and MSNM are all TXTBOXes so this seems like enough.

Now all I have to do in /userinfo.php is specify the output format as 'I' like so.
...
$xoopsTpl->assign('lang_icq'_US_ICQ);
$xoopsTpl->assign('user_icq'$thisUser->getVar('user_icq''I'));
...
if (
$thisUser->getVar('user_viewemail') == 1) {
    
$xoopsTpl->assign('user_email'$thisUser->getVar('email''I'));
} else {
    if (
is_object($xoopsUser)) {
        
// All admins will be allowed to see emails, even those that are not allowed to edit users (I think it's ok like this)
        
if ($xoopsUserIsAdmin || ($xoopsUser->getVar("uid") == $thisUser->getVar("uid"))) {
            
$xoopsTpl->assign('user_email'$thisUser->getVar('email''I'));
...


I commented out all my previous email tags in module.textsanitiser and added the following near the end of xoopsCodeDecode()
$text preg_replace($patterns$replacements$text);

// lastly decode the email tags added by Rob Stockley 25 May 07
$e_pattern "/[email]([^;<>*()"']*)[/email]/sU";
$e_matches = array();
while (preg_match($e_pattern, $text, $e_matches) != 0) {
    $e_enc = strencode($e_matches[1].'
|8');
    $e_repl = '
<img src="'.XOOPS_URL.'/include/swirl.php?data='.$e_enc.'">';
    $text = preg_replace($e_pattern, $e_repl, $text, 1);
}
$e_pattern = "/[email=(['"]?)([0-9]*)\1]([^;<>*()"']*)[/email]/sU";
while (preg_match($e_pattern, $text, $e_matches) != 0) {
    $e_enc = strencode($e_matches[3].'
|'.$e_matches[2]);
    $e_repl = '
<img src="'.XOOPS_URL.'/include/swirl.php?data='.$e_enc.'">';
    $text = preg_replace($e_pattern, $e_repl, $text, 1);
}
return $text;


The beginning of swirl.php has changed a little to cope with the encoding of email adresses.
<?php
/* script adapted by Rob Stockley from example published at
* http://nz2.php.net/manual/en/function.imagestring.php
* by brooks dot boyd at gmail dot com
*/

include './functions.php';

if (
$_GET['data'] != "") {
    
$data explode("|"strdecode($_GET['data']));
    
$msg $data[0];
    
$size intval($data[1]);
    if (
$size 16$size 16;
    if (
$size 8$size 8;

    
// you need to make sure this font file exists
    
$font '/usr/share/fonts/truetype/ttf-bitstream-vera/VeraMono.ttf';
...


Lastly you'll notice that I've referred to a pair of functions named strencode() and strdecode(). These do some pretty basic character based obfuscation so that the html source bears no resemblance to an email address. I tacked them on to the end of /include/functions.php so that they'd be in scope for all.

So anyway this approach has worked for me. I can now display text fields and emails enclosed with xoopsCode tags all as images. The default size for fields is hardcoded while the xoopsCode take a size variable between 8 and 16.

Enjoy,
Rob



30
robstockley
Re: Converting email addresses as images

You could add another field to emailprotection.php but the code might start to look a bit messy.

My new solution extends the xoopsObject class by adding a new output format to the getVar function. I haven't tested fully but in theory you'll be able to configure any textbox to be displayed as an image. I use TT fonts so I'm just figuring out how to check for the presence of the FreeType library before adding a fallback option to use the GD default fonts.




TopTop
« 1 2 (3) 4 5 »



Login

Who's Online

269 user(s) are online (149 user(s) are browsing Support Forums)


Members: 0


Guests: 269


more...

Donat-O-Meter

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

Latest GitHub Commits