LUGOB (Linux User Group Ovest Bresciano)


 

:: Chi Siamo


uk_flag Info in English
 

LINK


Link inserito!
"; # The message to display, if there is an error $errormessage="

Oops! Hai scordato nome, URL o descrizione
"; # Replace special characters with their html equivalents like > to > (0/1) $specialchars=1; # Convert Ascii linebreaks to html linebreaks
(0/1) $linebreaks=1; # Entrytext, displayed above the links $entrytext = ''; # Rules, displayed when you enter some text... $rules = 'Inserisci qui il tuo link'; # display (1) or hide (0) the dropdowns/textlinks above and below the links (navigation) $dropdown_up=1; $dropdown_down=0; $textlinks_up=0; $textlinks_down=0; # Text to be displayed when a category has no data yet. $no_link_yet="Nessun link presente...

"; // Display templates, the data in %% will be replaced by the real content. // do not use ' !!! # detailed link display # possible variables are %url% %name% and %message% $detail_display=' %name%
%message%

'; # compact link display # possible variables are %url% and %name% $compact_display=' %name%
'; # category header # possible variables are %category% $cat_display='
 %category%

'; # text links template # possible variables are %links% $text_links_display = '

%links%
'; # dropdown template # possible variables are %dropdown% $dropdown_display = '
%dropdown%

'; # Add link template, please ensure to use both %% expressions, otherwise the link # will not be closed!!! # possible variables are %addlinkstart% and %addlinkend%
%addlinkstart% Add your link %addlinkend%

'; // The categories, split them with a, do not use spaces after the comma $categories = "Vari,Trashware,Download Consigliati,Open Source e Linux,Altri LUG nella zona"; $categories = split(",",$categories); sort($categories); if (!$pw || $pw != $pass){ // no admin /*----------------------------------------------------------------------------------------------- Introduction Screen when there is no data from the form ------------------------------------------------------------------------------------------------*/ if ($action != "view" && $action !="new" && $edit !="yes"){echo $entrytext;$action="view";$compact="no";} if ($dropdown_up==1){ // display upper dropdown $dropdownchunks=split("%dropdown%",$dropdown_display); echo "
".$dropdownchunks[0]; echo "Scegli la categoria:  Nascondi dettagli ".$dropdownchunks[1]."
"; #mio... echo "  ".$dropdownchunks[1].""; ##### } if ($textlinks_up==1){ // diplay upper textlinks $textchunks=split("%links%",$text_links_display); echo $textchunks[0]; for ($x=0;$x$categories[$x]  ";} else {echo "$categories[$x]  ";} endfor; echo "
"; if ($cat != "all"){echo "all";} else echo "all"; if ($compact=="yes"){$viewdisp="show hide details.";} if ($compact!="yes"){$viewdisp="show hide details.";} echo "   (".$viewdisp.")".$textchunks[1]; } /*----------------------------------------------------------------------------------------------- Display the links ------------------------------------------------------------------------------------------------*/ if ($action=="view"){ // if there is no category, display all... if ($cat == "") $cat="all"; echo $entrytext; $lines=get_data($filelocation); // reads datafile if ($cat == "all"){ // loop over all categories for ($x=0;$x"; # spazio tra una categoria e l'altra } $f++; } // no link in category, display message if ($found==0)echo $no_link_yet; endfor; } // display category else { // put data in template $cat_display_now = $cat_display; $cat_display_now=eregi_replace("%category%",$cat,$cat_display_now); echo stripslashes($cat_display_now); $f=0; $found=0; // trigger if there is a link while($f < sizeof($lines)){ $user = explode("#",$lines[$f]); if ($user[2] == $cat){ $found=1;// link found! // if there is no http, add it if (substr($user[3],0,7)!= "http://"){$user[3]="http://".$user[3];} if ($compact != "yes"){ // display with details // take template and put data in $detail_display_now = $detail_display; $detail_display_now=eregi_replace("%url%",$user[3],$detail_display_now); $detail_display_now=eregi_replace("%name%",$user[1],$detail_display_now); $detail_display_now=eregi_replace("%message%",$user[4],$detail_display_now); echo stripslashes($detail_display_now); } else { // display without details // take template and put data in $compact_display_now = $compact_display; $compact_display_now=eregi_replace("%url%",$user[3],$compact_display_now); $compact_display_now=eregi_replace("%name%",$user[1],$compact_display_now); echo stripslashes($compact_display_now); } } $f++; } // if there is no link in this category, say so if ($found==0)echo $no_link_yet; } // Display add link template $addlink_display=eregi_replace("%addlinkstart%","",$addlink_display); $addlink_display=eregi_replace("%addlinkend%","",$addlink_display); ############################### # MOSTA O MENO SCRITTA ADD A LINK... # echo $addlink_display; } /*----------------------------------------------------------------------------------------------- Adding a new entry to the data file ------------------------------------------------------------------------------------------------*/ if ($edit == "yes"){ // When there is missing data, display the errormessage and reprint the form if ($name == "" || $message =="" || $url==""){ echo $errormessage."\n"; echo "
Name:
Category:
url:
Message:
"; } // If all the entries are correct, display thanksmessage add to datafile else { echo $thanksmessage."\n"; // Change % and # to percent and no, to avoid wrong splitting of the data. $message = eregi_replace("#","no.",$message); $message = eregi_replace("%","percent",$message); $name = eregi_replace("#","no.",$name); $name = eregi_replace("%","percent",$name); // When specialchars are to be replaced... if ($specialchars==1){$message=htmlentities($message);} // When ASCII Linebreaks should become
s if ($linebreaks==1){$message = nl2br($message);} $lines=get_data($filelocation); $counter = sizeof($lines); $newfile = fopen($filelocation,"a+"); $add = "%".$counter."#".$name."#".$category."#".$url."#".$message."\n"; fwrite($newfile, $add); fclose($newfile); } } /*----------------------------------------------------------------------------------------------- Add a new entry to the links, display the rules and show the form. ------------------------------------------------------------------------------------------------*/ if ($action == "new" && $edit != "yes"){ echo "$rules
\n
Name:
Category:
echo"
url:
Message:
Form Disabilitato per ragioni di sicurezza :-)
"; } } /*----------------------------------------------------------------------------------------------- Admin Section! ------------------------------------------------------------------------------------------------*/ if ($pw == $pass){ // Display entries with delete / edit buttons if (!$del && !$edit & !$add){ echo $entrytext; // load data from file $lines=get_data($filelocation); // Display all the entries for ($f=1;$f
'; endfor; } // edit entry if ($edit){ // read data $lines=get_data($filelocation); // loop over entries while(list($key)= each ($lines)){ // when the entry is the one to be edited, split in and display the form with the data if ($key == $edit){$user = explode("#",$lines[$key]);} } echo "
Handle:
category:
url:
Message:
"; } // Add the changed data to the datafile if ($add){ // exchange invalid characters $message = eregi_replace("#","no.",$message); $message = eregi_replace("%","percent",$message); $name = eregi_replace("#","no.",$name); $name = eregi_replace("%","percent",$name); $newdatas=""; $lines=get_data($filelocation); // loop over entries while(list($key)= each ($lines)){ // when the entry is not the one to be changed... if ($key != $add){ // when it's not the first entry, don't add a % (prevents blank entry) if ($key != 0){$newdatas .= "%";} // else simply put in the old data $newdatas .= $lines[$key]; } // if the entry is the one that was changed, insert the new data else {$newdatas .= "%".$add."#".$name."#".$category."#".$url."#".$message;} } // overwrite the old data file... $newfile = fopen($filelocation,"w+"); fwrite($newfile, $newdatas); fclose($newfile); // display linkbutton back echo "
The data of entry ".$name." has been changed!
"; } // Delete entry if ($del){ // reset datavariable $newdatas=""; // read in old data $lines=get_data($filelocation); // reset new entry counter $count=0; // loop over entries while(list($key)= each ($lines)){ // when the entry is not the one to be deleted... if ($key != $del){ // when it's not the first entry, don't add a % (prevents blank entry) if ($key != 0){$newdatas .= "%";} // divide into data chunks $user = explode("#",$lines[$key]); // add new counter and add the data if ($key != 0){$newdatas .= $count."#".$user[1]."#".$user[2]."#".$user[3]."#".$user[4];} // increase counter $count++; } } // replace old data file $newfile = fopen($filelocation,"w+"); fwrite($newfile, $newdatas); fclose($newfile); echo "
The entry has been deleted
"; } } // Display dropdown and links below if ($dropdown_down==1){ // get template, add data in it $dropdownchunks=split("%dropdown%",$dropdown_display); echo "
".$dropdownchunks[0]; echo "Choose category:   hide details ".$dropdownchunks[1]."
"; } if ($textlinks_down==1){ $textchunks=split("%links%",$text_links_display); echo $textchunks[0]; for ($x=0;$x$categories[$x]  ";} else {echo "$categories[$x]  ";} endfor; echo "
"; if ($cat != "all"){echo "all";} else echo "all"; if ($compact=="yes"){$viewdisp="show hide details.";} if ($compact!="yes"){$viewdisp="show hide details.";} echo "   (".$viewdisp.")".$textchunks[1]; } // Function for reading and preparing the data... function get_data($filelocation){ // check for the datafile, if it isn't there create blank one if (!file_exists($filelocation)) { $newfile = fopen($filelocation,"w+"); fclose($newfile); } $newfile = fopen($filelocation,"r"); $content = fread($newfile, filesize($filelocation)); fclose($newfile); $lines = explode("%",$content); return $lines; } ?>