예제 #1
0
if (!defined('e107_INIT')) {
    exit;
}
if (!e107::isInstalled('pm')) {
    return '';
}
global $sysprefs, $pm_prefs;
if (!isset($pm_prefs['perpage'])) {
    $pm_prefs = $sysprefs->getArray('pm_prefs');
}
require_once e_PLUGIN . 'pm/pm_func.php';
e107::getScParser();
require_once e_PLUGIN . 'pm/pm_shortcodes.php';
setScVar('pm_handler_shortcodes', 'pmPrefs', $pm_prefs);
$pmManager = new pmbox_manager($pm_prefs);
setScVar('pm_handler_shortcodes', 'pmManager', &$pmManager);
define('PM_INBOX_ICON', "<img src='" . e_PLUGIN_ABS . "pm/images/mail_get.png' class='icon S16' alt='" . LAN_PM_25 . "' title='" . LAN_PM_25 . "' />");
define('PM_OUTBOX_ICON', "<img src='" . e_PLUGIN_ABS . "pm/images/mail_send.png' class='icon S16' alt='" . LAN_PM_26 . "' title='" . LAN_PM_26 . "' />");
define('PM_SEND_LINK', LAN_PM_35);
define('NEWPM_ANIMATION', "<img src='" . e_PLUGIN_ABS . "pm/images/newpm.gif' alt='' />");
$sc_style['PM_SEND_PM_LINK']['pre'] = "<br /><br />[ ";
$sc_style['PM_SEND_PM_LINK']['post'] = " ]";
$sc_style['PM_INBOX_FILLED']['pre'] = "[";
$sc_style['PM_INBOX_FILLED']['post'] = "%]";
$sc_style['PM_OUTBOX_FILLED']['pre'] = "[";
$sc_style['PM_OUTBOX_FILLED']['post'] = "%]";
$sc_style['PM_NEWPM_ANIMATE']['pre'] = "<a href='" . e_PLUGIN_ABS . "pm/pm.php?inbox'>";
$sc_style['PM_NEWPM_ANIMATE']['post'] = "</a>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['pre'] = "<br />[ <a href='" . e_PLUGIN_ABS . "pm/pm.php?blocked'>";
$sc_style['PM_BLOCKED_SENDERS_MANAGE']['post'] = '</a> ]';
if (!isset($pm_menu_template)) {
예제 #2
0
파일: e_cron.php 프로젝트: notzen/e107
 function sendMailshot($cal_query, $shot_type, $msg_num, $calendar_shortcodes)
 {
     global $pref;
     if ($this->logRequirement > 1) {
         $this->logLine(' Starting emails for ' . $shot_type, FALSE, TRUE);
         if ($this->debugLevel >= 2) {
             $this->logLine("\r\n    Query is: " . $cal_query);
         }
     }
     if ($num_cat_proc = $this->e107->sql->db_Select_gen($cal_query)) {
         // Got at least one event to process here
         if ($this->logRequirement > 1) {
             $this->logLine(' - ' . $num_cat_proc . ' categories found to process');
         }
         $this->checkDB();
         // Make sure we've got another DB object
         while ($thisevent = $this->e107->sql->db_Fetch()) {
             // Process one event at a time
             $this->logLine('    Processing event: ' . $event_title);
             setScVar('event_calendar_shortcodes', 'event', $thisevent);
             // Save current values in shortcode
             // Note that event processed, and generate the email
             if ($msg_num == 1) {
                 $this->ourDB->db_Update('event_cat', 'event_cat_last=' . time() . ' where event_cat_id=' . intval($event_cat_id));
                 $cal_msg = $thisevent['event_cat_msg1'];
             } else {
                 $this->ourDB->db_Update('event_cat', 'event_cat_today=' . time() . ' where event_cat_id=' . intval($event_cat_id));
                 $cal_msg = $thisevent['event_cat_msg2'];
             }
             if (trim($cal_msg) == '') {
                 $this->loadDefaultMessages();
                 $cal_msg = $this->defaultMessage[$msg_num];
             }
             // Parsing the template here means we can't use USER-related shortcodes
             // Main ones which are relevant: MAIL_DATE_START, MAIL_TIME_START, MAIL_DATE_END,
             //	MAIL_TIME_END, MAIL_TITLE, MAIL_DETAILS, MAIL_CATEGORY, MAIL_LOCATION,
             //	MAIL_CONTACT, MAIL_THREAD (maybe). Also MAIL_LINK, MAIL_SHORT_DATE
             // Best to strip entities here rather than at entry - handles old events as well
             // Note that certain user-related substitutions will work, however - |USERID|, |USERNAME|, |DISPLAYNAME|
             $cal_title = html_entity_decode($this->e107->tp->parseTemplate($pref['eventpost_mailsubject'], TRUE), ENT_QUOTES, CHARSET);
             $cal_msg = html_entity_decode($this->e107->tp->parseTemplate($cal_msg, TRUE), ENT_QUOTES, CHARSET);
             // Four cases for the query:
             //	1. No forced mailshots - based on event_subs table only									Need INNER JOIN
             //	2. Forced mailshot to members - send to all users (don't care about subscriptions)		Don't need JOIN
             // 	3. Forced mailshot to group of members - based on user table only						Don't need JOIN
             //	4. Forced mailshot to group, plus optional subscriptions - use the lot!    				Need LEFT JOIN
             // (Always block sent to banned members)
             $manual_subs = isset($pref['eventpost_asubs']) && $pref['eventpost_asubs'] == '1';
             $subs_fields = '';
             $subs_join = '';
             $whereClause = '';
             $group_clause = '';
             if ($event_cat_force_class != e_UC_MEMBER) {
                 // Cases 1, 3, 4 (basic query does for case 2)
                 if (!$thisevent['event_cat_force_class'] || $manual_subs) {
                     // Cases 1 & 4 - need to join with event_subs database
                     $subs_fields = ", es.* ";
                     if ($thisevent['event_cat_force_class']) {
                         $subs_join = 'LEFT';
                     } else {
                         $subs_join = 'INNER';
                     }
                     $subs_join .= ' join `#event_subs` AS es on u.`user_id`=es.`event_userid` ';
                     $whereClause = ' es.`event_cat`=' . intval($thisevent['event_category']) . ' ';
                     $group_clause = ' GROUP BY u.`user_id`';
                 }
                 if ($event_cat_force_class) {
                     // cases 3 and 4 - ... and check for involuntary subscribers
                     if ($whereClause) {
                         $whereClause .= ' OR ';
                     }
                     if ($thisevent['event_cat_force_class'] == e_UC_ADMIN) {
                         $whereClause .= '(u.`user_admin` = 1 )';
                     } else {
                         $whereClause .= "find_in_set('" . intval($thisevent['event_cat_force_class']) . "', u.`user_class`)";
                         $group_clause = ' GROUP BY u.`user_id`';
                     }
                 }
                 if ($whereClause) {
                     $whereClause = ' AND (' . $whereClause . ' ) ';
                 }
             }
             // End of cases 1, 3, 4
             $cal_emilargs = "SELECT u.`user_id`, u.`user_class`, u.`user_email`, u.`user_name`, u.`user_ban`, u.`user_admin`{$subs_fields}\n\t\t\t\t  from `#user` AS u {$subs_join}\n\t\t\t\t\t  WHERE u.`user_ban` = 0 {$whereClause} {$group_clause}";
             if ($this->debugLevel >= 2) {
                 $this->logLine("\r\n    Email selection query is: " . $cal_emilargs);
             }
             if ($num_shots = $this->ourDB->db_Select_gen($cal_emilargs)) {
                 $this->logLine(' - ' . $num_shots . ' emails found to send');
                 // Definitely got some emails to send here
                 $this->checkMailManager();
                 // Make sure our mail manager is loaded
                 // Start by adding the email details
                 $email = array('mail_create_app' => 'calendar_menu', 'mail_title' => str_replace('--REF--', intval(time() / 3600), LAN_EC_MAIL_07), 'mail_subject' => $cal_title, 'mail_body' => $cal_msg, 'mail_sender_email' => $pref['eventpost_mailaddress'], 'mail_sender_name' => $pref['eventpost_mailfrom'], 'mail_send_style' => 'textonly');
                 if (FALSE === ($mailMainID = $this->mailManager->saveEmail($email, TRUE))) {
                     $this->logLine('Error adding mail body to database - run abandoned');
                     break;
                 }
                 $this->mailManager->mailInitCounters($mailMainID);
                 // Initialise counters for emails added
                 // Now loop through adding users
                 while ($row = $this->ourDB->db_Fetch()) {
                     if ($this->debugLevel == 0) {
                         $recipient = array('mail_recipient_id' => $row['user_id'], 'mail_recipient_name' => $row['user_name'], 'mail_recipient_email' => $row['user_email'], 'mail_target_info' => array('USERID' => $row['user_id'], 'DISPLAYNAME' => $row['user_name'], 'USERNAME' => $row['user_loginname']));
                         $result = $this->mailManager->mailAddNoDup($mailMainID, $recipient, MAIL_STATUS_TEMP);
                         if ($result === FALSE) {
                             $this->logLine("Error adding recipient {$row['user_id']}");
                         }
                     } else {
                         $send_result = " **DEBUG**";
                     }
                     if ($this->logRequirement > 1) {
                         $this->logLine('      Send to ' . $user_id . ':' . $user_email . ' Name: ' . $user_name . ' Result = ' . $send_result);
                     }
                 }
                 $this->mailManager->mailUpdateCounters($mailMainID);
                 // Save counters to DB
                 if ($this->mailManager->activateEmail($mailMainID, FALSE, time() + 80000) === TRUE) {
                     $this->logLine("Email {$mailMainID} activated");
                 } else {
                     $this->logLine("Error activating email {$mailMainID}");
                 }
             } elseif ($num_cat === FALSE) {
                 $this->logLine('  User read error for ' . $shot_type . ': ' . $this->ourDB->{$mySQLlastErrNum} . ':' . $this->ourDB->{$mySQLlastErrText});
             } elseif ($this->logRequirement > 1) {
                 $this->logLine('  - no users found.');
             }
         }
         // while
         if ($this->logRequirement > 1) {
             $this->logLine('  Completed emails for ' . $shot_type . ' at ' . date('D j M Y G:i:s'));
         }
     } elseif ($num_cat === FALSE) {
         $this->logLine('  DB read error for ' . $shot_type . ': ' . $this->e107->sql->{$mySQLlastErrNum} . ':' . $this->e107->sql->{$mySQLlastErrText});
     } elseif ($this->logRequirement > 1) {
         $this->logLine('  - no records found.');
     }
 }
예제 #3
0
 *
 *
 *
 * $Source: /cvs_backup/e107_0.8/e107_plugins/online/lastseen_menu.php,v $
 * $Revision$
 * $Date$
 * $Author$
 */
if (!defined('e107_INIT')) {
    exit;
}
include_lan(e_PLUGIN . 'online/languages/' . e_LANGUAGE . '.php');
require_once e_PLUGIN . 'online/online_shortcodes.php';
if (is_readable(THEME . 'online_menu_template.php')) {
    require THEME . 'online_menu_template.php';
} else {
    require e_PLUGIN . 'online/online_menu_template.php';
}
$menu_pref = e107::getConfig('menu')->getPref('');
$tp = e107::getParser();
$num = intval(varsettrue($menu_pref['online_ls_amount'], 10));
$sql->db_Select('user', 'user_id, user_name, user_currentvisit', 'ORDER BY user_currentvisit DESC LIMIT 0,' . $num, 'nowhere');
$lslist = $sql->db_getList();
$text = $tp->parseTemplate($TEMPLATE_LASTSEEN['START'], TRUE);
foreach ($lslist as $row) {
    setScVar('online_shortcodes', 'currentUser', $row);
    $text .= $tp->parseTemplate($TEMPLATE_LASTSEEN['ITEM'], TRUE);
}
$text .= $tp->parseTemplate($TEMPLATE_LASTSEEN['END'], TRUE);
$caption = varsettrue($menu_pref['online_ls_caption'], LAN_LASTSEEN_1);
$ns->tablerender($caption, $text, 'lastseen');
예제 #4
0
파일: online_menu.php 프로젝트: armpit/e107
                } elseif (strstr($online_location_page, 'forum')) {
                    $pinfo = e_PLUGIN . 'forum/forum.php';
                    $online_location_page = 'forum';
                } elseif (strstr($online_location_page, 'content')) {
                    $pinfo = 'content.php';
                    $online_location_page = 'content';
                } elseif (strstr($online_location_page, 'comment')) {
                    $pinfo = 'comment.php';
                    $online_location_page = 'comment';
                }
                list($oid, $oname) = explode('.', $uinfo, 2);
                $data = array('oid' => $row['user_id'], 'oname' => $row['user_name'], 'page' => $online_location_page, 'pinfo' => $pinfo, 'oimage' => $row['user_image']);
                setScVar('online_shortcodes', 'currentMember', $data);
                $ret .= $tp->parseTemplate($ONLINE_TEMPLATE['online_members_list_extended'], TRUE);
            }
            setScVar('online_shortcodes', 'onlineMembersList', $ret);
        }
    }
    $text = $tp->parseTemplate($ONLINE_TEMPLATE['enabled'], TRUE);
} else {
    if (ADMIN) {
        $text = $tp->parseTemplate($ONLINE_TEMPLATE['disabled'], TRUE);
    } else {
        return;
    }
}
$img = is_readable(THEME . 'images/online_menu.png') ? "<img src='" . THEME_ABS . "images/online_menu.png' alt='' />" : '';
$caption = $img . ' ' . vartrue($menu_pref['online_caption'], LAN_ONLINE_10);
if (getperms('1')) {
    $path = e_PLUGIN_ABS . "online/config.php";
    $caption .= "<a class='pull-right' href='" . $path . "' title='Configure'><i class='icon-cog'></i></a>";
예제 #5
0
파일: pm.php 프로젝트: notzen/e107
 /**
  *	Show list of blocked users
  *	@param int $start - not used at present; offset into list
  *
  *	@return string text for display
  */
 public function showBlocked($start = 0)
 {
     $tpl_file = THEME . 'pm_template.php';
     include is_readable($tpl_file) ? $tpl_file : e_PLUGIN . 'pm/pm_template.php';
     $pmBlocks = $this->block_get_user();
     // TODO - handle pagination, maybe (is it likely to be necessary?)
     setScVar('pm_handler_shortcodes', 'pmBlocks', $pmBlocks);
     $txt = "<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>";
     $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_HEADER, true);
     if ($pmTotalBlocked = count($pmBlocks)) {
         foreach ($pmBlocks as $pmBlocked) {
             setScVar('pm_handler_shortcodes', 'pmBlocked', $pmBlocked);
             $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_TABLE, true);
         }
     } else {
         $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_EMPTY, true);
     }
     $txt .= $this->e107->tp->parseTemplate($PM_BLOCKED_FOOTER, true);
     $txt .= '</form>';
     return $txt;
 }