Guest Book  

Feel free to leave commentary!
"; } elseif ((($_depth == 0) && ($inString[$_i] != '{') && ($inString[$_i] != '}')) || ($_depth > 0)) { $_q .= $inString[$_i]; } $_i++; } return $_q; } function vgb_addFilter ( $f, $c = "" ) { global $arg,$entryfilter; if (isset($arg[PFIX.'filter'.$f]) && ($arg[PFIX.'filter'.$f] != "")) { $col = ($c == "") ? strtoupper($f) : $c; $val = trim($arg[PFIX.'filter'.$f]); if ($val[0] != "%") $val = "%".$val; if ($val[strlen($val)-1] != "%") $val .= "%"; $val = " e.$col like '".addSlashes($val)."'"; $entryfilter .= ($entryfilter == "") ? $val : " and".$val; } } function vgb_checkParameter () { // check if all of the form-parameter are valid global $errorMSG,$entry,$settings,$lang,$boxes,$arg, $ratings,$fields,$custom,$_entry,$_custom,$_ratings; $_entry = $entry; $_custom = $custom; $_ratings = $ratings; $query = vgb_query("select * from VGB_USER where RESERVED = 1"); $_names = array(); while ($u = vgb_result($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 (vgb_numrows($query) == 0) $errorMSG = $lang['invalidPassword']; else { $u = vgb_result($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 (vgb_numrows($query) > 0) { if (((isset($custom[$field['ID']])) && ($custom[$field['ID']] == "")) || (!isset($custom[$field['ID']]))) { $c = vgb_result($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']; elseif (($x = vgb_noASCII(array($lang['email'] => $entry['EMAIL'], $lang['homepage'] => $entry['HOMEPAGE'], "AIM" => $entry['AIM'], "MSN" => $entry['MSN'], "YAHOO" => $entry['YAHOO'], "Password" => $entry['PRIVATE'], ))) != "") $errorMSG = "Only ASCII characters are allowed in the field: ".$x; // paramters too long ? elseif (vgb_strlen($entry['NAME']) > $settings['MAXLENNAME']) $errorMSG = $lang['tooLongName']; elseif (($settings['MAXLENENTRY'] != 0) && (($_zahl = vgb_strlen($entry['ENTRY'])) > $settings['MAXLENENTRY'])) $errorMSG = $lang['tooLongEntry']. ($_zahl-$settings['MAXLENENTRY']); elseif (vgb_strlen($entry['EMAIL']) > $settings['MAXLENEMAIL']) $errorMSG = $lang['tooLongEmail']; elseif (vgb_strlen($entry['HOMEPAGE']) > $settings['MAXLENHOMEPAGE']) $errorMSG = $lang['tooLongHomepage']; elseif (vgb_strlen($entry['ICQ']) > 10) $errorMSG = $lang['tooLongICQ']; elseif (vgb_strlen($entry['AIM']) > $settings['MAXLENAIM']) $errorMSG = $lang['tooLongAIM']; elseif (vgb_strlen($entry['MSN']) > $settings['MAXLENMSN']) $errorMSG = $lang['tooLongMSN']; elseif (vgb_strlen($entry['YAHOO']) > $settings['MAXLENYAHOO']) $errorMSG = $lang['tooLongYAHOO']; // check for wrong types elseif (($entry['EMAIL'] != "") && (!vgb_isValidEmail($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 = ". intval($entry['COUNTRY'])); if (vgb_numrows($_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 (vgb_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 (vgb_strlen($custom[$_field['ID']]) > vgb_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.".EXT."?&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,$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='".MSCRIPT."?". 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() { } function VGBLink ( $inTag = "" ) { } function makeEntryList( $inString ) { // generates the entries of the active page global $arg,$ratings,$custom,$settings,$lang,$showPrivate,$entryfilter, $maxPage,$maxEntry,$entry,$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 = vgb_result($_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 = vgb_result($_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 = vgb_result($_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 != "")) 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(vgb_UndoNoHTML(vgb_wrapWords(vgb_string(vgb_filterBadwords(vgb_noHTML($entry['NAME']),$settings['FILTERNAME'])))),false); } 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_string(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_string(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 = vgb_numrows($query); if (($comments == 0) && !is_null($inNULL)) { $_out = $inNULL; $comments = ""; } else $_out = $inTRUE; $newString = vgb_splitString($_out); out($newString[0],$comments); $_link = SCRIPTPATH."screen.".EXT."?$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(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['EMAIL']),$settings['FILTEREMAIL'])),false); $_value2 = $_value; $mail = explode("@",$_value2,2); $_value2 = $mail[0].''.$mail[1]; $_value3 = vgb_removeHTML(vgb_string(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.".EXT."?$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(vgb_string(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['HOMEPAGE']),$settings['FILTERHOMEPAGE']))),false); 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(vgb_string(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['AIM']),$settings['FILTERAIM']))),false); 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(vgb_string(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['MSN']),$settings['FILTERMSN']))),false); 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(vgb_string(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['YAHOO']),$settings['FILTERYAHOO']))),false); 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.".EXT."?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 (vgb_numrows($_query) == 0) Error($lang['wrongQueryResult'].$_q); $_country = vgb_result($_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_string(vgb_removeHTML($_value)); OutIf ($settings['ASKCOUNTRY'],$inTRUE,$inFALSE,$inNULL, $_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 = vgb_numrows($_query)) == 0) out($inFALSE); else { // print the defined rating-boxes $_string = vgb_splitString($inTRUE); out($_string[0]); while ($_box = vgb_result($_query)) { $_value = (isset($ratings[$_box['ID']])) ? $ratings[$_box['ID']] : null; OutIf (TRUE,$_string[1],"",$inNULL, $_value,vgb_removeHTML(vgb_string($_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 ((vgb_numrows($_query)) < $inPos) out($inFALSE); else { for ($_i=0;$_i<$inPos;$_i++) { $_box = vgb_result($_query); } $_value = (isset($ratings[$_box['ID']])) ? $ratings[$_box['ID']] : null; OutIf (TRUE,$inTRUE,"",$inNULL, $_value,vgb_removeHTML(vgb_string($_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 = vgb_numrows($_query)) == 0) out($inFALSE); else { // print the defined custom-fields $_string = vgb_splitString($inTRUE); out($_string[0]); while ($_field = vgb_result($_query)) { // is there an input for this entry ? $st = true; 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 = vgb_UndoNoHTML(vgb_wrapWords(vgb_string(vgb_filterBadwords(vgb_noHTML($_value),$_field['FILTER'])))); $st = false; } } } if (!is_null($_value)) { $_value = ($st) ? vgb_removeHTML(vgb_string($_value),false) : vgb_removeHTML($_value,false); } OutIf (TRUE,$_string[1],"",$inNULL,$_value, vgb_removeHTML(vgb_string($_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 = vgb_numrows($_query)) < $inPos) out($inFALSE); else { for($_i=0;$_i<$inPos;$_i++) { $_field = vgb_result($_query); } // is there an input for this entry ? $_value2 = null; $st = true; 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 = vgb_UndoNoHTML(vgb_wrapWords(vgb_string(vgb_filterBadwords(vgb_noHTML($_value),$_field['FILTER'])))); $st = false; } } } if (!is_null($_value)) $_value = ($st) ? vgb_removeHTML(vgb_string($_value),false) : vgb_removeHTML($_value,false); OutIf (TRUE,$inTRUE,"",$inNULL,$_value, vgb_removeHTML(vgb_string($_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(vgb_string(vgb_UndoNoHTML(vgb_filterBadwords(vgb_noHTML($entry['PICTEXT']),$settings['FILTERPICTEXT']))),false); 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.".EXT."?$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,$_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 "
"; $_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.".EXT."?$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 = vgb_result($_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 .= "