Login    Registrati    Text  + grande    + piccolo

phpnuke for donkeys translator phpnuke for donkeys translator phpnuke for donkeys translator phpnuke for donkeys translator phpnuke for donkeys translator phpnuke for donkeys translator phpnuke for donkeys translator

smartphone android
vendite riservate
Offerte Cd e Dvd
 
Area Riservata 1 Tutorials
Area Riservata 1 Downloads
Area Riservata 2 Tutorials
Area Riservata 2 Downloads Info Area 1    Info Area 2
Clicca per iniziare il tour!
Mobile     Facebook     Twitter     RSS Feed
Per qualsiasi informazione Contattaci
Nuova pagina 2


PHP-Nukefordonkeys.com: Forums

:: Leggi il Topic - guiki, un aiutino please
 FAQFAQ   CercaCerca   Gruppi utentiGruppi utenti   ProfiloProfilo   LoginLogin 

guiki, un aiutino please

 
Nuovo Topic   Rispondi    Indice del forum -> Addons, Blocchi, Moduli
Precedente :: Successivo  
Autore Messaggio
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 25-10-2006 00:39    Oggetto: guiki, un aiutino please Rispondi citando

Ciao a tutti,
ho da poco implementato sul mio sito la funzione Guiki (un modulo che funziona più o meno come wikipedia). C'è qualcun altro che lo utilizza? O qualche anima gentile che voglia darmi una mano?
Praticamente tutti gli utenti registrati possono modificare o scrivere nuove pagine, ma possono anche eliminarle. A me interesserebbe lasciare la funzione "delete" solo all'amministratore e nel caso ad un gruppo apposito per la moderazione. Non credo sia difficile ma siccome sono un po' ignorante con i codici mi servirebbe un aiuto. Penso che il problema si trovi nell'index.php:
Codice:
if (!defined('MODULE_FILE')) {
    die ("You can't access this file directly...");
}


require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
$index = 1;
//get_lang($module_name);             // no languages yet
$pagetitle = "$module_name";
global $user, $prefix;
$prefix_guiki = $prefix."_guiki";

if(!is_array($user)) {
  $user_get = base64_decode($user);
  $user_get = explode(":", $user_get);
  $user_name = "$user_get[1]";
} else {
  $user_name = "$user[1]";
}
 
include("modules/$module_name/config.php");         // Get user set variables
$TPLT["EDIT"]   = "$TEMPLATE/edit.html";      // Set edit template
$TPLT["SHOW"]   = "$TEMPLATE/show.html";      // Set show template
$TPLT["SEARCH"]   = "$TEMPLATE/show.html";      // Set search template
$TPLT["INDEX"] = "$TEMPLATE/show.html";         // Set index template
$TPLT["HISTORY"] = "$TEMPLATE/show.html";

$CONTENT   = $HTTP_POST_VARS["CONTENT"];      // Get content from edit page
$SEARCH      = $HTTP_POST_VARS["SEARCH"];      // Get search term
$MODE      = $HTTP_GET_VARS["MODE"];      // Get mode
$DOCPOST   = $HTTP_POST_VARS["docpost"];      // Testing out new editor delete me
$PAGE      = $HTTP_GET_VARS["PAGE"];      // Get page name

$CONTENT    = preg_replace("/<\?/","",$CONTENT);   // No PHP uploads
$SEARCH    = checkVars($SEARCH);         // No special chars
$PAGE       = checkVars($PAGE);         // No special chars
$MODE       = checkVars($MODE);         // No special chars

if (! $MODE)   {$MODE = "SHOW";}         // Set default mode
if (! $PAGE)   {$PAGE = $HOME;}         // Set default page

# include("header.php");

function head() {
    global $slogan, $sitename, $banners, $nukeurl, $Version_Num, $artpage, $topic, $hlpfile, $user, $hr, $theme, $cookie, $bgcolor1, $bgcolor2, $bgcolor3, $bgcolor4, $textcolor1, $textcolor2, $forumpage, $adminpage, $userpage, $pagetitle;
    include("includes/ipban.php");
    $ThemeSel = get_theme();
    include_once("themes/$ThemeSel/theme.php");
    echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
    echo "<html>\n";
    echo "<head>\n";
    echo "<title>$sitename $pagetitle</title>\n";
    include("includes/meta.php");
    include("includes/javascript.php");

    if (file_exists("themes/$ThemeSel/images/favicon.ico")) {
        echo "<link REL=\"shortcut icon\" HREF=\"themes/$ThemeSel/images/favicon.ico\" TYPE=\"image/x-icon\">\n";
    }
    echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"backend.php\">\n";
    echo "<LINK REL=\"StyleSheet\" HREF=\"themes/$ThemeSel/style/style.css\" TYPE=\"text/css\">\n\n\n";
    if (file_exists("includes/custom_files/custom_head.php")) {
          include_once("includes/custom_files/custom_head.php");
    }
    echo "\n\n\n</head>\n\n";
    if (file_exists("includes/custom_files/custom_header.php")) {
          include_once("includes/custom_files/custom_header.php");
    }
   
    echo "\n\n\n</head>\n\n";

    themeheader();
}


online();
head();
include("includes/counter.php");
global $user_name, $home;
if ($home == 1) {
    message_box();
    blocks(Center);
}
title("$sitename: $pagetitle - $MODE Page $PAGE");

if( $CONTENT )                  
   if (validate($user_name))         
      savePage($PAGE,$CONTENT);           

if( $DOCPOST )                  
   if (validate($user_name))      
      savePage($PAGE,$DOCPOST);       

if (! page_exists($PAGE))                 
   if ($MODE != "INDEX"&&$MODE != "SEARCH" && $MODE != "HISTORY")
      $MODE = "EDIT";            // Go into edit mode

if ($MODE == "EDIT"||$MODE == "DELETE")         // If $MODE is edit or delete
   if (! validate($user_name))         // Challenge for user and password
      $MODE = "SHOW";            // Change to show if they dont know login
if ($MODE == "DELETE"){               // If mode is delete (AUTH done above)
   deletepage($PAGE);            // Delete the page
   $PAGE = "$HOME";            // Set $PAGE to default
   $MODE = "SHOW";               // Set $MODE to show
}
if ($MODE == "REVERT") {
        revertpage($PAGE, $DATA);
        $MODE = "HISTORY";
        $DATA = "";
}
OpenTable();   

template($MODE,$PAGE,$DATA,$TPLT[$MODE],$SEARCH);   // Make replacements

CloseTable();   
include("footer.php");
//die();

/*
**  FUNCTIONS
*/
function template($MODE,$PAGE,$DATA,$TEMPLATE,$SEARCH){
   $OUTPUT       = implode( "", file($TEMPLATE) );
   if (page_exists($PAGE)){
      $CONTENT        = stripslashes(getpage($PAGE));
      $MODIFIED       = "Last Modified at ".date("H:i:s F d Y",pagemtime($PAGE))." by ".pagemuser($PAGE);
   }
   if ($MODE == "SEARCH")
      $CONTENT   = findPage($SEARCH);
        if ($MODE == "INDEX")
      $CONTENT   = indexPage();
        if ($MODE == "HISTORY")
                $CONTENT        = historypage($PAGE,$DATA);
   $OUTPUT   = str_replace("<!--MODIFIED-->"   ,$MODIFIED      ,$OUTPUT);
   $OUTPUT   = str_replace("<!--REVERT-->"   ,showRevertLink()   ,$OUTPUT);
   $OUTPUT   = str_replace("<!--CANCEL-->"   ,showCancelLink()   ,$OUTPUT);
   $OUTPUT   = str_replace("<!--EDIT-->"   ,showEditLink($MODE, $PAGE)   ,$OUTPUT);
      $OUTPUT     = str_replace("<!--HISTORY-->"  ,showHistoryLink($PAGE)      ,$OUTPUT);
      $OUTPUT   = str_replace("<!--INDEX-->"   ,showIndexLink($PAGE)      ,$OUTPUT);
   $OUTPUT   = str_replace("<!--DELETE-->"   ,showDeleteLink()   ,$OUTPUT);
   $OUTPUT   = str_replace("<!--PAGE-->"   ,$PAGE         ,$OUTPUT);
   $OUTPUT   = str_replace("<!--CONTENT-->"   ,$CONTENT      ,$OUTPUT);
   $OUTPUT   = str_replace("<!--TEMPLATE-->"   ,dirname($TEMPLATE)   ,$OUTPUT);
   if ($MODE == "SHOW")
      //$OUTPUT = preg_replace("/a href=/i","a target='_blank' href="),$OUTPUT); // now working popup all external links
      $OUTPUT = preg_replace("/\[\[(.*?)\]\]/",writeLink("\\1"),$OUTPUT);
   writeHeaders();
   echo $OUTPUT;
}
function checkVars($DATA){
    return preg_replace("/[\`|\.|\\|\/|<\?]/","",$DATA);
}
function findPage($SEARCH) {
   $output = "<ul>\n";
   foreach (getDataFiles() as $page) {
      if (!preg_match("/.gif|.jpg|.png/i",$page)){
         $current = getpage($page);
         if (preg_match("/$SEARCH/i",$current) )
            $output .= "<li>".writeLink($page)."</li>\n";
      }
   }
   $output .= "</ul>\n";
   return $output;
}
function validate($user){
    global $db, $prefix, $MAX_KARMA, $admin;
    if(is_admin($admin)) return true;
    $result = $db->sql_fetchrow($db->sql_query("SELECT karma FROM ".$prefix."_users WHERE username='$user'"));
    $karma = $result['karma'];
    if ($user != "" && $karma <= $MAX_KARMA) {
   return true;
    } else {
        return false;
    }
}
function showCancelLink(){
    global $module_name;
    return "<a href=\"modules.php?name=$module_name&amp;MODE=SHOW&PAGE=<!--PAGE-->\">Cancel</a>";
}
function showRevertLink(){
    global $module_name;
    return "<a href=\"modules.php?name=$module_name&amp;MODE=EDIT&PAGE=<!--PAGE-->\">Revert</font>";
}
function showDeleteLink(){
    global $module_name;
    return "<a href=\"modules.php?name=$module_name&amp;MODE=DELETE&PAGE=<!--PAGE-->\"><font color='red'>Delete</font></a>";
}
function showEditLink($MODE, $PAGE){
    global $module_name, $user_name;
    if ((validate($user_name)) && ( $MODE != "HISTORY" ) && ( $PAGE != "Index" )) {
        return "<a href=\"modules.php?name=$module_name&amp;MODE=EDIT&PAGE=<!--PAGE-->\">Edit</a>";
    }
}
function showIndexLink($PAGE){
    global $module_name;
    if ( $PAGE != "Index" )
       return "<a href=\"modules.php?name=$module_name&amp;MODE=INDEX&PAGE=Index\">Index</a>";
}

function showHistoryLink($PAGE){
    global $module_name;
    if ( $PAGE != "Index" )
       return "<a href=\"modules.php?name=$module_name&amp;MODE=HISTORY&PAGE=<!--PAGE-->\">History</a>";
    else
       return "<a href=\"modules.php?name=$module_name&amp;MODE=HISTORY&PAGE=<!--PAGE-->\">Recent Changes</a>";
}

function savePage($PAGE,$CONTENT) {
    global $db, $prefix_guiki, $user_name;
    if (validate($user_name)) {
    $PAGE = addslashes($PAGE);
    $CONTENT = addslashes($CONTENT);
    if(page_exists($PAGE)){
       // Make a copy
       $query = "INSERT INTO ".$prefix_guiki."_history SELECT * FROM $prefix_guiki WHERE page = '$PAGE'";
       $db->sql_query($query);
    //echo $query;
    //$error = $db->sql_error();
    //echo $error["message"];
       $db->sql_query("UPDATE $prefix_guiki SET content = '$CONTENT' WHERE page = '$PAGE'");
    }else{
       $db->sql_query("INSERT INTO $prefix_guiki VALUES('$PAGE','$CONTENT',0,'')");
   //echo $query;
   //$error = $db->sql_error();
   //echo $error["message"];
    }
    //Update time
    $time=time();
    if($user_name=="")
    {
       $guser_name="Administrator";
    }else
    {
       $guser_name=$user_name;
    }
    $query = "UPDATE $prefix_guiki SET modtime = $time, editedby = '$guser_name' WHERE page = '$PAGE'";
    //echo $query;
    //$error = $db->sql_error();
    //echo $error["message"];
    $db->sql_query($query);
    } else {
      echo "Illegal attempt to change wiki. Admin notified";
    }


function revertpage($PAGE, $DATA) {
    global $db, $prefix_guiki, $user_name;
    if (validate($user_name)) {
       $PAGE = addslashes($PAGE);
       // Make a copy for history
       $query = "INSERT INTO ".$prefix_guiki."_history SELECT * FROM $prefix_guiki WHERE page = '$PAGE'";
       $db->sql_query($query);
       // Delete current page
       $query = "DELETE FROM $prefix_guiki WHERE page = '$PAGE'";
       $db->sql_query($query);
       // Copy page from history
       $query = "INSERT INTO ".$prefix_guiki." SELECT * FROM ".$prefix_guiki."_history WHERE page = '$PAGE' and modtime = '$DATA'";
       $db->sql_query($query);
       // Update edit time and user
       $time=time();
       $query = "UPDATE $prefix_guiki SET modtime = $time, editedby = '$user_name' WHERE page = '$PAGE'";
       $db->sql_query($query);
    } else {
      echo "Illegal attempt to change wiki. Admin notified";
    }
}


function writeHeaders() {
    header ("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header ("Cache-Control: no-cache, must-revalidate");
    header ("Pragma: no-cache");
}
function writeLink($PAGE) {
    global $module_name;
    if ( preg_match("/.gif|.jpg|.png/i",$PAGE)){ //not working mat
        return "<img src=\"modules/$module_name/data/$PAGE\">";  //data is hardcoded this is BAD
    } else {
        return "<a href=\"modules.php?name=$module_name&amp;MODE=SHOW&PAGE=$PAGE\">$PAGE</a>";
    }
}
function getDataFiles() {
    global $db, $prefix_guiki;
    $pagelist = $db->sql_query("SELECT page FROM $prefix_guiki ORDER BY page");
    //Convert to array
    while( $pagename = $db->sql_fetchrow($pagelist)){
            $allpages[] = $pagename['page'];
    }           
    return $allpages;
}
function getpage($PAGE){
   global $db, $prefix_guiki;
   $PAGE = addslashes($PAGE);
   $sqlrow = $db->sql_fetchrow($db->sql_query("SELECT content from $prefix_guiki WHERE page = '$PAGE'"));
   return $sqlrow['content'];
}


function page_exists($PAGE){
   global $db, $prefix_guiki;
   $PAGE = addslashes($PAGE);
   return $db->sql_numrows($db->sql_query("SELECT page from $prefix_guiki WHERE page = '$PAGE'"));
}
function deletepage($PAGE){
   global $db, $prefix_guiki, $user_name;
        if (validate($user_name)) {
   $PAGE = addslashes($PAGE);
   $db->sql_query("DELETE FROM ".$prefix_guiki."_history WHERE page = '$PAGE'");
   return $db->sql_query("DELETE FROM $prefix_guiki WHERE page = '$PAGE'");
        } else {
          echo "Illegal attempt to delete page. Admins notified";
        }
}
function pagemtime($PAGE){
   global $db, $prefix_guiki;
   $PAGE = addslashes($PAGE);
   $sqlrow = $db->sql_fetchrow($db->sql_query("SELECT modtime from $prefix_guiki WHERE page = '$PAGE'"));
   return $sqlrow['modtime'];
}

function pagemuser($PAGE){
        global $db, $prefix_guiki;
        $PAGE = addslashes($PAGE);
        $sqlrow = $db->sql_fetchrow($db->sql_query("SELECT editedby from $prefix_guiki WHERE page = '$PAGE'"));
        return $sqlrow['editedby'];
}


function indexpage(){
   global $db, $prefix_guiki;
   $output = "<ul>\n";
   foreach(getDataFiles() as $page){
      $output .= "<li>".writeLink($page)."</li>\n";
   }
   $output .= "</ul>\n";
   return $output;
}

function historypage($PAGE,$DATA) {
    global $db, $prefix_guiki, $module_name;
    if ($PAGE == "Index"){
        $query = "SELECT page, modtime, editedby FROM ".$prefix_guiki."_history ORDER BY modtime ASC LIMIT 0,10";
     $result = $db->sql_query($query);
        $output = "<table width=75% border=1>";
        $output .= "<tr><th>Date</th><th>Author</th><th>Page</th></tr>";
        while ($row = $db->sql_fetchrow($result))  {
            $output .= "<tr><td>".date("r", $row['modtime'])."</td><td>".$row['editedby']."</td><td>".$row["page"]."</td></tr>";
        }
        $output .= "</table>";
     return $output;
    } else {
        $PAGE = addslashes($PAGE);
        $output = "<br>";
        if ( $DATA != "" ) {
           $output .= "<font color=red>History for $PAGE: ".date("r", $DATA)."</font><br>";
           $query = "SELECT content from ".$prefix_guiki."_history WHERE page = '$PAGE' AND modtime =' $DATA'";
           $sqlrow = $db->sql_fetchrow($db->sql_query($query));
           $output .= stripslashes($sqlrow['content']);
      $output = preg_replace("/\[\[(.*?)\]\]/",writeLink("\\1"),$output);
           $output .= "<br><hr><br>";
        }
        $output .= "<table width=75% border=1>";
        $output .= "<tr><th>Date</th><th>Author</th><th>Action</th></tr>";
        $query = "SELECT * FROM ".$prefix_guiki."_history WHERE page = '$PAGE' ORDER BY modtime DESC";
        $result = $db->sql_query($query);
        while ($row = $db->sql_fetchrow($result))  {
            $output .= "<tr><td>".date("r", $row['modtime'])."</td><td>".$row['editedby']."</td><td><a href=\"modules.php?name=$module_name&amp;MODE=HISTORY&PAGE=$PAGE&DATA=".$row['modtime']."\">view</a> <a href=\"modules.php?name=$module_name&amp;MODE=REVERT&PAGE=$PAGE&DATA=".$row['modtime']."\">revert</a> </td></tr>";
        }
        $output .= "</table>";
        return $output;
   }
}

ciaoooo
Torna in cima
Profilo Messaggio privato HomePage
lutor
Moderatore
Moderatore


Registrato: 12-10-2004
Messaggi: 774

MessaggioInviato: 25-10-2006 12:41    Oggetto: Rispondi citando

Lo provo in locale, man non prima di stasera spero....dammi un attimo Smile
_________________

The Fitness Tube
WI Live News
Torna in cima
Profilo Messaggio privato Invia email HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 25-10-2006 14:47    Oggetto: Rispondi citando

ok, aspetto allora! sxiamo bene
Torna in cima
Profilo Messaggio privato HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 31-10-2006 13:16    Oggetto: Rispondi citando

up...lutor....
Torna in cima
Profilo Messaggio privato HomePage
lutor
Moderatore
Moderatore


Registrato: 12-10-2004
Messaggi: 774

MessaggioInviato: 31-10-2006 13:19    Oggetto: Rispondi citando

ange pazzienta ancor aun attimo ho avuto da fare.....Smile
_________________

The Fitness Tube
WI Live News
Torna in cima
Profilo Messaggio privato Invia email HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 02-11-2006 19:20    Oggetto: Rispondi citando

ok! Very Happy
Torna in cima
Profilo Messaggio privato HomePage
krima
Newbie
Newbie


Registrato: 21-01-2005
Messaggi: 177

MessaggioInviato: 02-11-2006 23:24    Oggetto: Rispondi citando

Ho provato ad installare Guiki su nuke 7.6 ma mi da pagina bianca, c'è qualcosa di particolare da fare?
_________________
Realizzazione siti internet
Torna in cima
Profilo Messaggio privato HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 04-11-2006 10:29    Oggetto: Rispondi citando

io mi ricordo che c'erano due versioni di guiki, diverse a secondo del phpnuke usato. Mi ricordo anche che la prima che avevo usato non mi andava (quella per il phpnuke 7.6) mentre l'altra si. Al max vedo di vedere meglio e ti saprò dire
Torna in cima
Profilo Messaggio privato HomePage
krima
Newbie
Newbie


Registrato: 21-01-2005
Messaggi: 177

MessaggioInviato: 04-11-2006 10:39    Oggetto: Rispondi citando

Grazie ci sono riuscito, chi ha fatto il modulo ha incluso l'header, di non so quale versione di nuke, nell'index.php.
Facendo in questo modo, con le patch più recenti, da errore con qualsiasi tema. Wink
_________________
Realizzazione siti internet
Torna in cima
Profilo Messaggio privato HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 12-11-2006 14:56    Oggetto: Rispondi citando

si sa niente al riguardo? Shocked
Torna in cima
Profilo Messaggio privato HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 15-11-2006 14:20    Oggetto: Rispondi citando

.......
Torna in cima
Profilo Messaggio privato HomePage
lutor
Moderatore
Moderatore


Registrato: 12-10-2004
Messaggi: 774

MessaggioInviato: 15-11-2006 15:44    Oggetto: Rispondi citando

Angelo mi spiace ma ancora non ho fatto a tempo.... si era capito vero?
troppe cose da fare.......hai per caso ricontrollato bene per i problema?
_________________

The Fitness Tube
WI Live News
Torna in cima
Profilo Messaggio privato Invia email HomePage
angelovirgus
Newbie
Newbie


Registrato: 15-09-2005
Messaggi: 187
Località: Lecce e Firenze

MessaggioInviato: 15-11-2006 21:24    Oggetto: Rispondi citando

ciao lutor, io uso la versione 1.3 di guiki su raven76. Funziona per bene ma mi parrebbe troppo dare agli utenti la possibilità di eliminare direttamente la pagina da un semplice tasto (anche se lo possono fare in altro modo, dalla modifica testo). Credo che sia una cosa semplice da sistemare, purtroppo però non ci capisco molto.
Torna in cima
Profilo Messaggio privato HomePage
Mostra prima i messaggi di:   
Nuovo Topic   Rispondi    Indice del forum -> Addons, Blocchi, Moduli Tutti i fusi orari sono GMT + 1 ora
Pagina 1 di 1

 
Vai a:  
Non puoi inserire nuovi Topic in questo forum
Non puoi rispondere ai Topic in questo forum
Non puoi modificare i tuoi messaggi in questo forum
Non puoi cancellare i tuoi messaggi in questo forum
Non puoi votare nei sondaggi in questo forum


Powered by phpBB © 2001-2006 phpBB Group
Versione 2.0.21 by Nuke Cops © 2006 http://www.nukecops.com

Basato su PHP-Nuke - Powered by PHPNuke Professional
Generazione pagina: 0.16 Secondi