function email_user_approved($reservation_idx)
 {
     //emails the user when thier loan has been approved
     $reserve = ReserveDatabaseAPI::by_id($reservation_idx);
     $reservation = $reserve[$reservation_idx];
     $index = $reserve[$reservation_idx]['building_idx'];
     $categories = ReserveDatabaseAPI::categories();
     $locations = ReserveDatabaseAPI::locations();
     $email = new \PSUSmarty();
     $email->assign('categories', $categories);
     $email->assign('locations', $locations);
     $email->assign('reserve', $reservation);
     $contents = $email->fetch($GLOBALS['TEMPLATES'] . '/email.user.approve.tpl');
     return PSU::mail($reserve[$reservation_idx]['email'], 'Media Request Approved!', $contents, self::headers());
 }
 function __construct()
 {
     parent::__construct();
     $this->template_dir = $GLOBALS['BASE_DIR'] . '/templates';
     // custom template functions
     $this->assign('RFP', $GLOBALS['RFP']);
     // TODO: PSUSmarty.class.php should be updated to assign $PHP on fetch
     $this->assign('PHP', $GLOBALS);
     $this->assign('SESSION', $_SESSION);
 }
 /** 
  * __construct      *
  * Initial object setup.
  *
  * @param string|boolean $uid_or_auto indicates how cache and template directories should be set. uid specifies a unique id to build names, true generates paths automatically. leave blank or false to specify these paths yourself.
  */
 function __construct($params = null, $uid_or_auto = true)
 {
     // Call the super/parent classes constructor
     parent::__construct($uid_or_auto);
     if ($GLOBALS['TEMPLATES']) {
         $this->template_dir = $GLOBALS['TEMPLATES'];
     }
     // register any custom functions
     $this->register_block('box', array($this, 'psu_box'));
     $this->register_block('jqm_page', array($this, 'jqmobile_page'));
     $this->register_block('jqm_header', array($this, 'jqmobile_header'));
     $this->register_block('jqm_content', array($this, 'jqmobile_content'));
     $this->register_block('jqm_footer', array($this, 'jqmobile_footer'));
     $this->register_function('nav', array($this, 'nav'));
 }
Esempio n. 4
0
 /**
  * __construct
  *
  * Initial object setup.
  *
  * @param	string|boolean $uid_or_auto indicates how cache and template directories should be set. uid specifies a unique id to build names, true generates paths automatically. leave blank or false to specify these paths yourself.
  */
 function __construct($params = null, $fluid = false, $uid_or_auto = true)
 {
     static::$GLOBAL_STYLE = PSU_BASE_DIR . '/app/core/templates';
     parent::__construct($uid_or_auto);
     if ($_SESSION['impersonate']) {
         \PSU::get('log/impersonate')->write('Impersonation' . (\PSU::isDev() ? ' on dev server' : '') . ': accessing ' . $_SERVER['REQUEST_URI'] . ($_SERVER['HTTP_REFERER'] ? ' via ' . $_SERVER['HTTP_REFERER'] : ''), $_SESSION['username'], serialize($_REQUEST));
     }
     //end if
     if ($GLOBALS['TEMPLATES']) {
         $this->template_dir = $GLOBALS['TEMPLATES'];
     }
     if (!isset($GLOBALS['USE_APPLICATION_STYLE'])) {
         $GLOBALS['USE_APPLICATION_STYLE'] = true;
     }
     if ($params) {
         parse_str($params, $params);
         $key = key($params);
         if (!$params[$key]) {
             $params['page_title'] = str_replace('_', ' ', $key);
         }
         //end if
     }
     //end if
     $this->page_title = $params['page_title'];
     $this->app_title = $params['app_title'] ? $params['app_title'] : ($GLOBALS['TITLE'] ? $GLOBALS['TITLE'] : 'PSU Webapp');
     $this->fluid = $params['fluid'] ? $params['fluid'] : $fluid;
     // register any custom functions
     $this->register_block('box', array($this, 'psu_box'));
     $this->register_block('col', array($this, 'psu_col'));
     $this->register_block('message', array($this, 'psu_message'));
     $this->register_modifier('yesno', array($this, 'yesno'));
     $this->register_modifier('pluralize', array($this, 'pluralize'));
     $this->register_modifier('query_string', 'http_build_query');
     $this->register_function('myrel_access', array($this, 'myrel_access'));
     $this->register_function('myrel_list', array($this, 'myrel_list'));
     $this->register_function('randomid', array($this, 'randomid'));
     $this->register_function('nav', array($this, 'nav'));
     $this->register_function('navselect', array($this, 'navselect'));
     $this->register_modifier('bool2str', array($this, 'bool2str'));
     $this->content_classes = array(\PSU::isDev() ? 'webapp-dev' : 'webapp-prod');
     $this->body_style_classes = array();
     $this->body_style_classes[] = strtolower('month-' . date('F'));
     $this->body_style_classes[] = strtolower('weekday-' . date('l'));
     $this->body_style_classes[] = 'week-' . date('W');
     $this->body_style_classes[] = 'day-of-year-' . date('z');
     $this->body_style_classes[] = 'day-of-month-' . date('j');
     $this->body_style_classes[] = 'hour-' . date('H');
     $this->body_style_classes[] = 'minute-' . date('i');
     if ($_SESSION['username']) {
         $this->body_style_classes[] = 'user-' . $_SESSION['username'];
     }
     //end if
     if ($_SESSION['wp_id']) {
         $this->body_style_classes[] = 'user-' . $_SESSION['wp_id'];
     }
     //end if
     if ($GLOBALS['FANCY_TPL']) {
         $this->body_style_classes[] = 'extra-tag-styles';
     }
     $this->assign('facebook_api', \PSU::fbAPI());
     $this->assign('facebook_enable', $GLOBALS['FACEBOOK_ENABLE'] == true);
     $go = new \go($_SESSION['wp_id'] ? $_SESSION['wp_id'] : $_SESSION['username']);
     $hot_links = $go->cacheGetSites($_SESSION['wp_id'] || $_SESSION['username'] ? 'popular-me' : 'popular-everyone');
     if (sizeof($hot_links) < 5 && $_SESSION['username']) {
         $everyone_links = $go->cacheGetSites('popular-everyone');
         $hot_links = array_merge($hot_links, $everyone_links);
         $hot_links = array_unique($hot_links);
     }
     //end if
     $this->assign('webapp_hot_links', $hot_links);
     // cdn base url; omit trailing slash
     $this->assign('cdn', substr(\PSU::cdn(), 0, -1));
     if (\PSU::mobile() && $_COOKIE['psumobile'] != 'disable' || $_COOKIE['psumobile'] == 'force') {
         $this->mobile = true;
     }
     //end if
 }
 function __construct()
 {
     parent::__construct();
     $this->template_dir = $GLOBALS['TEMPLATES'];
 }
Esempio n. 6
0
 /**
  * build the email channel
  *
  * @since		version 1.0
  */
 public function emailChannel()
 {
     require_once 'PSUSmarty.class.php';
     $tpl = new PSUSmarty();
     $total_messages = 0;
     $unread_messages = 0;
     $clean_messages = array();
     $messages = $this->getMessages('in:inbox');
     if ($messages === false) {
         return sprintf('Sorry, your mailbox could not be fetched (%s).', $this->error_code);
     }
     if (is_array($messages)) {
         $more = $messages['more'];
         foreach ($messages['m'] as $message) {
             $clean_message = array();
             $clean_message['subject'] = isset($message['su'][0]) && $message['su'][0] != '' ? htmlentities($message['su'][0]) : '[None]';
             $clean_message['subject'] = strlen($clean_message['subject']) > 20 ? substr($clean_message['subject'], 0, 17) . '...' : $clean_message['subject'];
             $clean_message['body_fragment'] = $message['fr'][0];
             $clean_message['from_email'] = $message['e_attribute_a'][0];
             $clean_message['from'] = $message['e_attribute_p'][0] ? htmlspecialchars($message['e_attribute_p'][0]) : $clean_message['from_email'];
             $clean_message['size'] = $this->makeBytesPretty($message['s'], 40 * 1024 * 1024);
             $clean_message['date'] = date('n/j/y', $message['d'] / 1000);
             $clean_message['id'] = $message['id'];
             $clean_message['url'] = 'http://go.plymouth.edu/mymail/msg/' . $clean_message['id'];
             $clean_message['attachment'] = false;
             $clean_message['status'] = 'read';
             $clean_message['deleted'] = false;
             $clean_message['flagged'] = false;
             if (isset($message['f'])) {
                 $clean_message['attachment'] = strpos($message['f'], 'a') !== false ? true : false;
                 $clean_message['status'] = strpos($message['f'], 'u') !== false ? 'unread' : 'read';
                 $clean_message['deleted'] = strpos($message['f'], '2') !== false ? true : false;
                 $clean_message['flagged'] = strpos($message['f'], 'f') !== false ? true : false;
             }
             $clean_messages[] = $clean_message;
         }
         $tpl->assign('messages', $clean_messages);
         $inbox = $this->getFolder(array('l' => 2));
         $total_messages = (int) $inbox['n'];
         $unread_messages = (int) $inbox['u'];
     }
     $tpl->assign('total_messages', $total_messages);
     $tpl->assign('unread_messages', $unread_messages);
     $info = $this->getInfo(array('sections' => 'mbox'));
     if (is_array($info['attrs'][0]['attr_attribute_name'])) {
         $quota = $info['attrs'][0]['attr'][array_search('zimbraMailQuota', $info['attrs'][0]['attr_attribute_name'])];
         $size_text = $this->makeBytesPretty($info['used'][0], $quota * 0.75) . ' out of ' . $this->makeBytesPretty($quota);
         $tpl->assign('size', $size_text);
     }
     /*include_once 'portal_functions.php';
     		$roles = getRoles($this->_username);
     
     		if(in_array('faculty', $roles) || in_array('employee', $roles))
     		{
     			$tpl->parse('main.away_message');
     		}*/
     return $tpl->fetch('/web/pscpages/webapp/portal/channel/email/templates/index.tpl');
 }
 /**
  * displays a ticket's public updates
  */
 public function ticket($ticket)
 {
     IDMObject::authN();
     $sql = "SELECT *,\n\t\t\t\t\t\t\t\t\t CONCAT(date_assigned, ' ', time_assigned) update_date\n\t\t\t        FROM call_history\n\t\t\t\t\t\t WHERE call_id = ?\n               AND (updated_by = ?\n\t\t\t\t\t\t        OR\n\t\t\t\t\t\t        tlc_assigned_to = ?\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\tupdated_by = ?\n\t\t\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\t\t\ttlc_assigned_to = ?\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t ORDER BY date_assigned, time_assigned";
     $args = array($ticket, $this->myuser->login_name, $this->myuser->login_name, $this->myuser->wp_id, $this->myuser->wp_id);
     $details = PSU::db('calllog')->GetAll($sql, $args);
     foreach ($details as &$detail) {
         $p = new PSUPerson($detail['updated_by']);
         $detail['updated_by_name'] = $p->wp_id == $_SESSION['wp_id'] ? 'You' : $p->formatName('f');
         $p->destroy();
         unset($p);
     }
     //end foreach
     $sql = "SELECT call_status\n\t\t\t        FROM call_history\n\t\t\t\t\t\t WHERE call_id = ? AND current = 1";
     $args = array($ticket);
     $this->tpl->assign('call_status', PSU::db('calllog')->GetOne($sql, $args));
     $this->tpl->assign('details', $details);
     $this->tpl->assign('ticket', $ticket);
     $tpl = new PSUSmarty();
     $tpl->assign('hide_checklist', true);
     $tpl->assign('details_title', 'Update Ticket');
     $form = $tpl->fetch(PSU_BASE_DIR . '/webapp/calllog/templates/ticket_form.tpl');
     $this->tpl->assign('form', $form);
     $this->tpl->display('ticket.tpl');
 }
function smarty_function_psugraph_options($params, &$smarty)
{
    $tpl = new PSUSmarty();
    $tpl->assign('args', $params);
    return $tpl->fetch('/web/pscpages/webapp/analytics/templates/graph.options.tpl');
}
 /**
  * __construct
  *
  * Initial object setup.
  *
  * @param	string|boolean $uid_or_auto indicates how cache and template directories should be set. uid specifies a unique id to build names, true generates paths automatically. leave blank or false to specify these paths yourself.
  */
 function __construct($uid_or_auto = true)
 {
     self::$GLOBAL_TEMPLATES = PSU_LEGACY_DIR . '/templates';
     self::$STYLE_TEMPLATES = PSU_BASE_DIR . '/app/core/templates';
     parent::__construct();
     static::$js_registry = array('jquery' => 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js', 'jquery-ui' => 'http' . ($_SERVER['HTTPS'] ? 's' : '') . '://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js', 'ddm' => '/includes/js/jquery-plugins/jquery.multi-ddm.min.js', 'my-combined' => '/webapp/my/js/combined.js', 'my-behavior' => '/webapp/my/js/behavior.js', 'myjs' => '/webapp/portal/myjs/index.php', 'style-behavior' => '/webapp/style-bootstrap/js/behavior.js', 'bootstrap' => '/webapp/style-bootstrap/js/bootstrap.min.js');
     $this->psu_server = ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://';
     if (PSU::isdev()) {
         $this->psu_server .= self::psu_dev_server;
     } else {
         $this->psu_server .= self::psu_prod_server;
     }
     // does user want us to set up smarty dirs?
     if ($uid_or_auto) {
         // what's our temp directory?
         $tmp = null;
         if (isset($GLOBALS['TEMPORARY_FILES'])) {
             $tmp = $GLOBALS['TEMPORARY_FILES'];
         } else {
             foreach (self::$DEFAULT_TMP as $this_tmp) {
                 if (is_dir($this_tmp) && is_writable($this_tmp)) {
                     $tmp = $this_tmp;
                     break;
                 }
             }
         }
         if ($uid_or_auto === true) {
             // true means full automatic. use BASE_URL as the unique seed
             if (!isset($GLOBALS['BASE_URL'])) {
                 // can't be full auto without a base url.
                 throw new PSUSmartyException(PSUSmartyException::NO_BASE_URL);
             }
             $md5 = md5($GLOBALS['BASE_URL']);
             $this->compile_dir = $tmp . '/smarty_tc_' . $md5;
         } else {
             // uid was set, and it wasn't true, so use the string
             $this->compile_dir = $tmp . '/smarty_tc_' . $uid_or_auto;
         }
     } elseif (isset($GLOBALS['SMARTY_COMPILE'])) {
         // user did not want an auto dir, but specified a dir elsewhere
         $this->compile_dir = $GLOBALS['SMARTY_COMPILE'];
     }
     // create compile directory if it's not there yet
     if (!is_dir($this->compile_dir)) {
         $old_umask = umask(07);
         mkdir($this->compile_dir);
         umask($old_umask);
     }
     $this->plugins_dir[] = PSU_EXTERNAL_DIR . '/smarty/psu_plugins';
     $this->head = array('js' => array(), 'google_lazy_js' => array(), 'css' => array());
     // register any custom functions
     $this->register_function('PSU_JS', array($this, 'psu_js'));
     $this->register_function('psu_js', array($this, 'psu_js'));
     $this->register_function('PSU_GOOGLE_LAZY_JS', array($this, 'psu_google_lazy_js'));
     $this->register_function('PSU_CSS', array($this, 'psu_css'));
     $this->register_function('psu_dbug', array($this, 'psu_dbug'));
     $this->register_function('icon', array($this, 'icon'));
     $this->register_function('iconbox', array($this, 'iconbox'));
     $this->register_function('psu_puke', array($this, 'psu_puke'));
     $this->register_function('psu_progress', array($this, 'psu_progress'));
     $this->register_function('psu_authz_js', array($this, 'psu_authz_js'));
     $this->register_outputfilter(array($this, 'psu_head_includes'));
     $this->register_modifier('cdn', array($this, 'cdn'));
     $this->register_modifier('cssslug', array($this, 'cssslug'));
     $this->register_function('paging_querystring', array($this, 'paging_querystring'));
     $this->register_modifier('paging_order', array($this, 'paging_order'));
     $this->register_function('psu_messages', array($this, 'psu_messages'));
     $this->register_function('psu_errors', array($this, 'psu_errors'));
     $this->register_function('psu_successes', array($this, 'psu_successes'));
     $this->register_function('psu_warnings', array($this, 'psu_warnings'));
     $https = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
     // add in the registry
     $this->assign('psureg', PSU::get());
 }
 /**
  * This function is used to send off an email regaurding information on the employee exit checklist. 
  * This function is a bit smashed together to only work with employee exit checklist. If a future checklist was made this function
  * will have to be rethought.
  *
  * @param $attribute string containing pa.attribute and pa.type keys in order to populate usernames by attribute
  * @param $type_id int 1 = permission 2 = role 6 = admin. Must be one of these numebrs
  * @param $subject PSUPerson the person the email is about. 
  * @param $end_date string the date the person will be leaving the institution
  * @param $list string the checklist the email is using. 
  */
 public static function email($subject, $end_date, $attribute, $type_id, $list, $checklist_id, $response)
 {
     global $config;
     $emails = array();
     $people = self::contributors($subject, $checklist_id, $attribute, $type_id);
     $emails = self::contributor_email($people);
     $checklist = self::get($subject->pidm, 'employee-exit');
     if ($emails) {
         $url = $config->get('ape', 'base_url') . '/user/' . $subject->pidm . '/checklist/' . $list;
         $email = new PSUSmarty();
         $email->assign('no_outstanding_charges', $response->no_outstanding_charges);
         $email->assign('no_ape_attributes', $response->no_ape_attributes);
         $email->assign('no_academic_admin', $response->no_academic_admin);
         $email->assign('end_date', $end_date);
         $email->assign('employee_name', $subject->formatName('f m l'));
         $email->assign('employee_username', $subject->username);
         $email->assign('subject', $subject);
         $email->assign('position', $subject->employee_positions[$checklist['position_code']]);
         $email->assign('link', $url);
         $headers = 'Content-type: text/html; charset=UTF-8' . "\r\n";
         PSU::mail($emails, '[Action Required] ' . $subject->formatName('f m l') . ' - Leaving ' . date('M j, Y', $end_date), $email->fetch($GLOBALS['TEMPLATES'] . '/email.checklist.employee-exit.tpl'), $headers);
     }
     //end foreach
     return $emails;
 }
Esempio n. 11
0
<?php

$template_dir = $_GET['dir'] == 'js' ? 'js' : 'css';
$file = $_GET['file'] . '.tpl';
$content_type = $template_dir == 'js' ? 'text/javascript' : 'text/css';
header("Content-Type: {$content_type}");
if (preg_match('/^[a-zA-Z0-9_\\.]+$/', $file) == 0) {
    $_SESSION['errors'][] = "Error in media request {$template_dir}/{$file}.";
    exit;
}
$tpl = new PSUSmarty();
$tpl->template_dir = $GLOBALS['BASE_DIR'] . '/' . $template_dir;
$tpl->display($file);