21
ccrstudioweb
Re: smartpartner and 100% cpu usage by APACHE

No,
I´ve just set it as first xoops´page.
I´ll take a look at xDirectory.
But for now I´d like to discover the smartpartner problem! Thank you!



22
ccrstudioweb
smartpartner and 100% cpu usage by APACHE

Hi all!
I instaled smartpartner 2.0 but I got only blank pages, so I decided to install SmartPartner version 1.4 (RC 1).

WHAT I WANT:
I tested several moduls in order to have an yellow pages site and a list of number fones of my city (about 17,000) and smartpartner was what best fit my propose (If someone has a better idea is welcome)

WHAT I USE:
XOOPS 2.0.18.1
SmartPartner version 1.4 (RC 1).
Easy PHP 2.0.0.0
phpMyAdmin 2.9.1.1
MySQL: 5.0.22
PHP Version 5.2.0

THE PROBLEM
I inserted the 17,000 phone numbers on DB.
When I do a search using XOOPS native sercher, Is everything OK, But when I enter the smartpartner category listing (eG:http://localhost/ltlnossalista/modules/smartpartner/index.php?view_category_id=3), there are a big delay and a 100% CPU usage, which ends on blank page sometimes.
The funniest is that even if i go to another page, the usage of CPU continues.
look:
Resized Image

THE CODES:
MYSQL TABLES:
CREATE TABLE `ccr091202_smartpartner_partner` (
  `
idint(11NOT NULL auto_increment,
  `
categoryidint(11NOT NULL default '11',
  `
weightint(10NOT NULL default '0',
  `
datesubint(11NOT NULL default '1259850053',
  `
hitsint(10NOT NULL default '0',
  `
hits_pageint(10NOT NULL default '0',
  `
urlvarchar(150) default '',
  `
imagevarchar(150NOT NULL default '-1',
  `
image_urlvarchar(255NOT NULL default '',
  `
titlevarchar(255NOT NULL default '',
  `
summarytext NOT NULL default 'Pirassununga/SP',
  `
descriptiontext NOT NULL default '  ',
  `
contact_namevarchar(255NOT NULL default '',
  `
contact_emailvarchar(255NOT NULL default '',
  `
contact_phonevarchar(255NOT NULL default '',
  `
adresstext NOT NULL,
  `
statustinyint(1NOT NULL default '2',
  `
email_privtinyint(1NOT NULL default '0',
  `
phone_privtinyint(1NOT NULL default '0',
  `
adress_privtinyint(1NOT NULL default '0',
  
PRIMARY KEY  (`id`),
  
KEY `status` (`status`)
ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='SmartPartner by marcan' AUTO_INCREMENT=10 ;


INSERT INTO `ccr091202_smartpartner_partner` (`id`, `categoryid`, `weight`, `datesub`, `hits`, `hits_page`, `url`, `image`, `image_url`, `title`, `summary`, `description`, `contact_name`, `contact_email`, `contact_phone`, `adress`, `status`, `email_priv`, `phone_priv`, `adress_priv`) VALUES 
(10001110125985005300'''-1''''Pedro de Carvalho''Pirassununga/SP'' ''''''3561 9057''Rua João felício Filho, 710 - Jardim Redentor'2000),
(
10002110125985005300'''-1''''Márcia Montovani''Pirassununga/SP'' ''''''3561 1234''Rua Mascarenhas pedroso, 710 - Jardim Redentor'2000),
(
10003110125985005300'''-1''''Carmo castro''Pirassununga/SP'''''' ''3561 4321''Rua José Felício, 2710 - Jardim Rntor'2000); 
AND 
SO ON


THE PHP (smartpartner/index.php?view_category_id):
<?php

/**
* $Id: index.php,v 1.27 2006/02/13 17:42:12 malanciault Exp $
* Module: SmartPartner
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/


/**
*Ceci nous produira un tableau de forme:
*
*PartnersArray[] =
*     PartnersArray[TopCat1][info] = (nom, description)
*     PartnersArray[TopCat1][partners] = array de partner (via fct get_partners_array())
*      PartnersArray[TopCat1][subcats][0][info] = (nom, description)
*      PartnersArray[TopCat1][subcats][0][partners] = array de partner
*      PartnersArray[TopCat1][subcats][0][subcats]....
*    Ainsi de suite
*
*ex: PartnersArray[TopCat1][partners][0][nom] contiendra le nom du 1er partenaire de TopCat1
*       
*/

/**
*Loop inside the array of all partners to match with current category
*
*param $categoryid - id of the current category 
*return array of partners for the current category
*/
function get_partners_array($categoryid){
    
    foreach (
$every_partners_array as $partnerObj ){
        if(
$partnerObj->categoryid() == $categoryid && ($view_category_id || (!$view_category_id && sizeof($partners) < $xoopsModuleConfig['percat_user']))){
            
$partner $partnerObj->toArray('index');
            
$partners[] = $partner;
        }
    }
    return 
$partners
}

/**
*Loop inside the array of all categories to find subcats for current category
*recusrive function: for each subcat found, call to function getcontent to
*get partners and subcats within it
*
*param $categoryid - id of the current category 
*return array of subcats for the current category
*/
function get_subcats($every_categories_array,$categoryid$level){

    
//global $every_categories_array;
    
$subcatArray = array();
    
$level++;
    
    foreach (
$every_categories_array as $subcatObj) {
             
        if(
$subcatObj->parentid() == $categoryid ){
            
$subcatArray[] = get_cat_content($every_categories_array,$subcatObj,$level);
        }
    }
    return 
$subcatArray;
}

/**
*Retrieve content for the current category
*
*param $categoryid - id of the current category 
*return array of content for the current category
*/
function get_cat_content($every_categories_array$categoryObj,$level){
    
$category = array();
    
$decalage='';
    for(
$i=0;$i<$level;$i++){
        
$decalage .= '--';
    }
    
$decalage .= ' ';
    
$category['title'] = $decalage.''.$categoryObj->name();
    
$category['description'] = $categoryObj->description();
    
$category['link_view'] = $categoryObj->getCategoryUrl();
    
$category['partners'] = get_partners_array($categoryObj->categoryid());
    
$category['image_url'] = $categoryObj->getImageUrl(true);
    
$category['subcats'] = get_subcats($every_categories_array,$categoryObj->categoryid(),$level);
    return 
$category;
}

include 
"header.php";
$xoopsOption['template_main'] = 'smartpartner_index.html';
include 
XOOPS_ROOT_PATH."/header.php";
include 
"footer.php";

// At which record shall we start
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;

$view_category_id = isset($_GET['view_category_id']) ? intval($_GET['view_category_id']) : 0;

$partners_total $smartpartner_partner_handler->getPartnerCount();

if(
$xoopsModuleConfig['index_sortby']== 'title' || $xoopsModuleConfig['index_sortby']== 'weight'){
    
$order 'ASC';
}
else{
    
$order 'DESC';
}
//Retreive all records from database
$every_categories_array $smartpartner_category_handler->getCategories(0,0,-1,'weight''ASC'true);
$every_partners_array $smartpartner_partner_handler->getPartnersForIndex(-1_SPARTNER_STATUS_ACTIVE$xoopsModuleConfig['index_sortby'], $order);

$partnersArray = array();

//display All categories and partners
if(!$view_category_id){
    
//get orphan first if preference says so
    
if($xoopsModuleConfig['orphan_first']){
        
$partnersArray['orphan']['partners']= get_partners_array(0);
    }

    
//get all categories and content
    
foreach ( $every_categories_array as $categoryObj){
        if (
$categoryObj->parentid()==0){
            
$partnersArray[] = get_cat_content($every_categories_array$categoryObj,0);
        }
    }

    
    
//get orphan last if preference says so
    
if(!$xoopsModuleConfig['orphan_first']){
        
$partnersArray['orphan']['partners']= get_partners_array(0);
    }
    
    
$categoryPath '';
}

//viewing a specific category
else{
    
$currentCategoryObj $every_categories_array[$view_category_id];
    
$partnersArray[] = get_cat_content($every_categories_array$currentCategoryObj0);

    if (!
$partnersArray[0]['partners'] && !$partnersArray[0]['subcats']) {
        
redirect_header(SMARTPARTNER_URL3_MD_SPARTNER_CATEGORY_EMPTY);            
    }
    
// Retreiving the category path
    
$categoryPath $currentCategoryObj->getCategoryPath();
}

//$partners_total_onpage = $count;.partners
$xoopsTpl->assign('partners'$partnersArray);

//end new code to implement categories

// Partners Navigation Bar
//$pagenav = new XoopsPageNav($partners_total_onpage, $xoopsModuleConfig['perpage_user'], $start, 'start', '');
//$xoopsTpl->assign('pagenav', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
$xoopsTpl->assign('view_deteils_cat'_MD_SPARTNER_DETAIL_CAT);
$xoopsTpl->assign('on_index_page'$view_category_id == 0);
$xoopsTpl->assign('sitename'$xoopsConfig['sitename']);
$xoopsTpl->assign("displayjoin" $xoopsModuleConfig['allowsubmit'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost']));
$xoopsTpl->assign("img_max_width" $xoopsModuleConfig['img_max_width']);
$xoopsTpl->assign('module_home''<a href="' SMARTPARTNER_URL '">' $smartpartner_moduleName '</a>');
$xoopsTpl->assign('categoryPath'$categoryPath);
$xoopsTpl->assign('lang_intro_text' $myts->displayTarea($xoopsModuleConfig['welcomemsg']));
$xoopsTpl->assign('lang_partner'_MD_SPARTNER_PARTNER);
$xoopsTpl->assign('lang_desc'_MD_SPARTNER_DESCRIPTION);
$xoopsTpl->assign('lang_edit'_MD_SPARTNER_EDIT);
$xoopsTpl->assign('lang_delete'_MD_SPARTNER_DELETE);
$xoopsTpl->assign('lang_hits'_MD_SPARTNER_HITS);
$xoopsTpl->assign('lang_join' _MD_SPARTNER_JOIN);
$xoopsTpl->assign('lang_no_partners'_MD_SPARTNER_NOPART);
$xoopsTpl->assign('lang_main_partner'_MD_SPARTNER_PARTNERS);
$xoopsTpl->assign('lang_readmore'_MD_SPARTNER_READMORE);
if(!
$xoopsModuleConfig['hide_module_name']){
    
$xoopsTpl->assign('lang_partnerstitle'$myts->displayTarea($xoopsModule->getVar('name')));
}
include_once 
XOOPS_ROOT_PATH.'/footer.php';
?>


It must have a loop or such thing but I couldn´t find it.
I tried to give you all information. If someone can help me I would apreciate a lot.
Thank you in advanced!!!!



23
ccrstudioweb
Re: smart codes and PHP

THANK YOU GHIA!!!!!!!!!

That´s it!!!

In return I explain:
I will explode the url in order to get the file extention. And depending on the file extention, the xcgal prints an apropriate player

<{php}>
$foto_temp $this->get_template_vars('picture_url');  
$ext end(explode("."$foto_temp));  

if (
$ext == "mp3" or $ext == "MP3" or $ext == "wma" or $ext == "WMA"  or $ext == "au" or $ext == "AU" )  { echo "<div width="100%" align="center"><OBJECT id="MediaPlayer1" width="400" height="70" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><param name="fileName" value=""<{/php}><{$picture_url}>"<{php}> echo "><param name="animationatStart" value="false"><param name="transparentatStart" value="true"><param name="autoStart" value="false"><param name="showControls" value="true"><PARAM NAME="ShowPositionControls" VALUE="true"> <PARAM NAME="ShowAudioControls" VALUE="true"><PARAM NAME=ShowDisplay" VALUE="false"><PARAM NAME="EnableTracker" VALUE="true"><PARAM NAME="ShowTracker" VALUE="true"><PARAM NAME="ShowStatusBar" VALUE="true"><param name="loop" value="true"><embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="MediaPlayer1" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="1" showdisplay="0" showstatusbar="1" videoborder3d="-1" width="400" height="70" src=""<{/php}><{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true"></embed></OBJECT></div> ";} else { echo"";}    



 
if ($ext == "wmv" or $ext == "WMV" or $ext == "avi" or $ext == "AVI" )  { echo "<div width="100%" align="center"> <OBJECT id="MediaPlayer1" width="436" height="343" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><param name="fileName" value=""<{/php}><{$picture_url}>"<{php}> echo "><param name="animationatStart" value="false"><param name="transparentatStart" value="true"><param name="autoStart" value="false"><param name="showControls" value="true"><PARAM NAME="ShowPositionControls" VALUE="true"> <PARAM NAME="ShowAudioControls" VALUE="true"><PARAM NAME=ShowDisplay" VALUE="false"><PARAM NAME="EnableTracker" VALUE="true"><PARAM NAME="ShowTracker" VALUE="true"><PARAM NAME="ShowStatusBar" VALUE="true"><param name="loop" value="true"></OBJECT>  <embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download" id="MediaPlayer1" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="1" showdisplay="0" showstatusbar="1" videoborder3d="-1" width="436" height="343" src=""<{/php}><{$picture_url}>"<{php}> echo " autostart="false" designtimesp="5311" loop="true"></embed><br /></div> ";} else { echo"";}     



if ($ext == "flv" or $ext == "FLV" or $ext == "swf" or $ext == "SWF" )  { echo"<div width="100%" align="center"><table width="400" align="center" border="0" height="335"><tbody><tr><td align="center" bgcolor="#000000"><div id="container"><embed type="application/x-shockwave-flash" src="mediaplayer.swf" style="" id="mediaplayer" name="mediaplayer" quality="high" allowfullscreen="true" flashvars="width=436&amp;height=343&amp;file=";<{/php}><{$picture_url}>"<{php}> echo " width="436" height="343"></div></td></tr></tbody></table></div>";} else { echo"";}       <{/php}>
:



24
ccrstudioweb
smart codes and PHP

Hi all,
I,m working on modules/xcgal/templates/xcgal_display.html

I added an php routine inside this file. But inside the <{php}><{/php}> I need one XOOPS variable <{$picture_url}> in order to get the file extension:

<{php}> $foto_temp = <{$picture_url}>; echo $foto_temp ; <{/php}>


If I use the former code I get a blank page.
So I,d tried to concatenate it:

<{php}> $foto_temp ".<{$picture_url}>."; echo $foto_temp ; <{/php}>


And I got:
.<>.

I´d tried this one as well:
<{php}> $foto_temp $picture_url; echo $foto_temp ; <{/php}>


And the variable $foto_temp got no value.

I need something like this:
<{php}> $foto_temp =  albums/userpics/10001/Sussurros.wmv  
; echo $foto_temp ; <{/php}>


I´ve been using XOOPS 2.0.18
Any idea?
Thanks in advanced!
Claudio Reis



25
ccrstudioweb
NEWS multi upload files

Hi, I need help on NEWS module.
I want news to upload several files in one action. Look the images on this article near the footer:

http://www.piracemafm.com.br/modules/news/article.php?storyid=63

To have this I need to upload one and save the article. After, I edit the same article and submit another file, so I reedit and send the third....

I´d like to submit 3, 4, 5 at once.
I tryied to duplicate the folowing line on news/includes/storyform.inc.php

$sform->addElement(new XoopsFormFile(_AM_SELFILE'attachedfile'$xoopsModuleConfig['maxuploadsize']), false);


It duplicated the file upload field, but when using it, only the last one is attached.
Any ideia?
Thanks in advanced!



26
ccrstudioweb
Re: White page when trying to view admin profile (userinfo.php id=1)

Hi all, I get make it work!
I simply entered admin and turned the options "defaul theme" and "selectable theme" to the same option (??????)

Don´t ask me why it did work, much less how the problem appeared...

My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/



27
ccrstudioweb
Re: White page when trying to view admin profile (userinfo.php id=1)

Hi all! I get the same error, but in a diferent way...
see:

I (as admin) can not see, as well as anybody can not see my or other profile.

I had debugged it and a lot of messages came, so I desabled all modules and the messages desappeared, so, after that I did as described on other forum in which said to comment userinfo.php the followng lines:
/* $module_handler =& xoops_gethandler('module'); $criteria = new CriteriaCompo(new Criteria('hassearch', 1)); $criteria->add(new Criteria('isactive', 1)); $mids =& array_keys($module_handler->getList($criteria));  foreach ($mids as $mid) {   if ( $gperm_handler->checkRight('module_read', $mid, $groups)) {     $module =& $module_handler->get($mid);     $results =& $module->search('', '', 5, 0, $thisUser->getVar('uid'));     $count = count($results);     if (is_array($results) && $count > 0) {         for ($i = 0; $i < $count; $i++) {             if (isset($results[$i]['image']) && $results[$i]['image'] != '') {                 $results[$i]['image'] = 'modules/'.$module->getVar('dirname').'/'.$results[$i]['image'];             } else {                 $results[$i]['image'] = 'images/icons/posticon2.gif';             }              if (!preg_match("/^http[s]*:///i", $results[$i]['link'])) {                 $results[$i]['link'] = "modules/".$module->getVar('dirname')."/".$results[$i]['link'];             }              $results[$i]['title'] = $myts->makeTboxData4Show($results[$i]['title']);             $results[$i]['time'] = $results[$i]['time'] ? formatTimestamp($results[$i]['time']) : '';         }         if ($count == 5) {             $showall_link = '<a href="search.php?action=showallbyuser&amp;mid='.$mid.'&amp;uid='.$thisUser->getVar('uid').'">'._US_SHOWALL.'</a>';         } else {             $showall_link = '';         }         $xoopsTpl->append('modules', array('name' => $module->getVar('name'), 'results' => $results, 'showall_link' => $showall_link));     }     unset($module);   } }*/


The forum said that it was because a conflict bettween modules and the userinfo.php, and was neccessary disable the last user´s activities on their profile.

Result: The modules is working, but I still have a blank user info page.
the only message debbugging gives is (Notice: A session had already been started - ignoring session_start() in file /include/common.php line 257)

The footer and header load perfectly, but the content. The edit profile and messages are fine.
It means that the system is accessing the DB.

I still am looking for the answer, but any help is welcome! Thanxs team!
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/



28
ccrstudioweb
Re: SSL in registering new user

If I access thehttps://register.php instead ofhttp://register.php the condition IF got into true:

if (!$member_handler->insertUser($newuser)) {
echo _US_REGISTERNG;
include 'footer.php';
exit();
}

noit possible insert new user.

I believe the problem is relating to pages address, so i changed
'XOOPS_URL' into 'XOOPS_URL2'
and add the line;
define 'XOOPS_URL2', 'https://mywebsite.com/portal'); But doesn´t work.

As related in a other forum, the register has three actions:
case 'newuser':
case 'register':
case 'finish':
in the third finish happens the registration error:if (!$member_handler->insertUser($newuser)) {echo _US_REGISTERNG;
And really, the data is not inserted in MySQL table and returns the error.


My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/



29
ccrstudioweb
Re: SSL in registering new user

The XOOPS make it possible protect the login page, but I think 2 more should be protected as well: the register page and the edit profile page where you type the pswd
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/



30
ccrstudioweb
Re: SSL in registering new user

See, I just only extract the three footer.php includes from register.php.

When a new user registers, the final message is:
$result = $xoopsDB->query($sql);
list($count) = $xoopsDB->fetchRow($result);
if ($count > 0) {
$stop .= _US_EMAILTAKEN."<br />";
}
$count = 0;
if ( $email ) {
$sql = sprintf('SELECT COUNT(*) FROM %s WHERE email = %s', $xoopsDB->prefix('users'), $xoopsDB->quoteString(addslashes($email)));
$result = $xoopsDB->query($sql);
list($count) = $xoopsDB->fetchRow($result);
if ( $count > 0 ) {
$stop .= _US_EMAILTAKEN ."<br />";
}
}


What I want is to have a simple page, without header nor footer, But I can´t simply extract the includes, I need to have something on the places in order to page complete the requestion.


I´ve noticed one thing: I use the original register.php inhttp://register.php and everything ok. But when registering using sslhttps://register.php i´ve got the same US_EMAILTAKEN: not possible register the new user
My Google Maps API3 and Xoops integration (Cool!):
http://www.esterecomendo.com.br/portal/




TopTop
« 1 2 (3) 4 5 6 »



Login

Who's Online

175 user(s) are online (113 user(s) are browsing Support Forums)


Members: 0


Guests: 175


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