Errors corregidos !!!

Asked by Eliu Florez

Hola amigos,
encontre unos errores los cuales corregi espero aver ayudado.

function checkUser()
....
else {
 $gettext_tables = new gettext_reader(
  new CachedFileReader($file)
 );
  $gettext_tables->load_tables();
}

corregido a:

function checkUser()
....
 $gettext_tables = new gettext_reader(
  new CachedFileReader($file)
 );
  $gettext_tables->load_tables();

para language de default.

setting.php

linea:
if (!unlink(PATH.'/users_files/'.$_USER['username'].'/img/background/bg.'.$_USER['customize']['background']))

corregido a:
if (!@unlink(PATH.'/users_files/'.$_USER['username'].'/img/background/bg.'.$_USER['customize']['background']))

corregir error al eliminar el background por user.

corregido error update background.

function uploadBackground($ref)
{
 global $globals;
 global $_USER;

 $extension = strtolower(pathinfo($ref['name'], PATHINFO_EXTENSION));
 if (!in_array($extension, $globals['allowed_extensions'])) return 'INVALID_EXTENSION';
 else {
  $size = $ref['size'] / 1024;
  if ($size > 1024) return 'TOO_BIG';
  else {
   if ($_USER['customize']['background']) {
    if (!@unlink(PATH.'/users_files/'.$_USER['username'].'/img/background/bg.'.$_USER['customize']['background'])) return 'ERROR_DELETE_PREV'; die();
   }
   if (!@copy($ref['tmp_name'], PATH.'/users_files/'.$_USER['username']."/img/background/bg.$extension")) return 'ERROR_UPLOAD';
   else {
    return $extension;
   }
  }
 }
}

corregido a:

function uploadBackground($ref)
{
 global $globals;
 global $_USER;
 global $db;
 global $jk;

 $extension = strtolower(pathinfo($ref['name'], PATHINFO_EXTENSION));
 if (!in_array($extension, $globals['allowed_extensions'])) return 'INVALID_EXTENSION';
 else {
  $size = $ref['size'] / 1024;
  if ($size > 1024) return 'TOO_BIG';
  else {
   if ($_USER['customize']['background']) {
    if (!@unlink(PATH.'/users_files/'.$_USER['username'].'/img/background/bg.'.$_USER['customize']['background'])) { return 'ERROR_DELETE_PREV'; die(); }
    else {
      $_USER['customize']['background'] = '';
      $jk->updateUser('customize_background', false);
      $db->updateUserOptions($_USER['ID'], array('customize' => serialize($_USER['customize'])));
      $ok = '';
    }
   }
   if (!@copy($ref['tmp_name'], PATH.'/users_files/'.$_USER['username']."/img/background/bg.$extension")) return 'ERROR_UPLOAD';
   else {
    return $extension;
   }
  }
 }
}

nose si en update del background es la mejor forma pero me funcion. ok. y saludos espero respuestas. si fue mi nota de ayuda.

Question information

Language:
Spanish Edit question
Status:
Answered
For:
Jisko Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Marcos Garcia (marcosgdf) said :
#1

He aplicado algunos de los cambios. No estoy deacuerdo con el que haces en el uploadBackground, porque evitando la muestra del error no te quitas de encima el problema..

Revision history for this message
Eliu Florez (florez-e) said :
#2

ok. aunq si te fijas en el pages/setting.php lo llevas asi.

else {
        $_USER['customize']['background'] = '';
 $jk->updateUser('customize_background', false);
 $db->updateUserOptions($_USER['ID'], array('customize' => serialize($_USER['customize'])));
 $ok = '';
}
  luego de eliminar el background. y el caso es que si no lo elimino ??? si lo que quiero es agregar otro fondo sin eliminar el que tengo ??? lo que llevo a cabo es verificar existencia si existe lo elimino y agrego el nuevo. si solo lo elimino el bg.png y no limpio en
$jk->updateUser('customize_background', false);
$db->updateUserOptions($_USER['ID'], array('customize' => serialize($_USER['customize'])));

Error. nose si es la mejor forma a que mejoralo lo se. pero solo fue una idea. jejeje! dale saludos.

Can you help with this problem?

Provide an answer of your own, or ask Eliu Florez for more information if necessary.

To post a message you must log in.