Example #1
0
 function getlinks($cat = 1)
 {
     $this->eLinkList = array();
     // clear the array in case getlinks is called 2x on the same page.
     $sql = e107::getDb('sqlSiteLinks');
     $ins = $cat > 0 ? "link_category = " . intval($cat) . " AND " : "";
     $query = "SELECT * FROM #links WHERE " . $ins . "  link_class IN (" . USERCLASS_LIST . ") ORDER BY link_order ASC";
     if ($sql->db_Select_gen($query)) {
         while ($row = $sql->db_Fetch()) {
             if ($row['link_sefurl']) {
                 $this->sefList[$row['link_sefurl']] = $row['link_url'];
             }
             //	if (substr($row['link_name'], 0, 8) == 'submenu.'){
             //		$tmp=explode('.', $row['link_name'], 3);
             //		$this->eLinkList[$tmp[1]][]=$row;
             if (isset($row['link_parent']) && $row['link_parent'] != 0) {
                 $this->eLinkList['sub_' . $row['link_parent']][] = $row;
             } else {
                 $this->eLinkList['head_menu'][] = $row;
                 if (vartrue($row['link_function'])) {
                     list($path, $method) = explode("::", $row['link_function']);
                     if (include_once e_PLUGIN . $path . "/e_sitelink.php") {
                         $class = $path . "_sitelinks";
                         $sublinkArray = e107::callMethod($class, $method);
                         //TODO Cache it.
                         if (vartrue($sublinkArray)) {
                             $this->eLinkList['sub_' . $row['link_id']] = $sublinkArray;
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
 function __construct()
 {
     $pref = e107::getPref();
     $this->notify_prefs = e107::getConfig('notify')->getPref();
     $this->prefCleanup();
     $this->test();
     $recalibrate = FALSE;
     // load every e_notify.php file.
     if ($pref['e_notify_list']) {
         foreach ($pref['e_notify_list'] as $val) {
             $this->notify_prefs['plugins'][$val] = TRUE;
             if (is_readable(e_PLUGIN . $val . "/e_notify.php")) {
                 require_once e_PLUGIN . $val . '/e_notify.php';
                 if (class_exists($val . "_notify")) {
                     $legacy = 0;
                     // Newe.
                     $config_events = array();
                     $data = e107::callMethod($val . "_notify", 'config');
                     $config_category = str_replace("_menu", "", ucfirst($val)) . " Events";
                     foreach ($data as $v) {
                         $func = $v['function'];
                         $config_events[$func] = $v['name'];
                     }
                 } else {
                     $legacy = 1;
                     // Legacy Mode.
                 }
                 //		foreach ($config_events as $event_id => $event_text)
                 //   		{
                 //	$this -> notify_prefs['event'][$event_id] = array('class' => '255', 'email' => '', 'plugin'=> $val);
                 //		}
                 $this->pluginConfig[$val] = array('category' => $config_category, 'events' => $config_events, 'legacy' => $legacy);
                 $recalibrate = true;
             }
         }
     }
     //	print_a($this->pluginConfig);
     if ($recalibrate) {
         //	$s_prefs = $tp -> toDB($this -> notify_prefs);
         //	$s_prefs = $eArrayStorage -> WriteArray($s_prefs);
         //	$sql -> db_Update("core", "e107_value='".$s_prefs."' WHERE e107_name='notify_prefs'");
     }
 }
Example #3
0
 function rssadminimport()
 {
     $sql = e107::getDb();
     $ns = e107::getRender();
     $mes = e107::getMessage();
     $tp = e107::getParser();
     global $i, $rss_shortcodes, $feed, $pref;
     global $RSS_ADMIN_IMPORT_HEADER, $RSS_ADMIN_IMPORT_TABLE, $RSS_ADMIN_IMPORT_FOOTER;
     $sqli = new db();
     $feedlist = array();
     // News
     $feed['name'] = ADLAN_0;
     $feed['url'] = 'news';
     // The identifier for the rss feed url
     $feed['topic_id'] = '';
     // The topic_id, empty on default (to select a certain category)
     $feed['path'] = 'news';
     // This is the plugin path location
     $feed['text'] = RSS_PLUGIN_LAN_7;
     $feed['class'] = '0';
     $feed['limit'] = '9';
     $feedlist[] = $feed;
     // News categories
     if ($sqli->db_Select("news_category", "*", "category_id!='' ORDER BY category_name ")) {
         while ($rowi = $sqli->db_Fetch()) {
             $feed['name'] = ADLAN_0 . ' > ' . $rowi['category_name'];
             $feed['url'] = 'news';
             $feed['topic_id'] = $rowi['category_id'];
             $feed['path'] = 'news';
             $feed['text'] = RSS_PLUGIN_LAN_10 . ' ' . $rowi['category_name'];
             $feed['class'] = '0';
             $feed['limit'] = '9';
             //	$feed['exclude_class'] = '';
             $feedlist[] = $feed;
         }
     }
     /*		// Download
     		$feed['name']		= ADLAN_24;
     		$feed['url']		= 'download';
     		$feed['topic_id']	= '';
     		$feed['path']		= 'download';
     		$feed['text']		= RSS_PLUGIN_LAN_8;
     		$feed['class']		= '0';
     		$feed['limit']		= '9';
     		$feedlist[]			= $feed;
     
     		// Download categories
     		if($sqli -> db_Select("download_category", "*","download_category_id!='' ORDER BY download_category_order "))
     		{
     			while($rowi = $sqli -> db_Fetch())
     			{
     				$feed['name']		= ADLAN_24.' > '.$rowi['download_category_name'];
     				$feed['url']		= 'download';
     				$feed['topic_id']	= $rowi['download_category_id'];
     				$feed['path']		= 'download';
     				$feed['text']		= RSS_PLUGIN_LAN_11.' '.$rowi['download_category_name'];
     				$feed['class']		= '0';
     				$feed['limit']		= '9';
     				$feedlist[]			= $feed;
     			}
     		}
     */
     // Comments
     $feed['name'] = LAN_COMMENTS;
     $feed['url'] = 'comments';
     $feed['topic_id'] = '';
     $feed['path'] = 'comments';
     $feed['text'] = RSS_PLUGIN_LAN_9;
     $feed['class'] = '0';
     $feed['limit'] = '9';
     $feedlist[] = $feed;
     // Plugin rss feed, using e_rss.php in plugin folder
     $plugin_feedlist = array();
     foreach ($pref['e_rss_list'] as $val) {
         $eplug_rss_feed = array();
         if (is_readable(e_PLUGIN . $val . "/e_rss.php")) {
             require_once e_PLUGIN . $val . "/e_rss.php";
             $className = $val . "_rss";
             $data = false;
             if (!($data = e107::callMethod($className, 'config'))) {
                 $data = $eplug_rss_feed;
             }
             foreach ($data as $v) {
                 $v['path'] = $val;
                 array_push($plugin_feedlist, $v);
             }
         }
     }
     $feedlist = array_merge($feedlist, $plugin_feedlist);
     //		print_a($feedlist);
     $render = FALSE;
     $i = 0;
     $text = $RSS_ADMIN_IMPORT_HEADER;
     foreach ($feedlist as $k => $feed) {
         $feed['topic_id'] = $tp->toDB($feed['topic_id']);
         $feed['url'] = $tp->toDB($feed['url']);
         // Check if feed is not yet present
         if (!$sql->select("rss", "*", "rss_path='" . $feed['path'] . "' AND rss_url='" . $feed['url'] . "' AND rss_topicid='" . $feed['topic_id'] . "' ")) {
             $render = TRUE;
             $text .= $tp->parseTemplate($RSS_ADMIN_IMPORT_TABLE, FALSE, $rss_shortcodes);
             $i++;
         }
     }
     $text .= $tp->parseTemplate($RSS_ADMIN_IMPORT_FOOTER, FALSE, $rss_shortcodes);
     if (!$render) {
         $this->show_message(RSS_LAN_ADMIN_11, RSS_LAN_ERROR_6);
     } else {
         $ns->tablerender(RSS_LAN_ADMIN_11, $mes->render() . $text);
     }
 }
Example #4
0
 /**
  * Displays existing comments, and a comment entry form
  *
  * @param string $table - the source table for the associated item
  * @param string $action - usually 'comment' or 'reply'
  * @param integer $id - ID of item associated with comments (e.g. news ID)
  * @param unknown_type $width - appears to not be used
  * @param string $subject
  * @param boolean $rate
  */
 function compose_comment($table, $action, $id, $width, $subject, $rate = FALSE, $return = FALSE, $tablerender = TRUE)
 {
     //compose comment	: single call function will render the existing comments and show the form_comment
     //rate				: boolean, to show/hide rating system in comment, default FALSE
     global $totcc;
     $tp = e107::getParser();
     $ns = e107::getRender();
     $pref = e107::getPref();
     if ($this->getCommentPermissions() === FALSE) {
         return;
     }
     $params = array('method' => 'compose_comment', 'table' => $table, 'action' => $action, 'id' => $id, 'width' => $width, 'subject' => $subject, 'rate' => $rate, 'return' => $return, 'tablerender' => $tablerender);
     if ($this->engine != 'e107') {
         list($plugin, $method) = explode("::", $this->engine);
         $obj = e107::getAddon($plugin, 'e_comment');
         $text = e107::callMethod($obj, $method, $params);
         if (!$return) {
             if ($tablerender) {
                 echo $ns->tablerender(null, $text, 'comment', true);
             } else {
                 echo $text;
             }
         } else {
             $ret['comment'] = $text;
             $ret['comment_form'] = '';
             $ret['caption'] = '';
             return !$return ? "" : $ret;
         }
         return '';
     }
     if ($user_func = e107::getOverride()->check($this, 'compose_comment')) {
         return call_user_func($user_func, $params);
     }
     // ------------- TODO move the 'listing' into separate function so that ajax can access it easily.
     $options = array('action' => $action, 'subject' => $subject, 'rate' => $rate);
     $text = $lock = $modcomment = '';
     if ($action != 'reply') {
         $tmp = $this->getComments($table, $id, 0, $options);
         // render all comments;
         $text = $tmp['comments'];
         $lock = $tmp['lock'];
         unset($tmp);
     }
     // -------------------------------------------------------
     if ($text) {
         $modcomment = "<div class='comment-options'>";
         if ($this->totalComments && getperms("B")) {
             //	$modcomment .= "<a href='".e_ADMIN_ABS."modcomment.php?$table.$id'>".COMLAN_314."</a>";
             $modcomment .= "<a class='btn btn-default btn-mini btn-sm' href='" . e_ADMIN_ABS . "comment.php?searchquery={$id}&filter_options=comment_type__" . $this->getCommentType($table) . "'>" . COMLAN_314 . "</a>";
         }
         $modcomment .= $this->nextprev($table, $id, $from);
         $modcomment .= "</div>";
     }
     // ---------------------------
     if ($lock != '1') {
         $comment = $this->form_comment($action, $table, $id, $subject, "", TRUE, $rate, false);
         // tablerender turned off.
     } else {
         $comment = "<br /><div style='text-align:center'><b>" . COMLAN_328 . "</b></div>";
     }
     if ($text) {
         //XXX Do NOT add to template - too important to allow for modification.
         $text = "<ul class='media-list' id='comments-container'>\n" . $text . "\n</ul>";
     } else {
         $text = "<ul class='media-list' id='comments-container'><li><!-- --></li></ul>";
     }
     $search = array("{MODERATE}", "{COMMENTS}", "{COMMENTFORM}", "{COMMENTNAV}");
     $replace = array($modcomment, $text, $comment, $pagination);
     $TEMPL = str_replace($search, $replace, $this->template['layout']);
     if (!$return) {
         if ($tablerender) {
             echo $ns->tablerender("<span id='e-comment-total'>" . $this->totalComments . "</span> " . COMLAN_99, $TEMPL, 'comment', TRUE);
         } else {
             echo $TEMPL;
         }
     }
     //echo $modcomment.$comment;
     //echo $text;
     $ret['comment'] = $text;
     $ret['comment_form'] = $comment;
     $ret['caption'] = "<span id='e-comment-total'>" . $this->totalComments . "</span> " . COMLAN_99;
     return !$return ? "" : $ret;
 }
Example #5
0
File: links.php Project: gitye/e107
 function link_sefurl($curVal, $mode)
 {
     if ($mode == 'read') {
         $plugin = $this->getController()->getModel()->get('link_owner');
         return $curVal;
         //  $this->linkFunctions[$curVal];
     }
     if ($mode == 'write') {
         $plugin = $this->getController()->getModel()->get('link_owner');
         $obj = e107::getAddon($plugin, 'e_url');
         $config = e107::callMethod($obj, 'config');
         $opts = array();
         if (empty($config)) {
             return $this->hidden('link_sefurl', '') . "<span class='label label-warning'>" . LAN_NOT_AVAILABLE . "</span>";
         }
         foreach ($config as $k => $v) {
             if (strpos($v['regex'], ')') === false) {
                 $opts[] = $k;
             }
         }
         return $this->select('link_sefurl', $opts, $curVal, array('useValues' => true, 'defaultValue' => '', 'default' => '(' . LAN_DISABLED . ')'));
     }
 }
Example #6
0
 /**
  * Check for Dynamic Function
  * @example class:method($parm)
  */
 protected function isDynamic($row)
 {
     if (varset($row['link_sub'])) {
         return $row['link_sub'];
     }
     if (vartrue($row['link_function'])) {
         $parm = false;
         list($path, $method) = explode("::", $row['link_function']);
         if (strpos($method, "(")) {
             list($method, $prm) = explode("(", $method);
             $parm = rtrim($prm, ")");
         }
         if (include_once e_PLUGIN . $path . "/e_sitelink.php") {
             $class = $path . "_sitelink";
             if ($sublinkArray = e107::callMethod($class, $method, $parm)) {
                 return $sublinkArray;
             }
         }
     }
     return array();
 }
Example #7
0
 public function __construct($content_type, $rss_type, $topic_id, $row)
 {
     // Constructor
     $sql_rs = new db();
     global $rssgen;
     $sql = e107::getDb();
     $pref = e107::getPref();
     $tp = e107::getParser();
     $this->e107 = e107::getInstance();
     $this->path = e_PLUGIN . "rss_menu/";
     $this->rssType = $rss_type;
     $this->topicid = $topic_id;
     $this->offset = $pref['time_offset'] * 3600;
     $this->limit = $row['rss_limit'];
     $this->contentType = $row['rss_name'];
     if (!is_numeric($content_type)) {
         $path = e_PLUGIN . $row['rss_path'] . '/e_rss.php';
     }
     if (strpos($row['rss_path'], '|') !== FALSE) {
         $tmp = explode("|", $row['rss_path']);
         $path = e_PLUGIN . $tmp[0] . "/e_rss.php";
         $this->parm = $tmp[1];
         // FIXME @Deprecated - use $parm['url'] instead in data() method within e_rss.php.  Parm is used in e_rss.php to define which feed you need to prepare
     }
     switch ($content_type) {
         case 'news':
         case 1:
             $path = e_PLUGIN . "news/e_rss.php";
             $this->contentType = "news";
             break;
         case 2:
             $path = '';
             $this->contentType = "articles";
             break;
         case 3:
             $path = '';
             $this->contentType = "reviews";
             break;
         case 4:
             $path = '';
             $this->contentType = "content";
             break;
         case 'comments':
             //TODO Eventually move to e107_plugins/comments
         //TODO Eventually move to e107_plugins/comments
         case 5:
             $path = '';
             $this->rssQuery = "SELECT * FROM `#comments` WHERE `comment_blocked` = 0 ORDER BY `comment_datestamp` DESC LIMIT 0," . $this->limit;
             $sql->gen($this->rssQuery);
             $tmp = $sql->db_getList();
             $this->rssItems = array();
             $loop = 0;
             foreach ($tmp as $value) {
                 $this->rssItems[$loop]['title'] = $value['comment_subject'];
                 $this->rssItems[$loop]['pubdate'] = $value['comment_datestamp'];
                 switch ($value['comment_type']) {
                     case 0:
                     case 'news':
                         $this->rssItems[$loop]['link'] = "http://" . $_SERVER['HTTP_HOST'] . e_HTTP . "comment.php?comment.news." . $value['comment_item_id'];
                         break;
                     case 2:
                     case 'download':
                         $this->rssItems[$loop]['link'] = "http://" . $_SERVER['HTTP_HOST'] . e_HTTP . "comment.php?comment.download." . $value['comment_item_id'];
                         break;
                     case 4:
                     case 'poll':
                         $this->rssItems[$loop]['link'] = "http://" . $_SERVER['HTTP_HOST'] . e_HTTP . "comment.php?comment.poll." . $value['comment_item_id'];
                         break;
                 }
                 $this->rssItems[$loop]['description'] = $value['comment_comment'];
                 $this->rssItems[$loop]['author'] = substr($value['comment_author'], strpos($value['comment_author'], ".") + 1);
                 $loop++;
             }
             break;
         case 6:
         case 7:
             $path = e_PLUGIN . "forum/e_rss.php";
             break;
         case 8:
             if (!$this->topicid) {
                 return FALSE;
             }
             $path = e_PLUGIN . "forum/e_rss.php";
             break;
             // case 10 was bugtracker
         // case 10 was bugtracker
         case 11:
             if (!$this->topicid) {
                 return FALSE;
             }
             $path = e_PLUGIN . "forum/e_rss.php";
             break;
         case 'download':
         case 12:
             $path = e_PLUGIN . "download/e_rss.php";
             break;
     }
     if (isset($path) && $path != '') {
         // New rss reader from e_rss.php in plugin folder
         if (is_readable($path)) {
             require_once $path;
             $className = basename(dirname($path)) . '_rss';
             // v2.x standard
             if ($data = e107::callMethod($className, 'data', array('url' => $content_type, 'id' => $this->topicid, 'limit' => $this->limit))) {
                 $eplug_rss_data = array(0 => $data);
                 unset($data);
             }
             foreach ($eplug_rss_data as $key => $rs) {
                 foreach ($rs as $k => $row) {
                     $this->rssItems[$k]['author'] = $row['author'];
                     $this->rssItems[$k]['author_email'] = $row['author_email'];
                     $this->rssItems[$k]['title'] = $row['title'];
                     if ($row['link']) {
                         if (stripos($row['link'], 'http') !== FALSE) {
                             $this->rssItems[$k]['link'] = $row['link'];
                         } else {
                             $this->rssItems[$k]['link'] = SITEURLBASE . e_PLUGIN_ABS . $row['link'];
                         }
                     }
                     $this->rssItems[$k]['description'] = $row['description'];
                     if ($row['enc_url']) {
                         $this->rssItems[$k]['enc_url'] = SITEURLBASE . e_PLUGIN_ABS . $row['enc_url'] . $row['item_id'];
                     }
                     if ($row['enc_leng']) {
                         $this->rssItems[$k]['enc_leng'] = $row['enc_leng'];
                     }
                     if (!empty($eplug_rss['enc_type'])) {
                         $this->rssItems[$k]['enc_type'] = $this->getmime($eplug_rss['enc_type']);
                     } elseif ($row['enc_type']) {
                         $this->rssItems[$k]['enc_type'] = $row['enc_type'];
                     }
                     $this->rssItems[$k]['category_name'] = $row['category_name'];
                     if ($row['category_link']) {
                         if (stripos($row['category_link'], 'http') !== FALSE) {
                             $this->rssItems[$k]['category_link'] = $row['category_link'];
                         } else {
                             $this->rssItems[$k]['category_link'] = SITEURLBASE . e_PLUGIN_ABS . $row['category_link'];
                         }
                     }
                     if (!empty($row['datestamp'])) {
                         $this->rssItems[$k]['pubdate'] = $row['datestamp'];
                     } else {
                         $this->rssItems[$k]['pubdate'] = time();
                     }
                     if ($row['custom']) {
                         $this->rssItems[$k]['custom'] = $row['custom'];
                     }
                     if ($row['media']) {
                         $this->rssItems[$k]['media'] = $row['media'];
                     }
                 }
             }
         }
     }
 }
Example #8
0
 /**
  * Handle a bounce report. 
  * @param string $bounceString - the string from header X-e107-id
  * @param string $emailAddress - optional email address string for checks
  * @return boolean - TRUE on success, FALSE on failure
  */
 public function markBounce($bounceString, $emailAddress = '')
 {
     $bounceString = trim($bounceString);
     $bounceInfo = array('mail_bounce_string' => $bounceString, 'mail_recipient_email' => $emailAddress);
     // Ready for event data
     $errors = array();
     // Log all errors, at least until proven
     $vals = explode('/', $bounceString);
     // Should get one or four fields
     if ($this->debugMode) {
         echo "<h4>Bounce String</h4>";
         print_a($bounceString);
         echo "<h4>Vals</h4>";
         print_a($vals);
     }
     if (!is_numeric($vals[0])) {
         $errors[] = 'Bad user ID: ' . $vals[0];
     }
     $uid = intval($vals[0]);
     // User ID (zero is valid)
     if (count($vals) == 4) {
         if (!is_numeric($vals[1])) {
             $errors[] = 'Bad body record: ' . $vals[1];
         }
         if (!is_numeric($vals[2])) {
             $errors[] = 'Bad recipient record: ' . $vals[2];
         }
         $vals[0] = intval($vals[0]);
         $vals[1] = intval($vals[1]);
         $vals[2] = intval($vals[2]);
         $vals[3] = trim($vals[3]);
         $hash = $vals[0] . '/' . $vals[1] . '/' . $vals[2] . '/';
         if (md5($hash) != $vals[3]) {
             $errors[] = 'Bad md5';
             $errors[] = print_r($vals, true);
             $errors[] = 'hash:' . md5($hash);
         }
         if (empty($errors)) {
             $this->checkDB(1);
             // Look up in mailer DB if no errors so far
             if (false === $this->db->gen("SELECT mr.`mail_recipient_id`, mr.`mail_recipient_email`, mr.`mail_recipient_name`, mr.mail_target_info, \n\t\t\t\t\tmc.mail_create_date, mc.mail_start_send, mc.mail_end_send, mc.`mail_title`, mc.`mail_subject`, mc.`mail_creator`, mc.`mail_other` FROM `#mail_recipients` AS mr \n\t\t\t\t\tLEFT JOIN `#mail_content` as mc ON mr.`mail_detail_id` = mc.`mail_source_id`\n\t\t\t\t\t\tWHERE mr.`mail_target_id` = {$vals[2]} AND mc.`mail_source_id` = {$vals[1]}")) {
                 // Invalid mailer record
                 $errors[] = 'Not found in DB: ' . $vals[1] . '/' . $vals[2];
             }
             $row = $this->db->fetch(MYSQL_ASSOC);
             $row = $this->dbToBoth($row);
             $bounceInfo = $row;
             if ($emailAddress && $emailAddress != $row['mail_recipient_email']) {
                 $errors[] = 'Email address mismatch: ' . $emailAddress . '/' . $row['mail_recipient_email'];
             }
             if ($uid != $row['mail_recipient_id']) {
                 $errors[] = 'User ID mismatch: ' . $uid . '/' . $row['mail_recipient_id'];
             }
             if (count($errors) == 0) {
                 $bounceInfo['mail_source_id'] = $vals[1];
                 $bounceInfo['mail_target_id'] = $vals[2];
                 $bounceInfo['mail_recipient_id'] = $uid;
                 $bounceInfo['mail_recipient_name'] = $row['mail_recipient_name'];
                 if (!$this->db->update('mail_content', '`mail_bounce_count` = `mail_bounce_count` + 1 WHERE `mail_source_id` = ' . $vals[1])) {
                     e107::getAdminLog()->add('Unable to increment bounce-count on mail_source_id=' . $vals[1], $bounceInfo, E_LOG_FATAL, 'BOUNCE', LOG_TO_ROLLING);
                 }
                 if (!$this->db->update('mail_recipients', '`mail_status` = ' . MAIL_STATUS_BOUNCED . ' WHERE `mail_target_id` = ' . $vals[2])) {
                     e107::getAdminLog()->add('Unable to update recipient mail_status to bounce on mail_target_id = ' . $vals[2], $bounceInfo, E_LOG_FATAL, 'BOUNCE', LOG_TO_ROLLING);
                 }
                 $addons = array_keys($row['mail_selectors']);
                 // trigger e_mailout.php addons. 'bounce' method.
                 foreach ($addons as $plug) {
                     if ($plug == 'core') {
                         require_once e_HANDLER . 'user_handler.php';
                         if ($err = userHandler::userStatusUpdate('bounce', $uid, $emailAddress)) {
                         }
                         $errors[] = $err;
                     } else {
                         if ($cls = e107::getAddon($plug, 'e_mailout')) {
                             if (e107::callMethod($cls, 'bounce', $bounceInfo) === false) {
                                 e107::getAdminLog()->add($plug . ' bounce process failed', $bounceInfo, E_LOG_FATAL, 'BOUNCE', LOG_TO_ROLLING);
                             }
                         }
                     }
                 }
             }
             //	echo e107::getMessage()->render();
             //	print_a($bounceInfo);
         }
     } elseif (count($vals) != 1 && count($vals) != 4) {
         $errors[] = 'Bad element count: ' . count($vals);
     } elseif (!empty($uid) || !empty($emailAddress)) {
         // require_once(e_HANDLER.'user_handler.php');
         $err = e107::getUserSession()->userStatusUpdate('bounce', $uid, $emailAddress);
         if ($err) {
             $errors[] = $err;
         }
     }
     if (!empty($errors)) {
         $logErrors = $bounceInfo;
         $logErrors['user_id'] = $uid;
         $logErrors['mailshot'] = $vals[1];
         $logErrors['mailshot_recipient'] = $vals[2];
         $logErrors['errors'] = $errors;
         $logErrors['email'] = $emailAddress;
         $logErrors['bounceString'] = $bounceString;
         $logString = $bounceString . ' (' . $emailAddress . ')[!br!]' . implode('[!br!]', $errors) . implode('[!br!]', $bounceInfo);
         //	e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce receive error',$logString, FALSE,LOG_TO_ROLLING);
         e107::getAdminLog()->add('Bounce receive error', $logErrors, E_LOG_WARNING, 'BOUNCE', LOG_TO_ROLLING);
         return $errors;
     } else {
         //	e107::getAdminLog()->e_log_event(10,-1,'BOUNCE','Bounce received/logged',$bounceInfo, FALSE,LOG_TO_ROLLING);
         e107::getAdminLog()->add('Bounce received/logged', $bounceInfo, E_LOG_INFORMATIVE, 'BOUNCE', LOG_TO_ROLLING);
     }
     e107::getEvent()->trigger('mailbounce', $bounceInfo);
     return false;
 }
Example #9
0
 /**
  * This one will be greatly extended, allowing menus to offer UI and us 
  * settings per instance later ($parm variable available for menus - same as shortcode's $parm)
  */
 function menuInstanceParameters()
 {
     if (!vartrue($_GET['parmsId'])) {
         return;
     }
     $id = intval($_GET['parmsId']);
     $frm = e107::getForm();
     $sql = e107::getDb();
     if (!$sql->select("menus", "*", "menu_id=" . $id)) {
         $this->menuAddMessage("Couldn't Load Menu", E_MESSAGE_ERROR);
         return;
     }
     $row = $sql->fetch();
     $text = "<div style='text-align:center;'>\n\t\t<form  id='e-save-form' method='post' action='" . e_SELF . "?lay=" . $this->curLayout . "'>\n        <fieldset id='core-menus-parametersform'>\n\t\t<legend>" . MENLAN_44 . " " . $row['menu_name'] . "</legend>\n        <table class='table '>\n        <colgroup>\n            <col class='col-label' />\n            <col class='col-control' />\n        </colgroup>\n\n\t\t";
     if (file_exists(e_PLUGIN . $row['menu_path'] . "e_menu.php")) {
         $plug = rtrim($row['menu_path'], '/');
         $obj = e107::getAddon($plug, 'e_menu');
         if (!is_object($obj)) {
             $text .= "<tr><td colspan='2' class='alert alert-danger'>{$plug} object not found. Try re-scanning plugin directories in Tools > Database. </td></tr>";
         } else {
             $menuName = substr($row['menu_name'], 0, -5);
         }
         $fields = e107::callMethod($obj, 'config', $menuName);
         if (!($form = e107::getAddon($plug, 'e_menu', $plug . "_menu_form"))) {
             $form = $frm;
         }
         $value = e107::unserialize($row['menu_parms']);
         if (!empty($fields)) {
             foreach ($fields as $k => $v) {
                 $text .= "<tr><td class='text-left'>" . $v['title'] . "</td>";
                 $v['writeParms']['class'] = 'e-save';
                 $i = $k;
                 if (!empty($v['multilan'])) {
                     $i = $k . '[' . e_LANGUAGE . ']';
                     if (isset($value[$k][e_LANGUAGE])) {
                         $value[$k] = varset($value[$k][e_LANGUAGE], '');
                     }
                 }
                 $text .= "<td class='text-left'>" . $form->renderElement($i, $value[$k], $v) . "</td></tr>";
             }
         } else {
             $text .= "<tr><td colspan='2' class='alert alert-danger'>No Fields Set in " . $row['menu_path'] . "e_menu.php</td></tr>";
         }
     } else {
         $text .= "<tr>\n\t\t\t<td>\n\t\t\t" . MENLAN_45 . "</td>\n\t\t\t<td>\n\t\t\t" . $frm->text('menu_parms', $row['menu_parms'], 900, 'class=e-save&size=xxlarge') . "\n\t\t\t</td>\n\t\t\t</tr>";
     }
     $text .= "</table>";
     /*
     		
     			$text .= "
     			<div class='buttons-bar center'>";
     			$text .= $frm->admin_button('parms_submit', LAN_SAVE, 'update');
     			$text .= "<input type='hidden' name='menu_id' value='".$id."' />
     			</div>";
     */
     $text .= $frm->hidden('mode', 'parms');
     $text .= $frm->hidden('menu_id', $id);
     $text .= "\n\t\t</fieldset>\n\t\t</form>\n\t\t</div>";
     return $text;
 }