Location: PHPKode > projects > Leafnode Web Administration > leafwa-0.7.0a1-ap/subun.php
<?
/***** 
subun.php
last altered 2-Nov-2000.

variables:
   $match = string to match
*****/

include "funlib.inc";

$debug = 0;

if ($action=="newMatch") {
   $match = $newMatch;
   setcookie("match", $match);
}

outHeadTop("Leafwa - Subscriptions", "select groups for download", 1);

if ($debug){
   echo "<br><i>Debug info:</i> whoami\n"; system("whoami");
   echo "<br>action [$action]\n";
   echo "<br>newMatch [$newMatch]\n";
   echo "<br>sub [$sub]\n";
   echo "<br>unsub [$unsub]\n";
}

if ($sub != ""){
   echo "<p><font color='#006600'>(Subscribed <b>$sub</b>)</font>\n";
 
   $cmd = "./subscribe.sh " . $intGroupDir . " " . $sub;
   $ret = exec($cmd, $dummyArray, $retVal);
   if ($debug) echo "<p>subscribed, ret=[$ret], <br>return value = $retVal\n";
}

if ($unsub != ""){
   echo "<p><font color='#660000'>(Unsubscribed <b>$unsub</b>)</font>\n";

   $cmd = "./unsubscribe.sh " . $intGroupDir . " " . $unsub;
   $ret = exec($cmd, $dummyArray, $retVal);
   #if ($debug) echo "<p>unsubscribed, return value = $retVal\n";
}

if ($match == ""){
} else {
   $cmd = "awk '{print $1}' <" .$activeFN. " | grep \"" . $match . "\""; 
   //echo "command is [$cmd]";
   $result = exec($cmd, $res2, $res3);
   //echo "<br>**** res3 is [$res3]";
   
   $foundNgs = sizeof($res2);
}

/* get groups subscribed to */
$cmd2 = "ls " . $intGroupDir . " | sort";
exec($cmd2, $subbedArr, $res4);
$numSubbed = sizeof($subbedArr);


?>

<p>
| <a href="leafwa.php">Main screen</a> 
| <a href="viewsettings.php">View settings</a>
| <a href="newsq.php">News queue</a>
| <a href="h_subun.html">Help</a>
|

<hr noshade>

<form method=get action="subun.php">
<input type=hidden name="action" value="newMatch">

<table border=0>
<tr>
<td>
<?
if ($match != "") {

   if ($foundNgs == 0){
      echo "<strong>No newsgroup names match </strong>";
   } else if ($foundNgs == 1){
      echo "<strong>This newsgroup name contains </strong>";
   } else {
      echo "<strong>These $foundNgs newsgroup names contain </strong>";
   }
} else {
   echo "No newsgroup filter specified; specify one below";  
}
?> 
</td><td bgcolor="#aaffbb">
<strong><?echo $match;?></strong>
</td><td><strong>:</strong>
</td></tr>
</table>

<p>
<?
   for ($i = 0; $i < $foundNgs; $i++){
      echo $res2[$i] . " - <a href='subun.php?sub=" 
         . rawurlencode($res2[$i]) . "'>subscribe</a>\n<br>\n";
   }//for
?>

<p>( Set New Filter: <input name=newMatch type=text size=15>
   <input type=submit value="Change"> )

</form>

<hr width="80%">

<p><h3>Leafnode is currently subscribed to <? echo $numSubbed;?> groups:</h3>

<p>
<?
   for ($i = 0; $i < $numSubbed; $i++){
      $sg = $subbedArr[$i];
      echo $sg . " - <a href='subun.php?unsub="
         . rawurlencode($sg) . "'>unsubscribe</a>\n<br>\n";
   }//for
?>
<p>
<hr noshade>

</body>
</html>
Return current item: Leafnode Web Administration