/** * Compile RSS Data * @param $parms array url, limit, id * @return array */ function data($parms = '') { $sql = e107::getDb(); $rss = array(); $i = 0; if ($items = $sql->select('chatbox', "*", "cb_blocked=0 ORDER BY cb_datestamp DESC LIMIT 0," . $parms['limit'])) { while ($row = $sql->fetch()) { $tmp = explode(".", $row['cb_nick']); $rss[$i]['author'] = $tmp[1]; $rss[$i]['author_email'] = ''; $rss[$i]['link'] = "chatbox_menu/chat.php?" . $row['cb_id']; $rss[$i]['linkid'] = $row['cb_id']; $rss[$i]['title'] = ''; $rss[$i]['description'] = $row['cb_message']; $rss[$i]['category_name'] = ''; $rss[$i]['category_link'] = ''; $rss[$i]['datestamp'] = $row['cb_datestamp']; $rss[$i]['enc_url'] = ""; $rss[$i]['enc_leng'] = ""; $rss[$i]['enc_type'] = ""; $i++; } } return $rss; }
/** * For inserting default database content during install after table has been created by the test_sql.php file. */ function install_post($var) { $sql = e107::getDb(); $mes = e107::getMessage(); /* $e107_test = array( 'test_id' =>'1', 'test_icon' =>'{e_PLUGIN}test/images/test_32.png', 'test_type' =>'type_1', 'test_name' =>'My Name', 'test_folder' =>'Folder Value', 'test_version' =>'1', 'test_author' =>'bill', 'test_authorURL' =>'http://e107.org', 'test_date' =>'1352871240', 'test_compatibility' =>'2', 'test_url' =>'http://e107.org' ); if($sql->insert('test',$e107_test)) { $mes->add("Custom - Install Message.", E_MESSAGE_SUCCESS); } else { $mes->add("Custom - Failed to add default table data.", E_MESSAGE_ERROR); }*/ }
function unanswered() { $sql = e107::getDb(); $tp = e107::getParser(); $limit = 25; $count = $sql->retrieve('faqs', 'faq_id', "faq_answer='' ", true); $existing = $sql->retrieve('faqs', 'faq_id,faq_question,faq_datestamp', "faq_answer='' ORDER BY faq_datestamp DESC LIMIT " . $limit, true); if (empty($existing)) { return; } $questions = array(); foreach ($existing as $row) { $questions[] = "<i>" . $row['faq_question'] . "</i><br /><small>" . $tp->toDate($row['faq_datestamp'], 'short') . "</small>\n"; // $questions[] = $row['faq_question']; } // // $questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>"); $name = SITENAME . " Automation"; $email = e107::pref('core', 'siteadminemail'); $name = e107::pref('core', 'siteadmin'); $link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full'); $body = "<h2>" . count($count) . " Unuanswered Questions at " . SITENAME . "</h2>To answer these questions, please login to " . SITENAME . " and then <a href='{$link}'>click here</a>.<br />\n\t\t\tThe " . $limit . " most recent questions are displayed below.\n\t\t\t<ul><li>" . implode("</li><li>", $questions) . "</li></ul>"; $eml = array('subject' => count($count) . " Unuanswered Question as of " . date('d-M-Y') . " ", 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $body); e107::getEmail()->sendEmail($email, $name, $eml); }
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; } } } } } } }
function sc_oneliner($parm = '') { $sql = e107::getDb(); $icon = $this->var['current']['icon']; $oneliners = $sql->retrieve('forecasty_oneliners', '*', "`condition`='" . $icon . "' AND `vulgarity`='" . e107::pref('forecasty', 'vulgarity') . "'", true); return $oneliners[array_rand($oneliners)]['line']; }
/** * @DEPRECATED * Use e107::getParser()->parseTemplate("{USER_AVATAR=".$avatar."}",true); instead. */ function avatar($avatar) { return e107::getParser()->parseTemplate("{USER_AVATAR=" . $avatar . "}", true); /* global $tp; if (stristr($avatar, '-upload-') !== false) { return e_AVATAR_UPLOAD.str_replace('-upload-', '', $avatar); } elseif (stristr($avatar, 'Binary') !== false) { $sqla = new db; preg_match("/Binary\s(.*?)\//", $avatar, $result); $sqla->db_Select('rbinary', '*', "binary_id='".$tp->toDB($result[1])."' "); $row = $sqla->db_Fetch(); return $row['binary_data']; } elseif (strpos($avatar, 'http://') === false) { return SITEURLBASE.e_IMAGE_ABS."avatars/".$avatar; } else { return $avatar; } */ }
function forum_post_rep($data) { $e107 = e107::getInstance(); include_lan(e_PLUGIN . 'forum/languages/' . e_LANGUAGE . '/lan_forum_notify.php'); $message = 'todo'; $e107->notify->send('forum_post_rep', FORUM_NT_9, $message); }
function e_linkwords() { global $pref, $admin_log; /* constructor */ // Do an auto-update on the variable used to hook parsers - so we should only be called once e107::lan('linkwords', e_LANGUAGE); // e_PLUGIN."linkwords/languages/".e_LANGUAGE.".php" $hooks = explode(",", $pref['tohtml_hook']); if (($key = array_search('linkwords', $hooks)) !== FALSE) { unset($hooks[$key]); } if (count($hooks) == 0) { unset($pref['tohtml_hook']); } else { $pref['tohtml_hook'] = implode(',', $hooks); } if (!isset($pref['e_tohtml_list'])) { $pref['e_tohtml_list'] = array(); } if (!in_array('linkwords', $pref['e_tohtml_list'])) { $pref['e_tohtml_list'][] = 'linkwords'; } save_prefs(); e107::getLog()->add('LINKWD_05', LWLAN_58 . '[!br!]' . $pref['tohtml_hook'], ''); // Log that the update was done return; }
function iconpicker_shortcode($parm) { $parms = array(); parse_str($parm, $parms); $name = varset($parms['id']); $sql = e107::getDb(); $frm = e107::getForm(); $tp = e107::getParser(); // $sc_parameters is currently being used to select the media-category. $qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") "; $qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' "; $qry .= "ORDER BY media_category,media_name"; $str = ""; $size_section = array(); $lastsize = "16"; if ($sql->db_Select_gen($qry)) { while ($row = $sql->db_Fetch()) { list($tmp, $tmp2, $size) = explode("_", $row['media_category']); if ($str != '' && $size != $lastsize) { $size_section[] = $str; $str = ""; } $str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>"; $lastsize = $size; } return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>'; } }
function user_avatar_shortcode($parm = '') { global $loop_uid; $height = e107::getPref("im_height"); $width = e107::getPref("im_width"); $tp = e107::getParser(); if (intval($loop_uid) > 0 && trim($parm) == "") { $parm = $loop_uid; } if (is_numeric($parm)) { if ($parm == USERID) { $image = USERIMAGE; } else { $row = get_user_data(intval($parm)); $image = $row['user_image']; } } elseif ($parm) { $image = $parm; } elseif (USERIMAGE) { $image = USERIMAGE; } else { $image = ""; } if (vartrue($image)) { $img = strpos($image, "://") !== false ? $image : $tp->thumbUrl(e_MEDIA . "avatars/" . $image, "aw=" . $width . "&ah=" . $height); $text = "<img class='user-avatar e-tip' src='" . $img . "' alt='' style='width:" . $width . "px; height:" . $height . "px' />\n\t\t"; } else { $img = $tp->thumbUrl(e_IMAGE . "generic/blank_avatar.jpg", "aw=" . $width . "&ah=" . $height); $text = "<img class='user-avatar' src='" . $img . "' alt='' />"; } return $text; }
function getListData() { $sql = e107::getDb(); $list_caption = $this->parent->settings['caption']; $list_display = $this->parent->settings['open'] ? "" : "none"; $qry = ''; if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") { $qry = "user_join>" . $this->parent->getlvisit() . " AND "; } $qry .= " user_ban=0 ORDER BY user_join DESC LIMIT 0," . intval($this->parent->settings['amount']); $bullet = $this->parent->getBullet($this->parent->settings['icon']); if (!$this->parent->e107->sql->gen("SELECT user_id,user_name,user_join FROM #user WHERE " . $qry)) { $list_data = LIST_MEMBER_2; } else { while ($row = $this->parent->e107->sql->fetch()) { $record = array(); $rowheading = $this->parent->parse_heading($row['user_name']); //<a href='".e_BASE."user.php?id.".$row['user_id']."'>".$rowheading."</a> $uparams = array('id' => $row['user_id'], 'name' => $rowheading); $link = e107::getUrl()->create('user/profile/view', $uparams); $userlink = "<a href='" . $link . "'>" . $rowheading . "</a>"; $record['icon'] = $bullet; $record['heading'] = USER ? $userlink : $rowheading; $record['category'] = ''; $record['author'] = ''; $record['date'] = vartrue($this->parent->settings['date']) ? $this->parent->getListDate($row['user_join']) : ""; $record['info'] = ''; $list_data[] = $record; } } //return array with 'records', (global)'caption', 'display' return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display); }
public function showForm($mes) { $ns = e107::getRender(); $frm = new form(); $text = $frm->form_open('post', e_SELF); $text .= "<table class='table adminform'>"; $text .= "<tr><td>" . LAN_RADIUS_01 . "</td><td>"; $text .= $frm->form_text('radius_server', 35, vartrue($this->radius['radius_server']), 120); $text .= "</td></tr>\n"; $text .= "<tr><td>" . LAN_RADIUS_02 . "</td><td>"; $text .= $frm->form_text('radius_secret', 35, vartrue($this->radius['radius_secret']), 200); $text .= "</td></tr>\n"; $tmp = $this->alt_auth_get_field_list('radius', $frm, $this->radius, FALSE); if ($tmp) { $text .= "<tr><td class='forumheader2' colspan='2'>" . LAN_ALT_27 . "</td></tr>\n" . $tmp; unset($tmp); } $text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>"; // $text .= $frm -> form_button("submit", "update", LAN_ALT_2); $text .= e107::getForm()->admin_button('update', LAN_UPDATE, 'update'); $text .= "</td></tr>\n"; $text .= "</table>\n"; $text .= $frm->form_close(); $ns->tablerender(LAN_RADIUS_06, $mes->render() . $text); $ns->tablerender(LAN_ALT_40 . LAN_ALT_41, $this->alt_auth_test_form('radius', $frm)); }
/** * Render menu. */ function renderMenu() { $tpl = e107::getTemplate('nodejs_comment'); $sc = e107::getScBatch('nodejs_comment', true); $tp = e107::getParser(); $cm = e107::getComment(); $amount = (int) vartrue($this->plugPrefs['comment_display'], 10); /** * getCommentData() returns with array, which contains: * - comment_datestamp * - comment_author_id * - comment_author * - comment_comment * - comment_subject * - comment_type * - comment_title * - comment_url */ $items = $cm->getCommentData($amount); $text = $tp->parseTemplate($tpl['MENU']['LATEST']['HEADER'], true, $sc); foreach ($items as $item) { $sc->setVars($item); $text .= $tp->parseTemplate($tpl['MENU']['LATEST']['ITEM'], true, $sc); } if (empty($items)) { $text .= '<a href="#" class="list-group-item no-posts text-center">' . LAN_PLUGIN_NODEJS_COMMENT_FRONT_05 . '</a>'; } $text .= $tp->parseTemplate($tpl['MENU']['LATEST']['FOOTER'], true, $sc); e107::getRender()->tablerender(LAN_PLUGIN_NODEJS_COMMENT_FRONT_04, $text); unset($text); }
function install_post($var) { e107::includeLan(e_PLUGIN . 'featurebox/languages/' . e_LANGUAGE . '_admin_featurebox.php'); $mes = e107::getMessage(); $query = array(); $query['fb_category_id'] = 0; $query['fb_category_title'] = 'General'; $query['fb_category_template'] = 'default'; $query['fb_category_random'] = 0; $query['fb_category_class'] = e_UC_PUBLIC; $query['fb_category_limit'] = 1; $inserted = e107::getDb()->db_Insert('featurebox_category', $query); $status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $mes->add(FBLAN_INSTALL_01, $status); if ($inserted) { $query = array(); $query['fb_id'] = 0; $query['fb_category'] = $inserted; $query['fb_title'] = 'Default Title'; $query['fb_text'] = 'Default Message'; $query['fb_mode'] = 0; $query['fb_class'] = e_UC_PUBLIC; $query['fb_rendertype'] = 0; $query['fb_template'] = 'default'; $query['fb_order'] = 0; $query['fb_image'] = ''; $query['fb_imageurl'] = ''; $status = e107::getDb('sql2')->db_Insert('featurebox', $query) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; } else { $status = E_MESSAGE_ERROR; } $mes->add(FBLAN_INSTALL_02, $status); }
function getListData() { $sql = e107::getDb(); $tp = e107::getParser(); $list_caption = $this->parent->settings['caption']; $list_display = $this->parent->settings['open'] ? "" : "none"; if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") { $lvisit = $this->parent->getlvisit(); $qry = "cb_datestamp>" . $lvisit; } else { $qry = "cb_id != '0' "; } $qry .= " ORDER BY cb_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']); $bullet = $this->parent->getBullet($this->parent->settings['icon']); if (!($chatbox_posts = $this->parent->e107->sql->gen("SELECT * FROM #chatbox WHERE " . $qry))) { $list_data = LIST_CHATBOX_2; } else { while ($row = $this->parent->e107->sql->fetch()) { $cb_id = substr($row['cb_nick'], 0, strpos($row['cb_nick'], ".")); $cb_nick = substr($row['cb_nick'], strpos($row['cb_nick'], ".") + 1); $cb_message = $row['cb_blocked'] ? CHATBOX_L6 : str_replace("<br />", " ", $tp->toHTML($row['cb_message'])); $rowheading = $this->parent->parse_heading($cb_message); $record['icon'] = $bullet; $record['heading'] = $rowheading; $record['author'] = $this->parent->settings['author'] ? $cb_id != 0 ? "<a href='" . e_BASE . "user.php?id.{$cb_id}'>" . $cb_nick . "</a>" : $cb_nick : ""; $record['category'] = ""; $record['date'] = $this->parent->settings['date'] ? $row['cb_datestamp'] ? $this->parent->getListDate($row['cb_datestamp']) : "" : ""; $record['info'] = ""; $list_data[] = $record; } } //return array with 'records', (global)'caption', 'display' return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display); }
function colorizeLine($line) { $starPlayers = e107::getDb()->retrieve('starPlayers', '*', '', true); $words = explode(" ", $line); if (!empty($starPlayers[0])) { foreach ($starPlayers as $player) { $usernames = explode(',', $player['usernames']); $colorIt = false; foreach ($usernames as $username) { if (strpos($words[0], $username) !== false) { $colorIt = true; } } if ($colorIt) { $newLine = '<span style="color:' . $player['hexcolor'] . ';">' . $line . '</span>'; break; } else { $newLine = $line; } } $output = $newLine; } else { $output = $line; } return $output; }
function adnav_main($cat_title, $cat_link, $cat_img, $cat_id = FALSE, $params, $cat_open = FALSE) { $tp = e107::getParser(); $cat_link = strpos($cat_link, '://') === FALSE ? e_HTTP . $cat_link : $cat_link; $cat_link = $tp->replaceConstants($cat_link, TRUE, TRUE); if ($cat_open == 4 || $cat_open == 5) { $dimen = $cat_open == 4 ? "600,400" : "800,600"; $href = " href=\"javascript:open_window('" . $cat_link . "'," . $dimen . ")\""; } else { $href = "href='" . $cat_link . "'"; } $text = "<a class='menuItem' " . $href . " "; if ($cat_id) { if (isset($params[2]) && $params[2] == 'link') { $text .= "onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\""; } else { $text .= "onclick=\"return false;\" onmouseover=\"menuItemMouseover(event, '" . $cat_id . "');\""; } } if ($cat_open == 1) { $text .= " rel='external' "; } $text .= ">"; if ($cat_img != 'no_icons') { $text .= "<span class='menuItemBuffer'>" . $cat_img . "</span>"; } $text .= "<span class='menuItemText'>" . $tp->toHTML($cat_title, "", "defs, no_hook") . "</span>"; if ($cat_id) { $text .= "<span class=\"menuItemArrow\">▶</span>"; } $text .= "</a>"; return $text; }
function sc_fpw_submit($parm = '') { // return '<button type="submit" name="pwsubmit" class="button btn btn-primary btn-block reset">'.$label.'</button>'; // return "<input class='button btn btn-primary btn-block' type='submit' name='pwsubmit' value='".$label."' />"; $label = deftrue('LAN_FPW_102', LAN_156); return e107::getForm()->button('pwsubmit', $label); }
function loadJSAddons() { if (e_PAGE == 'menus.php' && vartrue($_GET['configure'])) { return; } // e107::js('core', 'bootstrap/js/bootstrap-modal.js', 'jquery', 2); // Special Version see: https://github.com/twitter/bootstrap/pull/4224 e107::css('core', 'bootstrap-select/bootstrap-select.min.css', 'jquery'); e107::js('core', 'bootstrap-select/bootstrap-select.min.js', 'jquery', 2); e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery'); e107::js('core', 'bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2); // TODO: remove typeahead. e107::js('core', 'bootstrap-jasny/js/jasny-bootstrap.js', 'jquery', 2); e107::css('core', 'bootstrap-datetimepicker/css/datetimepicker.css', 'jquery'); e107::js('core', 'bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js', 'jquery', 2); e107::js('core', 'jquery.h5validate.min.js', 'jquery', 2); e107::js('core', 'jquery.elastic.js', 'jquery', 2); e107::js('core', 'jquery.at.caret.min.js', 'jquery', 2); // e107::js('core', 'jquery-ui-timepicker-addon.js', 'jquery', 2); //e107::css('core', 'chosen/chosen.css', 'jquery'); //e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2); // e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2); // loaded in form-handler. // e107::css('core', 'bootstrap-tag/bootstrap-tag.css', 'jquery'); // e107::js('core', 'bootstrap-tag/bootstrap-tag.js', 'jquery', 2); // e107::js("core", "tags/jquery.tagit.js","jquery",3); // e107::css('core', 'tags/jquery.tagit.css', 'jquery'); e107::css('core', 'core/admin.jquery.css', 'jquery'); e107::js("core", "core/admin.jquery.js", "jquery", 4); // Load all default functions. e107::css('core', 'core/all.jquery.css', 'jquery'); e107::js("core", "core/all.jquery.js", "jquery", 4); // Load all default functions. }
public function renderBanner($row) { $sql = e107::getDb('banner'); $tp = e107::getParser(); if (!$row['banner_image']) { return "<a href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external'>no image assigned to this banner</a>"; } $fileext1 = substr(strrchr($row['banner_image'], '.'), 1); $sql->update('banner', 'banner_impressions=banner_impressions+1 WHERE banner_id=' . (int) $row['banner_id']); switch ($fileext1) { case 'swf': return "\n\t\t\t\t\t<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"468\" height=\"60\">\n\n\t\t\t\t\t<param name=\"movie\" value=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\">\n\n\t\t\t\t\t<param name=\"quality\" value=\"high\">\n\n\t\t\t\t\t<param name=\"SCALE\" value=\"noborder\">\n\n\t\t\t\t\t<embed src=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\" width=\"468\" height=\"60\" scale=\"noborder\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>\n\t\t\t\t\t</object>\n\t\t\t\t\t"; break; case 'html': case 'js': case 'php': // Code - may 'echo' text, or may return it as a value $file_data = file_get_contents(e_IMAGE . 'banners/' . $row['banner_image']); return $file_data; break; default: $src = $row['banner_image'][0] == '{' ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS . 'banners/' . $row['banner_image']; $ban_ret = "<img class='e-banner img-responsive' src='" . $src . "' alt='" . $row['banner_clickurl'] . "' style='border:0' />"; break; } return "<a class='e-tip' href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external' title=\"" . $tp->toAttribute($row['banner_description']) . "\">" . $ban_ret . '</a>'; }
public function __construct($override = FALSE) { global $pref; $this->e107 = e107::getInstance(); if ($override === FALSE || !is_array($override)) { // Set up from prefs $override['mail_bounce_user'] = $pref['mail_bounce_user']; $override['mail_bounce_pass'] = $pref['mail_bounce_pass']; $override['mail_bounce_email'] = $pref['mail_bounce_email']; $override['mail_bounce_pop3'] = $pref['mail_bounce_pop3']; $override['mail_bounce_type'] = varset($pref['mail_bounce_type'], 'pop3'); } if ($override['mail_bounce_type'] == 'imap') { $port = varset($override['mail_bounce_port'], '143'); $strConnect = '{' . $override['mail_bounce_pop3'] . ':' . $port . '}INBOX'; } else { $port = varset($override['mail_bounce_port'], '110'); // POP3 port $servertype = '/' . varset($override['mail_bounce_type'], 'pop3'); $strConnect = '{' . $override['mail_bounce_pop3'] . ':' . $port . $servertype . '}INBOX'; } $this->server = $strConnect; $this->username = $override['mail_bounce_user']; $this->password = $override['mail_bounce_pass']; $this->email = $override['mail_bounce_email']; $this->delBounce = $pref['mail_bounce_delete'] ? true : false; }
/** * Read configuration, initialise connection to LDAP database * * @return AUTH_xxxx result code */ public function auth_login() { $this->copyAttribs = array(); $this->copyMethods = array(); $sql = e107::getDB('altAuth'); $sql->db_Select('alt_auth', '*', "auth_type = 'ldap' "); while ($row = $sql->db_Fetch()) { $ldap[$row['auth_parmname']] = base64_decode(base64_decode($row['auth_parmval'])); if (strpos($row['auth_parmname'], 'ldap_xf_') === 0 && $ldap[$row['auth_parmname']]) { $this->copyAttribs[substr($row['auth_parmname'], strlen('ldap_xf_'))] = $ldap[$row['auth_parmname']]; // Key = LDAP attribute. Value = e107 field name } elseif (strpos($row['auth_parmname'], 'ldap_pm_') === 0 && $ldap[$row['auth_parmname']] && $ldap[$row['auth_parmname']] != 'none') { // Any fields with non-null 'copy' methods $this->copyMethods[substr($row['auth_parmname'], strlen('ldap_pm_'))] = $ldap[$row['auth_parmname']]; // Key = e107 field name. Value = copy method } unset($row['auth_parmname']); } $this->server = explode(',', $ldap['ldap_server']); $this->serverType = $ldap['ldap_servertype']; $this->dn = $ldap['ldap_basedn']; $this->ou = $ldap['ldap_ou']; $this->usr = $ldap['ldap_user']; $this->pwd = $ldap['ldap_passwd']; $this->ldapVersion = $ldap['ldap_version']; $this->filter = isset($ldap['ldap_edirfilter']) ? $ldap['ldap_edirfilter'] : ""; if (!function_exists('ldap_connect')) { return AUTH_NORESOURCE; } if (!$this->connect()) { return AUTH_NOCONNECT; } $this->Available = TRUE; return AUTH_SUCCESS; }
/** * Admin callback * Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page) */ public function admin() { // static may be used for performance e107::plugLan('tagwords'); static $admin = array('labels' => array('name' => LAN_TAG_URL_NAME, 'label' => LAN_TAG_URL_DEFAULT_LABEL, 'description' => LAN_TAG_URL_DEFAULT_DESCR), 'form' => array(), 'callbacks' => array()); return $admin; }
function getHookImages($hook, $count) { $sql = e107::getDb(); $pref = e107::pref('imggregator'); $count = isset($count) ? $count : $pref['imagesToFetch']; $tokens = explode(';', $sql->retrieve('hooks', 'hook_tokens', 'hook_name="' . $hook . '"')); if ($hook == 'instagram') { $user_id = explode(':', $tokens[0]); $access_token = explode(':', $tokens[1]); $url = fetchData('https://api.instagram.com/v1/users/' . $user_id[1] . '/media/recent/?access_token=' . $access_token[1] . '&count=' . $count); $result = json_decode($url); $i = 0; foreach ($result->data as $image) { copy($image->images->standard_resolution->url, 'images/instagram' . $i . '.jpg'); $i++; //$images[] = $image->images->standard_resolution->url; } } else { if ($hook == 'flickr') { $user_id = explode(':', $tokens[0]); $api_key = explode(':', $tokens[1]); $xml = simplexml_load_file('https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=' . $api_key[1] . '&user_id=' . urlencode($user_id[1]) . '&format=rest'); $i = 0; foreach ($xml->photos->photo as $photo) { if ($photo['ispublic'] == 1) { copy('https://farm' . $photo['farm'] . '.staticflickr.com/' . $photo['server'] . '/' . $photo['id'] . '_' . $photo['secret'] . '.jpg', 'images/flickr' . $i . '.jpg'); $i++; //$images[] .= 'https://farm'.$photo['farm'].'.staticflickr.com/'.$photo['server'].'/'.$photo['id'].'_'.$photo['secret'].'.jpg'; } } } } return $images; }
/** * Configuration Fields. * @return array */ public function config($menu = '') { $fields = array(); $categories = array(); $tmp = e107::getDb()->retrieve('news_category', 'category_id,category_name', null, true); foreach ($tmp as $val) { $id = $val['category_id']; $categories[$id] = $val['category_name']; } switch ($menu) { case "latestnews": $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge')); $fields['count'] = array('title' => LAN_LIMIT, 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*', 'size' => 'mini')); $fields['category'] = array('title' => LAN_CATEGORY, 'type' => 'dropdown', 'writeParms' => array('optArray' => $categories, 'default' => 'blank')); break; case "news_categories": $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge')); $fields['count'] = array('title' => LAN_LIMIT, 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*')); break; case "news_months": $fields['showarchive'] = array('title' => "Display Archive Link", 'type' => 'boolean'); $fields['year'] = array('title' => "Year", 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*', 'size' => 'mini')); break; case "other_news": case "other_news2": $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge')); break; } return $fields; }
function forum_thread_moderate($p) { $e107 = e107::getInstance(); $sql = e107::getDb(); foreach ($p as $key => $val) { if (preg_match("#(.*?)_(\\d+)_x#", $key, $matches)) { $act = $matches[1]; $id = (int) $matches[2]; switch ($act) { case 'lock': $sql->update('forum_thread', 'thread_active=0 WHERE thread_id=' . $id); return LAN_FORUM_CLOSE; break; case 'unlock': $sql->update('forum_thread', 'thread_active=1 WHERE thread_id=' . $id); return LAN_FORUM_OPEN; break; case 'stick': $sql->update('forum_thread', 'thread_sticky=1 WHERE thread_id=' . $id); return LAN_FORUM_STICK; break; case 'unstick': $sql->update('forum_thread', 'thread_sticky=0 WHERE thread_id=' . $id); return LAN_FORUM_UNSTICK; break; case 'deleteThread': return forumDeleteThread($id); break; case 'deletePost': return forumDeletePost($id); break; } } } }
function invalidURL() { $mes = e107::getMessage(); $mes->addWarning("Invalid URL"); echo "<div class='container'>" . $mes->render() . "</div>"; return; }
function plugin_shortcode($parm = '') { $tp = e107::getParser(); @(list($menu, $parms) = explode('|', $parm . '|', 2)); $path = $tp->toDB(dirname($menu)); $name = $tp->toDB(basename($menu)); //BC Fix for v2.x $changeMenuPaths = array(array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'siteinfo_menu', 'newpath' => 'siteinfo', 'menu' => 'latestnews_menu'), array('oldpath' => 'compliance_menu', 'newpath' => 'siteinfo', 'menu' => 'compliance_menu'), array('oldpath' => 'powered_by_menu', 'newpath' => 'siteinfo', 'menu' => 'powered_by_menu'), array('oldpath' => 'sitebutton_menu', 'newpath' => 'siteinfo', 'menu' => 'sitebutton_menu'), array('oldpath' => 'counter_menu', 'newpath' => 'siteinfo', 'menu' => 'counter_menu'), array('oldpath' => 'usertheme_menu', 'newpath' => 'user_menu', 'menu' => 'usertheme_menu'), array('oldpath' => 'userlanguage_menu', 'newpath' => 'user_menu', 'menu' => 'userlanguage_menu'), array('oldpath' => 'lastseen_menu', 'newpath' => 'online', 'menu' => 'lastseen_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news_menu'), array('oldpath' => 'other_news_menu', 'newpath' => 'news', 'menu' => 'other_news2_menu')); foreach ($changeMenuPaths as $k => $v) { if ($v['oldpath'] == $path && $v['menu'] == $name) { $path = $v['newpath']; continue; } } if ($path == '.') { $path = $menu; } /** * @todo check if plugin is installed when installation required */ /** * fixed todo: $mode is provided by the menu itself, return is always true, added optional menu parameters */ return e107::getMenu()->renderMenu($path, $name, trim($parms, '|'), true); }
function setstyle_shortcode($parm) { global $style; // BC $style = $parm; // BC e107::getRender()->setStyle($parm); }
function config() { $var[0]['caption'] = "Sample configuration field"; $var[0]['html'] = "<input type='text' name='_blank_example' value='" . e107::getThemePref('example', 'default') . "' />"; $var[1]['caption'] = "Featurebox Tab Category - number of items per tab"; $var[1]['html'] = "<input type='text' name='fb_tabs_cols' value='" . e107::getThemePref('fb_tabs_cols', 1) . "' />"; return $var; }