// if there IS a query $result = mysql_query($query); if (!$result) { log_error(__FILE__ . ':' . __LINE__, 'Error executing query: <i>' . mysql_error() . '</i>; Query is: <code>' . $query . '</code>'); die(STANDARD_ERROR); } while ($row = mysql_fetch_array($result)) { $collective_total_fans_approved += $row['rowcount']; } } // collective total fans (pending) $collective_total_fans = 0; $ownedarray = get_owned('current'); $query = ''; foreach ($ownedarray as $o) { $info = get_listing_info($o); $table = $info['dbtable']; $dbserver = $info['dbserver']; $dbdatabase = $info['dbdatabase']; $dbuser = $info['dbuser']; $dbpassword = $info['dbpassword']; if ($dbserver != $db_server || $dbdatabase != $db_database || $dbuser != $db_user || $dbpassword != $db_password) { // if not on same database, get counts NOW $db_link = mysql_connect($dbserver, $dbuser, $dbpassword); if ($db_link === false) { continue; } // if it can't be accessed; if not, skip this one $connected = mysql_select_db($dbdatabase); if (!$connected) { continue;
require_once $install_path . 'Mail.php'; // functions // functions if (!function_exists('clean')) { function clean($data) { $data = trim(htmlentities(strip_tags($data), ENT_QUOTES)); if (get_magic_quotes_gpc()) { $data = stripslashes($data); } $data = addslashes($data); return $data; } } // get listing info $info = get_listing_info($listing); // initialize variables $show_form = true; $messages = array(); $errorstyle = ' style="font-weight: bold; display: block;" ' . 'class="show_update_error"'; $data = array(); // process forms if (isset($_POST['enth_update']) && $_POST['enth_update'] == 'yes') { // do some spam/bot checking first $goahead = false; $badStrings = array('Content-Type:', 'MIME-Version:', 'Content-Transfer-Encoding:', 'bcc:', 'cc:', 'content-type', 'onload', 'onclick', 'javascript'); // 1. check that user is submitting from browser // 2. check the POST was indeed used // 3. no bad strings in any of the form fields if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['REQUEST_METHOD'] == 'POST') { foreach ($_POST as $k => $v) {
$total = count(get_owned()); } ?> <table> <tr><th> </th> <th>ID</th> <th>Title</th> <th>Subject/URL</th> <th>Category</th> <th>Image</th> <th>Action</th> </tr> <?php $shade = false; foreach ($ids as $id) { $info = get_listing_info($id); $class = ''; if ($shade) { $class = ' class="rowshade"'; $shade = false; } else { $shade = true; } $dir = get_setting('owned_images_dir'); $root_web = get_setting('root_path_web'); $root_abs = get_setting('root_path_absolute'); $dir = str_replace($root_abs, $root_web, $dir); $image = $info['imagefile'] && is_file($dir . $info['imagefile']) ? getimagesize($dir . $info['imagefile']) : array(); // make sure $image is an array, in case getimagesize() failed if (!is_array($image)) { $image = array();
function show_edit_forms() { require 'config.php'; $info = get_listing_info($_REQUEST['id']); ?> <div class="submenu"> <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> &type=database">Database</a> <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> &type=info">Info</a> <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> &type=settings">Settings</a> <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> &type=emails">Emails</a> <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> &type=templates">Templates</a> </div> <p>This page allows you to edit information and settings for the <i><?php echo $info['title']; ?> : <?php echo $info['subject']; ?> <?php echo $info['listingtype']; ?> </i>. Click on one of the submenu items to modify the <?php echo $info['listingtype']; ?> . </p> <h2>Quick <?php echo $info['listingtype']; ?> stats</h2> <?php $stats = get_listing_stats($info['listingid']); // prepare date format $lastupdated = @date(get_setting('date_format'), strtotime($stats['lastupdated'])); $countries = $stats['countries']; $average = $stats['average']; ?> <p><b>Last updated:</b> <?php echo $lastupdated; ?> <br /> <b>Members:</b> <?php echo $stats['total']; echo $info['country'] == 1 ? ' from ' . $countries . ' countries' : ''; ?> , <?php echo $stats['pending']; ?> pending<br /> <b>Growth rate:</b> <?php echo $average; ?> per day since opening </p> <?php if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'database') { ?> <form action="owned.php" method="post"> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="done" value="yes" /> <input type="hidden" name="type" value="database" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?> " /> <table> <tr><th colspan="2">Database/fields Settings</th></tr> <tr><td> Server </td><td style="text-align: left;"> <input type="text" name="dbserver" value="<?php echo $info['dbserver']; ?> " /> </td></tr> <tr class="rowshade"><td> Name </td><td style="text-align: left;"> <input type="text" name="dbdatabase" value="<?php echo $info['dbdatabase']; ?> " /> </td></tr> <tr><td> User </td><td style="text-align: left;"> <input type="text" name="dbuser" value="<?php echo $info['dbuser']; ?> " /> </td></tr> <tr class="rowshade"><td> Table </td><td style="text-align: left;"> <input type="text" name="dbtable" value="<?php echo $info['dbtable']; ?> " /> </td></tr> <tr><td> Password </td><td style="text-align: left;"> <small>Fill out only if changing the password.</small><br /> <input type="password" name="dbpassword" /> <input type="password" name="dbpasswordv" /> </td></tr> <tr class="rowshade"><td> Country field </td><td style="text-align: left;"> <?php if ($info['country'] == 1) { ?> <input type="radio" name="country" value="leave" checked="checked" /> Leave as is (Enabled)<br /> <input type="radio" name="country" value="disable" /> Disable (will delete current values from database!)<br /> <?php } else { ?> <input type="radio" name="country" value="leave" checked="checked" /> Leave as is (Disabled)<br /> <input type="radio" name="country" value="enable" /> Enable<br /> <?php } ?> </td></tr> <tr><td> Affiliates </td><td style="text-align: left;"> <input type="radio" name="affiliates" value="leave" checked="checked" /> Leave as is <?php if ($info['affiliates'] == 0) { echo ' (Disabled)<br />'; echo '<input type="radio" name="affiliates" value="enable" /> Yes, '; echo 'images directory at <input type="text" name="affiliatesdir" ' . '/><br /><small>' . 'Please don\'t forget the trailing slash; this folder (absolute ' . 'path, i.e., /home/user/public_html/images/) must have ' . 'proper permissions set (i.e., must be CHMODed to ' . '755).</small><br />'; } else { echo ' (Enabled)<br />'; echo '<input type="radio" name="affiliates" value="rename" /> Move '; echo 'images directory to <input type="text" name="affiliatesdir" ' . 'value="' . $info['affiliatesdir'] . '" /><br /><small>' . 'Please don\'t forget the trailing slash; this folder (absolute ' . 'path, i.e., /home/user/public_html/images/) must have ' . 'proper permissions set (i.e., must be CHMODed to ' . '755).</small><br />'; echo '<input type="radio" name="affiliates" value="disable" /> '; echo 'Disable'; } ?> </td></tr> <tr class="rowshade"><td> Additional Fields </td><td style="text-align: left;"> <small>Click the "+" sign if you need more additional field fields below. You may edit the name of the existing fields by modifying the field directly, or deleting existing fields by removing the name entirely from the field.<br /> Additional fields must be ALL LOWERCASE, with NO SPACES and NO PUNCTUATION and NO SPECIAL CHARACTERS; if you wish for the field to have a space in its "name", use an underscore. For example: <i>favorite_book, do_you_like_apples</i><br /> Deleting an existing field will cause its contents to be discarded and this cannot be undone.</small><br /> <?php $fields = explode(',', $info['additional']); $printed = 0; foreach ($fields as $f) { if ($f != '') { $printed++; echo '<div style="padding: 2px;"> ' . $printed . ' <input type="text" name="additional[]" value="' . $f . '" /> </div>'; } } ?> <div id="multifields" style="padding: 2px; display: block;"> <input type="text" name="additional[]" /> <input type="button" value="+" onclick="moreFields()" /> <input type="button" value="x" onclick="this.parentNode.parentNode.removeChild(this.parentNode);" /> </div> <span id="multifieldshere"></span> </td></tr> <tr><td colspan="2" class="right"> <input type="submit" value="Update database settings" /> <input type="reset" value="Reset form values" /> <input type="button" value="Cancel" onclick="javascript:window.location='owned.php';" /> </td></tr> </table></form> <?php } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'info') { ?> <form action="owned.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="done" value="yes" /> <input type="hidden" name="type" value="info" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?> " /> <table> <tr><th colspan="2">Listing information</th></tr> <tr><td> Category Listing Category </td><td> <select name="catid[]" multiple="multiple" size="5"> <?php $cats = enth_get_categories(); $options = array(); foreach ($cats as $cat) { $optiontext = $cat['catname']; if (count($ancestors = array_reverse(get_ancestors($cat['catid']))) > 1) { // get ancestors $text = ''; foreach ($ancestors as $a) { $text .= get_category_name($a) . ' > '; } $optiontext = rtrim($text, ' > '); $optiontext = str_replace('>', '»', $optiontext); } $options[] = array('text' => $optiontext, 'id' => $cat['catid']); } usort($options, 'category_array_compare'); $selected = explode('|', $info['catid']); foreach ($options as $o) { echo '<option value="' . $o['id']; if (in_array($o['id'], $selected)) { echo '" selected="selected'; } echo '">' . $o['text'] . '</option>'; } ?> </select> </td></tr> <tr class="rowshade"><td> Subject </td><td> <input type="text" name="subject" value="<?php echo $info['subject']; ?> " /> </td></tr> <tr><td> Email </td><td> <input type="text" name="email" value="<?php echo $info['email']; ?> " /> </td></tr> <tr class="rowshade"><td> URL </td><td> <input type="text" name="url" value="<?php echo $info['url']; ?> " /> </td></tr> <tr><td> Title </td><td> <input type="text" name="title" value="<?php echo $info['title']; ?> " /> </td></tr> <tr class="rowshade"><td> Listing type </td><td> <input type="text" name="listingtype" value="<?php echo $info['listingtype']; ?> " /> </td></tr> <tr><td> Description </td><td> <textarea name="desc" rows="3" cols="30"><?php echo $info['desc']; ?> </textarea> </td></tr> <tr class="rowshade"><td rowspan="3"> Image </td><td> <?php $dir = get_setting('owned_images_dir'); if ($info['imagefile'] == '' || !is_file($dir . $info['imagefile'])) { echo 'No image specified.'; } else { $root_web = get_setting('root_path_web'); $root_abs = get_setting('root_path_absolute'); @($image = getimagesize($dir . $info['imagefile'])); $dir = str_replace($root_abs, $root_web, $dir); $dir = str_replace('\\', '/', $dir); echo '<img src="' . $dir . $info['imagefile'] . '" ' . $image[3] . ' border="0" alt="" />'; } ?> </td></tr><tr class="rowshade"><td> <input type="radio" name="image_change" value="no" checked="checked" /> Leave as it is<br /> <input type="radio" name="image_change" value="delete" /> Delete image<br /> <input type="radio" name="image_change" value="yes" /> Change with: </td></tr><tr class="rowshade"><td> <input type="file" name="image" /> </td></tr> <tr><td> Status </td><td> <select name="status"> <?php if ($info['status'] == 0) { echo '<option value="pending">Leave as is (Pending)</option>'; echo '<option value="pending">--</option>'; } else { if ($info['status'] == 1) { echo '<option value="upcoming">Leave as is (Upcoming)</option>'; echo '<option value="upcoming">--</option>'; } else { if ($info['status'] == 2) { echo '<option value="current">Leave as is (Current)</option>'; echo '<option value="current">--</option>'; } } } ?> <option value="pending">Pending</option> <option value="upcoming">Upcoming</option> <option value="current">Current</option> </select> </td></tr> <tr class="rowshade"><td> Date opened </td><td> <select name="date_day"> <option value="<?php echo @date('j', strtotime($info['opened'])); ?> ">Current (<?php echo @date('j', strtotime($info['opened'])); ?> )</option> <?php for ($i = 1; $i <= 31; $i++) { echo '<option>' . $i . '</option>'; } ?> </select> <select name="date_month"> <option value="<?php echo @date('n', strtotime($info['opened'])); ?> ">Current (<?php echo @date('F', strtotime($info['opened'])); ?> )</option> <option value="01">January</option> <option value="02">February</option> <option value="03">March</option> <option value="04">April</option> <option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="date_year"> <option value="<?php echo @date('Y', strtotime($info['opened'])); ?> ">Current (<?php echo @date('Y', strtotime($info['opened'])); ?> )</option> <?php for ($year = date('Y'); $year >= 2000; $year--) { echo '<option>' . $year . '</option>'; } ?> </select> </td></tr> <tr><td colspan="2" class="right"> <input type="submit" value="Update information" /> <input type="reset" value="Reset form values" /> <input type="button" value="Cancel" onclick="javascript:window.location='owned.php';" /> </td></tr> </table></form> <?php } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'settings') { ?> <form action="owned.php" method="post"> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="done" value="yes" /> <input type="hidden" name="type" value="settings" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?> " /> <table> <tr><th colspan="2">Management/look settings</th></tr> <tr><td> Hold member updates </td><td style="text-align: left;"> <?php if ($info['holdupdate'] == 1) { ?> <input type="radio" name="holdupdate" value="leave" checked="checked" /> Leave as is (Enabled)<br /> <input type="radio" name="holdupdate" value="disable" /> Disable<br /> <?php } else { ?> <input type="radio" name="holdupdate" value="leave" checked="checked" /> Leave as is (Disabled)<br /> <input type="radio" name="holdupdate" value="enable" /> Enable<br /> <?php } ?> <small>This setting will determine whether a member who updates his/her information will be placed back on pending or not.</small> </td></tr> <tr class="rowshade"><td> Pending notify </td><td style="text-align: left;"> <?php if ($info['notifynew'] == 1) { ?> <input type="radio" name="notifynew" value="leave" checked="checked" /> Leave as is (Enabled)<br /> <input type="radio" name="notifynew" value="disable" /> Disable<br /> <?php } else { ?> <input type="radio" name="notifynew" value="leave" checked="checked" /> Leave as is (Disabled)<br /> <input type="radio" name="notifynew" value="enable" /> Enable<br /> <?php } ?> <small>This setting will determine if you will be notified via email when a member has been added/placed on the pending queue.</small> </td></tr> <tr><td> Dropdown sorting </td><td style="text-align: left;"> <?php if ($info['dropdown'] == 1) { ?> <input type="radio" name="dropdown" value="leave" checked="checked" /> Leave as is (Enabled)<br /> <input type="radio" name="dropdown" value="disable" /> Disable<br /> <?php } else { ?> <input type="radio" name="dropdown" value="leave" checked="checked" /> Leave as is (Disabled)<br /> <input type="radio" name="dropdown" value="enable" /> Enable<br /> <?php } ?> </td></tr> <tr class="rowshade"><td> Sort members by </td><td style="text-align: left;"> <input type="text" name="sort" value="<?php echo $info['sort']; ?> " /><br /> <small>This is the database field that will determine how your members are sorted. This can be either any of your additional fields or by 'country'. Sorting by multiple fields are allowed -- separate fields using a comma (,).</small> </td></tr> <tr><td> Members per page </td><td style="text-align: left;"> <input type="text" name="perpage" value="<?php echo $info['perpage']; ?> " /><br /> </td></tr> <tr class="rowshade"><td> Link target </td><td style="text-align: left;"> <input type="text" name="linktarget" value="<?php echo $info['linktarget']; ?> " /><br /> </td></tr> <tr><td> Join page </td><td style="text-align: left;"> <input type="text" name="joinpage" value="<?php echo $info['joinpage']; ?> " /><br /> </td></tr> <tr class="rowshade"><td> List page </td><td style="text-align: left;"> <input type="text" name="listpage" value="<?php echo $info['listpage']; ?> " /><br /> </td></tr> <tr><td> Update page </td><td style="text-align: left;"> <input type="text" name="updatepage" value="<?php echo $info['updatepage']; ?> " /><br /> </td></tr> <tr class="rowshade"><td> Lostpass page </td><td style="text-align: left;"> <input type="text" name="lostpasspage" value="<?php echo $info['lostpasspage']; ?> " /><br /> </td></tr> <tr><td colspan="2" class="right"> <input type="submit" value="Update settings" /> <input type="reset" value="Reset form values" /> <input type="button" value="Cancel" onclick="javascript:window.location='owned.php';" /> </td></tr> </table></form> <?php } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'emails') { ?> <form action="owned.php" method="post"> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="done" value="yes" /> <input type="hidden" name="type" value="emails" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?> " /> <table> <tr><th colspan="2">Email Templates</th></tr> <tr><td> Signup email </td><td> <textarea name="emailsignup" rows="10" cols="60"><?php echo $info['emailsignup']; ?> </textarea> </td></tr> <tr class="rowshade"><td> Approval email </td><td> <textarea name="emailapproved" rows="10" cols="60"><?php echo $info['emailapproved']; ?> </textarea> </td></tr> <tr><td> Update info email </td><td> <textarea name="emailupdate" rows="10" cols="60"><?php echo $info['emailupdate']; ?> </textarea> </td></tr> <tr class="rowshade"><td> Lost password email </td><td> <textarea name="emaillostpass" rows="10" cols="60"><?php echo $info['emaillostpass']; ?> </textarea> </td></tr> <tr><td colspan="2" class="right"> <input type="submit" value="Update emails" /> <input type="reset" value="Reset form values" /> <input type="button" value="Cancel" onclick="javascript:window.location='owned.php';" /> </td></tr> </table></form> <?php } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'templates') { ?> <form action="owned.php" method="post"> <input type="hidden" name="action" value="edit" /> <input type="hidden" name="done" value="yes" /> <input type="hidden" name="type" value="templates" /> <input type="hidden" name="id" value="<?php echo $_REQUEST['id']; ?> " /> <table> <tr><th colspan="2">Website Templates</th></tr> <tr><td> Members List </td><td> <textarea name="listtemplate" rows="10" cols="60"><?php echo $info['listtemplate']; ?> </textarea> </td></tr> <tr class="rowshade"><td> Affiliates </td><td> <textarea name="affiliatestemplate" rows="10" cols="60"><?php echo $info['affiliatestemplate']; ?> </textarea> </td></tr> <tr><td> Statistics </td><td> <textarea name="statstemplate" rows="10" cols="60"><?php echo $info['statstemplate']; ?> </textarea> </td></tr> <tr class="rowshade"><td colspan="2" class="right"> <input type="submit" value="Update templates" /> <input type="reset" value="Reset form values" /> <input type="button" value="Cancel" onclick="javascript:window.location='owned.php';" /> </td></tr> </table></form> <?php } } } } } }
</select> </td></tr> <tr class="rowshade"><td colspan="2" class="right"> <input type="submit" value="Send email" /> </td></tr> </table></form> <?php } } /*___________________________________________________________________MEMBERS_*/ if ($action == 'members') { $show_default = false; $show_form = true; $info = get_listing_info($_REQUEST['id']); $from = '"' . html_entity_decode($info['title'], ENT_QUOTES) . '" <' . $info['email'] . '>'; if (isset($_POST['send']) && $_POST['send'] == 'yes') { $subject = ''; $body = ''; // get all members $members = get_members($_POST['id'], 'approved'); foreach ($members as $mem) { if ($_POST['emailtemplate'] == 'no') { $sendthis = parse_email_text($_POST['emailsubject'], $_POST['emailbody'], $mem['email'], $_POST['id']); $subject = $sendthis['subject']; $body = $sendthis['body']; } else { $sendthis = parse_template($_POST['emailtemplate'], $mem['email'], $_POST['id']); $subject = $sendthis['subject']; $body = $sendthis['body'];
">Template</a> <a href="emails.php?action=affiliates&id=<?php echo $listing; ?> ">Email</a> </div> <form action="affiliates.php" method="get"> <p class="right"> Manage: <select name="listing"> <option value="collective">Collective affiliates</option> <?php $owned = get_owned(); foreach ($owned as $id) { $own = get_listing_info($id); if ($own['affiliates'] == 1) { echo '<option value="' . $id; if (isset($_REQUEST['listing']) && $_REQUEST['listing'] == $id) { echo '" selected="selected'; } echo '">' . $own['subject'] . ' ' . $own['listingtype'] . ' affiliates </option>'; } } ?> </select> <input type="submit" value="Manage" /> </p></form> <p>
function show_step2() { require 'config.php'; $info = get_listing_info('', $_POST['dbtable']); ?> <p> <b>Congratulations!</b> Your listing information and database has been set up successfully. Your new listing has the Listing ID <b><?php echo $info['listingid']; ?> </b>. You can now continue on to <a href="owned.php?action=edit&id=<?php echo $info['listingid']; ?> ">this page</a> to continue customizing the listing. </p> <?php }