Example #1
0
 /**
  * chapter/index and book/index by name callback
  * @param eRequest $request
  */
 public function chapterIdByTitle(eRequest $request)
 {
     $name = $request->getRequestParam('name');
     if ($id = $request->getRequestParam('id')) {
         $request->setRequestParam('name', $id);
         return;
     } elseif (!$name || is_numeric($name)) {
         if (ADMIN) {
             e107::getMessage()->addError("One of your page-chapters is missing a SEF URL value");
         }
         return;
     }
     $sql = e107::getDb('url');
     $name = e107::getParser()->toDB($name);
     if ($sql->select('page_chapters', 'chapter_id', "chapter_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['chapter_id']);
         $request->setRequestParam('type', 'bk');
         e107::getMessage()->addDebug("Set CHAPTER ID =  '" . $name['chapter_id'] . "'");
     } elseif ($sql->select('page', 'page_id', "page_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['page_id']);
         $request->setRequestParam('type', 'id');
         e107::getMessage()->addDebug("Set PAGE ID =  '" . $name['page_id'] . "'");
     } else {
         if (ADMIN) {
             e107::getMessage()->addError("Couldn't find a book, chapter or page with a SEF URL value of '" . $name . "'");
         }
         $request->setRequestParam('id', 0);
     }
 }
Example #2
0
 function sc_newscomments($parm = null)
 {
     $pref = e107::getPref();
     $sql = e107::getDb();
     if ($this->commentsDisabled || $this->commentsEngine != 'e107') {
         return '';
     }
     $news_item = $this->news_item;
     $param = $this->param;
     if ($param['current_action'] == 'extend') {
         return LAN_NEWS_99 . ' (' . $news_item['news_comment_total'] . ')';
     }
     if (vartrue($pref['multilanguage'])) {
         // Can have multilanguage news table, monlingual comment table. If the comment table is multilingual, it'll only count entries in the current language
         $news_item['news_comment_total'] = $sql->count("comments", "(*)", "WHERE comment_item_id='" . $news_item['news_id'] . "' AND comment_type='0' ");
     }
     //XXX - ??? - another query? We should cache it in news table.
     if ($pref['comments_icon'] && $news_item['news_comment_total']) {
         $sql->select('comments', 'comment_datestamp', "comment_item_id='" . intval($news_item['news_id']) . "' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1");
         list($comments['comment_datestamp']) = $sql->fetch();
         $latest_comment = $comments['comment_datestamp'];
         if ($latest_comment > USERLV) {
             $NEWIMAGE = $param['image_new_small'];
         } else {
             $NEWIMAGE = $param['image_nonew_small'];
         }
     } else {
         $NEWIMAGE = $param['image_nonew_small'];
     }
     if (deftrue('BOOTSTRAP')) {
         $NEWIMAGE = "";
     }
     return !$news_item['news_allow_comments'] ? '' . ($pref['comments_icon'] ? $NEWIMAGE . ' ' : '') . "<a title='Comments' href='" . e107::getUrl()->create('news/view/item', $news_item) . "'>" . $param['commentlink'] . intval($news_item['news_comment_total']) . '</a>' : vartrue($param['commentoffstring'], 'Disabled');
 }
Example #3
0
 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);
 }
Example #4
0
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;
}
Example #5
0
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;
            }
        }
    }
}
Example #6
0
 /**
  * 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;
 }
Example #7
0
 /**
  * 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);	
     		}*/
 }
Example #8
0
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>';
    }
}
Example #9
0
 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>';
 }
Example #10
0
 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);
 }
Example #11
0
 /**
  * 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;
 }
Example #12
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 #13
0
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 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'];
 }
Example #15
0
 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);
 }
Example #16
0
 function init()
 {
     $this->forum_attachment_path = vartrue(trim($_POST['forum_attachment_path'], "/"), false);
     if ($data = e107::getDb('phpbb')->retrieve('userclass_classes', 'userclass_id', "userclass_name='FORUM_MODERATOR' ")) {
         $this->forum_moderator_class = $data;
     }
 }
Example #17
0
 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);
 }
Example #18
0
function do_export($filename, $type_list = '', $format_array, $sep = ',', $quot = '"')
{
    $sql = e107::getDb();
    $export_text = '';
    $qry = "SELECT * FROM `#banlist` ";
    if ($type_list != '') {
        $qry .= " WHERE`banlist_bantype` IN ({$type_list})";
    }
    if (!$sql->db_Select_gen($qry)) {
        return 'No data: ' . $qry;
    }
    while ($row = $sql->db_Fetch()) {
        $line = '';
        $spacer = '';
        foreach ($format_array as $f => $v) {
            switch ($f) {
                case 'banlist_ip':
                case 'banlist_bantype':
                case 'banlist_reason':
                case 'banlist_notes':
                    $line .= $spacer . $quot . $row[$f] . $quot;
                    break;
                case 'banlist_datestamp':
                case 'banlist_banexpires':
                    if ($row[$f]) {
                        $line .= $spacer . $quot . strftime($v, $row[$f]) . $quot;
                    } else {
                        $line .= $spacer . $quot . '0' . $quot;
                    }
                    break;
            }
            $spacer = $sep;
        }
        $export_text .= $line . "\n";
    }
    if (defined('CSV_DEBUG')) {
        $export_text .= 'Summary data: <br />';
        $export_text .= 'File: ' . $filename . '<br />';
        $export_text .= 'Types: ' . $type_list . '<br />';
        $export_text .= 'Query: ' . $qry . '<br />';
        echo str_replace("\n", "<br />", $export_text);
    } else {
        if (headers_sent()) {
            return "Cannot output file - some data already sent<br /><br />";
        }
        //Secure https check
        if (isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] == 'contype') {
            header('Pragma: public');
        }
        if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
            header('Content-Type: application/force-download');
        } else {
            header('Content-Type: application/octet-stream');
        }
        header('Content-Length: ' . strlen($export_text));
        header('Content-disposition: attachment; filename="' . $filename . '"');
        echo $export_text;
    }
}
Example #19
0
 function install_post($var)
 {
     $sql = e107::getDb();
     $mes = e107::getMessage();
     $query = "INSERT INTO #pcontent VALUES \n\t\t(1, 'content', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '" . time() . "', '0', '0', '', '1', '0', '', '') ,\n\t\t(2, 'article', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '" . time() . "', '0', '0', '', '2', '0', '', ''),\n\t\t(3, 'review', '', '', '', '1', '', '', '', '0', '0', '0', '0', '', '" . time() . "', '0', '0', '', '3', '0', '', '')";
     $status = $sql->gen($query) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
     $mes->add("Adding Default table categories to table: content ", $status);
 }
Example #20
0
 function upgrade_post($var)
 {
     $sql = e107::getDb();
     if ($sql->isEmpty('forum_thread') === true && $sql->isTable('forum_t') && $sql->isEmpty('forum_t') === false) {
         $mes = e107::getMessage();
         $mes->addSuccess("Migration is required. Please click 'Continue'.<br /><a class='btn btn-primary' href='" . e_PLUGIN . "forum/forum_update.php'>Continue</a>");
     }
 }
Example #21
0
 function __construct()
 {
     $books = e107::getDb()->retrieve("SELECT * FROM #page_chapters ORDER BY chapter_id ASC", true);
     foreach ($books as $row) {
         $id = $row['chapter_id'];
         $this->chapterData[$id] = $row;
     }
 }
Example #22
0
 function install_post($var)
 {
     $sql = e107::getDb();
     $mes = e107::getMessage();
     $insert = array(array('rss_id' => 0, 'rss_name' => 'News', 'rss_url' => 'news', 'rss_topicid' => '', 'rss_path' => 'news', 'rss_text' => 'The rss feed of the news', 'rss_datestamp' => time(), 'rss_class' => '0', 'rss_limit' => '9'));
     $status = $sql->insert('rss', $insert) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
     $mes->add("Adding Default table data to table: rss", $status);
     //TODO Generic LAN "LAN_DEFAULT_TABLE_DATA"
 }
Example #23
0
 public function __construct()
 {
     $this->sql_r = e107::getDb('sql_r');
     $this->isAdmin = FALSE;
     $this->fixed_classes = array(e_UC_PUBLIC => UC_LAN_0, e_UC_GUEST => UC_LAN_1, e_UC_NOBODY => UC_LAN_2, e_UC_MEMBER => UC_LAN_3, e_UC_ADMIN => UC_LAN_5, e_UC_MAINADMIN => UC_LAN_6, e_UC_READONLY => UC_LAN_4, e_UC_NEWUSER => UC_LAN_9, e_UC_BOTS => UC_LAN_10);
     $this->text_class_link = array('public' => e_UC_PUBLIC, 'guest' => e_UC_GUEST, 'nobody' => e_UC_NOBODY, 'member' => e_UC_MEMBER, 'admin' => e_UC_ADMIN, 'main' => e_UC_MAINADMIN, 'new' => e_UC_NEWUSER, 'mods' => e_UC_MODS, 'bots' => e_UC_BOTS, 'readonly' => e_UC_READONLY);
     $this->readTree(TRUE);
     // Initialise the classes on entry
 }
Example #24
0
 function faqCategories()
 {
     $sql = e107::getDb();
     $sublinks = array();
     $sql->db_Select("faqs_info", "*", "faq_info_id != '' ORDER BY faq_info_order");
     while ($row = $sql->db_Fetch()) {
         $sublinks[] = array('link_name' => $row['faq_info_title'], 'link_url' => '{e_PLUGIN}faqs/faqs.php?cat.' . $row['faq_info_id'], 'link_description' => $row['faq_info_about'], 'link_button' => '', 'link_category' => '', 'link_order' => '', 'link_parent' => '', 'link_open' => '', 'link_class' => intval($row['faq_info_class']));
     }
     return $sublinks;
 }
Example #25
0
 function getRecord($id)
 {
     $sql = e107::getDb();
     $this->row = '';
     $qry = "SELECT p.*, u.user_id, u.user_name FROM #page AS p\n\t\tLEFT JOIN #user AS u ON p.page_author = u.user_id\n\t\tWHERE p.page_id='{$id}' AND p.page_class IN (" . USERCLASS_LIST . ") ";
     if ($sql->gen($qry)) {
         $this->row = $sql->fetch();
     }
     return $this->row;
 }
Example #26
0
 function status()
 {
     $sql = e107::getDb();
     $chatbox_posts = $sql->count('chatbox');
     $var[0]['icon'] = "<img src='" . e_PLUGIN_ABS . "chatbox_menu/images/chatbox_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
     $var[0]['title'] = LAN_PLUGIN_CHATBOX_MENU_POSTS;
     $var[0]['url'] = e_PLUGIN . "chatbox_menu/admin_chatbox.php";
     $var[0]['total'] = $chatbox_posts;
     return $var;
 }
Example #27
0
 function myfunction()
 {
     $sql = e107::getDb();
     $sublinks = array();
     $sql->db_Select("page", "*", "page_theme = '' ORDER BY page_title");
     while ($row = $sql->db_Fetch()) {
         $sublinks[] = array('link_name' => $row['page_title'], 'link_url' => 'page.php?' . $row['page_id'], 'link_description' => '', 'link_button' => '', 'link_category' => '', 'link_order' => '', 'link_parent' => '', 'link_open' => '', 'link_class' => intval($row['page_class']));
     }
     return $sublinks;
 }
Example #28
0
 function latest()
 {
     $sql = e107::getDb();
     $reported_posts = $sql->count('generic', '(*)', "WHERE gen_type='reported_post' OR gen_type='Reported Forum Post'");
     $var[0]['icon'] = E_16_FORUM;
     $var[0]['title'] = ADLAN_LAT_6;
     $var[0]['url'] = e_PLUGIN . "forum/forum_admin.php?sr";
     $var[0]['total'] = $reported_posts;
     return $var;
 }
Example #29
0
 function latest()
 {
     $db = e107::getDb();
     $submitted_links = $db->count("links_page", "(*)", "WHERE link_active = 0 ");
     $var[0]['icon'] = "<img src='" . e_PLUGIN_ABS . "links_page/images/linkspage_16.png' style='width: 16px; height: 16px; vertical-align: bottom' alt='' /> ";
     $var[0]['title'] = ADLAN_LAT_5;
     $var[0]['url'] = e_PLUGIN . "links_page/admin_linkspage.php";
     $var[0]['total'] = $submitted_links ? $submitted_links : 0;
     return $var;
 }
Example #30
0
 function getRecord($id)
 {
     $sql = e107::getDb();
     $this->row = '';
     $qry = "SELECT d.*\n\t\tFROM #download as d\n\t\tWHERE d.download_id='{$id}' AND d.download_class REGEXP '" . e_CLASS_REGEXP . "' ";
     if ($sql->gen($qry)) {
         $this->row = $sql->fetch();
     }
     return $this->row;
 }