Esempio n. 1
0
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
$class_images = new class_images();
// This page is not in layout special...
$cms_page['page_id'] = 'pic_upload';
$cms_page['page_nav'] = false;
$cms_page['global_blocks'] = false;
$cms_auth_level = isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL;
check_page_auth($cms_page['page_id'], $cms_auth_level);
$upload_dir = POSTED_IMAGES_PATH;
$filetypes = 'jpg,jpeg,gif,png';
$maxsize = 1000 * 1024;
/* Results:
* 1 => Success
* 2 => Error
* 3 => Extension not allowed
* 4 => File is empty
* 5 => File too big
Esempio n. 2
0
	/**
	* Add uploaded images to DB
	*/
	function add_uploaded_images_to_db($action)
	{
		global $db, $cache, $config, $user, $lang, $language;
		global $wip;
		global $pics_number, $pic_start, $total_pics, $total_pics_modified;

		if (!defined('POSTED_IMAGES_PATH'))
		{
			include(IP_ROOT_PATH . 'includes/constants.' . PHP_EXT);
		}

		include(IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT);
		$class_images = new class_images();

		$lang_append = '&lang=' . $language;

		$table_output = '';
		$pics_moved = '';

		switch ($action)
		{
			case 'fix':
				$posted_images_folder = POSTED_IMAGES_PATH;
				if ($total_pics == 0)
				{
					$total_pics_modified = 0;
				}

				if (($all_pics_array = $cache->get('_uploaded_images')) === false)
				{
					$all_pics_array = array();
					$dir = @opendir($posted_images_folder);
					while($file = readdir($dir))
					{
						$item_path = $posted_images_folder . $file;
						$process_item = (($file != '.') && ($file != '..') && (is_dir($item_path)) && (!is_link($item_path))) ? true : false;
						if ($process_item)
						{
							$sub_dir = @opendir($item_path);
							while($sub_file = readdir($sub_dir))
							{
								$item_sub_path = $file . '/' . $sub_file;
								$item_sub_path_full = $posted_images_folder . $item_sub_path;
								$process_item = (($sub_file != '.') && ($sub_file != '..') && (!is_dir($item_sub_path_full)) && (!is_link($item_sub_path_full))) ? true : false;
								if($process_item && preg_match('/(\.gif$|\.tif$|\.png$|\.jpg$|\.jpeg$)$/is', $sub_file))
								{
									$all_pics_array[] = $item_sub_path;
								}
							}
						}
					}
					$cache->put('_uploaded_images', $all_pics_array);
				}
				$total_pics = sizeof($all_pics_array);

				if ($total_pics_modified >= $total_pics)
				{
					$wip = false;
					$table_output .= '<br /><br />' . "\n";
					$table_output .= '<div class="post-text">' . "\n";
					$table_output .= '<ul type="circle" style="align: left;">' . "\n";
					$table_output .= '<li><span style="color: ' . $this->color_green . ';"><b>' . $lang['FixingPicsComplete'] . '</b></span></li>' . "\n";
					$table_output .= '</ul>' . "\n";
					$table_output .= '</div>' . "\n";
					$table_output .= '<br class="clear" />' . "\n";
					$table_output .= '<br /><br />' . "\n";
					return $table_output;
				}

				$pics_updated = '';
				for ($i = $pic_start; $i < ($pic_start + $pics_number); $i++)
				{
					if (!empty($all_pics_array[$i]))
					{
						$image_data_tmp = explode('/', $all_pics_array[$i]);
						$image_details = $class_images->get_image_details($posted_images_folder . $all_pics_array[$i]);
						$image_data = array(
							'pic_filename' => $image_data_tmp[1],
							'pic_size' => $image_details['size'],
							'pic_title' => $image_data_tmp[1],
							'pic_desc' => $image_data_tmp[1],
							'pic_user_id' => $image_data_tmp[0],
							'pic_user_ip' => '0.0.0.0',
							'pic_time' => $image_details['time'],
						);
						//print_r($image_data);
						$image_submit = $class_images->submit_image($image_data, 'insert');
						$pics_updated .= '<li>' . $all_pics_array[$i] . '</li>';
					}
					$total_pics_modified++;
				}

				if ($total_pics_modified > $total_pics)
				{
					$total_pics_modified = $total_pics;
				}

				$table_output .= '<div class="post-text" style="width: 90%;">' . "\n";
				$table_output .= '<ul type="circle" style="align: left;">' . "\n";
				$table_output .= $pics_updated . "\n";
				$table_output .= '</ul>' . "\n";
				$table_output .= '</div>' . "\n";
				$table_output .= '<br class="clear" />' . "\n";
				$table_output .= '<br /><br />' . "\n";

				// Increase $post_start to process the other posts
				$pic_start = ($pic_start + $pics_number);

			break;

			default:
				$table_output .= '<form action="' . ip_functions::append_sid(THIS_FILE . '?mode=add_uploaded_images_to_db&amp;action=fix&amp;wip=true' . $lang_append) . '" method="post" enctype="multipart/form-data">' . "\n";
				$table_output .= '<table class="forumline">' . "\n";
				$table_output .= '<tr><td class="row-header" colspan="2"><span>' . $lang['AddPostedPicsDB'] . '</span></td></tr>' . "\n";
				$table_output .= '<tr>' . "\n";
				$table_output .= '	<td class="row1" width="200"><span class="genmed">' . $lang['PicsPerStep'] . '&nbsp;</span></td>' . "\n";
				$table_output .= '	<td class="row1"><span class="genmed"><input type="text" class="post" name="pics_number" value="100" size="10" /></span></td>' . "\n";
				$table_output .= '</tr>' . "\n";
				$table_output .= '<tr>' . "\n";
				$table_output .= '	<td class="row1" width="200"><span class="genmed">' . $lang['PicStartFrom'] . '&nbsp;</span></td>' . "\n";
				$table_output .= '	<td class="row1"><span class="genmed"><input type="text" class="post" name="pic_start" value="0" size="10" /></span></td>' . "\n";
				$table_output .= '</tr>' . "\n";
				$table_output .= '<tr>' . "\n";
				$table_output .= '	<td class="cat" colspan="2" style="border-right-width: 0px; border-bottom-width: 0px;"><input type="submit" class="mainoption" name="submit" value="' . $lang['Start'] . '" /></td>' . "\n";
				$table_output .= '</tr>' . "\n";
				$table_output .= '</table>' . "\n";
				$table_output .= '</form>' . "\n";
		}

		return $table_output;
	}
Esempio n. 3
0
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
$class_images = new class_images();
// This page is not in layout special...
$cms_page['page_id'] = 'pic_upload';
$cms_page['page_nav'] = true;
$cms_page['global_blocks'] = false;
$cms_auth_level = isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL;
check_page_auth($cms_page['page_id'], $cms_auth_level);
// Force the page_id to album
$cms_page['page_id'] = 'album';
if (!$user->data['session_logged_in']) {
    message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
}
// Get general album information
include ALBUM_MOD_PATH . 'album_common.' . PHP_EXT;
$pic_id = request_var('pic_id', 0);
$mode_array = array('show', 'delete', 'full');
Esempio n. 4
0
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
require IP_ROOT_PATH . 'includes/class_image.' . PHP_EXT;
include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
$class_images = new class_images();
// ------------------------------------
// Check the request
// ------------------------------------
$pic_id = request_var('pic_id', '');
if (empty($pic_id)) {
    image_no_thumbnail('no_thumb.jpg');
    exit;
    //die($lang['NO_PICS_SPECIFIED']);
    //message_die(GENERAL_MESSAGE, $lang['NO_PICS_SPECIFIED']);
}
$pic_id = urldecode($pic_id);
$tmp_split = explode('/', $pic_id);
$pic_user_id = intval((int) $tmp_split[0]);
if ($pic_user_id < 0) {
    image_no_thumbnail('no_thumb.jpg');
Esempio n. 5
0
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) {
    define('IP_ROOT_PATH', './');
}
if (!defined('PHP_EXT')) {
    define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
}
include IP_ROOT_PATH . 'common.' . PHP_EXT;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
$class_images = new class_images();
// This page is not in layout special...
$cms_page['page_id'] = 'pic_upload';
$cms_page['page_nav'] = false;
$cms_page['global_blocks'] = false;
$cms_auth_level = isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL;
check_page_auth($cms_page['page_id'], $cms_auth_level);
$upload_dir = POSTED_IMAGES_PATH;
$filetypes = 'jpg,jpeg,gif,png';
$maxsize = 1000 * 1024;
/* Results:
* 1 => Success
* 2 => Error
* 3 => Extension not allowed
* 4 => File is empty
* 5 => File too big
Esempio n. 6
0
        if ($like_result) {
            $result_code = $mode == 'like' ? AJAX_POST_LIKE : AJAX_POST_UNLIKE;
            $error_msg = '';
        } else {
            $result_code = AJAX_ERROR;
            $error_msg = '';
        }
    }
    $result_ar = array('result' => $result_code);
    if (!empty($error_msg)) {
        $result_ar['error_msg'] = $error_msg;
    }
    AJAX_message_die($result_ar);
} elseif ($mode == 'get_more_images') {
    include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
    $class_images = new class_images();
    $start = request_var('start', 0);
    $limit = request_var('limit', 5);
    $start = $start < 0 || $start > 999999 ? 0 : $start;
    $limit = $limit < 0 || $limit > 10 ? 5 : $limit;
    $images_data = $class_images->get_user_images($user->data['user_id'], 'i.pic_id DESC', $start, $limit);
    $result_ar = array();
    if (!empty($images_data)) {
        $server_url = create_server_url();
        $pics_parsed = 0;
        foreach ($images_data as $image_data) {
            $pics_parsed++;
            // We are checking for small thumbnails... added an underscore to distinguish those small thumbs respect to mid sized!
            $pic_img_sub_path = (USERS_SUBFOLDERS_IMG && !empty($image_data['pic_user_id']) ? $image_data['pic_user_id'] . '/' : '') . $image_data['pic_filename'];
            $pic_img_url = POSTED_IMAGES_PATH . $pic_img_sub_path;
            $pic_thumbnail_fullpath = POSTED_IMAGES_THUMBS_S_PATH . $pic_img_sub_path;
Esempio n. 7
0
        if ($like_result) {
            $result_code = $mode == 'like' ? AJAX_POST_LIKE : AJAX_POST_UNLIKE;
            $error_msg = '';
        } else {
            $result_code = AJAX_ERROR;
            $error_msg = '';
        }
    }
    $result_ar = array('result' => $result_code);
    if (!empty($error_msg)) {
        $result_ar['error_msg'] = $error_msg;
    }
    AJAX_message_die($result_ar);
} elseif ($mode == 'get_more_images') {
    include IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT;
    $class_images = new class_images();
    $start = request_var('start', 0);
    $limit = request_var('limit', 5);
    $start = $start < 0 || $start > 999999 ? 0 : $start;
    $limit = $limit < 0 || $limit > 10 ? 5 : $limit;
    $images_data = $class_images->get_user_images($user->data['user_id'], 'i.pic_id DESC', $start, $limit);
    $result_ar = array();
    if (!empty($images_data)) {
        $server_url = create_server_url();
        $pics_parsed = 0;
        foreach ($images_data as $image_data) {
            $pics_parsed++;
            // We are checking for small thumbnails... added an underscore to distinguish those small thumbs respect to mid sized!
            $image_paths = $class_images->generate_image_paths($image_data);
            $image_data['pic_title'] = strlen($image_data['pic_title']) > 25 ? substr($image_data['pic_title'], 0, 22) . '...' : $image_data['pic_title'];
            $pic_title = strlen($image_data['pic_title']) > 25 ? substr($image_data['pic_title'], 0, 22) . '...' : $image_data['pic_title'];
Esempio n. 8
0
*
*/

define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management

include(IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT);
$class_images = new class_images();

// This page is not in layout special...
$cms_page['page_id'] = 'pic_upload';
$cms_page['page_nav'] = false;
$cms_page['global_blocks'] = false;
$cms_auth_level = (isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL);
check_page_auth($cms_page['page_id'], $cms_auth_level);

// Get general album information
include(ALBUM_MOD_PATH . 'album_common.' . PHP_EXT);

// We need to keep it here... so also error messages will initialize it correctly!
$gen_simple_header = true;

$js_temp = array('jquery/jquery_ajax_upload.js');
Esempio n. 9
0
*
*/

define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management

include(IP_ROOT_PATH . 'includes/class_images.' . PHP_EXT);
$class_images = new class_images();

// This page is not in layout special...
$cms_page['page_id'] = 'pic_upload';
$cms_page['page_nav'] = false;
$cms_page['global_blocks'] = false;
$cms_auth_level = (isset($config['auth_view_pic_upload']) ? $config['auth_view_pic_upload'] : AUTH_ALL);
check_page_auth($cms_page['page_id'], $cms_auth_level);

// We need to keep it here... so also error messages will initialize it correctly!
$gen_simple_header = true;

$js_temp = array('jquery/jquery_ajax_upload.js');
$template->js_include = array_merge($template->js_include, $js_temp);
unset($js_temp);