function generateEmailBody($title, $link, $from_name, $from_email, $to_name, $to_email, $message = null) { $output = array(); $output[] = $from_name . ' thought you might find this link interesting:'; $output[] = ''; $output[] = 'Title: ' . $title; $output[] = 'Link: ' . $link; if ($message) { $output[] = 'Message: ' . iBeginShare::messageFilter($message); } $output[] = ''; $output[] = '-----------------------------'; $output[] = $from_name . ' is using iBegin Share (http://www.ibegin.com/labs/share/)'; $output[] = '-----------------------------'; return implode("\r\n", $output); }
/** * Logs an action for statistics usage. * @param {String} $action The action name (usually the plugin name) * @param {String} $link The URL which this action represents. * @param {String} $label The label of this log action (e.g. 'Delicious'). */ function logAction($action, $link, $label = null) { global $db_link; $db_link->query('INSERT INTO ' . IBEGIN_SHARE_TABLE_PREFIX . 'log (action, label, link, ipaddress, agent, timestamp) VALUES (%s, %s, %s, %s, %s, %d)', $action, $label, $link, ip2long(iBeginShare::getIp()), getenv('HTTP_USER_AGENT'), time()); }
<?php require_once dirname(__FILE__) . '/../../includes/global.inc.php'; // pdf was breaking define(RELATIVE_PATH, ''); switch ($_GET['action']) { case 'word': require_once dirname(__FILE__) . '/HTML2Doc.php'; $doc = new HTML_TO_DOC(); $doc->setTitle(iBeginShare::quoteSmart($_GET['title'])); $doc->createDoc($raw_content, (strlen(iBeginShare::quoteSmart($_GET['title'])) > 0 ? str_replace(' ', '-', strip_tags($_GET['title'])) : 'Document-' . date('Y-m-d')) . '.doc'); break; case 'pdf': require_once dirname(__FILE__) . '/html2fpdf/html2fpdf.php'; $pdf = new HTML2FPDF(); $pdf->DisplayPreferences($_GET['title']); $pdf->AddPage(); $pdf->WriteHTML(html_entity_decode($raw_content)); $pdf->Output((strlen(iBeginShare::quoteSmart($_GET['title'])) > 0 ? str_replace(' ', '-', strip_tags($_GET['title'])) : 'Document-' . date('Y-m-d')) . '.pdf', 'D'); break; }
<?php require_once dirname(__FILE__) . '/includes/global.inc.php'; //process the request. like do the mailing in 'Email' section. switch ($_GET['action']) { case 'log': if ($_GET['plugin'] && $_GET['link']) { iBeginShare::logAction($_GET['plugin'], $_GET['link'], $_GET['name']); } header("Location: " . $_GET['to']); exit; break; default: header("Location: ../"); exit; break; }