4images Modifications / Modifikationen > Plugins

[Plugin] Modified postcard viewer

(1/4) > >>

peterle:
based on the mod from uksoreeyes I modified the code a little bit. I think it is not of interest to see what message was sent. Therefore it just shows: date, who sent it and who received the card and the id of the picture with a link to open and make the used picture visible.
This is my first trial at all...My basic skills are Turbo-C and Pascal, times have changed, please forgive some possible strange lines...

Installation:

1.) create a folder "plugins" in "admin" -> ...admin/plugins

2.) create a new file called "postcard_view.php" (e.g. use notepad) with following code:


--- Code: ---<?php // PLUGIN_TITLE: modified Postcard Viewer 

$nozip = 1; 
define('IN_CP', 1); 

$root_path = "./../../"; 
define('ROOT_PATH', $root_path); 
require(ROOT_PATH.'admin/admin_global.php'); 
show_admin_header(); 

function display_results() { 
  global $site_db; 

  $sql = "SELECT * 
          FROM ".POSTCARDS_TABLE." p, ".IMAGES_TABLE." i 
          WHERE p.image_id = i.image_id 
          ORDER BY postcard_id DESC"; 
  $result = $site_db->query($sql); 
  while($row = $site_db->fetch_array($result)){ 
    $postcard_id = $row["postcard_id"]; 
    $postcard_date = date("D d M, Y g:i a", $row["postcard_date"]); 
    $image_id = $row["image_id"]; 
    
    $postcard_sender_name = $row["postcard_sender_name"]; 
    $postcard_sender_email = $row["postcard_sender_email"]; 
    $postcard_recipient_name = $row["postcard_recipient_name"]; 
    $postcard_recipient_email = $row["postcard_recipient_email"]; 
    
    $cat_id = $row['cat_id'];
    $pict_id = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']);
    $image_media_file = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']); 
    $template = TEMPLATE_PATH; 
    
    echo <<<END
          
    <font color="#000000" size="1" >$postcard_date: <br>sent to: $postcard_recipient_name - 
<a href="mailto:$postcard_recipient_email"><font color="#000000" size="1">$postcard_recipient_email</a></td>
     <td valign="top" width="200" height="250">
       sent by: $postcard_sender_name - <font color="#555555" size="1" ><a href="mailto:$postcard_sender_email">$postcard_sender_email</a>, picture: $image_id, 
<a href="../../details.php?image_id=$image_id" target="_blank">click to show picture</a>

</font></a>
<br><br><br></td>
   </tr>
 </tbody>
</table></td>
   </tr>
 </tbody>
</table><br> 
END;
  } 


display_results(); 
show_admin_footer(); 
?>
--- End code ---

3.) save this file "postcard_view.php" in the new folder "plugins", enter admin panel and click postcard_view...

have fun...

ib41:

--- Quote from: peterle ---based on the mod from uksoreeyes I modified the code a little bit. I think it is not of interest to see what message was sent. Therefore it just shows: date, who sent it and who received the card and the id of the picture with a link to open and make the used picture visible.
This is my first trial at all...My basic skills are Turbo-C and Pascal, times have changed, please forgive some possible strange lines...


3.) save this file "postcard_view.php" in the new folder "plugins", enter admin panel and click postcard_view...

have fun...
--- End quote ---


error:

--- Code: ---Parse error: parse error, unexpected T_SL, expecting ',' or ';' in /home/vhosts/hosting/gallery/admin/plugins/postcard_view.php on line 38
--- End code ---

ib41:

--- Quote from: peterle ---based on the mod from uksoreeyes I modified the code a little bit. I think it is not of interest to see what message was sent. Therefore it just shows: date, who sent it and who received the card and the id of the picture with a link to open and make the used picture visible.
This is my first trial at all...My basic skills are Turbo-C and Pascal, times have changed, please forgive some possible strange lines...

3.) save this file "postcard_view.php" in the new folder "plugins", enter admin panel and click postcard_view...

have fun...
--- End quote ---


ERROR received

--- Code: ---Parse error: parse error, unexpected T_SL, expecting ',' or ';' in /home/vhosts/hosting/gallery/admin/plugins/postcard_view.php on line 38
--- End code ---

bernd:
ib41, in line 38 (and in the following line as well) there was a line break that should not have been there. this has to be one line:

--- Code: ---$image_media_file = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']);
--- End code ---

and this one as well:

--- Code: ---$pict_id = get_media_code($row['image_media_file'], $image_id, $cat_id, $row['image_name']);
--- End code ---


thanks for creating this one peterle.

Flo2005:
I get this error-message


--- Quote ---Parse error: parse error, unexpected '&', expecting T_PAAMAYIM_NEKUDOTAYIM or '(' in /www/htdocs/snuup/portal/4images/admin/plugins/postcard_view.php on line 7
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version