1
zite83
Re: You are registered as BAD_IP by Protector.
  • 2010/12/5 10:44

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


All depends on what you want to do. If you are permanently banned then you need to go around protector and access your database and lib files, or you can wait till the time expires for the ban.

What you need to alter is a file located in your xoops_lib directory and a row or more in your database.


In your database locate the table {xoops_table_prefix}_protector_access and remove all rows that have your IP listed.

You will also need to remove the ip listed in the file located /xoops_lib/modules/protector/configs/badipsdb

This is at least how I unbanned myself from my test site.



2
zite83
Re: function updateAll()
  • 2010/11/14 19:33

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


*Face Palm*

Thanks trabis, I spent so much time looking at others modules trying to figure out how they do an update but couldn't figure it out. I had it all along, I just needed to add the unique auto id into my object before I inserted it and then it would of updated.... I came up with just a basic queryF statement but don't like to use those. Wow Xoops classes can save so much work once you know how to use them!



3
zite83
function updateAll()
  • 2010/11/14 1:17

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


I have most of the functions located in object.php figured out. I've been playing around with trying to update a single row in my database through extending the XoopsPersitableObjectHandler. I have been able to update one field at a time, but was wondering is there a function I'm missing that would update all fields in a row, or am I reading how to use the updateall function?


Example of how I insert a new row
$article_handler xoops_getModuleHandler('NewsArticles''MyNews');

//Build object
$article->art_cat_id =  $_POST['art_cat_id']; 
$article->art_title =  $_POST['art_title'];
$article->art_text =  $_POST['art_text'];
$article->art_submitter =  $uid
$article->art_submit_date =  $_POST['art_submit_date']; 

//Create data and insert.
$article_data $article_handler->create();
$article_data->setVars($article);
$article_handler->createArticles($article_data);


// Part of my class that extends XoopsPersitableObjectHandler

/*
* create
*/        

function createArticles($data)
{
     
$this->insert($data);        
}


Is there a function that I can use with XoopsPersitableObjectHandler that does the same thing but updates a rows fields instead? So that I can place all my data from a form into an object and then push that object through my class system?




4
zite83
Creating my own permissions class for my module.
  • 2010/8/13 21:19

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


This is what I found at Adding Group Permissions and starting playing around with it in some of my test modules.


$gperm_handler =& xoops_gethandler('groupperm');
$cando $gperm_handler->checkRight($perm_name1$groups$mod_id)

if (
$cando){

   echo 
'true';

}else{

   echo 
'false';

}


What I wanted to come up with was a simple class that I could check all permissions for that user through out my module. What I came up with seems to work, but I'm not that great with security and just wanted to know if this is safe way to check my modules permissions or is there another direction I should go.

//Create new object while passing what I want to check
$replayPermissions = new replayPermissions('replay_permissions');


if (
$replayPermissions->canDelete()){
    echo 
'True';    
}else{
    echo 
'False';    
}



Class itself, just to note is only checking one type of permissions "replay_permissions" that is for module wide and not just one specific id or item.

if (!defined('XOOPS_ROOT_PATH')) {
    die(
"XOOPS root path not defined");
}



class 
replayPermissions {

    private 
$isAdmin false;
    private 
$view false;
    private 
$submit false;
    private 
$edit false;
    private 
$delete false;
    private 
$download false;
    private 
$vote false;
    private 
$edit_others false;
    private 
$delete_others false;


    function 
replayPermissions()
    {
        
$this->__construct();
    }

    function 
__construct($perm_name){
        

         global 
$xoopsUser;
        
        
$uid = (is_object($xoopsUser)) ? intval($xoopsUser->uid()): 0;
        
$groups = (is_object($xoopsUser)) ? $xoopsUser->getGroups(): XOOPS_GROUP_ANONYMOUS
         
        
         
        
$module_handler =& xoops_gethandler('module');
        
$module =& $module_handler->getByDirname('replay');
        
$mid $module->getVar('mid');
        
        
$gperm_handler =& xoops_gethandler('groupperm');
        
        
$this->isAdmin $gperm_handler->checkRight('system_admin'$uid$groups);
        
$this->view $gperm_handler->checkRight($perm_name$groups$mid);        
        
$this->submit $gperm_handler->checkRight($perm_name$groups$mid);    
        
$this->edit $gperm_handler->checkRight($perm_name$groups$mid);
        
$this->delete $gperm_handler->checkRight($perm_name$groups$mid);    
        
$this->download $gperm_handler->checkRight($perm_name$groups$mid);    
        
$this->vote $gperm_handler->checkRight($perm_name$groups $mid);    
        
$this->edit_others $gperm_handler->checkRight($perm_name$groups$mid);    
        
$this->delete_others $gperm_handler->checkRight($perm_name$groups$mid);        

    }
    
    
    function 
isAdmin() { 
    
        return 
$this->isAdmin;
    
    }
    
    function 
canView() { 
    
        return 
$this->view
    
    }
    
    function 
canSubmit() { 
    
        return 
$this->submit
    
    }
    
    function 
canEdit() { 
    
        return 
$this->edit
    
    }
    
    function 
canDelete() { 
    
        return 
$this->delete
    
    }
    
    function 
canDownload() { 
    
        return 
$this->download
    
    }
    
    function 
canVote() {
    
        return 
$this->vote;
    
    }
    
    function 
canEdit_others() { 
    
        return 
$this->edit_others
    
    }
    
    function 
canDelete_others() {
    
        return 
$this->delete_others
    
    }
}



5
zite83
Re: Extending XoopsPersistableObjectHandler Question
  • 2010/7/22 13:49

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


Trabis only if my brain could work at such a high level as yours :)

This works much better than the rig I made which did the same thing.

$criteria = new CriteriaCompo();

foreach (
$ID_array as $id){

     
$criteria->add(new Criteria('id'$id'='),'OR');

}
$obj $obj_handler->getObjects($criteria);


Thanks for the help!



6
zite83
Extending XoopsPersistableObjectHandler Question
  • 2010/7/22 9:54

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


Extending XoopsPersistableObjectHandler questions agin..

Example Table

(id - name - age - sex)

1 - Bob - 23 - M
2 - Susan - 12 - F
3 - Greg - 56 - M
4 - Jessica - 27 - F
5 - Sue - 32 - F
6 - Jim - 87 - M
7 - Frank - 3 - M
etc..

Now lets say this table goes all the way to 1000 rows..

Im extending XoopsPersistableObjectHandler and I want to know how to tackle this query if at all possible.

$obj_handler =& xoops_getModuleHandler('class','module');

What I want to know is there any way I can pull only rows 1,6,7,14,78,100,135,144,322?

Should I do a query for each row or is there a way to just pull those without querying all 1000+ rows?



7
zite83
Re: Object handler combind multipal tables data
  • 2009/9/13 4:13

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


My brain hurts some what, but I got it working! Thanks so much!

Like I stated the example I gave was just an example, what I'm really making is a Raid Progression module for our guild website. I've seen many addons on other CMS' like it, but since XOOPS dosn't have one, I would just make it myself.


//Append each boss to instance array where the raid_lid matches the raid_id
foreach ($instances as $id => $instance_id){
    foreach (
$bosses as $boss_id){
        if (
$instance_id['raid_id'] == $boss_id['raid_lid']){
                
$instances[$id]['bosses'][] = $boss_id;
        }
    }
}


Now I just need to do abit of styling of course the screen shot is just a test.

Resized Image


Yes I'm World of Warcraft nerd and I will be making a few modules for XOOPS based around World of Warcraft Guilds.



8
zite83
Object handler combind multipal tables data
  • 2009/9/12 23:25

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


I need some help, I read the topic on how can i create and use XOOPS object handler in my module? and played around with that, and just love it! No more SQL statements! The one thing I can't figure out is how to join two tables data or if there is another route I can take.

Here's an example of what I want to do


table one "departments"

id - name

1 - hardware
2 - sporting-goods
3 - auto
4 - produce
5 - deli

table two "employees"

id - dept_id - name

1 - 2 - Joe
2 - 2 - Bob
3 - 2 - Susan
4 - 4 - Greg
5 - 4 - Jim
6 - 3 - Frank
7 - 1 - Jill
8 - 1 - Brian
9 - 5 - Kate
10 - 5 - Matt


Now my template will show each department and under each department would be its employees.

<{foreach item=department from=$departments}>

<{
department.name}>

<{foreach 
item=employee from=$employees}>

<{
$employee.name}>

<{/foreach}>

<{/foreach}>


I don't know if that is even the route to go, but any help would be great.



9
zite83
Re: Problem altering newbb templates
  • 2009/8/22 20:03

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


I don't know if the problem I had is the same, but when I wanted to use a custom template for cbb3.08 with in my theme, I noticed everything would show my templates all but the thread.html one. Taking a look at the veiwtopic.php I noticed this...

if($xoopsTpl->xoops_canUpdateFromFile() && is_dir(XOOPS_THEME_PATH."/".$xoopsConfig['theme_set']."/templates/".$xoopsModule->getVar("dirname"))){
    
$xoopsTpl->assign('newbb_template_path'XOOPS_THEME_PATH."/".$xoopsConfig['theme_set']."/templates/".$xoopsModule->getVar("dirname"));
}else{
    
$xoopsTpl->assign('newbb_template_path'XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/templates");
}


I changed the templates to modules
if($xoopsTpl->xoops_canUpdateFromFile() && is_dir(XOOPS_THEME_PATH."/".$xoopsConfig['theme_set']."/modules/".$xoopsModule->getVar("dirname"))){
    
$xoopsTpl->assign('newbb_template_path'XOOPS_THEME_PATH."/".$xoopsConfig['theme_set']."/modules/".$xoopsModule->getVar("dirname"));
}else{
    
$xoopsTpl->assign('newbb_template_path'XOOPS_ROOT_PATH."/modules/".$xoopsModule->getVar("dirname")."/templates");
}


Once I made that change, thread.html was being used from my themes directory not my module directory.



10
zite83
White page on perm-quota.php
  • 2009/8/20 18:28

  • zite83

  • Just popping in

  • Posts: 41

  • Since: 2004/10/5


extgallery

Author
Zoullou
Version - 1.08

With a fresh install of my XOOPS and fresh downloads of all the modules I use. Everything worked fine, till I tried creating a category with extcal and just a white page happen, same when I tried going to the permissions tab. After turning on debug mode, I found there was an error in line 1 in perm-quota.php
At the end of perm-quota.php it is missing a closing semicolon
'pluginPerm' =>
  array (

  ),
)
?>


It should be

'pluginPerm' =>
  array (

  ),
);
?>


Well thats what I did and now the module works just fine. I am posting this here in case anyone else runs into the problem, tried posting on Zoullou's site, but waiting on an activation of my account.

Let me know if this works for anyone else and that this is the problem with white page showing after clicking the perms tab and or trying to add category.

include / perm-quota.php




TopTop
(1) 2 3 4 »



Login

Who's Online

221 user(s) are online (163 user(s) are browsing Support Forums)


Members: 0


Guests: 221


more...

Donat-O-Meter

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

Latest GitHub Commits