Beispiel #1
0
 function message($title, $message, $link, $time = 2)
 {
     global $CONFIG;
     if ($CONFIG['display_redirection_page'] == 0) {
         header("Location: {$link}&message_id=" . cpgStoreTempMessage($message));
     } else {
         pageheader($title, "<META http-equiv=\"refresh\" content=\"{$time};url={$link}\">");
         msg_box($title, $message, Lang::item('common.continue'), $link);
         pagefooter();
     }
     exit;
 }
Beispiel #2
0
    }
}
$data = base64_encode(serialize($FAVPICS));
if (CPG_COOKIES_ALLOWED) {
    setcookie($CONFIG['cookie_name'] . '_fav', $data, time() + CPG_DAY * 30, $CONFIG['cookie_path']);
}
// If the user is logged in then put it in the DB
if (USER_ID > 0) {
    $sql = "UPDATE {$CONFIG['TABLE_FAVPICS']} SET user_favpics = '{$data}' WHERE user_id = " . USER_ID;
    cpg_db_query($sql);
    // User never stored a fav... so insert new row
    if (!cpg_db_affected_rows()) {
        $sql = "INSERT INTO {$CONFIG['TABLE_FAVPICS']} (user_id, user_favpics) VALUES (" . USER_ID . ", '{$data}')";
        cpg_db_query($sql);
    }
}
// Prepare message
if (in_array($pid, $FAVPICS)) {
    $message_id = cpgStoreTempMessage($lang_rate_pic_php['fav_added']);
    $message_icon = 'success';
} else {
    $message_id = cpgStoreTempMessage($lang_rate_pic_php['fav_removed']);
    $message_icon = 'info';
}
$ref .= strpos($ref, '?') !== FALSE ? '&' : '?';
$ref .= 'message_id=' . $message_id . '&message_icon=' . $message_icon . '#cpgMessageBlock';
$header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $ref);
pageheader($lang_common['information'], "<meta http-equiv=\"refresh\" content=\"1;url={$ref}\">");
msg_box($lang_common['information'], $lang_rate_pic_php['rate_ok'], $lang_common['continue'], $ref);
pagefooter();
/**
* cpgRedirectPage()
*
* Redirect to the target page or display an info screen first and then redirect
*
* @param string $targetAddress
* @param string $caption
* @param string $message
* @param string $countdown
* @param string $type (possible values: 'info', 'error', 'warning', 'validation', 'success' -> theme_display_message_block
* @return void
**/
function cpgRedirectPage($targetAddress = '', $caption = '', $message = '', $countdown = 0, $type = 'info')
{
    global $CONFIG, $USER_DATA, $lang_common;
    $logged_in = USER_ID || isset($USER_DATA['user_id']) && is_numeric($USER_DATA['user_id']);
    if (!$logged_in && $CONFIG['allow_unlogged_access'] == 0) {
        // Anonymous access to site is not allowed, so need to redirect to login page
        $targetAddress = 'login.php';
    }
    if ($CONFIG['display_redirection_page'] == 0) {
        $header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
        if (strpos($targetAddress, '?') == FALSE) {
            $separator = '?';
        } else {
            $separator = '&';
        }
        header($header_location . $targetAddress . $separator . 'message_id=' . cpgStoreTempMessage($message) . '&message_icon=' . $type . '#cpgMessageBlock');
        pageheader($caption, "<META http-equiv=\"refresh\" content=\"1;url={$targetAddress}\">");
        msg_box($caption, $message, $lang_common['continue'], $targetAddress, $type);
        pagefooter();
        exit;
    } else {
        pageheader($caption, "<META http-equiv=\"refresh\" content=\"1;url={$targetAddress}\">");
        msg_box($caption, $message, $lang_common['continue'], $targetAddress, $type);
        pagefooter();
        exit;
    }
}
$data = base64_encode(serialize($FAVPICS));
if (CPG_COOKIES_ALLOWED) {
    setcookie($CONFIG['cookie_name'] . '_fav', $data, time() + CPG_DAY * 30, $CONFIG['cookie_path']);
}
// If the user is logged in then put it in the DB
if (USER_ID > 0) {
    $sql = "UPDATE {$CONFIG['TABLE_FAVPICS']} SET user_favpics = '{$data}' WHERE user_id = " . USER_ID;
    cpg_db_query($sql);
    // User never stored a fav... so insert new row
    if (!mysql_affected_rows($CONFIG['LINK_ID'])) {
        $sql = "INSERT INTO {$CONFIG['TABLE_FAVPICS']} (user_id, user_favpics) VALUES (" . USER_ID . ", '{$data}')";
        cpg_db_query($sql);
    }
}
// Prepare message
if (function_exists('hidden_features_page_start')) {
    if (in_array($pid, $FAVPICS)) {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_added']);
        $message_icon = 'success';
    } else {
        $message_id = cpgStoreTempMessage($lang_plugin_hidden_features['fav_removed']);
        $message_icon = 'info';
    }
    $ref .= strpos($ref, '?') !== FALSE ? '&' : '?';
    $ref .= 'message_id=' . $message_id . '&message_icon=' . $message_icon . '#cpgMessageBlock';
}
$header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . $ref);
pageheader($lang_common['information'], "<meta http-equiv=\"refresh\" content=\"1;url={$ref}\">");
msg_box($lang_common['information'], $lang_rate_pic_php['rate_ok'], $lang_common['continue'], $ref);
pagefooter();
Beispiel #5
0
// Number of cached files
$result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate");
list($cached_files_total) = mysql_fetch_row($result);
mysql_free_result($result);
// Number of files in pictures table
$result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']}");
list($image_files_total) = mysql_fetch_row($result);
mysql_free_result($result);
// Query the pictures table for unique pids that only reside in the pictures table, but not in the cache table
$result = cpg_db_query("SELECT DISTINCT * FROM {$CONFIG['TABLE_PICTURES']} WHERE pid NOT IN (SELECT {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate.pid FROM {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate) LIMIT 1");
// Loop if there are still files to cache
$remaining_files = $image_files_total - $cached_files_total;
if ($remaining_files > 0) {
    $meta_refresh = '<meta http-equiv="refresh" content="' . $CONFIG['plugin_thumb_rotate_timelimit'] . '; URL=index.php?file=thumb_rotate/batch_fill" />';
} else {
    $message = cpgStoreTempMessage($lang_plugin_thumb_rotate['batch_fill'] . ': ' . $lang_common['done']);
    $meta_refresh = '<meta http-equiv="refresh" content="0; URL=index.php?file=thumb_rotate/index&message_id=' . $message . '&message_icon=success" />';
}
pageheader($lang_plugin_thumb_rotate['config_name'] . '-' . $lang_plugin_thumb_rotate['batch_fill'], $meta_refresh);
$CURRENT_PIC_DATA = mysql_fetch_assoc($result);
$CURRENT_PIC_DATA['extension'] = ltrim(substr($CURRENT_PIC_DATA['filename'], strrpos($CURRENT_PIC_DATA['filename'], '.')), '.');
$CURRENT_PIC_DATA['filename_without_extension'] = str_replace('.' . $CURRENT_PIC_DATA['extension'], '', $CURRENT_PIC_DATA['filename']);
if ($remaining_files > 0) {
    $created_image_array = thumb_rotate_image_create($CURRENT_PIC_DATA);
}
if ($created_image_array['path'] != '') {
    $result = cpg_db_query("INSERT IGNORE INTO {$CONFIG['TABLE_PREFIX']}plugin_thumb_rotate ( `pid` , `filepath`, `width`, `height` ) VALUES ('{$CURRENT_PIC_DATA['pid']}', '{$created_image_array['path']}', '{$created_image_array['width']}', '{$created_image_array['height']}');");
    $remaining_files--;
}
$remaining_output = theme_display_bar($remaining_files, $image_files_total, 600, '', '', sprintf($lang_plugin_thumb_rotate['x_files_remaining'], '/' . $image_files_total, 'red', 'green'));
// Display the rotated thumb we just created
Beispiel #6
0
/**
* cpgRedirectPage()
*
* Redirect to the target page or display an info screen first and then redirect
*
* @param string $targetAddress
* @param string $caption
* @param string $message
* @param string $countdown
* @return void
**/
function cpgRedirectPage($targetAddress = '', $caption = '', $message = '', $countdown = 0)
{
    global $CONFIG, $lang_common;
    if ($CONFIG['display_redirection_page'] == 0) {
        $header_location = @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' : 'Location: ';
        if (strpos($targetAddress, '?') == FALSE) {
            $separator = '?';
        } else {
            $separator = '&';
        }
        header($header_location . $targetAddress . $separator . 'message_id=' . cpgStoreTempMessage($message) . '#cpgMessageBlock');
        pageheader($caption, "<META http-equiv=\"refresh\" content=\"1;url={$targetAddress}\">");
        msg_box($caption, $message, $lang_common['continue'], $location);
        pagefooter();
        ob_end_flush();
        exit;
    } else {
        pageheader($caption, "<META http-equiv=\"refresh\" content=\"1;url={$targetAddress}\">");
        msg_box($caption, $message, $lang_common['continue'], $location);
        pagefooter();
        ob_end_flush();
        exit;
    }
}