Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2011, 12:14
stomp
 
Fecha de Ingreso: febrero-2007
Mensajes: 3
Antigüedad: 17 años, 2 meses
Puntos: 0
Pregunta Plogger y el agregar un campo al formulario.

Hola, no se si alguien conoce plogger, estoy tratando de agregar el campo de precio al formulario de edicion, y modifique lo siguiente:

ADMIN FUNCTIONS
LINES 307-378
Código PHP:
$query "INSERT INTO `".PLOGGER_TABLE_PREFIX."pictures`
(`parent_collection`,
`parent_album`,
`path`,
`date_modified`,
`date_submitted`,
`allow_comments`,
`EXIF_date_taken`,
`EXIF_camera`,
`EXIF_shutterspeed`,
`EXIF_focallength`,
`EXIF_flash`,
`EXIF_aperture`,
`EXIF_iso`,
`caption`,
`description`, `precio`)
VALUES
('"
.$albumdata['collection_id']."',
'"
.$albumdata['album_id']."',
'"
.mysql_real_escape_string($picture_path)."',
NOW(),
NOW(),
"
.intval($allow_comm).",
'"
.mysql_real_escape_string($exif['date_taken'])."',
'"
.mysql_real_escape_string($exif['camera'])."',
'"
.mysql_real_escape_string($exif['shutter_speed'])."',
'"
.mysql_real_escape_string($exif['focal_length'])."',
'"
.mysql_real_escape_string($exif['flash'])."',
'"
.mysql_real_escape_string($exif['aperture'])."',
'"
.mysql_real_escape_string($exif['iso'])."',
'"
.mysql_real_escape_string($caption)."',
'"
.mysql_real_escape_string($desc)."',
'"
.mysql_real_escape_string($precio)."')"
;

$sql_result run_query($query);

$result['output'] .= sprintf(plog_tr('Your image %s was uploaded successfully.'), '<strong>'.$filename.'</strong>');
$result['picture_id'] = mysql_insert_id();

// Let's generate the thumbnail and the large thumbnail right away.
// This way, the user won't see any latency from the thumbnail generation
// when viewing the gallery for the first time
// This also helps with the image pre-loading problem introduced
// by a javascript slideshow.

$thumbpath generate_thumb($picture_path$result['picture_id'], THUMB_SMALL);
//$thumbpath = generate_thumb($picture_path, $result['picture_id'],THUMB_LARGE);
}

return 
$result;
}

function 
update_picture($id$caption$allow_comments$description$precio) {
$id intval($id);
$caption mysql_real_escape_string($caption);
$description mysql_real_escape_string($description);
$allow_comments intval($allow_comments);
$precio mysql_real_escape_string($precio);
$query "UPDATE ".PLOGGER_TABLE_PREFIX."pictures SET
caption = '$caption',
description = '$description',
precio = '$precio',
allow_comments = '$allow_comments'
WHERE id='$id'"
;
$result mysql_query($query);
if (
$result) {
return array(
'output' => plog_tr('You have successfully modified the selected picture.'));
} else {
return array(
'errors' => mysql_error());
}

PLOG MANAGE FILE
LINES 184-210
Código PHP:
if ($photo['allow_comments'] == 1$state 'checked="checked"'; else $state '';

$output .= "\n\t\t" '<form class="edit width-700" action="'.$_SERVER['PHP_SELF'].'?level=pictures&amp;id='.$photo['parent_album'].'" method="post">';

$thumbpath generate_thumb(SmartStripSlashes($photo['path']), $photo['id'], THUMB_SMALL);
$output .= "\n\t\t\t" '<div style="float: right;"><img src="'.$thumbpath.'" alt="" /></div>
<div>
<div class="strong">'
.plog_tr('Edit Image Properties').'</div>
<p>
<label class="strong" accesskey="c" for="caption">'
.plog_tr('<em>C</em>aption').':</label><br />
<input size="62" name="caption" id="caption" value="'
.htmlspecialchars(SmartStripSlashes($photo['caption'])).'" />
</p>
<p>
<label class="strong" for="description">'
.plog_tr('Description').':</label><br />
<textarea name="description" id="description" cols="60" rows="5">'
.htmlspecialchars(SmartStripSlashes($photo['description'])).'</textarea>
</p>
<p>
<label class="strong" for="precio">Precio:</label><br />
<textarea name="precio id="precio" cols="60" rows="1">'
.htmlspecialchars(SmartStripSlashes($photo['precio'])).'</textarea>
</p>
<p><input type="checkbox" id="allow_comments" name="allow_comments" value="1" '
.$state.' /><label class="strong" for="allow_comments" accesskey="w">'.plog_tr('Allo<em>w</em> Comments').'?</label></p>';
$output .= "\n\t\t\t\t" '<input type="hidden" name="pid" value="'.$photo['id'].'" />
<input type="hidden" name="action" value="update-picture" />
<input class="submit" name="update" value="'
.plog_tr('Update').'" type="submit" />
<input class="submit-cancel" name="cancel" value="'
.plog_tr('Cancel').'" type="submit" />
</div>
</form>' 
"\n"
Y tambien agregue el campo en la base de datos como text unicode utf8 etc...
todo parece bien, hasta que en el formulario hago la entrada y a enviar me manda este error:

Código PHP:
NoticeUndefined indexprecio in /mounted-storage/......(aqui va mi path)/productos/plog-admin/plog-manage.php on line 232 
Linea 232

Código PHP:
case 'update-picture':
            
// Update the picture information
            
if (!isset($_REQUEST['cancel'])) {
                
$allow_comments = (isset($_REQUEST['allow_comments'])) ? $_REQUEST['allow_comments'] : '';
                  
LINEA 232 ----> $action_result update_picture($_REQUEST['pid'], $_REQUEST['caption'], $allow_comments$_REQUEST['description'], $_REQUEST['precio']);
            } 
Ya intente declarar una global en el mismo archivo pero parece que no funciona.

Ayuda por favor :)

Última edición por stomp; 11/11/2011 a las 12:19 Razón: Agregue Linea 232 y Etiquetas.