WackoWiki: RobertVaeth/WackoActions ...

Home Page | Изменения | Новые Комменты | Пользователи | Каталог | Регистрация | Вход:  Пароль:  

Different actions for WackoWiki

Currently more chaos than helpful.

Action: LastEdited


/actions/lastedited.php

<?php
//Declaration and the read in...
if($pages = $this->LoadRevisions($this->tag))
{
  
$this->context[++$this->current_context] = "";
  
$last_edited = $pages[0];

  
//Output
  
if ($this->GetResourceValue("LastEdited"))
    
$output .= $this->GetResourceValue("LastEdited").": ";
  else
    
$output .= "Last edited by: ";
  
$output .= $this->Link($last_edited["user"]);
  
$output .= " <small>(".$last_edited["time"].")</small>";
  print(
$output);
  
$this->current_context--;
} else {
  print(
$this->GetResourceValue("ReadAccessDenied"));
}
?>


SkipPer /05.01.2005 09:37/ awesome men, mit Sprachvariable für die wakka.de.php kann mans sogar eindeutschen, der (css) Teil vielleicht mit Parameter, manche wollen es vielleicht linksbündig (grübel)


Action: HighScores


/actions/highscores.php

<?php
    
# highscores.php {{HighScores}}
    # by Chris Tessmer
    # 19 Dec 2002
    # license: GPL

    
$str = 'SELECT Count(*) AS cnt, `name`  FROM ';
    
$str .= $this->config["table_prefix"] . 'users, ' ;
    
$str .= $this->config["table_prefix"].'pages ';
    
$str .= "WHERE `name` = `owner` AND `latest` = 'Y' AND `comment_on` = '' GROUP BY name ORDER BY cnt DESC;";
    
$rankQuery = $this->Query( $str );

    
$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `latest` = \'Y\' AND `comment_on` = \'\' ';
    
$totalQuery = $this->Query( $str );
    
$total  = mysql_result($totalQuery, 0);

    print(
"<blockquote><table>" );

    
$i = 0;    
    while(
$row = mysql_fetch_array($rankQuery) )
    {
        
$i++;
        
$str = '<tr>';
        
$str .= "<td>$i. &nbsp;</td>";
        
$str .= '<td>'. $this->Link("/".$row["name"]," ",$row["name"]).'</td>';
        
$str .= '<td> </td>';
        
$str .= '<td> &nbsp;&nbsp;&nbsp;</td>';
        
$str .= '<td>'.$row["cnt"].'</td>';
        
$str .= '<td> &nbsp;&nbsp;&nbsp;</td>';
        
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
        
$str .= '</tr>';
        print(
$str );
    }
    print(
"</table></blockquote>" );    
?>

SkipPer /15.01.2005 18:44/ bei wakka gefunden, Link auf Nutzer muss korrigiert werden, und der Code brauch auch etwas Liebe
Nötige Erweiterungen:

Get language from browser

Reason: Menu language of WackoWiki in your native / prefered language.


Collecting:

Um an die im Browser eingestellte Sprache zu kommen muss man ja den Header (der an den Server geschickt wird) auslesen:

<?
switch (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)) {
case
'de':
header("location: .....de");
break;
case
'en':
header("location: ........com");
break;
case
'it':
header("location: ........it");
break;
case
'es':
header("location: ........es");
break;
default:
header("location: .....de");
}
?>

oder
<?php
//Sprache auslesen und entsprechend umleiten

$languages = explode(",",$HTTP_ACCEPT_LANGUAGE);

foreach (
$languages as $key => $langcode) {
    if (
preg_match("/^de/i",$langcode)) {
    
header ("Location: index_de.php"); //zur deutschen Sprache
    
exit;
    }
if (
preg_match("/^en/i",$langcode)) {
    
header ("Location: index_en.php"); // zur englischen Sprache
    
exit;
    }
header ("Location: index_en.php"); // falls Sprache nicht gefunden zur default Sprache
exit;
?>


Thoughts / Brainstorm:


Process while contacting a wiki:

  1. index.php (No information useful, simply a redirector to the next file)
  2. wakka.php
  3. wakka.config.php (“language” = > “de”)

 
Файлов нет. [Показать файлы/форму]
Комментариев нет. [Показать комментарии/форму]
Donate
Время работы: 12.286 s
Использовано памяти: 2.672 Mb