Esempio n. 1
0
/**
 * autoDeleted()
 * Automatic remove images if they have not be viewed for some time
 */
function autoDeleted()
{
    global $settings;
    // check auto remove image is on
    if (!check_set('SET_AUTO_DELETED')) {
        return;
    }
    // make file name
    $checkfor = CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']);
    // check to see if it's been run for this time period
    if (is_file($checkfor)) {
        return;
    }
    // get image index
    $db_img = imageList(0, 'all');
    // check image index for images
    if (empty($db_img) || count($db_img) < 1) {
        return;
    }
    $delete_time = time() - $settings['SET_AUTO_DELETED_TIME'] * 86400;
    // check when image was last viewed
    foreach ($db_img as $k => $image) {
        // check to see if the image has been uploaded for long then the period
        if ($delete_time > $image['added']) {
            // image viewed db address
            $img_view_db = CFBANDWIDTHPATH . $image['id'] . '_imgbw.db';
            // check to see if there is a images viewed db file
            if (is_file($img_view_db)) {
                // read files last modified date (as this is most likely the last viewed date)
                if ($last_modified = filemtime($img_view_db)) {
                    // check to see if it has not been view for the period
                    if ($delete_time > $last_modified) {
                        $delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
                        // add image to remove array
                    }
                } else {
                    $db_count = db_imageCounterList(null, $image['id']);
                    if (isset($db_count['date'])) {
                        if ($delete_time > $db_count['date']) {
                            $delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
                            // add image to remove array
                        }
                    }
                }
            } else {
                $delete_id[$image['id']] = array('deleteid' => $image['deleteid']);
                // add image to remove array
            }
        }
    }
    //remove images
    if (!empty($delete_id)) {
        foreach ($delete_id as $k => $image) {
            removeImage($image['deleteid']);
        }
    }
    // remove image removed meg
    $Suc = array();
    // make lasted checked file
    if (savefile(array(), CFDATAPATH . 'ad' . date($settings['SET_AUTO_DELETED_JUMP']))) {
        // check for old file
        if (is_file(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1))) {
            // remove old file if found
            @unlink(CFDATAPATH . 'ad' . (date($settings['SET_AUTO_DELETED_JUMP']) - 1));
        }
    }
}
Esempio n. 2
0
if ($db_img = imageList(0, 'all')) {
    // workout the last reset date
    if ($settings['SET_BANDWIDTH_RESET'] == 'm') {
        $resetdate = strtotime('01 ' . date('M Y'));
    } else {
        $resetdate = strtotime('last monday', strtotime('tomorrow'));
    }
    // add bandwidth & counter to image DB
    foreach ($db_img as $k => $v) {
        // ip search
        if ($ipSearch && $_GET['ip'] != $v['ip']) {
            unset($db_img[$k]);
            $DBCOUNT--;
            continue;
        }
        if (!($hc = db_imageCounterList(null, $v['id']))) {
            // image view counter db
            $hc = array('image' => 0, 'thumb_mid' => 0, 'thumb' => 0, 'gallery' => 0, 'bandwidth' => 0, 'date' => 0, 'lr_image' => 0, 'lr_thumb_mid' => 0, 'lr_thumb' => 0, 'lr_gallery' => 0, 'lr_bandwidth' => 0, 'lr_date' => 0);
        }
        $db_img[$k]['lastviewed'] = $hc['date'] == (int) 0 ? round((time() - $v['added']) / 86400, 2) : round((time() - $hc['date']) / 86400, 2);
        if ($allTime) {
            $db_img[$k]['bandwidth'] = $hc['bandwidth'];
            $db_img[$k]['hotlink'] = 0 + $hc['image'] + $hc['thumb_mid'] + $hc['thumb'];
            $db_img[$k]['gallery'] = !isset($hc['gallery']) ? 0 : $hc['gallery'];
        } elseif ($hc['lr_date'] >= $resetdate) {
            $db_img[$k]['bandwidth'] = $hc['lr_bandwidth'];
            $db_img[$k]['hotlink'] = 0 + $hc['lr_image'] + $hc['lr_thumb_mid'] + $hc['lr_thumb'];
            $db_img[$k]['gallery'] = !isset($hc['lr_gallery']) ? 0 : $hc['lr_gallery'];
        } else {
            $db_img[$k]['bandwidth'] = 0;
            $db_img[$k]['hotlink'] = 0;
Esempio n. 3
0
 *   Used For:     Admin Edit Image Info
 *   Last edited:  11/01/2012
 *
 *************************************************************************************************************/
// Get Image ID
$edit_img_id = cl($_GET['id']);
// Update Image Info If Needed
if (isset($_POST['update'])) {
    $pam = array('alt' => cl($_POST['setAlt']), 'private' => cl($_POST['setPrivate']) == 1 ? true : false);
    if (db_update($edit_img_id, $pam)) {
        user_feedback('success', _T("admin_iep_suc"), 'edit_image');
    }
}
// get image info
$edit_image = db_get_image($edit_img_id);
$cdb = db_imageCounterList(null, $edit_img_id);
// page settings
$page['id'] = 'edit';
$page['title'] = _T("admin_iep_title");
$page['description'] = '';
$page['tipsy'] = true;
$page['lightbox'] = true;
require CFADMINPATH . 'admin_page_header.php';
?>
<!-- admin image edit -->
			<div class="ibox top_img"><a href="<?php 
echo imageAddress(1, $edit_image);
?>
" target="_blank" title="<?php 
echo $edit_image['alt'];
?>