Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [www] Proszę o ocene - vost.pl
authentik
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 1.05.2007

Ostrzeżenie: (20%)
X----


Serwis został odpalony w wersji beta jednak jest to bardzo wczesna wersja serwis z podstawowymi funkcjonalnościami.

Zapraszam wszystkich zainteresowanych!

www.vost.pl

W niedługim czasie zostaną uruchomione między innymi takie funkcjonalności jak:

- rejestracja i logowanie użytkowników

- ulepszone wyszukiwania

- możliwość tworzenia playlist przez użytkowników

- rankingi wyszukiwanych plików i tworzonych playlist

- blog

- grupy dyskusyjne dla użytkowników

oraz wiele innych.

Użytkowników serwisu proszę o wskazówki i rady dotyczące funkcjonalności brakującej, bądź już istniejącej.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
nexis
post
Post #2





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

Ostrzeżenie: (0%)
-----


Używasz jednocześnie kilku bibliotek, które robią to samo:

- jQuery
- prototype
- advAJAX
- lightbox

Wszystko możesz zrealizować za pomocą jQuery (posiadasz swoją drogą starszą wersję 1.2.3, a jest już 1.2.6) i ponadto polecam użycie kompresji dla plików JavaScript, które na swoim hostingu (home.pl) możesz zrealizować np. tak:

js/.htaccess
  1. RewriteEngine on
  2. RewriteRule .* gzip.php


js/gzip.php
  1. <?php
  2.  
  3. $file = end(explode('/', $_SERVER['PATH_REDIRECTED']));
  4.  
  5.  
  6. /*
  7.  * The mkdir function does not support the recursive
  8.  * parameter in the version of PHP run by Yahoo! Web
  9.  * Hosting. This function simulates it.
  10.  */
  11.  
  12. function mkdir_r( $dir_name, $rights=0777 ) {
  13.  $dirs = explode( "/", $dir_name );
  14.  $dir = "";
  15.  foreach ( $dirs as $part ) {
  16.  $dir .= $part . "/";
  17.  if ( !is_dir( $dir ) && strlen( $dir ) > 0 )
  18.  mkdir( $dir, $rights );
  19.  }
  20. }
  21.  
  22. /*
  23.  * List of known content types based on file extension.
  24.  * Note: These must be built-in somewhere...
  25.  */
  26.  
  27. $known_content_types = array(
  28. "htm" => "text/html",
  29. "html" => "text/html",
  30. "js"  => "text/javascript",
  31. "css" => "text/css",
  32. "xml" => "text/xml",
  33. "gif" => "image/gif",
  34. "jpg" => "image/jpeg",
  35. "jpeg" => "image/jpeg",
  36. "png" => "image/png",
  37. "txt" => "text/plain"
  38. );
  39.  
  40. /*
  41.  * Get the path of the target file.
  42.  */
  43.  
  44. if ( !isset( $file ) ) {
  45. header( "HTTP/1.1 400 Bad Request" );
  46. echo( "<html><body><h1>HTTP 400 - Bad Request</h1></body></html>" );
  47. }
  48.  
  49. /*
  50.  * Verify the existence of the target file.
  51.  * Return HTTP 404 if needed.
  52.  */
  53.  
  54. if (($src_uri = realpath( $file )) === false) {
  55. /* The file does not exist */
  56. header( "HTTP/1.1 404 Not Found" );
  57. echo( "<html><body><h1>HTTP 404 - Not Found</h1></body></html>" );
  58. }
  59.  
  60. /*
  61.  * Verify the requested file is under the doc root for security reasons.
  62.  */
  63.  
  64. $doc_root = realpath( "." );
  65.  
  66. if (strpos($src_uri, $doc_root) !== 0) {
  67. header( "HTTP/1.1 403 Forbidden" );
  68. echo( "<html><body><h1>HTTP 403 - Forbidden</h1></body></html>" );
  69. }
  70.  
  71. /*
  72.  * Set the HTTP response headers that will
  73.  * tell the client to cache the resource.
  74.  */
  75.  
  76. $file_last_modified = filemtime( $src_uri );
  77. header( "Last-Modified: " . date( "r", $file_last_modified ) );
  78.  
  79. $max_age = 300 * 24 * 60 * 60; // 300 days
  80.  
  81. $expires = $file_last_modified + $max_age;
  82. header( "Expires: " . date( "r", $expires ) );
  83.  
  84. $etag = dechex( $file_last_modified );
  85. header( "ETag: " . $etag );
  86.  
  87. $cache_control = "must-revalidate, proxy-revalidate, max-age=" . $max_age . ", s-maxage=" . $max_age;
  88. header( "Cache-Control: " . $cache_control );
  89.  
  90. /*
  91.  * Check if the client should use the cached version.
  92.  * Return HTTP 304 if needed.
  93.  */
  94.  
  95. if ( function_exists( "http_match_etag" ) && function_exists( "http_match_modified" ) ) {
  96. if ( http_match_etag( $etag ) || http_match_modified( $file_last_modified ) ) {
  97. header( "HTTP/1.1 304 Not Modified" );
  98. }
  99. } else {
  100. error_log( "The HTTP extensions to PHP does not seem to be installed..." );
  101. }
  102.  
  103. /*
  104.  * Extract the directory, file name and file
  105.  * extension from the "uri" parameter.
  106.  */
  107.  
  108. $uri_dir = "";
  109. $file_name = "";
  110. $content_type = "";
  111.  
  112. $uri_parts = explode( "/", $src_uri );
  113.  
  114. for ( $i=; $i<count( $uri_parts ) - 1 ; $i++ )
  115. $uri_dir .= $uri_parts[$i] . "/";
  116.  
  117. $file_name = end( $uri_parts );
  118.  
  119. $file_parts = explode( ".", $file_name );
  120. if ( count( $file_parts ) > 1 ) {
  121. $file_extension = end( $file_parts );
  122. $content_type = $known_content_types[$file_extension];
  123. }
  124.  
  125. /*
  126.  * Get the target file.
  127.  * If the browser accepts gzip encoding, the target file
  128.  * will be the gzipped version of the requested file.
  129.  */
  130.  
  131. $dst_uri = $src_uri;
  132.  
  133. $compress = true;
  134.  
  135. /*
  136.  * Let's compress only text files...
  137.  */
  138.  
  139. $compress = $compress && ( strpos( $content_type, "text" ) !== false );
  140.  
  141. /*
  142.  * Finally, see if the client sent us the correct Accept-encoding: header value...
  143.  */
  144.  
  145. $compress = $compress && ( strpos( $_SERVER["HTTP_ACCEPT_ENCODING"], "gzip" ) !== false );
  146.  
  147. if ( $compress ) {
  148. $gz_uri = "tmp/gzip/" . $src_uri . ".gz";
  149.  
  150. if ( file_exists( $gz_uri ) ) {
  151. $src_last_modified = filemtime( $src_uri );
  152. $dst_last_modified = filemtime( $gz_uri );
  153. // The gzip version of the file exists, but it is older
  154. // than the source file. We need to recreate it...
  155. if ( $src_last_modified > $dst_last_modified )
  156. unlink( $gz_uri );
  157. }
  158.  
  159. if ( !file_exists( $gz_uri ) ) {
  160. if ( !file_exists( "tmp/gzip/" . $uri_dir ) )
  161. mkdir_r( "tmp/gzip/" . $uri_dir );
  162. $error = false;
  163. if ( $fp_out = gzopen( $gz_uri, "wb" ) ) {
  164. if ( $fp_in = fopen( $src_uri, "rb" ) ) {
  165. while( !feof( $fp_in ) )
  166. gzwrite( $fp_out, fread( $fp_in, 1024*512 ) );
  167. fclose( $fp_in );
  168. } else {
  169. $error = true;
  170. }
  171. gzclose( $fp_out );
  172. } else {
  173. $error = true;
  174. }
  175.  
  176. if ( !$error ) {
  177. $dst_uri = $gz_uri;
  178. header( "Content-Encoding: gzip" );
  179. }
  180. } else {
  181. $dst_uri = $gz_uri;
  182. header( "Content-Encoding: gzip" );
  183. }
  184. }
  185.  
  186. /*
  187.  * Output the target file and set the appropriate HTTP headers.
  188.  */
  189.  
  190. if ( $content_type )
  191. header( "Content-Type: " . $content_type );
  192.  
  193. header( "Content-Length: " . filesize( $dst_uri ) );
  194. readfile( $dst_uri );
  195.  
  196.  
  197. ?>


Tym sposobem możesz równiez kompresować inne pliki oczywiście.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.12.2025 - 20:27