WDC
"myXOOPs"-Profi
Gepostet am:27.06.2006 20:02
// Update a photo
function myalbum_update_photo( $lid , $cid , $title , $desc , $valid = null , $ext = "" , $x = "" , $y = "" )
{
global $xoopsDB, $xoopsConfig, $xoopsModule;
global $table_photos , $table_text , $table_cat , $mod_url , $isadmin ;
if( isset( $valid ) ) {
$set_status = ",status='$valid'" ;
// Trigger Notification
if( $valid == 1 ) {
$notification_handler =& xoops_gethandler( 'notification' ) ;
// Global Notification
$notification_handler->triggerEvent( 'global' , 0 , 'new_photo' , array( 'PHOTO_TITLE' => $title , 'PHOTO_URI' => "$mod_url/photo.php?lid=$lid&cid=$cid" ) ) ;
// Category Notification
$rs = $xoopsDB->query( "SELECT title FROM $table_cat WHERE cid=$cid" ) ;
list( $cat_title ) = $xoopsDB->fetchRow( $rs ) ;
$notification_handler->triggerEvent( 'category' , $cid , 'new_photo' , array( 'PHOTO_TITLE' => $title , 'CATEGORY_TITLE' => $cat_title , 'PHOTO_URI' => "$mod_url/photo.php?lid=$lid&cid=$cid" ) ) ;
}
} else {
$set_status = '' ;
}
$set_date = empty( $_POST['store_timestamp'] ) ? ",date=UNIX_TIMESTAMP()" : "" ;
// not admin can only touch photos status>0
$whr_status = $isadmin ? '' : 'AND status>0' ;
if( $ext == "" ) {
// modify only text
$xoopsDB->query("UPDATE $table_photos SET cid='$cid',title='".addslashes($title)."' $set_status $set_date WHERE lid='$lid' $whr_status") ;
} else {
// modify text and image
$xoopsDB->query("UPDATE $table_photos SET cid='$cid',title='".addslashes($title)."', ext='$ext',res_x='$x',res_y='$y' $set_status $set_date WHERE lid='$lid' $whr_status");
}
$xoopsDB->query("UPDATE $table_text SET description='".addslashes($desc)."' WHERE lid='$lid'");
redirect_header( "editphoto.php?lid=$lid" , 0 , _ALBM_DBUPDATED ) ;
}
UPDATE tabelle SET spalte1=wert1 AND spalte2=wert2 WHERE spalteX=wertX;
| Forum | Thema | Antworten | Views | Letzter Beitrag |
|---|---|---|---|---|
| Modulentwicklung | New Xoops Xcreate Module | 0 | 5332 | 26.11.2025 15:22 efkan |
| Modulentwicklung | XOOPS Custom Field Module | 1 | 1818 | 24.11.2025 11:21 Goffy |