HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //home/httpd/mech_ftp/baretube.com/admin/rss.php
<?php
require "db.php";

if ($_POST['list']) {
    foreach ($_POST['list'] as $i) {
        if (is_numeric($i)) {
            dbQuery("DELETE FROM `rss_feed` WHERE `record_num` = '$i'");
        }
    }
}

if (isset($_POST['formSubmit'])) {
	if(is_array($_POST['niche'])) { 
		foreach($_POST['niche'] as $i) { 
			$niches[] = (int)$i;
		}
	}
	@$niches = mysqli_real_escape_string($dblink,json_encode($niches)); 
    $_POST = array_map_array('trim', $_POST);
    
    if ($_POST['name'] == "") {
        setMessage('Feed "Name" is required!', 'error');
    }

    if (!getMessages(false, 'error')) {
		
        $insert_id = dbInsert('rss_feed', array(
            'name' => $_POST['name'],
            'top' => $_POST['top'],
            'bottom' => $_POST['bottom'],
            'feed' => $_POST['feed'],
			'channels' => $niches
        ));
        setMessage("RSS Feed has been added!");
        header("Location: $_SERVER[REQUEST_URI]");
        exit();
    } else {
        entities_walk($_POST);
    }
}
?>

<? require "header.php"; ?>

<div class="content-page">

    <div class="header-area">
        <div class="breadcrumbs">
            <a href="index.php">Admin Home</a>          
            <span><a href="rss.php">RSS Feeds</a></span>  
        </div>
    </div>

    <div class="content-outer">

        <h2>Manage<strong>RSS/XML Feeds</strong></h2>

        <div class="content-inner">

            <? echo getMessages(); ?>

            <form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
                <table class="pagetable"> 
                    <thead>
                        <tr>
                            <th colspan="2">Add Feed</th>
                        </tr>
                    </thead>
                    <tr>
                        <td>Name</td>
                        <td><input name="name" type="text" required value="<? echo $_POST['name']; ?>" /></td>
                    </tr>
                    <tr>
                        <td>Top</td>
                        <td><textarea name="top" cols="35" rows="4"><? echo $_POST['top']; ?></textarea></td>
                    </tr>
                    <tr>
                        <td>Loop</td>
                        <td>
                            <textarea name="feed" cols="35" rows="15"><? echo $_POST['feed']; ?></textarea>
                            <p class="hint">Valid Tags:<br />{title} {keywords}{description} {url} {thumb_main} {thumb1-9} {embed} {pornstars} {categories} {lengthsec} {length}</p>
                        </td>
                    </tr>
                    <tr>
                        <td>Bottom</td>
                        <td><textarea name="bottom" cols="35" rows="4"><? echo $_POST['bottom']; ?></textarea></td>
                    </tr>
					<tr>
                        <td>Categories</td>
                        <td>
						<select name="niche[]" multiple="multiple" class="full-width">
                                    <?php
                                    $presult = dbQuery("SELECT * FROM niches ORDER BY name ASC", false);
                                    foreach ($presult as $srow) {
                                        ?>
                                        <option<?php echo in_array($srow['record_num'], $thisniche) ? ' selected' : ''; ?> value="<?php echo $srow['record_num']; ?>"><?php echo $srow['name']; ?></option>
                                    <?php } ?>
                                </select><br>
								(Hold ctrl to select multiple. Leave blank for all categories)
							</td>
                    </tr>
					
					
                    <tr class="item submit">
                        <td colspan="2">
                            <input type="hidden" name="formSubmit" value="1" />
                            <button type="submit" class="btn action-search">Save RSS Feed</button>
                        </td>
                    </tr>
                </table>
            </form>

            <form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
                <table class="pagetable">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>URL</th>
                            <th></th>
                            <th style="width:50px">
                                <label for="check-select-all-1" class="checkbox">
                                    <input type="checkbox" name="select_all" value="1" data-items="list[]" id="check-select-all-1">
                                    <i></i>
                                </label>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $results = dbQuery("SELECT * FROM `rss_feed` ORDER BY `name`", false); ?>
                        <? if (!is_array($results)) { ?>
                            <tr><td colspan="4"><div class="notification alert">No feeds found</div></td></tr>
                        <?php } else { ?>
                            <?php foreach ($results as $row) { ?>
                                <tr>
                                    <td><?php echo $row['name']; ?></td>
                                    <td><?php echo $basehttp; ?>/crss/<?php echo $row['record_num']; ?>?limit=1000</td>
                                    <td class="options">
                                        <a href="edit_rss.php?id=<?php echo $row['record_num']; ?>" class="btn btn-xs btn-orange" title="Edit Feed"><i class="ion ion-edit icon-edit"></i></a>
                                    </td>
                                    <td>
                                        <label class="checkbox">
                                            <input type="checkbox" name="list[]" value="<?php echo $row['record_num']; ?>" id="ids-<?php echo $row['record_num']; ?>"><i></i>
                                        </label>
                                    </td>
                                </tr>
                            <?php } ?>
                        <?php } ?>
                        <tr class="item submit">
                            <td colspan="4">
                                <?php if (!empty($results)) { ?>
                                    <button type="submit" class="btn action-delete">Delete Selected</button>
                                <?php } ?>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</div>

<?php require "footer.php"; ?>