Logo Search packages:      
Sourcecode: kde-i18n version File versions

requests.php

<?
$db = db_init ();
 
      if(!isset($PHP_AUTH_USER)) 
      {
            Header("WWW-Authenticate: Basic realm=\"KDE I18N - ".gettext("English team")."\"");
            Header("HTTP/1.0 401 Unauthorized");
            echo gettext("Use the registration page to request a function")."\n";
            exit; 
      } 
      else 
      {
            $result = db_query("SELECT * FROM translators WHERE id=\"$PHP_AUTH_USER\"",$db);
            $pass=db_result($result,0,"password");
            if ( !(crypt($PHP_AUTH_PW,"$pass")=="$pass") )
            {
                  Header("WWW-Authenticate: Basic realm=\"KDE I18N - ".gettext("English team")."\"");             
                  Header("HTTP/1.0 401 Unauthorized");
                  echo gettext("ERROR: Authorization failed. Wrong username or password.");
                  exit;
            } 
            else 
            {
                  echo "Welcome $PHP_AUTH_USER!<br>";
            }     
      }
?>
<html>
<?php
include("header.php");
      if($stato) 
      {
            $i = 0;
            echo gettext("Change the state of files").":<br>";
                  while( $selection[$i] )
                  {
                        $result = db_query("SELECT * FROM files WHERE pofile=\"$selection[$i]\"",$db); 
                        $myrow = db_fetch_row($result);
                              if($PHP_AUTH_USER==$myrow[3]) 
                              {
                                    echo "$selection[$i]: $newstatus";
                                    $result = db_query("UPDATE files SET status=\"$newstatus\" WHERE pofile=\"$selection[$i]\"",$db);
                                    echo db_error();
                                    echo "<br>"; 
                              }
                              else
                              {
                                    sprintf (gettext("You must be the translator of %s in order to change its state")."<br>",$myrow[0]); 
                                    $i++;
                              }
                  }
      else
      {
            if($ask) 
            {
                  $i = 0;
                  $result = db_query("SELECT * FROM translators WHERE id=$PHP_AUTH_USER",$db);
                  $richiedente = sprintf("%s %s <%s>", db_result($result,0,"first"), db_result($result,0,"last"), db_result($result,0,"email"));
                        while( $selection[$i] )
                        {
                                    echo "$selection[$i]: richiesto...<br>";
                                    $result = db_query("SELECT * FROM files WHERE pofile=\"$selection[$i]\"",$db); 
                                    $myrow = db_fetch_row($result);
                                          if($PHP_AUTH_USER==$myrow[3])
                                          {
                                                sprintf(gettext("You already are the translator of %s!!<br>"),$myrow[0]); 
                                          }
                                          elseif($myrow[2]=="requested") 
                                          {
                                                echo gettext("These files have already been requested by someone and are still unassigned").".<br>";
                                          
                                          else 
                                          {
                                                $sqlstring = sprintf("UPDATE files SET idTranslator=\"%s\", status=\"reassigned\" WHERE pofile=\"%s\"",$PHP_AUTH_USER,$selection[$i]);
                                                $sqlstringref = sprintf("UPDATE files SET status=\"NOT reassigned\" WHERE pofile=\"%s\"",$selection[$i]);
                                                $sqlstring1 = sprintf("UPDATE files SET status=\"requested\" WHERE pofile=\"%s\"",$selection[$i]);
                                                $comment = sprintf("%s requests permission to translate the file %s",$richiedente,$selection[$i]); 
                                                $result = db_query($sqlstring1,$db);
                                                $result = db_query("INSERT INTO querystring(qstring,comment,translatorId,rstring,requestFrom) VALUES ('$sqlstring','$comment','$myrow[3]','$sqlstringref','$PHP_AUTH_USER')",$db);
                                                $dd = db_error();
                                                $something=1;
                                          }
                                    $i++;
                        }
                  if($something) 
                  {
                        $url = $rootdir."/requests.php?do=1";
                        $result = db_query("SELECT email FROM translators WHERE id=\"$myrow[3]\"",$db); 
                        $emailresp = db_result($result,0,"email");
                        $messaggio = sprintf(gettext ("AUTOMATICALLY GENERATED MESSAGE\n
                        %s asked to translate some packages that\n
                        are under your responsability\n
                        You can decide to allow or not those requests visiting\n %s\n
                        \nIf you have any trouble contact %s"),$richiedente,$url,$coordinator);
                        mail($emailresp,"Package change request",$messaggio,"From: KDE-I18N Italian team <kde-i18n-it@kde.org>\n\r");
                  }
            }
            else
            {
                  if($do) 
                  {
                        echo "<form action=requests.php method=\"POST\">";
                        echo "<table border=1>\n";
                        echo "<tr><td>".gettext("File")."</td><td>".gettext("Accept")."</td><td>".gettext("Reject")."</td></tr>\n";
                        $result = db_query("SELECT * FROM querystring WHERE translatorId=\"$PHP_AUTH_USER\"",$db);
                              while ($myrow = db_fetch_row($result)) 
                              {
                                    printf("<tr><td>%s</td><td><input type=checkbox value=\"%s\" name=\"selection[]\"></td><td><input type=checkbox value=\"%s\" name=\"refuse[]\"></td></tr>\n",$myrow[2],$myrow[0],$myrow[0]);
                              }
                        echo "</table><br>";
                        echo "<input type=\"submit\" value=\"".gettext("Accept/reject the requests")."\" name=\"ok\" >";
                        echo "</form>\n";
                  }
                  else 
                  {
                        if($ok) 
                        {
                              $i = 0;
                              $result4 = db_query("SELECT * FROM translators",$db);
                              while ($myrow4 = db_fetch_row($result4)) 
                              {
                              $something=0;
                              $i = 0;
                              $message=""; //Il repsonsabile dei seguenti pacchetti ha accettato le seguenti richieste: \n\n";
                                    while( $selection[$i] )
                                    {
                                          $q=$selection[$i];
                                          //echo $q;
                                          $result = db_query("SELECT * FROM querystring WHERE id=\"$q\" AND requestFrom=\"$myrow4[0]\"",$db);
                                          $myrow = db_fetch_row($result);
                                          echo db_error();
                                                if($myrow)
                                                {
                                                            if($something==0) 
                                                            {
                                                                  sprintf(gettext("For %s %s you refused :<br>"), $myrow4[1], $myrow4[2]);
                                                                  $message=gettext("The responsable of the following files rejected those requests:");
                                                            }
                                                      $result = db_query("SELECT * FROM querystring WHERE id=\"$q\"",$db);
                                                      $com=db_result($result,0,"comment");
                                                      $message.=db_result($result,0,"comment") . "\n";
                                                      $st = db_result($result,0,"qstring");
                                                      $result = db_query($st,$db);
                                                      $result = db_query("UPDATE querystring SET translatorId=\"-1\" WHERE id=\"$q\"",$db);
                                          /*
                                          if($something==0)
                                          echo "Per $myrow4[1] $myrow4[2] hai accettato:<br>"; 
                                          */
                                                      echo "$com"; 
                                                      echo "<br>" ;
                                                      $something=1;
                                                }
                                          $i++;
                                    }
                                    // $message.="\n\n\n...invece ha rifiutato: \n";
                                    $i = 0;
                                    
                                    while( $refuse[$i] )
                                    {
                                          $q=$refuse[$i];
                                          //echo $q;
                                          $result = db_query("SELECT * FROM querystring WHERE id=\"$q\" AND requestFrom=\"$myrow4[0]\"",$db);
                                          $myrow = db_fetch_row($result);
                                          if($myrow)
                                          {
                                                      if($something!=2) 
                                                      {
                                                            sprintf(gettext("For %s %s you refused :<br>"), $myrow4[1], $myrow4[2]);
                                                            if($something==0) $message=gettext("The responsable of the following files rejected those requests:");
                                                            else $message.="\n\n\n...".gettext("while he rejected");
                                                      }
                                                $result = db_query("SELECT * FROM querystring WHERE id=\"$q\"",$db);
                                                $message.=db_result($result,0,"comment") . "\n";
                                                $com = db_result($result,0,"comment");
                                                $st = db_result($result,0,"rstring");
                                                $result = db_query($st,$db);
                                                $result = db_query("UPDATE querystring SET translatorId=\"-2\" WHERE id=\"$q\"",$db);
                                                /*
                                                if($something!=2)
                                                echo "Per $myrow4[1] $myrow4[2] hai rifiutato:<br>"; 
                                                */
                                                echo "$com";
                                                echo "<br>" ;
                                                $something=2;
                                          }
                                          $i++;
                                    }
                                    if($something!=0) 
                                    {
                                          mail($myrow4[3],"Package change request",$message,"From: KDE-I18N Italian team <kde-i18n-it@kde.org>\n\r");
                                          //echo $message;
                                    } //whilesu i traduttori
                              }
                        } 
                        else
                        {
                              if($modify)
                              {
                                    $result = db_query("SELECT * FROM translators WHERE id=\"$PHP_AUTH_USER\"",$db);
                                    $myrow = db_fetch_row($result);
                              }
                        
      print (gettext("Modify your account information").":<br>");
?>
<table border=0>
<form method="post" enctype="multipart/form-data" action=register.php>
      <tr><td><?php gettext("Name") ?></td><td><input type="Text" name="first" value="<? echo $myrow[1] ?>"></td></tr>
      <tr><td><?php gettext("Surname") ?></td><td><input type="Text" name="last" value="<? echo $myrow[2] ?>"></td></tr>
      <tr><td><?php gettext("Email") ?></td><td><input type="Text" name="email" value="<? echo $myrow[3] ?>"></td></tr>
      <tr><td><?php gettext("Old Password") ?></td><td><input type="Password" name="oldpassword"></td></tr>
      <tr><td><?php gettext("New Password") ?></td><td><input type="Password" name="password"></td></tr>
      <tr><td><?php gettext("Verify Password") ?></td><td><input type="Password" name="password1"></td></tr>
      <tr><td><img src=<? sprintf("translators-foto/$s.png",$myrow[0]);?>></TD></TR>
      <tr><td><?php gettext("Photo") ?> <?php gettext("(PNG, max 40Kb)") ?></td><td><input type="file" name="file"></td></tr>
      <tr><td><?php gettext("Short biography") ?></td><td><textarea name="biography" cols="60" rows="6"><? echo $myrow[6] ?></textarea>
<input type="hidden" name="MAX_FILE_SIZE" value="40000">
<input type="hidden" name="id" value="<?echo $PHP_AUTH_USER?>">
<input type="Submit" name="submit" value="<?php gettext("Apply") ?>">
</form>
</table>
<?
                        }
                  }
            }
      }


include("footer.php");

?>


</body>



</html>

Generated by  Doxygen 1.6.0   Back to index