<?php
/*
###################################################################################
  Bigware Shop 2.3
  Release Datum: 23.08.2015
  
  Bigware Shop
  http://www.bigware.de

  Copyright (c) 2015 Bigware LTD
  (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
  (c) 2015	Bigware LTD

  Copyrightvermerke duerfen nicht entfernt werden.
  ------------------------------------------------------------------------
  Dieses Programm ist freie Software. Sie koennen es unter den Bedingungen
  der GNU General Public License, wie von der Free Software Foundation
  veroeffentlicht, weitergeben und/oder modifizieren, entweder gemaess Version 2 
  der Lizenz oder (nach Ihrer Option) jeder spaeteren Version.
  Die Veroeffentlichung dieses Programms erfolgt in der Hoffnung, dass es Ihnen
  von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
  implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FUER EINEN
  BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
  
  Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
  Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

  Infos:
  ------------------------------------------------------------------------
  Der Bigware Shop wurde vor vielen Jahren bereits aus dem bekannten Shopsystem osCommerce
  weiter- und neuentwickelt.
  Der Bigware Shop legt im hohen Masse Wert auf Bedienerfreundlichkeit, beinhaltet eine leichte
  Installation, viele neue professionelle Werkzeuge und zeichnet sich aus durch eine grosse 
  Community, die bei Problemen weiterhelfen kann.
  
  Der Bigware Shop ist auf jedem System lauffaehig, welches eine PHP Umgebung
  (ab PHP 4.1.3) und mySQL zur Verfuegung stellt und auf Linux basiert.
 
  Hilfe erhalten Sie im Forum auf www.bigware.de 
  
  -----------------------------------------------------------------------
  
 ##################################################################################




*/
?>
<?php
  require('load_this/load_bigware_11.php'); 
  function go_encrypt_password2($plain) {
    $password = '';
    for ($i=0; $i<10; $i++) {
      $password .= go_rand();
    }
    $salt = substr(md5($password), 0, 2);
    $password = md5($salt . $plain) . ':' . $salt;
    return $password;
  }
   function go_create_random_value($length, $type = 'mixed') {
    if ( ($type != 'mixed') && ($type != 'chars') && ($type != 'digits')) return false;
    $rand_value = '';
    while (strlen($rand_value)<$length) {
      if ($type == 'digits') {
        $char = go_rand(0,9);
      } else {
        $char = chr(go_rand(0,255));
      }
      if ($type == 'mixed') {
        if (preg_match('/^[a-z0-9]$/i', $char)) $rand_value .= $char;
      } elseif ($type == 'chars') {
        if (preg_match('/^[a-z]$/i', $char)) $rand_value .= $char;
      } elseif ($type == 'digits') {
        if (preg_match('/^[0-9]$/i', $char)) $rand_value .= $char;
      }
    }
    return $rand_value;
  }	
	
	
  if ($_GET['action']) {
    switch ($_GET['action']) {
        case 'confirmaccept':				
				$attendees_group_id = go_db_producing_input($_POST['attendees_group_id']);
				$attendees_id = go_db_producing_input($_GET['bigID']); 
				$sql_data_array = array('member_level' => '1',
																'attendees_group_id' => $attendees_group_id);
				go_db_carry('attendees', $sql_data_array, 'update', 'attendees_id=\''. $attendees_id .'\' ');
        
        $check_attendee_query = go_db_query("select attendees_firstname, attendees_lastname, attendees_password, attendees_id, attendees_email_address from " . DB_TBL_ATTENDEES . " where attendees_id = '" . $_GET['bigID'] . "'");
        $check_attendee = go_db_fetch_array($check_attendee_query); 
        $newpass = go_create_random_value(TYPE_IN_PASSWORD_MIN_LENGTH);
        $crypted_password = go_encrypt_password2($newpass);
        go_db_query("update " . DB_TBL_ATTENDEES . " set attendees_password = '" . $crypted_password . "' where attendees_id = '" . $check_attendee['attendees_id'] . "'"); 
        go_mail($check_attendee['attendees_firstname'], $check_attendee['attendees_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), SHOP_OWNER, SHOP_OWNER_EMAIL_ADDRESS, '');
				go_mail($check_attendee['attendees_firstname'] . " " . $check_attendee['attendees_lastname'], $check_attendee['attendees_email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY,$check_attendee['attendees_email_address'], $newpass)), SHOP_OWNER, SHOP_OWNER_EMAIL_ADDRESS);
				
				
				
				$_GET['action'] = '';
        $_GET['bigID'] = '';						
        break;
      case 'deleteconfirm':
        $attendees_id = go_db_producing_input($_GET['bigID']);
        if ($_POST['delete_reviews'] == 'on') {
          $reviews_query = go_db_query("select reviews_id from " . DB_TBL_REVIEWS . " where attendees_id = '" . go_db_input($attendees_id) . "'");
          while ($reviews = go_db_fetch_array($reviews_query)) {
            go_db_query("delete from " . DB_TBL_REVIERELATIV_DESCRIPTION . " where reviews_id = '" . $reviews['reviews_id'] . "'");
          }
          go_db_query("delete from " . DB_TBL_REVIEWS . " where attendees_id = '" . go_db_input($attendees_id) . "'");
        } else {
          go_db_query("update " . DB_TBL_REVIEWS . " set attendees_id = null where attendees_id = '" . go_db_input($attendees_id) . "'");
        }
        go_db_query("delete from " . DB_TBL_DIRECTORY_TO_ADDRESS . " where attendees_id = '" . go_db_input($attendees_id) . "'");
        go_db_query("delete from " . DB_TBL_ATTENDEES . " where attendees_id = '" . go_db_input($attendees_id) . "'");
        go_db_query("delete from " . DB_TBL_ATTENDEES_INFO . " where attendees_info_id = '" . go_db_input($attendees_id) . "'");
        go_db_query("delete from " . DB_TBL_ATTENDEES_BASKET . " where attendees_id = '" . go_db_input($attendees_id) . "'");
        go_db_query("delete from " . DB_TBL_ATTENDEES_BASKET_CHARACTERISTICS . " where attendees_id = '" . go_db_input($attendees_id) . "'");
        go_db_query("delete from " . DB_TBL_WHOS_ONLINE . " where attendee_id = '" . go_db_input($attendees_id) . "'");
        go_forward(go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action'))));
        break;
    }
  }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="load_this/style.css">
<script language="javascript" src="load_this/menu.js"></script>
<script language="javascript" src="load_this/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
<!-- header //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_9.php'); ?>
<!-- header_eof //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
				<?php IF (MEMBER == 'true'){ ?>
          <tr><?php echo go_fetch_form('search', NAME_OF_FILE_ATTENDEES, '', 'get'); ?>
            <td class="pageGeneralsign"><?php echo ABOVE_TITLE; ?></td>
            <td class="pageGeneralsign" align="right"><?php echo go_fetch_dividing_up('tranparentes.gif', 1, ABOVE_PICTURE_HEIGHT); ?></td>
            <td class="smallText" align="right"><?php echo ABOVE_TITLE_SEARCH . ' ' . go_fetch_inputfeld('search'); ?></td>
          </form></tr>
        </table></td>
      </tr>
      <tr>
        <td><table cellpadding="5" border="0" width="100%" cellspacing="0" cellpadding="0"> 
          <tr>
            <td valign="top"><table border="0" cellpadding="5" cellspacing="1" style="border-collapse: collapse" width="100%" id="AutoNumber1"> 
              <tr class="tbUPCountData">
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_LASTNAME; ?></td>
                <td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_FIRSTNAME; ?></td>
								<td class="tbUPDataInside"><?php echo DB_TBL_ABOVE_COMPANY; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_MEMBER_CREATED; ?></td>
                <td class="tbUPDataInside" align="right"><?php echo DB_TBL_ABOVE_ACTION; ?>&nbsp;</td>
              </tr>
<?php
    $search = '';
    if ( ($_GET['search']) && (go_not_null($_GET['search'])) ) {
      $keywords = go_db_input(go_db_producing_input($_GET['search']));
      $search = "where c.attendees_lastname like '%" . $keywords . "%' or c.attendees_firstname like '%" . $keywords . "%' or c.attendees_email_address like '%" . $keywords . "' and member_level = '0'";
    }
    if ($search =='') $search = "where member_level = '0'";
    $attendees_query_raw = "select c.attendees_id, c.attendees_lastname, c.attendees_firstname, a.entry_company, c.attendees_email_address, a.entry_land_id, c.attendees_group_id from ((" . DB_TBL_ATTENDEES . " c) left join " . DB_TBL_DIRECTORY_TO_ADDRESS . " a on c.attendees_id = a.attendees_id and c.attendees_default_address_id = a.directory_to_address_id) " . $search . " order by c.attendees_lastname, c.attendees_firstname";
    $attendees_split = new splitPageResults($_GET['page'], MAX_SHOW_SEARCH_RESULTS, $attendees_query_raw, $attendees_query_numrows);
    $attendees_query = go_db_query($attendees_query_raw);
    while ($attendees = go_db_fetch_array($attendees_query)) {
      $info_query = go_db_query("select attendees_info_date_member_created as date_member_created, attendees_info_date_member_last_modified as date_member_last_modified, attendees_info_date_of_last_logon as date_last_logon, attendees_info_number_of_logons as number_of_logons from " . DB_TBL_ATTENDEES_INFO . " where attendees_info_id = '" . $attendees['attendees_id'] . "'");
      $info = go_db_fetch_array($info_query);
      if (((!$_GET['bigID']) || (@$_GET['bigID'] == $attendees['attendees_id'])) && (!$bigwareInfo)) {
        $land_query = go_db_query("select lands_name from " . DB_TBL_LANDS . " where lands_id = '" . $attendees['entry_land_id'] . "'");
        $land = go_db_fetch_array($land_query);
        $reviews_query = go_db_query("select count(*) as number_of_reviews from " . DB_TBL_REVIEWS . " where attendees_id = '" . $attendees['attendees_id'] . "'");
        $reviews = go_db_fetch_array($reviews_query);
        $attendee_info = array_merge($land, $info, $reviews);
        $bigwareInfo_array = array_merge($attendees, $attendee_info);
        $bigwareInfo = new objectInfo($bigwareInfo_array);
      
			}
      if ( (is_object($bigwareInfo)) && ($attendees['attendees_id'] == $bigwareInfo->attendees_id) ) {
        echo '          <tr class="tbCountDataSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id . '&action=change') . '\'">' . "\n";
      } else {
        echo '          <tr class="tbCountData" onmouseover="this.className=\'tbCountDataOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'tbCountData\'" onclick="document.location.href=\'' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID')) . 'bigID=' . $attendees['attendees_id']) . '\'">' . "\n";
      }
		
?>
                <td class="TbInsideData"><?php echo $attendees['attendees_lastname']; ?></td>
                <td class="TbInsideData"><?php echo $attendees['attendees_firstname']; ?></td>
								<td class="main"><?php echo $attendees['entry_company']; ?></td>								
                <td class="TbInsideData" align="right"><?php echo go_date_short($info['date_member_created']); ?></td>
                <td class="TbInsideData" align="right"><?php if ( (is_object($bigwareInfo)) && ($attendees['attendees_id'] == $bigwareInfo->attendees_id) ) { echo go_picture(FOLDER_RELATIV_PICTURES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID')) . 'bigID=' . $attendees['attendees_id']) . '">' . go_picture(FOLDER_RELATIV_PICTURES . 'icon_info.gif', PICTURE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
              </tr></form>
<?php
    }
?>
              <tr>
                <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <tr>
                    <td class="smallText" valign="top"><?php echo $attendees_split->display_count($attendees_query_numrows, MAX_SHOW_SEARCH_RESULTS, $_GET['page'], TEXT_SHOW_NUMBER_OF_ATTENDEES); ?></td>
                    <td class="smallText" align="right"><?php echo $attendees_split->display_links($attendees_query_numrows, MAX_SHOW_SEARCH_RESULTS, MAX_SHOW_PAGE_LINKS, $_GET['page'], go_get_all_get_parameter(array('page', 'info', 'x', 'y', 'bigID'))); ?></td>
                  </tr>
<?php
    if (go_not_null($_GET['search'])) {
?>
                  <tr>
                    <td align="right" colspan="2"><?php echo '<a href="' . go_href_link(NAME_OF_FILE_ATTENDEES) . '">' . go_picture_button('button_reset.gif', PICTURE_RESET) . '</a>'; ?></td>
                  </tr>
<?php
    }
?>
                </table></td>
              </tr>
            </table></td>
<?php
  require(FOLDER_RELATIV_LANGUAGES . $language . '/' . NAME_OF_FILE_ATTENDEES);
  $heading = array();
  $contents = array();
  switch ($_GET['action']) {
    case 'confirm':
      $heading[] = array('text' => '<b>' . TEXT_INFO_ABOVE_DELETE_ATTENDEE . '</b>');
      $contents = array('form' => go_fetch_form('attendees', NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id . '&action=deleteconfirm'));
      $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $bigwareInfo->attendees_firstname . ' ' . $bigwareInfo->attendees_lastname . '</b>');
      if ($bigwareInfo->number_of_reviews > 0) $contents[] = array('text' => '<br>' . go_fetch_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $bigwareInfo->number_of_reviews));
      $contents[] = array('align' => 'center', 'text' => '<br>' . go_picture_submit('button_delete.gif', PICTURE_DELETE) . ' <a href="' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id) . '">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>');
      break;
    case 'accept':
	$email = SHOP_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_CONFIRM . "\n\n" . EMAIL_CONTACT . "\n\n" . EMAIL_WARNING . "\n\n";
          $heading[] = array('text' => '<b>' . $bigwareInfo->attendees_firstname . ' ' . $bigwareInfo->attendees_lastname . '</b>');
          $contents = array('form' => go_fetch_form('attendees', NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id . '&action=confirmaccept'));
					$contents[] = array('align' => 'center', 'text' => '<br>'. go_fetch_pull_down_menu('attendees_group_id', go_get_attendees_group(''. VISITOR_NAME .''), $bigwareInfo->attendees_group_id) .'<br>');					
					$contents[] = array('align' => 'center', 'text' => '<br>' . go_picture_submit('button_activate.gif', PICTURE_DELETE) . ' <a href="' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id) . '"">' . go_picture_button('button_cancel.gif', PICTURE_CANCEL) . '</a>');
		  break;
    default:
      if (is_object($bigwareInfo)) {
          $heading[] = array('text' => '<b>' . $bigwareInfo->attendees_firstname . ' ' . $bigwareInfo->attendees_lastname . '</b>');          										
					$contents[] = array('align' => 'center', 'text' => '<a href="' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id . '&action=accept') . '">' . go_picture_button('button_activate.gif', PICTURE_ACTIVATE) . '</a> <a href="' . go_href_link(NAME_OF_FILE_MEMBERS, go_get_all_get_parameter(array('bigID', 'action')) . 'bigID=' . $bigwareInfo->attendees_id . '&action=confirm') . '">' . go_picture_button('button_delete.gif', PICTURE_DELETE) . '</a><br><a href="' . go_href_link(NAME_OF_FILE_MAIL, 'selected_frame=tools&attendee=' . $bigwareInfo->attendees_email_address) . '">' . go_picture_button('button_email.gif', PICTURE_EMAIL) . '</a>');
      }
      break;
  }
  if ( (go_not_null($heading)) && (go_not_null($contents)) ) {
    echo '            <td width="25%" valign="top">' . "\n";
    $frame = new frame;
    echo $frame->infoBox($heading, $contents);
    echo '            </td>' . "\n";
  }
?>
          </tr>
        </table></td>
				
<?php } else { 
echo MEMBER_DEACTIVATED ;
?>
          </tr>
        </table></td>
<?php 
}
?>				
      </tr>
    </table></td>
<!-- body_text_eof //-->
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_7.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(FOLDER_RELATIV_INCLUDES . 'load_bigware_6.php'); ?>
