$l['name'], 'variables' => $l['variables']); } } $defaultVariables = array( 'OC_pcemail' => OCC_WORD_CHAIR . ' Email Address', 'OC_confirmmail' => 'Notification Email Address', 'OC_confName' => 'Event Short Name', 'OC_confNameFull' => 'Event Full Name', 'OC_confURL' => 'Event Web Address', 'OC_openconfURL' => 'OpenConf Web Address', ); clearstatcache(); function oc_templateForm($tid, $subject, $body) { print '

all templates


Template:' . safeHTMLstr($GLOBALS['templateAR'][$tid]['name']) . ' 
 
 
'; print ' [:variables:]

'; foreach ($GLOBALS['defaultVariables'] as $k => $v) { print ''; } if (!empty($GLOBALS['templateAR'][$tid]['variables'])) { $vars = json_decode($GLOBALS['templateAR'][$tid]['variables']); foreach ($vars as $k => $v) { print ''; } } print '
[:' . safeHTMLstr($k) . ':]'. safeHTMLstr($v) . '
[:' . safeHTMLstr($k) . ':]'. safeHTMLstr($v) . '

The variables appearing next to the message field may be used in your email by enclosing each instance in [:variable:] . These will be substituted for their value prior to the email being sent. For example, to include the conference (short) name in your message use [:OC_confName:] . Some variables are only available for certain types of notification.

'; printFooter(); exit; } if (isset($_GET['ocaction']) && ($_GET['ocaction'] == 'edit') && isset($_GET['tid']) && isset($templateAR[$_GET['tid']])) { $r = ocsql_query("SELECT `name`, `subject`, `body`, `variables` FROM `" . OCC_TABLE_TEMPLATE . "` WHERE `type`='notification' AND `templateid`='" . safeSQLstr($_GET['tid']) . "'") or err('Unable to retrieve template'); if (ocsql_num_rows($r) == 1) { $l = ocsql_fetch_assoc($r); oc_templateForm($_GET['tid'], $l['subject'], $l['body']); } else { print '

Template not found

'; } } elseif (isset($_POST['ocaction']) && ($_POST['ocaction'] == 'Save Template')) { $templateid = (isset($_POST['templateid']) ? trim($_POST['templateid']) : ''); $subject = (isset($_POST['subject']) ? trim($_POST['subject']) : ''); $body = (isset($_POST['body']) ? trim($_POST['body']) : ''); $err = ''; if ( ! preg_match("/^[\w-]+$/", $templateid) || ! isset($templateAR[$templateid]) ) { warn('Template ID invalid'); } elseif (preg_match("/[\r\n]/", $subject)) { $err = 'Subject invalid'; } else { $q = "UPDATE `" . OCC_TABLE_TEMPLATE . "` SET `subject`='" . safeSQLstr($subject) . "', `body`='" . safeSQLstr($body) . "', `updated`='" . safeSQLstr(date("Y-m-d")) . "' WHERE `templateid`='" . safeSQLstr($templateid) . "' AND `type`='notification' LIMIT 1"; if ( ! ocsql_query($q) ) { $err = 'Unable to add/update database'; } } if (empty($err)) { print '

Template saved

'; } else { print '

' . $err . '

'; } oc_templateForm($templateid, $subject, $body); break; } print '

click name to edit

'; $row = 2; foreach ($templateAR as $templateID => $templateInfo) { print ''; $row = $rowAR[$row]; } print '

If modifying a template and non-English language(s)
in use, include translation(s) in the template.

'; printFooter(); ?>