[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_plugins/content/ -> e_emailprint.php (source)

   1  <?php
   2  
   3  if (!defined('e107_INIT')) { exit; }
   4  
   5  function print_item($id)
   6  {
   7          global $tp;
   8          global $content_pref, $mainparent, $aa, $row, $content_image_path;
   9          $con = new convert;
  10  
  11          require_once(e_PLUGIN."content/handlers/content_class.php");
  12          $aa = new content;
  13  
  14          require_once(e_PLUGIN."content/content_shortcodes.php");
  15  
  16          $lan_file = e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php";
  17          include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."content/languages/English/lan_content.php");
  18  
  19          if(!is_object($sql)){ $sql = new db; }
  20          $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_image, content_parent, content_datestamp, content_class", "content_id='".intval($id)."' ");
  21          $row = $sql -> db_Fetch();
  22  
  23          if(!check_class($row['content_class'])){
  24              header("location:".e_PLUGIN."content/content.php"); exit;
  25          }
  26          $row['content_heading']        = $tp -> toHTML($row['content_heading']);
  27          $row['content_subheading']    = $tp -> toHTML($row['content_subheading']);
  28          $row['content_text']        = $tp -> replaceConstants($row['content_text']);
  29          $row['content_text']        = preg_replace("/\{EMAILPRINT\}|\[newpage\]/", "", $tp -> toHTML($row['content_text'], TRUE));
  30          $authordetails                = $aa -> getAuthor($row['content_author']);
  31          $row['content_datestamp']    = $con -> convert_date($row['content_datestamp'], "long");
  32  
  33          $mainparent                    = $aa -> getMainParent($id);
  34          $content_pref                = $aa -> getContentPref($mainparent);
  35          $content_icon_path            = $tp -> replaceConstants($content_pref["content_icon_path"]);
  36          $content_image_path            = $tp -> replaceConstants($content_pref["content_image_path"]);
  37          $img                        = $tp -> parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes);
  38  
  39          $text = "
  40          <b>".$row['content_heading']."</b>
  41          <br />
  42          ".$row['content_subheading']."
  43          <br />
  44          ".$authordetails[1].", ".$row['content_datestamp']."
  45          <br /><br />
  46          <div style='float:left; padding-right:10px;'>".$img."</div>
  47          ".$row['content_text']."
  48          <br /><br /><hr />
  49          ".CONTENT_EMAILPRINT_LAN_1." ".SITENAME."
  50          <br />
  51          ( ".SITEURLBASE.e_PLUGIN_ABS."content/content.php?content.".$row['content_id']." )        
  52          ";
  53  
  54          require_once(e_HANDLER.'bbcode_handler.php');
  55          $e_bb = new e_bbcode;
  56          $text = $e_bb->parseBBCodes($text, '');
  57  
  58          return $text;
  59  }
  60  
  61  function email_item($id)
  62  {
  63      $plugintable = "pcontent";
  64      if(!is_object($sql)){ $sql = new db; }
  65      if($sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_author, content_parent, content_datestamp, content_class", "content_id='".intval($id)."' ")){
  66          while($row = $sql -> db_Fetch()){
  67              $tmp = explode(".",$row['content_parent']);
  68              if(!check_class($row['content_class'])){
  69                  header("location:".e_PLUGIN."content/content.php"); exit;
  70              }
  71              $message = SITEURL.e_PLUGIN."content/content.php?content.".$id."\n\n".$row['content_heading']."\n".$row['content_subheading']."\n";
  72          }
  73          return $message;
  74      }
  75  }
  76  
  77  
  78  function print_item_pdf($id){
  79      global $tp, $content_shortcodes;
  80      global $CONTENT_PRINT_IMAGES, $row, $content_image_path, $content_pref, $mainparent, $eArrayStorage;
  81  
  82      //in this section you decide what to needs to be output to the pdf file
  83      $con = new convert;
  84      
  85      require_once(e_PLUGIN."content/content_shortcodes.php");
  86  
  87      require_once(e_PLUGIN."content/handlers/content_class.php");
  88      $aa = new content;
  89      
  90      if(!is_object($sql)){ $sql = new db; }
  91      $sql -> db_Select($plugintable, "content_id, content_heading, content_subheading, content_text, content_image, content_author, content_parent, content_datestamp, content_class, content_pref", "content_id='".intval($id)."' ");
  92      $row = $sql -> db_Fetch();
  93  
  94      if(!check_class($row['content_class'])){
  95          header("location:".e_PLUGIN."content/content.php"); exit;
  96      }
  97      $authordetails                = $aa -> getAuthor($row['content_author']);
  98      $row['content_datestamp']    = $con -> convert_date($row['content_datestamp'], "long");
  99      $img                        = $tp -> parseTemplate('{CONTENT_PRINT_IMAGES}', FALSE, $content_shortcodes);
 100  
 101      $mainparent                    = $aa -> getMainParent(intval($id));
 102      $content_pref                = $aa -> getContentPref($mainparent);
 103      $content_icon_path            = $tp -> replaceConstants($content_pref["content_icon_path"]);
 104      $content_image_path            = $tp -> replaceConstants($content_pref["content_image_path"]);
 105      $img                        = $tp -> parseTemplate('{CONTENT_PDF_IMAGES}', FALSE, $content_shortcodes);
 106  
 107      //add custom and preset tags if present
 108      $custom                        = $eArrayStorage->ReadArray($row['content_pref']);
 109      $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11);
 110  
 111      $CONTENT_CONTENT_TABLE_CUSTOM_TAGS = "";
 112      if(!empty($custom)){
 113          foreach($custom as $k => $v){
 114              if($k == "content_custom_presettags"){
 115                  if(isset($content_pref["content_content_presettags"]) && $content_pref["content_content_presettags"]){
 116                      foreach($v as $ck => $cv){
 117                          if(is_array($cv)){    //date
 118                              if(!($cv['day']=="" && $cv['month']=="" && $cv['year']=="")){
 119                                  $vv = $cv['day']." ".$months[($cv['month']-1)]." ".$cv['year'];
 120                              }
 121                          }else{
 122                              $vv = $cv;
 123                          }
 124                          if( isset($ck) && $ck != "" && isset($vv) && $vv!="" ){
 125                              $CUSTOM_TAGS = TRUE;
 126                              $CONTENT_CONTENT_TABLE_CUSTOM_KEY        = $tp->toHTML($ck, true);
 127                              $CONTENT_CONTENT_TABLE_CUSTOM_VALUE        = $tp->toHTML($vv, true);
 128                              $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY." : ".$CONTENT_CONTENT_TABLE_CUSTOM_VALUE."<br />";
 129                          }
 130                      }
 131                  }
 132              }else{
 133                  if(isset($content_pref["content_content_customtags"]) && $content_pref["content_content_customtags"]){
 134                      $key = substr($k,15);
 135                      if( isset($key) && $key != "" && isset($v) && $v!="" ){
 136                          $CUSTOM_TAGS = TRUE;
 137                          $CONTENT_CONTENT_TABLE_CUSTOM_KEY        = $tp->toHTML($key, true);
 138                          $CONTENT_CONTENT_TABLE_CUSTOM_VALUE        = $tp->toHTML($v, true);
 139                          $CONTENT_CONTENT_TABLE_CUSTOM_TAGS .= $CONTENT_CONTENT_TABLE_CUSTOM_KEY." : ".$CONTENT_CONTENT_TABLE_CUSTOM_VALUE."<br />";
 140                      }
 141                  }
 142              }
 143          }
 144      }
 145  
 146      $text = "
 147      <b>".$row['content_heading']."</b><br />
 148      ".$row['content_subheading']."<br />
 149      ".$authordetails[1].", ".$row['content_datestamp']."<br />
 150      <br />
 151      ".$row['content_text']."<br />
 152      ".($CONTENT_CONTENT_TABLE_CUSTOM_TAGS ? $CONTENT_CONTENT_TABLE_CUSTOM_TAGS : "")."
 153      <div style='float:left; padding-left:10px;'>".$img."</div>
 154      ";
 155  
 156      //the following defines are processed in the document properties of the pdf file
 157  
 158      //Do NOT add parser function to the variables, leave them as raw data !
 159      //as the pdf methods will handle this !
 160      $text        = $text;                        //define text
 161      $creator    = SITENAME;                        //define creator
 162      $author        = $authordetails[1];            //define author
 163      $title        = $row['content_heading'];        //define title
 164      $subject    = $row['content_subheading'];    //define subject
 165      $keywords    = "";                            //define keywords
 166  
 167      //define url to use in the header of the pdf file
 168      $url        = SITEURLBASE.e_PLUGIN_ABS."content/content.php?content.".$row['content_id'];
 169  
 170      //always return an array with the following data:
 171      return array($text, $creator, $author, $title, $subject, $keywords, $url);
 172  }
 173  
 174  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7