コード例 #1
1
ファイル: download_file.php プロジェクト: kmklr72/lmms.io
function download_file($file_id, $file_name)
{
    global $DATA_DIR;
    $file_path = $DATA_DIR . $file_id;
    if (file_exists($file_path)) {
        increment_file_downloads($file_id);
        $content_type = get_content_type($file_name);
        header("Content-type: {$content_type}");
        $user_agent = $_SERVER['HTTP_USER_AGENT'];
        if (!is_image($file_name)) {
            if (is_integer(strpos($user_agent, "msie")) && is_integer(strpos($user_agent, "win"))) {
                header("Content-Disposition:filename=\"{$file_name}\"");
            } else {
                header("Content-Disposition: attachment; filename=\"{$file_name}\"");
            }
            header("Content-Description: Download");
        }
        ob_clean();
        flush();
        readfile($file_path);
    } else {
        require_once 'dbo.php';
        header("HTTP/1.0 404 Not Found");
        echo "<h1>HTTP/1.0 404 Not Found</h1>";
        $link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
        echo "Sorry, file was not found.  Please notify <a href=\"mailto:webmaster@lmms.io" . "?subject=LSP 404&body=FYI: 404 Not Found: {$link}\">webmaster@lmms.io</a> of this error.";
    }
    exit;
}
コード例 #2
0
ファイル: oa.modules.php プロジェクト: sany217/WeiXin
 public function getFirstImage($module, $attachment_id, $attachment_name)
 {
     if ($attachment_id == "") {
         return "";
     }
     $attachment_id_array = explode(",", $attachment_id);
     $attachment_name_array = explode("*", $attachment_name);
     $array_count = sizeof($attachment_id_array);
     $i = 0;
     for (; $i < $array_count; ++$i) {
         if ($attachment_id_array[$i] == "") {
             continue;
         }
         $attachment_id1 = $attachment_id_array[$i];
         $ym = substr($attachment_id1, 0, strpos($attachment_id1, "_"));
         if ($ym) {
             $attachment_id1 = substr($attachment_id1, strpos($attachment_id, "_") + 1);
         }
         $attachment_id_encoded = attach_id_encode($attachment_id1, $attachment_name_array[$i]);
         $url_array = attach_url($attachment_id_array[$i], $attachment_name_array[$i], $module, $other);
         if (!is_image($attachment_name_array[$i])) {
             continue;
         }
         return "/inc/attach.php?MODULE=" . $module . "&YM=" . $ym . "&ATTACHMENT_ID=" . $attachment_id_encoded . "&ATTACHMENT_NAME=" . urlencode($attachment_name_array[$i]) . "&DIRECT_VIEW=1";
     }
     return "";
 }
コード例 #3
0
 /**
  * The second last process, should only be getting everything
  * syntaxically correct, rather than doing any heavy processing
  *
  * @author Anthony Short
  * @return $css string
  */
 public static function post_process()
 {
     if ($found = CSS::find_properties_with_value('image-replace', 'url\\([\'\\"]?([^)]+)[\'\\"]?\\)')) {
         foreach ($found[4] as $key => $value) {
             $path = $url = str_replace("\\", "/", unquote($value));
             # If they're getting an absolute file
             if ($path[0] == "/") {
                 $path = DOCROOT . ltrim($path, "/");
             }
             # Check if it exists
             if (!file_exists($path)) {
                 FB::log("ImageReplace - Image doesn't exist " . $path);
             }
             # Make sure it's an image
             if (!is_image($path)) {
                 FB::log("ImageReplace - File is not an image: {$path}");
             }
             // Get the size of the image file
             $size = GetImageSize($path);
             $width = $size[0];
             $height = $size[1];
             // Make sure theres a value so it doesn't break the css
             if (!$width && !$height) {
                 $width = $height = 0;
             }
             // Build the selector
             $properties = "\n\t\t\t\t\tbackground:url({$url}) no-repeat 0 0;\n\t\t\t\t\theight:{$height}px;\n\t\t\t\t\twidth:{$width}px;\n\t\t\t\t\tdisplay:block;\n\t\t\t\t\ttext-indent:-9999px;\n\t\t\t\t\toverflow:hidden;\n\t\t\t\t";
             CSS::replace($found[2][$key], $properties);
         }
         # Remove any left overs
         CSS::replace($found[1], '');
     }
 }
コード例 #4
0
function cpgUserLastComment($uid)
{
    global $CONFIG, $FORBIDDEN_SET;
    $result = cpg_db_query("SELECT COUNT(*), MAX(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE approval = 'YES' AND author_id = '{$uid}' {$FORBIDDEN_SET}");
    list($comment_count, $lastcom_id) = mysql_fetch_row($result);
    mysql_free_result($result);
    $lastComArray = array('count' => 0);
    if ($comment_count) {
        $sql = "SELECT filepath, filename, url_prefix, pwidth, pheight, msg_author, UNIX_TIMESTAMP(msg_date) as msg_date, msg_body FROM {$CONFIG['TABLE_COMMENTS']} AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid WHERE msg_id = {$lastcom_id}";
        $result = cpg_db_query($sql);
        if (mysql_num_rows($result)) {
            $row = mysql_fetch_assoc($result);
            $pic_url = get_pic_url($row, 'thumb');
            if (!is_image($row['filename'])) {
                $image_info = cpg_getimagesize(urldecode($pic_url));
                $row['pwidth'] = $image_info[0];
                $row['pheight'] = $image_info[1];
            }
            $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['thumb_width']);
            $lastcom = '<img src="' . $pic_url . '" class="image"' . $image_size['geom'] . ' border="0" alt="" />';
            $lastComArray = array('thumb' => $lastcom, 'comment' => $row['msg_body'], 'msg_date' => $row['msg_date'], 'count' => $comment_count);
        }
        mysql_free_result($result);
    }
    return $lastComArray;
}
コード例 #5
0
function caching($comics_id, $zip_path, $image_ext)
{
    $comic = zip_open($zip_path);
    if (!is_resource($comic)) {
        die("[ERR]ZIP_OPEN : " . $zip_path);
    }
    $inzip_path = "";
    $count = 0;
    $files = null;
    $db = new SQLite3(DB);
    $db->exec("BEGIN DEFERRED;");
    while (($entry = zip_read($comic)) !== false) {
        $inzip_path = zip_entry_name($entry);
        $cache_name = md5($zip_path . "/" . $inzip_path) . '.' . get_ext($inzip_path);
        // 画像か否か
        if (!is_image($inzip_path, $image_ext)) {
            continue;
        }
        $data = zip_entry_read($entry, zip_entry_filesize($entry));
        $filepath = CACHE . '/' . $cache_name;
        file_put_contents($filepath, $data);
        $count++;
        query("INSERT INTO images (comics_id, page, filepath) VALUES (" . $comics_id . ", " . $count . ", '" . $filepath . "')", $db);
    }
    zip_close($comic);
    query("UPDATE comics SET pages = " . $count . " WHERE id = " . $comics_id, $db);
    $db->exec("COMMIT;");
}
コード例 #6
0
ファイル: index.php プロジェクト: nWidart/TPWeb_Gallerie
function create_gallery()
{
    global $types_ok;
    $chemin = "images/projects_filtres";
    if ($handle = opendir($chemin)) {
        $img = '';
        $count = 0;
        while (($filename = readdir($handle)) !== FALSE) {
            $count++;
            // c'est une image?
            $chemin_image = $chemin . '/' . $filename;
            if (!is_dir($chemin_image)) {
                if (is_image($chemin_image)) {
                    $tab_ficher = explode('.', $filename);
                    // Le nom du fichier [1]= extension
                    $tab_details_nom = explode('-', $tab_ficher[0]);
                    $tab_filtres = explode('_', $tab_details_nom[1]);
                    // var_dump($tab_filtres);
                    $filters = implode(' ', $tab_filtres);
                    echo '<li class="element ' . $filters . '">';
                    echo '<a href="' . $chemin_image . '"><img src="images/projects/img' . $count . '.jpg" alt="" /></a>';
                    echo '</li>';
                }
            }
        }
    }
}
コード例 #7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $mcid
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $mcid_id)
 {
     $this->validate($request, ['file' => 'required']);
     $mcid = MCID::findOrFail($mcid_id);
     $file = $_FILES['file'];
     $fileName = md5($mcid_id . $file['name'] . time());
     $path = str_finish($this->skin_path, '/') . $fileName;
     $content = File::get($file['tmp_name']);
     if (is_image($file['type']) && $file['size'] <= 150 * 1000) {
         list($img_w, $img_h) = getimagesize($file['tmp_name']);
         if ($img_w > 64 || $img_h > 64) {
             $error = "皮肤文件 '{$fileName}' 尺寸不正确.";
         } else {
             $result = $this->manager->saveFile($path, $content);
             if ($result === true) {
                 $skin = Skin::where('mcid_id', $mcid->id)->first();
                 if ($skin == null) {
                     $skin = new Skin();
                 }
                 $skin->mcid_id = $mcid->id;
                 $skin->url = $path;
                 $skin->save();
                 return redirect()->back()->withSuccess("皮肤文件 '{$fileName}' 上传成功.");
             } else {
                 $error = $result ?: "皮肤文件 '{$fileName}' 上传失败.";
             }
         }
     } else {
         $error = "皮肤文件 '{$fileName}' 格式或大小不正确.";
     }
     return redirect()->back()->withErrors([$error]);
 }
コード例 #8
0
ファイル: index.php プロジェクト: fbianco/MimingGallery
function get_images_list()
{
    $S = array();
    foreach (scandir(IDIR) as $O) {
        $I = IDIR . $O;
        if (is_image($I) && is_readable($I)) {
            array_push($S, $O);
        }
    }
    return $S;
}
コード例 #9
0
function get_images_list()
{
    // Return a list of readable images in IDIR
    $images_list = array();
    foreach (scandir(IDIR) as $fname) {
        $fpath = IDIR . $fname;
        if (is_image($fpath) && is_readable($fpath)) {
            array_push($images_list, $fname);
        }
    }
    return $images_list;
}
コード例 #10
0
ファイル: upload.php プロジェクト: philum/cms
function upurlsav($dr, $o, $u)
{
    $u = ajxg($u);
    if (!is_image($u)) {
        return 'no';
    }
    $ret = get_file($u);
    $nm = strrchr($u, '/');
    $f = 'users/' . $dr . '/' . $nm;
    write_file($f, $ret);
    return 'ok';
}
コード例 #11
0
ファイル: utils.php プロジェクト: kmklr72/lmms.io
function is_lsp_image($file_path)
{
    if (!is_image($file_path) || explode("download_file.php", $file_path) < 2) {
        return false;
    }
    $parsed = parse_url($file_path);
    if (isset($parsed['query'])) {
        $query = array();
        parse_str($parsed['query'], $query);
        return $query['file'];
    }
    return false;
}
コード例 #12
0
ファイル: ifrm.php プロジェクト: philum/cms
function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    if ($f) {
        $f = str_replace(array("\n", "\r"), ' ', $f);
        $r = explode(' ', $f);
        foreach ($r as $v) {
            $d = curl_get_contents($v);
            if (is_image($v) && $d) {
                $ret .= ifrim($v, $d);
            }
        }
    }
    return $ret;
}
コード例 #13
0
ファイル: image_thumbs.php プロジェクト: erico-deh/ocPortal
 /**
  * Create filename-mirrored thumbnails for the given directory stub (mirrors stub/foo with stub_thumbs/foo).
  *
  * @param  string		Directory to mirror
  */
 function directory_thumb_mirror($dir)
 {
     require_code('images');
     $full = get_custom_file_base() . '/uploads/' . $dir;
     $dh = @opendir($full);
     if ($dh !== false) {
         while (($file = readdir($dh)) !== false) {
             $target = get_custom_file_base() . '/' . $dir . '_thumbs/' . $file;
             if (!file_exists($target) && is_image($full . '/' . $file)) {
                 require_code('images');
                 convert_image($full . '/' . $file, $target, -1, -1, intval(get_option('thumb_width')));
             }
         }
     }
     closedir($dh);
 }
コード例 #14
0
ファイル: ifr.php プロジェクト: philum/cms
function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    $f = http($f);
    if ($f) {
        $ret = curl_get_contents($f);
        if (is_image($f) && $ret) {
            $ret = ifrim($f, $ret);
        }
    }
    $encoding = embed_detect(strtolower($ret), "charset=", '"', "");
    if (strtolower($encoding) == "utf-8" or strpos($ret, 'é')) {
        $ret = utf8_decode_b($ret);
    }
    return $ret;
}
コード例 #15
0
ファイル: helpers.php プロジェクト: inoplate/media
 /**
  * Retrieve image thumbnail
  * 
  * @param  string $mime
  * @return string
  */
 function get_thumbnail($mime, $forImage)
 {
     if (is_image($mime)) {
         return $forImage;
     } elseif (is_video($mime)) {
         return "/vendor/inoplate-media/images/medias/video_128px.png";
     } elseif (is_audio($mime)) {
         return "/vendor/inoplate-media/images/medias/music_128px.png";
     } elseif ($mime == 'application/excel' || $mime == 'application/vnd.ms-excel' || $mime == 'application/x-excel' || $mime == 'application/x-msexcel') {
         return "/vendor/inoplate-media/images/medias/xls_128px.png";
     } elseif ($mime == 'application/mspowerpoint' || $mime == 'application/powerpoint' || $mime == 'application/vnd.ms-powerpoint' || $mime == 'application/x-mspowerpoint') {
         return "/vendor/inoplate-media/images/medias/xls_128px.png";
     } else {
         return "/vendor/inoplate-media/images/medias/file_128px.png";
     }
 }
コード例 #16
0
ファイル: user.lib.php プロジェクト: rhertzog/lcs
/**
 * Handle user's profile picture modification
 * (based on $_REQUEST['delPicture'] and $_FILE['picture'].
 *
 * @return  $feedback array (yes, it is kinda ugly)
 */
function user_handle_profile_picture($userData)
{
    $feedback = array('success' => false, 'messages' => array(), 'pictureName' => '');
    // Handle user picture
    if (!empty($_REQUEST['delPicture'])) {
        $picturePath = user_get_picture_path($userData);
        if ($picturePath) {
            claro_delete_file($picturePath);
            $feedback['success'] = true;
            $feedback['messages'][] = get_lang("User picture deleted");
        } else {
            $feedback['messages'][] = get_lang("Cannot delete user picture");
        }
    }
    if (isset($_FILES['picture']['name']) && $_FILES['picture']['size'] > 0) {
        $fileName = $_FILES['picture']['name'];
        $fileTmpName = $_FILES['picture']['tmp_name'];
        if (is_uploaded_file($fileTmpName)) {
            // Is it an picture ?
            if (is_image($fileName)) {
                // Does it meet the platform's requirements
                list($width, $height, $type, $attr) = getimagesize($fileTmpName);
                if ($width > 0 && $width <= get_conf('maxUserPictureWidth', 150) && $height > 0 && $height <= get_conf('maxUserPictureHeight', 200) && $_FILES['picture']['size'] <= get_conf('maxUserPictureSize', 100 * 1024)) {
                    $uploadDir = user_get_private_folder_path($userData['user_id']);
                    if (!file_exists($uploadDir)) {
                        claro_mkdir($uploadDir, CLARO_FILE_PERMISSIONS, true);
                    }
                    // User's picture successfully treated
                    if (false !== ($pictureName = treat_uploaded_file($_FILES['picture'], $uploadDir, '', 1000000000000.0))) {
                        $feedback['success'] = true;
                        $feedback['messages'][] = get_lang("User picture added");
                        $feedback['pictureName'] = $pictureName;
                    } else {
                        $feedback['messages'][] = get_lang("Cannot upload file");
                    }
                } else {
                    $feedback['messages'][] = get_lang("Image is too big : max size %width%x%height%, %size% bytes", array('%width%' => get_conf('maxUserPictureWidth', 150), '%height%' => get_conf('maxUserPictureHeight', 200), '%size%' => get_conf('maxUserPictureHeight', 100 * 1024)));
                }
            } else {
                $feedback['messages'][] = get_lang("Invalid file format, use gif, jpg or png");
            }
        } else {
            $feedback['messages'][] = get_lang('Upload failed');
        }
    }
    return $feedback;
}
コード例 #17
0
ファイル: functions.php プロジェクト: qwazix/viood
/**
 * Recurses into a directory and writes the structure
 * in an associative array
 * @global string $pictureDir from config.php
 * @param string $directory The directory to recurse into
 * @param array $array The array to put the results in
 * @param int $depth How deep should it go? (Default 1)
 * @return array
 * 
 */
function recurse_dir($directory, $array, $depth = 1, $include_info = true, $full_path = false)
{
    //    echo $directory,"<br><br>";
    global $pictureDir;
    $dirName = basename($directory);
    if (!is_dir($directory)) {
        include '404.php';
    }
    $gallery_info = getGalleryInfo($dirName);
    //get images to be ignored from gallery.json
    if (is_array($gallery_info["ignore"])) {
        $ignore_images = $gallery_info["ignore"];
    } else {
        $ignore_images = array();
    }
    if ($handle = opendir($directory)) {
        //for each entry found inside $directory
        while (false !== ($entry = readdir($handle))) {
            $path = $directory . "/" . $entry;
            //echo "$pictureDir -- $dirName -- $path -- $entry \n </br>";
            //ignore . and .. , write directories to the array and recurse into them
            if ($entry != "." && $entry != ".." && !in_array($entry, $ignore_images)) {
                if (is_dir($path)) {
                    $array[$entry] = array();
                    if ($include_info) {
                        $array[$entry]["__info__"] = getGalleryInfo($path);
                    }
                    if ($depth != 0) {
                        $array[$entry] = recurse_dir($path, $array[$entry], $depth - 1, $include_info, $full_path);
                    }
                } else {
                    if (is_image($path)) {
                        $array[$entry] = $full_path ? $path : $entry;
                    }
                }
            }
        }
        closedir($handle);
    }
    //echo "final"; _print_r($array);
    return $array;
}
コード例 #18
0
ファイル: UploadManager.php プロジェクト: marcoax/laraCms
 public function init($media, $model)
 {
     $this->model = $model;
     $this->media = $media;
     echo 'myFunction is OK' . $media;
     if (Input::hasFile($media) && Input::file($media)->isValid()) {
         $newMedia = Input::file($media);
         $mediaType = is_image($newMedia->getMimeType()) == 'image' ? 'images' : 'docs';
         $destinationPath = config('laraCms.admin.path.repository') . '/' . $mediaType;
         // upload path
         $extension = $newMedia->getClientOriginalExtension();
         // getting image extension
         $name = basename($newMedia->getClientOriginalName(), '.' . $extension);
         $fileName = str_slug(rand(11111, 99999) . '_' . $name) . "." . $extension;
         // renameing image
         $newMedia->move($destinationPath, $fileName);
         // uploading file to given path
         echo $this->model->{$media} = $fileName;
     }
 }
コード例 #19
0
ファイル: ifram.php プロジェクト: philum/cms
function ifrget($a, $b, $f)
{
    $f = ajxg($f);
    $f = http($f);
    if ($a) {
        ifradd();
    }
    if ($f) {
        $ret = read_file($f);
        $ret = ifrcorr($ret, $f);
        if (is_image($f) && $ret) {
            $ret = ifrim($f, $ret);
        }
    }
    $encoding = embed_detect(strtolower($ret), "charset=", '"', "");
    if (strtolower($encoding) == "utf-8" or strpos($ret, 'é')) {
        $ret = utf8_decode_b($ret);
    }
    return $ret;
}
コード例 #20
0
ファイル: AjaxController.php プロジェクト: marcoax/laraCms
 /**
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function uploadifive(Request $request)
 {
     $media = 'Filedata';
     if (Input::hasFile($media) && Input::file($media)->isValid()) {
         $newMedia = Input::file($media);
         $mediaType = is_image($newMedia->getMimeType()) == 'image' ? 'images' : 'docs';
         $destinationPath = $mediaType;
         // upload path folder
         $extension = $newMedia->getClientOriginalExtension();
         // getting image extension
         $name = basename($newMedia->getClientOriginalName(), '.' . $extension);
         $fileName = str_slug($newMedia->getClientOriginalName());
         $mediaPath = public_path('media/' . $destinationPath . '/' . $fileName);
         // renaming image if exist
         if (file_exists($mediaPath)) {
             $fileName = str_slug(rand(11111, 99999) . '_' . $name) . "." . $extension;
         }
         $storage = \Storage::disk('media');
         $storage->put($destinationPath . '/' . $fileName, file_get_contents($newMedia), 'public');
         if (is_image($newMedia->getMimeType()) == 'image') {
             $img = Image::make(public_path('media/' . $destinationPath . '/' . $fileName))->widen(1600);
             // save file as png with medium quality
             $img->save(public_path('media/' . $destinationPath . '/' . $fileName, 60));
         }
         $modelClass = 'App\\' . $request->model;
         $list = $modelClass::find($request->Id);
         $c = new Media();
         $c->title = $fileName;
         $c->file_name = $fileName;
         $c->size = $newMedia->getClientSize();
         $c->collection_name = $mediaType;
         $c->disk = $destinationPath;
         $c->media_category_id = $request->myImgType;
         $c->file_ext = $extension;
         $list->media()->save($c);
         $this->responseContainer['status'] = 'ok';
         $this->responseContainer['data'] = $mediaType;
         return $this->responseHandler();
     }
 }
コード例 #21
0
ファイル: codebase.php プロジェクト: phill104/branches
function facebook_file_data($CURRENT_PIC_DATA)
{
    global $CONFIG;
    //	print_r ($CURRENT_PIC_DATA);
    if (is_image($CURRENT_PIC_DATA['filename'])) {
        $html =& $CURRENT_PIC_DATA['html'];
        $html = '<div class="Photo fn-container" id="PhotoContainer">' . $html . '</div>';
        $html .= <<<EOT
\t\t


EOT;
        $html .= <<<EOT
\t\t
\t\t<div style="clear: both; padding-top: 10px; padding-bottom: 10px">
\t\t\t<style> html .fb_share_link { padding:2px 0 0 20px; height:216px; }</style><a href="http://www.facebook.com/sharer.php?u={$CONFIG['site_url']}{$CURRENT_PIC_DATA['url']}&{$CURRENT_PIC_DATA['title']}" TARGET="_blank" onclick="window.open(this.href,'window','width=626,height=436,resizable') ;return false;"><img src="plugins/facebook/facebook_share_button.jpg" width=75 height=33 /></a>
\t\t</div>

EOT;
    }
    return $CURRENT_PIC_DATA;
}
コード例 #22
0
ファイル: banners.php プロジェクト: erico-deh/ocPortal
 /**
  * Standard modular run function for realtime-rain hooks.
  *
  * @param  TIME			Start of time range.
  * @param  TIME			End of time range.
  * @return array			A list of template parameter sets for rendering a 'drop'.
  */
 function run($from, $to)
 {
     $drops = array();
     if (has_actual_page_access(get_member(), 'admin_banners')) {
         $rows = $GLOBALS['SITE_DB']->query('SELECT b.name,img_url,c_ip_address,c_member_id AS member_id,c_date_and_time AS timestamp FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banner_clicks c LEFT JOIN ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'banners b ON b.name=c.c_banner_id WHERE c_date_and_time BETWEEN ' . strval($from) . ' AND ' . strval($to));
         require_lang('banners');
         foreach ($rows as $row) {
             $timestamp = $row['timestamp'];
             $member_id = $row['member_id'];
             $image = is_guest($member_id) ? rain_get_country_image($row['c_ip_address']) : $GLOBALS['FORUM_DRIVER']->get_member_avatar_url($member_id);
             require_code('images');
             if (is_image($row['img_url'])) {
                 $image = $row['img_url'];
             }
             if (url_is_local($image)) {
                 $image = get_custom_base_url() . '/' . $image;
             }
             $drops[] = rain_get_special_icons($row['c_ip_address'], $timestamp) + array('TYPE' => 'banners', 'FROM_MEMBER_ID' => strval($member_id), 'TO_MEMBER_ID' => NULL, 'TITLE' => do_lang('BANNER_CLICKED'), 'IMAGE' => $image, 'TIMESTAMP' => strval($timestamp), 'RELATIVE_TIMESTAMP' => strval($timestamp - $from), 'TICKER_TEXT' => NULL, 'URL' => NULL, 'IS_POSITIVE' => true, 'IS_NEGATIVE' => false, 'FROM_ID' => 'member_' . strval($member_id), 'TO_ID' => NULL, 'GROUP_ID' => 'banner_' . $row['name']);
         }
     }
     return $drops;
 }
コード例 #23
0
ファイル: image.php プロジェクト: rhertzog/lcs
} else {
    $relativePath = '/';
}
/*
 * Handle upload
 */
if ($is_allowedToEdit && isset($_FILES['sentFile']['tmp_name']) && is_uploaded_file($_FILES['sentFile']['tmp_name'])) {
    $imgFile = $_FILES['sentFile'];
    $imgFile['name'] = replace_dangerous_char($imgFile['name'], 'strict');
    $imgFile['name'] = get_secure_file_name($imgFile['name']);
    if (claro_is_in_a_course()) {
        $enoughSize = enough_size($_FILES['sentFile']['size'], $pathSys, $maxFilledSpace);
    } else {
        $enoughSize = true;
    }
    if (is_image($imgFile['name']) && $enoughSize) {
        // rename if file already exists
        if (file_exists($pathSys . $relativePath . $imgFile['name'])) {
            $pieceList = explode('.', $imgFile['name']);
            $base = $pieceList[0];
            $ext = $pieceList[1];
            $i = 1;
            while (file_exists($pathSys . $relativePath . $base . '_' . $i . '.' . $ext)) {
                $i++;
            }
            $imgFile['name'] = $base . '_' . $i . '.' . $ext;
            $alertMessage = get_lang('A file with this name already exists.') . "\n" . get_lang('Your file has been renamed to %filename', array('%filename' => $imgFile['name']));
        }
        if (move_uploaded_file($imgFile['tmp_name'], $pathSys . $relativePath . $imgFile['name'])) {
            $imgUrl = str_replace('//', '/', $pathWeb . $relativePath . $imgFile['name']);
        } else {
コード例 #24
0
ファイル: reviewcom.php プロジェクト: alencarmo/OCF
        <a href="{$_SERVER['PHP_SELF']}?start={$start}&amp;count={$count}&amp;sort=comment_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['comment_d']}" /></a>
        </td>
        <td class="tableh2" valign="top">{$lang_reviewcom_php['file']}
        <a href="{$_SERVER['PHP_SELF']}?start={$start}&amp;count={$count}&amp;sort=file_a"><img src="images/ascending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['file_a']}" /></a>
        <a href="{$_SERVER['PHP_SELF']}?start={$start}&amp;count={$count}&amp;sort=file_d"><img src="images/descending.gif" width="9" height="9" border="0" alt="" title="{$lang_reviewcom_php['file_d']}" /></a>
        </td>
        </tr>

EOT;
$sort_codes = array('name_a' => 'msg_author ASC', 'name_d' => 'msg_author DESC', 'date_a' => 'msg_id ASC', 'date_d' => 'msg_id DESC', 'comment_a' => 'msg_body ASC', 'comment_d' => 'msg_body DESC', 'file_a' => 'pid ASC', 'file_d' => 'pid DESC');
$sort = !isset($_GET['sort']) || !isset($sort_codes[$_GET['sort']]) ? 'date_d' : $_GET['sort'];
$result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, {$CONFIG['TABLE_COMMENTS']}.pid as pid, aid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']} WHERE {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid ORDER BY {$sort_codes[$sort]} LIMIT {$start}, {$count}");
$rowcounter = 0;
while ($row = mysql_fetch_array($result)) {
    $thumb_url = get_pic_url($row, 'thumb');
    if (!is_image($row['filename'])) {
        $image_info = getimagesize($thumb_url);
        $row['pwidth'] = $image_info[0];
        $row['pheight'] = $image_info[1];
    }
    $image_size = compute_img_size($row['pwidth'], $row['pheight'], $CONFIG['alb_list_thumb_size']);
    $thumb_link = 'displayimage.php?pos=' . -$row['pid'];
    $msg_date = localised_date($row['msg_date'], $comment_date_fmt);
    $msg_body = bb_decode(process_smilies($row['msg_body']));
    $rowcounter++;
    if ($rowcounter >= 2) {
        //let the row colors alternate, for now they are the same
        $rowcounter = 0;
        $tableclass = 'tableb';
        // change to "tableh2_compact" or similar for alternation
    } else {
コード例 #25
0
function get_body_class()
{
    // Home page classes.
    if (is_page('home')) {
        // Simple "home" class.
        echo VIDEO_SERVICE . ' home';
        // Single page classes.
    } elseif (is_page('single')) {
        // Simple "single" class.
        echo VIDEO_SERVICE . ' single';
        // Page page classes.
    } else {
        //
        if (is_image('background')) {
            echo 'page background';
        } else {
            echo 'page';
        }
    }
}
コード例 #26
0
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
{
    global $CONFIG, $USER_DATA, $PIC_NEED_APPROVAL, $CURRENT_PIC_DATA;
    global $lang_errors, $lang_db_input_php;
    $image = $CONFIG['fullpath'] . $filepath . $filename;
    $normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
    $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;
    $orig = $CONFIG['fullpath'] . $filepath . $CONFIG['orig_pfx'] . $filename;
    // $mini = $CONFIG['fullpath'] . $filepath . $CONFIG['mini_pfx'] . $filename;
    $work_image = $image;
    if (!is_known_filetype($image)) {
        return array('error' => $lang_db_input_php['err_invalid_fext'] . ' ' . $CONFIG['allowed_file_extensions'], 'halt_upload' => 0);
    } elseif (is_image($filename)) {
        $imagesize = cpg_getimagesize($image);
        if ($CONFIG['read_iptc_data']) {
            // read IPTC data
            $iptc = get_IPTC($image);
            if (is_array($iptc) && !$title && !$caption && !$keywords) {
                //if any of those 3 are filled out we don't want to override them, they may be blank on purpose.
                $title = isset($iptc['Headline']) ? trim($iptc['Headline']) : $title;
                $caption = isset($iptc['Caption']) ? trim($iptc['Caption']) : $caption;
                $keywords = isset($iptc['Keywords']) ? implode($CONFIG['keyword_separator'], $iptc['Keywords']) : $keywords;
            }
        }
        // resize picture if it's bigger than the max width or height for uploaded pictures
        if (max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) {
            if (USER_IS_ADMIN && $CONFIG['auto_resize'] == 1 || !USER_IS_ADMIN && $CONFIG['auto_resize'] > 0) {
                $resize_method = $CONFIG['picture_use'] == "thumb" ? $CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use'] : $CONFIG['picture_use'];
                resize_image($image, $image, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $resize_method, 'false');
                $imagesize = cpg_getimagesize($image);
            } elseif (USER_IS_ADMIN) {
                // skip resizing for admin
                $picture_original_size = true;
            } else {
                @unlink($uploaded_pic);
                $msg = sprintf($lang_db_input_php['err_fsize_too_large'], $CONFIG['max_upl_width_height'], $CONFIG['max_upl_width_height']);
                return array('error' => $msg, 'halt_upload' => 1);
            }
        }
        // create backup of full sized picture if watermark is enabled for full sized pictures
        if (!file_exists($orig) && $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
            if (!copy($image, $orig)) {
                return false;
            } else {
                $work_image = $orig;
            }
        }
        if (!file_exists($thumb)) {
            // create thumbnail
            if (($result = resize_image($work_image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'], "false", 1)) !== true) {
                return $result;
            }
        }
        if ($CONFIG['make_intermediate'] && cpg_picture_dimension_exceeds_intermediate_limit($imagesize[0], $imagesize[1]) && !file_exists($normal)) {
            // create intermediate sized picture
            $resize_method = $CONFIG['picture_use'] == "thumb" ? $CONFIG['thumb_use'] == "ex" ? "any" : $CONFIG['thumb_use'] : $CONFIG['picture_use'];
            $watermark = $CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'resized') ? 'true' : 'false';
            if (($result = resize_image($work_image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $resize_method, $watermark)) !== true) {
                return $result;
            }
        }
        // watermark full sized picture
        if ($CONFIG['enable_watermark'] == '1' && ($CONFIG['which_files_to_watermark'] == 'both' || $CONFIG['which_files_to_watermark'] == 'original')) {
            $wm_max_upl_width_height = $picture_original_size ? max($imagesize[0], $imagesize[1]) : $CONFIG['max_upl_width_height'];
            // use max aspect of original image if it hasn't been resized earlier
            if (($result = resize_image($work_image, $image, $wm_max_upl_width_height, $CONFIG['thumb_method'], 'any', 'true')) !== true) {
                return $result;
            }
        }
    } else {
        $imagesize[0] = $iwidth;
        $imagesize[1] = $iheight;
    }
    clearstatcache();
    $image_filesize = filesize($image);
    $total_filesize = is_image($filename) ? $image_filesize + (file_exists($normal) ? filesize($normal) : 0) + filesize($thumb) : $image_filesize;
    // Test if disk quota exceeded
    if (!GALLERY_ADMIN_MODE && $USER_DATA['group_quota'] && $category == FIRST_USER_CAT + USER_ID) {
        $result = cpg_db_query("SELECT sum(total_filesize) FROM {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']} WHERE  {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND category = '" . (FIRST_USER_CAT + USER_ID) . "'");
        $record = mysql_fetch_array($result);
        $total_space_used = $record[0];
        mysql_free_result($result);
        if ($total_space_used + $total_filesize >> 10 > $USER_DATA['group_quota']) {
            @unlink($image);
            if (is_image($image)) {
                @unlink($normal);
                @unlink($thumb);
            }
            $msg = $lang_errors['quota_exceeded'] . '<br />&nbsp;<br />' . strtr($lang_errors['quota_exceeded_details'], array('[quota]' => $USER_DATA['group_quota'], '[space]' => $total_space_used >> 10));
            return array('error' => $msg, 'halt_upload' => 1);
        }
    }
    // Test if picture requires approval
    if (GALLERY_ADMIN_MODE) {
        $approved = 'YES';
    } elseif (!$USER_DATA['priv_upl_need_approval'] && $category == FIRST_USER_CAT + USER_ID) {
        $approved = 'YES';
    } elseif (!$USER_DATA['pub_upl_need_approval'] && $category < FIRST_USER_CAT) {
        $approved = 'YES';
    } else {
        $approved = 'NO';
    }
    $PIC_NEED_APPROVAL = $approved == 'NO';
    // User ID is recorded when in admin mode
    $user_id = USER_ID;
    // Populate Array to pass to plugins, then to SQL
    $CURRENT_PIC_DATA['aid'] = $aid;
    $CURRENT_PIC_DATA['filepath'] = $filepath;
    $CURRENT_PIC_DATA['filename'] = $filename;
    $CURRENT_PIC_DATA['filesize'] = $image_filesize;
    $CURRENT_PIC_DATA['total_filesize'] = $total_filesize;
    $CURRENT_PIC_DATA['pwidth'] = $imagesize[0];
    $CURRENT_PIC_DATA['pheight'] = $imagesize[1];
    $CURRENT_PIC_DATA['owner_id'] = $user_id;
    $CURRENT_PIC_DATA['title'] = $title;
    $CURRENT_PIC_DATA['caption'] = $caption;
    $CURRENT_PIC_DATA['keywords'] = $keywords;
    $CURRENT_PIC_DATA['approved'] = $approved;
    $CURRENT_PIC_DATA['user1'] = $user1;
    $CURRENT_PIC_DATA['user2'] = $user2;
    $CURRENT_PIC_DATA['user3'] = $user3;
    $CURRENT_PIC_DATA['user4'] = $user4;
    $CURRENT_PIC_DATA['pic_raw_ip'] = $raw_ip;
    $CURRENT_PIC_DATA['pic_hdr_ip'] = $hdr_ip;
    $CURRENT_PIC_DATA['position'] = $position;
    $CURRENT_PIC_DATA['guest_token'] = USER_ID == 0 ? cpg_get_guest_token() : '';
    $CURRENT_PIC_DATA = CPGPluginAPI::filter('add_file_data', $CURRENT_PIC_DATA);
    if (USER_ID > 0 || $CONFIG['allow_guests_enter_file_details'] == 1) {
        $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$CURRENT_PIC_DATA['guest_token']}')";
    } else {
        $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, guest_token) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '', '', '', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$CURRENT_PIC_DATA['guest_token']}')";
    }
    $result = cpg_db_query($query);
    // Put the pid in current_pic_data and call the plugin filter for file data success
    $CURRENT_PIC_DATA['pid'] = mysql_insert_id($CONFIG['LINK_ID']);
    CPGPluginAPI::action('add_file_data_success', $CURRENT_PIC_DATA);
    //return $result;
    return true;
}
コード例 #27
0
 function form_upload()
 {
     if ($_FILES['userpicture']['tmp_name'] != '' && $_FILES['userpicture']['tmp_name'] == 0) {
         $folder = strip($_GET['folder']);
         $uploaddir = SERVERPATH . '/albums/' . $folder;
         $tmp_name = $_FILES['userpicture']['tmp_name'];
         $name = $_FILES['userpicture']['name'];
         if (is_image($name)) {
             $uploadfile = $uploaddir . '/' . $name;
             move_uploaded_file($tmp_name, $uploadfile);
             @chmod($uploadfile, 0777);
         }
     }
 }
コード例 #28
0
ファイル: qun.logic.php プロジェクト: YouthAndra/huaitaoo2o
 function upload_icon($upload_data)
 {
     extract($upload_data);
     $u_setting = $this->upload_setting();
     $allow_exts = $u_setting['allow_exts'];
     $max_size = $u_setting['img_size'];
     $type = trim(strtolower(end(explode(".", $_FILES[$field]['name']))));
     if (!in_array($type, $allow_exts)) {
         return -1;
     }
     $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}";
     $image_path = $this->qun_avatar_path($upload_data['qid']);
     if (empty($image_path)) {
         return;
     }
     $image_file = $image_path . $image_name;
     if (!is_dir($image_path)) {
         jio()->MakeDir($image_path);
     }
     jupload()->init($image_path, $field, true);
     jupload()->setMaxSize($max_size);
     jupload()->setNewName($image_name);
     $result = jupload()->doUpload();
     if ($result) {
         $result = is_image($image_file);
     }
     if (!$result) {
         jio()->DeleteFile($image_file);
         return -2;
     }
     list($w, $h) = getimagesize($image_file);
     $dst_file = $image_path . $upload_data['qid'] . '_b.jpg';
     if (file_exists($dst_file)) {
         unlink($dst_file);
     }
     $make_result = image_thumb($image_file, $dst_file, 80, 80, 2);
     $lst_file = $image_path . $upload_data['qid'] . '_s.jpg';
     if (file_exists($lst_file)) {
         unlink($lst_file);
     }
     $make_result = image_thumb($image_file, $lst_file, 50, 50, 2);
     unlink($image_file);
     if ($GLOBALS['_J']['config']['ftp_on']) {
         $ftp_key = randgetftp();
         $get_ftps = jconf::get('ftp');
         $site_url = $get_ftps[$ftp_key]['attachurl'];
         $ftp_result = ftpcmd('upload', $lst_file, '', $ftp_key);
         if ($ftp_result > 0) {
             $ftp_result = ftpcmd('upload', $dst_file, '', $ftp_key);
             jio()->DeleteFile($lst_file);
             jio()->DeleteFile($dst_file);
             $lst_file = $site_url . '/' . str_replace('./', '', $lst_file);
         }
     }
     if (!empty($upload_data['qid'])) {
         DB::query("UPDATE " . DB::table('qun') . " SET icon='{$lst_file}' WHERE qid='{$upload_data['qid']}'");
     }
     return 1;
 }
コード例 #29
0
        ?>
</td>
                        <td><?php 
        if (is_image($_file->fileNewName)) {
            ?>
<a href="<?php 
            echo site_url($user->userURL . '/preview/full/' . $_file->fileNewName);
            ?>
" rel="colorbox"><?php 
        }
        ?>
<img src="<?php 
        echo site_url($user->userURL . '/preview/icon/' . $_file->fileNewName);
        ?>
" /><?php 
        if (is_image($_file->fileNewName)) {
            ?>
</a><?php 
        }
        ?>
</td>
			<td><?php 
        if ($user->userCanDownload == '1') {
            ?>
<a href="<?php 
            echo site_url($user->userURL . '/download/' . $_file->fileUniqueID);
            ?>
"><?php 
        }
        echo shorten_string($_file->fileName);
        if ($user->userCanDownload == '1') {
コード例 #30
0
ファイル: crawl.php プロジェクト: unetics/Crawler
 /**
  * Parse the HTML for links, store in an array
  */
 $links = parse_links($page_data['html']);
 /**
  * Loop through the array of links
  */
 foreach ($links as $key => &$link) {
     /**
      * Uniformly clean the link so we don't have duplicates (absolute, no anchors, add www., etc.)
      */
     $link = clean_link($link, $dir);
     /**
      * If the link is to an image, do not add it
      */
     if (is_image($link)) {
         continue;
     }
     /**
      * Verify that the link target is within our array of domains
      */
     if (out_of_domain($link)) {
         continue;
     }
     /**
      * Verify that the link target is not excluded by a string match
      */
     if (exclude_by_pattern($link)) {
         continue;
     }
     /**