Subversion-Projekte lars-tiefland.php_share

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php
// +------------------------------------------------------------------------+
// | Content_Active                                                         |
// +------------------------------------------------------------------------+
// | Copyright (c) 2000-2007 Markus Niewerth                                |
// | Email         markus@niewerth.com                                      |
// | Web           http://www.gamerzzone.de                                 |
// | Mirror        http://content-active.gamerzzone.de                          |
// +------------------------------------------------------------------------+
// | This source file is subject to version 3.00 of the PHP License,        |
// | that is available at http://www.php.net/license/3_0.txt.               |
// | If you did not receive a copy of the PHP license and are unable to     |
// | obtain it through the world-wide-web, please send a note to            |
// | license@php.net so we can mail you a copy immediately.                 |
// +------------------------------------------------------------------------+
// | License Informations                                                   |
// +------------------------------------------------------------------------+
// | Copyright (c) 2000-2007,Markus Niewerth                                |
// | All rights reserved.                                                   |
// |                                                                        |
// | Redistribution and use in source and binary forms, with or without     |
// | modification, are permitted provided that the following conditions     |
// | are met:                                                               |
// |                                                                        |
// | o Redistributions of source code must retain the above copyright       |
// |   notice, this list of conditions and the following disclaimer.        |
// | o Redistributions in binary form must reproduce the above copyright    |
// |   notice, this list of conditions and the following disclaimer in the  |
// |   documentation and/or other materials provided with the distribution. | 
// | o The names of the authors may not be used to endorse or promote       |
// |   products derived from this software without specific prior written   |
// |   permission.                                                          |
// |                                                                        |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS    |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT      |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  |
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT   |
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  |
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT       |
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT    |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.   |
// |                                                                        |
// +------------------------------------------------------------------------+
// | Author: Markus Niewerth <markus@niewerth.com>                          |
// +------------------------------------------------------------------------+ 
error_reporting(E_ALL & ~E_NOTICE);
ini_set("register_globals", "On");

$baseConfig['emailconfig.default.inc.php'] = "local_s/__classes/";

 //require(substr(PHP_OS, 0, 3)=='WIN' ? 'config.php' : 'config.php');

require_once('local_s/__classes/Email_Safe.class.php');



/*
if (!file_exists("email.conf.php")) 
        $eSafe->copyConfig();
$eSafe->add("markus@gamerzzone.de");
*/

$self=basename($PHP_SELF);
$action = $_GET['action'];
// -------------------------
// Email config file
$emailConfig = "emailconfig.inc.php";
// -------------------------

// -------------------------

function pre($arr) {
        print("<pre>");
        print_r($arr);
        print("</pre>");
}

// pre($_POST);

if ($_POST['create_config'] && $_POST['ID']) {
        $dest = $_POST['webPath'].$_POST['sourceConfig'];
        $base = $baseConfig[$_POST['sourceConfig']].$_POST['sourceConfig'];
        $eSafe = &new Email_Safe($dest);
        
        if (!file_exists($dest)) 
                $eSafe->copyConfig(false,$base);
                
        $print = NULL;
        
        foreach($_POST['attach'] AS $email) {
                if (!empty($email)) {   
                        if ( $erg = $eSafe->add($email) ) 
                                $print .= "Hinzugef&uuml;gt: $email, <br>Code: <input type='text'  size='40' value='".md5($email)."'><hr>\n";
                }
        }
        //
        if(isset($erg)) {
                $print .=  "<hr><textarea name=\"textarea\" id=\"textarea\" cols=\"60\" wrap=\"off\" rows=\"".(sizeof($erg)+5)."\">".@implode("",$erg)."</textarea>";
        }
}

?>



<script language="JavaScript">
<!--

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function addAttach(obj)
{
        source=document.getElementById(obj)
        clone=source.cloneNode(true);
        clone.removeAttribute("id");
        
        source.parentNode.appendChild(clone);
}

function removeAttach(obj)
{
        div = obj.parentNode;
        td = obj.parentNode.parentNode;
        if (!div.id)  { td.removeChild(div); }
}

function removeEmail(obj)
{
        obj=document.getElementById(obj)
        div = obj.parentNode;
        td = obj.parentNode.parentNode;
        if (!div.id)  { td.removeChild(div); }
}
//-->
</script>
<style type="text/css">
<!--
.Stil1 {color: #FFFFFF}
-->
</style>
<body bgcolor="#FFFFFF" leftmargin="20" topmargin="10" marginwidth="20" marginheight="10" text="#000096">
<form method="post" action="#" name="formname" enctype="multipart/form-data">
  <table width="662" border="0" cellspacing="0" cellpadding="0">
    <tr valign="top"> 
      <td width="585"> 
<!--  Auswahl Löschen START  --><!--  Auswahl SELECT_EDIT ENDE  -->

<?
        if ($_GET['action']=="edit")
        {
        ?> 
            <table width="100%" border="1" cellspacing="0" cellpadding="3" bordercolorlight="#FFFFFF" bordercolordark="#999999">
          <tr bgcolor="#000099"> 
            <td colspan="2" class="headline Stil1">Email Konfiguration: 
              <?
                                        if ($_POST['configFile'] || ($_POST['sourceConfig'] && $_POST['create_config']))
                                        {
                                         ?>
              Bearbeiten 
              <?
                                        }
                                        else
                                        {
                                         ?>
              Erstellen 
              <?
                                        }
                                ?>            </td>
          </tr>
          <tr>
            <td valign="top" bgcolor="#000099" class="headline Stil1">Basis:</td>
            <td>
                          <?php
                                        if ($_POST['sourceConfig']) {
                          ?>
              <input name="configFile" type="text" id="configFile" value="<?php echo $baseConfig[$_POST['sourceConfig']].$_POST['sourceConfig'] ?>" size="40">
                          <?php
                                        } elseif ($_POST['configFile']) {
                                        
                          ?>
              <input name="configFile" type="text" id="configFile" value="<?php echo $_POST['configFile'] ?>" size="40">
                          <?php
                                        } else {
                          ?>
              <input name="configFile" type="text" id="configFile" size="40">
                          <?php
                                        }
                          ?>
                          <? if (!($_POST['sourceConfig'] && $_POST['create_config'])) { ?>
              <br>
              <input name="create_config" type="checkbox" id="create_config" value="create">
              Konfig neu erstellen auf Basis von 
              <select name="sourceConfig" id="sourceConfig">
                <?php
                                        foreach (array_keys($baseConfig) AS $fileName) {
                                ?>
                <option>
                  <?= $fileName ?>
                </option>
                <?php
                                        }
                                ?>
              </select>
              <? } else { ?> 
                                <br />
                          WebPfad: 
                                <input name="webPath" type="text" id="webPath" value="<?= $_POST['webPath'] ?>">
              <input name="create_config" type="hidden" id="create_config" value="<?php echo $_POST['create_config'] ?>">
              <input name="sourceConfig" type="hidden" id="sourceConfig" value="<?php echo $_POST['sourceConfig'] ?>">
              <? } ?>              </td>
          </tr>
                  <!-- Emails -->
                  <?php
                                if (is_array($eMails) && sizeof($eMails) > 0) {
                                        foreach (array_keys($eMails) AS $emailID) {
                  ?>
                  <div id="mailList">
          <tr> 
            <td width="13%" valign="top" bgcolor="#000099" class="headline Stil1">Vorhandene:</td>
                        <td>
                        
                          <input name="attach[]" type="text" id="attach[]" value="<?= $eMails[$emailID] ?>">
                          <input type="button" value=" - " onClick="removeMail('mailList')">
                          <textarea name="textarea" cols="45" rows="5" wrap="off" id="textarea"></textarea>           </td>
          </tr>
                  </div>
                  <?php
                                        }
                                }
                  ?>
          <tr> 
            <td width="13%" valign="top" bgcolor="#000099" class="headline Stil1">Add Email:</td>
                        <td>
                        <div id="mailAttach">
                          <input name="attach[]" type="text" id="attach[]">
                          <input type="button" value=" + " onClick="addAttach('mailAttach')">
                          <input type="button" value=" - " onClick="removeAttach(this)">
                        </div>                  </td>
          </tr>
          <!-- // Emails Ende  -->
          <tr bgcolor="#000099"> 
            <td align="right" colspan="2"> 
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr> 
                  <td width="13%">&nbsp;                    </td>
                  <td width="87%" align="right"> 
                    <input name="ID" type="hidden" id="ID" value="<?php echo $_POST['configFile'] ?>">
                    <input type="hidden" name="action" value="update">
                    <input type="submit" value="OK">
                    <input type="reset" name="Button" value="Zur&uuml;cksetzen">                  </td>
                </tr>
                                <?php
                         if ($print) {
                ?>
                <tr bordercolorlight="#FFFFFF" bordercolordark="#999999">
                  <td valign="top" bgcolor="#000099" class="headline Stil1">Ergebnis:</td>
                  <td bgcolor="#FFFFFF"><?= $print ?>                  </td>
                </tr>
                                <?php
                         }
                ?>
            </table>
            </td>
          </tr>
        </table>
        
<?
        }
?> </td>
      <td width="77" align="right"> 
        <table width="67" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#FFFFFF" bordercolordark="#999999">
                <tr> 
            <td class="frame"><a href="<? echo $self ?>?action=edit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/navigation/bt_neu_f2.gif',1)"><img name="Image5" border="0" src="images/navigation/bt_neu.gif" width="67" height="40"></a></td>
                </tr>
                <tr> 
            <td class="frame"><a href="<? echo $self ?>?action=select_edit" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','images/navigation/bt_bearbeiten_f2.gif',1)"><img name="Image6" border="0" src="images/navigation/bt_bearbeiten.gif" width="67" height="40"></a></td>
                </tr>
                <tr> 
            <td class="frame"><a href="<? echo $self ?>?action=delete" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','images/navigation/bt_delete_f2.gif',1)"><img name="Image7" border="0" src="images/navigation/bt_delete.gif" width="67" height="40"></a></td>
                </tr>
                <tr>
                  <td class="frame"><a href="<? echo $self ?>?action=check" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('999','','images/navigation/bt_neu_f2.gif',1)"><img src="images/navigation/bt_neu.gif" alt="Check Webs" name="Image5" width="67" height="40" border="0"></a></td>
                  </tr>
                </table>
      </td>
</tr>
</table>
</form>
</body>