示例#1
0
 /**
  *  Constructor
  *  @param  string  $varname        Optional form variable name
  */
 function ppFile($varname = 'uploadfile')
 {
     global $_PP_CONF, $_CONF;
     $this->filenames = array();
     $this->setContinueOnError(true);
     $this->setLogFile('/tmp/warn.log');
     $this->setDebug(true);
     parent::upload();
     // Before anything else, check the upload directory
     if (!$this->setPath($_PP_CONF['download_path'])) {
         return;
     }
     // For now, this is ok.  Later maybe duplicate the $_PP_CONF array
     // for downloaded mime-types.  For some reason, upload.class.php and
     // download.class.php have their array key=>values reversed.
     $this->setAllowAnyMimeType(true);
     //$this->setAllowedMimeTypes($_PP_CONF['allowedextensions']);
     // Max size for uploads?  This is only accessible to admins anyway.
     $this->setMaxFileSize((int) $_PP_CONF['max_file_size'] * 1048576);
     // Set the name of the form variable used.
     $this->setFieldName($varname);
     // For a single file this is a simple one-element array.
     // To allow multiple files per product, a "real" array needs
     // to be populated and another DB table will be needed.
     //$filenames = array();
     //for ($i = 0; $i < count($_FILES[$varname]['name']); $i++) {
     //    $this->filenames[] = $_FILES[$varname][$i]['name'];
     //}
     $this->filenames[] = $_FILES[$varname]['name'];
     $this->setFileNames($this->filenames);
 }
示例#2
0
 /**
  *  Constructor
  *  @param string $name Optional image filename
  */
 public function __construct($ad_id, $varname = 'photo')
 {
     global $_CONF_ADVT, $_CONF;
     if (empty($_FILES[$varname])) {
         $this->havefiles = false;
         return;
     } else {
         $this->havefiles = true;
     }
     $this->setContinueOnError(true);
     $this->setLogFile($_CONF['path_log'] . 'error.log');
     $this->setDebug(true);
     parent::upload();
     // Before anything else, check the upload directory
     if (!$this->setPath(CLASSIFIEDS_IMGPATH)) {
         return;
     }
     $this->ad_id = trim($ad_id);
     $this->pathImage = CLASSIFIEDS_IMGPATH;
     //$this->pathThumb = $this->pathImage . '/thumb';     // deprecated
     $this->setAllowedMimeTypes(array('image/pjpeg' => '.jpg,.jpeg', 'image/jpeg' => '.jpg,.jpeg', 'image/png' => '.png'));
     $this->setMaxFileSize($_CONF['max_image_size']);
     $this->setMaxDimensions($_CONF_ADVT['img_max_width'], $_CONF_ADVT['img_max_height']);
     $this->setAutomaticResize(true);
     $this->setFieldName($varname);
     $filenames = array();
     for ($i = 0; $i < count($_FILES[$varname]['name']); $i++) {
         $filenames[] = $this->ad_id . '_' . rand(100, 999) . '.jpg';
     }
     $this->setFileNames($filenames);
 }
示例#3
0
 /**
  *  Constructor
  *  @param string $name Optional image filename
  */
 function __construct($product_id, $varname = 'photo')
 {
     global $_PP_CONF, $_CONF;
     $this->setContinueOnError(true);
     $this->setLogFile('/tmp/warn.log');
     $this->setDebug(true);
     parent::upload();
     // Before anything else, check the upload directory
     if (!$this->setPath($_PP_CONF['image_dir'])) {
         return;
     }
     $this->product_id = trim($product_id);
     $this->pathImage = $_PP_CONF['image_dir'];
     $this->setAllowedMimeTypes(array('image/pjpeg' => '.jpg,.jpeg', 'image/jpeg' => '.jpg,.jpeg'));
     $this->setMaxFileSize($_PP_CONF['max_image_size']);
     $this->setMaxDimensions($_PP_CONF['img_max_width'], $_PP_CONF['img_max_height']);
     $this->setAutomaticResize(true);
     $this->setFieldName($varname);
     $filenames = array();
     for ($i = 0; $i < $this->numFiles(); $i++) {
         $filenames[] = $this->product_id . '_' . rand(100, 999) . '.jpg';
     }
     $this->setFileNames($filenames);
 }
示例#4
0
         }
         tep_db_query("update " . TABLE_BOARDS_CATEGORIES . " set image = '' where boards_categories_id = '" . (int) $boards_categories_id . "'");
     } else {
         $uploaded = false;
         if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
             $size = @getimagesize($categories_image);
             if ($size[2] == '3') {
                 $ext = '.png';
             } elseif ($size[2] == '2') {
                 $ext = '.jpg';
             } else {
                 $ext = '.gif';
             }
             $new_filename = $boards_categories_id . $ext;
             $upload->filename = 'categories/' . $new_filename;
             if ($upload->upload('image', DIR_FS_CATALOG_IMAGES)) {
                 if (CATEGORY_IMAGE_WIDTH > 0 || CATEGORY_IMAGE_HEIGHT > 0) {
                     tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', CATEGORY_IMAGE_WIDTH, CATEGORY_IMAGE_HEIGHT);
                 }
                 $prev_file_query = tep_db_query("select image from " . TABLE_BOARDS_CATEGORIES . " where boards_categories_id = '" . (int) $boards_categories_id . "'");
                 $prev_file = tep_db_fetch_array($prev_file_query);
                 if (tep_not_null($prev_file['image']) && $prev_file['image'] != $upload->filename) {
                     @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['image']);
                 }
                 tep_db_query("update " . TABLE_BOARDS_CATEGORIES . " set image = '" . $upload->filename . "' where boards_categories_id = '" . (int) $boards_categories_id . "'");
             }
         }
     }
     tep_update_blocks($boards_categories_id, 'boards_category');
     tep_redirect(tep_href_link(FILENAME_BOARDS, 'tPath=' . $tPath . '&cPath=' . $cPath . '&cID=' . $boards_categories_id));
 }
示例#5
0
if ($imagesize) {
    $size = explode(",", $imagesize);
    if (count($size) % 2 != 0) {
        $json = json_encode(array("state" => 'upload上传插件属性imagesize宽,高值必须成对出现如100,200,300,400'));
        echo $json;
        exit;
    }
}
$dir = isset($_POST['dir']) ? $_POST['dir'] : '';
//上传目录
$thumb_type = isset($_POST['thumb_type']) ? $_POST['thumb_type'] : 6;
//缩略方式
C("THUMB_ON", 0);
C("WATER_ON", $water_on);
$upload = new upload($dir, '', $swfupload_size);
$uploadFile = $upload->upload();
$state = empty($upload->error) ? "SUCCESS" : $upload->error;
if (!$uploadFile) {
    //上传失败
    $json = json_encode(array("state" => $state));
    echo $json;
    exit;
}
$field = $uploadFile[0]['path'];
//上传成功文件物理路径
$info = pathinfo($field);
$fileData = array();
$fileData[0]['path'] = $field;
//上传后的大图
$fileData[0]['url'] = __ROOT__ . '/' . $field;
//上传后的大图URL
 if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
     $size = @getimagesize($manufacturers_image);
     if ($size[2] == '3') {
         $ext = '.png';
     } elseif ($size[2] == '2') {
         $ext = '.jpg';
     } else {
         $ext = '.gif';
     }
     $new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($manufacturers_path));
     if (!tep_not_null($new_filename)) {
         $new_filename = $manufacturers_id;
     }
     $new_filename .= $ext;
     $upload->filename = 'manufacturers/' . $new_filename;
     if ($upload->upload('manufacturers_image', DIR_FS_CATALOG_IMAGES)) {
         if (MANUFACTURER_IMAGE_WIDTH > 0 || MANUFACTURER_IMAGE_HEIGHT > 0) {
             tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', MANUFACTURER_IMAGE_WIDTH, MANUFACTURER_IMAGE_HEIGHT);
             if (!is_dir(DIR_FS_CATALOG_IMAGES . 'manufacturers/thumbs')) {
                 mkdir(DIR_FS_CATALOG_IMAGES . 'manufacturers/thumbs', 0777);
             }
             tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, DIR_FS_CATALOG_IMAGES . str_replace('manufacturers/', 'manufacturers/thumbs/', $upload->filename), 50, 70);
         }
         $prev_file_query = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int) $manufacturers_id . "'");
         $prev_file = tep_db_fetch_array($prev_file_query);
         if (tep_not_null($prev_file['manufacturers_image']) && $prev_file['manufacturers_image'] != $upload->filename) {
             @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['manufacturers_image']);
         }
         tep_db_query("update " . TABLE_MANUFACTURERS . " set manufacturers_image = '" . $upload->filename . "' where manufacturers_id = '" . (int) $manufacturers_id . "'");
     }
 }
 }
 $category_name_1 = 'Книги на иностранных языках' . (tep_not_null($products_language) ? ' (' . $products_language . ')' : '');
 $metatags_page_title = (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '.' : '') . (tep_not_null($category_name_1) ? ' ' . $category_name_1 . '.' : '') . ' Интернет-магазин Setbook.';
 $metatags_title = $products_name;
 $metatags_keywords = (tep_not_null($category_name_1) ? $category_name_1 . '. ' : '') . (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '. ' : ' ') . (tep_not_null($products_genre) ? $products_genre . '.' : '');
 $metatags_description = (tep_not_null($category_name_1) ? $category_name_1 . '. ' : '') . (tep_not_null($authors_name) ? $authors_name . ', ' : '') . $products_name . (substr($products_name, -1) != '.' ? '. ' : ' ') . (tep_not_null($products_description) ? preg_replace('/^([^\\.]+\\.).*$/', '$1', $products_description) : '');
 $content_type = 'foreign';
 $content_id = $products_id;
 tep_db_query("replace into " . TABLE_METATAGS . " (metatags_page_title, metatags_title, metatags_keywords, metatags_description, language_id, content_type, content_id) values ('" . tep_db_input($metatags_page_title) . "', '" . tep_db_input($metatags_title) . "', '" . tep_db_input($metatags_keywords) . "', '" . tep_db_input($metatags_description) . "', '" . (int) $languages_id . "', '" . tep_db_input($content_type) . "', '" . (int) $content_id . "')");
 if ($upload = new upload('', '', '777', array('gif', 'jpeg', 'jpg', 'png'))) {
     $new_filename = 'thumbs/' . substr(uniqid(rand()), 0, 10) . '.jpg';
     $is_copied = false;
     $products_image_url = tep_db_prepare_input($HTTP_POST_VARS['products_image_url']);
     if (is_uploaded_file($products_image)) {
         $upload->filename = $new_filename;
         if ($upload->upload('products_image', DIR_FS_CATALOG_IMAGES . 'foreign/')) {
             $is_copied = true;
         }
     } elseif (tep_not_null($products_image_url)) {
         if (copy($products_image_url, DIR_FS_CATALOG_IMAGES . 'foreign/' . $new_filename)) {
             $is_copied = true;
         }
     }
     if ($is_copied) {
         $prev_file_query = tep_db_query("select products_image from " . TABLE_FOREIGN_PRODUCTS . " where products_id = '" . (int) $products_id . "'");
         $prev_file = tep_db_fetch_array($prev_file_query);
         if (tep_not_null($prev_file['products_image'])) {
             @unlink(DIR_FS_CATALOG_IMAGES . 'foreign/' . $prev_file['products_image']);
             @unlink(DIR_FS_CATALOG_IMAGES . 'foreign/big/' . $prev_file['products_image']);
         }
         tep_create_thumb(DIR_FS_CATALOG_IMAGES . 'foreign/' . $new_filename, DIR_FS_CATALOG_IMAGES . 'foreign/big/' . $new_filename, BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT, '85', 'reduce_only');
示例#8
0
     $templates_description_array = $HTTP_POST_VARS['templates_description'];
     $language_id = $languages[$i]['id'];
     $sql_data_array = array('templates_name' => tep_db_prepare_input($templates_name_array[$language_id]), 'templates_description' => tep_db_prepare_input($templates_description_array[$language_id]), 'default_status' => $default_status, 'sort_order' => $sort_order);
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'templates_id' => $templates_id, 'language_id' => $languages[$i]['id']);
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         tep_db_perform(TABLE_TEMPLATES, $sql_data_array);
     } elseif ($action == 'update') {
         $update_sql_data = array('last_modified' => 'now()');
         $sql_data_array = array_merge($sql_data_array, $update_sql_data);
         tep_db_perform(TABLE_TEMPLATES, $sql_data_array, 'update', "templates_id = '" . (int) $templates_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
     }
 }
 if ($upload = new upload('', '', '777', array('php'))) {
     $upload->filename = 'template_' . $templates_id . '.html';
     if ($upload->upload('templates_filename', DIR_FS_CATALOG_TEMPLATES)) {
         $prev_file_query = tep_db_query("select templates_filename from " . TABLE_TEMPLATES . " where templates_id = '" . (int) $templates_id . "'");
         $prev_file = tep_db_fetch_array($prev_file_query);
         if (tep_not_null($prev_file['templates_filename']) && $prev_file['templates_filename'] != $upload->filename) {
             @unlink(DIR_FS_CATALOG_TEMPLATES . $prev_file['templates_filename']);
         }
         tep_db_query("update " . TABLE_TEMPLATES . " set templates_filename = '" . tep_db_input($upload->filename) . "' where templates_id = '" . (int) $templates_id . "'");
     } elseif (isset($HTTP_POST_VARS['templates_filename_contents'])) {
         if (get_magic_quotes_gpc()) {
             $templates_filename_contents = stripslashes(trim($HTTP_POST_VARS['templates_filename_contents']));
         } else {
             $templates_filename_contents = str_replace('\\"', '"', trim($HTTP_POST_VARS['templates_filename_contents']));
         }
         $prev_file_query = tep_db_query("select templates_filename from " . TABLE_TEMPLATES . " where templates_id = '" . (int) $templates_id . "'");
         $prev_file = tep_db_fetch_array($prev_file_query);
         if (tep_not_null($prev_file['templates_filename'])) {
示例#9
0
 function avatars()
 {
     $db = M('user_info');
     $db_info = $db->field('avatar')->where('uid=' . $_SESSION['uid'])->find();
     $avatar = $db_info['avatar'];
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         C('UPLOAD_IMG_DIR', '');
         //图片没有附文件夹
         C('THUMB_ENDFIX', '');
         //只生成头像缩略图(即覆盖原文件)
         $upload = new upload(PATH_ROOT . '/uploads/avatars', array('jpg', 'jpeg', 'png', 'gif'), 3145728, 0, 1, array(100, 100, 4));
         $info = $upload->upload();
         if ($info) {
             $db->where('uid=' . $_SESSION['uid'])->update(array('avatar' => $info[0]['thumb']));
             unlink(PATH_ROOT . '/' . $avatar);
             //删除之前的头像文件
             $this->success('头像修改成功', 'avatars');
         } else {
             $this->error($upload->error);
         }
     }
     $this->assign('avatar', $avatar);
     $this->display('profile/avatars');
 }
示例#10
0
 function links()
 {
     $db = V('link');
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $_POST['created'] = time();
         if ($_FILES['logo']['error'] == 0) {
             C('UPLOAD_IMG_DIR', '');
             $upload = new upload('uploads/link', array('jpg', 'png', 'gif'), 2465792);
             $up_info = $upload->upload();
             if ($up_info) {
                 $_POST['logo'] = $up_info[0]['path'];
             }
         }
         if ($db->table('link')->insert($_POST)) {
             $this->success('添加友情链接成功!');
         }
     }
     $db->view = array('link_category' => array('type' => 'INNER', 'on' => 'link.cate_id=link_category.lcid'));
     $links = $db->findall();
     $cates = $db->table('link_category')->join(NULL)->findall();
     $this->assign('cates', $cates);
     $this->assign('links', $links);
     $this->display();
 }
示例#11
0
     $shops_query = tep_db_query("select shops_database from " . TABLE_SHOPS . " where shops_database <> ''" . ($action == 'update_block' ? " and shops_id = '" . (int) SHOP_ID . "'" : ""));
     while ($shops = tep_db_fetch_array($shops_query)) {
         tep_db_select_db($shops['shops_database']);
         if ($action == 'insert_block') {
             tep_db_perform(TABLE_BLOCKS, $sql_data_array);
         } elseif ($action == 'update_block') {
             tep_db_perform(TABLE_BLOCKS, $sql_data_array, 'update', "blocks_id = '" . (int) $blocks_id . "' and language_id = '" . (int) $languages[$i]['id'] . "'");
         }
     }
     tep_db_select_db(DB_DATABASE);
 }
 $sql = "";
 if (DEBUG_MODE == 'on') {
     if ($upload = new upload('', '', '777', array('php'))) {
         $upload->filename = 'block_' . $blocks_id . '.php';
         if ($upload->upload('blocks_filename', DIR_FS_CATALOG_BLOCKS)) {
             $prev_file_query = tep_db_query("select blocks_filename from " . TABLE_BLOCKS . " where blocks_id = '" . (int) $blocks_id . "'");
             $prev_file = tep_db_fetch_array($prev_file_query);
             if (tep_not_null($prev_file['blocks_filename']) && $prev_file['blocks_filename'] != $upload->filename) {
                 @unlink(DIR_FS_CATALOG_BLOCKS . $prev_file['blocks_filename']);
             }
             $sql .= "update " . TABLE_BLOCKS . " set blocks_filename = '" . tep_db_input($upload->filename) . "' where blocks_id = '" . (int) $blocks_id . "';\n";
         } elseif (isset($HTTP_POST_VARS['blocks_filename_contents'])) {
             $blocks_filename_contents = stripslashes($HTTP_POST_VARS['blocks_filename_contents']);
             $prev_file_query = tep_db_query("select blocks_filename from " . TABLE_BLOCKS . " where blocks_id = '" . (int) $blocks_id . "'");
             $prev_file = tep_db_fetch_array($prev_file_query);
             if (tep_not_null($prev_file['blocks_filename'])) {
                 @unlink(DIR_FS_CATALOG_BLOCKS . $prev_file['blocks_filename']);
             } else {
                 $prev_file['blocks_filename'] = 'block_' . $blocks_id . '.php';
             }
示例#12
0
 $banners_image_target = tep_db_prepare_input($HTTP_POST_VARS['banners_image_target']);
 $db_image_location = '';
 $expires_date = tep_db_prepare_input($HTTP_POST_VARS['expires_date']);
 $expires_impressions = tep_db_prepare_input($HTTP_POST_VARS['expires_impressions']);
 $date_scheduled = tep_db_prepare_input($HTTP_POST_VARS['date_scheduled']);
 $banners_weight = tep_db_prepare_input($HTTP_POST_VARS['banners_weight']);
 $banners_use_group_conditions = tep_db_prepare_input($HTTP_POST_VARS['banners_use_group_conditions']);
 $banner_error = false;
 if (empty($banners_title)) {
     $messageStack->add(ERROR_BANNER_TITLE_REQUIRED, 'error');
     $banner_error = true;
 }
 if (empty($banners_html_text)) {
     if (empty($banners_image_local)) {
         $banners_image = new upload();
         if ($banners_image->upload('banners_image', DIR_FS_CATALOG_IMAGES . 'banners/' . $banners_image_target)) {
         } else {
             $banner_error = true;
         }
     }
 }
 if ($banner_error == false) {
     $db_image_location = 'banners/' . (tep_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename);
     $sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_groups_id' => $gPath, 'banners_weight' => $banners_weight, 'banners_use_group_conditions' => $banners_use_group_conditions, 'banners_html_text' => $banners_html_text);
     if ($action == 'insert') {
         $insert_sql_data = array('date_added' => 'now()', 'status' => '1');
         $sql_data_array = array_merge($sql_data_array, $insert_sql_data);
         tep_db_perform(TABLE_BANNERS, $sql_data_array);
         $banners_id = tep_db_insert_id();
         $messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
     } elseif ($action == 'update') {
示例#13
0
     if (tep_not_null($image_type)) {
         if ($image_type == '1') {
             $ext = 'gif';
         } elseif ($image_type == '2') {
             $ext = 'jpg';
         } elseif ($image_type == '3') {
             $ext = 'png';
         }
     } else {
         $ext = 'jpg';
     }
     $upload->filename = 'thumbs/p' . $products_id . '.' . $ext;
 }
 $uploaded = false;
 if (is_uploaded_file($products_image_big)) {
     if ($upload->upload('products_image_big', DIR_FS_CATALOG_IMAGES_BIG)) {
         $uploaded = true;
         tep_create_thumb(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename, '', BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT);
     }
 } elseif ($HTTP_POST_VARS['delete_big'] == '1') {
     @unlink(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename);
 }
 if (is_uploaded_file($products_image_middle)) {
     if ($upload->upload('products_image_middle', DIR_FS_CATALOG_IMAGES_MIDDLE)) {
         $uploaded = true;
         tep_create_thumb(DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename, '', BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT);
     }
 } elseif ($HTTP_POST_VARS['delete_middle'] == '1') {
     @unlink(DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename);
 } elseif ($HTTP_POST_VARS['middle_from_big'] == '1') {
     tep_create_thumb(DIR_FS_CATALOG_IMAGES_BIG . $upload->filename, DIR_FS_CATALOG_IMAGES_MIDDLE . $upload->filename, MIDDLE_IMAGE_WIDTH, MIDDLE_IMAGE_HEIGHT);
示例#14
0
     if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
         $size = @getimagesize($series_image);
         if ($size[2] == '3') {
             $ext = '.png';
         } elseif ($size[2] == '2') {
             $ext = '.jpg';
         } else {
             $ext = '.gif';
         }
         $new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($series_path));
         if (!tep_not_null($new_filename)) {
             $new_filename = $series_id;
         }
         $new_filename .= $ext;
         $upload->filename = 'series/' . $new_filename;
         if ($upload->upload('series_image', DIR_FS_CATALOG_IMAGES)) {
             $prev_file_query = tep_db_query("select series_image from " . TABLE_SERIES . " where series_id = '" . (int) $series_id . "'");
             $prev_file = tep_db_fetch_array($prev_file_query);
             if (tep_not_null($prev_file['series_image']) && $prev_file['series_image'] != $upload->filename) {
                 @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['series_image']);
             }
             if (SERIE_IMAGE_WIDTH > 0 || SERIE_IMAGE_HEIGHT > 0) {
                 tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', SERIE_IMAGE_WIDTH, SERIE_IMAGE_HEIGHT);
             }
             tep_db_query("update " . TABLE_SERIES . " set series_image = '" . $upload->filename . "' where series_id = '" . (int) $series_id . "'");
         }
     }
     tep_update_blocks($series_id, 'serie');
     tep_redirect(tep_href_link(FILENAME_SERIES, 'search=' . urlencode($search) . '&page=' . $HTTP_GET_VARS['page'] . '&sID=' . $series_id));
     break;
 case 'deleteconfirm':
示例#15
0
        $GMT_time = time();
        $insert_mesg_query = "INSERT INTO frei_chat (frei_chat.\"from\",from_name,frei_chat.\"to\",to_name,message,frei_chat.\"sent\",frei_chat.\"time\",message_type,room_id,GMT_time) VALUES(?,?,?,?,?,?,?,?,?,?)";
        $this->insert_mesg_query = $this->db->prepare($insert_mesg_query);
        $this->insert_mesg_query->execute(array($this->frm_id, $this->usr_name, $this->to, $this->to_name, $message, $this->mysql_now, $time, 0, '-1', $GMT_time));
        //echo $query;
    }
    //---------------------------------------------------------------------------------------------
    public function delete_files()
    {
        $captchaFolder = $this->path;
        // Filetypes to check (you can also use *.*)
        $fileTypes = '*.*';
        $expire_time = $this->expirytime;
        //in minutes
        // Find all files of the given file type
        foreach (glob($captchaFolder . $fileTypes) as $Filename) {
            // Read file creation time
            $FileCreationTime = filectime($Filename);
            // Calculate file age in seconds
            $FileAge = time() - $FileCreationTime;
            // Is the file older than the given time span?
            if ($FileAge > $expire_time * 60) {
                //   echo "The file $Filename is older than $expire_time minutes\n";
                unlink($Filename);
            }
        }
    }
}
$upload = new upload();
$upload->upload();
/*****************************************************************************
	Facula Framework Simple Home Page
	
	FaculaFramework 2009-2012 (C) Rain Lee <*****@*****.**>
	
	@Copyright 2009-2012 Rain Lee <*****@*****.**>
	@Author Rain Lee <*****@*****.**>
	@Package FaculaFramework
	@Version 0.2-alpha
*******************************************************************************/
$user = $ses->getSessionInfo();
$ui->assign('Returned', $sec->filterTextToWebForm($_MYPOST));
if (!$user['MemberID'] && $_MYPOST['submit']) {
    if (!$ses->signin($_MYPOST['token'], $_MYPOST['username'], $_MYPOST['password'])) {
        $ui->insertmessage($ses->error);
    }
} elseif ($user['MemberID'] && $_MYPOST['submit']) {
    if (!$ses->signout($_MYPOST['token'])) {
        $ui->insertmessage($ses->error);
    }
}
$users = new simple_users();
if ($_FILES['upload']) {
    $upload = new upload();
    if (!$upload->upload(7, "upload", "jpg,gif,png", 5000000)) {
        $ui->insertmessage($upload->error);
    }
}
$ui->assign('users', $users->getUsers());
$ui->display('test');
示例#17
0
 if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
     $size = @getimagesize($authors_image);
     if ($size[2] == '3') {
         $ext = '.png';
     } elseif ($size[2] == '2') {
         $ext = '.jpg';
     } else {
         $ext = '.gif';
     }
     $new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($authors_path));
     if (!tep_not_null($new_filename)) {
         $new_filename = $authors_id;
     }
     $new_filename .= $ext;
     $upload->filename = 'authors/' . $new_filename;
     if ($upload->upload('authors_image', DIR_FS_CATALOG_IMAGES)) {
         $prev_file_query = tep_db_query("select authors_image from " . TABLE_AUTHORS . " where authors_id = '" . (int) $authors_id . "'");
         $prev_file = tep_db_fetch_array($prev_file_query);
         if (tep_not_null($prev_file['authors_image']) && $prev_file['authors_image'] != $upload->filename) {
             @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['authors_image']);
         }
         if (AUTHOR_IMAGE_WIDTH > 0 || AUTHOR_IMAGE_HEIGHT > 0) {
             tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, '', AUTHOR_IMAGE_WIDTH, AUTHOR_IMAGE_HEIGHT);
             if (!is_dir(DIR_FS_CATALOG_IMAGES . 'authors/thumbs')) {
                 mkdir(DIR_FS_CATALOG_IMAGES . 'authors/thumbs', 0777);
             }
             tep_create_thumb(DIR_FS_CATALOG_IMAGES . $upload->filename, DIR_FS_CATALOG_IMAGES . str_replace('authors/', 'authors/thumbs/', $upload->filename), 50, 70);
         }
         tep_db_query("update " . TABLE_AUTHORS . " set authors_image = '" . $upload->filename . "' where authors_id = '" . (int) $authors_id . "'");
     }
 }
示例#18
0
 /**
  * 企业logo
  */
 public function logo()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         C('UPLOAD_IMG_DIR', '');
         //图片没有附文件夹
         C('THUMB_ENDFIX', '');
         //只生成头像缩略图(即覆盖原文件)
         $upload = new upload(PATH_ROOT . '/uploads/company_logo', array('jpg', 'jpeg', 'png', 'gif'), 3145728, 0, 1, array(100, 100, 4));
         $up_info = $upload->upload();
         if ($up_info) {
             $this->company->updateCompanyData(array('logo' => $up_info['0']['thumb']), 'uid=' . $_SESSION['uid']);
             //更新企业营业执照为正在审核中
             $this->success('企业LOGO修改成功!');
         } else {
             $this->error($upload->error);
         }
     }
     $info = $this->company->getCompanyDataById($_SESSION['uid'], 'logo');
     $this->assign('info', $info);
     $this->display('company/logo');
 }
示例#19
0
// |  Software: [HDPHP framework]
// |   Version: 2013.01
// |      Site: http://www.hdphp.com
// |-----------------------------------------------------------------------------------
// |    Author: 向军 <*****@*****.**>
// | Copyright (c) 2012-2013, http://houdunwang.com. All Rights Reserved.
// |-----------------------------------------------------------------------------------
// |   License: http://www.apache.org/licenses/LICENSE-2.0
// '-----------------------------------------------------------------------------------
header("Content-Type: text/html; charset=utf-8");
C("debug",0);
C("WATER_ON",intval($_GET['Image']));
if($_GET['maximagewidth']!='false' || $_GET['maximageheight']!='false'){
	$maximageheight = intval($_GET['maximageheight']);
	$maximagewidth =  intval($_GET['maximagewidth']);
	$maximagewidth = $maximagewidth?$maximagewidth:C("UPLOAD_IMG_MAX_WIDTH");
	$maximageheight =$maximageheight?$maximageheight:C("UPLOAD_IMG_MAX_HEIGHT");
	C("UPLOAD_IMG_RESIZE_ON",true);
	C("UPLOAD_IMG_MAX_WIDTH",$maximagewidth);
	C("UPLOAD_IMG_MAX_HEIGHT",$maximageheight);
}
$upload = new upload('','',intval($_GET['uploadsize']));
$file = $upload->upload();
if(!$file){
	echo json_encode(array('error' => 1, 'message' =>$upload->error));
	exit;
}
$file_url = __ROOT__.'/'.$file[0]['path'];
echo json_encode(array('error' => 0, 'url' => $file_url));
exit;
?>
示例#20
0
                if ($upload = new upload('', '', '777', array('jpeg', 'jpg', 'gif', 'png'))) {
                    $size = @getimagesize($specials_types_image);
                    if ($size[2] == '3') {
                        $ext = '.png';
                    } elseif ($size[2] == '2') {
                        $ext = '.jpg';
                    } else {
                        $ext = '.gif';
                    }
                    $new_filename = preg_replace('/[^\\d\\w]/i', '', strtolower($specials_types_path));
                    if (!tep_not_null($new_filename)) {
                        $new_filename = $specials_types_id;
                    }
                    $new_filename .= $ext;
                    $upload->filename = 'specials/' . $new_filename;
                    if ($upload->upload('specials_types_image', DIR_FS_CATALOG_IMAGES)) {
                        $prev_file_query = tep_db_query("select specials_types_image from " . TABLE_SPECIALS_TYPES . " where specials_types_id = '" . (int) $specials_types_id . "'");
                        $prev_file = tep_db_fetch_array($prev_file_query);
                        if (tep_not_null($prev_file['specials_types_image']) && $prev_file['specials_types_image'] != $upload->filename) {
                            @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['specials_types_image']);
                        }
                        tep_db_query("update " . TABLE_SPECIALS_TYPES . " set specials_types_image = '" . $upload->filename . "' where specials_types_id = '" . (int) $specials_types_id . "'");
                    }
                }
                tep_redirect(tep_href_link(FILENAME_SPECIALS, 'tID=' . $specials_types_id));
            }
            break;
    }
}
$specials_types_heading = '';
$special_types = array(array('id' => '', 'text' => TEXT_DEFAULT_SELECT));