1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 02:10:46 +02:00

PDF plugin - admin logging, plugin.xml

This commit is contained in:
e107steved
2008-12-21 12:03:28 +00:00
parent 3aab4367fb
commit 9775e4ece6
9 changed files with 178 additions and 173 deletions

View File

@@ -1,54 +1,65 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Plugin Administration - PDF generator
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/admin_pdf_config.php,v $
| * $Revision: 1.2 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/admin_pdf_config.php,v $ * $Date: 2008-12-21 12:03:28 $
| $Revision: 1.1.1.1 $ * $Author: e107steved $
| $Date: 2006-12-02 04:35:32 $ *
| $Author: mcfly_e107 $
+----------------------------------------------------------------------------+
*/ */
require_once("../../class2.php"); require_once('../../class2.php');
require_once(e_ADMIN."auth.php"); if (!getperms("P") || !plugInstalled('pdf'))
require_once(e_HANDLER."form_handler.php"); {
header('location:'.e_BASE.'index.php');
exit;
}
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
$rs = new form; $rs = new form;
e107_require_once(e_HANDLER.'arraystorage_class.php'); e107_require_once(e_HANDLER.'arraystorage_class.php');
$eArrayStorage = new ArrayData(); $eArrayStorage = new ArrayData();
unset($text); unset($text);
$lan_file = e_PLUGIN."pdf/languages/".e_LANGUAGE.".php"; include_lan(e_PLUGIN.'pdf/languages/English_admin_pdf.php');
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
if(isset($_POST['update_pdf'])){ if(isset($_POST['update_pdf']))
{
$message = updatePDFPrefs(); $message = updatePDFPrefs();
} }
function updatePDFPrefs(){
global $sql, $eArrayStorage, $tp; function updatePDFPrefs()
while(list($key, $value) = each($_POST)){ {
foreach($_POST as $k => $v){ global $sql, $eArrayStorage, $tp, $admin_log;
if(strpos($k, "pdf_") === 0){ while(list($key, $value) = each($_POST))
{
foreach($_POST as $k => $v)
{
if(strpos($k, 'pdf_') === 0)
{
$pdfpref[$k] = $tp->toDB($v); $pdfpref[$k] = $tp->toDB($v);
} }
} }
} }
//create new array of preferences
$tmp = $eArrayStorage->WriteArray($pdfpref); $tmp = $eArrayStorage->WriteArray($pdfpref);
$sql -> db_Update("core", "e107_value='$tmp' WHERE e107_name='pdf' "); $sql -> db_Update("core", "e107_value='{$tmp}' WHERE e107_name='pdf' ");
$admin_log->logArrayAll('PDF_01',$pdfpref);
$message = PDF_LAN_18; $message = PDF_LAN_18;
return $message; return $message;
} }
function getDefaultPDFPrefs(){
function getDefaultPDFPrefs()
{
$pdfpref['pdf_margin_left'] = '25'; $pdfpref['pdf_margin_left'] = '25';
$pdfpref['pdf_margin_right'] = '15'; $pdfpref['pdf_margin_right'] = '15';
$pdfpref['pdf_margin_top'] = '15'; $pdfpref['pdf_margin_top'] = '15';
@@ -65,12 +76,16 @@ function getDefaultPDFPrefs(){
return $pdfpref; return $pdfpref;
} }
function getPDFPrefs(){
function getPDFPrefs()
{
global $sql, $eArrayStorage; global $sql, $eArrayStorage;
if(!is_object($sql)){ $sql = new db; } if(!is_object($sql)){ $sql = new db; }
$num_rows = $sql -> db_Select("core", "*", "e107_name='pdf' "); $num_rows = $sql -> db_Select("core", "*", "e107_name='pdf' ");
if($num_rows == 0){ if($num_rows == 0)
{
$tmp = getDefaultPDFPrefs(); $tmp = getDefaultPDFPrefs();
$tmp2 = $eArrayStorage->WriteArray($tmp); $tmp2 = $eArrayStorage->WriteArray($tmp);
$sql -> db_Insert("core", "'pdf', '".$tmp2."' "); $sql -> db_Insert("core", "'pdf', '".$tmp2."' ");
@@ -81,7 +96,9 @@ function getPDFPrefs(){
return $pdfpref; return $pdfpref;
} }
if(isset($message)){
if(isset($message))
{
$caption = PDF_LAN_1; $caption = PDF_LAN_1;
$ns -> tablerender($caption, $message); $ns -> tablerender($caption, $message);
} }
@@ -97,15 +114,15 @@ $text = "
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_5."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_5."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_left", 74, $pdfpref['pdf_margin_left'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_left", 10, $pdfpref['pdf_margin_left'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_6."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_6."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_right", 74, $pdfpref['pdf_margin_right'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_right", 10, $pdfpref['pdf_margin_right'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_7."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_7."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_top", 74, $pdfpref['pdf_margin_top'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_margin_top", 10, $pdfpref['pdf_margin_top'], 10)."</td>
</tr>"; </tr>";
$fontlist=array("arial","times","courier","helvetica","symbol"); $fontlist=array("arial","times","courier","helvetica","symbol");
@@ -123,19 +140,19 @@ $text .= "
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_9."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_9."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size", 74, $pdfpref['pdf_font_size'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size", 10, $pdfpref['pdf_font_size'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_10."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_10."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_sitename", 74, $pdfpref['pdf_font_size_sitename'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_sitename", 10, $pdfpref['pdf_font_size_sitename'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_11."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_11."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_page_url", 74, $pdfpref['pdf_font_size_page_url'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_page_url", 10, $pdfpref['pdf_font_size_page_url'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_12."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_12."</td>
<td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_page_number", 74, $pdfpref['pdf_font_size_page_number'], 250)."</td> <td class='forumheader3' style='width:70%;'>".$rs -> form_text("pdf_font_size_page_number", 10, $pdfpref['pdf_font_size_page_number'], 10)."</td>
</tr> </tr>
<tr> <tr>
<td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_13."</td> <td class='forumheader3' style='width:30%; white-space:nowrap;'>".PDF_LAN_13."</td>

View File

@@ -1,21 +1,20 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Plugin - PDF generator
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/e107pdf.php,v $
| * $Revision: 1.6 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/e107pdf.php,v $ * $Date: 2008-12-21 12:03:28 $
| $Revision: 1.5 $ * $Author: e107steved $
| $Date: 2008-08-08 21:13:46 $ *
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/ */
if (!defined('e107_INIT')) { exit; }
// Debug option - adds entries to rolling log (only works in 0.8) // Debug option - adds entries to rolling log (only works in 0.8)
//define ('PDF_DEBUG', TRUE); //define ('PDF_DEBUG', TRUE);

View File

@@ -1,4 +1,19 @@
<?php <?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/fpdf.php,v $
* $Revision: 1.3 $
* $Date: 2008-12-21 12:03:28 $
* $Author: e107steved $
*
*/
/******************************************************************************* /*******************************************************************************
* Software: FPDF * * Software: FPDF *
* Version: 1.53 * * Version: 1.53 *
@@ -8,6 +23,7 @@
* * * *
* You may use and modify this software as you wish. * * You may use and modify this software as you wish. *
*******************************************************************************/ *******************************************************************************/
if (!defined('e107_INIT')) { exit; }
if(!class_exists('FPDF')) if(!class_exists('FPDF'))
{ {

View File

@@ -3,10 +3,10 @@
+ -----------------------------------------------------------------------------+ + -----------------------------------------------------------------------------+
| e107 website system - Language File. | e107 website system - Language File.
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/languages/English.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/languages/English_admin_pdf.php,v $
| $Revision: 1.1.1.1 $ | $Revision: 1.1 $
| $Date: 2006-12-02 04:35:37 $ | $Date: 2008-12-21 12:03:28 $
| $Author: mcfly_e107 $ | $Author: e107steved $
+-----------------------------------------------------------------------------+ +-----------------------------------------------------------------------------+
*/ */
@@ -36,4 +36,8 @@ define("PDF_LAN_18", "PDF preferences successfully updated");
define("PDF_LAN_19", "Page"); define("PDF_LAN_19", "Page");
define("PDF_LAN_20", "error reporting"); define("PDF_LAN_20", "error reporting");
// Admin logging
define('LAN_AL_PDF_01', 'PDF settings updated');
?> ?>

View File

@@ -1,36 +1,34 @@
<?php <?php
/* /*
+ ----------------------------------------------------------------------------+ * e107 website system
| e107 website system *
| * Copyright (C) 2001-2008 e107 Inc (e107.org)
| <20>Steve Dunstan 2001-2002 * Released under the terms and conditions of the
| http://e107.org * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
| jalist@e107.org *
| * Plugin - PDF Generator
| Released under the terms and conditions of the *
| GNU General Public License (http://gnu.org). * $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $
| * $Revision: 1.3 $
| $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $ * $Date: 2008-12-21 12:03:28 $
| $Revision: 1.2 $ * $Author: e107steved $
| $Date: 2008-01-09 22:06:22 $ *
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/ */
require_once("../../class2.php"); require_once("../../class2.php");
$qs = explode(".", e_QUERY,2); if (!plugInstalled('pdf') || !e_QUERY)
if ($qs[0] == "") { {
header("location:".e_BASE."index.php"); header("location:".e_BASE."index.php");
exit; exit;
} }
$qs = explode(".", e_QUERY,2);
$source = $qs[0]; $source = $qs[0];
$parms = varset($qs[1],''); $parms = varset($qs[1],'');
$lan_file = e_PLUGIN."pdf/languages/".e_LANGUAGE.".php"; include_lan(e_PLUGIN.'pdf/languages/English_admin_pdf.php');
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
define('FPDF_FONTPATH', 'font/'); define('FPDF_FONTPATH', 'font/');
require_once(e_PLUGIN."pdf/ufpdf.php"); //require the ufpdf class require_once(e_PLUGIN.'pdf/ufpdf.php'); //require the ufpdf class
require_once(e_PLUGIN."pdf/e107pdf.php"); //require the e107pdf class require_once(e_PLUGIN.'pdf/e107pdf.php'); //require the e107pdf class
$pdf = new e107PDF(); $pdf = new e107PDF();
if(strpos($source,'plugin:') !== FALSE) if(strpos($source,'plugin:') !== FALSE)
@@ -51,16 +49,20 @@ if(strpos($source,'plugin:') !== FALSE)
else else
{ {
if($source == 'news'){ if($source == 'news')
{
$con = new convert; $con = new convert;
$sql->db_Select("news", "*", "news_id='".intval($parms)."'"); $sql->db_Select("news", "*", "news_id='".intval($parms)."'");
$row = $sql->db_Fetch(); $row = $sql->db_Fetch();
$news_body = $tp->toHTML($row['news_body'], TRUE); $news_body = $tp->toHTML($row['news_body'], TRUE);
$news_extended = $tp->toHTML($row['news_extended'], TRUE); $news_extended = $tp->toHTML($row['news_extended'], TRUE);
if ($row['news_author'] == 0){ if ($row['news_author'] == 0)
{
$a_name = "e107"; $a_name = "e107";
$category_name = "e107 welcome message"; $category_name = "e107 welcome message";
}else{ }
else
{
$sql->db_Select("news_category", "category_id, category_name", "category_id='".intval($row['news_category'])."'"); $sql->db_Select("news_category", "category_id, category_name", "category_id='".intval($row['news_category'])."'");
list($category_id, $category_name) = $sql->db_Fetch(); list($category_id, $category_name) = $sql->db_Fetch();
$sql->db_Select("user", "user_id, user_name", "user_id='".intval($row['news_author'])."'"); $sql->db_Select("user", "user_id, user_name", "user_id='".intval($row['news_author'])."'");
@@ -110,9 +112,7 @@ else
//always return an array with the following data: //always return an array with the following data:
$text = array($text, $creator, $author, $title, $subject, $keywords, $url); $text = array($text, $creator, $author, $title, $subject, $keywords, $url);
$pdf->makePDF($text); $pdf->makePDF($text);
} }
} }
?> ?>

View File

@@ -1,8 +1,13 @@
/* /*
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org) * e107 website system Copyright (C) 2001-2008 e107 Inc (e107.org)
* $Id: pdf.sc,v 1.2 2008-09-04 20:07:34 e107steved Exp $ * $Id: pdf.sc,v 1.3 2008-12-21 12:03:28 e107steved Exp $
*/ */
if (!plugInstalled('pdf'))
{
return;
}
if (defined("ICONPRINTPDF") && file_exists(THEME."images/".ICONPRINTPDF)) if (defined("ICONPRINTPDF") && file_exists(THEME."images/".ICONPRINTPDF))
{ {
$icon = THEME_ABS."images/".ICONPRINTPDF; $icon = THEME_ABS."images/".ICONPRINTPDF;
@@ -12,8 +17,4 @@ else
$icon = e_PLUGIN_ABS."pdf/images/pdf_16.png"; $icon = e_PLUGIN_ABS."pdf/images/pdf_16.png";
} }
$parms = explode("^",$parm); $parms = explode("^",$parm);
//core //return "<a href='".e_BASE."pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
//plugin //return "<a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
return " <a href='".e_PLUGIN_ABS."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>"; return " <a href='".e_PLUGIN_ABS."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";

View File

@@ -1,69 +0,0 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
$lan_file = e_PLUGIN."pdf/languages/".e_LANGUAGE.".php";
include_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."pdf/languages/English.php");
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "PDF_PLUGIN_LAN_1";
$eplug_version = "1.0";
$eplug_author = "Eric Vanderfeesten (lisa)";
$eplug_logo = "";
$eplug_url = "http://eindhovenseschool.net";
$eplug_email = "lisa@eindhovenseschool.net";
$eplug_description = PDF_PLUGIN_LAN_2;
$eplug_compatible = "e107v0.7+";
$eplug_readme = ""; // leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "pdf";
// Mane of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "admin_pdf_config.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/pdf_32.png";
$eplug_icon_small = $eplug_folder."/images/pdf_16.png";
$eplug_caption = PDF_PLUGIN_LAN_3;
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = "";
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = "";
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = "";
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = FALSE;
$eplug_link_name = "";
$eplug_link_url = "";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = PDF_PLUGIN_LAN_4;
// upgrading ... //
$upgrade_add_prefs = "";
$upgrade_remove_prefs = "";
$upgrade_alter_tables = "";
$eplug_upgrade_done = "";
?>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-21 12:03:28 e107steved Exp $ -->
<e107Plugin name="PDF_PLUGIN_LAN_1" version="1.0" compatibility="0.8" installRequired="true">
<author name="Eric Vanderfeesten (lisa)" url="http://eindhovenseschool.net" email="lisa@eindhovenseschool.net" />
<description>PDF_PLUGIN_LAN_2</description>
<folder>pdf</folder>
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<logLanguageFile filename="languages/--LAN--_admin_pdf.php" />
<administration>
<configFile>admin_pdf_config.php</configFile>
<icon>images/pdf_32.png</icon>
<iconSmall>images/pdf_16.png</iconSmall>
<caption>PDF</caption>
<installDone>PDF_PLUGIN_LAN_4</installDone>
</administration>
<mainPrefs>
</mainPrefs>
</e107Plugin>

View File

@@ -1,4 +1,20 @@
<?php <?php
/*
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Plugin - PDF generator
*
* $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/ufpdf.php,v $
* $Revision: 1.3 $
* $Date: 2008-12-21 12:03:28 $
* $Author: e107steved $
*
*/
/******************************************************************************* /*******************************************************************************
* Software: UFPDF, Unicode Free PDF generator * * Software: UFPDF, Unicode Free PDF generator *
* Version: 0.1 * * Version: 0.1 *
@@ -10,6 +26,7 @@
* UFPDF is a modification of FPDF to support Unicode through UTF-8. * * UFPDF is a modification of FPDF to support Unicode through UTF-8. *
* * * *
*******************************************************************************/ *******************************************************************************/
if (!defined('e107_INIT')) { exit; }
if(!class_exists('UFPDF')) if(!class_exists('UFPDF'))
{ {