xoops forums

Forum Index


Board index » All Posts (wishcraft)




wishcraft

Module Developer
Posted on: 2008/2/7 4:23
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1311

Re: Links on Xoops main site dont work

Well of all the CMS XOOPS is the most powerful and also one of the only ones that does templating, my friend that runs www.spraci.com whom used dupal is finding there are to many SQL Injections with his server now he is in his 10th year and having over 15000 people come to his site daily.

Joomla for example is FULL of security flaws, it will infact on many service (hosting) be disabled by the hostmaster due to this. And is not recommended.

Joomla is a similar thing to Xoops, a CMS (Content Management System). See with XOOPS you can cache your system so it reduced MySQL Queries and speeds up performance, also with XOOPS the more people you have at the site the quicker it performs.

They do not work together as they are competiting platforms, but out of the too I tell you which one i use, and i have been programmer sites before HTML even existed (Aggghh Gopher).. XOOPS.

The XOOPS site has been undergoing some server restructing and maintenance to the code libraries, i appologies for any inconvience this has cause or possible result in your consider an inferior CMS.

To get reading material and books on XOOPS check out www.amazon.com there is a good short manual there for around 24.95 that i supply most of my clients.
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/7 4:17
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1312

Re: turning off allow_url_fopen

This is more a php question but I will answer it for you Partly cause I am a nice man...

This is the function you have to use http://au2.php.net/manual/en/function.ini-set.php

What you will have to do is alter main.php so it has the following command:

ini_set('allow_url_fopen',TRUE); # Will enable it
ini_set('allow_url_fopen',FALSE); # Will disable it
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/7 4:12
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1313

Re: No Banner ads are displaying

For banner ads to display the theme must contain the smarty tag - <{$xoops_banner}> if it does not you will have to edit it and it will then display
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/7 4:01
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1314

Couple of Requests

Request #1

We need a control table for robots and spiders, so we can authorise things like googlebot.com to access areas that are otherwise off limits to anonymous users.

I have done this alter line 315 in include\common.php to this statement:

$moduleperm_handler =& xoops_gethandler('groupperm');
        if (
$xoopsUser) {
            if (!
$moduleperm_handler->checkRight('module_read'$xoopsModule->getVar('mid'), $xoopsUser->getGroups())) {
                if (!
friendlybot()){
                    
redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
                    exit();
                }
            }
            
$xoopsUserIsAdmin $xoopsUser->isAdmin($xoopsModule->getVar('mid'));
        } else {
            if (!
$moduleperm_handler->checkRight('module_read'$xoopsModule->getVar('mid'), XOOPS_GROUP_ANONYMOUS)) {
                if (!
friendlybot()){
                    
redirect_header(XOOPS_URL."/user.php",1,_NOPERM);
                    exit();
                }
            }
        }


and included a file in include called bots.php which looks like:

function friendlybot(){
        global 
$xoopsDB;
        
$hostname gethostbyaddr($_SERVER['REMOTE_ADDR']);
        
$sql "SELECT bottype FROM ".$xoopsDB->prefix("bot");
        
$ret $xoopsDB->query($sql);
        
$state=false;
        while (
$row $xoopsDB->fetchArray($ret)){
            if (
strpos(" ".$hostname,$row['bottype'])>0&&(strpos(" ".$hostname,$row['bottype'])+strlen($row['bottype']))==strlen($hostname)){
                
$state=true;
            }
        }
        return 
$state;
    }


Still needs some security improvements like using a different matching method or checking that it is an authorised robot..

I could also have a system where you could assign a username to either one or more than one bot, so it starts a logged in session for (remember most spiders don't have cookies).. With a possible rank for it called something like 'Automonous Task'..

This was more the quick and dirty method I made for it. Maybe you could also add an extra basename check into it. This means you content will be in the search engines but it will encorage users to register to gain access to the material.

Request #2

Sitemap Control method like backend.php see SEO Tip #0

Example sitemaps:

http://www.chronolabs.org.au/sitemap.php
http://www.seo-solutions.co.in/sitemap.php
http://www.pettrade.com.au/sitemap.php
http://www.extraterrestrialembassy.com/sitemap.php

and so on

Request #3

Skype and gmail username added to the userinfo profile... come on fellas it is on 2 extra field and that the user url only displays basename() to prevent massive blow outs of field width.. Maybe also another URL for Personal Blogs also using basename(url).

Request #4

More Smiling People
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/7 3:37
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1315

Re: Xoops Freelancer?

Well I am willing to have a crack at it, sounds like a sick server... $85 AUD p/h just email me or send me a private message, i might change you to a newer version of CBB, that I have been using and seems to have no fault, 3 is an old version.
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/6 22:31
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1316

Optimizing URL Path - SEO Tip #4

Well as some of you may be aware I have been writting a few SEO tips and ticks for modules. I am going to use Ben Brown, Fernando Santos & Tobias Liegl - Content module in this example but it works for all modules.

This is about URL Optimization with the use of a .htaccess file.

First Up in this example you can see it at work at a site I have been putting together for SEO'ing XOOPS (www.seo-solutions.co.in). This ensures that we have an environment for discussing and maintaining SEO techniques for XOOPS and Websites in general. There are also a few free tools there for you to use.

Ok first up lets have a look at an example .htaccess file

Quote:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9\ \'\_\-]+)$ ../modules/freetools/?menu=$1 [L,NC,QSA]


This htaccess file will rewite the URL when a file or path in the /public_html/freetools path doesn't exist ie. http://www.seo-solutions.co.in/freetools/Position_Checker

You have to alter the index.php file to support a $_GET['menu'] variable which in my code looks like from line 39 to 46 (Orignally on line 39):

$menu = isset($HTTP_GET_VARS['menu']) ? $HTTP_GET_VARS['menu'] : '';
if (
strlen($menu)>0){
  
$result $xoopsDB->queryF("SELECT storyid FROM ".$xoopsDB->prefix(_FTS_freetools_PREFIX)." WHERE title LIKE '$menu'");
  
$rt $xoopsDB->fetchArray($result);
  
$id $rt['storyid'];
} else {
    
$id = isset($HTTP_GET_VARS['id']) ? intval($HTTP_GET_VARS['id']) : 0;
}


orgianlly this code was only one line which was $id = isset($HTTP_GET_VARS['id']) ? intval($HTTP_GET_VARS['id']) : 0;

Now what this is doing is using the content's title field to look up the ID, the underscore '_' in MySQL support a wild card for 1 character which means that it will with a Like command look up the ID and pass it to the remaining code.

This will then reload the page on the example URL i have shown you without the page even being in that folder. There is a couple of limitations in XOOPS 2.0 and 2.2 that is when you can't rewrite the URL in the mainmenu easily... I am looking into this more, the only problem with this is you get 2 URL in the search index for 1 page.. bit like spam isn't it.

This is all to it, if you want to hire me to optimize your xoops, I am available on ad hoc arrangements - $85AUD p/h. btw you may need this function for your sitemap mentioned in SEO Tip #3 it is called SEF it changes a title to a URL consistant with a MySQL injection. It removes all the funny characters that can affect a mod rewrite.

function sef($datab)
{
    
$replacement_chars = array(",",""","","-",":","\","'"," ",".","%","@","#","!","&","/");
    $return_data = (str_replace($replacement_chars,"_",$datab));
    #print $return_data . "<BR><BR>";
    return($return_data);

}
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/4 22:16
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1317

Re: SmartProfile - edituser.php & /admin/user.php

Starting at Line 144 (/admin/user.php) you need to alter it to read

foreach (array_keys($fields) as $i) {
            
$fieldname $fields[$i]->getVar('field_name');
            if (
in_array($fields[$i]->getVar('fieldid'), $editable_fields) && ($fields[$i]->getvar('field_type') != "image" || isset($_REQUEST[$fieldname]))) {
                if (
in_array($fieldname$profile_handler->getUserVars())) {
                    
$value $fields[$i]->getValueForSave($_REQUEST[$fieldname], $user->getVar($fieldname'n'));
                    
$user->setVar($fieldname$value);
                }
                else {
                    
$value $fields[$i]->getValueForSave((isset($_REQUEST[$fieldname]) ? $_REQUEST[$fieldname] : ""), $profile->getVar($fieldname'n'));
                    
$profile->setVar($fieldname$value);
                }
            } elseif (
$fields[$i]->getvar('field_type') == "image"){
               
$value $fields[$i]->getValueForSave($fieldname$profile->getVar($fieldname'n'),$imageindex);
               
$profile->setVar($fieldname$value);
            }

        }


And starting line 78 you need to alter the foreach also to read

foreach (array_keys($fields) as $i) {
        
$fieldname $fields[$i]->getVar('field_name');
        if (
in_array($fields[$i]->getVar('fieldid'), $editable_fields) && ($fields[$i]->getvar('field_type') != "image" || isset($_REQUEST[$fieldname]))) {
            if (
in_array($fieldname$profile_handler->getUserVars())) {
                
$value $fields[$i]->getValueForSave($_REQUEST[$fieldname], $edituser->getVar($fieldname'n'));
                
$edituser->setVar($fieldname$value);
            }
            else {
                
$value $fields[$i]->getValueForSave((isset($_REQUEST[$fieldname]) ? $_REQUEST[$fieldname] : ""), $profile->getVar($fieldname'n'));
                
$profile->setVar($fieldname$value);
            }
        } elseif (
$fields[$i]->getvar('field_type') == "image"){
                
$value $fields[$i]->getValueForSave($fieldname$profile->getVar($fieldname'n'),$imageindex);
               
$profile->setVar($fieldname$value);

            
        }
    }


The changes to /class/field.php need to be changed as you can't do an isset on a $_FILES object it will always read true.

Starting at line 363 of the select case you need to make the following changes through to the fetchmedia call, the case statement should read

case "image":
                foreach (
$_POST['xoops_upload_file'] as $result){
                    
$count++;
                    if (
$result==$this->getVar('field_name')){
                        
$index $count-1;
                        break;
                    }
                }
                
                if (!isset(
$_FILES[$_POST['xoops_upload_file'][$index]])||$_FILES[$_POST['xoops_upload_file'][$index]]['error']==4) {
                    return 
$oldvalue;
                } else {
                    
//print_r($_FILES[$_POST['xoops_upload_file'][$index]]);
                
}
                
/*if (!isset($_FILES[$this->getVar('field_name')])) {
                    return $oldvalue;
                }*/
                
$options $this->getVar('field_options');
                
$dirname XOOPS_UPLOAD_PATH."/smartprofile";
                if (!
is_dir($dirname)) {
                    
mkdir($dirname);
                }
                include_once 
XOOPS_ROOT_PATH.'/class/uploader.php';
                
$uploader = new XoopsMediaUploader($dirname, array('image/gif''image/jpeg''image/pjpeg''image/x-png''image/png'), $options['maxsize']*1024$options['maxwidth'], $options['maxheight']);
                if (
$uploader->fetchMedia($_POST['xoops_upload_file'][$index])) {
                  
                    
$uploader->setPrefix('image');
                    if (
$uploader->upload()) {
                        @
unlink($dirname."/".$oldvalue);
                        return 
$uploader->getSavedFileName();
                    }
                    else {
                        echo 
$uploader->getErrors();
                        return 
$oldvalue;
                    }
                }
                else {
                    echo 
$uploader->getErrors();
                    return 
$oldvalue;
                }
                break;
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/2 10:26
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1318

Re: SmartProfile - edituser.php & /admin/user.php

Ok the second bug i have a quick fix for it...

from line 53 to line 81 of /smartprofile/include/functions.php should be as follows:

global $op_buffer;
    
$member_handler =& xoops_gethandler('member');
    
$display_criteria = new Criteria('uname'$user->getVar('uname'));
    if (
$user->getVar('uid') > 0) {
        
//existing user, so let's keep the user's own row out of this
        
$display_criteria = new CriteriaCompo($display_criteria);

        
$useriddisplay_criteria = new Criteria('uid'$user->getVar('uid'), '!=');

        
$display_criteria->add($useriddisplay_criteria);
    }
    
$display_count $member_handler->getUserCount($display_criteria);
    unset(
$display_criteria);
    if (
$display_count 0&&$op_buffer!='edit') {
        
$stop .= _PROFILE_MA_DISPLAYNAMETAKEN."<br />";
    }
    if ( 
$user->getVar('email')) {
        
$count_criteria = new Criteria('email'$user->getVar('email'));
        if (
$user->getVar('uid') > 0) {
            
//existing user, so let's keep the user's own row out of this
            
$count_criteria = new CriteriaCompo($count_criteria);
            
$count_criteria->add(new Criteria('uid'$user->getVar('uid'), '!='));
        }
        
$count $member_handler->getUserCount($count_criteria);
        unset(
$count_criteria);
        if ( 
$count &&$op_buffer!='edit') {
            
$stop .= _PROFILE_MA_EMAILTAKEN."<br />";
        }
    }


and you will need to add these to lines to /smartprofile/admin/user.php at line 42

global $op_buffer;
$op_buffer $op;


that will fix the second bug... but is wrong with the first problem and uploading??
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/2/2 10:16
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1319

SmartProfile - edituser.php & /admin/user.php

Hi all how have you been, I am just trying to debug something with smartprofile module for a client that has been a pleasure doing business with.

Quote:

When I try to edit the profile from smart profile here /modules/smartprofile/edituser.php After saving I get the following errors.

Errors Returned While Uploading
Filename Is Empty
Errors Returned While Uploading
Filename Is Empty


I have checked where the error is coming from which is the uploader.php class as part of xoops, this is the source wrap that handles uploads for some reason the media name is coming through blank and it is erroring at line 198 of /class/uploader.php

if ($this->mediaName == '') {
            
$this->setErrors('Filename Is Empty');
            return 
false;
        }


I would say there is nothing wrong with the uploader class something ether to do with magic quotes and uploading on his service or a bug in smartprofile, just wondering if anyone knowns of a fix for this.

The other bug is a repeat of the last with the following error occurring when:

Quote:

When I try to edit from /modules/smartprofile/admin/user.php I get the following errors

ERROR: Displayname taken.
ERROR: Email address already registered.


But i will have a look and see if I can see what is doing that.. admin panel stuff is easier
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies


wishcraft

Module Developer
Posted on: 2008/1/18 21:51
wishcraft
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18
#1320

Re: Hack the "recent comment block"

In /modules/system/templates/blocks you will find a smarty template called system_block_comments.html I think this is the one you need to alter, you will have to check the variable names in the PHP file that generates this, but this is the block i think that does 'recent comments' (don't quote me on this).

All you should have to do is make the block look and feel the way you want it and then refresh the module and clear your template_c path.

Thanks!
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/SimonXaies
github.com/Chronolabs-Cooperative
facebook.com/SimonSXaies



TopTop
« 1 ... 129 130 131 (132) 133 134 135 »