Example #1
0
 public function get_mood_message()
 {
     // whether any user has reacted to this post
     $locale = fusion_get_locale("", FORUM_ADMIN_LOCALE);
     $locale += fusion_get_locale("", FORUM_LOCALE);
     $last_datestamp = array();
     $mood_description = array();
     $mood_cache = $this->cache_mood();
     $response_query = "SELECT pn.*, u.user_id, u.user_name, u.user_avatar, u.user_status\n        FROM " . DB_POST_NOTIFY . " pn\n        LEFT JOIN " . DB_USERS . " u ON pn.notify_sender = u.user_id\n        WHERE post_id='" . $this->post_id . "' GROUP BY pn.notify_mood_id ORDER BY pn.notify_mood_id ASC, pn.post_id ASC";
     $response_result = dbquery($response_query);
     if (dbrows($response_result)) {
         while ($m_data = dbarray($response_result)) {
             $user_output = "<a class='mood_sender' href='" . FUSION_REQUEST . "#post_" . $this->post_id . "'>\n" . profile_link($m_data['user_id'], $m_data['user_name'], $m_data['user_status'], "", FALSE) . "</a>";
             if (fusion_get_userdata('user_id') == $m_data['notify_sender']) {
                 $user_output = $locale['you'];
             }
             $reply_sender[$m_data['notify_mood_id']][] = $user_output;
             // The pairing errors are when `notify_mood_id` is illegally inserted or deleted
             // To code fallback on empty
             $last_datestamp[$m_data['notify_mood_id']] = $m_data['notify_datestamp'];
             $icon = isset($mood_cache[$m_data['notify_mood_id']]['mood_icon']) ? $mood_cache[$m_data['notify_mood_id']]['mood_icon'] : "fa fa-question fa-fw";
             $mood_icon[$m_data['notify_mood_id']] = "<i class='{$icon}'></i>";
             $description = isset($mood_cache[$m_data['notify_mood_id']]['mood_description']) ? $mood_cache[$m_data['notify_mood_id']]['mood_description'] : $locale['forum_0529'];
             $mood_description[$m_data['notify_mood_id']] = $description;
         }
         $output_message = "";
         foreach ($mood_description as $mood_id => $mood_output) {
             $senders = implode(", ", $reply_sender[$mood_id]);
             $output_message .= sprintf($locale['forum_0528'], $mood_icon[$mood_id], $senders, $mood_output, timer($last_datestamp[$mood_id])) . "\n                        <br/>";
         }
         return (string) $output_message;
     }
 }
Example #2
0
 private static function setLocale()
 {
     self::$locale = fusion_get_locale("", FORUM_ADMIN_LOCALE);
     self::$locale += fusion_get_locale("", SETTINGS_LOCALE);
     self::$locale += fusion_get_locale("", FORUM_TAGS_LOCALE);
     self::$locale += fusion_get_locale("", FORUM_RANKS_LOCALE);
 }
Example #3
0
 public function __construct()
 {
     if (empty(self::$locale)) {
         $locale = fusion_get_locale('', LOCALE . LOCALESET . "admin/errors.php");
         $locale += fusion_get_locale('', LOCALE . LOCALESET . "errors.php");
         self::$locale += $locale;
     }
     $this->error_status = filter_input(INPUT_POST, 'error_status', FILTER_VALIDATE_INT, array('min_range' => 0, 'max_range' => 2));
     $this->posted_error_id = filter_input(INPUT_POST, 'error_id', FILTER_VALIDATE_INT);
     $this->delete_status = filter_input(INPUT_POST, 'delete_status', FILTER_VALIDATE_INT, array('min_range' => 0, 'max_range' => 2));
     $this->rowstart = filter_input(INPUT_GET, 'rowstart', FILTER_VALIDATE_INT) ?: 0;
     $this->error_id = filter_input(INPUT_GET, 'error_id', FILTER_VALIDATE_INT);
     if (isnum($this->error_status) && $this->posted_error_id) {
         dbquery("UPDATE " . DB_ERRORS . " SET error_status='" . $this->error_status . "' WHERE error_id='" . $this->posted_error_id . "'");
         redirect(FUSION_REQUEST);
     }
     if (isset($_POST['delete_entries']) && isnum($this->delete_status)) {
         dbquery("DELETE FROM " . DB_ERRORS . " WHERE error_status='" . $_POST['delete_status'] . "'");
         $source_redirection_path = preg_replace("~" . fusion_get_settings("site_path") . "~", "", FUSION_REQUEST, 1);
         redirect(fusion_get_settings("siteurl") . $source_redirection_path);
     }
     $result = dbquery("SELECT * FROM " . DB_ERRORS . " ORDER BY error_timestamp DESC LIMIT " . $this->rowstart . ",20");
     while ($data = dbarray($result)) {
         $this->errors[$data['error_id']] = $data;
     }
     $this->rows = $this->errors ? dbcount('(error_id)', DB_ERRORS) : 0;
 }
Example #4
0
 public function set_filterInfo()
 {
     $locale = fusion_get_locale("", FORUM_LOCALE);
     $time = isset($_GET['time']) ? $_GET['time'] : '';
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     $sort = isset($_GET['sort']) ? $_GET['sort'] : '';
     $order = isset($_GET['order']) ? $_GET['order'] : '';
     $timeCol = '';
     $typeCol = '';
     if ($time) {
         $time_array = array('today' => strtotime('today'), '2days' => strtotime('-2 days'), '1week' => strtotime('-1 week'), '2week' => strtotime('-2 weeks'), '1month' => strtotime('-2 months'), '2month' => strtotime('-2 months'), '3month' => strtotime('-2 months'), '6month' => strtotime('-6 months'), '1year' => strtotime('-1 year'));
         $time_stop = $time_array['today'];
         foreach ($time_array as $key => $value) {
             if ($time == $key) {
                 $time_stop = prev($time_array);
                 break;
             }
         }
         if ($time !== 'today') {
             $start_time = intval($time_array[$time]);
             $end_time = time();
             $timeCol = "AND ((p1.post_datestamp BETWEEN '{$start_time}' AND '{$end_time}') OR (t.thread_lastpost BETWEEN '{$start_time}' AND '{$end_time}'))";
         } else {
             $timeCol = "AND (p1.post_datestamp >= " . intval($time_array[$time]) . " OR t.thread_lastpost >= " . intval($time_stop) . " )";
         }
     }
     if ($type) {
         $type_array = array('all' => '', 'discussions' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND (forum_poll_title IS NULL or forum_poll_title='')", 'attachments' => "AND a1.attach_name !='' OR a2.attach_name !='' AND (forum_poll_title IS NULL or forum_poll_title='')", 'poll' => "AND (a1.attach_name IS NULL or a1.attach_name='') AND (a2.attach_name IS NULL or a2.attach_name='') AND forum_poll_title !=''", 'solved' => "AND t.thread_answered = '1'", 'unsolved' => "AND t.thread_answered = '0'");
         $typeCol = $type_array[$type];
     }
     $sortCol = "ORDER BY t.thread_lastpost ";
     $orderCol = 'DESC';
     if ($sort) {
         $sort_array = array('author' => 't.thread_author', 'time' => 't.thread_lastpost', 'subject' => 't.thread_subject', 'reply' => 't.thread_postcount', 'view' => 't.thread_views');
         $sortCol = "ORDER BY " . $sort_array[$sort] . " ";
     }
     if ($order) {
         $order_array = array('ascending' => 'ASC', 'descending' => 'DESC');
         $orderCol = $order_array[$order];
     }
     $this->filter_sql = array('condition' => $timeCol . $typeCol, 'order' => $sortCol . $orderCol);
     // Filter Links
     $timeExt = isset($_GET['time']) ? "&amp;time=" . $time : '';
     $typeExt = isset($_GET['type']) ? "&amp;type=" . $type : '';
     $sortExt = isset($_GET['sort']) ? "&amp;sort=" . $sort : '';
     $orderExt = isset($_GET['order']) ? "&amp;order=" . $order : '';
     $baseLink = clean_request("", array("time", "type", "sort", "order"), FALSE);
     if (isset($_GET['viewforum']) && isset($_GET['forum_id'])) {
         $baseLink = INFUSIONS . 'forum/index.php?viewforum&amp;forum_id=' . $_GET['forum_id'] . '' . (isset($_GET['parent_id']) ? '&amp;parent_id=' . $_GET['parent_id'] . '' : '');
     }
     $timeLink = $baseLink . $typeExt . $sortExt . $orderExt;
     $this->filter_info['time'] = array($locale['forum_3006'] => $baseLink, $locale['forum_3007'] => $timeLink . '&amp;time=today', $locale['forum_3008'] => $timeLink . '&amp;time=2days', $locale['forum_3009'] => $timeLink . '&amp;time=1week', $locale['forum_3010'] => $timeLink . '&amp;time=2week', $locale['forum_3011'] => $timeLink . '&amp;time=1month', $locale['forum_3012'] => $timeLink . '&amp;time=2month', $locale['forum_3013'] => $timeLink . '&amp;time=3month', $locale['forum_3014'] => $timeLink . '&amp;time=6month', $locale['forum_3015'] => $timeLink . '&amp;time=1year');
     $typeLink = $baseLink . $timeExt . $sortExt . $orderExt;
     $this->filter_info['type'] = array($locale['forum_3000'] => $typeLink . '&amp;type=all', $locale['forum_3001'] => $typeLink . '&amp;type=discussions', $locale['forum_3002'] => $typeLink . '&amp;type=attachments', $locale['forum_3003'] => $typeLink . '&amp;type=poll', $locale['forum_3004'] => $typeLink . '&amp;type=solved', $locale['forum_3005'] => $typeLink . '&amp;type=unsolved');
     $sortLink = $baseLink . $timeExt . $typeExt . $orderExt;
     $this->filter_info['sort'] = array($locale['forum_3016'] => $sortLink . '&amp;sort=author', $locale['forum_3017'] => $sortLink . '&amp;sort=time', $locale['forum_3018'] => $sortLink . '&amp;sort=subject', $locale['forum_3019'] => $sortLink . '&amp;sort=reply', $locale['forum_3020'] => $sortLink . '&amp;sort=view');
     $orderLink = $baseLink . $timeExt . $typeExt . $sortExt;
     $this->filter_info['order'] = array($locale['forum_3021'] => $orderLink . '&amp;order=descending', $locale['forum_3022'] => $orderLink . '&amp;order=ascending');
 }
Example #5
0
 public function __construct()
 {
     global $admin_pages, $aidlink;
     $this->admin_pages = $admin_pages;
     $this->locale = fusion_get_locale('', LOCALE . LOCALESET . "admin/main.php");
     $this->admin_sections = array(0 => $GLOBALS['locale']['ac00'], 1 => $GLOBALS['locale']['ac01'], 2 => $GLOBALS['locale']['ac02'], 3 => $GLOBALS['locale']['ac03'], 4 => $GLOBALS['locale']['ac04'], 5 => $GLOBALS['locale']['ac05']);
     $this->current_page = self::_currentPage();
     // Dashboard breadcrumb
     add_breadcrumb(array('link' => ADMIN . 'index.php' . $aidlink . '&amp;pagenum=0', 'title' => $GLOBALS['locale']['ac10']));
     $acTab = isset($_GET['pagenum']) && isnum($_GET['pagenum']) ? $_GET['pagenum'] : $this->_isActive();
     if ($acTab != 0 && $acTab <= 5) {
         add_breadcrumb(array('link' => ADMIN . $aidlink . "&amp;pagenum=" . $acTab, 'title' => $GLOBALS['locale']['ac0' . $acTab]));
     }
 }
Example #6
0
 function display_error_page($data)
 {
     $locale = fusion_get_locale();
     $text = $data['title'];
     $image = $data['image'];
     opentable($text);
     echo "<table class='table table-responsive' width='100%' style='text-center'>";
     echo "<tr>";
     echo "<td width='30%' align='center'><img class='img-responsive' src='" . $image . "' alt='" . $text . "' border='0'></td>";
     echo "<td style='font-size:16px;color:red' align='center'>" . $text . "</td>";
     echo "</tr>";
     echo "<tr>";
     echo "<td colspan='2' align='center'><b><a class='button' href='" . BASEDIR . "index.php'>" . $locale['errret'] . "</a></b></td>";
     echo "</tr>";
     echo "</table>";
     closetable();
 }
Example #7
0
 static function get_Currency($currency_code = NULL)
 {
     $locale = fusion_get_locale("", LOCALE . LOCALESET . 'currency.php');
     if (empty(self::$currency_list)) {
         foreach (self::getCountryResource() as $object) {
             if ($object->name->common !== 'Antarctica') {
                 if ($currency_code == $object->currency[0]) {
                     break;
                 }
                 $currency_symbol = isset($locale['currency_symbol'][$object->currency[0]]) ? $locale['currency_symbol'][$object->currency[0]] : "\$";
                 self::$currency_list[$object->currency[0]] = $locale['currency'][$object->currency[0]] . " (" . $currency_symbol . ")";
             }
         }
     }
     if ($currency_code !== NULL) {
         return isset(self::$currency_list[$currency_code]) ? self::$currency_list[$currency_code] : $locale['na'];
     } else {
         return array_filter(self::$currency_list);
     }
 }
Example #8
0
+--------------------------------------------------------+
| Filename: infusion.php
| Author: J.Falk (Falk)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) {
    die("Access Denied");
}
$locale = fusion_get_locale("", LOCALE . LOCALESET . "setup.php");
// Infusion general information
$inf_title = $locale['weblinks']['title'];
$inf_description = $locale['weblinks']['description'];
$inf_version = "1.00";
$inf_developer = "PHP Fusion Development Team";
$inf_email = "*****@*****.**";
$inf_weburl = "https://www.php-fusion.co.uk";
$inf_folder = "weblinks";
$inf_image = "weblink.png";
// Multilanguage table for Administration
$inf_mlt[] = array("title" => $locale['weblinks']['title'], "rights" => "WL");
// Create tables
$inf_newtable[] = DB_WEBLINKS . " (\n\tweblink_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n\tweblink_name VARCHAR(100) NOT NULL DEFAULT '',\n\tweblink_description TEXT NOT NULL,\n\tweblink_url VARCHAR(200) NOT NULL DEFAULT '',\n\tweblink_cat MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',\n\tweblink_datestamp INT(10) UNSIGNED NOT NULL DEFAULT '0',\n\tweblink_visibility TINYINT(4) NOT NULL DEFAULT '0',\n\tweblink_count SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',\n\tPRIMARY KEY(weblink_id),\n\tKEY weblink_datestamp (weblink_datestamp),\n\tKEY weblink_count (weblink_count)\n) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci";
$inf_newtable[] = DB_WEBLINK_CATS . " (\n\tweblink_cat_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n\tweblink_cat_parent MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',\n\tweblink_cat_name VARCHAR(100) NOT NULL DEFAULT '',\n\tweblink_cat_description TEXT NOT NULL,\n\tweblink_cat_sorting VARCHAR(50) NOT NULL DEFAULT 'weblink_name ASC',\n\tweblink_cat_language VARCHAR(50) NOT NULL DEFAULT '" . LANGUAGE . "',\n\tPRIMARY KEY(weblink_cat_id)\n) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci";
// Settings
Example #9
0
 /**
  * Moderator Action - Renew Thread
  * Modal pop up confirmation of thread being `renewed`
  */
 private function mod_renew_thread()
 {
     $locale = fusion_get_locale();
     if (iMOD) {
         $result = dbquery("SELECT p.post_id, p.post_author, p.post_datestamp, f.forum_id, f.forum_cat\n\t\t\t\t\tFROM " . DB_FORUM_POSTS . " p\n\t\t\t\t\tINNER JOIN " . DB_FORUM_THREADS . " t ON p.thread_id=t.thread_id\n\t\t\t\t\tINNER JOIN " . DB_FORUMS . " f on f.forum_id = t.forum_id\n\t\t\t\t\tWHERE p.thread_id='" . intval($this->thread_id) . "' AND t.thread_hidden=0 AND p.post_hidden=0\n\t\t\t\t\tORDER BY p.post_id DESC LIMIT 1\n\t\t\t\t\t");
         if (dbrows($result) > 0) {
             $data = dbarray($result);
             dbquery("UPDATE " . DB_FORUM_POSTS . " SET post_datestamp='" . time() . "' WHERE post_id='" . $data['post_id'] . "'");
             dbquery("UPDATE " . DB_FORUM_THREADS . " SET thread_lastpost='" . time() . "', thread_lastpostid='" . $data['post_id'] . "', thread_lastuser='******'post_author'] . "' WHERE thread_id='" . intval($this->thread_id) . "'");
             dbquery("UPDATE " . DB_FORUMS . " SET forum_lastpost='" . time() . "', forum_lastuser='******'post_author'] . "' WHERE forum_id='" . $this->forum_id . "'");
             ob_start();
             echo openmodal('renew', $locale['forum_0758'], array('class' => 'modal-center', 'static' => 1));
             echo "<div style='text-align:center'><br />\n" . $locale['forum_0759'] . "<br /><br />\n";
             echo "<a href='" . INFUSIONS . "forum/index.php?viewforum&amp;forum_id=" . $this->forum_id . "&amp;parent_id=" . $this->parent_id . "'>" . $locale['forum_0702'] . "</a><br /><br />\n";
             echo "<a href='" . INFUSIONS . "forum/index.php'>" . $locale['forum_0703'] . "</a><br /><br /></div>\n";
             echo closemodal();
             add_to_footer(ob_get_contents());
             ob_end_clean();
         } else {
             redirect(INFUSIONS . "forum/index.php");
         }
     }
 }
/**
 * @param        $formname
 * @param        $textarea
 * @param bool   $html
 * @param bool   $colors
 * @param bool   $images
 * @param string $folder
 * @return string
 */
function display_html($formname, $textarea, $html = TRUE, $colors = FALSE, $images = FALSE, $folder = "")
{
    $locale = fusion_get_locale("", LOCALE . LOCALESET . "colors.php");
    $locale += fusion_get_locale("", LOCALE . LOCALESET . "admin/html_buttons.php");
    $res = "";
    if ($html) {
        $res .= "<div class='btn-group'>\n";
        $res .= "<button type='button' value='b' title='" . $locale['html_000'] . "' class='btn btn-sm btn-default m-b-10 button' style='font-weight:bold;' onclick=\"addText('" . $textarea . "', '&lt;strong&gt;', '&lt;/strong&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-bold'></i></button>\n";
        $res .= "<button type='button' value='i' title='" . $locale['html_001'] . "' class='btn btn-sm btn-default m-b-10 button' style='font-style:italic;' onclick=\"addText('" . $textarea . "', '&lt;i&gt;', '&lt;/i&gt;', '" . $formname . "');\">I</button>\n";
        $res .= "<button type='button' value='u' title='" . $locale['html_002'] . "' class='btn btn-sm btn-default m-b-10 button' style='text-decoration:underline;' onclick=\"addText('" . $textarea . "', '&lt;u&gt;', '&lt;/u&gt;', '" . $formname . "');\">U</button>\n";
        $res .= "<button type='button' value='strike' title='" . $locale['html_003'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;del&gt;', '&lt;/del&gt;', '" . $formname . "');\"><del>ABC</del></button>\n";
        $res .= "<button type='button' value='blockquote' title='" . $locale['html_004'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;blockquote&gt;', '&lt;/blockquote&gt;', '" . $formname . "');\"><i class='fa fa-quote-left'></i></button>\n";
        $res .= "<button type='button' value='hr' title='" . $locale['html_005'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;hr/&gt;', '', '" . $formname . "');\"><i class='glyphicon glyphicon-resize-horizontal'></i></button>\n";
        $res .= "</div>\n";
        $res .= "<div class='btn-group'>\n";
        $res .= "<button type='button' class='btn btn-sm btn-default button m-b-10' value='" . $locale['html_016'] . "' onclick=\"insertText('" . $textarea . "', '&lt;!--PAGEBREAK--&gt;', '" . $formname . "');\">" . $locale['html_016'] . "</button>\n";
        $res .= fusion_get_settings("allow_php_exe") ? "<button type='button' class='btn btn-sm btn-default button m-b-10' value='&lt;?php?&gt;' onclick=\"addText('" . $textarea . "', '&lt;?php\\n', '\\n?&gt;', '" . $formname . "');\">&lt;?php?&gt;</button>\n" : "";
        $res .= "<button type='button' class='btn btn-sm btn-default button m-b-10' value='&lt;p&gt;' onclick=\"addText('" . $textarea . "', '&lt;p&gt;', '&lt;/p&gt;', '" . $formname . "');\">&lt;p&gt;</button>\n";
        $res .= "<button type='button' class='btn btn-default btn-sm button m-b-10' value='&lt;br /&gt;' onclick=\"insertText('" . $textarea . "', '&lt;br /&gt;', '" . $formname . "');\">&lt;br /&gt;</button>\n";
        $res .= "</div>\n";
        $res .= "<div class='btn-group'>\n";
        $res .= "<button type='button' value='left' title='" . $locale['html_006'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;p style=\\'text-align:left;\\'&gt;', '&lt;/p&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-align-left'></i></button>\n";
        $res .= "<button type='button' value='center' title='" . $locale['html_007'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;p style=\\'text-align:center;\\'&gt;', '&lt;/p&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-align-center'></i></button>\n";
        $res .= "<button type='button' value='right' title='" . $locale['html_008'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;p style=\\'text-align:right;\\'&gt;', '&lt;/p&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-align-right'></i></button>\n";
        $res .= "<button type='button' value='justify' title='" . $locale['html_009'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;p style=\\'text-align:justify;\\'&gt;', '&lt;/p&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-align-justify'></i></button>\n";
        $res .= "</div>\n";
        $res .= "<div class='btn-group'>\n";
        $res .= "<button type='button' value='link' title='" . $locale['html_010'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;a href=\\'', '\\' target=\\'_blank\\'>Link&lt;/a&gt;', '" . $formname . "');\"><i class='glyphicon glyphicon-paperclip'></i></button>\n";
        //$res .= "<button type='button' value='img' title='".$locale['html_011']."' class='btn btn-sm btn-default m-b-10 dropdown-toggle button' data-toggle='dropdown' onclick=\"addText('".$textarea."', '&lt;img src=\'".str_replace("../", "", $folder)."', '\' style=\'margin:5px\' alt=\'\' align=\'left\' /&gt;', '".$formname."');\"><i class='fa fa-picture-o'></i></button>\n";
        $res .= "<div class='btn-group HTML-img'><a title='" . $locale['html_011'] . "' class='btn btn-sm btn-default dropdown dropdown-toggle button' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'><i class='fa fa-picture-o'></i><b class='caret'></b></a>\n";
        if ($images && $folder) {
            $res .= "<ul class='dropdown-menu'>\n";
            $res .= "<li class='p-l-15 p-r-15'>\n";
            $image_files = makefilelist($folder, ".|..|index.php", TRUE);
            $image_list = makefileopts($image_files);
            $res .= "<select name='insertimage' class='form-control textbox' style='margin-top:5px' onchange=\"insertText('" . $textarea . "', '&lt;img src=\\'" . str_replace("../", "", $folder) . "' + this.options[this.selectedIndex].value + '\\' alt=\\'\\' style=\\'margin:5px\\' align=\\'left\\' /&gt;', '" . $formname . "');this.selectedIndex=0;\">\n";
            $res .= "<option value=''>" . $locale['html_011'] . "</option>\n" . $image_list . "</select>\n";
            $res .= "</li>\n</ul>\n";
        }
        $res .= "</div>\n";
        $res .= "<button type='button' value='center' title='" . $locale['html_012'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;center&gt;', '&lt;/center&gt;', '" . $formname . "');\">center</button>\n";
        $res .= "<button type='button' value='small' title='" . $locale['html_013'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;span class=\\'small\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\">small</button>\n";
        $res .= "<button type='button' value='small2' title='" . $locale['html_014'] . "' class='btn btn-sm  btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;span class=\\'small2\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\">small2</button>\n";
        $res .= "<button type='button' value='alt' title='" . $locale['html_015'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;span class=\\'alt\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\">alt</button>\n";
        $res .= "<button type='button' value='" . $locale['html_016'] . "' title='" . $locale['html_016'] . "' class='btn btn-sm btn-default m-b-10 button' onclick=\"addText('" . $textarea . "', '&lt;!--PAGEBREAK--&gt;', '', '" . $formname . "');\"><i class='glyphicon glyphicon-minus'></i></button>\n";
        if ($colors) {
            $res .= "<div class='btn-group'>\n";
            $res .= "<button title='" . $locale['html_017'] . "' class='dropdown-toggle btn btn-sm btn-default button' data-toggle='dropdown'><i class='fa fa-tint m-r-5'></i> <span class='caret'></span></button>\n";
            $res .= "<ul class='dropdown-menu' role='text-color' style='width:190px;'>\n";
            $res .= "<li>\n";
            $res .= "<div class='display-block p-l-10 p-r-5 p-t-5 p-b-0' style='width:100%'>\n";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#000\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_8'] . "' style='background-color:#000; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#993300\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_136'] . "' style='background-color:#993300; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#333300\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_137'] . "' style='background-color:#333300; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#003300\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_138'] . "' style='background-color:#003300; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#003366\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_139'] . "' style='background-color:#003366; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#000080\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_92'] . "' style='background-color:#000080; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#333399\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_140'] . "' style='background-color:#333399; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#333333\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_141'] . "' style='background-color:#333333; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "</div>\n";
            $res .= "<div class='display-block p-l-10 p-r-10 p-t-5 p-b-0' style='width:100%'>\n";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#800000\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_77'] . "' style='background-color:#800000; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF6600\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_142'] . "' style='background-color:#FF6600; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF6600\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_35'] . "' style='background-color:#2F4F4F; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#008000\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_51'] . "' style='background-color:#008000; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#008080\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_126'] . "' style='background-color:#008080; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#0000FF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_10'] . "' style='background-color:#0000FF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#666699\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_143'] . "' style='background-color:#666699; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#808080\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_50'] . "' style='background-color:#808080; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "</div>\n";
            $res .= "<div class='display-block p-l-10 p-r-10 p-t-5 p-b-0' style='width:100%'>\n";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF0000\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_110'] . "' style='background-color:#FF0000; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF9900\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_144'] . "' style='background-color:#FF9900; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#99CC00\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_145'] . "' style='background-color:#99CC00; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#339966\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_146'] . "' style='background-color:#339966; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#33CCCC\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_147'] . "' style='background-color:#33CCCC; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#3366FF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_148'] . "' style='background-color:#3366FF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#800080\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_109'] . "' style='background-color:#800080; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#999999\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_149'] . "' style='background-color:#999999; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "</div>\n";
            $res .= "<div class='display-block p-l-10 p-r-10 p-t-5 p-b-0' style='width:100%'>\n";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF00FF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_45'] . "' style='background-color:#FF00FF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FFCC00\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_150'] . "' style='background-color:#FFCC00; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FFFF00\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_134'] . "' style='background-color:#FFFF00; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#00FF00\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_75'] . "' style='background-color:#00FF00; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#00FFFF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_3'] . "' style='background-color:#00FFFF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#00CCFF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_151'] . "' style='background-color:#00CCFF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#993366\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_152'] . "' style='background-color:#993366; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FFFFFF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_132'] . "' style='background-color:#FFFFFF; width:17px; margin:2px; text-decoration:none !important; box-shadow: 0 0 2px #a0a0a0;'>&nbsp;</a>";
            $res .= "</div>\n";
            $res .= "<div class='display-block p-l-10 p-r-10 p-t-5 p-b-0' style='width:100%'>\n";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FF99CC\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_153'] . "' style='background-color:#FF99CC; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FFCC99\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_154'] . "' style='background-color:#FFCC99; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#FFFF99\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_155'] . "' style='background-color:#FFFF99; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#CCFFCC\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_156'] . "' style='background-color:#CCFFCC; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#CCFFFF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_157'] . "' style='background-color:#CCFFFF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#99CCFF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_158'] . "' style='background-color:#99CCFF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:#CC99FF\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_159'] . "' style='background-color:#CC99FF; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "<a class='display-inline-block' onclick=\"addText('" . $textarea . "', '&lt;span style=\\'color:transparent\\'&gt;', '&lt;/span&gt;', '" . $formname . "');\" title='" . $locale['color_0'] . "' style='background-color:transparent; width:17px; margin:2px; text-decoration:none !important;'>&nbsp;</a>";
            $res .= "</div>\n";
            $res .= "</li>\n";
            $res .= "</ul>\n";
            $res .= "</div>\n";
        }
        $res .= "</div>\n";
        $res .= "<div class='btn-group'>\n";
        $res .= "<button type='button' title='" . $locale['html_018'] . "' class='btn btn-sm btn-default m-b-10 button strong' onclick=\"addText('" . $textarea . "', '&lt;p&gt;', '&lt;/p&gt;', '" . $formname . "');\">" . $locale['html_018'] . "</button>\n";
        $res .= "<button title='" . $locale['html_019'] . "' class='dropdown-toggle btn btn-sm btn-default m-b-10 button' data-toggle='dropdown'><i class='glyphicon glyphicon-header'></i> " . $locale['html_019'] . " <span class='caret'></span></button>\n";
        $res .= "<ul class='dropdown-menu' role='text-heading' style='width:190px;'>\n";
        $res .= "<li>\n<a value='H1' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h1&gt;', '&lt;/h1&gt;', '" . $formname . "');\"><span class='strong' style='font-size:24px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 1</span></a>\n</li>\n";
        $res .= "<li>\n<a value='H2' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h2&gt;', '&lt;/h2&gt;', '" . $formname . "');\"><span class='strong' style='font-size:19.5px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 2</span></a>\n</li>\n";
        $res .= "<li>\n<a value='H3' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h3&gt;', '&lt;/h3&gt;', '" . $formname . "');\"><span class='strong' style='font-size:15.5px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 3</span></a>\n</li>\n";
        $res .= "<li>\n<a value='H4' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h4&gt;', '&lt;/h4&gt;', '" . $formname . "');\"><span class='strong' style='font-size:13px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 4</span></a>\n</li>\n";
        $res .= "<li>\n<a value='H5' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h5&gt;', '&lt;/h5&gt;', '" . $formname . "');\"><span class='strong' style='font-size:11px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 5</span></a>\n</li>\n";
        $res .= "<li>\n<a value='H6' class='pointer' onclick=\"addText('" . $textarea . "', '&lt;h6&gt;', '&lt;/h6&gt;', '" . $formname . "');\"><span class='strong' style='font-size:9px; font-family: Georgia, \\'Times New Roman\\', Times, serif !important;'>Heading 6</span></a>\n</li>\n";
        $res .= "</ul>\n";
        $res .= "</div>\n";
    }
    return $res;
}
Example #11
0
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once file_exists('maincore.php') ? 'maincore.php' : __DIR__ . "/../../maincore.php";
if (!db_exists(DB_DOWNLOADS)) {
    redirect(BASEDIR . "error.php?code=404");
}
require_once THEMES . "templates/header.php";
require_once INCLUDES . "infusions_include.php";
if (file_exists(INFUSIONS . "downloads/locale/" . LOCALESET . "downloads.php")) {
    $locale += fusion_get_locale("", INFUSIONS . "downloads/locale/" . LOCALESET . "downloads.php");
} else {
    $locale += fusion_get_locale("", INFUSIONS . "downloads/locale/English/downloads.php");
}
include INFUSIONS . "downloads/templates/downloads.php";
require_once INFUSIONS . "downloads/classes/Functions.php";
$dl_settings = get_settings("downloads");
if (!isset($_GET['download_id']) && !isset($_GET['cat_id'])) {
    add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"));
}
add_breadcrumb(array('link' => INFUSIONS . 'downloads/downloads.php', 'title' => \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name")));
$result = NULL;
if (isset($_GET['file_id']) && isnum($_GET['file_id'])) {
    $res = 0;
    $data = dbarray(dbquery("SELECT download_url, download_file, download_cat, download_visibility FROM " . DB_DOWNLOADS . " WHERE download_id='" . intval($_GET['file_id']) . "'"));
    if (checkgroup($data['download_visibility'])) {
        $result = dbquery("UPDATE " . DB_DOWNLOADS . " SET download_count=download_count+1 WHERE download_id='" . intval($_GET['file_id']) . "'");
        if (!empty($data['download_file']) && file_exists(DOWNLOADS . 'files/' . $data['download_file'])) {
Example #12
0
 public function __construct()
 {
     $this->addBreadCrumb(array('link' => BASEDIR . 'index.php', 'title' => fusion_get_locale('home', LOCALE . LOCALESET . "global.php"), 'class' => 'home-link crumb'));
 }
Example #13
0
 /**
  * Get the forum structure
  *
  * @param bool $forum_id
  * @param bool $branch_id
  *
  * @return array
  */
 public static function get_forum($forum_id = FALSE, $branch_id = FALSE)
 {
     // only need to fetch child.
     $forum_settings = self::get_forum_settings();
     $userdata = fusion_get_userdata();
     $locale = fusion_get_locale("", FORUM_LOCALE);
     $index = array();
     // define what a row is
     $row = array('forum_new_status' => '', 'last_post' => '', 'forum_icon' => '', 'forum_icon_lg' => '', 'forum_moderators' => '', 'forum_link' => array('link' => '', 'title' => ''), 'forum_description' => '', 'forum_postcount_word' => '', 'forum_threadcount_word' => '');
     $query = dbquery("\n\t\t\t\tSELECT tf.forum_id, tf.forum_cat, tf.forum_branch, tf.forum_name, tf.forum_description, tf.forum_image,\n\t\t\t\ttf.forum_type, tf.forum_mods, tf.forum_threadcount, tf.forum_postcount, tf.forum_order, tf.forum_lastuser, tf.forum_access, tf.forum_lastpost, tf.forum_lastpostid,\n\t\t\t\tt.thread_id, t.thread_lastpost, t.thread_lastpostid, t.thread_subject, p.post_message,\n\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar\n\t\t\t\tFROM " . DB_FORUMS . " tf\n\t\t\t\tLEFT JOIN " . DB_FORUM_THREADS . " t ON tf.forum_lastpostid = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_FORUM_POSTS . " p ON p.thread_id = t.thread_id AND p.post_id = t.thread_lastpostid\n\t\t\t\tLEFT JOIN " . DB_USERS . " u ON tf.forum_lastuser = u.user_id\n\t\t\t\t" . (multilang_table("FO") ? "WHERE forum_language='" . LANGUAGE . "' AND" : "WHERE") . " " . groupaccess('tf.forum_access') . "\n\t\t\t\t" . ($forum_id && $branch_id ? "AND tf.forum_id = '" . intval($forum_id) . "' or tf.forum_cat = '" . intval($forum_id) . "' OR tf.forum_branch = '" . intval($branch_id) . "'" : '') . "\n\t\t\t\tGROUP BY tf.forum_id ORDER BY tf.forum_cat ASC, tf.forum_order ASC, t.thread_lastpost DESC\n\t\t");
     while ($data = dbarray($query) and checkgroup($data['forum_access'])) {
         // Calculate Forum New Status
         $newStatus = "";
         $forum_match = "\\|" . $data['forum_lastpost'] . "\\|" . $data['forum_id'];
         $last_visited = isset($userdata['user_lastvisit']) && isnum($userdata['user_lastvisit']) ? $userdata['user_lastvisit'] : time();
         if ($data['forum_lastpost'] > $last_visited) {
             if (iMEMBER && ($data['forum_lastuser'] !== $userdata['user_id'] || !preg_match("({$forum_match}\\.|{$forum_match}\$)", $userdata['user_threads']))) {
                 $newStatus = "<span class='forum-new-icon'><i title='" . $locale['forum_0260'] . "' class='" . self::get_forumIcons('new') . "'></i></span>";
             }
         }
         // Calculate lastpost information
         $lastPostInfo = array();
         if ($data['forum_lastpostid']) {
             $last_post = array('avatar' => '', 'avatar_src' => $data['user_avatar'] && file_exists(IMAGES . 'avatars/' . $data['user_avatar']) && !is_dir(IMAGES . 'avatars/' . $data['user_avatar']) ? IMAGES . 'avatars/' . $data['user_avatar'] : '', 'message' => fusion_first_words(parseubb(parsesmileys($data['post_message'])), 10), 'profile_link' => profile_link($data['forum_lastuser'], $data['user_name'], $data['user_status']), 'time' => timer($data['forum_lastpost']), 'date' => showdate("forumdate", $data['forum_lastpost']), 'thread_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&amp;thread_id=" . $data['thread_id'], 'post_link' => INFUSIONS . "forum/viewthread.php?forum_id=" . $data['forum_id'] . "&amp;thread_id=" . $data['thread_id'] . "&amp;pid=" . $data['thread_lastpostid'] . "#post_" . $data['thread_lastpostid']);
             if ($forum_settings['forum_last_post_avatar']) {
                 $last_post['avatar'] = display_avatar($data, '30px', '', '', 'img-rounded');
             }
             $lastPostInfo = $last_post;
         }
         /**
          * Default system icons - why do i need this? Why not let themers decide?
          */
         switch ($data['forum_type']) {
             case '1':
                 $forum_icon = "<i class='" . self::get_forumIcons('forum') . " fa-fw m-r-10'></i>";
                 $forum_icon_lg = "<i class='" . self::get_forumIcons('forum') . " fa-3x fa-fw m-r-10'></i>";
                 break;
             case '2':
                 $forum_icon = "<i class='" . self::get_forumIcons('thread') . " fa-fw m-r-10'></i>";
                 $forum_icon_lg = "<i class='" . self::get_forumIcons('thread') . " fa-3x fa-fw m-r-10'></i>";
                 break;
             case '3':
                 $forum_icon = "<i class='" . self::get_forumIcons('link') . " fa-fw m-r-10'></i>";
                 $forum_icon_lg = "<i class='" . self::get_forumIcons('link') . " fa-3x fa-fw m-r-10'></i>";
                 break;
             case '4':
                 $forum_icon = "<i class='" . self::get_forumIcons('question') . " fa-fw m-r-10'></i>";
                 $forum_icon_lg = "<i class='" . self::get_forumIcons('question') . " fa-3x fa-fw m-r-10'></i>";
                 break;
             default:
                 $forum_icon = "";
                 $forum_icon_lg = "";
         }
         $mod = new Moderator();
         $row = array_merge($row, $data, array("forum_moderators" => $mod::parse_forum_mods($data['forum_mods']), "forum_new_status" => $newStatus, "forum_link" => array("link" => INFUSIONS . "forum/index.php?viewforum&amp;forum_id=" . $data['forum_id'] . "&amp;parent_id=" . $data['forum_cat'], "title" => $data['forum_name']), "forum_description" => nl2br(parseubb($data['forum_description'])), "forum_postcount_word" => format_word($data['forum_postcount'], $locale['fmt_post']), "forum_threadcount_word" => format_word($data['forum_threadcount'], $locale['fmt_thread']), "last_post" => $lastPostInfo, "forum_icon" => $forum_icon, "forum_icon_lg" => $forum_icon_lg));
         $data["forum_image"] = $data['forum_image'] && file_exists(FORUM . "images/" . $data['forum_image']) ? $data['forum_image'] : "";
         $thisref =& $refs[$data['forum_id']];
         $thisref = $row;
         if ($data['forum_cat'] == 0) {
             $index[0][$data['forum_id']] =& $thisref;
         } else {
             $refs[$data['forum_cat']]['child'][$data['forum_id']] =& $thisref;
         }
     }
     return (array) $index;
 }
Example #14
0
    /**
     * News Item Page Template
     * @param $info
     */
    function render_news_item($info)
    {
        global $aidlink;
        $locale = fusion_get_locale();
        $news_settings = get_settings('news');
        $data = $info['news_item'];
        add_to_head("<link rel='stylesheet' href='" . INFUSIONS . "news/templates/css/news.css' type='text/css'>");
        add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />");
        add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>");
        add_to_footer('<script type="text/javascript">
			$(document).ready(function() {
				$(".news-image-overlay").colorbox({
					transition: "elasic",
					height:"100%",
					width:"100%",
					maxWidth:"98%",
					maxHeight:"98%",
					scrolling:false,
					overlayClose:true,
					close:false,
					photo:true,
					onComplete: function(result) {
						$("#colorbox").live("click", function(){
						$(this).unbind("click");
						$.fn.colorbox.close();
						});
					},
					onLoad: function () {
					}
			   });
			});
			</script>');
        opentable($locale['news_0004']);
        echo render_breadcrumbs();
        echo "<!--news_pre_readmore-->";
        echo "<article class='news-item' style='display:block; width:100%; overflow:hidden;'>\n";
        echo "<h2 class='text-center'>" . $data['news_subject'] . "</h2>\n";
        echo "<div class='news_news text-dark m-t-20 m-b-20'>\n";
        if ($data['news_image_src']) {
            echo "<a class='" . $data['news_ialign'] . " news-image-overlay' href='" . $data['news_image_src'] . "'>\n            <img class='img-responsive' src='" . $data['news_image_src'] . "' alt='" . $data['news_subject'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; overflow:hidden;' /></a>";
        } elseif (!empty($data['news_image']) && !empty($data['news_cat_image_src'])) {
            echo "<a class='" . $data['news_ialign'] . "' href='" . INFUSIONS . "news/news.php?cat_id=" . $data['news_cat_id'] . "'>\n            <img class='img-responsive' src='" . IMAGES_NC . $data['news_cat_image_src'] . "' style='padding:5px; max-height:" . $news_settings['news_photo_h'] . "px; alt='" . $data['news_cat_name'] . "' />\n            </a>";
        }
        echo $data['news_news'];
        echo "</div>\n";
        echo "<div class='news_extended text-dark m-t-20 m-b-20'>" . $data['news_extended'] . "</div>\n";
        echo "<div style='clear:both;'></div>\n";
        echo "<div class='well m-t-5 text-center'>\n";
        echo "<span class='news-action m-r-10'><i class='fa fa-user'></i>" . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "</span>\n";
        echo "<span class='news-action m-r-10'><i class='fa fa-calendar'></i>" . showdate("newsdate", $data['news_datestamp']) . "</span>\n";
        echo "<span class='news-action'><i class='fa fa-eye'></i><span class='text-dark m-r-10'>" . number_format($data['news_reads']) . "</span>\n</span>";
        echo $data['news_allow_comments'] ? display_comments($data['news_comments'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#comments") : '';
        echo $data['news_allow_ratings'] ? "<span class='m-r-10'>" . display_ratings($data['news_sum_rating'], $data['news_count_votes'], INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "#ratings") . " </span>" : '';
        echo "<a class='m-r-10' title='" . $locale['news_0002'] . "' href='" . BASEDIR . "print.php?type=N&amp;item_id=" . $data['news_id'] . "'><i class='fa fa-print'></i></a>";
        echo iADMIN && checkrights("N") ? "<a title='" . $locale['news_0003'] . "' href='" . INFUSIONS . "news/news_admin.php" . $aidlink . "&amp;action=edit&amp;section=news_form&amp;news_id=" . $data['news_id'] . "' title='" . $locale['news_0003'] . "' />" . $locale['news_0003'] . "</a>\n" : "";
        echo "</div>";
        echo "<!--news_sub_readmore-->";
        echo !isset($_GET['readmore']) && $data['news_ext'] == "y" ? "<div class='m-t-20'>\n<a href='" . INFUSIONS . "news/news.php?readmore=" . $data['news_id'] . "' class='button'>" . $locale['news_0001'] . "</a>\n</div>\n" : "";
        if ($data['page_count'] > 0) {
            echo "<div class='text-center m-t-10'>\n" . makepagenav($_GET['rowstart'], 1, $data['page_count'], 3, INFUSIONS . "news/news.php?readmore=" . $_GET['readmore'] . "&amp;") . "\n</div>\n";
        }
        if ($data['news_allow_comments']) {
            echo "<hr />" . showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n";
        }
        if ($data['news_allow_ratings']) {
            echo "<hr />" . showratings("N", $_GET['readmore'], INFUSIONS . "news/news.php?readmore=" . $_GET['readmore']) . "\n";
        }
        echo "</article>\n";
        closetable();
    }
Example #15
0
function member_nav($second = "", $third = "")
{
    global $aidlink;
    $locale = fusion_get_locale();
    echo "<table cellpadding='0' cellspacing='1' width='100%'>\n<tr>\n";
    echo "<td class='tbl2'>\n";
    echo "<a href='" . FUSION_SELF . $aidlink . "'>" . $locale['susp115'] . "</a>\n";
    if ($second && ($second = explode("|", $second))) {
        echo " &gt; <a href='" . $second[0] . "'>" . $second[1] . "</a>\n";
    }
    if ($third && ($third = explode("|", $third))) {
        echo " &gt; <a href='" . $third[0] . "'>" . $third[1] . "</a>\n";
    }
    echo "</td>\n</tr>\n</table>\n";
    echo "<div style='margin:5px'></div>\n";
}
/**
 * Get a user own data
 *
 * @param $key - The column of one user information
 * @return array|null
 */
function fusion_get_userdata($key = NULL)
{
    global $userdata;
    $userdata += array("user_id" => 0, "user_name" => fusion_get_locale("user_guest", LOCALE . LOCALESET . "global.php"), "user_status" => 1, "user_level" => 0, "user_rights" => "", "user_groups" => "", "user_theme" => fusion_get_settings("theme"));
    return $key === NULL ? $userdata : (isset($userdata[$key]) ? $userdata[$key] : $userdata);
}
Example #17
0
 function display_quickReply($info)
 {
     $locale = fusion_get_locale("", FORUM_LOCALE);
     $forum_settings = \PHPFusion\Forums\ForumServer::get_forum_settings();
     $userdata = fusion_get_userdata();
     $qr_form = "<!--sub_forum_thread-->\n";
     $form_url = INFUSIONS . "forum/viewthread.php?thread_id=" . $info['thread_id'];
     $qr_form .= openform('quick_reply_form', 'post', $form_url, array('class' => 'm-b-20 m-t-20'));
     $qr_form .= "<h4 class='m-t-20 pull-left'>" . $locale['forum_0168'] . "</h4>\n";
     $qr_form .= form_textarea('post_message', $locale['forum_0601'], '', array('bbcode' => true, 'required' => true, 'autosize' => true, 'preview' => true, 'form_name' => 'quick_reply_form'));
     $qr_form .= "<div class='m-t-10 pull-right'>\n";
     $qr_form .= form_button('post_quick_reply', $locale['forum_0172'], $locale['forum_0172'], array('class' => 'btn-primary btn-sm m-r-10'));
     $qr_form .= "</div>\n";
     $qr_form .= "<div class='overflow-hide'>\n";
     $qr_form .= form_checkbox('post_smileys', $locale['forum_0169'], '', array('class' => 'm-b-0', 'reverse_label' => TRUE));
     if (array_key_exists("user_sig", $userdata) && $userdata['user_sig']) {
         $qr_form .= form_checkbox('post_showsig', $locale['forum_0170'], '1', array('class' => 'm-b-0', 'reverse_label' => TRUE));
     }
     if ($forum_settings['thread_notify']) {
         $qr_form .= form_checkbox('notify_me', $locale['forum_0171'], $info['user_tracked'], array('class' => 'm-b-0', 'reverse_label' => TRUE));
     }
     $qr_form .= "</div>\n";
     $qr_form .= closeform();
     return (string) $qr_form;
 }
Example #18
0
| Author: PHP-Fusion Development Team
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES . "templates/header.php";
require_once INCLUDES . "comments_include.php";
require_once INCLUDES . "ratings_include.php";
require_once THEMES . "templates/global/custompage.php";
$locale = fusion_get_locale("", LOCALE . LOCALESET . "custom_pages.php");
$cp_data = array();
if (!isset($_GET['page_id']) || !isnum($_GET['page_id'])) {
    redirect("index.php");
}
$_GET['rowstart'] = isset($_GET['rowstart']) && isnum($_GET['rowstart']) ? $_GET['rowstart'] : 0;
$cp_result = dbquery("SELECT * FROM " . DB_CUSTOM_PAGES . "\n            WHERE page_id='" . intval($_GET['page_id']) . "' AND " . groupaccess('page_access') . "\n            " . (multilang_table("CP") ? "AND " . in_group("page_language", LANGUAGE) : ""));
$info = array("title" => "", "error" => "", "body" => "", "count" => 0, "pagenav" => "", "show_comments" => "", "show_ratings" => "");
if (dbrows($cp_result) > 0) {
    $cp_data = dbarray($cp_result);
    add_to_title($locale['global_200'] . $cp_data['page_title']);
    add_breadcrumb(array('link' => BASEDIR . "viewpage.php?page_id=" . $_GET['page_id'], 'title' => $cp_data['page_title']));
    if ($cp_data['page_keywords'] !== "") {
        set_meta("keywords", $cp_data['page_keywords']);
    }
    $info['title'] = $cp_data['page_title'];
Example #19
0
 /**
  * Septenary Header
  */
 public function displayHeader()
 {
     global $aidlink;
     $userdata = fusion_get_userdata();
     $locale = self::$locale;
     echo "<header id='top'>";
     echo "<div class='overlay'>\n";
     $this->open_grid('section-1', 1);
     echo "<div class='row hidden-xs'>\n";
     echo "<div id='logo' class='hidden-xs hidden-md col-lg-3 p-t-5 text-smaller'>\n</div>\n";
     echo "<div class='col-xs-12 col-md-9 col-lg-9 text-right clearfix'>\n";
     echo "<div class='display-inline-block' style='width:30%; float:right;'>\n";
     echo openform('searchform', 'post', BASEDIR . 'search.php?stype=all', array('class' => 'm-b-10'));
     echo form_text('stext', '', '', array('placeholder' => $locale['sept_006'], 'append_button' => TRUE, 'append_type' => "submit", "append_form_value" => $locale['sept_006'], "append_value" => "<i class='fa fa-search'></i> " . $locale['sept_006'], "append_button_name" => "search", 'class' => 'no-border m-b-0'));
     echo closeform();
     echo "</div>\n";
     echo "<ul id='head_nav' class='display-inline-block'>\n";
     $language_opts = '';
     if (count(fusion_get_enabled_languages()) > 1) {
         $language_opts = "<li class='dropdown'>\n";
         $language_opts .= "<a class='dropdown-toggle pointer' data-toggle='dropdown' title='" . fusion_get_locale('UM101') . "'><i class='fa fa-globe fa-lg'></i> " . translate_lang_names(LANGUAGE) . " <span class='caret'></span></a>\n";
         $language_opts .= "<ul class='dropdown-menu' role='menu'>\n";
         $language_switch = fusion_get_language_switch();
         if (!empty($language_switch)) {
             foreach ($language_switch as $folder => $langData) {
                 $language_opts .= "<li class='text-left'><a href='" . $langData['language_link'] . "'>\n";
                 $language_opts .= "<img alt='" . $langData['language_name'] . "' class='m-r-5' src='" . $langData['language_icon_s'] . "'/>\n";
                 $language_opts .= $langData['language_name'];
                 $language_opts .= "</a></li>\n";
             }
         }
         $language_opts .= "</ul>\n";
         $language_opts .= "</li>\n";
     }
     if (!iMEMBER) {
         echo "<li><a href='" . BASEDIR . "login.php'>" . $locale['sept_001'] . "</a></li>\n";
         if (fusion_get_settings("enable_registration")) {
             echo "<li><a href='" . BASEDIR . "register.php'>" . $locale['sept_002'] . "</a></li>\n";
         }
         echo $language_opts;
     } else {
         if (iADMIN) {
             echo "<li>\n<a href='" . ADMIN . $aidlink . "&amp;pagenum=0'>" . $locale['sept_003'] . "</a>\n</li>\n";
         }
         echo "<li>\n<a href='" . BASEDIR . "profile.php?lookup=" . $userdata['user_id'] . "'>" . $locale['sept_004'] . "</a>\n</li>\n";
         echo $language_opts;
         echo "<li>\n<a href='" . BASEDIR . "index.php?logout=yes'>" . $locale['sept_005'] . "</a></li>\n";
     }
     echo "</ul>\n";
     echo "</div>\n";
     echo "</div>\n";
     $this->close_grid(1);
     $this->open_grid('section-2', 1);
     echo "<div class='header-nav'>\n";
     echo showsublinks('') . "\n";
     echo "</div>\n";
     $this->close_grid();
     echo "</div>\n";
     $this->display_Showcase();
     echo "</header>\n";
 }
Example #20
0
{
    $findHTMLTags = "/(href|src)=('|\")((?!(htt|ft)p(s)?:\\/\\/)[^\\']*)/i";
    if (!function_exists("replaceHTMLTags")) {
        function replaceHTMLTags($m)
        {
            $pathInfo = pathinfo($_SERVER['REQUEST_URI']);
            $pathDepth = substr($_SERVER['REQUEST_URI'], -1) == "/" ? substr_count($pathInfo['dirname'], "/") : substr_count($pathInfo['dirname'], "/") - 1;
            $actualDepth = $pathDepth > 0 ? str_repeat("../", $pathDepth) : "";
            $replace = $m[1] . "=" . $m[2] . "./" . $actualDepth . $m[3];
            return $replace;
        }
    }
    return preg_replace_callback("{$findHTMLTags}", "replaceHTMLTags", $output);
}
add_handler("replaceDir");
$locale = fusion_get_locale("", LOCALE . LOCALESET . "error.php");
$data = array("title" => $locale['errunk'], "image" => IMAGES . "unknown.png");
if (isset($_GET['code'])) {
    switch ($_GET['code']) {
        case 401:
            header("HTTP/1.1 401 Unauthorized");
            $data = array("title" => $locale['err401'], "image" => IMAGES . "error/401.png");
            break;
        case 403:
            header("HTTP/1.1 403 Forbidden");
            $data = array("title" => $locale['err403'], "image" => IMAGES . "error/403.png");
            break;
        case 404:
            header("HTTP/1.1 404 Not Found");
            $data = array("title" => $locale['err404'], "image" => IMAGES . "error/404.png");
            break;
Example #21
0
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: admin/blog.php
| Author: Frederick MC Chan (Chan)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
$formaction = FUSION_REQUEST;
$locale = fusion_get_locale();
$userdata = fusion_get_userdata();
$data = array('blog_id' => 0, 'blog_draft' => 0, 'blog_sticky' => 0, 'blog_blog' => '', 'blog_datestamp' => time(), 'blog_extended' => '', 'blog_keywords' => '', 'blog_breaks' => 'yes', 'blog_allow_comments' => 1, 'blog_allow_ratings' => 1, 'blog_language' => LANGUAGE, 'blog_visibility' => 0, 'blog_subject' => '', 'blog_start' => '', 'blog_end' => '', 'blog_cat' => 0, 'blog_image' => '', 'blog_ialign' => 'pull-left');
if (fusion_get_settings('tinymce_enabled') != 1) {
    $data['blog_breaks'] = isset($_POST['line_breaks']) ? "yes" : "no";
} else {
    $data['blog_breaks'] = "no";
}
if (isset($_POST['save'])) {
    $blog_blog = "";
    if ($_POST['blog_blog']) {
        $blog_blog = str_replace("src='" . str_replace("../", "", IMAGES_B), "src='" . IMAGES_B, stripslashes($_POST['blog_blog']));
        $blog_blog = parse_textarea($blog_blog, FALSE, FALSE);
    }
    $blog_extended = "";
    if ($_POST['blog_extended']) {
Example #22
0
/**
 * Displays News Form
 */
function display_news_form()
{
    global $aidlink;
    if (isset($_POST['cancel'])) {
        redirect(FUSION_SELF . $aidlink);
    }
    $formaction = FUSION_REQUEST;
    $locale = fusion_get_locale();
    $userdata = fusion_get_userdata();
    $news_settings = fusion_get_settings("news");
    $edit = isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['news_id']) && isnum($_GET['news_id']) ? TRUE : FALSE;
    add_breadcrumb(array('link' => '', 'title' => $edit ? $locale['news_0003'] : $locale['news_0002']));
    $data = array('news_id' => 0, 'news_draft' => 0, 'news_sticky' => 0, 'news_news' => '', 'news_datestamp' => time(), 'news_extended' => '', 'news_keywords' => '', 'news_breaks' => 'n', 'news_allow_comments' => 1, 'news_allow_ratings' => 1, 'news_language' => LANGUAGE, 'news_visibility' => 0, 'news_subject' => '', 'news_start' => '', 'news_end' => '', 'news_cat' => 0, 'news_image' => '', 'news_ialign' => 'pull-left');
    if (fusion_get_settings("tinymce_enabled")) {
        $data['news_breaks'] = 'n';
    } else {
        $data['news_breaks'] = 'y';
    }
    if (isset($_POST['save']) or isset($_POST['save_and_close'])) {
        $news_news = "";
        if ($_POST['news_news']) {
            $news_news = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_news']) : stripslashes($_POST['news_news']));
            $news_news = parse_textarea($news_news);
        }
        $news_extended = "";
        if ($_POST['news_extended']) {
            $news_extended = str_replace("src='" . str_replace("../", "", IMAGES_N), "src='" . IMAGES_N, fusion_get_settings('allow_php_exe') ? htmlspecialchars($_POST['news_extended']) : stripslashes($_POST['news_extended']));
            $news_extended = parse_textarea($news_extended);
        }
        $data = array('news_id' => form_sanitizer($_POST['news_id'], 0, 'news_id'), 'news_subject' => form_sanitizer($_POST['news_subject'], '', 'news_subject'), 'news_cat' => form_sanitizer($_POST['news_cat'], 0, 'news_cat'), 'news_news' => form_sanitizer($news_news, "", "news_news"), 'news_extended' => form_sanitizer($news_extended, "", "news_extended"), 'news_keywords' => form_sanitizer($_POST['news_keywords'], '', 'news_keywords'), 'news_datestamp' => form_sanitizer($_POST['news_datestamp'], '', 'news_datestamp'), 'news_start' => form_sanitizer($_POST['news_start'], 0, 'news_start'), 'news_end' => form_sanitizer($_POST['news_end'], 0, 'news_end'), 'news_visibility' => form_sanitizer($_POST['news_visibility'], 0, 'news_visibility'), 'news_draft' => isset($_POST['news_draft']) ? "1" : "0", 'news_sticky' => isset($_POST['news_sticky']) ? "1" : "0", 'news_allow_comments' => isset($_POST['news_allow_comments']) ? "1" : "0", 'news_allow_ratings' => isset($_POST['news_allow_ratings']) ? "1" : "0", 'news_language' => form_sanitizer($_POST['news_language'], '', 'news_language'), 'news_image' => "", 'news_ialign' => "", 'news_image_t1' => "", 'news_image_t2' => "");
        if (isset($_FILES['news_image'])) {
            // when files is uploaded.
            $upload = form_sanitizer($_FILES['news_image'], '', 'news_image');
            if (!empty($upload) && !$upload['error']) {
                $data['news_image'] = $upload['image_name'];
                $data['news_image_t1'] = $upload['thumb1_name'];
                $data['news_image_t2'] = $upload['thumb2_name'];
                $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
            }
        } else {
            // when files not uploaded. but there should be exist check.
            $data['news_image'] = isset($_POST['news_image']) ? $_POST['news_image'] : "";
            $data['news_image_t1'] = isset($_POST['news_image_t1']) ? $_POST['news_image_t1'] : "";
            $data['news_image_t2'] = isset($_POST['news_image_t2']) ? $_POST['news_image_t2'] : "";
            $data['news_ialign'] = isset($_POST['news_ialign']) ? form_sanitizer($_POST['news_ialign'], "pull-left", "news_ialign") : "pull-left";
        }
        if (fusion_get_settings('tinymce_enabled') != 1) {
            $data['news_breaks'] = isset($_POST['line_breaks']) ? "y" : "n";
        } else {
            $data['news_breaks'] = "n";
        }
        if ($data['news_sticky'] == "1") {
            $result = dbquery("UPDATE " . DB_NEWS . " SET news_sticky='0' WHERE news_sticky='1'");
        }
        // reset other sticky
        // delete image
        if (isset($_POST['del_image'])) {
            if (!empty($data['news_image']) && file_exists(IMAGES_N . $data['news_image'])) {
                unlink(IMAGES_N . $data['news_image']);
            }
            if (!empty($data['news_image_t1']) && file_exists(IMAGES_N_T . $data['news_image_t1'])) {
                unlink(IMAGES_N_T . $data['news_image_t1']);
            }
            if (!empty($data['news_image_t2']) && file_exists(IMAGES_N_T . $data['news_image_t2'])) {
                unlink(IMAGES_N_T . $data['news_image_t2']);
            }
            $data['news_image'] = "";
            $data['news_image_t1'] = "";
            $data['news_image_t2'] = "";
        }
        if (defender::safe()) {
            if (dbcount("('news_id')", DB_NEWS, "news_id='" . $data['news_id'] . "'")) {
                dbquery_insert(DB_NEWS, $data, 'update');
                addNotice('success', $locale['news_0101']);
            } else {
                $data['news_name'] = $userdata['user_id'];
                dbquery_insert(DB_NEWS, $data, 'save');
                addNotice('success', $locale['news_0100']);
            }
            if (isset($_POST['save_and_close'])) {
                redirect(clean_request("", array("ref"), FALSE));
            } else {
                redirect(FUSION_REQUEST);
            }
        }
    } elseif (isset($_GET['action']) && $_GET['action'] == "edit" && (isset($_POST['news_id']) && isnum($_POST['news_id'])) || isset($_GET['news_id']) && isnum($_GET['news_id'])) {
        $result = dbquery("SELECT * FROM " . DB_NEWS . " WHERE news_id='" . (isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id']) . "'");
        if (dbrows($result)) {
            $data = dbarray($result);
        } else {
            redirect(FUSION_SELF . $aidlink);
        }
    }
    $result = dbquery("SELECT news_cat_id, news_cat_name FROM " . DB_NEWS_CATS . " " . (multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : "") . " ORDER BY news_cat_name");
    $news_cat_opts = array();
    $news_cat_opts['0'] = $locale['news_0202'];
    if (dbrows($result)) {
        while ($odata = dbarray($result)) {
            $news_cat_opts[$odata['news_cat_id']] = $odata['news_cat_name'];
        }
    }
    echo "<div class='m-t-20'>\n";
    $news_settings = get_settings("news");
    echo openform('news_form', 'post', $formaction, array('enctype' => 1));
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    echo form_hidden('news_id', "", $data['news_id']);
    echo form_text('news_subject', $locale['news_0200'], $data['news_subject'], array('required' => 1, 'max_length' => 200, 'error_text' => $locale['news_0250']));
    echo form_select('news_keywords', $locale['news_0205'], $data['news_keywords'], array("max_length" => 320, "placeholder" => $locale['news_0205a'], "width" => "100%", "error_text" => $locale['news_0255'], "tags" => TRUE, "multiple" => TRUE));
    echo "<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_start', $locale['news_0206'], $data['news_start'], array('placeholder' => $locale['news_0208'], "join_to_id" => "news_end"));
    echo "</div>\n<div class='pull-left m-r-10 display-inline-block'>\n";
    echo form_datepicker('news_end', $locale['news_0207'], $data['news_end'], array('placeholder' => $locale['news_0208'], "join_from_id" => "news_start"));
    echo "</div>\n";
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside('');
    echo form_select_tree("news_cat", $locale['news_0201'], $data['news_cat'], array("width" => "100%", "inline" => TRUE, "parent_value" => $locale['news_0202'], "query" => multilang_table("NS") ? "WHERE news_cat_language='" . LANGUAGE . "'" : ""), DB_NEWS_CATS, "news_cat_name", "news_cat_id", "news_cat_parent");
    echo form_select('news_visibility', $locale['news_0209'], $data['news_visibility'], array('options' => fusion_get_groups(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    if (multilang_table("NS")) {
        echo form_select('news_language', $locale['global_ML100'], $data['news_language'], array('options' => fusion_get_enabled_languages(), 'placeholder' => $locale['choose'], 'width' => '100%', "inline" => TRUE));
    } else {
        echo form_hidden('news_language', '', $data['news_language']);
    }
    echo form_button('cancel', $locale['cancel'], $locale['cancel'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    closeside();
    echo "</div>\n</div>\n";
    $snippetSettings = array("required" => TRUE, "preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203a'], "form_name" => "news_form");
    if (fusion_get_settings("tinymce_enabled")) {
        $snippetSettings = array("required" => TRUE, "type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_news', $locale['news_0203'], $data['news_news'], $snippetSettings);
    if (!fusion_get_settings("tinymce_enabled")) {
        $extendedSettings = array("preview" => TRUE, "html" => TRUE, "autosize" => TRUE, "placeholder" => $locale['news_0203b'], "form_name" => "news_form");
    } else {
        $extendedSettings = array("type" => "tinymce", "tinymce" => "advanced");
    }
    echo form_textarea('news_extended', $locale['news_0204'], $data['news_extended'], $extendedSettings);
    // second row
    echo "<div class='row'>\n";
    echo "<div class='col-xs-12 col-sm-12 col-md-7 col-lg-8'>\n";
    openside('');
    if ($data['news_image'] != "" && $data['news_image_t1'] != "") {
        $image_thumb = get_news_image_path($data['news_image'], $data['news_image_t1'], $data['news_image_t2']);
        if (!$image_thumb) {
            $image_thumb = IMAGES . "imagenotfound70.jpg";
        }
        echo "<div class='row'>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        echo "<label><img class='img-responsive img-thumbnail' src='" . $image_thumb . "' alt='" . $locale['news_0216'] . "' /><br />\n";
        echo "<input type='checkbox' name='del_image' value='y' /> " . $locale['delete'] . "</label>\n";
        echo "</div>\n";
        echo "<div class='col-xs-12 col-sm-6'>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions, "inline" => FALSE));
        echo "</div>\n</div>\n";
        echo "<input type='hidden' name='news_image' value='" . $data['news_image'] . "' />\n";
        echo "<input type='hidden' name='news_image_t1' value='" . $data['news_image_t1'] . "' />\n";
        echo "<input type='hidden' name='news_image_t2' value='" . $data['news_image_t2'] . "' />\n";
    } else {
        $file_input_options = array('upload_path' => IMAGES_N, 'max_width' => $news_settings['news_photo_max_w'], 'max_height' => $news_settings['news_photo_max_h'], 'max_byte' => $news_settings['news_photo_max_b'], 'thumbnail' => 1, 'thumbnail_w' => $news_settings['news_thumb_w'], 'thumbnail_h' => $news_settings['news_thumb_h'], 'thumbnail_folder' => 'thumbs', 'delete_original' => 0, 'thumbnail2' => 1, 'thumbnail2_w' => $news_settings['news_photo_w'], 'thumbnail2_h' => $news_settings['news_photo_h'], 'type' => 'image');
        echo form_fileinput("news_image", $locale['news_0216'], "", $file_input_options);
        echo "<div class='small m-b-10'>" . sprintf($locale['news_0217'], parsebytesize($news_settings['news_photo_max_b'])) . "</div>\n";
        $alignOptions = array('pull-left' => $locale['left'], 'news-img-center' => $locale['center'], 'pull-right' => $locale['right']);
        echo form_select('news_ialign', $locale['news_0218'], $data['news_ialign'], array("options" => $alignOptions));
    }
    closeside();
    openside('');
    echo "<label><input type='checkbox' name='news_draft' value='yes'" . ($data['news_draft'] ? "checked='checked'" : "") . " /> " . $locale['news_0210'] . "</label><br />\n";
    echo "<label><input type='checkbox' name='news_sticky' value='yes'" . ($data['news_sticky'] ? "checked='checked'" : "") . "  /> " . $locale['news_0211'] . "</label><br />\n";
    echo form_hidden('news_datestamp', '', $data['news_datestamp']);
    if (fusion_get_settings("tinymce_enabled") != 1) {
        echo "<label><input type='checkbox' name='line_breaks' value='yes'" . ($data['news_breaks'] ? "checked='checked'" : "") . " /> " . $locale['news_0212'] . "</label><br />\n";
    }
    closeside();
    echo "</div>\n<div class='col-xs-12 col-sm-12 col-md-5 col-lg-4'>\n";
    openside("");
    if (!fusion_get_settings("comments_enabled") || !fusion_get_settings("ratings_enabled")) {
        $sys = "";
        if (!fusion_get_settings("comments_enabled") && !fusion_get_settings("ratings_enabled")) {
            $sys = $locale['comments_ratings'];
        } elseif (!fusion_get_settings("comments_enabled")) {
            $sys = $locale['comments'];
        } else {
            $sys = $locale['ratings'];
        }
        echo "<div class='alert alert-warning'>" . sprintf($locale['news_0253'], $sys) . "</div>\n";
    }
    echo "<label><input type='checkbox' name='news_allow_comments' value='yes' onclick='SetRatings();'" . ($data['news_allow_comments'] ? "checked='checked'" : "") . " /> " . $locale['news_0213'] . "</label><br/>";
    echo "<label><input type='checkbox' name='news_allow_ratings' value='yes'" . ($data['news_allow_ratings'] ? "checked='checked'" : "") . " /> " . $locale['news_0214'] . "</label>";
    closeside();
    echo "</div>\n</div>\n";
    echo form_button('preview', $locale['news_0240'], $locale['news_0240'], array('class' => 'btn-default m-r-10'));
    echo form_button('save', $locale['news_0241'], $locale['news_0241'], array('class' => 'btn-success'));
    echo form_button("save_and_close", "Save and Close", "save_and_close", array("class" => "btn-primary m-l-10"));
    echo closeform();
    echo "</div>\n";
}
Example #23
0
$inf_version = "1.00";
$inf_developer = "PHP Fusion Development Team";
$inf_email = "";
$inf_weburl = "https://www.php-fusion.co.uk";
$inf_folder = "member_poll_panel";
// Multilanguage table for Administration
$inf_mlt[] = array("title" => $locale['setup_3207'], "rights" => "PO");
// Create tables
$inf_newtable[] = DB_POLL_VOTES . " (\n\tvote_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n\tvote_user MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',\n\tvote_opt SMALLINT(2) UNSIGNED NOT NULL DEFAULT '0',\n\tpoll_id MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',\n\tPRIMARY KEY (vote_id)\n) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci";
$inf_newtable[] = DB_POLLS . " (\n\tpoll_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n\tpoll_title VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_0 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_1 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_2 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_3 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_4 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_5 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_6 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_7 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_8 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_opt_9 VARCHAR(200) NOT NULL DEFAULT '',\n\tpoll_started INT(10) UNSIGNED NOT NULL DEFAULT '0',\n\tpoll_ended INT(10) UNSIGNED NOT NULL DEFAULT '0',\n\tpoll_language VARCHAR(50) NOT NULL DEFAULT '" . LANGUAGE . "',\n\tPRIMARY KEY (poll_id)\n) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci";
// Automatic enable of the latest articles panel
$inf_insertdbrow[] = DB_PANELS . " (panel_name, panel_filename, panel_content, panel_side, panel_order, panel_type, panel_access, panel_display, panel_status, panel_url_list, panel_restriction) VALUES('" . $locale['setup_3407'] . "', 'member_poll_panel', '', '1', '5', 'file', '0', '0', '1', '', '0')";
// Position these links under Content Administration
$inf_insertdbrow[] = DB_ADMIN . " (admin_rights, admin_image, admin_title, admin_link, admin_page) VALUES ('PO', 'polls.gif', '" . $locale['setup_3022'] . "', '" . INFUSIONS . "member_poll_panel/member_poll_panel_admin.php', '1')";
$enabled_languages = makefilelist(LOCALE, ".|..", TRUE, "folders");
// Create a link for all installed languages
if (!empty($enabled_languages)) {
    foreach ($enabled_languages as $language) {
        $locale = fusion_get_locale("", LOCALE . $language . "/setup.php");
        $mlt_insertdbrow[$language][] = DB_SITE_LINKS . " (link_name, link_url, link_visibility, link_position, link_window, link_order, link_language) VALUES ('" . $locale['setup_3022'] . "', '" . INFUSIONS . "members_poll_panel/polls_archive.php', '0', '1', '0', '2', '" . $language . "')";
        $mlt_deldbrow[$language][] = DB_SITE_LINKS . " WHERE link_url='" . INFUSIONS . "members_poll_panel/polls_archive.php' AND link_language='" . $language . "'";
    }
} else {
    $inf_insertdbrow[] = DB_SITE_LINKS . " (link_name, link_url, link_visibility, link_position, link_window, link_order, link_language) VALUES ('" . $locale['setup_3022'] . "', '" . INFUSIONS . "members_poll_panel/polls_archive.php', '0', '1', '0', '2', '" . LANGUAGE . "')";
    $inf_deldbrow[] = DB_SITE_LINKS . " WHERE link_url='infusions/member_poll_panel/polls_archive.php' AND link_language='" . LANGUAGE . "'";
}
// Defuse cleaning
$inf_droptable[] = DB_POLLS;
$inf_droptable[] = DB_POLL_VOTES;
$inf_deldbrow[] = DB_PANELS . " WHERE panel_name='" . $locale['setup_3407'] . "'";
$inf_deldbrow[] = DB_ADMIN . " WHERE admin_rights='PO'";
        if (isset($_POST['multilang_tables'])) {
            $result = dbquery("UPDATE " . DB_LANGUAGE_TABLES . " SET mlt_status='0'");
            for ($i = 0; $i < count($_POST['multilang_tables']); $i++) {
                $ml_tables .= stripinput($_POST['multilang_tables'][$i]);
                if ($i != count($_POST['multilang_tables']) - 1) {
                    $ml_tables .= ".";
                }
            }
            $ml_tables = explode('.', $ml_tables);
            for ($i = 0; $i < count($ml_tables); $i++) {
                $result = dbquery("UPDATE " . DB_LANGUAGE_TABLES . " SET mlt_status='1' WHERE mlt_rights='" . $ml_tables[$i] . "'");
            }
        }
        // reset back to current language
        $locale = fusion_get_locale('', LOCALE . LOCALESET . 'admin/settings.php');
        $locale += fusion_get_locale('', LOCALE . LOCALESET . 'setup.php');
        addNotice('success', $locale['900']);
        redirect(FUSION_SELF . $aidlink);
    } else {
        addNotice('success', $locale['901']);
    }
}
opentable($locale['682ML']);
echo "<div class='well'>" . $locale['language_description'] . "</div>";
echo openform('settingsform', 'post', FUSION_SELF . $aidlink);
echo form_hidden('old_localeset', '', fusion_get_settings("locale"));
echo form_hidden('old_enabled_languages', '', fusion_get_settings("enabled_languages"));
echo form_select('localeset', $locale['417'], fusion_get_settings("locale"), array('options' => fusion_get_enabled_languages(), "inline" => TRUE));
echo "<div class='row'>\n";
echo "<div class='col-xs-12 col-sm-3'>\n";
echo "<strong>" . $locale['684ML'] . "</strong>\n";
Example #25
0
$inf_version = "1.00";
$inf_developer = "PHP Fusion Development Team";
$inf_email = "";
$inf_weburl = "https://www.php-fusion.co.uk";
$inf_folder = "shoutbox_panel";
// The folder in which the infusion resides.
$inf_image = "shout.png";
//Administration panel
$inf_adminpanel[] = array("title" => $locale['SB_admin1'], "image" => $inf_image, "panel" => "shoutbox_admin.php", "rights" => "S", "page" => 5);
//Multilanguage table for Administration
$inf_mlt[] = array("title" => $inf_title, "rights" => "SB");
// Delete any items not required below.
$inf_newtable[] = DB_SHOUTBOX . " (\n    shout_id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,\n    shout_name VARCHAR(50) NOT NULL DEFAULT '',\n    shout_message VARCHAR(200) NOT NULL DEFAULT '',\n    shout_datestamp INT(10) UNSIGNED NOT NULL DEFAULT '0',\n    shout_ip VARCHAR(45) NOT NULL DEFAULT '',\n    shout_ip_type TINYINT(1) UNSIGNED NOT NULL DEFAULT '4',\n    shout_hidden TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',\n    shout_language VARCHAR(50) NOT NULL DEFAULT '',\n    PRIMARY KEY (shout_id),\n    KEY shout_datestamp (shout_datestamp)\n    ) ENGINE=MyISAM DEFAULT CHARSET=UTF8 COLLATE=utf8_unicode_ci";
// shoutbox deletion of MLT shouts
$enabled_languages = makefilelist(LOCALE, ".|..", TRUE, "folders");
if (!empty($enabled_languages)) {
    foreach ($enabled_languages as $language) {
        include LOCALE . $language . "/setup.php";
        $mlt_deldbrow[$language][] = DB_SHOUTBOX . " WHERE shout_language='" . $language . "'";
    }
}
//Infuse insertations
$inf_insertdbrow[] = DB_PANELS . " (panel_name, panel_filename, panel_content, panel_side, panel_order, panel_type, panel_access, panel_display, panel_status, panel_url_list, panel_restriction) VALUES('" . fusion_get_locale("SB_title", SHOUTBOX_LOCALE) . "', 'shoutbox_panel', '', '4', '3', 'file', '0', '1', '1', '', '0')";
$inf_insertdbrow[] = DB_SETTINGS_INF . " (settings_name, settings_value, settings_inf) VALUES('visible_shouts', '5', '" . $inf_folder . "')";
$inf_insertdbrow[] = DB_SETTINGS_INF . " (settings_name, settings_value, settings_inf) VALUES('guest_shouts', '0', '" . $inf_folder . "')";
//Defuse cleaning
$inf_droptable[] = DB_SHOUTBOX;
$inf_deldbrow[] = DB_ADMIN . " WHERE admin_rights='S'";
$inf_deldbrow[] = DB_PANELS . " WHERE panel_filename='" . $inf_folder . "'";
$inf_deldbrow[] = DB_SETTINGS_INF . " WHERE settings_inf='" . $inf_folder . "'";
$inf_deldbrow[] = DB_LANGUAGE_TABLES . " WHERE mlt_rights='SB'";
Example #26
0
 public function cache_tags()
 {
     $tag_query = "SELECT * FROM " . DB_FORUM_TAGS . " WHERE tag_status=1\n            " . (multilang_table("FO") ? "AND tag_language='" . LANGUAGE . "'" : "") . "\n            ORDER BY tag_title ASC";
     $tag_result = dbquery($tag_query);
     if (dbrows($tag_result) > 0) {
         while ($data = dbarray($tag_result)) {
             $data['tag_link'] = FORUM . "tags.php?tag_id=" . $data['tag_id'];
             $data['tag_active'] = isset($_GET['viewtags']) && isset($_GET['tag_id']) && $_GET['tag_id'] == $data['tag_id'] ? TRUE : FALSE;
             $this->tag_info['tags'][$data['tag_id']] = $data;
             $thread_query = "SELECT * FROM " . DB_FORUM_THREADS . " WHERE " . in_group('thread_tags', $data['tag_id']) . " ORDER BY thread_lastpost DESC LIMIT 1";
             $thread_result = dbquery($thread_query);
             $thread_rows = dbrows($thread_result);
             if ($thread_rows > 0) {
                 $tData = dbarray($thread_result);
                 $this->tag_info['tags'][$data['tag_id']]['threads'] = $tData;
             }
         }
         // More
         $this->tag_info['tags'][0] = array('tag_id' => 0, 'tag_link' => FORUM . "tags.php", 'tag_title' => fusion_get_locale("global_700") . "&hellip;", 'tag_active' => '', 'tag_color' => '');
     }
 }
Example #27
0
 protected function verify_image_upload()
 {
     $locale = fusion_get_locale();
     require_once INCLUDES . "infusions_include.php";
     if ($this->field_config['multiple']) {
         $target_folder = $this->field_config['path'];
         $target_width = $this->field_config['max_width'];
         $target_height = $this->field_config['max_height'];
         $max_size = $this->field_config['max_byte'];
         $delete_original = $this->field_config['delete_original'];
         $thumb1 = $this->field_config['thumbnail'];
         $thumb2 = $this->field_config['thumbnail2'];
         $thumb1_ratio = 1;
         $thumb1_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/";
         $thumb1_suffix = $this->field_config['thumbnail_suffix'];
         $thumb1_width = $this->field_config['thumbnail_w'];
         $thumb1_height = $this->field_config['thumbnail_h'];
         $thumb2_ratio = 0;
         $thumb2_folder = $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/";
         $thumb2_suffix = $this->field_config['thumbnail2_suffix'];
         $thumb2_width = $this->field_config['thumbnail2_w'];
         $thumb2_height = $this->field_config['thumbnail2_h'];
         $query = '';
         if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][0]) && $this->safe()) {
             $result = array();
             for ($i = 0; $i <= count($_FILES[$this->field_config['input_name']]['name']) - 1; $i++) {
                 if (is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name'][$i])) {
                     $image = $_FILES[$this->field_config['input_name']];
                     $target_name = $_FILES[$this->field_config['input_name']]['name'][$i];
                     if ($target_name != "" && !preg_match("/[^a-zA-Z0-9_-]/", $target_name)) {
                         $image_name = $target_name;
                     } else {
                         $image_name = stripfilename(substr($image['name'][$i], 0, strrpos($image['name'][$i], ".")));
                     }
                     $image_ext = strtolower(strrchr($image['name'][$i], "."));
                     $image_res = array();
                     if (filesize($image['tmp_name'][$i]) > 10 && @getimagesize($image['tmp_name'][$i])) {
                         $image_res = @getimagesize($image['tmp_name'][$i]);
                     }
                     $image_info = array("image" => FALSE, "image_name" => $image_name . $image_ext, "image_ext" => $image_ext, "image_size" => $image['size'], "image_width" => $image_res[0], "image_height" => $image_res[1], "thumb1" => FALSE, "thumb1_name" => "", "thumb2" => FALSE, "thumb2_name" => "", "error" => 0);
                     if ($image_ext == ".gif") {
                         $filetype = 1;
                     } elseif ($image_ext == ".jpg") {
                         $filetype = 2;
                     } elseif ($image_ext == ".png") {
                         $filetype = 3;
                     } else {
                         $filetype = FALSE;
                     }
                     if ($image['size'][$i] > $max_size) {
                         // Invalid file size
                         $image_info['error'] = 1;
                     } elseif (!$filetype || !verify_image($image['tmp_name'][$i])) {
                         // Unsupported image type
                         $image_info['error'] = 2;
                     } elseif ($image_res[0] > $target_width || $image_res[1] > $target_height) {
                         // Invalid image resolution
                         $image_info['error'] = 3;
                     } else {
                         if (!file_exists($target_folder)) {
                             mkdir($target_folder, 0755);
                         }
                         $image_name_full = filename_exists($target_folder, $image_name . $image_ext);
                         $image_name = substr($image_name_full, 0, strrpos($image_name_full, "."));
                         $image_info['image_name'] = $image_name_full;
                         $image_info['image'] = TRUE;
                         move_uploaded_file($image['tmp_name'][$i], $target_folder . $image_name_full);
                         if (function_exists("chmod")) {
                             chmod($target_folder . $image_name_full, 0755);
                         }
                         if ($query && !dbquery($query)) {
                             // Invalid query string
                             $image_info['error'] = 4;
                             if (file_exists($target_folder . $image_name_full)) {
                                 @unlink($target_folder . $image_name_full);
                             }
                         } elseif ($thumb1 || $thumb2) {
                             require_once INCLUDES . "photo_functions_include.php";
                             $noThumb = FALSE;
                             if ($thumb1) {
                                 if ($image_res[0] <= $thumb1_width && $image_res[1] <= $thumb1_height) {
                                     $noThumb = TRUE;
                                     $image_info['thumb1_name'] = $image_info['image_name'];
                                     $image_info['thumb1'] = TRUE;
                                 } else {
                                     if (!file_exists($thumb1_folder)) {
                                         mkdir($thumb1_folder, 0755, TRUE);
                                     }
                                     $image_name_t1 = filename_exists($thumb1_folder, $image_name . $thumb1_suffix . $image_ext);
                                     $image_info['thumb1_name'] = $image_name_t1;
                                     $image_info['thumb1'] = TRUE;
                                     if ($thumb1_ratio == 0) {
                                         createthumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width, $thumb1_height);
                                     } else {
                                         createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb1_folder . $image_name_t1, $thumb1_width);
                                     }
                                 }
                             }
                             if ($thumb2) {
                                 if ($image_res[0] < $thumb2_width && $image_res[1] < $thumb2_height) {
                                     $noThumb = TRUE;
                                     $image_info['thumb2_name'] = $image_info['image_name'];
                                     $image_info['thumb2'] = TRUE;
                                 } else {
                                     if (!file_exists($thumb2_folder)) {
                                         mkdir($thumb2_folder, 0755, TRUE);
                                     }
                                     $image_name_t2 = filename_exists($thumb2_folder, $image_name . $thumb2_suffix . $image_ext);
                                     $image_info['thumb2_name'] = $image_name_t2;
                                     $image_info['thumb2'] = TRUE;
                                     if ($thumb2_ratio == 0) {
                                         createthumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width, $thumb2_height);
                                     } else {
                                         createsquarethumbnail($filetype, $target_folder . $image_name_full, $thumb2_folder . $image_name_t2, $thumb2_width);
                                     }
                                 }
                             }
                             if ($delete_original && !$noThumb) {
                                 unlink($target_folder . $image_name_full);
                                 $image_info['image'] = FALSE;
                             }
                         }
                     }
                 } else {
                     $image_info = array("error" => 5);
                 }
                 if ($image_info['error'] != 0) {
                     $this->stop();
                     // return FALSE if possible
                     switch ($image_info['error']) {
                         case 1:
                             // Invalid file size
                             addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
                             self::setInputError($this->field_name);
                             break;
                         case 2:
                             // Unsupported image type
                             addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
                             self::setInputError($this->field_name);
                             break;
                         case 3:
                             // Invalid image resolution
                             addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
                             self::setInputError($this->field_name);
                             break;
                         case 4:
                             // Invalid query string
                             addNotice('danger', $locale['df_422']);
                             self::setInputError($this->field_name);
                             break;
                         case 5:
                             // Image not uploaded
                             addNotice('danger', $locale['df_423']);
                             self::setInputError($this->field_name);
                             break;
                     }
                     $result[$i] = $image_info;
                 } else {
                     $result[$i] = $image_info;
                 }
             }
             // end for
             return $result;
         } else {
             return array();
         }
     } else {
         if (!empty($_FILES[$this->field_config['input_name']]['name']) && is_uploaded_file($_FILES[$this->field_config['input_name']]['tmp_name']) && $this->safe()) {
             $upload = upload_image($this->field_config['input_name'], $_FILES[$this->field_config['input_name']]['name'], $this->field_config['path'], $this->field_config['max_width'], $this->field_config['max_height'], $this->field_config['max_byte'], $this->field_config['delete_original'], $this->field_config['thumbnail'], $this->field_config['thumbnail2'], 1, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail_suffix'], $this->field_config['thumbnail_w'], $this->field_config['thumbnail_h'], 0, $this->field_config['path'] . $this->field_config['thumbnail_folder'] . "/", $this->field_config['thumbnail2_suffix'], $this->field_config['thumbnail2_w'], $this->field_config['thumbnail2_h']);
             if ($upload['error'] != 0) {
                 $this->stop();
                 switch ($upload['error']) {
                     case 1:
                         // Invalid file size
                         addNotice('danger', sprintf($locale['df_416'], parsebytesize($this->field_config['max_byte'])));
                         self::setInputError($this->field_name);
                         break;
                     case 2:
                         // Unsupported image type
                         addNotice('danger', sprintf($locale['df_417'], ".gif .jpg .png"));
                         self::setInputError($this->field_name);
                         break;
                     case 3:
                         // Invalid image resolution
                         addNotice('danger', sprintf($locale['df_421'], $this->field_config['max_width'], $this->field_config['max_height']));
                         self::setInputError($this->field_name);
                         break;
                     case 4:
                         // Invalid query string
                         addNotice('danger', $locale['df_422']);
                         self::setInputError($this->field_name);
                         break;
                     case 5:
                         // Image not uploaded
                         addNotice('danger', $locale['df_423']);
                         self::setInputError($this->field_name);
                         break;
                 }
                 return $upload;
             } else {
                 return $upload;
             }
         } else {
             return array();
         }
     }
 }
Example #28
0
 public function get_profile_output()
 {
     $this->method = "display";
     global $locale, $userdata, $aidlink;
     $section_links = $this->renderPageLink();
     $this->info['section'] = $section_links;
     $_GET['section'] = isset($_GET['section']) && isset($section_links[$_GET['section']]) ? $_GET['section'] : 1;
     if (!empty($this->userData['user_avatar']) && file_exists(IMAGES . "avatars/" . $this->userData['user_avatar'])) {
         $this->userData['user_avatar'] = IMAGES . "avatars/" . $this->userData['user_avatar'];
     } else {
         $this->userData['user_avatar'] = IMAGES . "avatars/noavatar150.png";
     }
     $this->info['core_field']['profile_user_avatar'] = array('title' => $locale['u186'], 'value' => $this->userData['user_avatar'], 'status' => $this->userData['user_status']);
     // user name
     $this->info['core_field']['profile_user_name'] = array('title' => $locale['u068'], 'value' => $this->userData['user_name']);
     // user level
     $this->info['core_field']['profile_user_level'] = array('title' => $locale['u063'], 'value' => getgroupname($this->userData['user_level']));
     // user email
     if (iADMIN || $this->userData['user_hide_email'] == 0) {
         $this->info['core_field']['profile_user_email'] = array('title' => $locale['u064'], 'value' => hide_email($this->userData['user_email'], fusion_get_locale("UM061a", LOCALE . LOCALESET . "global.php")));
     }
     // user joined
     $this->info['core_field']['profile_user_joined'] = array('title' => $locale['u066'], 'value' => showdate("longdate", $this->userData['user_joined']));
     // user last visit
     $lastVisit = $this->userData['user_lastvisit'] ? showdate("longdate", $this->userData['user_lastvisit']) : $locale['u042'];
     $this->info['core_field']['profile_user_visit'] = array('title' => $locale['u067'], 'value' => $lastVisit);
     // user status
     if (iADMIN && $this->userData['user_status'] > 0) {
         $this->info['core_field']['profile_user_status'] = array('title' => $locale['u055'], 'value' => getuserstatus($this->userData['user_status']));
         $this->info['core_field']['profile_user_reason'] = array('title' => $locale['u056'], 'value' => $this->userData['suspend_reason']);
     }
     // IP
     $this->info['core_field']['profile_user_ip'] = array();
     if (iADMIN && checkrights("M")) {
         $this->info['core_field']['profile_user_ip'] = array('title' => $locale['u049'], 'value' => $this->userData['user_ip']);
     }
     // Groups - need translating.
     $this->info['core_field']['profile_user_group']['title'] = $locale['u057'];
     $user_groups = strpos($this->userData['user_groups'], ".") == 0 ? substr($this->userData['user_groups'], 1) : $this->userData['user_groups'];
     $user_groups = explode(".", $user_groups);
     $grp_html = '';
     $user_groups = array_filter($user_groups);
     if (!empty($user_groups)) {
         for ($i = 0; $i < count($user_groups); $i++) {
             $grp_html .= "<span class='user_group'><a href='" . FUSION_SELF . "?group_id=" . $user_groups[$i] . "'>" . getgroupname($user_groups[$i]) . "</a></span>";
         }
         $this->info['core_field']['profile_user_group']['value'] = $grp_html;
     } else {
         $this->info['core_field']['profile_user_group']['value'] = $locale['user_na'];
     }
     $this->get_userFields();
     if (iMEMBER && $userdata['user_id'] != $this->userData['user_id']) {
         $this->info['buttons'][] = array('link' => BASEDIR . "messages.php?folder=inbox&amp;msg_send=" . $this->userData['user_id'], 'name' => $locale['u043']);
         if (checkrights("M") && $userdata['user_level'] <= USER_LEVEL_ADMIN && $this->userData['user_id'] != "1") {
             $this->info['buttons'][] = array('link' => ADMIN . "members.php" . $aidlink . "&amp;step=log&amp;user_id=" . $this->userData['user_id'], 'name' => $locale['u054']);
             $this->info['admin'] = self::renderAdminOptions();
         }
     }
     return $this->info;
 }
Example #29
0
    function display_forum_tags($info)
    {
        $locale = fusion_get_locale();
        echo render_breadcrumbs();
        if (isset($_GET['tag_id'])) {
            // thread design
            echo "<!--pre_forum-->\n";
            echo "<div class='forum-title m-t-20'>" . $locale['forum_0341'] . "</div>\n";
            echo "<div class='filter'>\n";
            forum_filter($info);
            echo "</div>\n";
            if (!empty($info['threads']['pagenav'])) {
                echo "<div class='text-right'>\n";
                echo $info['threads']['pagenav'];
                echo "</div>\n";
            }
            if (!empty($info['threads'])) {
                echo "<div class='forum-container list-group-item'>\n";
                if (!empty($info['threads']['sticky'])) {
                    foreach ($info['threads']['sticky'] as $cdata) {
                        render_thread_item($cdata);
                    }
                }
                if (!empty($info['threads']['item'])) {
                    foreach ($info['threads']['item'] as $cdata) {
                        render_thread_item($cdata);
                    }
                }
                echo "</div>\n";
            } else {
                echo "<div class='text-center'>" . $locale['forum_0269'] . "</div>\n";
            }
            if (!empty($info['threads']['pagenav'])) {
                echo "<div class='text-right hidden-xs m-t-15'>\n";
                echo $info['threads']['pagenav'];
                echo "</div>\n";
            }
            if (!empty($info['threads']['pagenav2'])) {
                echo "<div class='hidden-sm hidden-md hidden-lg m-t-15'>\n";
                echo $info['threads']['pagenav2'];
                echo "</div>\n";
            }
        } else {
            ?>
            <div class="row m-0">
                <?php 
            if (!empty($info['tags'])) {
                ?>
                    <?php 
                unset($info['tags'][0]);
                ?>
                    <?php 
                foreach ($info['tags'] as $tag_id => $tag_data) {
                    ?>
                        <div class="col-xs-12 col-sm-4" style="height: 200px; max-height:200px; background-color: <?php 
                    echo $tag_data['tag_color'];
                    ?>
">
                            <a href="<?php 
                    echo $tag_data['tag_link'];
                    ?>
">
                                <div class="panel-body">
                                    <h4 class="text-white"><?php 
                    echo $tag_data['tag_title'];
                    ?>
</h4>
                                    <p class="text-white"><?php 
                    echo $tag_data['tag_description'];
                    ?>
</p>
                                </div>
                                <hr/>
                                <?php 
                    if (!empty($tag_data['threads'])) {
                        ?>
                                <span class="tag_result text-white">
                                    <?php 
                        echo trim_text($tag_data['threads']['thread_subject'], 10) . " - " . timer($tag_data['threads']['thread_lastpost']);
                        ?>
                                </span>
                                <?php 
                    }
                    ?>
                            </a>
                        </div>
                    <?php 
                }
                ?>
                <?php 
            }
            ?>
            </div>
            <?php 
        }
    }
Example #30
0
 /**
  * Update User Fields
  * @return bool
  */
 public function saveUpdate()
 {
     $locale = fusion_get_locale();
     $settings = fusion_get_settings();
     $this->_method = "validate_update";
     //$this->data = $this->userData; // Turn off for Next
     $this->_settUserName();
     $this->_setPassword();
     if (!defined('ADMIN_PANEL')) {
         $this->_setAdminPassword();
     }
     $this->_setUserEmail();
     if ($this->validation == 1) {
         $this->_setValidationError();
     }
     $this->_setUserAvatar();
     $quantum = new QuantumFields();
     $quantum->setCategoryDb(DB_USER_FIELD_CATS);
     $quantum->setFieldDb(DB_USER_FIELDS);
     $quantum->setPluginFolder(INCLUDES . "user_fields/");
     $quantum->setPluginLocaleFolder(LOCALE . LOCALESET . "user_fields/");
     $quantum->load_fields();
     $quantum->load_field_cats();
     $quantum->setCallbackData($this->data);
     $_input = $quantum->return_fields_input(DB_USERS, 'user_id');
     if (!empty($_input)) {
         foreach ($_input as $input) {
             $this->data += $input;
         }
     }
     if (\defender::safe()) {
         if ($this->_userName != $this->userData['user_name']) {
             save_user_log($this->userData['user_id'], "user_name", $this->_userName, $this->userData['user_name']);
         }
         if ($this->_userEmail != $this->userData['user_email']) {
             save_user_log($this->userData['user_id'], "user_email", $this->_userEmail, $this->userData['user_email']);
         }
         $quantum->log_user_action(DB_USERS, "user_id");
         dbquery_insert(DB_USERS, $this->data, 'update');
         $this->_completeMessage = $locale['u163'];
         if ($this->isAdminPanel && $this->_isValidCurrentPassword && $this->_newUserPassword && $this->_newUserPassword2) {
             // inform user that password has changed. and tell him your new password
             include INCLUDES . "sendmail_include.php";
             addNotice("success", str_replace("USER_NAME", $this->userData['user_name'], $locale['global_458']));
             $input = array("mailname" => $this->userData['user_name'], "email" => $this->userData['user_email'], "subject" => str_replace("[SITENAME]", $settings['sitename'], $locale['global_456']), "message" => str_replace(array("[SITENAME]", "[SITEUSERNAME]", "USER_NAME", "[PASSWORD]"), array($settings['sitename'], $settings['siteusername'], $this->userData['user_name'], $this->_newUserPassword), $locale['global_457']));
             if (!sendemail($input['mailname'], $input['email'], $settings['siteusername'], $settings['siteemail'], $input['subject'], $input['message'])) {
                 addNotice('warning', str_replace("USER_NAME", $this->userData['user_name'], $locale['global_459']));
             }
         }
         if (\defender::safe()) {
             addNotice('success', $locale['u169']);
         }
         return true;
     }
     return false;
 }