function delete_images($image_ids, $delfromserver = 1) { global $site_db, $lang, $ids; if (empty($image_ids)) { echo $lang['no_search_results']; return false; } $error_log = array(); echo "<br />"; $sql = "SELECT image_id, cat_id, user_id, image_name, image_media_file, image_thumb_file\n FROM " . IMAGES_TABLE . "\n WHERE image_id IN ({$image_ids})"; $image_result = $site_db->query($sql); while ($image_row = $site_db->fetch_array($image_result)) { $sql = "DELETE FROM " . IMAGES_TABLE . "\n WHERE image_id = " . $image_row['image_id']; if ($site_db->query($sql)) { echo "<b>" . $lang['image_delete_success'] . "</b> " . $image_row['image_name'] . " (ID: " . $image_row['image_id'] . ")<br />\n"; $ids[] = $image_row['image_id']; } else { $error_log[] = "<b>" . $lang['image_delete_error'] . "</b> " . $image_row['image_name'] . " (ID: " . $image_row['image_id'] . ")<br />"; } if ($delfromserver) { if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file'])) { if (@unlink(MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file'])) { echo " " . $lang['file_delete_success'] . " (" . $image_row['image_media_file'] . ")<br />\n"; } else { $error_log[] = "<b>" . $lang['file_delete_error'] . " (" . $image_row['image_media_file'] . ")<br />"; } } if (!empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file'])) { if (@unlink(THUMB_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_thumb_file'])) { echo " " . $lang['thumb_delete_success'] . " (" . $image_row['image_thumb_file'] . ")<br />\n"; } else { $error_log[] = "<b>" . $lang['thumb_delete_error'] . " (" . $image_row['image_thumb_file'] . ")<br />\n"; } } if (@unlink(MEDIA_PATH . "/" . $image_row['cat_id'] . "/big/" . $image_row['image_media_file'])) { echo " " . $lang['file_delete_success'] . " (big/" . $image_row['image_media_file'] . ")<br />\n"; } else { echo " No Original Found <br />\n"; } } if (!empty($user_table_fields['user_comments'])) { $sql = "SELECT user_id\n FROM " . COMMENTS_TABLE . "\n WHERE image_id = " . $image_row['image_id'] . " AND user_id <> " . GUEST; $result = $site_db->query($sql); while ($row = $site_db->fetch_array($result)) { $sql = "UPDATE " . USERS_TABLE . "\n SET " . get_user_table_field("", "user_comments") . " = " . get_user_table_field("", "user_comments") . " - 1\n WHERE " . get_user_table_field("", "user_id") . " = " . $row['user_id']; $site_db->query($sql); } } $sql = "DELETE FROM " . COMMENTS_TABLE . "\n WHERE image_id = " . $image_row['image_id']; if ($site_db->query($sql)) { echo $lang['comments_delete_success'] . "<br />\n"; } else { $error_log[] = "<b>" . $lang['comments_delete_success'] . "</b> " . $image_row['image_name'] . ", (ID: " . $image_row['image_id'] . ")<br />\n"; } echo "<br />\n"; } remove_searchwords($image_ids); return $error_log; }
public function __construct() { $this->last = ''; $this->allow = false; $this->folder = XFS . XCOR . 'cache/'; if (is_remote() && @file_exists($this->folder) && @is_readable($this->folder) && @is_writable($this->folder)) { $this->allow = true; } return; }
function int_user() { global $DETDB, $USER; if (is_remote()) { $USER = (object) array('ID' => 0, 'login' => 'system', 'display_name' => 'system', 'code' => 'system', 'groups_ID' => '', 'last_ip' => $_SERVER['REMOTE_ADDR'], 'rules' => get_remote_key_rules()); } elseif (check_login(true)) { $USER = $DETDB->select('users', 'ID, display_name, groups_ID, last_ip, rules', true, "WHERE ID='" . $_COOKIE['user_ID'] . "'"); $USER->check = true; } else { $USER = (object) array('ID' => null, 'display_name' => 'Гость', 'code' => 'ghost', 'groups_ID' => '["2"]', 'last_ip' => $_SERVER['REMOTE_ADDR'], 'rules' => ''); $USER->check = false; } $USER = form_user_rules($USER); }
function copy_thumbnail($image_media_file, $image_thumb_file, $from_cat = 0, $to_cat = 0) { if (is_remote($image_thumb_file)) { return $image_thumb_file; } $thumb_src = $from_cat != -1 ? THUMB_PATH . ($from_cat != 0 ? "/" . $from_cat : "") : THUMB_TEMP_PATH; $thumb_dest = $to_cat != -1 ? THUMB_PATH . ($to_cat != 0 ? "/" . $to_cat : "") : THUMB_TEMP_PATH; if ($image_thumb_file != "" && file_exists($thumb_src . "/" . $image_thumb_file)) { $thumb_extension = get_file_extension($image_thumb_file); $new_thumb = get_file_name($image_media_file) . "." . $thumb_extension; if ($new_thumb = copy_file($thumb_src, $thumb_dest, $image_thumb_file, $new_thumb, 1)) { $image_thumb_file = $new_thumb; } } return $image_thumb_file; }
public function __construct() { $sql = 'SELECT * FROM _config'; $this->config = sql_rowset($sql, 'config_name', 'config_value'); if ($this->v('site_disable')) { exit('not_running'); } $address = $this->v('site_address'); $host_addr = array_key(explode('/', array_key(explode('//', $address), 1)), 0); if ($host_addr != get_host()) { $allow_hosts = get_file(XFS . XCOR . 'store/domain_alias'); foreach ($allow_hosts as $row) { if (substr($row, 0, 1) == '#') { continue; } $remote = strpos($row, '*') === false; $row = !$remote ? str_replace('*', '', $row) : $row; $row = str_replace('www.', '', $row); if ($row == get_host()) { $sub = str_replace($row, '', get_host()); $sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : ''); $address = str_replace($host_addr, $sub . $row, $address); $this->v('site_address', $address, true); break; } } } if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) { $page_protocol = array_key(explode('//', _page()), 0); $a = $this->v('site_address') . str_replace(str_replace('www.', '', $page_protocol . $address), '', _page()); redirect($a, false); } $this->cache_dir = XFS . XCOR . 'cache/'; if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) { $this->cache_f = true; } // // Load additional objects. // $this->email = _import('emailer'); $this->cache = _import('cache'); return; }
function is_remote_file($file_name) { return is_remote($file_name) && preg_match("#\\.[a-zA-Z0-9]{1,4}\$#", $file_name) ? 1 : 0; }
$image_ids = array(); $sql = "SELECT image_id, cat_id, image_media_file, image_download_url\n FROM " . IMAGES_TABLE . "\n WHERE image_active = 1 AND image_id IN ({$image_id_sql}) AND cat_id NOT IN (" . get_auth_cat_sql("auth_viewimage", "NOTIN") . ", " . get_auth_cat_sql("auth_viewcat", "NOTIN") . ", " . get_auth_cat_sql("auth_download", "NOTIN") . ")"; $result = $site_db->query($sql); if ($result) { include ROOT_PATH . "includes/zip.php"; $zipfile = new zipfile(); $file_added = 0; while ($image_row = $site_db->fetch_array($result)) { $file_path = null; $file_name = null; if (!empty($image_row['image_download_url'])) { if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) { $file_path = $image_row['image_download_url']; $file_name = basename($image_row['image_download_url']); } } elseif (is_remote($image_row['image_media_file'])) { $file_path = $image_row['image_media_file']; $file_name = get_basefile($image_row['image_media_file']); } else { $file_path = MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file']; $file_name = $image_row['image_media_file']; } if (!empty($file_path)) { @set_time_limit(120); $file_path = fix_file_path($file_path); if (!($file_data = @file_get_contents($file_path))) { continue; } $zipfile->add_file($file_data, $file_name); $file_added = 1; unset($file_data);
$config['upload_emails'] = str_replace(" ", "", $config['upload_emails']); $emails = explode(",", $config['upload_emails']); $validation_url = $script_url . "/admin/index.php?goto=" . urlencode("validateimages.php?action=validateimages"); $site_email->set_to($config['site_email']); $site_email->set_subject($lang['new_upload_emailsubject']); $site_email->register_vars(array("image_name" => stripslashes($image_name), "file_name" => $new_name, "cat_name" => $cat_cache[$cat_id]['cat_name'], "validation_url" => $validation_url, "site_name" => $config['site_name'])); $site_email->set_body("upload_notify", $config['language_dir_default']); $site_email->set_bcc($emails); $site_email->send_email(); } $msg .= $lang['image_add_success'] . ": <b>" . format_text(stripslashes($image_name)) . "</b> (" . $new_name . ")"; $msg .= !$direct_upload ? "<br />" . $lang['new_upload_validate_desc'] : ""; $file_extension = get_file_extension($new_name); $file = is_remote($new_name) ? $new_name : ($direct_upload ? MEDIA_PATH . "/" . $cat_id . "/" . $new_name : MEDIA_TEMP_PATH . "/" . $new_name); $width_height = ""; if (!is_remote($file) && ($imageinfo = @getimagesize($file))) { $width_height = " " . $imageinfo[3]; } $media_icon = "<img src=\"" . ICON_PATH . "/" . $file_extension . ".gif\" border=\"0\" alt=\"\" />"; $site_template->register_vars(array("media_src" => $file, "media_icon" => $media_icon, "image_name" => format_text(stripslashes($image_name)), "width_height" => $width_height)); $media = $site_template->parse_template("media/" . $file_extension); $content .= "<table border=\"0\" align=\"center\">\n<tr>\n<td>\n" . $media . "\n</td>\n</tr>\n</table>\n"; } else { $action = "uploadform"; $sendprocess = 1; } } else { $action = "uploadform"; $sendprocess = 1; } }
/** * Assigns template filename for handle. */ public function set_filename($handle, $filename, $xs_include = false, $quiet = false) { global $core; $can_cache = $this->use_cache; if (strpos($filename, '..') !== false) { $can_cache = false; } $this->files[$handle] = $this->make_filename($filename, $xs_include); $this->files_cache[$handle] = ''; $this->files_cache2[$handle] = ''; // Checking if we have valid filename if (!$this->files[$handle]) { if ($xs_include || $quiet) { return false; } else { die("Template->make_filename(): Error - invalid template {$filename}"); } } // creating cache filename if ($can_cache) { $this->files_cache2[$handle] = $this->make_filename_cache($this->files[$handle]); if (@file_exists($this->files_cache2[$handle])) { $this->files_cache[$handle] = $this->files_cache2[$handle]; } } // checking if tpl and/or php file exists if (empty($this->files_cache[$handle]) && !@file_exists($this->files[$handle])) { // trying to load alternative filename (usually subSilver) if (!empty($this->tpldef) && !empty($this->tpl) && $this->tpldef !== $this->tpl) { $this->files[$handle] = ''; // save old configuration $root = $this->root; $tpl_name = $this->tpl; // set temporary configuration $this->root = $this->tpldir . $this->tpldef; $this->tpl = $this->tpldef; // recursively run set_filename $res = $this->set_filename($handle, $filename, $xs_include, $quiet); // restore old configuration $this->root = $root; $this->tpl = $tpl_name; return $res; } if ($quiet) { return false; } if ($xs_include) { if (!is_remote()) { die('Template->make_filename(): Error - included template file not found: ' . $filename); } return false; } else { die('Template->make_filename(): Error - template file not found: ' . $this->files[$handle]); } } // checking if we should recompile cache if (!empty($this->files_cache[$handle]) && $core->v('auto_recompile')) { $cache_time = @filemtime($this->files_cache[$handle]); if (@filemtime($this->files[$handle]) > $cache_time || $core->v('template_time') > $cache_time) { // file was changed. don't use cache file (will be recompled if configuration allowes it) $this->files_cache[$handle] = ''; } } return true; }
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) { global $site_template, $site_sess, $lang, $mode; if (!get_file_path($media_file_name, "media", $cat_id, 0, 0)) { $media = "<img src=\"" . ICON_PATH . "/404.gif\" border=\"0\" alt=\"\" />"; $site_template->register_vars("iptc_info", ""); $site_template->register_vars("exif_info", ""); } else { $media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1); $file_extension = get_file_extension($media_file_name); $media_icon = "<img src=\"" . ICON_PATH . "/" . $file_extension . ".gif\" border=\"0\" alt=\"" . format_text($image_name, 2) . "\" />"; if ($show_link) { $media_icon = "<a href=\"" . $site_sess->url(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $image_id . (!empty($mode) ? "&mode=" . $mode : "")) . "\">" . $media_icon . "</a>"; } $width_height = ""; $width = ""; $height = ""; $iptc_info = ""; $exif_info = ""; if (!is_remote($media_src)) { $src = !file_exists($media_src) && file_exists(preg_replace("/\\/{2,}/", "/", get_document_root() . "/" . $media_src)) ? preg_replace("/\\/{2,}/", "/", get_document_root() . "/" . $media_src) : $media_src; if (in_array(strtolower($file_extension), array('gif', 'jpg', 'jpeg', 'png', 'swf')) && ($image_info = @getimagesize($src, $info))) { $width_height = " " . $image_info[3]; $width = $image_info[0]; $height = $image_info[1]; if ($detailed_view && isset($info['APP13'])) { $iptc_array = get_iptc_info($info['APP13']); $bgcounter = 0; foreach ($iptc_array as $key => $val) { $row_bg_number = $bgcounter++ % 2 == 0 ? 1 : 2; $site_template->register_vars(array("iptc_value" => format_text($val), "iptc_name" => $lang['iptc_' . $key], "row_bg_number" => $row_bg_number)); $iptc_info .= $site_template->parse_template("iptc_bit"); } } if ($detailed_view && $image_info[2] == 2 && function_exists('exif_read_data') && ($exif_data = @exif_read_data($src, 'EXIF'))) { $exif_array = get_exif_info($exif_data); $bgcounter = 0; foreach ($exif_array as $key => $val) { $row_bg_number = $bgcounter++ % 2 == 0 ? 1 : 2; $site_template->register_vars(array("exif_value" => format_text($val), "exif_name" => $lang['exif_' . $key], "row_bg_number" => $row_bg_number)); $exif_info .= $site_template->parse_template("exif_bit"); } } } } $site_template->register_vars(array("media_src" => $media_src, "media_icon" => $media_icon, "image_name" => format_text($image_name, 2), "width_height" => $width_height, "width" => $width, "height" => $height, "iptc_info" => $iptc_info, "exif_info" => $exif_info)); $media = $site_template->parse_template("media/" . $file_extension); } return $media; }
function delete_images($image_ids, $delfromserver = 1) { global $site_db, $lang; if (empty($image_ids)) { echo $lang['no_search_results']; return false; } $error_log = array(); echo "<br />"; $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file, l.lightbox_image_ids\n FROM " . IMAGES_TABLE . " i\n LEFT JOIN " . LIGHTBOXES_TABLE . " l ON (l.user_id = i.user_id)\n WHERE i.image_id IN ({$image_ids})"; $image_result = $site_db->query($sql); while ($image_row = $site_db->fetch_array($image_result)) { if ($image_row['user_id'] != GUEST) { $lightbox_array = explode(" ", $image_row['lightbox_image_ids']); foreach ($lightbox_array as $key => $val) { if ($val == $image_row['image_id']) { unset($lightbox_array[$key]); } } $lightbox_image_ids = trim(implode(" ", $lightbox_array)); $sql = "UPDATE " . LIGHTBOXES_TABLE . "\n SET lightbox_image_ids = '" . $lightbox_image_ids . "'\n WHERE user_id = " . $image_row['user_id']; $site_db->query($sql); } $sql = "DELETE FROM " . IMAGES_TABLE . "\n WHERE image_id = " . $image_row['image_id']; if ($site_db->query($sql)) { echo "<b>" . $lang['image_delete_success'] . "</b> " . format_text($image_row['image_name'], 2) . " (ID: " . $image_row['image_id'] . ")<br />\n"; } else { $error_log[] = "<b>" . $lang['image_delete_error'] . "</b> " . format_text($image_row['image_name'], 2) . " (ID: " . $image_row['image_id'] . ")<br />"; } if ($delfromserver) { if (!is_remote($image_row['image_media_file']) && !is_local_file($image_row['image_media_file'])) { if (@unlink(MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file'])) { echo " " . $lang['file_delete_success'] . " (" . $image_row['image_media_file'] . ")<br />\n"; } else { $error_log[] = "<b>" . $lang['file_delete_error'] . " (" . $image_row['image_media_file'] . ")<br />"; } } if (!empty($image_row['image_thumb_file']) && !is_remote($image_row['image_thumb_file']) && !is_local_file($image_row['image_thumb_file'])) { if (@unlink(THUMB_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_thumb_file'])) { echo " " . $lang['thumb_delete_success'] . " (" . $image_row['image_thumb_file'] . ")<br />\n"; } else { $error_log[] = "<b>" . $lang['thumb_delete_error'] . " (" . $image_row['image_thumb_file'] . ")<br />\n"; } } } if (!empty($user_table_fields['user_comments'])) { $sql = "SELECT user_id\n FROM " . COMMENTS_TABLE . "\n WHERE image_id = " . $image_row['image_id'] . " AND user_id <> " . GUEST; $result = $site_db->query($sql); while ($row = $site_db->fetch_array($result)) { $sql = "UPDATE " . USERS_TABLE . "\n SET " . get_user_table_field("", "user_comments") . " = " . get_user_table_field("", "user_comments") . " - 1\n WHERE " . get_user_table_field("", "user_id") . " = " . $row['user_id']; $site_db->query($sql); } } $sql = "DELETE FROM " . COMMENTS_TABLE . "\n WHERE image_id = " . $image_row['image_id']; if ($site_db->query($sql)) { echo $lang['comments_delete_success'] . "<br />\n"; } else { $error_log[] = "<b>" . $lang['comments_delete_success'] . "</b> " . format_text($image_row['image_name'], 2) . ", (ID: " . $image_row['image_id'] . ")<br />\n"; } echo "<br />\n"; } remove_searchwords($image_ids); return $error_log; }
function _link($mod = '', $attr = false, $ts = true) { global $core; $url = get_protocol() . array_key(explode('://', $core->v('address')), 1); if ($mod == 'alias' && $attr !== false && is_remote()) { $alias = $attr; if (is_array($attr)) { $alias = ''; if (isset($attr['alias'])) { $alias = $attr['alias']; unset($attr['alias']); } $attr = count($attr) ? $attr : false; } if ($alias != '') { $url = str_replace('www', $alias, $url); } } if (is_string($mod) && strpos($mod, ' ') !== false) { $attr_v = $attr; $attr = w(); foreach (explode(' ', $mod) as $k => $v) { if (strpos($v, ':') !== false) { list($k, $v) = explode(':', $v); } $attr[$k] = $v; } $mod = array_shift($attr); if ($attr_v !== false) { if (!is_array($attr_v)) { $attr_v = array($attr_v); } $attr = array_merge($attr, $attr_v); } } $url .= $mod != '' ? $mod . ($ts ? '/' : '') : ''; if ($attr !== false) { $url .= _linkp($attr, $mod != 'fetch' && $ts); } return strtolower($url); }
echo "<b>" . $limitfinish . "</b>."; } else { echo "<b>" . $countimages['images'] . "</b>."; } echo "<br />" . $lang['no_image_found']; show_form_header("validateimages.php", "saveimages", "form"); $bgcounter = 0; echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n"; if ($countimages['images'] > 0) { echo "<tr class=\"tableseparator\">\n"; echo "<td class=\"tableseparator\">" . $lang['validate'] . "</td>\n<td class=\"tableseparator\">" . $lang['delete'] . "</td>\n<td class=\"tableseparator\"> </td>\n<td class=\"tableseparator\">" . $lang['field_image_name'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_category'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_username'] . "</td>\n<td class=\"tableseparator\">" . $lang['field_date'] . "</td>\n<td class=\"tableseparator\">" . $lang['options'] . "</td>\n</tr>\n"; $sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_date, i.image_media_file" . get_user_table_field(", u.", "user_name") . "\n FROM " . IMAGES_TEMP_TABLE . " i\n LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = i.user_id)\n WHERE {$condition}\n ORDER BY {$orderby} {$direction}\n LIMIT {$limitstart}, {$limitnumber}"; $result = $site_db->query($sql); while ($image_row = $site_db->fetch_array($result)) { echo "<tr class=\"" . get_row_bg() . "\">"; $image_path = is_remote($image_row['image_media_file']) ? $image_row['image_media_file'] : MEDIA_TEMP_PATH . "/" . $image_row['image_media_file']; $file_src = get_file_path($image_row['image_media_file'], "media", 0, 1); echo "<td><input type=\"radio\" name=\"image_list[" . $image_row['image_id'] . "]\" value=\"1\"></td>"; echo "<td><input type=\"radio\" name=\"image_list[" . $image_row['image_id'] . "]\" value=\"0\"></td>"; echo "<td><a href=\"" . $image_path . "\" target=\"_blank\"><img src=\"" . $file_src . "\" border=\"1\" height=\"50\"></a></td>"; echo "<td><b><a href=\"" . $image_path . "\" target=\"_blank\">" . format_text($image_row['image_name'], 2) . "</a></b> (" . $image_row['image_media_file']; if (!get_file_path($image_row['image_media_file'], "media", 0, 0, 0)) { echo " <b class=\"marktext\">!</b>"; } echo ")</td>\n"; echo "<td><a href=\"" . $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $image_row['cat_id']) . "\" target=\"_blank\">" . format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2) . "</a></td>\n"; $show_user_name = format_text($image_row[$user_table_fields['user_name']], 2); if ($image_row['user_id'] != GUEST && empty($url_show_profile)) { $show_user_name = "<a href=\"" . $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $image_row['user_id']) . "\" target=\"_blank\">{$show_user_name}</a>"; } echo "<td>" . $show_user_name . "</td>\n";
$imgs = ""; if ($result) { $bgcounter = 0; $image_counter = 0; while ($image_row = $site_db->fetch_array($result)) { if ($image_row['image_thumb_file'] == "") { $exists = false; } else { if (is_remote($image_row['image_thumb_file'])) { $exists = true; } else { $exists = file_exists(THUMB_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_thumb_file']); } } if (!$exists && (file_exists(MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file']) || is_remote($image_row['image_media_file']))) { $src = is_remote($image_row['image_media_file']) ? $image_row['image_media_file'] : MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $image_row['image_media_file']; $image_info = getimagesize($src); if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) { $imgs .= "<tr class=\"" . get_row_bg() . "\">"; $imgs .= "<td width=\"20%\"><input type=\"checkbox\" name=\"image_list[" . $image_row['image_id'] . "]\" value=\"1\" checked=\"checked\"></td>\n"; $imgs .= "<td width=\"30%\"><b><a href=\"" . $site_sess->url(ROOT_PATH . "details.php?" . URL_IMAGE_ID . "=" . $image_row['image_id']) . "\" target=_blank>" . format_text($image_row['image_name'], 2) . "</a></b></td>\n"; $imgs .= "<td width=\"25%\">" . $image_row['image_media_file'] . "</td>\n"; $imgs .= "<td width=\"25%\">" . format_text($cat_cache[$image_row['cat_id']]['cat_name'], 2) . "</td></tr>\n"; $image_counter++; } } if ($image_counter == $num_newimages) { break; } } }
function get_file_url($file_name, $image_type, $cat_id) { $url = get_file_path($file_name, $image_type, $cat_id, 0, 1); if (!is_remote($file_name)) { global $script_url; $url = $script_url . '/' . $url; } return str_replace('./', '', $url); }
if ($message[0] == 'reload') { $message[0] = 'success'; } if (!isset($message[2])) { $message[2] = 'Внимание!'; } push_output_message(array('title' => $message[2], 'type' => $message[0], 'text' => $message[1], 'class' => "message-generate alert alert-{$message[0]}")); } unset($message); destroy_cookie('reload_message'); } actions_zone('before_form_page'); //Формирование страницы if (is_ajax()) { $PAGE->code = 'ajax_call'; } elseif (is_remote()) { $PAGE->code = 'remote_call'; } elseif (!$PAGE->code) { $key = get_current_key(); $PAGE->title = $APAGES[$key]->title; $PAGE->code = $key; } uasort($APAGES, 'collector_sort'); foreach ($APAGES as $item) { if (count($item->childs) > 1) { usort($item->childs, 'apage_sort_child'); } } uasort($SCRIPTS, 'collector_sort'); uasort($ACTIONS, 'collector_sort'); //Загрузка шаблонов
$big = isset($HTTP_POST_VARS['big']) && $HTTP_POST_VARS['big'] == 1 ? 1 : $big_default; $annotate = isset($HTTP_POST_VARS['annotate']) && $HTTP_POST_VARS['annotate'] == 1 ? 1 : $annotate_default; $big_folder = isset($HTTP_POST_VARS['big_folder']) ? trim($HTTP_POST_VARS['big_folder']) : $big_folder_default; for ($i = 1; $i <= $num_newimages; $i++) { $addimage = isset($HTTP_POST_VARS['addimage_' . $i]) && $HTTP_POST_VARS['addimage_' . $i] == 1 ? 1 : 0; if ($addimage) { $image_name = trim($HTTP_POST_VARS['image_name_' . $i]); $cat_id = intval($HTTP_POST_VARS['cat_id_' . $i]); $image_download_url = isset($HTTP_POST_VARS['image_download_url_' . $i]) ? trim($HTTP_POST_VARS['image_download_url_' . $i]) : ""; if ($image_name == "") { $error['image_name_' . $i] = 1; } if ($cat_id == 0) { $error['cat_id_' . $i] = 1; } if ($image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url)) { $error['image_download_url_' . $i] = 1; } if (!empty($additional_image_fields)) { foreach ($additional_image_fields as $key => $val) { if (isset($HTTP_POST_VARS[$key . '_' . $i]) && intval($val[2]) == 1 && trim($HTTP_POST_VARS[$key . '_' . $i]) == "") { $error[$key . '_' . $i] = 1; } } } } } if (empty($error)) { require ROOT_PATH . 'includes/image_utils.php'; $no_resize = 0; $convert_options = init_convert_options();
function core() { $sql = 'SELECT * FROM _config'; $this->config = _rowset($sql, 'config_name', 'config_value'); if ($this->v('site_disabled')) { exit('SITE DISABLED'); } $address = $this->v('address'); $host_addr = array_key(explode('/', array_key(explode('://', $address), 1)), 0); if ($host_addr != get_host()) { $allow_hosts = get_file('./base/domain_alias'); foreach ($allow_hosts as $row) { if (substr($row, 0, 1) == '#') { continue; } $remote = strpos($row, '*') === false; $row = !$remote ? str_replace('*', '', $row) : $row; $row = str_replace('www.', '', $row); if ($row == get_host()) { $sub = str_replace($row, '', get_host()); $sub = f($sub) ? $sub . '.' : ($remote ? 'www.' : ''); $address = str_replace($host_addr, $sub . $row, $address); $this->v('address', $address, true); break; } } } if (strpos($address, 'www.') !== false && strpos(get_host(), 'www.') === false && strpos($address, get_host())) { $a = $this->v('address') . str_replace(str_replace('www.', '', $address), '', _page()); redirect($a, false); } $this->cache_dir = XFS . 'core/cache/'; if (is_remote() && @file_exists($this->cache_dir) && @is_writable($this->cache_dir) && @is_readable($this->cache_dir)) { $this->cache_f = true; } return; }