$language";
$dbprefix="folio_";
PagesMenu();
FolioGuard();
LanguageMenu();
switch($page){
case "9": //shop
echo "
shop menu
";
echo "shop products
";
break;
case "6": //portfolio
echo "";
NewsOverview();
echo "
";
echo "";
//if (!isset($mode)){$mode=;}
//text listing
//NewsOverview();
//echo "
"._SITE_BACKTOPREVIOUSPAGE."";
//echo "
";
switch ($mode){
//mode 1 = category pagination
//mode 2 = category detail page
//mode 3 = single static page
//mode 4 = formpost
case "1":
//category pagination
//PAGINATION
$perpage=5;
//pagination buttons
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=$cat GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC");
$totalrows=mysql_num_rows($pagequery);
$pages=ceil($totalrows/$perpage);
$paginationblock="";
$paginationblock.= "
";
for( $i=1;$i<=$pages;$i++) {
$paginationblock.= ""._SITE_PAGE." $i | ";
}
$paginationblock.= "
";
//echo $paginationblock;
//pagination filter
if (isset($page)){
$offset=($page*$perpage)-$perpage;
$pagination="LIMIT $perpage OFFSET $offset";
}else{
$pagination="LIMIT $perpage";
}
//news by category
$query=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=$cat GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC $pagination");
//news
//$newsresult=mysql_query("SELECT * FROM ".$dbprefix."news WHERE public=1 ORDER BY id DESC LIMIT 3");
if (mysql_num_rows($query)<1){
echo "\n
"._SITE_NONEWSPOSTED."
"._SITE_CHECKBACKLATER."";
} else {
while($newsresultrow=mysql_fetch_array($query)){
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
echo "\n";
echo "\n
";
$picture="";
$related="";
//related
//testing
$table="news";
$item=$newsresultrow[record2];
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='news' AND record1=$item AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
switch($table2){
case "files":
//check if picture
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$record2 AND public=1");
$fileresultrow=mysql_fetch_array($fileresult);
$type=$fileresultrow[type];
$file=$fileresultrow[file];
if ($type=="jpg"){
//get folder
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picture.= "
";
} else {
//not a picture
//$related.="
-> id $record2
";
}
break;
default:
//$related.="
-> id $record2
";
break;
}
} //related
//$relatedinfo=GetRelated($table, $item);
/*
//title
echo "
$newsresultrow[$titlelang]
";
//posted
echo "
";
echo "\n $picture
$newsresultrow[$commentlang]";
echo "\n
";
echo "
";
echo "
";
*/
$relatedinfo=GetRelated($table, $item);
//title
echo "
$newsresultrow[$titlelang]
";
//posted
echo "
";
echo "\n
$picture$newsresultrow[$commentlang]$newsresultrow[$textlang]";
//echo "\n
";
echo "\n
";
echo "\n
$relatedinfo
";
echo "\n
";
echo "
";
echo "";
} //stories
}
break;
case "2":
//news detail
//echo "news detail page";
//news by category
$query=mysql_query("SELECT * FROM ".$dbprefix."news WHERE id=$news and public>0");
//news
//$newsresult=mysql_query("SELECT * FROM ".$dbprefix."news WHERE public=1 ORDER BY id DESC LIMIT 3");
while($newsresultrow=mysql_fetch_array($query)){
echo "\n";
echo "\n";
$picture="";
$related="";
//related
//testing
$table="news";
$item=$newsresultrow[id];
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='news' AND record1=$item AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
switch($table2){
case "files":
//check if picture
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$record2 AND public=1");
$fileresultrow=mysql_fetch_array($fileresult);
$type=$fileresultrow[type];
$file=$fileresultrow[file];
if ($type=="jpg"){
//get folder
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picture.= "
";
} else {
//not a picture
//$related.="
-> id $record2
";
}
break;
default:
//$related.="
-> id $record2
";
break;
}
} //related
$relatedinfo=GetRelated($table, $item);
//title
echo "
$newsresultrow[$titlelang]
";
//posted
echo "
";
echo "\n $picture
$newsresultrow[$commentlang]$newsresultrow[$textlang]";
echo "\n
";
echo "\n
$relatedinfo
";
echo "\n
";
echo "
";
echo "";
} //stories
break;
case "4":
FormPost();
break;
case "5":
//category pagination as pictures only
//PAGINATION
$perpage=9;
if ($cat>-1){
//pagination buttons
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=$cat GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC");
}else{
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC");
}
$totalrows=mysql_num_rows($pagequery);
$pages=ceil($totalrows/$perpage);
$paginationblock="";
$paginationblock.= "";
for( $i=1;$i<=$pages;$i++) {
$paginationblock.= ""._SITE_PAGE." $i | ";
}
$paginationblock.= "
";
//echo $paginationblock;
//pagination filter
if (isset($pn)){
$offset=($pn*$perpage)-$perpage;
$pagination="LIMIT $perpage OFFSET $offset";
}else{
$pagination="LIMIT $perpage";
}
//news by category
if ($cat>-1){
$query=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=$cat GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC $pagination");
}else{
$query=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC $pagination");
}
//news
//$newsresult=mysql_query("SELECT * FROM ".$dbprefix."news WHERE public=1 ORDER BY id DESC LIMIT 3");
if (mysql_num_rows($query)<1){
echo "\n"._SITE_NONEWSPOSTED."
"._SITE_CHECKBACKLATER."";
} else {
while($newsresultrow=mysql_fetch_array($query)){
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
echo "\n";
echo "\n";
$picture="";
$related="";
//related
//testing
$table="news";
$item=$newsresultrow[record2];
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='news' AND record1=$item AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
switch($table2){
case "files":
//check if picture
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$record2 AND public=1");
$fileresultrow=mysql_fetch_array($fileresult);
$type=$fileresultrow[type];
$file=$fileresultrow[file];
if ($type=="jpg"){
//get folder
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picture.= "
";
} else {
//not a picture
//$related.="
-> id $record2
";
}
break;
default:
//$related.="
-> id $record2
";
break;
}
} //related
echo "\n
$picture";
echo "
";
} //stories
echo "\n
";
}
break;
case "6":
//echo "gallery mode for folder $folder";
//PAGINATION
$perpage=9;
//pagination buttons
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."files WHERE type=\"jpg\" AND folderid=$folder AND public=1 ORDER BY id ASC ");
$totalrows=mysql_num_rows($pagequery);
$pages=ceil($totalrows/$perpage);
$paginationblock="";
$paginationblock.= "";
for( $i=1;$i<=$pages;$i++) {
$paginationblock.= ""._SITE_PAGE." $i | ";
}
$paginationblock.= "
";
//pagination filter
if (isset($pp)){
$offset=($pp*$perpage)-$perpage;
$pagination="LIMIT $perpage OFFSET $offset";
}else{
$pagination="LIMIT $perpage";
}
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE type=\"jpg\" AND folderid=$folder AND public=1 ORDER BY id ASC $pagination");
$i=0;
while($fileresultrow=mysql_fetch_array($fileresult)){
$file=$fileresultrow[file];
//$page=$i+$offset;
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
echo "\n";
echo "
";
echo "\n
";
} //thumbs
echo "\n
";
break;
case "7":
//echo "single picture id $file";
//PAGINATION
$perpage=1;
//pagination buttons
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."files WHERE type=\"jpg\" AND folderid=$folder AND public=1 ORDER BY id ASC ");
$totalrows=mysql_num_rows($pagequery);
//$totalrows2=mysql_fetch_array($pagequery);
$pages=ceil($totalrows/$perpage);
$paginationblock="";
$paginationblock.= "";
$i=1;
while ($totalrows3=mysql_fetch_array($pagequery)){
//text version
//$paginationblock.= ""._SITE_PICTURE." $i | ";
//thumbnail version
//$file=$totalrows3[id];
$folderid=$totalrows3[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$paginationblock.= "";
$i++;
}
$paginationblock.= "
";
echo "\n";
//pagination filter
if (isset($page)){
$offset=($page*$perpage)-$perpage;
$pagination="LIMIT $perpage OFFSET $offset";
}else{
$pagination="LIMIT $perpage";
}
$table="files";
$item=$file;
//echo "$table, $item";
$relatedinfo=GetRelated($table, $item);
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$file AND public=1 ");
$fileresultrow=mysql_fetch_array($fileresult);
$folderid=$fileresultrow[folderid];
$table="folders";
$relatedinfo.=GetRelated($table, $folderid);
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$file AND public=1 ");
while($fileresultrow=mysql_fetch_array($fileresult)){
$file=$fileresultrow[file];
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
echo "
";
} //thumbs
echo "\n
";
echo "\n
";
echo "$relatedinfo";
break;
case "8":
//thumbnails based on color
//PAGINATION
$perpage=9;
//pagination buttons
$pagequery=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='files' AND table2='colors' AND record2='$colorid' ORDER BY id ASC ");
$totalrows=mysql_num_rows($pagequery);
$pages=ceil($totalrows/$perpage);
$paginationblock="";
$paginationblock.= "";
for( $i=1;$i<=$pages;$i++) {
$paginationblock.= ""._SITE_PAGE." $i | ";
}
$paginationblock.= "
";
//pagination filter
if (isset($pp)){
$offset=($pp*$perpage)-$perpage;
$pagination="LIMIT $perpage OFFSET $offset";
}else{
$pagination="LIMIT $perpage";
}
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='files' AND table2='colors' AND record2='$colorid' AND public=1 ORDER BY id ASC $pagination");
while($fileresultrow=mysql_fetch_array($fileresult)){
$fileid=$fileresultrow[record1];
$picresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE type=\"jpg\" AND id='$fileid' AND public='1' ");
$picresultrow=mysql_fetch_array($picresult);
$file=$picresultrow[file];
$folderid=$picresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id='$folderid' AND public='1'");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
echo "\n";
echo "
";
echo "\n
";
} //thumbs
echo "\n
";
break;
default:
//news by category
//$query=mysql_query("SELECT * FROM ".$dbprefix."news WHERE public>0 ORDER BY id DESC LIMIT 5");
//while($newsresultrow=mysql_fetch_array($query)){
//latest 5 from categories 1,2,5,6
//$query=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND (".$dbprefix."binder.record1=1 OR ".$dbprefix."binder.record1=2 OR ".$dbprefix."binder.record1=5 OR ".$dbprefix."binder.record1=6 ) GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC LIMIT 5");
//latest 5 from category 0 = FRONTPAGE
$query=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=0 GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC LIMIT 5");
while($newsresultrow=mysql_fetch_array($query)){
#################################
echo "\n";
echo "\n";
$picture="";
$related="";
//related
//testing
$table="news";
$item=$newsresultrow[record2];
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='news' AND record1=$item AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
switch($table2){
case "files":
//check if picture
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$record2 AND public=1");
$fileresultrow=mysql_fetch_array($fileresult);
$type=$fileresultrow[type];
$file=$fileresultrow[file];
if ($type=="jpg"){
//get folder
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picture.= "
";
} else {
//not a picture
//$related.="
-> id $record2
";
}
break;
default:
//$related.="
-> id $record2
";
break;
}
} //related
//$relatedinfo=GetRelated($table, $item);
//$relatedinfo=GetRelated($table, $item);
//title
echo "
$newsresultrow[$titlelang]
";
//posted
echo "
";
echo "\n
$picture $newsresultrow[$commentlang]";
echo "\n
";
echo "\n
";
echo "
";
echo "";
} //stories
#################################
//echo "
";
//PictureStrip();
break;
}
echo $paginationblock;
echo ""; //end page right
break;
default:
echo "";
echo "";
//static page
//echo "news detail page";
//news by category
$query=mysql_query("SELECT * FROM ".$dbprefix."pages WHERE id=$page and public>0");
//news
//$newsresult=mysql_query("SELECT * FROM ".$dbprefix."news WHERE public=1 ORDER BY id DESC LIMIT 3");
while($newsresultrow=mysql_fetch_array($query)){
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
$textlang="text_".$dblang;
echo "\n";
echo "\n
";
$picture="";
$related="";
//related
//testing
$table="pages";
$item=$newsresultrow[id];
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='pages' AND record1=$item AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
switch($table2){
case "files":
//check if picture
$fileresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$record2 AND public=1");
$fileresultrow=mysql_fetch_array($fileresult);
$type=$fileresultrow[type];
$file=$fileresultrow[file];
if ($type=="jpg"){
//get folder
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picture.= "
";
} else {
//not a picture
//$related.="
-> id $record2
";
}
break;
default:
//$related.="
-> id $record2
";
break;
}
} //related
$relatedinfo=GetRelated($table, $item);
//title
//echo "
$newsresultrow[$titlelang]
";
echo "\n $picture";
echo "
$newsresultrow[$commentlang]$newsresultrow[$textlang]";
echo "\n
";
echo "
";
if ($relatedinfo<>NULL){
echo "
$relatedinfo
";
}
echo "
";
} //stories
echo "
";
break;
}
include("site_footer.php");
function GetRelated($table, $item){
global $dblang, $lang, $cat, $page, $mode, $news, $dbprefix, $folder, $colorid;
$titlelang="title_".$dblang;
$keywordlang="keyword_".$dblang;
$keywordlist="";
$colorslist="";
include("./php/include/folio_config.inc");
$related="";
$arraykey=0;
$level1 = array();
//first get one direction
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table1='$table' AND record1='$item' AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
//echo "$table2 $record2 | ";
//$level1[$table2]=$record2;
array_push($level1,array());
array_push($level1[$arraykey],array());
$level1[$arraykey][$table2]=$record2;
$arraykey++;
}
//then get other direction
$relatedresult=mysql_query("SELECT * FROM ".$dbprefix."binder WHERE table2='$table' AND record2='$item' AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table1=$relatedresultrow[table1];
$record1=$relatedresultrow[record1];
//$level1[$table1]=$record1;
array_push($level1,array());
array_push($level1[$arraykey],array());
$level1[$arraykey][$table1]=$record1;
$arraykey++;
//echo "$table1 $record1 | ";
}
/*
for($x = 0;$x < count($level1);$x++){
$related.=" -> id ".$level1[$x]."
";
//now one level deeper
//first get one direction
$relatedresult=mysql_query("SELECT * FROM binder WHERE table1='$table' AND record1='$item' AND public=1");
$level2=array();
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table2];
$record2=$relatedresultrow[record2];
$level2[]="$table2, $record2";
}
//then get other direction
$relatedresult=mysql_query("SELECT * FROM binder WHERE table2='$table' AND record2='$item' AND public=1");
while($relatedresultrow=mysql_fetch_array($relatedresult)){
$table2=$relatedresultrow[table1];
$record2=$relatedresultrow[record1];
$level2[]="$table2, $record2";
}
for($x = 0;$x < count($level2);$x++){
$related.=" -> id ".$level2[$x]."
";
}
*/
/* MULTI DIM ARRAY SAMPLE
*/
$b = count($level1);
$i=0;
while ($i < $b) {
//echo $level1[$i];
foreach($level1[$i] as $key=>$value){
//echo "$key $value | ";
//ytg pdf limitation
if ($key=="files"){
//check filetype
$typeresult=mysql_query("SELECT * FROM ".$dbprefix."files WHERE id=$value AND public=1");
if(@mysql_num_rows($typeresult)>0){
while($typeresultrow=mysql_fetch_array($typeresult)){
$type=$typeresultrow[type];
//if pdf
if ($type=="pdf"){
//get folder
$folderid=$typeresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
//give pdf download link
$related.=" $typeresultrow[file]
";
} //if pdf
} //get type
}
} //if file
if ($key=="links"){
$linkresult=mysql_query("SELECT * FROM ".$dbprefix."links WHERE id=$value AND public=1");
if(@mysql_num_rows($linkresult)>0){
$linkresultrow=mysql_fetch_array($linkresult);
$related.=" $linkresultrow[$titlelang]
";
}
}
if ($key=="folders"){
$folderresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$value AND public=1");
if(@mysql_num_rows($folderresult)>0){
$folderresultrow=mysql_fetch_array($folderresult);
$related.=" $folderresultrow[folder] $folderresultrow[$titlelang]
";
}
}
if ($key=="keywords"){
$keywordsresult=mysql_query("SELECT * FROM ".$dbprefix."keywords WHERE id=$value AND public=1");
if(@mysql_num_rows($keywordsresult)>0){
$keywordsresultrow=mysql_fetch_array($keywordsresult);
$keywordlist .=" | $keywordsresultrow[$keywordlang]";
}
}
if ($key=="news"){
$newsresult=mysql_query("SELECT * FROM ".$dbprefix."news WHERE id=$value AND public=1");
if(@mysql_num_rows($newsresult)>0){
$newsresultrow=mysql_fetch_array($newsresult);
$related.=" "._SITE_READMOREINNEWS." $newsresultrow[$titlelang]
";
}
}
if ($key=="colors"){
$colorsresult=mysql_query("SELECT * FROM ".$dbprefix."colors WHERE id=$value AND public=1");
if(@mysql_num_rows($colorsresult)>0){
$colorsresultrow=mysql_fetch_array($colorsresult);
$hex=$colorsresultrow[hex];
$colorslist .=" | ";
}
}
//show category link when not same category or in single news item view
if (($key=="categories") AND (($value<>$cat) || ($mode==2))){
//if (($key=="categories") AND ($value<>$cat)){
if ($value>0) {
$categoryresult=mysql_query("SELECT * FROM ".$dbprefix."categories WHERE id=$value AND public=1");
if(@mysql_num_rows($categoryresult)>0){
$categoryresultrow=mysql_fetch_array($categoryresult);
//$related.=" $categoryresultrow[$titlelang]
";
$related.=" "._SITE_READMOREINCATEGORY." $categoryresultrow[$titlelang]
";
}
} else {
$related.=" "._SITE_CHECKFRONTPAGE."
";
}
}
//$related.=" -> id ".$value."
";
} //for each
$i++;
} //while
if ($keywordlist<>""){
$related.=""._SITE_MOREFROMKEYWORD." $keywordlist
";
}
$colorslist.="
";
$related.=$colorslist;
return $related;
}
function CategoriesMenu(){
global $dblang, $lang, $cat, $page, $mode, $news;
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
$textlang="text_".$dblang;
$dbprefix="folio_";
require ("./php/include/connect_db.php");
mysql_select_db($DBname, $link) or die("couldn't select database");
$result=mysql_query("SELECT * FROM ".$dbprefix."categories ORDER BY id ASC");
echo "";
}
function LanguageMenu(){
global $dblang, $lang, $cat, $page, $mode, $news;
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
$textlang="text_".$dblang;
$lang=$_GET['lang'];
$cat=$_GET['cat'];
$page=$_GET['page'];
$mode=$_GET['mode'];
$news=$_GET['news'];
if ((!isset($cat)) || ($cat==NULL)){$cat=1;}
if ((!isset($page)) || ($page==NULL)){$page=1;}
if ((!isset($lang)) || ($lang==NULL)){$lang=1;}
//if ((!isset($mode)) || ($mode==NULL)){$mode=3;}
//choose language block
echo "";
if ($lang=="1"){
//echo "
English";
echo "
日本語";
//echo "
";
}else{
echo "
English";
//echo "
日本語";
//echo "
";
}
echo "
"; //end languagebar
}
function PagesMenu(){
global $dblang, $lang, $cat, $page, $theme;
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
$textlang="text_".$dblang;
$dbprefix="folio_";
require ("./php/include/connect_db.php");
mysql_select_db($DBname, $link) or die("couldn't select database");
$result=mysql_query("SELECT * FROM ".$dbprefix."pages ORDER BY id DESC");
echo "";
}
function FormPost(){
$type=$_POST['type'];
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$comment=$_POST['comment'];
$newsletter=$_POST['newsletter'];
if ($name == "" || $email == "" || substr_count($email, "@") == "0")
{
echo "\n";
echo "";
exit;
};
if ($newsletter=="on"){
$newslettervalue="yes";
} else {
$newslettervalue="no";
}
$message= "INFO REQUEST FROM $name \n type: $type \n e-mail: $email \n phone: $phone \n comment: $comment \n newsletter: $newslettervalue \n ";
$subject = "website contact form reply type: $type";
$headers .= "From: ".$name." <".$email.">\r\n";
$to="info@johanrooms.com";
mail($to, $subject, $message, $headers);
echo "\nPOSTED
Your request has been sent.
";
//echo "Your request has been sent.\n";
//echo $message;
}
function NewsOverview(){
global $dblang, $lang, $cat, $page, $mode, $news;
$titlelang="title_".$dblang;
$commentlang="comment_".$dblang;
$textlang="text_".$dblang;
$dbprefix="folio_";
require ("./php/include/connect_db.php");
mysql_select_db($DBname, $link) or die("couldn't select database");
$overviewresult=mysql_query("SELECT * FROM ".$dbprefix."categories ORDER BY id ASC");
echo "
| all:
";
//category list
while($overviewresultrow=mysql_fetch_array($overviewresult)){
//echo "";
$titlelang="title_".$dblang;
if ($overviewresultrow[id]<>0){ //if not frontpage
echo "
|
$overviewresultrow[$titlelang]:
";
//last 3 headlines
$thiscat=$overviewresultrow[id];
$overviewquery=mysql_query("SELECT * FROM ".$dbprefix."news RIGHT JOIN ".$dbprefix."binder ON (".$dbprefix."news.id=".$dbprefix."binder.record2) WHERE ".$dbprefix."news.public>0 AND ".$dbprefix."binder.public>0 AND ".$dbprefix."binder.table1='categories' AND ".$dbprefix."binder.record1=$thiscat GROUP BY ".$dbprefix."news.id ORDER BY ".$dbprefix."news.posted DESC $pagination LIMIT 4");
if (mysql_num_rows($overviewquery)<1){
echo "";
} else {
//echo "
";
}
//echo "
";
} //end frontpage exception
}
}
function FolioGuard(){
//manage user login
require_once("folioguard.php");
}
function PictureStrip(){
//600px
$dbprefix="folio_";
$picturestrip="";
require ("./php/include/connect_db.php");
mysql_select_db($DBname, $link) or die("couldn't select database");
$result=mysql_query("SELECT * FROM ".$dbprefix."files WHERE type=\"jpg\" AND public>0 ORDER BY RAND() LIMIT 12");
while($fileresultrow=mysql_fetch_array($result)){
$file=$fileresultrow[file];
$folderid=$fileresultrow[folderid];
$pictureresult=mysql_query("SELECT * FROM ".$dbprefix."folders WHERE id=$folderid AND public=1");
$pictureresultrow=mysql_fetch_array($pictureresult);
$thisfolder=$pictureresultrow[folder];
$picturestrip.= "";
}
echo $picturestrip;
}
?>