Foros del Web » Programando para Internet » PHP »

Permisos con una sentencia php

Estas en el tema de Permisos con una sentencia php en el foro de PHP en Foros del Web. saludos amigos programadores... yo no soy programador.. pero ya estoy estudiando .. pero llegar a ser uno como ustedes.. tengo un conflicto con un plugins ...
  #1 (permalink)  
Antiguo 06/02/2010, 22:26
Avatar de jukayceci  
Fecha de Ingreso: diciembre-2009
Mensajes: 17
Antigüedad: 14 años, 3 meses
Puntos: 0
Permisos con una sentencia php

saludos amigos programadores... yo no soy programador.. pero ya estoy estudiando .. pero llegar a ser uno como ustedes..

tengo un conflicto con un plugins de wordpress.. esta instalado bien etc. etc..
pero me sale el siguiente mensaje.. cuando queria ver las fotos de flickr


Warning: file_put_contents(/home/mcrojas/public_html/web/wp-content/plugins/flickr-tag/cache/11e3190bff04534694312848c58aae8c.cache) [function.file-put-contents]: failed to open stream: Permission denied in /home/mcrojas/public_html/web/wp-content/plugins/flickr-tag/FlickrTagCommon.php on line 202

Flickr Tag Error: Call to display photo '4335716177' failed.

Error state follows:

* message: Writing to /home/mcrojas/public_html/web/wp-content/plugins/flickr-tag/cache/11e3190bff04534694312848c58aae8c.cache failed. Make sure the cache directory is writable by the webserver.


investigando encontre otra pagina. ke tiene el mismo problema:

[URL="http://www.mueses.com/photografia/un-ano-afuera-de-la-ventana/"]http://www.mueses.com/photografia/un-ano-afuera-de-la-ventana/[/URL]


y la mia.. obviamente

http://bolomotoshop.com/web/?page_id=5



QUISIERA KE ME INDIQUEN KE PASA EN ESA SENTENCIA.. si en donde me dice ke revise.. me aparece esto.:

if(file_put_contents($cache_file, $r, LOCK_EX) === FALSE)




AYUDA PORFAVOR
  #2 (permalink)  
Antiguo 06/02/2010, 22:51
Avatar de jackson666  
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 4 meses
Puntos: 65
Respuesta: Permisos con una sentencia php

Proba agregando esta linea antes de eso

Código PHP:
Ver original
  1. chmod($cache_file, '0777');
__________________
HV Studio
Diseño y desarrollo web
  #3 (permalink)  
Antiguo 06/02/2010, 23:56
Avatar de jukayceci  
Fecha de Ingreso: diciembre-2009
Mensajes: 17
Antigüedad: 14 años, 3 meses
Puntos: 0
Respuesta: Permisos con una sentencia php

ante de eso esta el 0755,, muestro todo el archivo

QUISIERA KE ME INDIQUEN KE PASA EN ESA SENTENCIA.. si en donde me dice ke revise.. me aparece esto.:

if(file_put_contents($cache_file, $r, LOCK_EX) === FALSE)
202

AYUDENME


Código PHP:
<?php

define
("FLICKR_TAG_API_KEY""ab3d8caa418c7e03aeda35edb756d223");
define("FLICKR_TAG_API_KEY_SS""2406fd6c36b852fd");

define("FLICKR_TAG_CACHE_DIR"dirname(__FILE__) . "/cache");

class 
FlickrTagCommon {
    var 
$error_state null;
    
    var 
$config = array(
                
"token" => null,
                
"nsid" => null,

                
"cache_ttl" => 604800,

                
"link_action" => "flickr",

                
"photo_size" => "small",
                
"photo_tooltip" => "description",

                
"set_size" => "square",
                
"set_tooltip" => "description",
                
"set_limit" => 50,

                
"photostream_size" => "square",
                
"photostream_tooltip" => "description",
                
"photostream_limit" => 50,

                
"group_size" => "square",
                
"group_tooltip" => "description",
                
"group_limit" => 50,

                
"tag_size" => "square",
                
"tag_tooltip" => "description",
                
"tag_limit" => 50
            
);

    var 
$size = array(
                
"square" => "_s",
                
"thumbnail" => "_t",
                
"small" => "_m",
                
"medium" => "",
                
"large" => "_b",
                
"original" => "_o"
            
);

    function 
FlickrTagCommon() {
        
$this->optionLoadAll();
    }

    function 
optionGet($key) {
        return 
$this->config[$key];
    }

    function 
optionSet($key$value) {
        
$this->config[$key] = $value;
    }

    function 
optionSaveAll() {
        foreach(
$this->config as $key=>$value)
            
update_option("flickr_tag_" $key$value);
    }

    function 
optionLoadAll() {
        foreach(
$this->config as $key=>$default) {
            
$v get_option("flickr_tag_" $key);

            if(
$v)
                
$this->config[$key] = $v;
        }
    }

    function 
isDisplayLimit($value) {
        if(
ctype_digit($value) && $value <= 100)
            return 
$value;
        else
            return 
null;
    }

    function 
isPhotoSize($value) {
        foreach(
$this->size as $k=>$v) {
            if(
$value == $k)
                return 
$v;
        }

        return 
null;
    }

    function 
cacheFlush() {
            
$d = @opendir(FLICKR_TAG_CACHE_DIR);

        if(! 
$d)
            return 
0;

            
$f 0;
            while((
$file readdir($d)) !== false) {
                    
$p FLICKR_TAG_CACHE_DIR "/" $file;

                    if(! 
is_file($p))
                            continue;

                    if(
is_file($p) && substr($pstrrpos($p".") + 1) == "cache")
                            if(@
unlink($p))
                                    
$f++;
            }

            
closedir($d);

            return 
$f;
    }

    function 
apiCall($params$cache true$sign true) {
        
// canonicalize parameters
        
$params['api_key'] = FLICKR_TAG_API_KEY;

        if(
$this->optionGet('token') && $sign
            
$params['auth_token'] = $this->optionGet('token');

        
ksort($params);

        
// construct signature and encode parameters
        
$signature_raw "";
        
$encoded_params = array();
        foreach(
$params as $k=>$v) {
            
$encoded_params[] = urlencode($k) . '=' urlencode($v);

            if(
$sign)
                
$signature_raw .= $k $v;
        }

        if(
$sign
            
array_push($encoded_params'api_sig=' md5(FLICKR_TAG_API_KEY_SS $signature_raw));

        
// check cache
        
$cache_key md5(join($params" "));
        
$cache_file FLICKR_TAG_CACHE_DIR "/" $cache_key ".cache";

        if(
$cache && file_exists($cache_file) && ((time() - filemtime($cache_file)) < $this->optionGet('cache_ttl') || $this->optionGet('cache_ttl') == -1)) {
            
$o unserialize(file_get_contents($cache_file));

        
// cache miss: make request
        
} else {
            
$c null;

            if(
function_exists('curl_init'))
                
$c curl_init();

            if(
$c) {
                
curl_setopt($cCURLOPT_URL"http://api.flickr.com/services/rest/");
                
curl_setopt($cCURLOPT_POST1);
                
curl_setopt($cCURLOPT_POSTFIELDSimplode('&'$encoded_params));
                
curl_setopt($cCURLOPT_RETURNTRANSFER1);
                
curl_setopt($cCURLOPT_CONNECTTIMEOUT10);

                
$r curl_exec($c);

            } else    
// no curl available... ugh!
                
@$r file_get_contents("http://api.flickr.com/services/rest/?" implode('&'$encoded_params));

            if(! 
$r) {
                if(
function_exists("error_get_last"))
                    
$this->error_state error_get_last();
                else
                    
$this->error_state = array("message" => "libcurl or URL fopen() wrappers were not found!");

                return 
null;
            }

             
$o unserialize($r);

            if(
$o['stat'] != "ok") {
                
$this->error_state $o;
                
                return 
null;
            }

            
// save serialized response to cache
            
if($cache) {
                if(! 
is_dir(FLICKR_TAG_CACHE_DIR)) {
                    @
mkdir(FLICKR_TAG_CACHE_DIR);
                    @
chmod(FLICKR_TAG_CACHE_DIR0755);
                }

                
chmod($cache_file'0777');
                if(
file_put_contents($cache_file$rLOCK_EX) === FALSE) {
                    
$this->error_state = array("message" => "Writing to " $cache_file " failed. Make sure the cache directory is writable by the webserver.");
    
                    return 
null;
                }
            }
        }

        return 
$o;
    }

    function 
error($message) {
            
$s .= '<div class="flickrTag_error">';

        
$s .= '<p>Flickr Tag Error: ' $message '</p>';

        if(
$this->error_state) {
            
$s .= "<p>Error state follows:</p><ul>";

            foreach(
$this->error_state as $l=>$m)
                
$s .= "<li>" $l ": " $m "</li>";

            
$s .= "</ul>";
        }

        
$s .= '</div>';

        return 
$s;
    }
}

Etiquetas: flickr, wordpress
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 20:05.