Pandabot/pb-web/inc/getconf.php

111 lines
5.7 KiB
PHP
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function getconf($cmd) {
global $channelInfoNew, $typemapping, $shm_memory;
$shm_key=fileinode("../bin/pandabot.php");
$shm = shm_attach($shm_key, $shm_memory);
$channelInfoNew=shm_get_var($shm, 4);
echo '<table>';
echo '<form action="post">';
echo '<input type="hidden" id="channelInfoKey" name="channelInfoKey" value=".${cmd}.">';
foreach(array_keys($channelInfoNew) as $channelInfoKey) {
if ($channelInfoKey == $cmd) {
echo '<input type="hidden" id="channelInfoKey" name="channelInfoKey" value="'.$channelInfoKey.'">';
echo "source: <b style='color:red;'>".$channelInfoNew[$channelInfoKey]["name"]."</b> (".$channelInfoNew[$channelInfoKey]["chanid"].")<br>";
echo '<td>typemapping:</td><td><select style="background: #b0b0a8; color: black;" name="typemapping" id="typemapping">';
foreach (array_keys($typemapping) as $mapping) {
if ( $mapping == $channelInfoNew[$channelInfoKey]["typemapping"]) { $typeselect="selected"; } else $typeselect="";
echo "<option ".$typeselect." value='".$mapping."'>".$mapping."</option>";
} // foreach ($typemapping as $mapping)
echo '</select></td></tr>';
echo "<td>disabled: </td><td>".' <select style="background: #b0b0a8; color: black;" name="disabled" id="disabled">';
switch($channelInfoNew[$channelInfoKey]["disabled"]) {
case "1":
echo "<option value='-1'>false</option>";
echo "<option selected value='1'>true</option>";
echo "<option value='2'>updatedb</option>";
break;
case "2":
echo "<option value='-1'>false</option>";
echo "<option value='1'>true</option>";
echo "<option selected value='2'>updatedb</option>";
break;
case "-1":
echo "<option selected value='-1'>false</option>";
echo "<option value='1'>true</option>";
echo "<option value='2'>updatedb</option>";
break;
} // switch($channelInfoNew[$channelInfoKey]["disabled"])
echo "</select></td></tr>";
echo "<td>mode: </td><td>".' <select style="background: #b0b0a8; color: black;" name="mode" id="mode">';
switch ($channelInfoNew[$channelInfoKey]["mode"]) {
case "i":
echo "<option value='read'>readonly</option>";
echo "<option selected value='inter'>interactiv</option>";
echo "<option value='interreq'>interactiv+request</option>";
break;
case "ir":
echo "<option value='read'>readonly</option>";
echo "<option value='inter'>interactiv</option>";
echo "<option selected value='interreq'>interactiv+request</option>";
break;
case "r":
echo "<option selected value='read'>readonly</option>";
echo "<option value='inter'>interactiv</option>";
echo "<option value='interreq'>interactiv+request</option>";
break;
} // switch ($channelInfoNew[$channelInfoKey]["mode"])
echo "</select></td></tr>";
if ($channelInfoNew[$channelInfoKey]["redirectout"]!=-1) { $checked="checked"; } else $checked="";
echo "<tr><td><a href='javascript:editchannel(".$channelInfoNew[$channelInfoKey]["redirectout"].");' title='".$channelInfoNew[$channelInfoKey]["redirectout"]."' style='color:#b8bfba; text-decoration: none;'>redirectout</a></td><td>".' <input type="checkbox" id="autosync" name="autosync" value="yes" '.$checked.'>in progress</td></tr>';
echo "<td style='vertical-align: top;'></td><td></tr>";
if ($channelInfoNew[$channelInfoKey]["autosync"]==1) { $checked="checked"; } else $checked="";
echo "<tr><td>autosync:</td><td>".' <input type="checkbox" id="autosync" name="autosync" value="yes" '.$checked.'></td></tr>';
echo "<td style='vertical-align: top;'>to:</td><td></tr><ul>";
if (!array_key_exists("-1", $channelInfoNew[$channelInfoKey]["to"])) {
echo "<table>";
foreach(array_keys($channelInfoNew[$channelInfoKey]["to"]) as $to) {
if ($channelInfoNew[$channelInfoKey]["to"][$to]["to_topic"] == -1) {$topicid=""; } else $topicid=":".$channelInfoNew[$channelInfoKey]["to"][$to]["to_topic"];
$topicname=$channelInfoNew[$channelInfoKey]["to"][$to]["topic_name"];
// echo '<script> infoarray[[0][\'text\']]="do u want remove"; infoarray[[0][\'channelInfoKey\']]='.$channelInfoKey.'; infoarray[[0][\'to\']]="'.$channelInfoNew[$channelInfoKey]["to"][$to]["name"].'";</script>';
// echo "<script> alert(infoarray[[3]['to']]); </script>";
echo "<td><li> <a style='color: #b8bfba; text-decoration:none;' href='javascript:editchannel(".$channelInfoNew[$channelInfoKey]["to"][$to]["chanid"].");'> <p style='display:inline' title='".$channelInfoNew[$channelInfoKey]["to"][$to]["name"]."'>".$channelInfoNew[$channelInfoKey]["to"][$to]["chanid"]."</p><p style='display:inline' title='topic: ".$topicname."'>".$topicid."</p></li></a></td>";
echo "<td><a style='text-decoration:none;' title='edit' href='javascript:yesno(infoarray)'>🈚</a></td>";
echo "<td><a style='text-decoration:none;' title='remove' href='javascript:yesno(infoarray)'>❌</a></td>";
echo "<tr>";
/// href=javascript:yesno('do u want to remove: .".$channelInfoNew[$channelInfoKey]["to"][$to]["name"]." ')>❌
} // foreach($channelInfoNew[$channelInfoKey]["to"] as $to)
} else {
echo "<li>no target channels configured</li><tr>";
}// if (!array_key_exists("-1", $channelInfoNew[$channelInfoKey]["to"]))
echo "<td><a style='text-decoration:none;' title='add' href='#'></a></td><td></td></table></ul> </td></tr>";
} // if ($channelInfoNew[$channelInfoKey] == $cmd )
} // foreach(array_keys($channelInfoNew) as $channelInfoKey)
echo '</form>';
echo '</table>';
echo "<br>";
} // function end
?>