gatherer = $gatherer; $subscriber->ipaddr = $REMOTE_ADDR; $subscriber->referer = $HTTP_REFERER; $subscriber->browser = $HTTP_USER_AGENT; $subscriber->mainaccount = $ac; $subscriber->subaccount = $said; $subscriber->language=$dl->detected_language; $subscriber = $dbProxy->addSubscriber($subscriber); #error_log("passing $subscriber->id to filterSingleOptIns"); $singleOptInIdsArray = $dbProxy->filterSingleOptIns($subscriber->id,$subscriber->topicIds); $cnt = 0; foreach ($singleOptInIdsArray as $anId) { if ($cnt > 0) $singleOptInIds .= ","; $singleOptInIds .= $anId; $cnt++; } $singleOptInTerds = $dbProxy->getSingleOptInTerds($subscriber->topicIds); #$terdString = "";#need this because if there are no terds, we still want to write nothing to the html page #if (count($singleOptInTerds) > 0) { #foreach ($singleOptInTerds as $smellyTerd) { #$terdString = $terdString . $smellyTerd; #} #} #if (isset($autoresponder)) { #$dbProxy->insertAutoResponders($subscriber,$autoresponder); #} session_register("email"); session_register("zip"); session_register("firstname"); #session_register("subscriber"); #session_register("topics"); #find the type of followup page. possibilities are .html, .php & .tmpl #treat .php and .html the same if (!isset($followup)) { #$dotPosition = strpos($followup,'.'); #$type = substr($followup,$dotPosition); if (isset($tmpl)) { #$tmpl = "hsi1thanksframe"; include "HtmlTemplateProxy.class"; $page = new HtmlTemplateProxy($tmpl); #$mytmpl = $tmplRoot . $tmpl.tmpl; #if (! file_exists($mytmpl) ) { $tmpl="standard"; return; } #$page->setTemplate("/listOptSystem/tmpl/$tmpl.tmpl"); #$page->setParameter("JAVASCRIPT",$javascript); $page->setParameter("MESSAGES",$msgOut); $page->setParameter("TABLE",$table); $page->setParameter("EMAIL",$email); $page->setParameter("FIRSTNAME",$firstname); $page->setParameter("DNAEMAIL",$email); $page->setParameter("DNAFIRSTNAME",$firstname); $page->setParameter("ZIP",$zip); $page->setParameter("OPTINTERDS",$singleOptInTerds); $tmpOIDS = ""; if ($singleOptInIds != "") { $tmpOIDS = "topicid[]=" . $singleOptInIds; } $page->setParameter("OPTINIDS",$tmpOIDS); #$page->setParameter("DNAJAVASCRIPT",$dnaJavascript); $page->setParameter("AID",$aid); $page->setParameter("SAID",$said); $page->setParameter("AC",$ac); if ($pop == 'y') { $targetAction = "target=\"new\" action=\"$PHP_SELF\""; } else { $targetAction = "action=\"$PHP_SELF\""; } $page->setParameter("TARGETACTION",$targetAction); #$page->setParameter("PHP_SELF",$PHP_SELF); $page->createPage(); exit; }#end if tmpl #else { #$tmpFollowUp = $followup; ##$tmpFollowUp = "confirm.php?$SID"; #} }#end if !isset($followup) else { $tmpFollowUp = $followup; #$tmpFollowUp = "confirm.php?$SID"; } header("Location: $tmpFollowUp"); exit; } } ?> email; } #if (!isset($firstname)) { $firstname = $subscriber->firstname; } #if (!isset($zip)) { $zip = $subscriber->zip; } } if (count($messages) > 0) { foreach($messages as $message) { $msgOut .= "

$message

"; } } ?> transposed to popular:-1:$cols //popular:5 -> max of 5, transposed to :5:$cols //or popular:5:2 -> max of 5 with 2 columns if (strpos($tmpCat,":") == 0) { //it doesn't contain a : (max topics) or a : (max columns) $tmpCat .= ":-1:$cols"; //will return all topics for a category, with number of cols set in $cols } $cnt = 0; $delims = ":"; $word = strtok($tmpCat,$delims); while (is_string($word)) { if ($word) { $cnt++; } $word = strtok($delims); } if ($cnt < 3) { $tmpCat .= ":$cols"; } # if we end up with popular:5 -> transpose to popular:5:$cols $throwAway = explode(":",$tmpCat); array_push($cats,$throwAway[0]); $catCols[strtolower($throwAway[0])] = $throwAway[2]; #$catCols[software]=4 //convert to lowercase //$catMax[Most Popular] -> $catMax[most popular] //$catMax[SoFtWaRe] -> $catMax[software] $catMax[strtolower($throwAway[0])] = $throwAway[1]; #catMax[catgames] = 7 #print "added $throwAway[2] to $throwAway[0]"; #print "
$throwAway[0] = $throwAway[1]"; } //now turn the array into comma delimited form //so that getCategory may be called //there is a way to do this in perl with 1 line, but not in php //that I can find! $cnt = 0; $pos = count($cats); foreach ($cats as $tmpCat) { if ($cnt > 0) $newCatList .= ","; $newCatList .= $tmpCat; $cnt++; } #$categoryObj = $dbProxy->getCategory($cat); if (!isset($topicids)) $categoryObj = $dbProxy->getCategory($newCatList); else { $title = false; $categoryObj = array(); array_push($categoryObj,new Category(-1,'tmp')); } #$remainingLists = $maxlists; $pos = count($categoryObj) - 1; $maxPos = 0; #assuming the request is software:5,games:17 and #software,games is passed to getCategory #then the array will return games,software like: #categoryObj[0] = games #categoryObj[1] = software #then, the max array was stored as an associative array #catMax[games] = 5 #catMax[software] = 17 #therefore we can access the maxlists as $catMax[aCategory->getDisplayName()]; #however, we must 1st convert everything to lowercase and #I had no luck creating a $maxTopics integer and then passing it to the select stmt #foreach ($categoryObj as $aCategory) { while ($pos >= 0) { $aCategory = $categoryObj[$pos--]; #$maxTopics = $catMax[strtolower($aCategory->getDisplayName())]; if (!isset($topicids)) { $aCategory->topics = $dbProxy->getTopicsForCategoryWithTypeAndIn($aCategory->id,$type, $catMax[strtolower($aCategory->getDisplayName())],$topicids); } else { $aCategory->topics = $dbProxy->getSpecificTopics($topicids); } if (count($aCategory->topics) > 0) { #sdg $table .= ""; # $table .= "
"; $table .= "
"; #$remainingLists -= count($aCategory->topics); $tmpColCnt = $catCols[strtolower($aCategory->getDisplayName())]; if ($tmpColCnt == 0) { $tmpColCnt = $cols; } //somehow $tmpCols is set to 4 when we only have 1 category per topic (i.e. Free Stuff) if ($tmpColCnt > count($aCategory->topics)) { $tmpColCnt = count($aCategory->topics); } $tmpWidth = 100/$tmpColCnt; settype($tmpWidth,integer); #print "title = $title"; if ($title == "true") { #$table .= "\n"; } $cnt = 0; $tdtag = 0; foreach ($aCategory->topics as $aTopic) { #if ($cnt % $cols == 0) { $table .= "\n"; } if ($cnt % $tmpColCnt == 0) { $table .= "\n"; } if (isset($topics)) { foreach ($topics as $checkedTopic) { $checked = ""; if ($checkedTopic == $aTopic->id) { $checked = "checked"; break; } } } else if (strcmp($aTopic->getChecked(),'y') == 0) { $checked = "checked"; } else { $checked = ""; } $name = $aTopic->getDisplayNameWithLink(); $table .= "\n"; ."$name"; $cnt++; $tdtag++; #if ($cnt % $cols == 0 || count($aCategory->topics) == $cnt) { if ($cnt % $tmpColCnt == 0 || count($aCategory->topics) == $cnt) { #if(count($aCategory->topics) == $cnt && ($cnt % $cols != 0)) { if(count($aCategory->topics) == $cnt && ($cnt % $tmpColCnt != 0)) { for ($endtd = $tdtag; $endtd < $tmpColCnt ; $endtd++) { $table .= "\n"; } } $table .= "\n"; $tdtag = 0; } } $table .= "
" $table .= "\n
" ."".$aCategory->getDisplayName() ."
id\" $checked>" #sdg ."$name  
"; } #} } $page = new HtmlTemplateProxy($tmpl); #$mytmpl = "/listOptSystem/tmpl/$tmpl.tmpl"; #if (! file_exists($mytmpl) ) { $tmpl="standard"; return; } #$page->setTemplate("/listOptSystem/tmpl/$tmpl.tmpl"); #$page->setParameter("JAVASCRIPT",$javascript); $page->setParameter("MESSAGES",$msgOut); $page->setParameter("TABLE",$table); $page->setParameter("EMAIL",$email); $page->setParameter("FIRSTNAME",$firstname); $page->setParameter("DNAEMAIL",$email); $page->setParameter("DNAFIRSTNAME",$firstname); $page->setParameter("ZIP",$zip); #$page->setParameter("DNAJAVASCRIPT",$dnaJavascript); $page->setParameter("AID",$aid); $page->setParameter("SAID",$said); $page->setParameter("AC",$ac); if ($pop == 'y') { $targetAction = "target=\"new\" action=\"$PHP_SELF\""; } else { $targetAction = "action=\"$PHP_SELF\""; } $page->setParameter("TARGETACTION",$targetAction); #$page->setParameter("PHP_SELF",$PHP_SELF); $page->createPage(); ?>