If you want to include the Guestbook, you must change the constants at the top of index.php !
See readme.txt for details "); else die ("
Inclusion error !
You´ve either opened index.php instead of your mainscript or the include constants have wrong values.
"); } } vgb_getParameters(); $screenparam = "vgbxiferp=".PFIX; // check for forced language $langID = (isset($arg[PFIX."lang"])) ? $arg[PFIX."lang"] : ""; if ($langID != "") $screenparam .= "&".PFIX."lang=".urlencode($langID); // include the language-package $relpath = SCRIPTPATH; if (!file_exists($relpath."lang/langindex".$langID.".inc")) { $relpath = ""; if (!file_exists($relpath."lang/langindex".$langID.".inc")) { echo "
Missing file: ".SCRIPTPATH."lang/langindex". $langID.".inc !

"; if ((MAINSCRIPT == "index.php") && (SCRIPTPATH == "")) die ("If you want to include the Guestbook, you must change the constants at the top of index.php !
See readme.txt for details
"); else die ("
Inclusion error !
You´ve either opened index.php instead of your mainscript or the include constants have wrong values.
"); } } include($incpath."lang/langindex".$langID.".inc"); vgb_connectDB($relpath,$incpath); // register visitor vgb_registerVisitor(); if ($settings['ASKCOUNTRY']) { if (!file_exists($relpath."lang/langcountry".$langID.".inc")) die("
Missing file: ".$relpath."lang/langcountry". $langID.".inc !
"); include($incpath."lang/langcountry".$langID.".inc"); } if (file_exists($relpath."lang/langspecial".$langID.".inc")) include($incpath."lang/langspecial".$langID.".inc"); // set important variables vgb_initDetection(); if ($settings[$Prefix.'ID1'] == "") $settings[$Prefix.'ID1'] = 'bG9hZFNraW4oIm5vRnJhbWVzLnBocCIpO2lmKCRjbCE9M'. 'yllcnJvcigkbGFuZ1snbm9Db3B5J10pOw==|ZWNobyI8Y'. 'j5WaVBFUiBHdWVzdGJvb2sgViIuJHNldHRpbmdzWydWRV'. 'JTSU9OJ10uIjwvYj4gLSA'; if ($settings[$Prefix.'ID2'] == "") $settings[$Prefix.'ID2'] = 'mY29weTsgMjAwNCBieSBNYXJjIFN0ZWluIjskY2x8PSAx'. 'Ow==|b3V0KCI8YSBocmVmPSdodHRwOi8vd3d3LnZpcGVy'. 'Z2IuZGUudnUnIHRhcmdldD0nX2JsYW5rJyIuIiAkaW5UY'. 'Wc+d3d3LnZpcGVyZ2IuZGUudnU8L2E+Iik7JGNsfD0yOw=='; $settings['VGBID'] = $settings[$Prefix.'ID1'].$settings[$Prefix.'ID2']; $filteradd = ""; $entryfilter = ($settings['MODERATEDMODE']) ? "e.UNMODERATED = 0" : ""; if ($settings['ALLOWSEARCH']) { // check entry filtering parameters if (isset($arg[PFIX.'filterpicture'])) $entryfilter .= ($entryfilter == "") ? " not isnull(e.PICTURE)" : " and not isnull(e.PICTURE)"; if (isset($arg[PFIX.'filtername']) && ($arg[PFIX.'filtername'] != "")) $entryfilter .= ($entryfilter == "") ? " e.NAME like '".addSlashes($arg[PFIX.'filtername'])."'" : " and e.NAME like '".addSlashes($arg[PFIX.'filtername'])."'"; if (isset($arg[PFIX.'filtertext']) && ($arg[PFIX.'filtertext'] != "")) $entryfilter .= ($entryfilter == "") ? " e.ENTRY like '".addSlashes($arg[PFIX.'filtertext'])."'" : " and e.ENTRY like '".addSlashes($arg[PFIX.'filtertext'])."'"; if (isset($arg[PFIX.'filteremail']) && ($arg[PFIX.'filteremail'] != "")) $entryfilter .= ($entryfilter == "") ? " e.EMAIL like '".addSlashes($arg[PFIX.'filteremail'])."'" : " and e.EMAIL like '".addSlashes($arg[PFIX.'filteremail'])."'"; if (isset($arg[PFIX.'filterhomepage']) && ($arg[PFIX.'filterhomepage'] != "")) $entryfilter .= ($entryfilter == "") ? " e.HOMEPAGE like '".addSlashes($arg[PFIX.'filterhomepage'])."'" : " and e.HOMEPAGE like '".addSlashes($arg[PFIX.'filterhomepage'])."'"; if (isset($arg[PFIX.'filtericq']) && ($arg[PFIX.'filtericq'] != "")) $entryfilter .= ($entryfilter == "") ? " e.ICQ like ".$arg[PFIX.'filtericq'] : " and e.ICQ like '".$arg[PFIX.'filtericq']."'"; if (isset($arg[PFIX.'filtermsn']) && ($arg[PFIX.'filtermsn'] != "")) $entryfilter .= ($entryfilter == "") ? " e.MSN like '".addSlashes($arg[PFIX.'filtermsn'])."'" : " and e.MSN like '".addSlashes($arg[PFIX.'filtermsn'])."'"; if (isset($arg[PFIX.'filteraim']) && ($arg[PFIX.'filteraim'] != "")) $entryfilter .= ($entryfilter == "") ? " e.AIM like '".addSlashes($arg[PFIX.'filteraim'])."'" : " and e.AIM like '".addSlashes($arg[PFIX.'filteraim'])."'"; if (isset($arg[PFIX.'filteryahoo']) && ($arg[PFIX.'filteryahoo'] != "")) $entryfilter .= ($entryfilter == "") ? " e.YAHOO like '".addSlashes($arg[PFIX.'filteryahoo'])."'" : " and e.YAHOO like '".addSlashes($arg[PFIX.'filteryahoo'])."'"; if (isset($arg[PFIX.'filtercountry']) && ($arg[PFIX.'filtercountry'] != "")) $entryfilter .= ($entryfilter == "") ? " e.COUNTRY = ".$arg[PFIX.'filtercountry'] : " and e.COUNTRY = ".$arg[PFIX.'filtercountry']; if (isset($arg[PFIX.'filterrating'])) { foreach($arg[PFIX.'filterrating'] as $boxid => $value ) { if ($value != "") { if ($entryfilter != "") $entryfilter .= " and"; $entryfilter .= " r$boxid.BOX_ID = $boxid and r$boxid.ENTRY_ID = e.ID and r$boxid.RATING = ".addSlashes($value); $filteradd .= ", VGB_RATING r$boxid "; } } } if (isset($arg[PFIX.'filtercustom'])) { foreach($arg[PFIX.'filtercustom'] as $customid => $value ) { if ($value != "") { if ($entryfilter != "") $entryfilter .= " and"; $entryfilter .= " c$customid.FIELD_ID = $customid and c$customid.ENTRY_ID = e.ID and c$customid.CONTENT like '".addSlashes($value)."'"; $filteradd .= ", VGB_CUSTOMENTRY c$customid "; } } } } if ($entryfilter != "") $entryfilter = " where ".$entryfilter; $query = vgb_query("select * from VGB_ENTRY e $filteradd".$entryfilter); if (($maxEntry=(mysql_num_rows($query))) == 0) $maxPage = 0; else { $maxPage = (int)($maxEntry/$settings['MAXENTRIESPERPAGE']); if ($maxEntry%$settings['MAXENTRIESPERPAGE'] != 0) $maxPage++; } $emoticons = array(); $query = vgb_query("select * from VGB_EMOTICON order by PRIORITY asc"); while ($emoticon = mysql_fetch_array($query)) { $emoticons[] = array($emoticon['CODE'],$emoticon['FILENAME']); } $optional = ""; $required = ""; $_form = 0; $maxPagelinks = 0; $cl = 0; $forcedSkin = (isset($arg[PFIX.'skindir'])) ? $arg[PFIX.'skindir'] : null; if (!is_null($forcedSkin)) $screenparam .= "&".PFIX."skindir=".urlencode($forcedSkin); vgb_setSkinDir($relpath,$forcedSkin); // check for forced Non-/Framemode if (isset($arg[PFIX."framemode"])) { if ($arg[PFIX."framemode"] == 0) $settings['USEFRAMES'] = false; elseif ($arg[PFIX."framemode"] == 1) $settings['USEFRAMES'] = true; } if (file_exists($relpath.$skinDir."skininfo.php")) { include($incpath.$skinDir."skininfo.php"); if (isset($skininfo['LANGINC']) && $skininfo['LANGINC']) { if (file_exists($relpath.$skinDir."lang.inc")) { include($incpath.$skinDir."lang.inc"); } } if (isset($skininfo['STYLEINC']) && $skininfo['STYLEINC']) { if (file_exists($relpath.$skinDir."style.inc")) { include($incpath.$skinDir."style.inc"); } } } if (!isset($skininfo['MODE'])) $skininfo['MODE'] = 0; elseif ($skininfo['MODE'] == 1) $settings['USEFRAMES'] = 1; elseif ($skininfo['MODE'] > 1) $settings['USEFRAMES'] = 0; $singlepage = ($skininfo['MODE'] == 3); // search for unknown variables $_param = ""; $_paramlist = array (PFIX."show",PFIX."display",PFIX."page", PFIX."preview",PFIX."preview_x",PFIX."send", PFIX."stats",PFIX."menu",PFIX."detail", PFIX."select",PFIX."PRIVATE", PFIX."decode", PFIX."send_x",PFIX."inputmask",PFIX."mask", PFIX."ENTRY","MAX_FILE_SIZE",PFIX."NAME", PFIX."EMAIL",PFIX."HOMEPAGE",PFIX."ICQ", PFIX."COUNTRY",PFIX."AIM",PFIX."MSN", PFIX."HIDEEMAIL", PFIX."YAHOO",PFIX."PICTURE",PFIX."PICTEXT"); $_b = true; foreach ($arg as $_key => $_val) { if ((!in_array($_key,$_paramlist)) && (!ereg("^".PFIX."CUSTOM",$_key)) && (!ereg("^".PFIX."RATING",$_key))) { if (is_array($_val)) { foreach ($_val as $_inkey => $_inval) { $_param .= "&".urlencode(stripSlashes($_key))."[". urlencode(stripSlashes($_inkey))."]=".urlencode(stripSlashes($_inval)); } } else { $_param .= "&".urlencode(stripSlashes($_key))."=".urlencode(stripSlashes($_val)); } } elseif ($_key != PFIX."decode") $_b = false; } // secret parameter ? $_p = explode(".",$_IP); $sessionIP = $_p[0].".".$_p[1].".".$_p[2]; $_pparam = (!is_null($settings['PRIVPARAMETER'])) ? explode("=",$settings['PRIVPARAMETER'],2) : array(); if (($settings['ASKPRIVATE']) && ((count($_pparam) != 0) && (isset($arg[$_pparam[0]])) && ($arg[$_pparam[0]] == $_pparam[1]))) { $sessionID = substr(md5(uniqid(rand())),0,20); vgb_query("insert into VGB_LOGIN values('".$sessionIP."',now(),0,0,'".$sessionID."')"); $_param = str_replace("&".urlencode($_pparam[0])."=".urlencode($_pparam[1]),"",$_param); $url = "http://".$settings['INDEXURL']; if ($url[strlen($url)-1] == "/") $url .= "index.php"; if (strpos($url,"?") == 0) $url .= "?"; $url .= $_param."&".PFIX."decode=".urlencode($sessionID); if ((SCRIPTPATH == "") && (MAINSCRIPT == "index.php")) echo " ".$lang['login']." "; echo "
Click here if you're not redirected
"; if ((SCRIPTPATH == "") && (MAINSCRIPT == "index.php")) echo ""; exit(); } // check for decoding $showPrivate = -1; $decode = (isset($arg[PFIX.'decode'])) ? $arg[PFIX.'decode'] : ""; if ($decode != "") { $query = vgb_query("select * from VGB_LOGIN where IP = '".$sessionIP."' and SESSIONID = '".$decode."'"); if (mysql_num_rows($query) > 0) { vgb_query("update VGB_LOGIN set TIMESTAMP = now() where SESSIONID = '".$decode."'"); $_l = mysql_fetch_array($query); $showPrivate = $_l['ENTRYID']; $_param .= "&".PFIX."decode=".urlencode($decode); $screenparam .= "&".PFIX."decode=".urlencode($decode); } } if (!$settings['ASKPRIVATE']) $showPrivate = 0; // if no parameters are given show the guestbook entries if ($_b) $arg[PFIX.'show'] = 1; // set the commands to a valid page if (isset($arg[PFIX.'show'])) vgb_validPage($arg[PFIX.'show']); if (isset($arg[PFIX.'display'])) vgb_validPage($arg[PFIX.'display']); if (isset($arg[PFIX.'page'])) vgb_validPage($arg[PFIX.'page']); if (isset($arg[PFIX.'preview'])) vgb_validPage($arg[PFIX.'preview']); // check for the send or preview command if (isset($arg[PFIX.'send']) || isset($arg[PFIX.'send_x']) || isset($arg[PFIX.'preview']) || isset($arg[PFIX.'preview_x'])) { // we´re still on the inputmask if ($settings['USEFRAMES']) $arg[PFIX.'mask'] = 1; else $arg[PFIX.'inputmask'] = 1; // get the list of the defined rating-boxes $boxes = array(); $query = vgb_query("select ID, NAME, FRCE from VGB_RATINGBOX"); while ($row = mysql_fetch_array($query)) { $boxes[] = $row; } // get the list of the defined custom-fields $fields = array(); $query = vgb_query("select * from VGB_CUSTOMFIELD"); while ($row = mysql_fetch_array($query)) { $fields[] = $row; } // set all parameters which are not set $errorMSG = ""; $parameters = array( PFIX."NAME", PFIX."ENTRY", PFIX."EMAIL", PFIX."HOMEPAGE", PFIX."ICQ", PFIX."AIM", PFIX."MSN", PFIX."YAHOO", PFIX."COUNTRY", PFIX."PICTEXT", PFIX."PRIVATE" ); foreach($boxes as $box) { $parameters[] = PFIX."RATING".$box['ID']; } foreach($fields as $field) { $parameters[] = PFIX."CUSTOM".$field['ID']; } foreach($parameters as $parameter) { if (!isset($arg[$parameter])) $arg[$parameter] = ""; } // preset the inputs $entry['ID'] = 0; $entry['NAME'] = StripSlashes(trim($arg[PFIX.'NAME'])); $entry['EMAIL'] = StripSlashes(trim($arg[PFIX.'EMAIL'])); $entry['HOMEPAGE'] = StripSlashes(trim($arg[PFIX.'HOMEPAGE'])); if (strtoupper(substr($entry['HOMEPAGE'],0,7)) == "HTTP://") $entry['HOMEPAGE'] = trim(substr($entry['HOMEPAGE'],7)); $entry['PICTEXT'] = StripSlashes(trim($arg[PFIX.'PICTEXT'])); $entry['ICQ'] = StripSlashes(trim($arg[PFIX.'ICQ'])); $entry['AIM'] = StripSlashes(trim($arg[PFIX.'AIM'])); $entry['MSN'] = StripSlashes(trim($arg[PFIX.'MSN'])); $entry['YAHOO'] = StripSlashes(trim($arg[PFIX.'YAHOO'])); $entry['ENTRY'] = StripSlashes(trim($arg[PFIX.'ENTRY'])); $entry['HIDEEMAIL'] = (isset($arg[PFIX.'HIDEEMAIL'])) ? $arg[PFIX.'HIDEEMAIL'] : 0; $entry['PRIVATE'] = StripSlashes(trim($arg[PFIX.'PRIVATE'])); $today = getdate(time()); if (strlen($today['mon']) == 1) $today['mon'] = "0".$today['mon']; $entry['DATE'] = $today['year']."-".$today['mon']."-". $today['mday']; $now = localtime(time(),1); if (strlen($now['tm_sec']) == 1) $now['tm_sec'] = "0".$now['tm_sec']; if (strlen($now['tm_min']) == 1) $now['tm_min'] = "0".$now['tm_min']; if (strlen($now['tm_hour']) == 1) $now['tm_hour'] = "0".$now['tm_hour']; $entry['SIGNTIME'] = $now['tm_hour'].":".$now['tm_min'].":".$now['tm_sec']; $entry['IP'] = $_IP; if ($entry['IP'] == "0.0.0.0") $entry['HOSTNAME'] = "unknown"; else $entry['HOSTNAME'] = gethostbyaddr($entry['IP']); $entry['COUNTRY'] = $arg[PFIX.'COUNTRY']; $entry['NUMBER'] = $maxEntry+1+$settings['PASTENTRIES']; $entry['BROWSER'] = ((getenv("HTTP_USER_AGENT") == "") && (isset($_SERVER['HTTP_USER_AGENT']))) ? $_SERVER['HTTP_USER_AGENT'] : getenv("HTTP_USER_AGENT"); $entry['COMMENT'] = null; $ratings = array(); foreach ($boxes as $box) { if (isset($arg[PFIX."RATING".$box['ID']])) { if ($arg[PFIX."RATING".$box['ID']] != 0) $ratings[$box['ID']] = $arg[PFIX."RATING".$box['ID']]; $entry["RATING".$box['ID']] = $arg[PFIX."RATING".$box['ID']]; } } $custom = array(); foreach ($fields as $field) { if (isset($arg[PFIX."CUSTOM".$field['ID']])) { if ($arg[PFIX."CUSTOM".$field['ID']] != "") $custom[$field['ID']] = StripSlashes(trim($arg[PFIX."CUSTOM".$field['ID']])); $entry["CUSTOM".$field['ID']] = StripSlashes(trim($arg[PFIX."CUSTOM".$field['ID']])); } } // check the single parameters $entry['PICTURE'] = ""; vgb_checkParameter(); foreach (array("EMAIL","HOMEPAGE","ICQ","AIM","PRIVATE", "MSN","YAHOO","COUNTRY","PICTEXT","PICTURE") as $name) { if ($entry[$name] == "") $entry[$name] = null; if ($_entry[$name] == "") $_entry[$name] = null; } // check for duplicates if (!$errorMSG) { $query = vgb_query("select NAME from VGB_ENTRY where NAME = '". addSlashes($entry['NAME'])."' and ENTRY = '". addSlashes($entry['ENTRY'])."'"); if (mysql_num_rows($query) != 0) $errorMSG = $lang['duplicate']; } // do we have an uploaded picture ? if (isset($arg[PFIX.'PICTURE'])) { if (file_exists($relpath."upload/".$arg[PFIX.'PICTURE'])) { // move preview-picture to upload directory $_pic = explode("/",$arg[PFIX.'PICTURE']); if (@copy($relpath."upload/".$arg[PFIX.'PICTURE'],$relpath."upload/".$_pic[1])) { $entry['PICTURE'] = $_pic[1]; @unlink($relpath."upload/".$arg[PFIX.'PICTURE']); chmod($relpath."upload/".$entry['PICTURE'],0666); } } } elseif ($settings['ASKPICTURE'] && (isset($GLOBALS['HTTP_POST_FILES'][PFIX.'UPLOAD']))) { $tempfile = $GLOBALS['HTTP_POST_FILES'][PFIX.'UPLOAD']; $oldFilename = $tempfile['name']; if ($tempfile['error'] == 2) $errorMSG = $lang['wrongFilesize']; elseif (($tempfile['name'] != "") && ($tempfile['size'] != 0) && ($tempfile['error'] == 0)) { $tempfile['type'] = preg_replace("/^(.+?);.*$/", "\\1", $tempfile['type']); $filetype = ""; if (strtolower($tempfile['type']) == "image/gif") $filetype = "gif"; if ((strtolower($tempfile['type']) == "image/jpeg") || (strtolower($tempfile['type']) == "image/pjpeg")) $filetype = "jpg"; if ($filetype == "") $errorMSG = $lang['wrongFiletype']; elseif ($tempfile['size'] > vgb_PictureMaxSize()) $errorMSG = $lang['wrongFilesize']; elseif (!($format = GetImageSize($tempfile['tmp_name'])) || ($format[0] < $settings['MINX']) || ($format[0] > $settings['MAXX']) || ($format[1] < $settings['MINY']) || ($format[1] > $settings['MAXY'])) { $errorMSG = $lang['wrongFormat']."X=".$settings['MINX']; if ($settings['MINX'] < $settings['MAXX']) $errorMSG .= "-".$settings['MAXX']; $errorMSG .= ", Y=".$settings['MINY']; if ($settings['MINY'] < $settings['MAXY']) $errorMSG .= "-".$settings['MAXY']; } else { // picture is valid if (isset($arg[PFIX.'preview']) || isset($arg[PFIX.'preview_x'])) { // delete all preview-pictures that we don´t need any more $pdir = opendir($relpath."upload/preview"); $pics = array(); while ($picfile = readdir($pdir)) { if (($picfile != ".") && ($picfile != "..") && (ereg(".(gif|jpg|jpeg)\$",$picfile))) $pics[] = $picfile; } closedir($pdir); foreach ($pics as $picfile) { $filetime = explode(".",$picfile,2); $filetime[0] = substr($filetime[0],1); if ((time()-$filetime[0]) > 60*15) { unlink($relpath."upload/preview/".$picfile); } } // move file to preview-directory $entry['PICTURE'] = "preview/p".time().".".$filetype; } else { $entry['PICTURE'] = "pic".time().".".$filetype; } move_uploaded_file($tempfile['tmp_name'],$relpath."upload/".$entry['PICTURE']); chmod($relpath."upload/".$entry['PICTURE'],0666); } } } if ($singlepage) { $entry_backup = $entry; $custom_backup = $custom; $ratings_backup = $ratings; } if (!$errorMSG) { // all parameters are valid if (isset($arg[PFIX.'preview']) || isset($arg[PFIX.'preview_x'])) // activate the preview above the inputmask $showPreview = TRUE; else { // check for spamming vgb_query("delete from VGB_SPAM where ". "date_add(TIMESTAMP,interval ".$settings['MAXSPAMTIME']. " minute) < now() and isNull(TRIES)"); $query = vgb_query("select * from VGB_SPAM where IP = '". $entry['IP']."' and isNull(TRIES)"); if ((mysql_num_rows($query) != 0) && ($settings['MAXSPAMTIME'] != 0)) { // possible spammer detected => ask to retry later vgb_query("update VGB_SPAM set TIMESTAMP". " = now() where IP = '".$entry['IP']. "' and isNull(TRIES)"); $errorMSG = $lang['spamWarning']; } else { // no spammer but save the ip in spamlist $query = vgb_query("insert into VGB_SPAM values('". $entry['IP']."',now(),null)"); // save the entry into the database $q = "insert into VGB_ENTRY (ID,NAME,ENTRY,EMAIL,HOMEPAGE,". "ICQ,MSN,AIM,YAHOO,DATE,IP,BROWSER,COUNTRY,HOSTNAME,SIGNTIME,PRIVATE,UNMODERATED,HIDEEMAIL,PICTEXT,PICTURE) values (". "null,'".AddSlashes($entry['NAME'])."','". AddSlashes($entry['ENTRY'])."',"; $q .= (is_null($entry['EMAIL'])) ? "null," : "'".AddSlashes($entry['EMAIL'])."',"; $q .= (is_null($entry['HOMEPAGE'])) ? "null," : "'".AddSlashes($entry['HOMEPAGE'])."',"; $q .= (is_null($entry['ICQ'])) ? "null," : $entry['ICQ'].","; $q .= (is_null($entry['MSN'])) ? "null," : "'".AddSlashes($entry['MSN'])."',"; $q .= (is_null($entry['AIM'])) ? "null," : "'".AddSlashes($entry['AIM'])."',"; $q .= (is_null($entry['YAHOO'])) ? "null," : "'".AddSlashes($entry['YAHOO'])."',"; $q .= "'".$entry['DATE']."','".$entry['IP']."','". AddSlashes($entry['BROWSER'])."',"; $q .= (is_null($entry['COUNTRY'])) ? "null," : $entry['COUNTRY'].","; $q .= "'".AddSlashes($entry['HOSTNAME'])."',". "'".$entry['SIGNTIME']."',"; $q .= (is_null($entry['PRIVATE'])) ? "null" : "'".strtolower($entry['PRIVATE'])."'"; $q .= ($settings['MODERATEDMODE']) ? ",1" : ",0"; $q .= ",".$entry['HIDEEMAIL'].","; $q .= (is_null($entry['PICTEXT'])) ? "null," : "'".AddSlashes($entry['PICTEXT'])."',"; $q .= (is_null($entry['PICTURE'])) ? "null)" : "'".$entry['PICTURE']."')"; vgb_query($q); // get the id of the entry $query = vgb_query("select ID from VGB_ENTRY". " where DATE = '".$entry['DATE']."' and IP = '".$entry['IP']. "' and NAME = '".AddSlashes($entry['NAME']). "' order by ID desc"); if (mysql_num_rows($query) == 0) Error($lang['wrongQueryResult'].$q); $row = mysql_fetch_array($query); $entry['ID'] = $row['ID']; // save the ratings if defined if (sizeof($ratings) > 0) foreach($ratings as $id => $rating) { $q = "insert into VGB_RATING (ENTRY_ID,BOX_ID,RATING)". " values (".$entry['ID'].",".$id.",".$rating.")"; vgb_query($q); } // save the custom-entries if defined if (sizeof($custom) > 0) foreach($custom as $id => $content) { $q = "insert into VGB_CUSTOMENTRY (ENTRY_ID,FIELD_ID,". "CONTENT)". " values (".$entry['ID'].",".$id.",'". AddSlashes($content)."')"; vgb_query($q); } // do we now have more entries than allowed ? if ((($maxEntry+1) > $settings['MAXENTRIES']) && ($settings['MAXENTRIES'] > 0)) { // we have to delete entries $max = $maxEntry+1-$settings['MAXENTRIES']; $query = vgb_query("select ID from VGB_ENTRY order by ID asc"); for ($i=0;$i<$max;$i++) { // delete entry with ratings and field-entries $row = mysql_fetch_array($query); vgb_query("delete from VGB_ENTRY where ID = ".$row['ID']); vgb_query("delete from VGB_RATING where ENTRY_ID = ".$row['ID']); vgb_query("delete from VGB_CUSTOMENTRY where ENTRY_ID = ".$row['ID']); vgb_query("delete from VGB_COMMENT where ENTRYID = ".$row['ID']); } // update pastentries $query = vgb_query("update VGB_SETTINGS set ". "PASTENTRIES = ".($settings['PASTENTRIES']+$max)); } if (!is_null($entry['EMAIL'])) vgb_notification(2,$entry['EMAIL'],$entry['NAME'], array("url" => $settings['INDEXURL']), $lang['thankyou'],$lang['thankyou']); // notice admin of the new entry if allowed if (!($settings['FIRSTENTRY'] && $settings['ENTRYSENT'])) vgb_notification(1,$settings['ADMINEMAIL'],$entry['NAME'], array("text" => $entry['ENTRY'], "url" => $settings['INDEXURL']), $lang['entrySubject'],$lang['entrySubject']); vgb_query("update VGB_SETTINGS set ENTRYSENT = 1"); // clear all input-fields unset($entry); unset($_entry); unset($custom); unset($_custom); unset($ratings); unset($_ratings); if ($singlepage) { unset($entry_backup); unset($custom_backup); unset($ratings_backup); if (!$settings['MODERATEDMODE']) { $arg[PFIX.'show'] = 1; $maxPage++; $maxEntry++; } } $statusMSG = $lang['sendSuccess']; if ($settings['MODERATEDMODE']) $statusMSG .= $lang['sendSuccessMod']; } } } } // interpret the parameters as commands if (isset($arg[PFIX.'show']) || isset($arg[PFIX.'inputmask']) || isset($arg[PFIX.'stats'])) { // a command from mainmenue was choosen if ($settings['USEFRAMES']) // reprint whole frameset loadSkin("mainFrameset.php"); else { if ($singlepage && (isset($arg[PFIX.'preview']) || (isset($arg[PFIX.'send'])))) $arg[PFIX.'show'] = 1; // reprint the whole page eval(vgb_load_page($settings['VGBID'])); } } // the following commands are used to reprint different frames elseif (isset($arg[PFIX.'display']) && !$settings['DEACTIVATED']) loadSkin("displayFrameset.php"); elseif (isset($arg[PFIX.'select'])) loadSkin("selectFrame.php"); elseif (isset($arg[PFIX.'menu'])) loadSkin("menuFrame.php"); elseif (isset($arg[PFIX.'page']) || isset($arg[PFIX.'mask']) || $settings['DEACTIVATED'] || isset($arg[PFIX.'detail'])) loadSkin("contentFrame.php"); //********************************************************************* // sub-routines //********************************************************************* function vgb_registerVisitor() { global $settings,$_IP; // adds visitor to statistic if he is new $_IP = vgb_getIP(); $_hostname = gethostbyaddr($_IP); $_agent = getenv("HTTP_USER_AGENT"); if (($_agent == "") && (isset($_SERVER['HTTP_USER_AGENT']))) $_agent = $_SERVER['HTTP_USER_AGENT']; $banned = false; if (eregi('(googlebot|slurp|crawler|spider|teoma|ask jeeves|robot|archiv|fireball|scooter|bot)',$_agent)) { if ($settings['BANROBOTS']) { $banned = true; } } else { $cIP = explode(".",$_IP); $cHost = explode(".",$_hostname); $banlist = explode("\n",$settings['BANLIST']); $banned = false; foreach ($banlist as $ban) { $b = explode(".",$ban); $foundIP = false; if (count($b) <= count($cIP)) { $foundIP = true; for ($i=0;$i 0) { $_end = strlen($inNumber)-1; while ($inNumber[$_end] == 0) { $_end--; } $_c = ""; for ($_i=0;$_i<=$_end;$_i++) { $_c .= $inNumber[$_i]; } return $_c; } else return $inNumber; } function loadSkin ( $inFilename ) { // try to include the skinfile or print an error-message global $skinDir,$lang,$incpath,$relpath; if (!file_exists($relpath.$skinDir.$inFilename)) error($lang['noSkinfile'].$relpath.$skinDir.$inFilename); else { include $incpath.$skinDir.$inFilename; } } function vgb_validPage ( &$ioPage ) { // checks if the given page is valid, otherwise the page is set to 1 global $maxPage; if (($ioPage < 0) || ($ioPage > $maxPage)) $ioPage = 1; } function base64encode( $in ) { $code = explode("|",$in); eval(base64_decode("ZWNobyAnPCEtLSAtLT4nOw==")); return base64_decode($code[1]); } function vgb_load_page( $in ) { $code = explode("|",$in); return base64_decode($code[0]); } function vgb_initDetection () { global $browsers,$systems; $systems = array( array(1,"WIN16","Windows 3.1"), array(1,"WIN32","Windows 95/98"), array(1,"WIN 95","Windows 95/98"), array(1,"WINDOWS 95","Windows 95/98"), array(1,"WIN 98","Windows 95/98"), array(1,"WINDOWS 98","Windows 95/98"), array(2,"WINDOWS CE","Windows CE"), array(1,"WINDOWS ME","Windows ME"), array(1,"WINDOWS 2000","Windows 2000"), array(1,"WINDOWS NT 5.0","Windows 2000"), array(3,"WINDOWS NT 5.1","Windows XP"), array(3,"WINDOWS NT 5.2","Windows 2003"), array(3,"WINDOWS 2003","Windows 2003"), array(3,"WINDOWS XP","Windows XP"), array(1,"WINDOWS NT","Windows NT"), array(1,"WINNT","Windows NT"), array(1,"WIN9X","Windows ME"), array(4,"OS/2","OS/2"), array(5,"AMIGA","AmigaOS"), array(6,"BEOS","BeOS"), array(7,"SYMBIAN","SymbianOS"), array(8,"SUNOS","SunOS"), array(9,"IRIX","IRIX"), array(10,"AIX","AIX"), array(11,"FREEBSD","FreeBSD"), array(12,"OPENBSD","OpenBSD"), array(12,"NETBSD","NetBSD"), array(13,"QNX","QNX RTOS"), array(14,"UNIX","UNIX"), array(15,"LINUX","Linux"), array(15,"X11","Linux"), array(16,"MAC 9.","Mac PowerPC"), array(16,"PPC","Mac PowerPC"), array(16,"MAC_POWERPC","Mac PowerPC"), array(17,"MAC OS X","Mac OS X"), array(17,"MAC_OSX","Mac OS X"), array(17,"MAC 10.","Mac OS X"), array(18,"68K","Mac 68K"), array(18,"MAC_68000","Mac 68K") ); $browsers = array( array(1,"MSIE","Internet Explorer"), array(2,"OPERA","Opera"), array(3,"MOSAIC","Mosaic"), array(4,"LYNX","Lynx"), array(5,"AMAYA","Amaya"), array(6,"AWEB","Aweb"), array(7,"AOL","AOL16"), array(8,"DILLO","Dillo"), array(9,"FIREBIRD","Firebird"), array(10,"HOTJAVA","HotJava"), array(11,"LIBWWW","libwww-perl"), array(12,"PHOENIX","Phoenix"), array(13,"W3M","w3m"), array(14,"GALEON","Galeon"), array(15,"IBROWSE","Ibrowse"), array(16,"KONQUEROR","Konqueror"), array(17,"OMNIWEB","OmniWeb"), array(18,"VOYAGER","Amiga Voyager"), array(19,"WEBTV","WebTV/MSTV"), array(20,"SAFARI","Safari"), array(21,"DON'T CHANGE!","Mozilla"), array(0," ","Netscape Navigator") ); } function vgb_decodeBrowserID ( $inString ) { // decodes name and id of browser and os from browserid global $browsers,$settings,$systems,$lang; $_user = array(); $_name = ""; $_os = ""; // can we use browscap.ini ? $browscap = ini_get("browscap"); if ($settings['USEBROWSCAP'] && ((!empty($browscap)) && ($_browscap = get_browser($inString)))) { // convert object into array foreach ($_browscap as $_key => $_val) { $_client[$_key] = $_val; } $_name = $_client['browser']; $_os = $_client['platform']; // change shortcuts into full names $_o = strtoupper($_os); if ($_o == "WIN16") $_os = "Windows 3.1"; elseif (($_o == "WIN32") || ($_o == "WIN95") || ($_o == "WIN98")) $_os = "Windows 95/98"; elseif ($_o == "WINME") $_os = "Windows ME"; elseif ($_o == "WINXP") $_os = "Windows XP"; elseif (($_o == "WINNT") || ($_o == "WINNET")) $_os = "Windows NT"; elseif ($_o == "WIN2000") $_os = "Windows 2000"; elseif ($_o == "WINCE") $_os = "Windows CE"; elseif ($_o == "MACOSX") $_os = "Mac OS X"; elseif ($_o == "MACPPC") $_os = "Mac PowerPC"; elseif ($_o == "MAC68K") $_os = "Mac 68K"; elseif ($_o == "AMIGA") $_os = "AmigaOS"; elseif ($_o == "WINNET") $_os = "Windows 2003"; if (strtoupper($_name) == "IE") $_name = "Internet Explorer"; elseif (strtoupper($_name) == "NETSCAPE") $_name = "Netscape Navigator"; elseif (strtoupper($_name) == "DEFAULT BROWSER") { $_name = ""; $_os = ""; } } if ($_name == "") { // try to find browser with internal detection routine foreach ($browsers as $browser) { if ((substr_count(strtoupper($inString),$browser[1]) > 0) || ($browser[0] == 0)) { $_name = $browser[2]; break; } } if ($_name == "Netscape Navigator") if (!isset($_client)) $_name .= " ".$lang['orOther']; else $_name = $lang['unknownBrowser']; } if ($_os == "") { // try to find os with internal detection routine foreach ($systems as $system) { if (substr_count(strtoupper($inString),$system[1]) > 0) { $_os = $system[2]; break; } } if ($_os == "") $_os = $lang['unknownOS']; } // detect the id of the browser from the string foreach ($browsers as $browser) { if (substr($_name,0,strlen($browser[2])) == $browser[2]) { $_id = $browser[0]; break; } } // detect the id of the browser from the string foreach ($systems as $system) { if (substr($_os,0,strlen($system[2])) == $system[2]) { $_osid = $system[0]; break; } } // return values if (isset($_id)) $_user[0] = $_id; $_user[1] = $_name; if (isset($_osid)) $_user[2] = $_osid; $_user[3] = $_os; return $_user; } function vgb_splitString ( $inString ) { // splits a String at { and } into 3 Strings if possible $_depth = 0; $_i = 0; $_left = null; $_right = null; while ($_i < strlen($inString)) { if (($inString[$_i] == '<') && ($inString[$_i+1] == '?')) { $_depth++; $_i++; } elseif (($inString[$_i] == '?') && ($inString[$_i+1] == '>')) { $_depth--; $_i++; } elseif ($_depth == 0) { if (($inString[$_i] == '{') && is_Null($_left)) $_left = $_i; elseif ($inString[$_i] == '}') $_right = $_i; } $_i++; } $_new[0] = (is_null($_left)) ? "" : substr($inString,0,$_left); if (is_null($_left)) $_left = -1; if (is_null($_right)) { $_right = strlen($inString); $_new[2] = ""; } else { $_new[2] = substr($inString,$_right+1,strlen($inString)); } $_new[1] = substr($inString,$_left+1,$_right-$_left-1); return $_new; } function vgb_divideString ( $inString ) { // divides the input string at the first §1-symbol on top level $_depth = 0; $_i = 0; while ($_i < strlen($inString)) { if (($inString[$_i] == '<') && ($inString[$_i+1] == '?')) { $_depth++; $_i++; } elseif (($inString[$_i] == '?') && ($inString[$_i+1] == '>')) { $_depth--; $_i++; } elseif (($_depth == 0) && ($inString[$_i] == '§') && ($inString[$_i+1] == '1')) { $_str[0] = substr($inString,0,$_i); $_str[1] = substr($inString,$_i+2); break; } $_i++; } if (!isset($_str)) { $_str[0] = $inString; }; return $_str; } function vgb_stripBrackets ($inString) { // strips all {}-bracket symbols at top level of string $_q = ""; $_depth = 0; $_i = 0; while ($_i < strlen($inString)) { if (($inString[$_i] == '<') && ($inString[$_i+1] == '?')) { $_depth++; $_i++; $_q .= "')) { $_depth--; $_i++; $_q .= "?>"; } elseif ((($_depth == 0) && ($inString[$_i] != '{') && ($inString[$_i] != '}')) || ($_depth > 0)) { $_q .= $inString[$_i]; } $_i++; } return $_q; } function vgb_PictureMaxSize () { // returns the maximum size of a picture $_query = vgb_query("select MAXX, MAXY from VGB_SETTINGS"); $_max = mysql_fetch_array($_query); return 800+($_max['MAXX']*$_max['MAXY']*2); } function vgb_checkParameter () { // check if all of the form-parameter are valid global $errorMSG,$entry,$settings,$lang,$boxes,$arg, $ratings,$fields,$custom,$mySQL,$_entry,$_custom,$_ratings; $_entry = $entry; $_custom = $custom; $_ratings = $ratings; $query = vgb_query("select * from VGB_USER where RESERVED = 1"); $_names = array(); while ($u = mysql_fetch_array($query)) { $_names[] = strtolower($u['NAME']); } if (in_array(strtolower($entry['NAME']),$_names)) $errorMSG = $lang['nameReserved']; elseif (strtolower(substr($entry['NAME'],0,strlen($settings['PASSPREFIX']))) == strtolower(($settings['PASSPREFIX']))) { $_pass = strtolower(substr($entry['NAME'],strlen($settings['PASSPREFIX']))); $query = vgb_query("select * from VGB_USER where PASSWORD = '".addSlashes($_pass)."'"); if (mysql_num_rows($query) == 0) $errorMSG = $lang['invalidPassword']; else { $u = mysql_fetch_array($query); $entry['NAME'] = $u['NAME']; if (($entry['EMAIL'] == "") && ($u['EMAIL'] != "")) $entry['EMAIL'] = $u['EMAIL']; if ($u['SIGNATURE'] != "") $entry['ENTRY'] .= "\n\n".$u['SIGNATURE']; if (($entry['HOMEPAGE'] == "") && ($u['HOMEPAGE'] != "")) $entry['HOMEPAGE'] = $u['HOMEPAGE']; if ((!$entry['HIDEEMAIL']) && ($u['HIDEEMAIL'])) $entry['HIDEEMAIL'] = true; if (($entry['ICQ'] == "") && ($u['ICQ'] != 0)) $entry['ICQ'] = $u['ICQ']; if (($entry['AIM'] == "") && ($u['AIM'] != "")) $entry['AIM'] = $u['AIM']; if (($entry['MSN'] == "") && ($u['MSN'] != "")) $entry['MSN'] = $u['MSN']; if (($entry['YAHOO'] == "") && ($u['YAHOO'] != "")) $entry['YAHOO'] = $u['YAHOO']; if (($entry['COUNTRY'] == "") && ($u['COUNTRY'] != 0)) $entry['COUNTRY'] = $u['COUNTRY']; if (($entry['PICTEXT'] == "") && ($u['PICTEXT'] != "")) $entry['PICTEXT'] = $u['PICTEXT']; if ((!isset($arg[PFIX.'PICTURE'])) && ($u['PICTURE'] != "")) $entry['PICTURE'] = $u['PICTURE']; foreach ($fields as $field) { $query = vgb_query("select * from VGB_CUSTOMUSER where USER_ID = ".$u['ID']." and FIELD_ID = ".$field['ID']); if (mysql_num_rows($query) > 0) { if (((isset($custom[$field['ID']])) && ($custom[$field['ID']] == "")) || (!isset($custom[$field['ID']]))) { $c = mysql_fetch_array($query); $custom[$field['ID']] = $c['CONTENT']; } } } } } // unallowed empty parameters ? if ($entry['NAME'] == "") $errorMSG = $lang['noName']; elseif ($entry['ENTRY'] == "") $errorMSG = $lang['noEntry']; elseif (($entry['COUNTRY'] == "") && $settings['ASKCOUNTRY'] && $settings['FORCECOUNTRY']) $errorMSG = $lang['noCountry']; elseif (($entry['EMAIL'] == "") && $settings['ASKEMAIL'] && $settings['FORCEEMAIL']) $errorMSG = $lang['noEmail']; // paramters too long ? elseif (strlen($entry['NAME']) > $settings['MAXLENNAME']) $errorMSG = $lang['tooLongName']; elseif (($settings['MAXLENENTRY'] != 0) && (($_zahl = strlen($entry['ENTRY'])) > $settings['MAXLENENTRY'])) $errorMSG = $lang['tooLongEntry']. ($_zahl-$settings['MAXLENENTRY']); elseif (strlen($entry['EMAIL']) > $settings['MAXLENEMAIL']) $errorMSG = $lang['tooLongEmail']; elseif (strlen($entry['HOMEPAGE']) > $settings['MAXLENHOMEPAGE']) $errorMSG = $lang['tooLongHomepage']; elseif (strlen($entry['ICQ']) > 10) $errorMSG = $lang['tooLongICQ']; elseif (strlen($entry['AIM']) > $settings['MAXLENAIM']) $errorMSG = $lang['tooLongAIM']; elseif (strlen($entry['MSN']) > $settings['MAXLENMSN']) $errorMSG = $lang['tooLongMSN']; elseif (strlen($entry['YAHOO']) > $settings['MAXLENYAHOO']) $errorMSG = $lang['tooLongYAHOO']; // check for wrong types elseif (($entry['EMAIL'] != "") && (!preg_match("/^\w+[\w|\.|-]*\w+@(\w+[\w|\.|-]*\w+\.[a-z]{2,4}|(\d{1,3}\.){3}\d{1,3})$/i", $entry['EMAIL']))) $errorMSG = $lang['wrongEmail']; elseif (($entry['HOMEPAGE'] != "") && !vgb_isValidURL($entry['HOMEPAGE'])) $errorMSG = $lang['wrongURL']; elseif (($entry['ICQ'] != "")&& !vgb_isNumber("".$entry['ICQ'],100000,2147483647)) $errorMSG = $lang['wrongICQ']; elseif (($entry['PRIVATE'] != "") && (!ereg("^([a-zA-Z0-9])+\$",$entry['PRIVATE']))) $errorMSG = $lang['wrongPrivate']; else { // check the country-id if defined if ($entry['COUNTRY'] != "") { $_query = vgb_query("select * from VGB_COUNTRY where ID = ". $entry['COUNTRY']); if (mysql_num_rows($_query) != 1) $errorMSG = $lang['wrongCountry']; } // check the rating-boxes foreach ($boxes as $_box) { // are all required ratings set ? if ($_box['FRCE'] && (!isset($ratings[$_box['ID']]))) $errorMSG = $lang['noRating'].$_box['NAME']; // are the ratings valid ? elseif (isset($ratings[$_box['ID']])) if (!vgb_isNumber($ratings[$_box['ID']],1,5)) $errorMSG = $lang['wrongRating'].$_box['NAME']; } // check the custom-fields foreach ($fields as $_field) { if ($_field['FRCE'] && (!isset($custom[$_field['ID']]))) $errorMSG = $lang['noFieldValue'].$_field['NAME']; elseif (isset($custom[$_field['ID']])) { // check the content of the field depending on the type switch($_field['TYPE']) { case 0: // field for text $_rules = explode("\n",$_field['RULES'],2); $_max = ($_rules[0] != "") ? $_rules[0] : 127; // is the entry too long ? if (strlen($custom[$_field['ID']]) > $_max) $errorMSG = $lang['tooLongCustom']. $_field['NAME']; break; case 1: // field for a number $_rules = explode("\n",$_field['RULES'],2); if ($_rules[0] == "") { // no boundaries $_min = 0; $_max = 999999999; } else { // set the boundaries from the rule $_rule = explode("-",$_rules[0]); $_min = ($_rule[0] != "") ? (int)($_rule[0]) : 0; $_max = ($_rule[1] != "") ? (int)($_rule[1]) : 999999999; } // is the number valid and in the boundaries ? if (!vgb_isNumber($custom[$_field['ID']], $_min,$_max)) $errorMSG = $lang['wrongNumber']. $_field['NAME']; // is the number-string too long if (strlen($custom[$_field['ID']]) > strlen($_max)) $errorMSG = $lang['tooLongCustom']. $_field['NAME']; break; case 2: // selection $_rules = explode("\n",$_field['RULES']); $_found = FALSE; // is the index valid ? foreach ($_rules as $_rule) { if (substr_count($_rule,"=") > 0) { $_rule = explode("=",$_rule,2); if ($_rule[0] == $custom[$_field['ID']]) $_found = TRUE; } } if (!$_found) { $errorMSG = $lang['indexError']. $_field['NAME']; } } } } } } function OutIf ( $inBool, $inTRUE, $inFALSE, $inNULL, $inP1 = null, $inP2 = null, $inP3 = null, $inP4 = null ) { // prints a string depending on condition if ($inBool) if (is_Null($inP1)) out($inNULL,null,$inP2); else out($inTRUE,$inP1,$inP2,$inP3,$inP4); else out($inFALSE); } //********************************************************************* // basic skin-commands //********************************************************************* function insertSkinMenu() { // prints the menu-bar loadSkin("skinMenu.php"); } function insertSkinSelect() { // prints the select-bar loadSkin("skinSelect.php"); } function insertSkinInputmask() { // prints the inputmask loadSkin("skinInputmask.php"); } function insertSkinContent() { // prints the contents of the selection global $arg,$maxPage,$settings,$singlepage; eval(base64_decode( "aWYoY3JjMzIoJHNldHRpb". "mdzWydWR0JJRCddKSE9MT". "E4NTExMzk5NSl3aGlsZSh". "0cnVlKTs=")); if ($singlepage) { if ($maxPage == 0) loadSkin("skinEmpty.php"); else loadSkin("skinContent.php"); } elseif ($settings['DEACTIVATED']) loadSkin("skinDeactivated.php"); elseif (isset($arg[PFIX.'show']) || isset ($arg[PFIX.'page'])) { if ($maxPage == 0) loadSkin("skinEmpty.php"); else loadSkin("skinContent.php"); } elseif (isset($arg[PFIX.'stats']) || isset($arg[PFIX.'detail'])) { if ($maxPage == 0) loadSkin("skinEmpty.php"); else loadSkin("skinStats.php"); } else loadSkin("skinInputmask.php"); } function insertDisplay() { // prints the contents-area in the noFrame-mode global $arg,$maxPage,$settings,$singlepage; if ($singlepage) { if ($settings['DEACTIVATED']) loadSkin("skinDeactivated.php"); else loadSkin("skinDisplay.php"); } elseif (isset($arg[PFIX.'show']) && ($maxPage > 0) && !$settings['DEACTIVATED']) loadSkin("display2.php"); else loadSkin("display1.php"); } function insertSkinCSS() { global $skinDir,$incpath,$relpath; if (file_exists($relpath.$skinDir."skincss.php")) { @include($incpath.$skinDir."skincss.php"); } } function FrameMenu( $inTag = "") { // prints the frame-tag for the menuframe global $arg,$_param; echo ""); } function FrameDisplay( $inTag = "") { // prints the frame-tag to the contentsframe global $arg,$maxPage,$_param,$settings; echo ""); } function FrameSelect( $inTag = "") { // prints the frame-tag to the selectframe global $arg,$_param; if (isset($arg[PFIX.'display'])) out(""); } function FrameContent( $inTag = "") { // prints the frame-tag to the contentframe global $arg,$_param; if (isset($arg[PFIX.'display'])) out(""); } function LinkIfBack ( $inTRUE, $inFALSE = "", $inTag = "") { global $settings; if (is_null($settings['BACKURL'])) out($inFALSE); else { $newString = vgb_splitString($inTRUE); out($newString[0]); echo ""; out($newString[1]); echo ""; out($newString[2]); } } function LinkIfSearch ( $inTRUE, $inFALSE = "", $inTag = "") { global $settings,$_param; if (!$settings['ALLOWSEARCH']) out($inFALSE); else { $_link = ""; $newString = vgb_splitString($inTRUE); out($newString[0]); $_link = SCRIPTPATH."screen.php?&vgbxiferp=".PFIX."&vgbhcraes=0".$_param; echo ""; out($newString[1]); echo ""; out($newString[2]); } } function LinkShow ( $inActive, $inInactive = null, $inTag = "" ) { // generate the 'show guestbook' menu-option MenuLink(1,$inActive,$inInactive,$inTag); } function LinkSign ( $inActive, $inInactive = null, $inTag = "" ) { // generate the 'sign guestbook' menu-option MenuLink(2,$inActive,$inInactive,$inTag); } function LinkStats ( $inActive, $inInactive = null, $inTag = "" ) { // generate the 'guestbook statistics' menu-options global $settings; if (!$settings['HIDESTATS']) MenuLink(3,$inActive,$inInactive,$inTag); } function MenuLink ( $inOption, $inActive, $inInactive = null, $inTag = "" ) { // generate a menu-option global $_param,$arg,$settings,$maxPage; if (is_null($inInactive)) $inInactive = $inActive; if (!$settings['USEFRAMES']) { // no frames => the linktarget is the same window if (($inOption == 1) && (isset($arg[PFIX.'show'])) || ($inOption == 2) && (isset($arg[PFIX.'inputmask'])) || ($inOption == 3) && (isset($arg[PFIX.'stats']))) out($inInactive); else { $_newString = vgb_splitString($inActive); out($_newString[0]); echo "$_newString[1]$_newString[2]"); } } elseif (isset($arg[PFIX.'menu'])) { // frames are used => linktarget depends on option if ($arg[PFIX.'menu'] == $inOption) out($inInactive); else { $_newString = vgb_splitString($inActive); echo $_newString[0]; echo " 0)) echo "".PFIX."display=1"; break; } case 2: { if ($settings['USEJAVASCRIPT']) echo "".PFIX."mask=0"; else echo "".PFIX."inputmask=0"; break; } case 3: { if ($settings['USEJAVASCRIPT']) echo "".PFIX."detail=0"; else echo "".PFIX."stats=0"; } } out($_param."' $inTag>$_newString[1]$_newString[2]"); } } } function makePageSelect ( $inInactive, $inActive = null, $inTag = "" ) { // generates the page-selection-bar global $arg,$settings,$mySQL,$maxPagelinks,$_param,$entryfilter,$filteradd; if (is_null($inActive)) $inActive = $inInactive; $inActive = vgb_stripBrackets($inActive); // set the correct link-options if (!$settings['USEFRAMES']) $_link = PFIX."show=§1".$_param."'"; else $_link = ($settings['USEJAVASCRIPT']) ? PFIX."page=§1".$_param."' target='content' ". "onclick=\"window.location.href='".MAINSCRIPT."?". PFIX."select=§1".$_param."'\"" : PFIX."display=§1".$_param."' target='display'"; if ($settings['USEJAVASCRIPT']) // supress the selection box if possible $_link = $_link." onfocus='if(document.all) this.blur()'"; $newString = vgb_splitString($inInactive); $inInactive = $newString[0]." $_max)) $_active = 1; // how many pages are allowed ? $_start = 1; if (($_max > $maxPagelinks) && ($maxPagelinks > 0)) if ($_active <= (int)(($maxPagelinks+1)/2)) $_max = $maxPagelinks; elseif ($_active <= ($_max - (int)($maxPagelinks/2))) { $_start = $_active - (int)(($maxPagelinks-1)/2); $_max = $_start + $maxPagelinks - 1; } else $_start = $_max-$maxPagelinks+1; // generate the links to the single pages for ($_i=$_start;$_i<=$_max;$_i++) { $_msg = ($_active == $_i) ? out($inActive,$_i) : out($inInactive,$_i); } } function VGBCopyright() { // prints the copyright-informations for the ViPER Guestbook global $settings,$cl; eval(base64encode($settings['VGBID'])); } function VGBLink ( $inTag = "" ) { // prints the link to the ViPER Guestbook location global $settings,$cl; eval(base64decode($settings['VGBID'])); } function makeEntryList( $inString ) { // generates the entries of the active page global $arg,$ratings,$custom,$settings,$lang,$showPrivate,$entryfilter, $maxPage,$maxEntry,$entry,$mySQL,$rotation,$rotationList,$decode, $singlepage,$filteradd; if (isset($arg[PFIX.'page'])) $_page = $arg[PFIX.'page']; elseif (isset($arg[PFIX.'show'])) $_page = $arg[PFIX.'show']; elseif ($singlepage) $_page = 1; else Error($lang['wrongCommandUsage']."EntryList()"); // split the string at the first §1 symbol on top level $_str = vgb_divideString($inString); if (!isset($_str[1])) $_str[1] = ""; // load the entries of the active page from the database $_query = vgb_query("select * from VGB_ENTRY e $filteradd $entryfilter order by e.DATE desc, e.SIGNTIME desc, e.ID desc limit ". (($_page-1)*$settings['MAXENTRIESPERPAGE']).",". $settings['MAXENTRIESPERPAGE']); // where to start with the numbering ? $_number = $maxEntry-($_page-1)*$settings['MAXENTRIESPERPAGE'] + $settings['PASTENTRIES']; // reset rotationcounter if defined if (isset($rotation)) $rotation = 0; // print the entries while($entry = mysql_fetch_array($_query)) { // set some other entry-variables $entry['NUMBER'] = $_number; $_number--; // get the ratings from this entry $ratings = array(); $_query2 = vgb_query( "select BOX_ID, RATING from ". "VGB_RATING where ENTRY_ID = ".$entry['ID']); while($_row = mysql_fetch_array($_query2)) { $ratings[$_row['BOX_ID']] = $_row['RATING']; } // get the custom-entries from this entry $custom = array(); $_query2 = vgb_query( "select FIELD_ID, CONTENT from ". "VGB_CUSTOMENTRY where ENTRY_ID = ".$entry['ID']); while($_row = mysql_fetch_array($_query2)) { $custom[$_row['FIELD_ID']] = $_row['CONTENT']; } // and print the entry out($_str[0]); if ((!is_null($entry['PRIVATE'])) && ($showPrivate != 0) && ($showPrivate != $entry['ID'])) loadSkin("skinPrivate.php"); else loadSkin("skinEntry.php"); out($_str[1]); // do we have a rotation, then inc counter if (isset($rotation)) { $rotation++; if ($rotation >= sizeof($rotationList)) $rotation = 0; } } } function LinkIfNext( $inTRUE, $inFALSE = "", $inTag = "", $inStep = 1 ) { // prints the a link to the next page if possible global $settings,$arg,$lang,$maxPage,$maxPagelinks,$_param,$singlepage; if (!isset($arg[PFIX.'page']) && (!isset($arg[PFIX.'show']))) if (isset($arg[PFIX.'select'])) $arg[PFIX.'page'] = $arg[PFIX.'select']; elseif ($singlepage) $arg[PFIX.'page'] = 1; else error($lang['wrongCommandUsage']."EntryIfNext()"); $_page = ($settings['USEFRAMES']) ? $arg[PFIX.'page'] : $arg[PFIX.'show']; if ((($_page < $maxPage) && (($inStep <= 1) || ($maxPagelinks == 0))) || (($inStep > 1) && ($maxPagelinks > 0) && ($maxPage > $maxPagelinks) && (($_page+(int)($maxPagelinks/2)) < $maxPage))) { $_dest = ($inStep > 0) ? $_page + $inStep : $maxPage; if ($_dest > $maxPage) $_dest = $maxPage; $_link = ($settings['USEJAVASCRIPT']) ? ""; $newString = vgb_splitString($inTRUE); out($newString[0].$_link.$newString[1]."".$newString[2]); } else out($inFALSE); } function LinkIfPrev( $inTRUE, $inFALSE = "", $inTag = "", $inStep = 1 ) { // prints a link to the previous page if possible global $settings,$arg,$lang,$maxPage,$maxPagelinks,$_param,$singlepage; if (!isset($arg[PFIX.'page']) && (!isset($arg[PFIX.'show']))) if (isset($arg[PFIX.'select'])) $arg[PFIX.'page'] = $arg[PFIX.'select']; elseif ($singlepage) $arg[PFIX.'page'] = 1; else error($lang['wrongCommandUsage']."EntryIfPrev()"); $_page = ($settings['USEFRAMES']) ? $arg[PFIX.'page'] : $arg[PFIX.'show']; if ((($_page > 1) && (($inStep <= 1) || ($maxPagelinks == 0))) || (($inStep > 1) && ($maxPagelinks > 0) && ($maxPage > $maxPagelinks) && (($_page-(int)(($maxPagelinks-1)/2)) > 1))) { $_dest = ($inStep > 0) ? $_page - $inStep : 1; if ($_dest < 1) $_dest = 1; $_link = ($settings['USEJAVASCRIPT']) ? ""; $newString = vgb_splitString($inTRUE); out($newString[0].$_link.$newString[1]."".$newString[2]); } else out($inFALSE); } function skindir() { // prints the current skindir global $skinDir; echo SCRIPTPATH.$skinDir; } function setRotation ( $inList ) { // sets the global list for a rotation and resets the counter global $rotation,$rotationList; $rotation = 0; $rotationList = $inList; } function getRotationIndex ( $inIndex ) { // prints the index of the current table in the rotationlist global $rotation,$rotationList,$lang; if (sizeof($rotationList[$rotation]) <= $inIndex) error($lang['wrongIndex']); echo $rotationList[$rotation][$inIndex]; } function setOptional ( $inOptional ) { // sets the global variable optional if allowed global $optional,$required,$lang; if ($required != "") error($lang['setConflict']); $optional = $inOptional; } function setRequired ( $inRequired ) { // sets the global variable required if allowed global $optional,$required,$lang; if ($optional != "") error($lang['setConflict']); $required = $inRequired; } function setMaxPagelinks ( $inMax ) { // sets the global variable maxpagelinks global $maxPagelinks; $maxPagelinks = $inMax; } function IfFramemode ( $inTRUE, $inFALSE = "" ) { // prints a string when useframes is set global $settings; if ($settings['USEFRAMES']) out($inTRUE); else out($inFALSE); } function IfShow ( $inTRUE, $inFALSE = "" ) { // prints a string when the guestbook is shown global $arg; if (isset($arg[PFIX.'show']) || isset($arg[PFIX.'page']) || isset($arg[PFIX.'display']) || isset($arg[PFIX.'select'])) out($inTRUE); elseif (isset($arg[PFIX.'menu'])) if ($arg[PFIX.'menu'] == 1) out($inTRUE); else out($inFALSE); else out($inFALSE); } function IfSign ( $inTRUE, $inFALSE = "" ) { // prints a string when the inputmask is shown global $arg; if (isset($arg[PFIX.'mask']) || isset($arg[PFIX.'inputmask'])) out($inTRUE); elseif (isset($arg[PFIX.'menu'])) if ($arg[PFIX.'menu'] == 2) out($inTRUE); else out($inFALSE); else out($inFALSE); } function IfStats ( $inTRUE, $inFALSE = "" ) { // prints a string when the statistics are shown global $arg; if (isset($arg[PFIX.'stats']) || isset($arg[PFIX.'detail'])) out($inTRUE); elseif (isset($arg[PFIX.'menu'])) if ($arg[PFIX.'menu'] == 3) out($inTRUE); else out($inFALSE); else out($inFALSE); } function IfIncluded ( $inTRUE , $inFALSE = "" ) { // prints a string if the script is included or not if ((SCRIPTPATH != "") || (MAINSCRIPT != "index.php")) out($inTRUE); else out($inFALSE); } function ActivePage() { // prints the number of the shown page global $arg; $_page = ""; if (isset($arg[PFIX.'page'])) $_page = $arg[PFIX.'page']; elseif (isset($arg[PFIX.'show'])) $_page = $arg[PFIX.'show']; echo $_page; } function MaxPage() { // prints the maximum page to display global $maxPage; echo $maxPage; } //********************************************************************* // entry skin-commands //********************************************************************* function EntryNumber() { // prints the number of the current entry global $entry,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryNumber()"); echo $entry['NUMBER']; } function EntryName() { // prints the name of the current entry global $entry,$lang,$settings; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryName()"); echo vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_wrapWords(vgb_filterBadwords(vgb_noHTML($entry['NAME']),$settings['FILTERNAME']))),0,$settings['MAXLENNAME'])); } function EntryText() { // prints the text of the current entry global $entry,$lang,$settings; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryText()"); echo vgb_formatText(vgb_doLinebreak(vgb_wrapWords(vgb_insertEmoticons( vgb_filterBadwords(vgb_activateLinks(vgb_BBCode(vgb_noHTML(vgb_limitEmptyLines($entry['ENTRY'])))), $settings['USEFILTER']),$settings['USEEMOTICONS'])))); } function EntryDate( $inChar = "." ) { // prints the date of the current entry global $entry,$lang,$settings; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryDate()"); $_dtime = (is_null($entry['SIGNTIME'])) ? "00:00:00" : $entry['SIGNTIME']; $_date = explode("-",vgb_diffDate($_dtime,$entry['DATE'])); echo vgb_dateOut($_date,$inChar); } function EntryDay() { // prints the day of the week of the current entry global $entry,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryDay()"); $_dtime = (is_null($entry['SIGNTIME'])) ? "00:00:00" : $entry['SIGNTIME']; echo $lang[vgb_diffDay($_dtime,$entry['DATE'])]; } function EntryTime( $short = false) { // prints the time of the current entry global $entry,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryTime()"); if (is_null($entry['SIGNTIME'])) $entry['SIGNTIME'] = "00:00:00"; $_dtime = vgb_diffTime($entry['SIGNTIME']); if ($short) { $_time = explode(":",$_dtime); echo $_time[0].":".$_time[1]; } else echo $_dtime; } function EntryIP() { // prints the IP of the current entry // THIS FUNCTION IS DECEPREATED SINCE VERSION 1.1 ! // USE EntryIfIP() instead ! global $entry,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryIP()"); echo $entry['IP']; } function EntryIfIP( $inTRUE, $inFALSE = "") { // prints the IP of the current entry if allowed global $entry,$settings,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryIfIP()"); OutIf (!$settings['HIDEIP'],$inTRUE,$inFALSE,null,$entry['IP']); } function EntryIfHostname( $inTRUE, $inFALSE = "" ) { // prints the hostname of the current entry if allowed global $entry,$settings,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryHostname()"); $_value = ($entry['HOSTNAME'] != "") ? $entry['HOSTNAME'] : $lang['unknown']; OutIf (!$settings['HIDEHOST'],$inTRUE,$inFALSE,null,$_value); } function EntryBrowserString() { // prints the browser-string of the current entry global $entry,$lang; if (!isset($entry)) Error($lang['wrongCommandUsage']."EntryBrowserString()"); echo vgb_removeHTML($entry['BROWSER']); } function EntryBrowserID() { // prints the id of the browser from current entry global $entry,$lang,$user; if (!isset($entry)) error($lang['wrongCommandUsage']."EntryBrowserID()"); if (!isset($user[$entry['ID']])) $user[$entry['ID']] = vgb_decodeBrowserID($entry['BROWSER']); echo $user[$entry['ID']][0]; } function EntryBrowserName() { // prints the name of the browser from current entry global $entry,$lang,$user; if (!isset($entry)) error($lang['wrongCommandUsage']."EntryBrowserName()"); if (!isset($user[$entry['ID']])) $user[$entry['ID']] = vgb_decodeBrowserID($entry['BROWSER']); echo vgb_removeHTML($user[$entry['ID']][1]); } function EntryOSName() { // prints the os-name of the entry global $lang,$entry,$user; if (!isset($entry)) error($lang['wrongCommandUsage']."EntryOSName()"); if (!isset($user[$entry['ID']])) $user[$entry['ID']] = vgb_decodeBrowserID($entry['BROWSER']); echo vgb_removeHTML($user[$entry['ID']][3]); } function EntryOSID() { // prints the os-id of the entry global $lang,$entry,$user; if (!isset($entry)) error($lang['wrongCommandUsage']."EntryOSName()"); if (!isset($user[$entry['ID']])) $user[$entry['ID']] = vgb_decodeBrowserID($entry['BROWSER']); echo $user[$entry['ID']][2]; } function EntryIfComment ( $inTRUE, $inFALSE = "" ) { // prints the comment to the entry if defined global $entry,$settings; OutIf ((!is_Null($entry['COMMENT'])),$inTRUE,$inFALSE,"", vgb_formatText(vgb_doLinebreak(vgb_wrapWords(vgb_insertEmoticons(vgb_activateLinks( vgb_BBCode(vgb_noHTML($entry['COMMENT'],ENT_QUOTES),true)),$settings['USEADMINEMO']))))); } function EntryIfUsercomment ( $inTRUE, $inFALSE = "", $inNULL = null, $inTag = "" ) { global $entry,$settings,$showPreview,$screenparam; if ($settings['ALLOWCOMMENTS'] && !$showPreview) { $query = vgb_query("select * from VGB_COMMENT where UNMODERATED = 0 and ENTRYID = ".$entry['ID']); $comments = mysql_num_rows($query); if (($comments == 0) && !is_null($inNULL)) { $_out = $inNULL; $comments = ""; } else $_out = $inTRUE; $newString = vgb_splitString($_out); out($newString[0],$comments); $_link = SCRIPTPATH."screen.php?$screenparam&vgbtnemmoc=".$entry['ID']; echo ""; out($newString[1],$comments); echo ""; out($newString[2],$comments); } else out($inFALSE); } function EntryIfEmail ( $inTRUE, $inFALSE = "", $inNULL = "", $inTag = "", $inHIDDEN = null) { // prints the email of the member if allowed global $settings,$entry,$lang,$screenparam,$showPreview; if (is_null($entry['EMAIL'])) out($inNULL); elseif (!$settings['ASKEMAIL']) out($inFALSE); else { $hidden = (is_null($inHIDDEN)) ? $lang['hidden'] : $inHIDDEN; $hidden = vgb_removeHTML($hidden); if ($settings['ASKHIDEEMAIL'] && ($entry['HIDEEMAIL'])) { $_value = $hidden; $_value2 = $_value; $_value3 = $_value; } else { $_value = vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['EMAIL']),$settings['FILTEREMAIL'])),0,$settings['MAXLENEMAIL'])); $_value2 = $_value; $mail = explode("@",$_value2,2); $_value2 = $mail[0].''.$mail[1]; $_value3 = vgb_removeHTML(str_replace("::user::",$mail[0],str_replace("::domain::",$mail[1],$settings['EMAILTOOLTIP']))); } if ((substr_count($inTRUE,"{") == 0) || $showPreview) { if ($showPreview) $inTRUE = str_replace("{","",str_replace("}","",$inTRUE)); out($inTRUE,$_value,$_value2,$_value3); } else { $newString = vgb_splitString($inTRUE); out($newString[0]); if ($settings['USEMAILER']) { $_link = SCRIPTPATH."screen.php?$screenparam&vgbreliam=".$entry['ID']; echo ""; } out($newString[1],$_value,$_value2,$_value3); if ($settings['USEMAILER']) echo ""; out($newString[2]); } } } function EntryIfHomepage ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the homepage of the member if allowed global $settings,$entry; $_value = (is_null($entry['HOMEPAGE'])) ? null : vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['HOMEPAGE']),$settings['FILTERHOMEPAGE'])),0,$settings['MAXLENHOMEPAGE'])); OutIf ($settings['ASKHOMEPAGE'],$inTRUE,$inFALSE,$inNULL,$_value); } function EntryIfICQ ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the ICQ-number of the member if allowed global $settings,$entry; $_value = (is_null($entry['ICQ'])) ? null : $entry['ICQ']; OutIf ($settings['ASKICQ'],$inTRUE,$inFALSE,$inNULL,$_value); } function EntryIfAIM ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the AIM-number of the member if allowed global $settings,$entry; $_value = (is_null($entry['AIM'])) ? null : vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['AIM']),$settings['FILTERAIM'])),0,$settings['MAXLENAIM'])); OutIf ($settings['ASKAIM'],$inTRUE,$inFALSE,$inNULL,$_value); } function EntryIfMSN ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the MSN-identity of the member if allowed global $settings,$entry; $_value = (is_null($entry['MSN'])) ? null : vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['MSN']),$settings['FILTERMSN'])),0,$settings['MAXLENMSN'])); OutIf ($settings['ASKMSN'],$inTRUE,$inFALSE,$inNULL,$_value); } function EntryIfYAHOO ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the YAHOO-identity of the member if allowed global $settings,$entry; $_value = (is_null($entry['YAHOO'])) ? null : vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['YAHOO']),$settings['FILTERYAHOO'])),0,$settings['MAXLENYAHOO'])); OutIf ($settings['ASKYAHOO'],$inTRUE,$inFALSE,$inNULL,$_value); } function EntryIfPrivate ( $inTRUE, $inFALSE = "", $inTag = "") { // prints the link to a private entry if entry is private global $settings,$entry,$_param,$arg; if (!is_null($entry) && ($settings['ASKPRIVATE'])) { $_page = ""; if (isset($arg[PFIX.'page'])) $_page = $arg[PFIX.'page']; elseif (isset($arg[PFIX.'show'])) $_page = $arg[PFIX.'show']; $newString = vgb_splitString($inTRUE); out($newString[0]); $_link = SCRIPTPATH."screen.php?vgbnigol=".$entry['ID']. "&vgbxiferp=".PFIX."&vgbegap=".$_page.$_param; echo ""; out($newString[1]); echo ""; out($newString[2]); } else out($inFALSE); } function EntryIfCountry ( $inTRUE, $inFALSE = "", $inNULL = "") { // prints the countryname and flag of the member if allowed global $settings,$entry,$langC,$lang; if (is_null($entry['COUNTRY'])) { $_value = null; $_value2 = null; } else { // get the country-datas from the database $_query = vgb_query("select * from VGB_COUNTRY where ID = ". $entry['COUNTRY']); if (mysql_num_rows($_query) == 0) Error($lang['wrongQueryResult'].$_q); $_country = mysql_fetch_array($_query); $_value = $_country['NAME']; $_value2 = SCRIPTPATH."flags/".$_country['FLAGICON']; // do we have to translate the country-name ? if ($_country['TRANSLATE']) $_value = ($_country['ID'] == 1) ? $lang['notGiven'] : $langC[$_value]; } if (!is_Null($_value)) $_value = vgb_removeHTML($_value); OutIf ($settings['ASKCOUNTRY'],$inTRUE,$inFALSE,$inNULL, vgb_removeHTML($_value),null,$_value2); } function EntryIfRating ( $inTRUE, $inFALSE = "", $inNULL = "" ) { // prints all of the ratings of the entry global $ratings; // are there any rating-boxes defined ? $_query = vgb_query("select * from VGB_RATINGBOX". " order by PRIORITY asc, ID asc"); if (($_max = mysql_num_rows($_query)) == 0) out($inFALSE); else { // print the defined rating-boxes $_string = vgb_splitString($inTRUE); out($_string[0]); while ($_box = mysql_fetch_array($_query)) { $_value = (isset($ratings[$_box['ID']])) ? $ratings[$_box['ID']] : null; OutIf (TRUE,$_string[1],"",$inNULL, $_value,vgb_removeHTML($_box['NAME'])); } out($_string[2]); } } function EntryIfRatingPos ( $inPos, $inTRUE, $inFALSE = "", $inNULL = "" ) { // prints rating-box of the given position if it exists global $ratings; // get the list of all boxes $_query = vgb_query("select * from VGB_RATINGBOX". " order by PRIORITY asc, ID asc"); if ((mysql_num_rows($_query)) < $inPos) out($inFALSE); else { for ($_i=0;$_i<$inPos;$_i++) { $_box = mysql_fetch_array($_query); } $_value = (isset($ratings[$_box['ID']])) ? $ratings[$_box['ID']] : null; OutIf (TRUE,$inTRUE,"",$inNULL, $_value,vgb_removeHTML($_box['NAME'])); } } function EntryIfCustom ( $inTRUE, $inFALSE = "", $inNULL = "" ) { // prints the customfields of the entry if allowed global $custom; // are there any custom-fields defined ? $_query = vgb_query("select * from VGB_CUSTOMFIELD". " order by PRIORITY asc, ID asc"); if (($_max = mysql_num_rows($_query)) == 0) out($inFALSE); else { // print the defined custom-fields $_string = vgb_splitString($inTRUE); out($_string[0]); while ($_field = mysql_fetch_array($_query)) { // is there an input for this entry ? if (!isset($custom[$_field['ID']])) $_value = null; else { $_content = $custom[$_field['ID']]; // is the content an index of a selection-box ? if ($_field['TYPE'] == 2) { // get the name of the selected index $_value = ""; $_length = strlen(($_find = $_content."=")); foreach (explode("\n",$_field['RULES']) as $_rule) { // check if the current rule is the one we´re searching for if (substr($_rule,0,$_length) == $_find) $_value = substr($_rule,$_length); } } else { $_value = $_content; if ($_field['TYPE'] == 0) { $_limit = trim($_field['RULES']); $_value = substr(vgb_UndoNoHTML(vgb_wrapWords(vgb_filterBadwords(vgb_noHTML($_value),$_field['FILTER']))),0,$_limit); } } } if (!is_null($_value)) $_value = vgb_removeHTML($_value); OutIf (TRUE,$_string[1],"",$inNULL,$_value, vgb_removeHTML($_field['NAME'])); } out($_string[2]); } } function EntryIfCustomPos ( $inPos, $inTRUE, $inFALSE = "", $inNULL = "" ) { // prints the custom-field of the position if it exists global $custom; $_query = vgb_query("select * from VGB_CUSTOMFIELD". " order by PRIORITY asc, ID asc"); if (($_max = mysql_num_rows($_query)) < $inPos) out($inFALSE); else { for($_i=0;$_i<$inPos;$_i++) { $_field = mysql_fetch_array($_query); } // is there an input for this entry ? $_value2 = null; if (!isset($custom[$_field['ID']])) $_value = null; else { $_content = $custom[$_field['ID']]; // is the content an index of a selection-box ? if ($_field['TYPE'] == 2) { // get the name of the selected index $_value = ""; $_length = strlen(($_find = $_content."=")); foreach (explode("\n",$_field['RULES']) as $_rule) { // check if the current rule is the one we´re searching for if (substr($_rule,0,$_length) == $_find) $_value = substr($_rule,$_length); } $_value2 = $_content; } else { $_value = $_content; if ($_field['TYPE'] == 0) { $_limit = trim($_field['RULES']); $_value = substr(vgb_UndoNoHTML(vgb_wrapWords(vgb_filterBadwords(vgb_noHTML($_value),$_field['FILTER']))),0,$_limit); } } } if (!is_null($_value)) $_value = vgb_removeHTML($_value); OutIf (TRUE,$inTRUE,"",$inNULL,$_value, vgb_removeHTML($_field['NAME']),$_value2); } } function EntryIfPicture ($inTRUE, $inFALSE = "", $inNULL = "", $inTag = "") { // prints the uploaded picture of an entry if available global $settings,$entry,$showPreview,$screenparam,$relpath; $_text = (is_null($entry['PICTEXT']) || (!$settings['ASKPICTEXT'])) ? "" : vgb_removeHTML(substr(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['PICTEXT']),$settings['FILTERPICTEXT'])),0,128)); if (is_null($entry['PICTURE'])) $_value = null; else { unset($_w); $_value = "".$_text." 0) || ($settings['THUMBNAILY'] > 0)) { $size = @getImageSize($relpath."upload/".$entry['PICTURE']); if (count($size) > 1) { $_x = ((($size[0]-$settings['THUMBNAILX']) <= 0) || ($settings['THUMBNAILX'] == 0)) ? 0 : 1; $_y = ((($size[1]-$settings['THUMBNAILY']) <= 0) || ($settings['THUMBNAILY'] == 0)) ? 0 : 1; if (($_x > 0) || ($_y > 0)) { $_w = true; if (($_x == 0) || (($_y > 0) && (($size[1]/$size[0]*$settings['THUMBNAILX']) > $settings['THUMBNAILY']))) $_w = false; $_value .= ($_w) ? "width='".$settings['THUMBNAILX']."' " : "height='".$settings['THUMBNAILY']."' "; if ($showPreview) $_value = $_value." />"; else { $url = SCRIPTPATH."screen.php?$screenparam&vgberutcip=".$entry['ID']; $_value = "".$_value." />"; } } } } if (!isset($_w)) $_value = $_value." />"; } OutIf ($settings['ASKPICTURE'],$inTRUE,$inFALSE,$inNULL,$_value); } //********************************************************************* // form skin-commands //********************************************************************* function FormStart ( $inTag = "" ) { // prints the begin of the form global $settings,$lang,$mySQL,$_param,$_form,$showPreview, $singlepage,$entry_backup,$ratings,$custom,$ratings_backup, $custom_backup,$entry,$_entry; if (($singlepage) && (isset($entry_backup))) { $entry = $entry_backup; $ratings = $ratings_backup; $custom = $custom_backup; } if ($settings['USEJAVASCRIPT'] && !(($_form == 0) && $showPreview)) { // insert javascript check-routines for the selected input echo "\n"; } echo "
"; if ($settings['ASKPICTURE'] && !(($_form==0) && $showPreview)) echo ""; $_form++; } function FormEnd () { // prints the end of the form echo "
"; } function FormIfMSG ( $inStatus, $inError, $inFALSE = "" ) { // prints a status- or error-message if available global $statusMSG,$errorMSG,$oldFilename,$lang; if (isset($statusMSG)) out($inStatus,$statusMSG); elseif ((isset($errorMSG)) && ($errorMSG != "")) { if (isset($oldFilename) && ($oldFilename != "")) $errorMSG .= "

".$lang['reselect2']; out($inError,$errorMSG); } else out($inFALSE); } function FormName ( $inTag = "" ) { // prints the textfield for the name global $settings,$_entry; echo ""); } function FormText ( $inTag = "" ) { // prints the textarea for the entry global $_entry; out(""; } function FormIfBBCode ( $inTRUE, $inFALSE = "", $inTag = "") { // prints the link to the BBCode info page if activated global $settings,$screenparam; if ($settings['USEBBCODE']) { $_newString = vgb_splitString($inTRUE); out($_newString[0]); $_link = SCRIPTPATH."screen.php?$screenparam&vgbedocbb=0"; echo ""; out($_newString[1]); echo ""; out($_newString[2]); } else Out($inFALSE); } function FormIfEmail ( $inTRUE, $inFALSE = "", $inTag = "") { // prints the textfield for email if allowed global $_entry,$settings,$optional,$required; $_value = ""; $_query = vgb_query("select * from VGB_COUNTRY where ID > 1"); // get the list of countries and sort the list by names $_countries = array(); while ($_country = mysql_fetch_array($_query)) { if ($_country['NAME'] != "0") { $_name = ($_country['TRANSLATE']) ? $langC[$_country['NAME']] : $_country['NAME']; $_countries[$_country['ID']] = $_name; } } uasort($_countries,"vgb_stringsort"); $_countries[1] = $langC['0']; if (is_null($_entry['COUNTRY'])) $_selected = (is_null($settings['PRECOUNTRY']) || $showPreview) ? 0 : $settings['PRECOUNTRY']; else $_selected = $_entry['COUNTRY']; // generate country-selection foreach ($_countries as $_id => $_name) { $_value .= "