Exemplo n.º 1
0
 public function display()
 {
     $strTag = utf8_strtolower($this->patharray[0]);
     if (!strlen($strTag)) {
         redirect($this->controller_path_plain . $this->SID);
     }
     $arrArticleIDs = $this->pdh->get('articles', 'articles_for_tag', array($strTag));
     $arrArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'desc');
     $intStart = $this->in->get('start', 0);
     $arrLimitedIDs = $this->pdh->limit($arrArticleIDs, $intStart, $this->user->data['user_nlimit']);
     //Articles to template
     foreach ($arrLimitedIDs as $intArticleID) {
         $userlink = '<a href="' . $this->routing->build('user', $this->pdh->geth('articles', 'user_id', array($intArticleID)), 'u' . $this->pdh->get('articles', 'user_id', array($intArticleID))) . '">' . $this->pdh->geth('articles', 'user_id', array($intArticleID)) . '</a>';
         //Content dependet from list_type
         //1 = until readmore
         //2 = Headlines only
         //3 = only first 600 characters
         $strText = $this->pdh->get('articles', 'text', array($intArticleID));
         $arrContent = preg_split('#<hr(.*)id="system-readmore"(.*)\\/>#iU', xhtml_entity_decode($strText));
         $strText = $this->bbcode->parse_shorttags($arrContent[0]);
         $strPath = $this->pdh->get('articles', 'path', array($intArticleID));
         $intCategoryID = $this->pdh->get('articles', 'category', array($intArticleID));
         //Replace Image Gallery
         $arrGalleryObjects = array();
         preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strText, $arrGalleryObjects, PREG_PATTERN_ORDER);
         if (count($arrGalleryObjects[0])) {
             include_once $this->root_path . 'core/gallery.class.php';
             foreach ($arrGalleryObjects[4] as $key => $val) {
                 $objGallery = registry::register('gallery');
                 $strGalleryContent = $objGallery->create($val, (int) $arrGalleryObjects[3][$key], $this->server_path . $strPath, 1);
                 $strText = str_replace($arrGalleryObjects[0][$key], $strGalleryContent, $strText);
             }
         }
         //Replace Raidloot
         $arrRaidlootObjects = array();
         preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strText, $arrRaidlootObjects, PREG_PATTERN_ORDER);
         if (count($arrRaidlootObjects[0])) {
             include_once $this->root_path . 'core/gallery.class.php';
             foreach ($arrRaidlootObjects[3] as $key => $val) {
                 $objGallery = registry::register('gallery');
                 $withChars = $arrRaidlootObjects[5][$key] == "true" ? true : false;
                 $strRaidlootContent = $objGallery->raidloot((int) $val, $withChars);
                 $strText = str_replace($arrRaidlootObjects[0][$key], $strRaidlootContent, $strText);
             }
         }
         $this->comments->SetVars(array('attach_id' => $intArticleID, 'page' => 'articles'));
         $intCommentsCount = $this->comments->Count();
         //Tags
         $arrTags = $this->pdh->get('articles', 'tags', array($intArticleID));
         $this->tpl->assign_block_vars('article_row', array('ARTICLE_CONTENT' => $strText, 'ARTICLE_TITLE' => $this->pdh->get('articles', 'title', array($intArticleID)), 'ARTICLE_SUBMITTED' => sprintf($this->user->lang('news_submitter'), $userlink, $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, true)), 'ARTICLE_DATE' => $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, false, true), 'ARTICLE_PATH' => $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID)), 'ARTICLE_SOCIAL_BUTTONS' => $arrCategory['social_share_buttons'] ? $this->social->createSocialButtons($this->env->link . $this->pdh->get('articles', 'path', array($intArticleID)), strip_tags($this->pdh->get('articles', 'title', array($intArticleID)))) : '', 'PERMALINK' => $this->pdh->get('articles', 'permalink', array($intArticleID)), 'S_TAGS' => count($arrTags) && $arrTags[0] != "" ? true : false, 'ARTICLE_CUTTED_CONTENT' => truncate($strText, 600, '...', false, true), 'S_READMORE' => isset($arrContent[1]) ? true : false, 'COMMENTS_COUNTER' => $intCommentsCount == 1 ? $intCommentsCount . ' ' . $this->user->lang('comment') : $intCommentsCount . ' ' . $this->user->lang('comments'), 'S_COMMENTS' => $this->pdh->get('articles', 'comments', array($intArticleID)) ? true : false, 'S_FEATURED' => $this->pdh->get('articles', 'featured', array($intArticleID))));
         if (count($arrTags) && $arrTags[0] != "") {
             foreach ($arrTags as $tag) {
                 $this->tpl->assign_block_vars('article_row.tag_row', array('TAG' => $tag, 'U_TAG' => $this->routing->build('tag', $tag)));
             }
         }
     }
     $this->tpl->assign_vars(array('TAG' => sanitize($strTag), 'PAGINATION' => generate_pagination($this->strPath . $this->SID, count($arrArticleIDs), $this->user->data['user_nlimit'], $intStart, 'start')));
     $this->tpl->add_meta('<link rel="canonical" href="' . $this->env->link . $this->routing->build('tag', $tag, false, false, true) . '" />');
     $this->core->set_vars(array('page_title' => $this->user->lang("tag") . ': ' . sanitize($strTag), 'template_file' => 'tag.html', 'display' => true));
 }
Exemplo n.º 2
0
        private function opengraph_tags($title, $description, $image)
        {
            $strMetatags = '<meta property="og:title" content="' . $title . '" />
							<meta property="og:type" content="article" />
							<meta property="og:url" content="' . ($this->env->ssl ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . xhtml_entity_decode($_SERVER['REQUEST_URI']) . '" />
							<meta property="og:description" content="' . htmlspecialchars(trim(strip_tags($description)), ENT_QUOTES) . '" />
							<meta property="og:image" content="' . $image . '" />';
            $this->tpl->add_meta($strMetatags);
        }
 /**
  * Display
  */
 public function display()
 {
     $this->confirm_delete($this->user->lang('dynamictemplate_confirm_delete_module'));
     $arrModuleIDs = $arrExportData = $this->pdh->get('dynamictemplate', 'id_list');
     foreach ($arrModuleIDs as $key => $id) {
         $arrExportData[$key] = $arrModuleData = $this->pdh->get('dynamictemplate', 'id', array($id));
         $this->tpl->assign_block_vars('modules', array('KEY' => $arrModuleData['id'], 'ACTIVE' => $arrModuleData['active'] ? 'checked="checked"' : '', 'NAME' => $arrModuleData['name'], 'LISTENER' => new hdropdown('listener', array('options' => $this->user->lang('dynamictemplate_listener'), 'value' => $arrModuleData['listener'], 'name' => 'module[' . $arrModuleData['id'] . '][listener]')), 'VALUE' => xhtml_entity_decode(htmlspecialchars_decode($arrModuleData['value']))));
     }
     $this->tpl->assign_vars(array('KEY' => max($arrModuleIDs) + 1, 'LISTENER' => new hdropdown('listener', array('options' => $this->user->lang('dynamictemplate_listener'), 'value' => '', 'name' => 'module[KEY][listener]')), 'EXPORT_DATA' => json_encode($arrExportData, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE)));
     // -- EQDKP ---------------------------------------------------------------
     $this->core->set_vars(array('page_title' => $this->user->lang('dynamictemplate') . ' ' . $this->user->lang('dynamictemplate_main_settings'), 'template_path' => $this->pm->get_data('dynamictemplate', 'template_path'), 'template_file' => 'admin/main_settings.html', 'display' => true));
 }
 public function portal()
 {
     // Deaktiviert die Warnung 'Dynamic Template-Plugin benötigt'		= HTML <!-- IF DYNAMICTEMPLATE --> <!-- ENDIF -->
     $this->tpl->assign_var('DYNAMICTEMPLATE', true);
     $arrModules = $this->pdh->get('dynamictemplate', 'id_list', array());
     foreach ($arrModules as $id) {
         $arrModuleData = $this->pdh->get('dynamictemplate', 'id', array($id));
         if ($arrModuleData['active']) {
             $arrModuleData['value'] = xhtml_entity_decode(htmlspecialchars_decode($arrModuleData['value']));
             if (!empty($arrModuleData['name'])) {
                 $this->tpl->assign_var('DYNAMICTEMPLATE_' . $arrModuleData['name'], $this->tpl->compileString($arrModuleData['value']));
             }
             if (!empty($arrModuleData['listener'])) {
                 $this->tpl->add_listener($arrModuleData['listener'], $arrModuleData['value'], true);
             }
         }
     }
 }
Exemplo n.º 5
0
    public function view_log()
    {
        $log_value = unserialize($this->pdh->get('logs', 'value', array($this->url_id)));
        $blnCompare = false;
        if (is_array($log_value)) {
            foreach ($log_value as $k => $v) {
                if ($k != 'header') {
                    //Enable Compare view
                    if (is_array($v)) {
                        $blnCompare = true;
                        if ($v['flag'] == 1) {
                            require_once $this->root_path . 'libraries/diff/diff.php';
                            require_once $this->root_path . 'libraries/diff/engine.php';
                            require_once $this->root_path . 'libraries/diff/renderer.php';
                            $diff = new diff(xhtml_entity_decode($this->logs->lang_replace($v['old'])), xhtml_entity_decode($this->logs->lang_replace($v['new'])), true);
                            $renderer = new diff_renderer_inline();
                            $new = $content = $renderer->get_diff_content($diff);
                        } else {
                            $new = nl2br($this->logs->lang_replace($v['new']));
                        }
                        $this->tpl->assign_block_vars('log_compare_row', array('KEY' => $this->logs->lang_replace(stripslashes($k)) . ':', 'OLD' => nl2br($this->logs->lang_replace($v['old'])), 'NEW' => $new, 'FLAG' => $v['flag']));
                    } else {
                        $this->tpl->assign_block_vars('log_row', array('KEY' => $this->logs->lang_replace(stripslashes($k)) . ':', 'VALUE' => $this->logs->lang_replace(stripslashes($v))));
                    }
                }
            }
        }
        $plugin = $this->pdh->get('logs', 'plugin', array($this->url_id));
        $this->tpl->assign_vars(array('LOG_PLUGIN' => $plugin != 'core' ? $this->user->lang($plugin) ? $this->user->lang($plugin) : ucfirst($plugin) : '', 'LOG_DATE' => $this->pdh->geth('logs', 'date', array($this->url_id, true)), 'LOG_USERNAME' => $this->pdh->geth('logs', 'user', array($this->url_id)), 'LOG_IP_ADDRESS' => $this->pdh->geth('logs', 'ipaddress', array($this->url_id)), 'LOG_SESSION_ID' => $this->pdh->geth('logs', 'sid', array($this->url_id)), 'LOG_ACTION' => $this->pdh->geth('logs', 'tag', array($this->url_id)), 'LOG_RECORD' => $this->pdh->geth('logs', 'record', array($this->url_id)), 'LOG_RECORD_ID' => $this->pdh->geth('logs', 'recordid', array($this->url_id)), 'S_COMPARE_VIEW' => $blnCompare, 'S_MORE_INFOS' => count($log_value)));
        $this->tpl->add_js('
			$("#back2view").click(function(){
				window.location="manage_logs.php' . $this->SID . '";
			});', 'docready');
        $this->tpl->css_file($this->root_path . 'libraries/diff/diff.css');
        $this->core->set_vars(array('page_title' => $this->user->lang('viewlogs_title'), 'template_file' => 'admin/manage_logs_view.html', 'display' => true));
    }
Exemplo n.º 6
0
 public function init()
 {
     // try to get from cache first
     $this->links = $this->pdc->get('pdh_links_table');
     if ($this->links !== NULL) {
         return true;
     }
     $this->links = array();
     $sql = "SELECT\n\t\t\t\t\tlink_id,\n\t\t\t\t\tlink_name,\n\t\t\t\t\tlink_url,\n\t\t\t\t\tlink_window,\n\t\t\t\t\tlink_menu,\n\t\t\t\t\tlink_visibility,\n\t\t\t\t\tlink_height\n\t\t\t\t\tFROM\n\t\t\t\t\t__links\n\t\t\t\t\tORDER BY link_sortid;";
     $objQuery = $this->db->query($sql);
     if ($objQuery) {
         while ($row = $objQuery->fetchAssoc()) {
             $this->links[$row['link_id']]['id'] = $row['link_id'];
             $this->links[$row['link_id']]['name'] = $row['link_name'];
             $this->links[$row['link_id']]['url'] = $row['link_url'];
             $this->links[$row['link_id']]['window'] = $row['link_window'];
             $this->links[$row['link_id']]['menu'] = $row['link_menu'];
             $this->links[$row['link_id']]['visibility'] = xhtml_entity_decode($row['link_visibility']);
             $this->links[$row['link_id']]['height'] = $row['link_height'];
         }
         $this->pdc->put('pdh_links_table', $this->links, NULL);
     }
     return true;
 }
    public function display()
    {
        if ($this->in->exists('mcsavevote')) {
            $this->saveRating();
        }
        $arrPathArray = registry::get_const('patharray');
        if (is_numeric($this->url_id)) {
            //For URL: index.php/MediaCenter/Downloads/MyFileName-17.html
            $arrMediaData = $this->pdh->get('mediacenter_media', 'data', array($this->url_id));
            if ($arrMediaData != false && count($arrMediaData)) {
                $strRef = $this->in->get('ref') != "" ? '&ref=' . $this->in->get('ref') : '';
                $intMediaID = $this->url_id;
                $intCategoryId = $this->pdh->get('mediacenter_media', 'category_id', array($this->url_id));
                $intAlbumID = $this->pdh->get('mediacenter_media', 'album_id', array($this->url_id));
                $blnShowUnpublished = $arrPermissions['change_state'] || $this->user->check_auth('a_mediacenter_manage', false);
                if (!$arrMediaData['published'] && !$blnShowUnpublished) {
                    message_die($this->user->lang('article_unpublished'));
                }
                $arrCategoryData = $this->pdh->get('mediacenter_categories', 'data', array($intCategoryId));
                $intPublished = $arrCategoryData['published'];
                if (!$intPublished && !$this->user->check_auth('a_mediacenter_manage', false)) {
                    message_die($this->user->lang('category_unpublished'));
                }
                //Check Permissions
                $arrPermissions = $this->pdh->get('mediacenter_categories', 'user_permissions', array($intCategoryId, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                $arrTags = $this->pdh->get('mediacenter_media', 'tags', array($intMediaID));
                //Create Maincontent
                $intType = $this->pdh->get('mediacenter_media', 'type', array($intMediaID));
                $strExtension = strtolower(pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION));
                $arrPlayableVideos = array('mp4', 'webm', 'ogg');
                $arrAdditionalData = unserialize($arrMediaData['additionaldata']);
                $strPermalink = $this->user->removeSIDfromString($this->env->buildlink() . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID, false, array(), false)));
                if ($intType === 0) {
                    $this->tpl->assign_vars(array('MC_MEDIA_DOWNLOADS' => $arrMediaData['downloads'], 'MC_MEDIA_FILENAME' => $arrMediaData['filename'], 'S_MC_EXTERNALFILEONLY' => $arrMediaData['filename'] == "" && $arrMediaData['externalfile'] != "" ? true : false, 'MC_MEDIA_EXTENSION' => pathinfo($arrMediaData['filename'], PATHINFO_EXTENSION), 'MC_MEDIA_SIZE' => human_filesize($arrAdditionalData['size']), 'MC_EMBEDD_HTML' => htmlspecialchars('<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>'), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } elseif ($intType === 1) {
                    //Video
                    $blnIsEmbedly = false;
                    if (isset($arrAdditionalData['html'])) {
                        //Is embedly Video
                        $strVideo = $arrAdditionalData['html'];
                        $blnIsEmbedly = true;
                    } else {
                        $strExternalExtension = strtolower(pathinfo($arrMediaData['externalfile'], PATHINFO_EXTENSION));
                        if (strlen($arrMediaData['externalfile']) && in_array($strExternalExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            switch ($strExternalExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $arrMediaData['externalfile'] . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $arrMediaData['externalfile'] . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } elseif (in_array($strExtension, $arrPlayableVideos)) {
                            $this->tpl->css_file($this->root_path . 'plugins/mediacenter/includes/videojs/video-js.min.css');
                            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/videojs/video.js');
                            $this->tpl->add_js('videojs.options.flash.swf = "' . $this->server_path . 'plugins/mediacenter/includes/videojs/video-js.swf"; ', 'docready');
                            $strLocalFile = $this->pfh->FolderPath('files', 'mediacenter', 'absolute') . $arrMediaData['localfile'];
                            switch ($strExtension) {
                                case 'mp4':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/mp4\' />';
                                    break;
                                case 'webm':
                                    $strSource = '  <source src="' . $strLocalFile . '" type=\'video/webm\' />';
                                    break;
                                case 'ogg':
                                    $strSource = '   <source src="' . $strLocalFile . '" type=\'video/ogg\' />';
                                    break;
                            }
                            $strVideo = '  <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="364"
						      poster="" data-setup="{}">
						    ' . $strSource . '
						    <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
						  </video>';
                        } else {
                            $strVideo = 'Cannot play this video type.';
                        }
                    }
                    $strEmbeddHTML = $blnIsEmbedly ? $arrAdditionalData['html'] : '<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . '</a>';
                    $this->tpl->assign_vars(array('MC_VIDEO' => $strVideo, 'MC_EMBEDD_HTML' => htmlspecialchars($strEmbeddHTML), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . "[/url]")));
                } else {
                    //Image
                    $strThumbfolder = $this->pfh->FolderPath('thumbs', 'mediacenter');
                    if (file_exists($strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension)) {
                        $strImage = $strThumbfolder . $arrMediaData['localfile'] . '.' . $strExtension;
                    } else {
                        $strImage = $this->pfh->FolderPath('files', 'mediacenter', 'relative') . $arrMediaData['localfile'];
                    }
                    $arrImageDimesions = getimagesize($strImage);
                    $strImage = str_replace($this->root_path, $this->server_path, $strImage);
                    $strOtherImages = "";
                    $arrOtherFiles = $this->pdh->get('mediacenter_media', 'other_ids', array($intMediaID, $strRef != "" ? true : false));
                    $this->jquery->lightbox(md5($intMediaID), array('slideshow' => true, 'transition' => "elastic", 'slideshowSpeed' => 4500, 'slideshowAuto' => false, 'type' => 'photo', 'title_function' => "var url = \$(this).data('url');\nvar title = \$(this).attr('title');\nif(url == undefined){ url = \$(this).attr('href');}\nvar desc = \$(this).data('desc');\nif(desc == undefined) { desc = ''; } else { desc = '<br />'+desc;}\nreturn '<a href=\"' + url + '\">'+title+'</a>'+desc;"));
                    foreach ($arrOtherFiles as $intFileID) {
                        if ($intFileID === $intMediaID) {
                            continue;
                        }
                        if ($this->pdh->get('mediacenter_media', 'type', array($intFileID)) === 2) {
                            $strName = $this->pdh->get('mediacenter_media', 'name', array($intFileID));
                            $strOtherImage = $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intFileID));
                            $strDesc = $this->pdh->get('mediacenter_media', 'description', array($intFileID));
                            $strDesc = strip_tags($this->bbcode->remove_bbcode($strDesc));
                            $strOtherImages .= '<a href="' . $strOtherImage . '&image" data-url="' . $strOtherImage . '" data-desc="' . $strDesc . '" class="lightbox_' . md5($intMediaID) . '" rel="' . md5($intMediaID) . '" title="' . sanitize($strName) . '"><img src="" /></a>';
                        }
                    }
                    $this->tpl->assign_vars(array('MC_IMAGE' => $strImage, 'MC_MEDIA_FILENAME' => $arrMediaData['filename'], 'MC_MEDIA_IMAGEDIMENSIONS' => $arrImageDimesions[0] . ' x ' . $arrImageDimesions[1], 'MC_LIGHTBOX' => md5($intMediaID), 'MC_OTHER_IMAGES' => $strOtherImages, 'MC_DESC_STRIPPED' => strip_tags($this->bbcode->remove_bbcode($arrMediaData['description'])), 'MC_EMBEDD_HTML_BIG' => htmlspecialchars('<a href="' . $strPermalink . '"><img src="' . $strPermalink . '?image" alt="" /></a>'), 'MC_EMBEDD_HTML_SMALL' => htmlspecialchars('<a href="' . $strPermalink . '"><img src="' . $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)) . '" alt="" /></a>'), 'MC_EMBEDD_BBCODE_SMALL' => htmlspecialchars("[url='" . $strPermalink . "'][img]" . $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)) . "[/img][/url]"), 'MC_EMBEDD_BBCODE_BIG' => htmlspecialchars("[url='" . $strPermalink . "'][img]" . $strPermalink . "?image[/img][/url]")));
                    foreach ($arrAdditionalData as $key => $val) {
                        if ($key === 'size') {
                            $val = human_filesize($val);
                        } elseif ($key === 'CreationTime') {
                            if ($val === 0) {
                                continue;
                            }
                            $val = $this->time->createTimeTag((int) $val, $this->time->user_date($val, true));
                        } elseif ($key === 'FNumber') {
                            $val = 'f/' . $val;
                        }
                        if ($key == 'Longitude' || $key == 'Latitude' || $key == 'Orientation') {
                            continue;
                        }
                        if (!strlen($val)) {
                            continue;
                        }
                        $this->tpl->assign_block_vars('mc_more_image_details', array('LABEL' => $this->user->lang('mc_' . $key), 'VALUE' => strlen($val) ? sanitize($val) : '&nbsp;'));
                    }
                    if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude']) && (int) $this->config->get('show_maps', 'mediacenter') == 1) {
                        $this->tpl->assign_vars(array('S_MC_COORDS' => true, 'MC_MEDIA_LONGITUDE' => $arrAdditionalData['Longitude'], 'MC_MEDIA_LATITUDE' => $arrAdditionalData['Latitude']));
                    }
                }
                $nextID = $this->pdh->get('mediacenter_media', 'next_media', array($intMediaID, $strRef != "" ? true : false));
                $prevID = $this->pdh->get('mediacenter_media', 'prev_media', array($intMediaID, $strRef != "" ? true : false));
                $arrInvolvedUser = $this->pdh->get('comment', 'involved_users', array('mediacenter', $intMediaID));
                $arrInvolvedUser[] = $this->pdh->get('mediacenter_media', 'user_id', array($intMediaID));
                $arrInvolvedUser = array_unique($arrInvolvedUser);
                $this->comments->SetVars(array('attach_id' => $intMediaID, 'page' => 'mediacenter', 'auth' => 'a_mediacenter_manage', 'ntfy_type' => 'mediacenter_media_comment_new', 'ntfy_title' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'ntfy_link' => $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'ntfy_user' => $arrInvolvedUser));
                $intCommentsCount = $this->comments->Count();
                //Reset Notifications
                if ($this->user->is_signedin()) {
                    $arrCommentIDs = $this->pdh->get('comment', 'filtered_list', array('mediacenter', $intMediaID));
                    if (count($arrCommentIDs)) {
                        $this->ntfy->markAsRead('mediacenter_media_comment_new', $this->user->id, array_keys($arrCommentIDs));
                    }
                    $this->ntfy->markAsRead('mediacenter_media_new', $this->user->id, $intMediaID);
                }
                $arrToolbarItems = array();
                if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                }
                if ($arrPermissions['update'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-pencil-square-o', 'js' => 'onclick="editMedia(' . $intMediaID . ')"', 'title' => $this->user->lang('mc_edit_media'));
                }
                if ($arrPermissions['delete']) {
                    $arrToolbarItems[] = array('icon' => 'fa-trash-o', 'js' => 'onclick="$(\'#del_articles\').click()"', 'title' => $this->user->lang('mc_delete_media'));
                }
                if ($arrPermissions['change_state']) {
                    if ($this->pdh->get('mediacenter_media', 'published', array($intMediaID))) {
                        $arrToolbarItems[] = array('icon' => 'fa-eye-slash', 'js' => 'onclick="$(\'#set_unpublished\').click()"', 'title' => $this->user->lang('article_unpublish'));
                    } else {
                        $arrToolbarItems[] = array('icon' => 'fa-eye', 'js' => 'onclick="$(\'#set_published\').click()"', 'title' => $this->user->lang('article_publish'));
                    }
                }
                $this->confirm_delete($this->user->lang('mc_confirm_delete_media'));
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                $strAlbumEditID = $this->pdh->get('mediacenter_media', 'album_id', array($intMediaID)) ? $this->pdh->get('mediacenter_media', 'album_id', array($intMediaID)) : 'c' . $intCategoryId;
                $this->tpl->assign_vars(array('MC_MEDIA_PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, false, 'mcPreviewImageBig')), 'MC_MEDIA_PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'MC_MEDIA_NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'MC_MEDIA_LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'MC_MEDIA_VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'MC_MEDIA_AUTHOR' => $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'MC_MEDIA_DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'MC_MEDIA_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'MC_MEDIA_DESCRIPTION' => $this->bbcode->toHTML($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'MC_MEDIA_TYPE' => $intType, 'MC_BREADCRUMB' => $intAlbumID ? str_replace('class="current"', '', $this->pdh->get('mediacenter_albums', 'breadcrumb', array($intAlbumID))) : str_replace('class="current"', '', $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId))), 'S_MC_TAGS' => count($arrTags) ? true : false, 'S_NEXT_MEDIA' => $nextID !== false ? true : false, 'S_PREV_MEDIA' => $prevID !== false ? true : false, 'U_NEXT_MEDIA' => $nextID ? $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($nextID)) . $strRef : '', 'U_PREV_MEDIA' => $prevID ? $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($prevID)) . $strRef : '', 'MEDIA_NEXT_TITLE' => $nextID ? $this->pdh->get('mediacenter_media', 'name', array($nextID)) : '', 'MEDIA_PREV_TITLE' => $prevID ? $this->pdh->get('mediacenter_media', 'name', array($prevID)) : '', 'MC_MEDIA_SOCIAL_BUTTONS' => $this->social->createSocialButtons($this->env->link . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), strip_tags($this->pdh->get('mediacenter_media', 'name', array($intMediaID)))), 'MC_MEDIA_RATING' => $arrCategoryData['allow_voting'] ? $this->jquery->starrating($intMediaID, $this->controller_path . 'MediaCenter/' . $this->SID . '&mcsavevote&link_hash=' . $this->CSRFGetToken('savevote'), array('score' => $arrMediaData['votes_count'] ? round($arrMediaData['votes_sum'] / $arrMediaData['votes_count']) : 0, 'number' => 10)) : '', 'MC_MEDIA_COMMENTS_COUNTER' => $intCommentsCount == 1 ? $intCommentsCount . ' ' . $this->user->lang('comment') : $intCommentsCount . ' ' . $this->user->lang('comments'), 'S_MC_COMMENTS' => $arrCategoryData['allow_comments'] ? true : false, 'MC_COMMENTS' => $this->comments->Show(), 'MC_TOOLBAR' => $jqToolbar['id'], 'S_MC_TOOLBAR' => $arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state'], 'MC_MEDIA_ID' => $intMediaID, 'MC_CATEGORY_ID' => $intCategoryId, 'MC_PERMALINK' => $strPermalink, 'MC_S_PUBLISHED' => $this->pdh->get('mediacenter_media', 'published', array($intMediaID)) ? true : false));
                $this->social->callSocialPlugins($this->pdh->get('mediacenter_media', 'name', array($intMediaID)), truncate($this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 200), $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)));
                if (count($arrTags) && $arrTags[0] != "") {
                    foreach ($arrTags as $tag) {
                        $this->tpl->assign_block_vars('tag_row', array('TAG' => $tag, 'U_TAG' => $this->controller_path . 'MediaCenter/Tags/' . $tag));
                    }
                }
                //Update Views
                if (!$this->env->is_bot($this->user->data['session_browser'])) {
                    $this->pdh->put('mediacenter_media', 'update_view', array($intMediaID));
                }
                if ($arrPermissions['create'] || $arrPermissions['update']) {
                    $this->jquery->dialog('editMedia', $this->user->lang('mc_edit_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID . "&aid=" . $strAlbumEditID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
                }
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $this->jquery->dialog('deleteMedia', $this->user->lang('mc_delete_media'), array('custom_js' => 'deleteMediaSubmit(aid);', 'confirm', 'withid' => 'aid', 'message' => $this->user->lang('mc_confirm_delete_media')), 'confirm');
                    $this->tpl->add_js("function deleteMediaSubmit(aid){\n\t\t\t\t\twindow.location='" . $this->controller_path . $this->page_path . $this->SID . '&mcdelete&link_hash=' . $this->CSRFGetToken('delete') . "&aid='+aid;\n\t\t\t\t}");
                }
                // -- EQDKP ---------------------------------------------------------------
                $this->core->set_vars(array('page_title' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)) . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'media.html', 'display' => true));
            } else {
                redirect($this->controller_path_plain . 'MediaCenter/' . $this->SID);
            }
        } elseif (isset($arrPathArray[1]) && $arrPathArray[1] === 'tags') {
            $strTag = $this->url_id;
            //Items per Page
            $intPerPage = $this->config->get('per_page', 'mediacenter');
            //Grid or List
            $intLayout = $this->in->exists('layout') ? $this->in->get('layout', 0) : 1;
            $hptt_page_settings = array('name' => 'hptt_mc_categorylist', 'table_main_sub' => '%intMediaID%', 'table_subs' => array('%intCategoryID%', '%intMediaID%'), 'page_ref' => 'manage_media.php', 'show_numbers' => false, 'selectboxes_checkall' => true, 'show_detail_twink' => false, 'table_sort_dir' => 'desc', 'table_sort_col' => 3, 'table_presets' => array(array('name' => 'mediacenter_media_previewimage', 'sort' => false, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_frontendlist', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'mediacenter_media_type', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_date', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => 'nowrap="nowrap"'), array('name' => 'mediacenter_media_views', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => '')));
            $start = $this->in->get('start', 0);
            $page_suffix = '&amp;layout=' . $intLayout;
            $sort_suffix = '&sort=' . $this->in->get('sort', '3|desc');
            $strBaseLayoutURL = $this->strPath . $this->SID . '&sort=' . $this->in->get('sort', '3|desc') . '&start=' . $start . '&layout=';
            $strBaseSortURL = $this->strPath . $this->SID . '&start=' . $start . '&layout=' . $intLayout . '&sort=';
            $arrSortOptions = $this->user->lang('mc_sort_options');
            $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_tags', array($strTag));
            if (count($arrMediaInCategory)) {
                $view_list = $arrMediaInCategory;
                $hptt = $this->get_hptt($hptt_page_settings, $view_list, $view_list, array(), 'tag' . md5($strTag));
                $hptt->setPageRef($this->strPath);
                $this->tpl->assign_vars(array('S_IN_CATEGORY' => true, 'S_LAYOUT_LIST' => $intLayout == 1 ? true : false, 'MEDIA_LIST' => $hptt->get_html_table($this->in->get('sort'), $page_suffix, $start, $intPerPage, null, false, array('mediacenter_media', 'checkbox_check')), 'PAGINATION' => generate_pagination($this->strPath . $this->SID . $sort_suffix . $page_suffix, count($view_list), $intPerPage, $start)));
                $arrRealViewList = $hptt->get_view_list();
                foreach ($arrRealViewList as $intMediaID) {
                    $this->tpl->assign_block_vars('mc_media_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'COMMENTS' => $this->pdh->get('mediacenter_media', 'comment_count', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
                }
            }
            $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => ucfirst(sanitize($strTag)), 'MC_CATEGORY_MEDIA_COUNT' => count($arrMediaInCategory), 'MC_LAYOUT_DD' => new hdropdown('selectlayout', array('options' => $this->user->lang('mc_layout_types'), 'value' => $intLayout, 'id' => 'selectlayout', 'class' => 'dropdown')), 'MC_SORT_DD' => new hdropdown('selectsort', array('options' => $arrSortOptions, 'value' => $this->in->get('sort', '3|desc'), 'id' => 'selectsort', 'class' => 'dropdown')), 'MC_BASEURL_LAYOUT' => $strBaseLayoutURL, 'MC_BASEURL_SORT' => $strBaseSortURL));
            // -- EQDKP ---------------------------------------------------------------
            $this->core->set_vars(array('page_title' => ucfirst(sanitize($strTag)) . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'tags.html', 'display' => true));
        } elseif (strlen($this->url_id)) {
            //For Category-View: index.php/MediaCenter/Downloads/
            //Also Subcategories possible:
            // index.php/MediaCenter/Blablupp/Sowieso/Downloads/
            $arrPathParts = registry::get_const('patharray');
            $strCategoryAlias = $this->url_id;
            if ($strCategoryAlias != $arrPathParts[0]) {
                $strCategoryAlias = $this->url_id = $arrPathParts[0];
            }
            $intCategoryId = $this->pdh->get('mediacenter_categories', 'resolve_alias', array($strCategoryAlias));
            if ($intCategoryId) {
                $arrCategoryData = $this->pdh->get('mediacenter_categories', 'data', array($intCategoryId));
                $intPublished = $arrCategoryData['published'];
                if (!$intPublished) {
                    message_die($this->user->lang('category_unpublished'));
                }
                //Check Permissions
                $arrPermissions = $this->pdh->get('mediacenter_categories', 'user_permissions', array($intCategoryId, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                if ($this->in->exists('map') && (int) $this->config->get('show_maps', 'mediacenter') == 1) {
                    $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                    $intCount = 0;
                    foreach ($arrMediaInCategory as $intMediaID) {
                        $arrAdditionalData = $this->pdh->get('mediacenter_media', 'additionaldata', array($intMediaID));
                        if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude'])) {
                            $this->tpl->assign_block_vars('mc_media_row', array('LNG' => $arrAdditionalData['Longitude'], 'LAT' => $arrAdditionalData['Latitude'], 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->server_path . $this->controller_path_plain . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2))));
                            $intCount++;
                        }
                    }
                    $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => $arrCategoryData['name'], 'MC_CATEGORY_ID' => $intCategoryId, 'MC_BREADCRUMB' => $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId)), 'MC_CATEGORY_MEDIA_COUNT' => $intCount));
                    // -- EQDKP ---------------------------------------------------------------
                    $this->core->set_vars(array('page_title' => $arrCategoryData['name'] . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'map.html', 'display' => true));
                } else {
                    $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                    $intMapCount = 0;
                    foreach ($arrMediaInCategory as $intMediaID) {
                        $arrAdditionalData = $this->pdh->get('mediacenter_media', 'additionaldata', array($intMediaID));
                        if (isset($arrAdditionalData['Longitude']) && isset($arrAdditionalData['Latitude'])) {
                            $intMapCount++;
                        }
                    }
                }
                $blnShowUnpublished = $arrPermissions['change_state'] || $this->user->check_auth('a_mediacenter_manage', false);
                $arrChilds = $this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId));
                foreach ($arrChilds as $intChildID) {
                    $this->tpl->assign_block_vars('child_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intChildID)), 'CATEGORY_ID' => $intChildID, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intChildID)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intChildID)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intChildID))) > 0 ? true : false));
                }
                //Items per Page
                $intPerPage = $arrCategoryData['per_page'];
                //Grid or List
                $intLayout = $this->in->exists('layout') ? $this->in->get('layout', 0) : (int) $arrCategoryData['layout'];
                $hptt_page_settings = array('name' => 'hptt_mc_categorylist', 'table_main_sub' => '%intMediaID%', 'table_subs' => array('%intCategoryID%', '%intMediaID%'), 'page_ref' => 'manage_media.php', 'show_numbers' => false, 'selectboxes_checkall' => true, 'show_detail_twink' => false, 'table_sort_dir' => 'desc', 'table_sort_col' => 3, 'table_presets' => array(array('name' => 'mediacenter_media_previewimage', 'sort' => false, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_frontendlist', 'sort' => true, 'th_add' => '', 'td_add' => ''), array('name' => 'mediacenter_media_type', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => ''), array('name' => 'mediacenter_media_date', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => 'nowrap="nowrap"'), array('name' => 'mediacenter_media_views', 'sort' => true, 'th_add' => 'width="20"', 'td_add' => '')));
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $hptt_page_settings['show_select_boxes'] = true;
                }
                $start = $this->in->get('start', 0);
                $page_suffix = '&amp;layout=' . $intLayout;
                $sort_suffix = '&sort=' . $this->in->get('sort', '3|desc');
                $strBaseLayoutURL = $this->strPath . $this->SID . '&sort=' . $this->in->get('sort', '3|desc') . '&start=' . $start . '&layout=';
                $strBaseSortURL = $this->strPath . $this->SID . '&start=' . $start . '&layout=' . $intLayout . '&sort=';
                $arrSortOptions = $this->user->lang('mc_sort_options');
                $arrMediaInCategory = $this->pdh->get('mediacenter_media', 'id_list_for_category', array($intCategoryId, $blnShowUnpublished ? false : true, true));
                if (count($arrMediaInCategory)) {
                    $view_list = $arrMediaInCategory;
                    $hptt = $this->get_hptt($hptt_page_settings, $view_list, $view_list, array('%link_url_suffix%' => '&amp;ref=cat'), 'cat_' . $intCategoryId . '.0');
                    $hptt->setPageRef($this->strPath);
                    $this->tpl->assign_vars(array('S_IN_CATEGORY' => true, 'S_LAYOUT_LIST' => $intLayout == 1 ? true : false, 'MEDIA_LIST' => $hptt->get_html_table($this->in->get('sort'), $page_suffix, $start, $intPerPage, null, false, array('mediacenter_media', 'checkbox_check')), 'PAGINATION' => generate_pagination($this->strPath . $this->SID . $sort_suffix . $page_suffix, count($view_list), $intPerPage, $start)));
                    $arrRealViewList = $hptt->get_view_list();
                    foreach ($arrRealViewList as $intMediaID) {
                        $this->tpl->assign_block_vars('mc_media_row', array('ID' => $intMediaID, 'PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)) . '&ref=cat', 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'COMMENTS' => $this->pdh->get('mediacenter_media', 'comment_count', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : '', 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_PUBLISHED' => $this->pdh->get('mediacenter_media', 'published', array($intMediaID)) ? true : false, 'S_CHECKBOX' => $arrPermissions['delete'] || $arrPermissions['change_state']));
                    }
                }
                $arrAlbums = $this->pdh->get('mediacenter_albums', 'albums_for_category', array($intCategoryId));
                foreach ($arrAlbums as $intAlbumID) {
                    $view_list = $this->pdh->get('mediacenter_media', 'id_list', array($intAlbumID, true));
                    $this->tpl->assign_block_vars('album_list', array('NAME' => $this->pdh->get('mediacenter_albums', 'name', array($intAlbumID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_albums', 'path', array($intAlbumID)), 'S_PERSONAL' => $this->pdh->get('mediacenter_albums', 'personal_album', array($intAlbumID)) ? true : false, 'S_ALBUM' => true, 'MEDIA_COUNT' => count($view_list), 'USER' => $this->pdh->get('user', 'name', array($this->pdh->get('mediacenter_albums', 'user_id', array($intAlbumID)))), 'ID' => $intAlbumID));
                }
                $strPermalink = $this->user->removeSIDfromString($this->env->buildlink() . $this->controller_path_plain . $this->pdh->get('mediacenter_categories', 'path', array($intCategoryId, false)));
                $arrToolbarItems = array();
                if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                    $this->jquery->dialog('editMedia', $this->user->lang('mc_add_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID . "&aid=c" . $intCategoryId, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
                }
                if ($this->user->check_auth('a_mediacenter_manage', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa-list', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_media.php" . $this->SID . '&cid=' . $intCategoryId . '\';"', 'title' => $this->user->lang('mc_manage_media'));
                    $arrToolbarItems[] = array('icon' => 'fa-pencil', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_categories.php" . $this->SID . '&cid=' . $intCategoryId . '\';"', 'title' => $this->user->lang('mc_manage_category'));
                }
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                $arrMenuItems = array();
                if ($arrPermissions['delete']) {
                    $arrMenuItems[] = array('name' => $this->user->lang('delete'), 'type' => 'button', 'icon' => 'fa-trash-o', 'perm' => true, 'link' => '#del_articles');
                }
                if ($arrPermissions['change_state']) {
                    $arrMenuItems[] = array('name' => $this->user->lang('mc_change_state_publish'), 'type' => 'button', 'icon' => 'fa-eye', 'perm' => true, 'link' => '#set_published');
                    $arrMenuItems[] = array('name' => $this->user->lang('mc_change_state_unpublish'), 'type' => 'button', 'icon' => 'fa-eye-slash', 'perm' => true, 'link' => '#set_unpublished');
                }
                $this->confirm_delete($this->user->lang('mc_confirm_delete_media'));
                $this->tpl->assign_vars(array('MC_CATEGORY_NAME' => $arrCategoryData['name'], 'MC_CATEGORY_ID' => $intCategoryId, 'MC_BREADCRUMB' => $this->pdh->get('mediacenter_categories', 'breadcrumb', array($intCategoryId)), 'MC_CATEGORY_MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intCategoryId)), 'MC_CATEGORY_DESCRIPTION' => $this->bbcode->parse_shorttags(xhtml_entity_decode($arrCategoryData['description'])), 'MC_LAYOUT_DD' => new hdropdown('selectlayout', array('options' => $this->user->lang('mc_layout_types'), 'value' => $intLayout, 'id' => 'selectlayout', 'class' => 'dropdown')), 'MC_SORT_DD' => new hdropdown('selectsort', array('options' => $arrSortOptions, 'value' => $this->in->get('sort', '3|desc'), 'id' => 'selectsort', 'class' => 'dropdown')), 'MC_BASEURL_LAYOUT' => $strBaseLayoutURL, 'MC_BASEURL_SORT' => $strBaseSortURL, 'MC_PERMALINK' => $strPermalink, 'MC_EMBEDD_HTML' => htmlspecialchars('<a href="' . $strPermalink . '">' . $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)) . '</a>'), 'MC_EMBEDD_BBCODE' => htmlspecialchars("[url='" . $strPermalink . "']" . $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)) . "[/url]"), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id'], 'MC_BUTTON_MENU' => $this->jquery->ButtonDropDownMenu('manage_members_menu', $arrMenuItems, array("input[name=\"selected_ids[]\"]"), '', $this->user->lang('mc_selected_media') . '...', ''), 'S_MC_BUTTON_MENU' => count($arrMenuItems) > 0 ? true : false, 'S_SHOW_MAP' => $intMapCount && $this->config->get('show_maps', 'mediacenter') ? true : false));
                // -- EQDKP ---------------------------------------------------------------
                $this->core->set_vars(array('page_title' => $arrCategoryData['name'] . ' - ' . $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'category.html', 'display' => true));
            } else {
                message_die($this->user->lang('article_not_found'));
            }
        } else {
            //-- Index Page of MediaCenter --------------------------------------------
            $this->tpl->js_file($this->root_path . 'plugins/mediacenter/includes/js/responsiveslides.min.js');
            $this->tpl->add_js('
		$("#slider_mc_featured").responsiveSlides({
	        auto: true,
	        pager: true,
	        nav: true,
	        speed: 3000,
			timeout: 5000,
			pause: true,
			namespace: "mc_featured",
	      });
		', 'docready');
            //Get Categorys
            $arrCategories = $this->pdh->get('mediacenter_categories', 'published_id_list', array($this->user->id));
            foreach ($arrCategories as $intCategoryId) {
                if ($this->pdh->get('mediacenter_categories', 'parent', array($intCategoryId)) == 0) {
                    $this->tpl->assign_block_vars('category_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intCategoryId)), 'CATEGORY_ID' => $intCategoryId, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intCategoryId)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intCategoryId)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId))) > 0 ? true : false));
                    $arrChilds = $this->pdh->get('mediacenter_categories', 'childs', array($intCategoryId));
                    foreach ($arrChilds as $intChildID) {
                        $this->tpl->assign_block_vars('category_row.child_row', array('CATEGORY_NAME' => $this->pdh->get('mediacenter_categories', 'name', array($intChildID)), 'CATEGORY_ID' => $intChildID, 'CATEGORY_LINK' => $this->controller_path . $this->pdh->get('mediacenter_categories', 'path', array($intChildID)), 'MEDIA_COUNT' => $this->pdh->get('mediacenter_categories', 'media_count', array($intChildID)), 'S_HAS_CHILDS' => count($this->pdh->get('mediacenter_categories', 'childs', array($intChildID))) > 0 ? true : false));
                    }
                }
            }
            //Get featured files
            $arrFeaturedFiles = $this->pdh->get('mediacenter_media', 'featured_media', array());
            $arrFeaturedFiles = $this->pdh->sort($arrFeaturedFiles, 'mediacenter_media', 'date', 'desc');
            $arrFeaturedFiles = $this->pdh->limit($arrFeaturedFiles, 0, 5);
            foreach ($arrFeaturedFiles as $intMediaID) {
                $this->tpl->assign_block_vars('mc_featured_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 2)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get newest files
            $arrNewestMedia = $this->pdh->get('mediacenter_media', 'newest_media', array(6));
            foreach ($arrNewestMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_newest_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get most viewed files
            $arrMostViewedMedia = $this->pdh->get('mediacenter_media', 'most_viewed', array(6));
            foreach ($arrMostViewedMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_mostviewed_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID))));
            }
            //Get last commented files
            $arrLatestCommentMedia = $this->pdh->get('mediacenter_media', 'last_comments', array(6));
            foreach ($arrLatestCommentMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_lastcomments_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            }
            //Get Best rated files
            $arrBestRatedMedia = $this->pdh->get('mediacenter_media', 'best_rated', array(6));
            foreach ($arrBestRatedMedia as $intMediaID) {
                $this->tpl->assign_block_vars('mc_bestrated_row', array('PREVIEW_IMAGE' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1)), 'PREVIEW_IMAGE_URL' => $this->pdh->geth('mediacenter_media', 'previewimage', array($intMediaID, 1, true)), 'NAME' => $this->pdh->get('mediacenter_media', 'name', array($intMediaID)), 'LINK' => $this->controller_path . $this->pdh->get('mediacenter_media', 'path', array($intMediaID)), 'VIEWS' => $this->pdh->get('mediacenter_media', 'views', array($intMediaID)), 'AUTHOR' => $this->core->icon_font('fa-user') . ' ' . $this->pdh->geth('user', 'name', array($this->pdh->get('mediacenter_media', 'user_id', array($intMediaID)), '', '', true)), 'DATE' => $this->time->createTimeTag($this->pdh->get('mediacenter_media', 'date', array($intMediaID)), $this->pdh->geth('mediacenter_media', 'date', array($intMediaID))), 'CATEGORY_AND_ALBUM' => $this->pdh->geth('mediacenter_media', 'category_id', array($intMediaID, true)) . (strlen($this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true))) ? ' &bull; ' . $this->pdh->geth('mediacenter_media', 'album_id', array($intMediaID, true)) : ''), 'DESCRIPTION' => $this->bbcode->remove_bbcode($this->pdh->get('mediacenter_media', 'description', array($intMediaID))), 'TYPE' => $this->pdh->geth('mediacenter_media', 'type', array($intMediaID)), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            }
            $arrToolbarItems = array();
            if ($arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false)) {
                $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editMedia(0)"', 'title' => $this->user->lang('mc_add_media'));
                $this->jquery->dialog('editMedia', $this->user->lang('mc_add_media'), array('url' => $this->controller_path . "EditMedia/Media-'+id+'/" . $this->SID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
            }
            if ($this->user->check_auth('a_mediacenter_manage', false)) {
                $arrToolbarItems[] = array('icon' => 'fa-list', 'js' => 'onclick="window.location=\'' . $this->server_path . "plugins/mediacenter/admin/manage_categories.php" . $this->SID . '\';"', 'title' => $this->user->lang('mc_manage_media'));
            }
            $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
            $arrStats = $this->pdh->get('mediacenter_media', 'statistics');
            foreach ($arrStats as $key => $val) {
                if ($key === 'size') {
                    $val = human_filesize($val);
                }
                $this->tpl->assign_vars(array('S_MC_STATS_' . strtoupper($key) => sprintf($this->user->lang('mc_statistics_' . $key), $val)));
            }
            $this->tpl->assign_vars(array('S_MC_SHOW_FEATURED' => intval($this->config->get('show_featured', 'mediacenter')) && count($arrFeaturedFiles), 'S_MC_SHOW_NEWEST' => intval($this->config->get('show_newest', 'mediacenter')) && count($arrNewestMedia), 'S_MC_SHOW_CATEGORIES' => intval($this->config->get('show_categories', 'mediacenter')), 'S_MC_SHOW_BESTRATED' => intval($this->config->get('show_bestrated', 'mediacenter')) && count($arrBestRatedMedia), 'S_MC_SHOW_MOSTVIEWED' => intval($this->config->get('show_mostviewed', 'mediacenter')) && count($arrMostViewedMedia), 'S_MC_SHOW_LATESTCOMMENTS' => intval($this->config->get('show_latestcomments', 'mediacenter')) && count($arrLatestCommentMedia), 'S_MC_TOOLBAR' => $arrPermissions['create'] || $this->user->check_auth('a_mediacenter_manage', false), 'MC_TOOLBAR' => $jqToolbar['id']));
            // -- EQDKP ---------------------------------------------------------------
            $this->core->set_vars(array('page_title' => $this->user->lang('mediacenter'), 'template_path' => $this->pm->get_data('mediacenter', 'template_path'), 'template_file' => 'mediacenter_index.html', 'display' => true));
        }
    }
Exemplo n.º 8
0
 public function display()
 {
     $intCategoryID = $this->in->get('c', 0);
     $strExchangeKey = $this->in->get('key');
     $user_id = $this->user->getUserIDfromExchangeKey($strExchangeKey);
     //Get latest Articles for a specific category
     if ($intCategoryID) {
         $arrArticleIDs = $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $user_id, true));
         $arrCategory = $this->pdh->get('article_categories', 'data', array($intCategoryID));
         switch ($arrCategory['sortation_type']) {
             case 4:
             case 3:
                 $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'last_edited', 'desc');
                 break;
             case 2:
             case 1:
             default:
                 $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'desc');
         }
     } else {
         //Get global latest articles
         $arrArticleCategoryIDs = $this->pdh->get('article_categories', 'id_list');
         $arrArticleIDs = array();
         foreach ($arrArticleCategoryIDs as $intCategoryID) {
             $arrArticleIDs = array_merge($arrArticleIDs, $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $user_id, true)));
         }
         $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'desc');
     }
     require_once $this->root_path . 'core/feed.class.php';
     $feed = registry::register('feed');
     $feed->feedfile = $this->env->link . $this->strPathPlain . '?key=' . $strExchangeKey;
     $feed->link = $this->env->link;
     $feed->title = $this->config->get('main_title') . ": " . $arrCategory['name'];
     $feed->description = strip_tags(xhtml_entity_decode($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($arrCategory['description']))));
     $feed->published = time();
     $feed->language = 'EN-EN';
     if (count($arrSortedArticleIDs)) {
         $arrSortedArticleIDs = $this->pdh->limit($arrSortedArticleIDs, 0, 30);
         foreach ($arrSortedArticleIDs as $intArticleID) {
             $strText = $this->pdh->get('articles', 'text', array($intArticleID));
             $arrContent = preg_split('#<hr(.*)id="system-readmore"(.*)\\/>#iU', xhtml_entity_decode($strText));
             $strText = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($arrContent[0]));
             //Replace Image Gallery
             $arrGalleryObjects = array();
             preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strText, $arrGalleryObjects, PREG_PATTERN_ORDER);
             if (count($arrGalleryObjects[0])) {
                 include_once $this->root_path . 'core/gallery.class.php';
                 foreach ($arrGalleryObjects[4] as $key => $val) {
                     $strText = str_replace($arrGalleryObjects[0][$key], "", $strText);
                 }
             }
             //Replace Raidloot
             $arrRaidlootObjects = array();
             preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strText, $arrRaidlootObjects, PREG_PATTERN_ORDER);
             if (count($arrRaidlootObjects[0])) {
                 include_once $this->root_path . 'core/gallery.class.php';
                 foreach ($arrRaidlootObjects[3] as $key => $val) {
                     $strText = str_replace($arrRaidlootObjects[0][$key], "", $strText);
                 }
             }
             $rssitem = registry::register('feeditems', array($intArticleID));
             $rssitem->title = sanitize($this->pdh->get('articles', 'title', array($intArticleID)));
             $rssitem->description = $strText;
             $rssitem->link = $this->user->removeSIDfromString($this->env->link . $this->pdh->get('articles', 'path', array($intArticleID)));
             $rssitem->published = $this->pdh->get('articles', 'date', array($intArticleID));
             $rssitem->author = $this->pdh->geth('articles', 'user_id', array($intArticleID));
             $rssitem->source = $feed->link;
             $feed->addItem($rssitem);
         }
     }
     header("Content-Type: application/xml; charset=utf-8");
     echo $feed->show();
     die;
 }
 public function output()
 {
     $this->tpl->js_file($this->server_path . 'portal/timeline/templates/js/timeline_portal.js');
     $this->tpl->css_file($this->server_path . 'portal/timeline/templates/timeline_portal.css');
     $arrCategories = $this->config('categories');
     $intInterval = (int) $this->config('interval');
     $intStartYear = $this->time->date('Y') - ($intInterval - 1);
     $arrMonthsNames = $this->user->lang('time_monthnames');
     //generate years & months
     for ($intYear = 0; $intYear <= $intInterval; $intYear++) {
         $this->tpl->assign_block_vars('pm_tl_years', array('COUNT' => $intYear, 'YEAR' => $intStartYear + $intYear, 'TIMESTAMP' => $this->time->mktime(0, 0, 0, 1, 1, $intStartYear + $intYear)));
         if ($intYear > 0) {
             for ($intMonth = 1; $intMonth < 12; $intMonth++) {
                 $this->tpl->assign_block_vars('pm_tl_months', array('COUNT' => $intMonth, 'YEAR' => $intYear, 'MONTH' => mb_substr($arrMonthsNames[$intMonth], 0, 3, 'UTF-8')));
             }
         }
     }
     //fetch all articles
     $arrArticles = $arrSortedArticles = array();
     foreach ($arrCategories as $intCategoryID) {
         $arrArticles = array_merge($arrArticles, $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $this->user->id)));
     }
     $arrArticles = array_unique($arrArticles);
     $arrArticles = $this->pdh->sort($arrArticles, 'articles', 'date', 'desc');
     //merge article_ids with same Dates
     foreach ($arrArticles as $intArticleID) {
         $intArticleDate = $this->pdh->get('articles', 'date', array($intArticleID));
         $intArticleDate = $this->time->date('Ymd', $intArticleDate);
         if (isset($arrSortedArticles[$intArticleDate])) {
             $arrSortedArticles[$intArticleDate][] = $intArticleID;
         } else {
             $arrSortedArticles[$intArticleDate] = array($intArticleID);
         }
     }
     //generate articles
     foreach ($arrSortedArticles as $arrArticleIDs) {
         $intDate = $this->pdh->get('articles', 'date', array($arrArticleIDs[0]));
         $this->tpl->assign_block_vars('pm_tl_articles', array('TIMESTAMP' => $intDate));
         foreach ($arrArticleIDs as $intArticleID) {
             $arrArticle = array();
             $arrArticle['date'] = $this->pdh->get('articles', 'date', array($intArticleID));
             $arrArticle['image'] = $this->pdh->get('articles', 'previewimage', array($intArticleID));
             $arrArticle['text'] = $this->pdh->get('articles', 'text', array($intArticleID));
             $arrArticle['title'] = $this->pdh->get('articles', 'title', array($intArticleID));
             $intWordcount = 200;
             $blnImage = false;
             if ($arrArticle['date'] + $intInterval * 60 * 60 * 24 * 365 < $this->time->time) {
                 continue;
             }
             if (strlen($arrArticle['image'])) {
                 $blnImage = true;
                 $arrArticle['image'] = register('pfh')->FileLink($arrArticle['image'], 'files', 'absolute');
             } else {
                 $arrArticle['image'] = '';
             }
             $arrArticle['text'] = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($arrArticle['text']));
             $arrArticle['text'] = strip_tags(xhtml_entity_decode($arrArticle['text']));
             $arrArticle['text'] = truncate($arrArticle['text'], $intWordcount, '...', false, true);
             $this->tpl->assign_block_vars('pm_tl_articles.article', array('ID' => $intArticleID, 'DATE' => $this->time->date('d.m.Y', $arrArticle['date']), 'TITLE' => $arrArticle['title'], 'IMAGE' => $blnImage, 'IMAGE_URL' => $arrArticle['image'], 'TEXT' => $arrArticle['text'], 'URL' => $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID))));
         }
     }
     $this->tpl->add_js("\n\t\t\t\$('#pm_timeline').timeline({  });\n\t\t", 'docready');
     return 'Error: Template file is empty.';
 }
Exemplo n.º 10
0
        private function opengraph_tags($title, $description, $image)
        {
            if ($this->blnMetaAdded) {
                return;
            }
            $strMetatags = '<meta property="og:title" content="' . $title . '" />
							<meta property="og:type" content="article" />
							<meta property="og:url" content="' . ($this->env->ssl ? 'https://' : 'http://') . $this->env->httpHost . xhtml_entity_decode($this->env->request) . '" />
							<meta property="og:description" content="' . htmlspecialchars(trim(strip_tags($description)), ENT_QUOTES) . '" />
							<meta property="og:image" content="' . $image . '" />';
            $this->tpl->add_meta($strMetatags);
            $this->blnMetaAdded = true;
        }
Exemplo n.º 11
0
 public function get_latest_articles($params, $body)
 {
     $isAPITokenRequest = $this->pex->getIsApiTokenRequest();
     //Get Number; default: 10
     $intNumber = intval($params['get']['number']) > 0 ? intval($params['get']['number']) : 10;
     //Get sort direction; default: desc
     $sort = isset($params['get']['sort']) && $params['get']['sort'] == 'asc' ? 'asc' : 'desc';
     $intCategoryID = isset($params['get']['c']) ? intval($params['get']['c']) : 0;
     $user_id = $this->user->id;
     $response = array();
     //Get latest Articles for a specific category
     if ($intCategoryID) {
         $arrArticleIDs = $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $user_id, true));
         $arrCategory = $this->pdh->get('article_categories', 'data', array($intCategoryID));
         switch ($arrCategory['sortation_type']) {
             case 4:
             case 3:
                 $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'last_edited', $sort);
                 break;
             case 2:
             case 1:
             default:
                 $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', $sort);
         }
     } else {
         //Get global latest articles
         $arrArticleCategoryIDs = $this->pdh->get('article_categories', 'id_list');
         $arrArticleIDs = array();
         foreach ($arrArticleCategoryIDs as $intCategoryID) {
             $arrArticleIDs = array_merge($arrArticleIDs, $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $user_id, true)));
         }
         $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', $sort);
     }
     if (count($arrSortedArticleIDs)) {
         $arrSortedArticleIDs = $this->pdh->limit($arrSortedArticleIDs, 0, $intNumber);
         foreach ($arrSortedArticleIDs as $intArticleID) {
             $strText = $this->pdh->get('articles', 'text', array($intArticleID));
             $arrContent = preg_split('#<hr(.*)id="system-readmore"(.*)\\/>#iU', xhtml_entity_decode($strText));
             $strText = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($arrContent[0]));
             //Replace Image Gallery
             $arrGalleryObjects = array();
             preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strText, $arrGalleryObjects, PREG_PATTERN_ORDER);
             if (count($arrGalleryObjects[0])) {
                 include_once $this->root_path . 'core/gallery.class.php';
                 foreach ($arrGalleryObjects[4] as $key => $val) {
                     $strText = str_replace($arrGalleryObjects[0][$key], "", $strText);
                 }
             }
             //Replace Raidloot
             $arrRaidlootObjects = array();
             preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strText, $arrRaidlootObjects, PREG_PATTERN_ORDER);
             if (count($arrRaidlootObjects[0])) {
                 include_once $this->root_path . 'core/gallery.class.php';
                 foreach ($arrRaidlootObjects[3] as $key => $val) {
                     $strText = str_replace($arrRaidlootObjects[0][$key], "", $strText);
                 }
             }
             $category_id = $this->pdh->get('articles', 'category', array($intArticleID));
             $comments = $this->pdh->get('comment', 'filtered_list', array('articles', $intArticleID));
             $arrComments = array();
             if (is_array($comments)) {
                 foreach ($comments as $key => $row) {
                     $avatarimg = $this->pdh->get('user', 'avatarimglink', array($row['userid']));
                     $arrComments['comment:' . $key] = array('username' => unsanitize($row['username']), 'user_avatar' => $this->pfh->FileLink($avatarimg != "" ? $avatarimg : 'images/global/avatar-default.svg', false, 'absolute'), 'date' => $this->time->date('Y-m-d H:i', $row['date']), 'date_timestamp' => $row['date'], 'message' => $this->bbcode->toHTML($row['text']));
                 }
             }
             $arrCommentsOut = array('count' => count($arrComments), 'page' => 'articles', 'attachid' => $intArticleID, 'comments' => $arrComments);
             $arrTags = array();
             $arrArticleTags = $this->pdh->get('articles', 'tags', array($intArticleID));
             if (is_array($arrArticleTags) && count($arrArticleTags) && $arrArticleTags[0] != "") {
                 foreach ($arrArticleTags as $k => $strTag) {
                     $arrTags['tag:' . $k] = $strTag;
                 }
             }
             $response['entries']['entry:' . $intArticleID] = array('id' => $intArticleID, 'title' => unsanitize($this->pdh->get('articles', 'title', array($intArticleID))), 'text' => $strText, 'link' => $this->user->removeSIDfromString($this->env->link . $this->pdh->get('articles', 'path', array($intArticleID))), 'permalink' => $this->env->link . 'index.php?a=' . $intArticleID, 'date' => $this->time->date('Y-m-d H:i', $this->pdh->get('articles', 'date', array($intArticleID))), 'date_timestamp' => $this->pdh->get('articles', 'date', array($intArticleID)), 'author' => unsanitize($this->pdh->geth('articles', 'user_id', array($intArticleID))), 'category_id' => $category_id, 'category' => $this->pdh->get('article_categories', 'name', array($category_id)), 'category_url' => $this->user->removeSIDfromString($this->env->link . $this->pdh->get('article_categories', 'path', array($category_id))), 'tags' => $arrTags, 'comments' => $arrCommentsOut);
         }
     }
     return $response;
 }
Exemplo n.º 12
0
    public function display()
    {
        $blnIsStartpage = false;
        $strPath = $this->env->path;
        $arrPath = array_filter(explode('/', $strPath));
        $arrPath = array_reverse($arrPath);
        $arrPath = $this->filterPathArray($arrPath);
        //Required, otherwise the Routing of Plugin URLS wont work.
        register('pm');
        if (count($arrPath) == 0 || str_ireplace('index.php', '', $strPath) === $this->config->get('server_path')) {
            $blnIsStartpage = true;
            //Get Start Page
            if ($this->config->get('start_page') != "") {
                $strPath = $this->config->get('start_page');
            } else {
                $strPath = "news";
            }
            $arrPath = array_filter(explode('/', $strPath));
            $arrPath = array_reverse($arrPath);
        }
        registry::add_const('patharray', $arrPath);
        $intArticleID = $intCategoryID = $strSpecificID = 0;
        //Search for static Routes first
        $strPageObject = false;
        foreach ($arrPath as $intPathPart => $strPathPart) {
            if (register('routing')->staticRoute($strPathPart)) {
                if ($intPathPart == 0) {
                    $strPageObject = register('routing')->staticRoute($strPathPart);
                    registry::add_const('page_path', $strPath);
                    registry::add_const('page', $strPath);
                } else {
                    //Static Page Object
                    $strPageObject = register('routing')->staticRoute($arrPath[$intPathPart]);
                    if ($strPageObject) {
                        //Zerlege .html
                        $strID = str_replace("-", "", strrchr($arrPath[0], "-"));
                        $arrMatches = array();
                        preg_match_all('/[a-z]+|[0-9]+/', $strID, $arrMatches, PREG_PATTERN_ORDER);
                        if (isset($arrMatches[0]) && count($arrMatches[0])) {
                            if (count($arrMatches[0]) == 2) {
                                if (is_numeric($arrMatches[0][1])) {
                                    $arrMatches[0][1] = intval($arrMatches[0][1]);
                                }
                                $this->in->inject($arrMatches[0][0], $arrMatches[0][1]);
                            }
                        }
                        if (strlen($strID)) {
                            if (is_numeric($strID)) {
                                $strID = intval($strID);
                            }
                            registry::add_const('url_id', $strID);
                        } elseif (strlen($arrPath[0])) {
                            registry::add_const('url_id', $arrPath[0]);
                            $this->in->inject(utf8_strtolower($arrPath[0]), 'injected');
                        }
                        registry::add_const('page', str_replace('/' . $arrPath[0], '', $strPath));
                        registry::add_const('page_path', $strPath);
                        registry::add_const('speaking_name', str_replace('-' . $strID, '', $arrPath[0]));
                        break;
                    }
                }
            }
        }
        if ($strPageObject) {
            $this->core->set_vars('portal_layout', 1);
            $objPage = $this->routing->getPageObject($strPageObject);
            if ($objPage) {
                $classname = get_class($objPage);
                $classname = str_replace("_pageobject", "", $classname);
                $intPortallayout = $this->pdh->get('portal_layouts', 'layout_for_route', array($classname, true));
                if ($intPortallayout !== false) {
                    $portal_layout = $intPortallayout;
                } else {
                    $portal_layout = 1;
                }
                $arrVars = $objPage->get_vars();
                $this->core->set_vars(array('page_title' => $arrVars['page_title'], 'template_file' => $arrVars['template_file'], 'portal_layout' => $portal_layout, 'display' => true));
            } else {
                redirect();
            }
        } else {
            //Search for Articles and Categories
            //Suche Alias in Artikeln
            $intArticleID = $this->in->exists('a') ? $this->in->get('a', 0) : $this->pdh->get('articles', 'resolve_alias', array($arrPath[0]));
            if (!$intArticleID) {
                //Suche Alias in Kategorien
                $intCategoryID = $this->in->exists('c') ? $this->in->get('c', 0) : $this->pdh->get('article_categories', 'resolve_alias', array($arrPath[0]));
                //Is there an index-Article in this Category?
                if ($intCategoryID) {
                    $intIndexArticle = $this->pdh->get('article_categories', 'index_article', array($intCategoryID));
                    if ($intIndexArticle) {
                        $intArticleID = $intIndexArticle;
                        $intCategoryID = false;
                    }
                }
                //Suche in Artikeln mit nächstem Index, denn könnte ein dynamischer Systemartikel sein
                if (!$intCategoryID && isset($arrPath[1])) {
                    $intArticleID = $this->pdh->get('articles', 'resolve_alias', array($arrPath[1]));
                    if ($intArticleID) {
                        //Zerlege .html
                        $strID = str_replace("-", "", strrchr($arrPath[0], "-"));
                        $arrMatches = array();
                        preg_match_all('/[a-z]+|[0-9]+/', $strID, $arrMatches, PREG_PATTERN_ORDER);
                        if (isset($arrMatches[0]) && count($arrMatches[0])) {
                            if (count($arrMatches[0]) == 2) {
                                if (is_numeric($arrMatches[0][1])) {
                                    $arrMatches[0][1] = intval($arrMatches[0][1]);
                                }
                                $this->in->inject($arrMatches[0][0], $arrMatches[0][1]);
                            }
                        }
                        if (strlen($strID)) {
                            if (is_numeric($strID)) {
                                $strID = intval($strID);
                            }
                            registry::add_const('url_id', $strID);
                            $strSpecificID = $strID;
                        } elseif (strlen($arrPath[0])) {
                            $this->in->inject(utf8_strtolower($arrPath[0]), 'injected');
                            registry::add_const('url_id', $arrPath[0]);
                            $strSpecificID = $arrPath[0];
                        }
                    } else {
                        $intCategoryID = $this->pdh->get('article_categories', 'resolve_alias', array($arrPath[1]));
                        if ($intCategoryID) {
                            $intIndexArticle = $this->pdh->get('article_categories', 'index_article', array($intCategoryID));
                            if ($intIndexArticle) {
                                $intArticleID = $intIndexArticle;
                                $intCategoryID = false;
                                //Zerlege .html
                                $strID = str_replace("-", "", strrchr($arrPath[0], "-"));
                                $arrMatches = array();
                                preg_match_all('/[a-z]+|[0-9]+/', $strID, $arrMatches, PREG_PATTERN_ORDER);
                                if (isset($arrMatches[0]) && count($arrMatches[0])) {
                                    if (count($arrMatches[0]) == 2) {
                                        if (is_numeric($arrMatches[0][1])) {
                                            $arrMatches[0][1] = intval($arrMatches[0][1]);
                                        }
                                        $this->in->inject($arrMatches[0][0], $arrMatches[0][1]);
                                    }
                                }
                                if (strlen($strID)) {
                                    if (is_numeric($strID)) {
                                        $strID = intval($strID);
                                    }
                                    registry::add_const('url_id', $strID);
                                    $strSpecificID = $strID;
                                } elseif (strlen($arrPath[0])) {
                                    $this->in->inject(utf8_strtolower($arrPath[0]), 'injected');
                                    registry::add_const('url_id', $arrPath[0]);
                                    $strSpecificID = $arrPath[0];
                                }
                            }
                        }
                    }
                }
            }
            //Display Artikel
            if ($intArticleID) {
                $arrArticle = $this->pdh->get('articles', 'data', array($intArticleID));
                //Perform Vote
                if ($this->in->exists('article_vote')) {
                    $arrVotedUsers = $this->pdh->get('articles', 'votes_users', array($intArticleID));
                    $blnUserHasVoted = is_array($arrVotedUsers) && in_array($this->user->id, $arrVotedUsers) && $this->user->id ? true : false;
                    if (!$blnUserHasVoted) {
                        $this->pdh->put('articles', 'vote', array($intArticleID, $this->in->get('article_vote', 0)));
                        $this->pdh->process_hook_queue();
                    }
                    $intSum = $this->pdh->get('articles', 'votes_sum', array($intArticleID));
                    $intCount = $this->pdh->get('articles', 'votes_count', array($intArticleID));
                    $intRating = $intCount ? round($intSum / $intCount) : 0;
                    die;
                }
                //Check if Published
                $intPublished = $arrArticle['published'];
                //Check Start to/start from
                if ($arrArticle['show_from'] != "" && $arrArticle['show_from'] > $this->time->time || $arrArticle['show_to'] != "" && $arrArticle['show_to'] < $this->time->time) {
                    $intPublished = false;
                }
                //Get Category Data
                $intCategoryID = $arrArticle['category'];
                registry::add_const('categoryid', $intCategoryID);
                $arrCategory = $this->pdh->get('article_categories', 'data', array($intCategoryID));
                //Category Permissions
                $arrPermissions = $this->pdh->get('article_categories', 'user_permissions', array($arrArticle['category'], $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('article_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                //Check Start to/start from
                if (!$intPublished && (!$arrPermissions['update'] && !$arrPermissions['change_state']) || !$arrCategory['published']) {
                    message_die($this->user->lang('article_unpublished'));
                }
                registry::add_const('page_path', $strPath);
                $strPath = ucfirst($this->pdh->get('articles', 'path', array($intArticleID)));
                registry::add_const('page', $this->user->removeSIDfromString($strPath));
                //User Memberships
                $arrUsergroupMemberships = $this->acl->get_user_group_memberships($this->user->id);
                //Page divisions
                $strText = xhtml_entity_decode($arrArticle['text']);
                $arrPagebreaks = array();
                preg_match_all('#<hr(.*)class="system-pagebreak"(.*)\\/>#iU', $strText, $arrPagebreaks, PREG_PATTERN_ORDER);
                $arrArticle['title'] = $this->user->multilangValue($arrArticle['title']);
                if (count($arrPagebreaks[0])) {
                    $arrTitles[1] = $arrArticle['title'];
                    foreach ($arrPagebreaks[2] as $key => $val) {
                        $titleMatches = array();
                        $intMatches = preg_match('#title="(.*)"#iU', $val, $titleMatches);
                        $arrTitles[$key + 2] = $intMatches && $titleMatches[1] != '' ? $titleMatches[1] : 'Page ' . $key + 2;
                    }
                    $arrContent = preg_split('#<hr(.*)class="system-pagebreak"(.*)\\/>#iU', $strText);
                    array_unshift($arrContent, "");
                } else {
                    $arrContent[0] = "";
                    $arrContent[1] = $strText;
                    $arrTitles[1] = $arrArticle['title'];
                }
                //Page
                $pageCount = count($arrContent) - 1;
                $intPageID = $this->in->get('page', 0) && isset($arrContent[$this->in->get('page', 0)]) ? $this->in->get('page', 0) : 1;
                //Bring Page Sitemap to Template
                if ($pageCount > 1) {
                    foreach ($arrTitles as $key => $val) {
                        $this->tpl->assign_block_vars('articlesitemap_row', array('LINK' => '<a href="' . $this->controller_path . $strPath . '&amp;page=' . $key . '">' . $val . '</a>', 'ACTIVE' => $key == $intPageID));
                    }
                }
                //Next and Previous Article
                $arrArticleIDs = $this->pdh->get('article_categories', 'published_id_list', array($arrArticle['category']));
                if (count($arrArticleIDs)) {
                    $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'asc');
                    $arrFlippedArticles = array_flip($arrSortedArticleIDs);
                    $intRecentArticlePosition = $arrFlippedArticles[$intArticleID];
                    $prevID = isset($arrSortedArticleIDs[$intRecentArticlePosition - 1]) ? $arrSortedArticleIDs[$intRecentArticlePosition - 1] : false;
                    $nextID = isset($arrSortedArticleIDs[$intRecentArticlePosition + 1]) ? $arrSortedArticleIDs[$intRecentArticlePosition + 1] : false;
                    $this->tpl->assign_vars(array('S_NEXT_ARTICLE' => $nextID !== false ? true : false, 'S_PREV_ARTICLE' => $prevID !== false ? true : false, 'U_NEXT_ARTICLE' => $nextID ? $this->controller_path . $this->pdh->get('articles', 'path', array($nextID)) : '', 'U_PREV_ARTICLE' => $prevID ? $this->controller_path . $this->pdh->get('articles', 'path', array($prevID)) : '', 'NEXT_TITLE' => $nextID ? $this->pdh->get('articles', 'title', array($nextID)) : '', 'PREV_TITLE' => $prevID ? $this->pdh->get('articles', 'title', array($prevID)) : ''));
                }
                $userlink = '<a href="' . $this->routing->build('user', $this->pdh->geth('articles', 'user_id', array($intArticleID)), 'u' . $this->pdh->get('articles', 'user_id', array($intArticleID))) . '">' . $this->pdh->geth('articles', 'user_id', array($intArticleID)) . '</a>';
                $arrToolbarItems = array();
                if ($arrPermissions['create']) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editArticle(0)"', 'title' => $this->user->lang('add_new_article'));
                }
                if ($arrPermissions['update']) {
                    $arrToolbarItems[] = array('icon' => 'fa-pencil-square-o', 'js' => 'onclick="editArticle(' . $intArticleID . ')"', 'title' => $this->user->lang('edit_article'));
                    $editor = register('tinyMCE');
                    //Init Inline Editor
                    $editor->inline_editor_simple('.headline_inlineedit', array('setup' => 'editor.on("blur", function(e) {
				            	save_inline_editor_simple(".headline_inlineedit", e);
				        	});', 'autofocus' => true, 'start_onload' => false));
                    $csrf = $this->user->csrfGetToken('editarticle_pageobjectsave_headline');
                    $csrf_raw = $this->user->csrfGetToken('editarticle_pageobjectgetrawarticle');
                    $csrf_article = $this->user->csrfGetToken('editarticle_pageobjectsave_article');
                    $this->tpl->add_js('function save_inline_editor_simple(selector, e){
				if (e.target.editorManager.activeEditor.isDirty() == false) return true;
			
				var newHeadline = e.target.editorManager.activeEditor.getContent();
					$.post( "' . $this->controller_path . 'EditArticle/' . $this->SID . '&save_headline=1&aid=' . $intArticleID . '&link_hash=' . $csrf . '",
					{ headline: newHeadline }, function( data ) {
						if (data.status != undefined && data.status == true){
							$("#notify_container").notify("create", "success", {text: ' . $this->tpl->handleModifier($this->user->lang('success_create_article'), 'jsencode') . ',title: ' . $this->tpl->handleModifier($this->user->lang('success'), 'jsencode') . ',custom: true,},{expires: 3000, speed: 1000});
						}
					}, "json");
			}
			
			var InlineLoaded = new Array();
			function focus_inline_editor(selector, e){
				if (InlineLoaded[selector] == undefined){
			
				e.target.editorManager.activeEditor.setContent("<b>Loading... <i class=\\"fa fa-spinner fa-spin fa-lg\\"></i></b><br /><br />", {format: "raw"});
			
				$.get( "' . $this->controller_path . 'EditArticle/' . $this->SID . '&get_raw_article=1&aid=' . $intArticleID . '&link_hash=' . $csrf_raw . '",
					function( data ) {
						if (data.text != undefined && data.text != false){
							e.target.editorManager.activeEditor.setContent(data.text,  {format: "raw"});
							InlineLoaded[selector] = 1;
						}
					}, "json");
				}
			}
		
			function save_inline_editor(selector, e){
				if (e.target.editorManager.activeEditor.isDirty() == false) return true;
			
				var newText = e.target.editorManager.activeEditor.getContent();
					$.post( "' . $this->controller_path . 'EditArticle/' . $this->SID . '&save_article=1&aid=' . $intArticleID . '&link_hash=' . $csrf_article . '",
					{ text: newText }, function( data ) {
						if (data.status != undefined && data.status == true){
							$("#notify_container").notify("create", "success", {text: ' . $this->tpl->handleModifier($this->user->lang('success_create_article'), 'jsencode') . ',title: ' . $this->tpl->handleModifier($this->user->lang('success'), 'jsencode') . ',custom: true,},{expires: 3000, speed: 1000});
						}
					}, "json");
			}
			
			
			
			$(".headline_inlineedit").on("dblclick", function(){
					tinyinlinesimple_21c3d11533bdc5e57418db4d323adbf5();
					$(".headline_inlineedit").off("dblclick");
			})
			$(".article-inlineedit").on("dblclick", function(){
					tinyinline_70f6da87ee4b4befde3c0e12de677bcc();
					$(".article-inlineedit").off("dblclick");
			})
			', 'docready');
                    $editor->inline_editor('.article-inlineedit', array('relative_urls' => false, 'link_list' => true, 'gallery' => true, 'raidloot' => true, 'image_upload' => true, 'setup' => 'editor.on("blur", function(e) {
							save_inline_editor(".article-inlineedit", e);
			        	});
			
					 	editor.on("focus", function(e) {
							focus_inline_editor(".article-inlineedit", e);
       					});', 'start_onload' => false, 'autofocus' => true, 'autoresize' => true), false);
                    $this->tpl->assign_vars(array('S_INLINE_EDIT' => true));
                }
                if ($arrPermissions['delete']) {
                    $arrToolbarItems[] = array('icon' => 'fa-trash-o', 'js' => 'onclick="deleteArticle(' . $intArticleID . ')"', 'title' => $this->user->lang('delete_article'));
                }
                if ($arrPermissions['change_state']) {
                    if ($intPublished) {
                        $arrToolbarItems[] = array('icon' => 'fa-eye-slash', 'js' => 'onclick="window.location=\'' . $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID . '&unpublish&link_hash=' . $this->CSRFGetToken('unpublish') . '&aid=' . $intArticleID . '\'"', 'title' => $this->user->lang('article_unpublish'));
                    } else {
                        $arrToolbarItems[] = array('icon' => 'fa-eye', 'js' => 'onclick="window.location=\'' . $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID . '&publish&link_hash=' . $this->CSRFGetToken('publish') . '&aid=' . $intArticleID . '\'"', 'title' => $this->user->lang('article_publish'));
                    }
                }
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                $arrVotedUsers = $this->pdh->get('articles', 'votes_users', array($intArticleID));
                $blnUserHasVoted = is_array($arrVotedUsers) && in_array($this->user->id, $arrVotedUsers) && $this->user->id ? true : false;
                //Tags
                $arrTags = $this->pdh->get('articles', 'tags', array($intArticleID));
                if (count($arrTags) && $arrTags[0] != "") {
                    foreach ($arrTags as $tag) {
                        $this->tpl->assign_block_vars('tag_row', array('TAG' => $tag, 'U_TAG' => $this->routing->build('tag', $tag)));
                    }
                }
                $this->comments->SetVars(array('attach_id' => $intArticleID . ($strSpecificID ? '_' . $strSpecificID : ''), 'page' => 'articles', 'auth' => 'a_articles_man', 'ntfy_type' => 'comment_new_article', 'ntfy_title' => $arrArticle['title'], 'ntfy_link' => $this->controller_path_plain . $this->page_path . $this->SID, 'ntfy_category' => $intCategoryID));
                $intCommentsCount = $this->comments->Count();
                //Replace page objects from Content
                $strContent = $this->bbcode->parse_shorttags($arrContent[$intPageID]);
                $strAdditionalTitles = '';
                preg_match_all('#<p(.*)class="system-article"(.*) title="(.*)">(.*)</p>#iU', $strContent, $arrPageObjects, PREG_PATTERN_ORDER);
                if (count($arrPageObjects[0])) {
                    include_once $this->root_path . 'core/pageobject.class.php';
                    foreach ($arrPageObjects[3] as $key => $val) {
                        $strPageObject = $val;
                        $strHaystack = $arrPageObjects[0][$key];
                        if (!is_file($this->root_path . 'core/pageobjects/' . $val . '_pageobject.class.php')) {
                            continue;
                        }
                        include_once $this->root_path . 'core/pageobjects/' . $val . '_pageobject.class.php';
                        $objPage = registry::register($val . '_pageobject');
                        $arrCoreVars = $objPage->get_vars();
                        if ($arrCoreVars['template_file'] != '') {
                            $strContent = str_replace($strHaystack, '<!-- INCLUDE ' . $arrCoreVars['template_file'] . ' --><br />', $strContent);
                        } else {
                            $strContent = str_replace($strHaystack, '', $strContent);
                        }
                        if (isset($arrCoreVars['page_title']) && strlen($arrCoreVars['page_title'])) {
                            $strAdditionalTitles = ' - ' . $arrCoreVars['page_title'];
                        }
                    }
                    $this->tpl->assign_var('S_INLINE_EDIT', false);
                }
                //Hook to replace content
                if ($this->hooks->isRegistered('article_parse')) {
                    $arrHooks = $this->hooks->process('article_parse', array('content' => $strContent, 'view' => 'article', 'article_id' => $intArticleID, 'specific_id' => $strSpecificID), true);
                    if (isset($arrHooks['content'])) {
                        $strContent = $arrHooks['content'];
                    }
                }
                //Replace Image Gallery
                $arrGalleryObjects = array();
                preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strContent, $arrGalleryObjects, PREG_PATTERN_ORDER);
                if (count($arrGalleryObjects[0])) {
                    include_once $this->root_path . 'core/gallery.class.php';
                    foreach ($arrGalleryObjects[4] as $key => $val) {
                        $objGallery = registry::register('gallery');
                        $strGalleryContent = $objGallery->create($val, (int) $arrGalleryObjects[3][$key], $this->controller_path . $strPath, $intPageID);
                        $strContent = str_replace($arrGalleryObjects[0][$key], $strGalleryContent, $strContent);
                    }
                }
                //Replace Raidloot
                $arrRaidlootObjects = array();
                preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strContent, $arrRaidlootObjects, PREG_PATTERN_ORDER);
                if (count($arrRaidlootObjects[0])) {
                    include_once $this->root_path . 'core/gallery.class.php';
                    foreach ($arrRaidlootObjects[3] as $key => $val) {
                        $objGallery = registry::register('gallery');
                        $withChars = $arrRaidlootObjects[5][$key] == "true" ? true : false;
                        $strRaidlootContent = $objGallery->raidloot((int) $val, $withChars);
                        $strContent = str_replace($arrRaidlootObjects[0][$key], $strRaidlootContent, $strContent);
                    }
                }
                //Replace Smilies
                $strContent = $this->bbcode->MyEmoticons($strContent);
                if ($arrPermissions['create'] || $arrPermissions['update']) {
                    $this->jquery->dialog('editArticle', $this->user->lang('edit_article'), array('url' => $this->controller_path . "EditArticle/" . $this->SID . "&aid='+id+'&cid=" . $intCategoryID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID));
                }
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $this->jquery->dialog('deleteArticle', $this->user->lang('delete_article'), array('custom_js' => 'deleteArticleSubmit(aid);', 'confirm', 'withid' => 'aid', 'message' => $this->user->lang('delete_article_confirm')), 'confirm');
                    $this->tpl->add_js("function deleteArticleSubmit(aid){\n\t\t\t\t\twindow.location='" . $this->controller_path . $this->page_path . $this->SID . '&delete&link_hash=' . $this->CSRFGetToken('delete') . "&aid='+aid;\n\t\t\t\t}");
                }
                $this->tpl->assign_vars(array('ARTICLE_ID' => $intArticleID, 'PAGINATION' => generate_pagination($this->controller_path . $strPath, $pageCount, 1, $intPageID - 1, 'page', 1), 'ARTICLE_CONTENT' => $strContent, 'ARTICLE_TITLE' => $arrTitles[$intPageID], 'ARTICLE_SUBMITTED' => sprintf($this->user->lang('news_submitter'), $userlink, $this->time->user_date($arrArticle['date'], false, true)), 'ARTICLE_DATE' => $this->time->user_date($arrArticle['date'], false, false, true), 'ARTILE_DATE_DAY' => $this->time->date('d', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTILE_DATE_MONTH' => $this->time->date('F', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTILE_DATE_YEAR' => $this->time->date('Y', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTICLE_TIMETAG' => $this->time->createTimeTag($arrArticle['date'], $this->time->user_date($arrArticle['date'], false, false, true) . ', ' . $this->time->user_date($arrArticle['date'], false, true)), 'ARTICLE_AUTHOR' => $userlink, 'ARTICLE_PUBLISHED' => $intPublished ? true : false, 'ARTICLE_TIME' => $this->time->user_date($arrArticle['date'], false, true), 'ARTICLE_REAL_CATEGORY' => $this->pdh->get('articles', 'category', array($intArticleID)), 'ARTICLE_REAL_CATEGORY_NAME' => $this->pdh->get('article_categories', 'name', array($this->pdh->get('articles', 'category', array($intArticleID)))), 'S_PAGINATION' => $pageCount > 1 ? true : false, 'ARTICLE_SOCIAL_BUTTONS' => $arrCategory['social_share_buttons'] ? $this->social->createSocialButtons($this->env->link . $this->controller_path_plain . $strPath, strip_tags($arrArticle['title'])) : '', 'PERMALINK' => $this->pdh->get('articles', 'permalink', array($intArticleID)), 'BREADCRUMB' => $this->pdh->get('articles', 'breadcrumb', array($intArticleID, $strAdditionalTitles, registry::get_const('url_id'), $arrPath)), 'ARTICLE_RATING' => $arrArticle['votes'] ? $this->jquery->starrating($intArticleID, $this->controller_path . $strPath . '&savevote&link_hash=' . $this->CSRFGetToken('savevote'), array('score' => $arrArticle['votes_count'] ? round($arrArticle['votes_sum'] / $arrArticle['votes_count']) : 0, 'number' => 10)) : '', 'ARTICLE_TOOLBAR' => $jqToolbar['id'], 'S_TOOLBAR' => $arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state'], 'S_TAGS' => count($arrTags) && $arrTags[0] != "" ? true : false, 'COMMENTS_COUNTER' => $intCommentsCount == 1 ? $intCommentsCount . ' ' . $this->user->lang('comment') : $intCommentsCount . ' ' . $this->user->lang('comments'), 'S_COMMENTS' => $arrArticle['comments'] ? true : false, 'S_HIDE_HEADER' => $arrArticle['hide_header'], 'S_FEATURED' => $this->pdh->get('articles', 'featured', array($intArticleID))));
                $strPreviewImage = $this->pdh->get('articles', 'previewimage', array($intArticleID)) != "" ? $this->pdh->geth('articles', 'previewimage', array($intArticleID)) : '';
                if (!strlen($strPreviewImage)) {
                    $strPreviewImage = $this->social->getFirstImage($strContent);
                }
                $this->social->callSocialPlugins($arrTitles[$intPageID], strip_tags(xhtml_entity_decode($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(truncate($strContent, 600, '...', false, true))))), $strPreviewImage);
                $this->tpl->add_meta('<link rel="canonical" href="' . $this->pdh->get('articles', 'permalink', array($intArticleID)) . '" />');
                $this->tpl->add_rssfeed($arrCategory['name'], $this->controller_path . 'RSS/' . $this->routing->clean($arrCategory['name']) . '-c' . $intCategoryID . '/' . ($this->user->is_signedin() ? '?key=' . $this->user->data['exchange_key'] : ''));
                //Comments
                if ($arrArticle['comments'] && $this->config->get('enable_comments') == 1) {
                    $this->comments->SetVars(array('ntfy_title' => $arrArticle['title'] . $strAdditionalTitles));
                    $this->tpl->assign_vars(array('COMMENTS' => $this->comments->Show()));
                }
                $intPortallayout = $blnIsStartpage ? $this->pdh->get('portal_layouts', 'layout_for_route', array('startpage', true)) : $arrCategory['portal_layout'];
                if ($intPortallayout === false) {
                    $intPortallayout = $arrCategory['portal_layout'];
                }
                $this->core->set_vars(array('page_title' => $arrArticle['title'] . $strAdditionalTitles, 'description' => truncate(strip_tags($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(xhtml_entity_decode($arrContent[$intPageID])))), 600, '...', false, true), 'image' => $strPreviewImage, 'template_file' => 'article.html', 'portal_layout' => $intPortallayout, 'display' => true));
            } elseif ($intCategoryID) {
                $arrCategory = $this->pdh->get('article_categories', 'data', array($intCategoryID));
                //Check if Published
                $intPublished = $arrCategory['published'];
                if (!$intPublished) {
                    message_die($this->user->lang('category_unpublished'));
                }
                registry::add_const('categoryid', $intCategoryID);
                //User Memberships
                $arrUsergroupMemberships = $this->acl->get_user_group_memberships($this->user->id);
                $arrPermissions = $this->pdh->get('article_categories', 'user_permissions', array($intCategoryID, $this->user->id));
                if (!$arrPermissions['read']) {
                    message_die($this->user->lang('category_noauth'), $this->user->lang('noauth_default_title'), 'access_denied', true);
                }
                $arrArticleIDs = $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, false, false, NULL, $arrPermissions['change_state'] ? true : false));
                switch ($arrCategory['sortation_type']) {
                    case 2:
                        $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'asc');
                        break;
                    case 3:
                        $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'last_edited', 'desc');
                        break;
                    case 4:
                        $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'last_edited', 'asc');
                        break;
                    case 1:
                    default:
                        $arrSortedArticleIDs = $this->pdh->sort($arrArticleIDs, 'articles', 'date', 'desc');
                }
                if ($arrCategory['featured_ontop']) {
                    $arrSortedArticleIDs = $this->pdh->get('articles', 'id_list_featured_ontop', array($arrSortedArticleIDs));
                }
                $intStart = $this->in->get('start', 0);
                $arrLimitedIDs = $this->pdh->limit($arrSortedArticleIDs, $intStart, $arrCategory['per_page']);
                $strPath = $this->pdh->get('article_categories', 'path', array($intCategoryID));
                registry::add_const('page_path', $this->user->removeSIDfromString($strPath));
                $arrCategory['name'] = $this->user->multilangValue($arrCategory['name']);
                //Articles to template
                foreach ($arrLimitedIDs as $intArticleID) {
                    $userlink = '<a href="' . $this->routing->build('user', $this->pdh->geth('articles', 'user_id', array($intArticleID)), 'u' . $this->pdh->get('articles', 'user_id', array($intArticleID))) . '">' . $this->pdh->geth('articles', 'user_id', array($intArticleID)) . '</a>';
                    //Content dependet from list_type
                    //1 = until readmore
                    //2 = Headlines only
                    //3 = only first 600 characters
                    $strText = $this->pdh->get('articles', 'text', array($intArticleID));
                    //Page divisions
                    $strText = xhtml_entity_decode($strText);
                    $arrPagebreaks = array();
                    preg_match_all('#<hr(.*)class="system-pagebreak"(.*)\\/>#iU', $strText, $arrPagebreaks, PREG_PATTERN_ORDER);
                    if (count($arrPagebreaks[0])) {
                        $arrContent = preg_split('#<hr(.*)class="system-pagebreak"(.*)\\/>#iU', $strText);
                        array_unshift($arrContent, "");
                    } else {
                        $arrContent[0] = "";
                        $arrContent[1] = $strText;
                    }
                    $strText = $arrContent[1];
                    $arrContent = preg_split('#<hr(.*)id="system-readmore"(.*)\\/>#iU', xhtml_entity_decode($strText));
                    $strText = $this->bbcode->parse_shorttags($arrContent[0]);
                    $blnPublished = $this->pdh->get('articles', 'published', array($intArticleID));
                    //Hook to replace content
                    if ($this->hooks->isRegistered('article_parse')) {
                        $arrHooks = $this->hooks->process('article_parse', array('content' => $strText, 'view' => 'category', 'article_id' => $intArticleID, 'specific_id' => $strSpecificID), true);
                        if (isset($arrHooks['content'])) {
                            $strText = $arrHooks['content'];
                        }
                    }
                    //Replace Image Gallery
                    $arrGalleryObjects = array();
                    preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strText, $arrGalleryObjects, PREG_PATTERN_ORDER);
                    if (count($arrGalleryObjects[0])) {
                        include_once $this->root_path . 'core/gallery.class.php';
                        foreach ($arrGalleryObjects[4] as $key => $val) {
                            $objGallery = registry::register('gallery');
                            $strGalleryContent = $objGallery->create($val, (int) $arrGalleryObjects[3][$key], $this->controller_path . $strPath, 1);
                            $strText = str_replace($arrGalleryObjects[0][$key], $strGalleryContent, $strText);
                        }
                    }
                    //Replace Raidloot
                    $arrRaidlootObjects = array();
                    preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strText, $arrRaidlootObjects, PREG_PATTERN_ORDER);
                    if (count($arrRaidlootObjects[0])) {
                        include_once $this->root_path . 'core/gallery.class.php';
                        foreach ($arrRaidlootObjects[3] as $key => $val) {
                            $objGallery = registry::register('gallery');
                            $withChars = $arrRaidlootObjects[5][$key] == "true" ? true : false;
                            $strRaidlootContent = $objGallery->raidloot((int) $val, $withChars);
                            $strText = str_replace($arrRaidlootObjects[0][$key], $strRaidlootContent, $strText);
                        }
                    }
                    //Replace Smilies
                    $strText = $this->bbcode->MyEmoticons($strText);
                    $arrToolbarItems = array();
                    if ($arrPermissions['create']) {
                        $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editArticle(0)"', 'title' => $this->user->lang('add_new_article'));
                    }
                    if ($arrPermissions['update']) {
                        $arrToolbarItems[] = array('icon' => 'fa fa-pencil-square-o', 'js' => 'onclick="editArticle(' . $intArticleID . ')"', 'title' => $this->user->lang('edit_article'));
                    }
                    if ($arrPermissions['delete']) {
                        $arrToolbarItems[] = array('icon' => 'fa-trash-o', 'js' => 'onclick="deleteArticle(' . $intArticleID . ')"', 'title' => $this->user->lang('delete_article'));
                    }
                    if ($arrPermissions['change_state']) {
                        if ($blnPublished) {
                            $arrToolbarItems[] = array('icon' => 'fa-eye-slash', 'js' => 'onclick="window.location=\'' . $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID . '&unpublish&link_hash=' . $this->CSRFGetToken('unpublish') . '&aid=' . $intArticleID . '\'"', 'title' => $this->user->lang('article_unpublish'));
                        } else {
                            $arrToolbarItems[] = array('icon' => 'fa-eye', 'js' => 'onclick="window.location=\'' . $this->env->link . $this->controller_path_plain . $this->page_path . $this->SID . '&publish&link_hash=' . $this->CSRFGetToken('publish') . '&aid=' . $intArticleID . '\'"', 'title' => $this->user->lang('article_publish'));
                        }
                    }
                    if ($arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state']) {
                        $jqToolbar = $this->jquery->toolbar('article_' . $intArticleID, $arrToolbarItems, array('position' => 'bottom'));
                    } else {
                        $jqToolbar['id'] = '';
                    }
                    $this->comments->SetVars(array('attach_id' => $intArticleID, 'page' => 'articles'));
                    $intCommentsCount = $this->comments->Count();
                    //Tags
                    $arrTags = $this->pdh->get('articles', 'tags', array($intArticleID));
                    $strPreviewImage = $this->pdh->get('articles', 'previewimage', array($intArticleID)) != "" ? $this->pdh->geth('articles', 'previewimage', array($intArticleID)) : '';
                    $this->tpl->assign_block_vars('article_row', array('ARTICLE_ID' => $intArticleID, 'ARTICLE_CONTENT' => $strText, 'ARTICLE_TITLE' => $this->pdh->get('articles', 'title', array($intArticleID)), 'ARTICLE_SUBMITTED' => sprintf($this->user->lang('news_submitter'), $userlink, $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, true)), 'ARTICLE_DATE' => $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, false, true), 'ARTICLE_TS' => $this->pdh->get('articles', 'date', array($intArticleID)), 'ARTICLE_TIMETAG' => $this->time->createTimeTag($this->pdh->get('articles', 'date', array($intArticleID)), $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, false, true) . ', ' . $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, true)), 'ARTICLE_AUTHOR' => $userlink, 'ARTICLE_TIME' => $this->time->user_date($this->pdh->get('articles', 'date', array($intArticleID)), false, true), 'ARTILE_DATE_DAY' => $this->time->date('d', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTILE_DATE_MONTH' => $this->time->date('F', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTILE_DATE_YEAR' => $this->time->date('Y', $this->pdh->get('articles', 'date', array($intArticleID))), 'ARTICLE_PATH' => $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID)), 'ARTICLE_SOCIAL_BUTTONS' => $arrCategory['social_share_buttons'] ? $this->social->createSocialButtons($this->env->link . $this->controller_path_plain . $this->pdh->get('articles', 'path', array($intArticleID)), strip_tags($this->pdh->get('articles', 'title', array($intArticleID)))) : '', 'ARTICLE_TOOLBAR' => $jqToolbar['id'], 'ARTICLE_PUBLISHED' => $blnPublished ? true : false, 'ARTICLE_REAL_CATEGORY' => $this->pdh->get('articles', 'category', array($intArticleID)), 'ARTICLE_REAL_CATEGORY_NAME' => $this->pdh->get('article_categories', 'name', array($this->pdh->get('articles', 'category', array($intArticleID)))), 'ARTICLE_PREVIEW_IMAGE' => $strPreviewImage, 'PERMALINK' => $this->pdh->get('articles', 'permalink', array($intArticleID)), 'S_TOOLBAR' => $arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state'], 'S_TAGS' => count($arrTags) && $arrTags[0] != "" ? true : false, 'ARTICLE_CUTTED_CONTENT' => truncate($strText, 600, '...', false, true), 'S_ARTICLE_CUTTED' => strlen($strText) > 600 ? true : false, 'S_READMORE' => isset($arrContent[1]) ? true : false, 'COMMENTS_COUNTER' => $intCommentsCount == 1 ? $intCommentsCount . ' ' . $this->user->lang('comment') : $intCommentsCount . ' ' . $this->user->lang('comments'), 'S_COMMENTS' => $this->pdh->get('articles', 'comments', array($intArticleID)) ? true : false, 'S_FEATURED' => $this->pdh->get('articles', 'featured', array($intArticleID)), 'S_HIDE_HEADER' => $this->pdh->get('articles', 'hide_header', array($intArticleID))));
                    if (count($arrTags) && $arrTags[0] != "") {
                        foreach ($arrTags as $tag) {
                            $this->tpl->assign_block_vars('article_row.tag_row', array('TAG' => $tag, 'U_TAG' => $this->routing->build('tag', $tag)));
                        }
                    }
                }
                //Childs
                if ($arrCategory['show_childs']) {
                    $arrChilds = $this->pdh->get('article_categories', 'childs', array($intCategoryID));
                    if (count($arrChilds)) {
                        $this->tpl->assign_vars(array('S_CHILDS' => true));
                        foreach ($arrChilds as $intChildID) {
                            if (!$this->pdh->get('article_categories', 'published', array($intChildID))) {
                                continue;
                            }
                            $this->tpl->assign_block_vars('child_row', array('NAME' => $this->pdh->get('article_categories', 'name', array($intChildID)), 'U_PATH' => $this->controller_path . $this->pdh->get('article_categories', 'path', array($intChildID)), 'COUNT' => count($this->pdh->get('article_categories', 'published_id_list', array($intChildID))), 'DESC' => strip_tags($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(xhtml_entity_decode($this->pdh->get('article_categories', 'description', array($intChildID))))))));
                        }
                    }
                }
                $arrToolbarItems = array();
                if ($arrPermissions['create']) {
                    $arrToolbarItems[] = array('icon' => 'fa-plus', 'js' => 'onclick="editArticle(0)"', 'title' => $this->user->lang('add_new_article'));
                }
                if ($this->user->check_auth('a_articles_man', false)) {
                    $arrToolbarItems[] = array('icon' => 'fa fa-pencil-square-o', 'js' => 'onclick="window.location=\'' . $this->server_path . "admin/manage_article_categories.php" . $this->SID . '&c=' . $intCategoryID . '\';"', 'title' => $this->user->lang('edit_article_category'));
                    $arrToolbarItems[] = array('icon' => 'fa-list', 'js' => 'onclick="window.location=\'' . $this->server_path . "admin/manage_articles.php" . $this->SID . '&c=' . $intCategoryID . '\';"', 'title' => $this->user->lang('list_articles'));
                }
                $jqToolbar = $this->jquery->toolbar('pages', $arrToolbarItems, array('position' => 'bottom'));
                if ($arrPermissions['create'] || $arrPermissions['update']) {
                    $this->jquery->dialog('editArticle', $this->user->lang('edit_article'), array('url' => $this->controller_path . "EditArticle/" . $this->SID . "&aid='+id+'&cid=" . $intCategoryID, 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . $this->controller_path_plain . $this->page_path));
                }
                if ($arrPermissions['delete'] || $arrPermissions['change_state']) {
                    $this->jquery->dialog('deleteArticle', $this->user->lang('delete_article'), array('custom_js' => 'deleteArticleSubmit(aid);', 'confirm', 'withid' => 'aid', 'message' => $this->user->lang('delete_article_confirm')), 'confirm');
                    $this->tpl->add_js("function deleteArticleSubmit(aid){\n\t\t\t\t\t\twindow.location='" . $this->controller_path . $this->page_path . $this->SID . '&delete&link_hash=' . $this->CSRFGetToken('delete') . "&aid='+aid;\n\t\t\t\t\t}");
                }
                $this->tpl->assign_vars(array('PAGINATION' => generate_pagination($this->controller_path . $strPath, count($arrSortedArticleIDs), $arrCategory['per_page'], $intStart, 'start'), 'CATEGORY_DESCRIPTION' => $this->bbcode->parse_shorttags(xhtml_entity_decode($arrCategory['description'])), 'CATEGORY_NAME' => $arrCategory['name'], 'PERMALINK' => $this->pdh->get('article_categories', 'permalink', array($intCategoryID)), 'RSSLINK' => $this->controller_path . 'RSS/' . $this->routing->clean($arrCategory['name']) . '-c' . $intCategoryID . '/' . ($this->user->is_signedin() ? '?key=' . $this->user->data['exchange_key'] : ''), 'BREADCRUMB' => $this->pdh->get('article_categories', 'parent', array($intCategoryID)) > 1 ? $this->pdh->get('article_categories', 'breadcrumb', array($intCategoryID)) : '', 'ARTICLE_TOOLBAR' => $jqToolbar['id'], 'S_TOOLBAR' => $arrPermissions['create'] || $arrPermissions['update'] || $arrPermissions['delete'] || $arrPermissions['change_state'], 'LIST_TYPE' => $arrCategory['list_type'], 'S_HIDE_HEADER' => $arrCategory['hide_header'], 'CATEGORY_ID' => $intCategoryID));
                $strPreviewImage = $this->pdh->get('articles', 'previewimage', array($intArticleID)) != "" ? $this->pdh->geth('articles', 'previewimage', array($intArticleID)) : '';
                if (!strlen($strPreviewImage)) {
                    $strPreviewImage = $this->social->getFirstImage($strContent);
                }
                $this->social->callSocialPlugins($arrCategory['name'], strip_tags(xhtml_entity_decode($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(truncate($arrCategory['description'], 600, '...', false, true))))), $strPreviewImage);
                $this->tpl->add_rssfeed($arrCategory['name'], $this->controller_path . 'RSS/' . $this->routing->clean($arrCategory['name']) . '-c' . $intCategoryID . '/' . ($this->user->is_signedin() ? '?key=' . $this->user->data['exchange_key'] : ''));
                $this->tpl->add_meta('<link rel="canonical" href="' . $this->pdh->get('article_categories', 'permalink', array($intCategoryID)) . '" />');
                $intPortallayout = $blnIsStartpage ? $this->pdh->get('portal_layouts', 'layout_for_route', array('startpage', true)) : $arrCategory['portal_layout'];
                if ($intPortallayout === false) {
                    $intPortallayout = $arrCategory['portal_layout'];
                }
                $this->core->set_vars(array('page_title' => $arrCategory['name'], 'description' => truncate(strip_tags($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(xhtml_entity_decode($arrCategory['description'])))), 600, '...', false, true), 'image' => $strPreviewImage, 'template_file' => 'category.html', 'portal_layout' => $intPortallayout, 'display' => true));
            }
        }
        if (!$this->env->is_ajax) {
            message_die($this->user->lang('article_not_found'));
        }
    }
Exemplo n.º 13
0
 public function process_data()
 {
     //Latest Articles
     $arrArticles = $this->pdh->get('articles', 'id_list', array());
     $arrArticles = $this->pdh->limit($arrArticles, 0, 25);
     $arrArticles = $this->pdh->sort($arrArticles, 'articles', 'date', 'desc');
     foreach ($arrArticles as $intArticleID) {
         $strText = $this->pdh->get('articles', 'text', array($intArticleID));
         $arrContent = preg_split('#<hr(.*)id="system-readmore"(.*)\\/>#iU', xhtml_entity_decode($strText));
         $strText = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($arrContent[0]));
         //Replace Image Gallery
         $arrGalleryObjects = array();
         preg_match_all('#<p(.*)class="system-gallery"(.*) data-sort="(.*)" data-folder="(.*)">(.*)</p>#iU', $strText, $arrGalleryObjects, PREG_PATTERN_ORDER);
         if (count($arrGalleryObjects[0])) {
             include_once $this->root_path . 'core/gallery.class.php';
             foreach ($arrGalleryObjects[4] as $key => $val) {
                 $strText = str_replace($arrGalleryObjects[0][$key], "", $strText);
             }
         }
         //Replace Raidloot
         $arrRaidlootObjects = array();
         preg_match_all('#<p(.*)class="system-raidloot"(.*) data-id="(.*)"(.*) data-chars="(.*)">(.*)</p>#iU', $strText, $arrRaidlootObjects, PREG_PATTERN_ORDER);
         if (count($arrRaidlootObjects[0])) {
             include_once $this->root_path . 'core/gallery.class.php';
             foreach ($arrRaidlootObjects[3] as $key => $val) {
                 $strText = str_replace($arrRaidlootObjects[0][$key], "", $strText);
             }
         }
         $arrNewsList[] = array('date' => $this->pdh->get('articles', 'html_date', array($intArticleID)), 'headline' => $this->pdh->get('articles', 'title', array($intArticleID)), 'content' => '<b><u><a href="' . $this->user->removeSIDfromString($this->env->link . $this->pdh->get('articles', 'path', array($intArticleID))) . '">' . unsanitize($this->pdh->get('articles', 'title', array($intArticleID))) . '</a></u></b><br /> ' . $strText);
     }
     //Next Events List
     $arrRaidIDlist = $this->pdh->get('calendar_events', 'id_list', array(false, $this->time->time));
     $arrRaidIDlist = $this->pdh->sort($arrRaidIDlist, 'calendar_events', 'date', 'asc');
     if (is_array($arrRaidIDlist)) {
         $arrRaidIDlist = array_slice($arrRaidIDlist, 0, 15);
     }
     $arrRaidList = array();
     if (is_array($arrRaidIDlist)) {
         foreach ($arrRaidIDlist as $intRaidID) {
             $ahref_start = (int) $this->pdh->get('calendar_events', 'calendartype', array($intRaidID)) == 1 ? '<a href="' . $this->env->link . $this->routing->build('calendarevent', $this->pdh->get('calendar_events', 'name', array($intRaidID)), $intRaidID, false, true) . '">' : '';
             $ahref_end = (int) $this->pdh->get('calendar_events', 'calendartype', array($intRaidID)) == 1 ? '</a>' : '';
             $arrRaidList[] = array('date' => $this->pdh->get('calendar_events', 'html_date', array($intRaidID)) . ' ' . $this->pdh->get('calendar_events', 'html_time_start', array($intRaidID)), 'headline' => $this->pdh->get('calendar_events', 'name', array($intRaidID)), 'content' => $ahref_start . $this->pdh->get('calendar_events', 'html_date', array($intRaidID)) . ' ' . $this->pdh->get('calendar_events', 'html_time_start', array($intRaidID)) . ': ' . $this->pdh->get('calendar_events', 'name', array($intRaidID)) . $ahref_end);
         }
     }
     $data = array('latest_news' => array('name' => $this->user->lang('news'), 'list' => $arrNewsList), 'next_events' => array('name' => $this->user->lang('massmail_next_events'), 'list' => $arrRaidList));
     //Plugin Hooks
     $arrPluginsHooks = $this->hooks->process('massmail_content');
     if (is_array($arrPluginsHooks)) {
         foreach ($arrPluginsHooks as $plugin => $value) {
             if (is_array($value)) {
                 $data = array_merge($data, $value);
             }
         }
     }
     //Bring the content to template
     if (is_array($data)) {
         foreach ($data as $key => $value) {
             $this->tpl->assign_block_vars('type_row', array('KEY' => 'd' . md5($key), 'NAME' => $value['name']));
             $this->jquery->selectall_checkbox('selall_d' . md5($key), 'cb_d' . md5($key) . '[]', $this->user->data['user_id']);
             if (is_array($value['list'])) {
                 foreach ($value['list'] as $listid => $listvalue) {
                     $this->tpl->assign_block_vars('type_row.content_row', array('DATE' => $listvalue['date'], 'HEADLINE' => $listvalue['headline'], 'CONTENT' => $listvalue['content'], 'ID' => 'd' . md5($key) . '_' . $listid));
                 }
             }
         }
     }
     $this->jquery->tab_header('massmail_content_tabs');
     $this->tpl->assign_vars(array('S_DATA' => true));
 }
Exemplo n.º 14
0
 public function display()
 {
     $start = $this->in->get('start', 0);
     $news_array = array();
     if ($this->url_id > 0) {
         //Single News
         $news_array[$this->url_id] = $this->pdh->get('news', 'news', array($this->url_id));
         if (!$news_array[$this->url_id]) {
             redirect('viewnews.php' . $this->SID);
         }
     } elseif ($this->in->exists('c')) {
         //Category
         $news_array = $this->pdh->aget('news', 'news', 0, array($this->pdh->get('news', 'news_ids4cat', array($this->in->get('c')))));
         $total_news = count($news_array);
         $ignore_flags = true;
         $this->tpl->assign_vars(array('NEWS_PAGINATION' => generate_pagination('viewnews.php' . $this->SID . '&amp;c=' . sanitize($this->in->get('c', 0)), $total_news, $this->user->data['user_nlimit'], $start)));
     } elseif ($this->in->exists('m')) {
         //Show a Month
         $start_date = $this->time->mktime(0, 0, 0, $this->in->get('m'), 0, $this->in->get('y'));
         $days = $this->time->date('t', $this->time->mktime(0, 0, 0, $this->in->get('m'), 0, $this->in->get('y')));
         $end_date = $this->time->mktime(0, 0, 0, $this->in->get('m'), $days, $this->in->get('y'));
         $allnews = $this->pdh->aget('news', 'date', 0, array($this->pdh->get('news', 'id_list')));
         asort($allnews);
         foreach ($allnews as $nid => $date) {
             if ($date > $start_date and $date < $end_date) {
                 $news_array[$nid] = $this->pdh->get('news', 'news', array($nid));
             }
         }
         unset($allnews);
         $total_news = count($news_array);
         $ignore_flags = true;
         $this->tpl->assign_vars(array('NEWS_PAGINATION' => generate_pagination('viewnews.php' . $this->SID . '&amp;y=' . sanitize($this->in->get('y', 0)) . '&amp;m=' . sanitize($this->in->get('m', 0)), $total_news, $this->user->data['user_nlimit'], $start)));
         $title = ' ' . $this->time->date('B', $this->time->mktime(0, 0, 0, $this->in->get('m'), 1, $this->in->get('y'))) . ' ' . $this->in->get('y');
     } else {
         //Show the News - default view
         $allnews = $this->pdh->aget('news', 'news', 0, array($this->pdh->get('news', 'id_list')));
         foreach ($allnews as $nid => $new) {
             if ((!$new['news_start'] or $new['news_start'] and $new['news_start'] < $this->time->time) and (!$new['news_stop'] or $new['news_stop'] and $new['news_stop'] > $this->time->time)) {
                 $news_array[$nid] = $new;
             }
         }
         unset($allnews);
         $total_news = count($news_array);
         $this->tpl->assign_vars(array('NEWS_PAGINATION' => generate_pagination('viewnews.php' . $this->SID, $total_news, $this->user->data['user_nlimit'], $start)));
     }
     $cur_news_number = 0;
     $sticky_news = 0;
     $first_news = false;
     $no_news = true;
     if (is_array($news_array)) {
         foreach ($news_array as $news_id => $news) {
             if (!$this->pdh->get('news', 'has_permission', array($news_id))) {
                 continue;
             }
             if (!@$news['news_flags'] || isset($ignore_flags)) {
                 if ($cur_news_number < $start) {
                     $cur_news_number++;
                     continue;
                 } else {
                     if ($cur_news_number >= $start + $this->user->data['user_nlimit']) {
                         break;
                     } else {
                         $cur_news_number++;
                     }
                 }
             } else {
                 $news['news_headline'] = $this->user->lang('sticky_news_prefix') . ' ' . $news['news_headline'];
                 $sticky_news++;
             }
             $this->tpl->assign_block_vars('date_row', array('DATE' => $this->time->user_date($news['news_date'], false, false, true)));
             if (!$first_news) {
                 $first_news = $news;
             }
             $message = $news['news_message'];
             //Extended News
             if ($this->url_id and strlen($news['extended_message']) > 1) {
                 $message .= "<br/><br/>" . $news['extended_message'];
             } else {
                 //listview
                 if (strlen($news['extended_message']) > 1) {
                     $message .= '<br><a class="button news_rmlink" href="viewnews.php' . $this->SID . '&amp;id=' . $news['news_id'] . '">' . $this->user->lang('news_readmore') . '</a>';
                 }
             }
             $message = $this->bbcode->parse_shorttags(xhtml_entity_decode($message));
             $message .= $this->newsloot($news['showRaids_id']);
             $show_comment = $comments_counter = $COMMENT = false;
             $nocomments = isset($news['nocomments']) ? $news['nocomments'] : 0;
             if ($nocomments != 1) {
                 // get the count of comments per news:
                 $this->comments->SetVars(array('attach_id' => $news['news_id'], 'page' => 'news'));
                 $comcount = $this->comments->Count();
                 $comments_counter = $comcount == 1 ? $comcount . ' ' . $this->user->lang('comment') : $comcount . ' ' . $this->user->lang('comments');
                 if ($this->url_id) {
                     $COMMENT = $this->comments->Show();
                 }
                 $show_comment = true;
             }
             //News Categories
             $news_icon = '';
             $headline = '';
             if ($this->config->get('enable_newscategories') == 1 && ($icon = $this->pdh->get('news_categories', 'icon', $news['news_category_id']))) {
                 $news_icon = '<img src="' . $this->pfh->FilePath('newscat_icons/' . sanitize($icon), 'eqdkp') . '" class="absmiddle" alt="Category Icon" />&nbsp;';
             }
             if ($this->config->get('enable_newscategories') == 1 && ($color = $this->pdh->get('news_categories', 'color', $news['news_category_id']))) {
                 $headline = '<span style="color:#' . $color . '">' . stripslashes($news['news_headline']) . '</span>';
             } else {
                 $headline = stripslashes($news['news_headline']);
             }
             $userlink = '<a href="' . $this->root_path . 'listusers.php' . $this->SID . '&amp;u=' . $news['user_id'] . '">' . sanitize($news['username']) . '</a>';
             $this->tpl->assign_block_vars('date_row.news_row', array('HEADLINE' => $headline, 'SOCIAL_BUTTONS' => $this->social->createSocialButtons($this->env->link . 'viewnews.php?id=' . $news_id, strip_tags($headline)), 'URL_RAW' => rawurlencode($this->env->link . 'viewnews.php?id=' . $news_id), 'SUBMITTED' => sprintf($this->user->lang('news_submitter'), $userlink, $this->time->user_date($news['news_date'], false, true)), 'ID' => $news_id, 'DETAIL' => $this->url_id > 0 ? true : false, 'SHOWCOMMENT' => $show_comment, 'COMMENTS_COUNTER' => $comments_counter, 'COMMENT' => $COMMENT, 'ICON' => $news_icon, 'CATEGORY_LINK' => 'viewnews.php' . $this->SID . '&amp;c=' . $news['news_category_id'], 'CATEGORY_ID' => $news['news_category_id'], 'CATEGORY_NAME' => $news['news_category'], 'MESSAGE' => $message));
             $no_news = false;
         }
     }
     $this->tpl->add_rssfeed($this->config->get('guildtag') . ' - News', 'last_news.xml', array('u_news_view'));
     $this->jquery->dialog('addNews', $this->user->lang('add_news'), array('url' => "admin/manage_news.php" . $this->SID . '&simple_head=true&n=0', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . 'viewnews.php' . $this->SID));
     $this->jquery->dialog('editNews', $this->user->lang('manage_news'), array('url' => "admin/manage_news.php" . $this->SID . "&n='+id+'&simple_head=true", 'withid' => 'id', 'width' => 920, 'height' => 740, 'onclose' => $this->env->link . 'viewnews.php' . $this->SID));
     $this->tpl->assign_vars(array('S_NEWSADM_ADD' => $this->user->check_auth('a_news_add', false), 'S_NEWSADM_UPD' => $this->user->check_auth('a_news_upd', false), 'S_NEWS_ARCHIVE_DISABLED' => $this->config->get('pk_show_newsarchive') == 0 ? true : false, 'S_NO_NEWS' => $no_news, 'S_SOCIAL_BUTTONS' => $this->config->get('enable_social_sharing') == 1 ? true : false, 'S_NEWSDETAILS' => $this->url_id > 0 ? true : false, 'S_CATS_ENABLED' => $this->config->get('enable_newscategories')));
     if ($no_news) {
         $news['extended_message'] = '';
     }
     $this->core->set_vars(array('page_title' => $this->url_id ? stripslashes($news['news_headline']) : '', 'description' => strip_tags($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(xhtml_entity_decode($first_news['news_message'])))), 'image' => $this->social->getFirstImage(xhtml_entity_decode($first_news['news_message'] . $news['extended_message'])), 'template_file' => 'viewnews.html', 'display' => true));
 }
Exemplo n.º 15
0
 public function display_guildrules()
 {
     $button = $this->user->is_signedin() ? 'confirmed' : 'register';
     $intGuildrulesArticleID = $this->pdh->get('articles', 'resolve_alias', array('guildrules'));
     $arrArticle = $this->pdh->get('articles', 'data', array($intGuildrulesArticleID));
     $strText = xhtml_entity_decode($arrArticle['text']);
     $this->tpl->assign_vars(array('SUBMIT_BUTTON' => $button, 'HEADER' => $this->user->lang('guildrules'), 'TEXT' => $strText, 'S_LICENCE' => true));
     $this->core->set_vars(array('page_title' => $this->user->lang('register_title'), 'template_file' => 'register.html', 'display' => true));
 }
Exemplo n.º 16
0
        public function get_html_value($id)
        {
            $strValue = $this->objPagination->get($id, 'log_value');
            $log_value = unserialize($strValue);
            $arrTable = array();
            $arrCompare = array();
            $objLogs = register('logs');
            if (is_array($log_value)) {
                foreach ($log_value as $k => $v) {
                    if ($k != 'header') {
                        //Enable Compare view
                        if (is_array($v)) {
                            if ($v['flag'] == 1) {
                                require_once $this->root_path . 'libraries/diff/diff.php';
                                require_once $this->root_path . 'libraries/diff/engine.php';
                                require_once $this->root_path . 'libraries/diff/renderer.php';
                                $diff = new diff(xhtml_entity_decode($objLogs->lang_replace($v['old'])), xhtml_entity_decode($objLogs->lang_replace($v['new'])), true);
                                $renderer = new diff_renderer_inline();
                                $new = $content = $renderer->get_diff_content($diff);
                            } else {
                                $new = nl2br($objLogs->lang_replace($v['new']));
                            }
                            $arrCompare[] = array($objLogs->lang_replace(stripslashes($k)), nl2br($objLogs->lang_replace($v['old'])), $new, $v['flag']);
                        } else {
                            $arrTable[] = array($objLogs->lang_replace(stripslashes($k)), $objLogs->lang_replace(stripslashes($v)));
                        }
                    }
                }
            }
            $out = "";
            if (count($arrTable)) {
                $out .= '<table class="table fullwidth">';
                foreach ($arrTable as $val) {
                    if (is_serialized($val[1])) {
                        $val[1] = print_r(unserialize($val[1]), true);
                    }
                    $out .= '<tr><td style="font-weight: bold;">' . $val[0] . ':</td><td>' . $val[1] . '</td></tr>';
                }
                $out .= '</table><br />';
            }
            if (count($arrCompare)) {
                $out .= '<table  class="table fullwidth colorswitch">
				<tr>
				<th>' . $this->user->lang('value') . '</th><th>' . $this->user->lang('old_value') . '</th><th>' . $this->user->lang('new_value') . '</th>
				</tr>';
                foreach ($arrCompare as $val) {
                    $out .= '<tr>
				<td style="font-weight: bold;">' . $val[0] . '</td><td style="white-space: pre-wrap; word-break: break-word;">' . $val[1] . '</td><td class="log-comp-pre">' . $val[2] . '</td>
				</tr>';
                }
                $out .= '</table>';
            }
            return $out;
        }
    public function output()
    {
        $this->tpl->js_file($this->server_path . 'portal/articleslider/js/responsiveslides.min.js');
        $intLimit = $this->config('maxitems') ? intval($this->config('maxitems')) : 5;
        $intTimeout = $this->config('timeout') ? intval($this->config('timeout')) : 5000;
        $strWidth = strlen($this->config('width')) ? intval($this->config('width')) : '100%';
        $intHeight = strlen($this->config('height')) ? intval($this->config('height')) : 300;
        $intWordcount = strlen($this->config('wordcount')) ? intval($this->config('wordcount')) : 160;
        $blnAuto = true;
        if (strlen($this->config('auto'))) {
            $blnAuto = $this->config('auto');
        }
        $this->tpl->add_css("\n.rslides {\n  position: relative;\n  list-style: none;\n  overflow: hidden;\n  padding: 0;\n  margin: 0;\n}\n\n.rslides li {\n  -webkit-backface-visibility: hidden;\n  position: absolute;\n  display: none;\n  width: 100%;\n  left: 0;\n  top: 0;\n  }\n\n.rslides li:first-child {\n  position: relative;\n  display: block;\n  float: left;\n  }\n\n.rslides img {\n  display: block;\n  height: auto;\n  float: left;\n  width: 100%;\n  border: 0;\n  }\n.callbacks {\n  position: relative;\n  list-style: none;\n  overflow: hidden;\n  width: 100%;\n  padding: 0;\n  margin: 0;\n  }\n.callbacks_container.slider_" . $this->id . " {\n  position: relative;\n  margin: auto;\n" . ($strWidth != "100%" ? 'max-width: ' . $strWidth . ';' : '') . "\n  }\n.callbacks li {\n  position: absolute;\n  width: 100%;\n  left: 0;\n  bottom: 0;\n  }\n\n.callbacks img {\n  display: block;\n  position: relative;\n  z-index: 1;\n  height: auto;\n  width: 100%;\n  border: 0;\n}\n\t\t\t\t\n.slider_" . $this->id . " .callbacks_imagecontainer {\n\tmax-height: " . $intHeight . "px;\n\toverflow: hidden;\n}\n\t\t\t\t\n.callbacks .caption {\n  display: block;\n  position: absolute;\n  z-index: 2;\n  font-size: 14px;\n  text-shadow: none;\n  color: #fff;\n  background: #000;\n  background: rgba(0,0,0, .7);\n  left: 0;\n  right: 0;\n  bottom: 0;\n  padding: 10px 20px;\n  margin: 0;\n  max-width: none;\n}\n\n.callbacks_container:hover .callbacks_nav {\n\tdisplay:block;\t\n}\t\t\t\t\n\n.callbacks_nav {\n  position: absolute;\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n  top: 52%;\n  left: 0;\n  opacity: 0.7;\n  z-index: 3;\n  text-indent: -9999px;\n  overflow: hidden;\n  text-decoration: none;\n  height: 61px;\n  width: 38px;\n  background: transparent url(\"" . $this->server_path . "portal/articleslider/images/themes.gif\") no-repeat left top;\n  margin-top: -45px;\ndisplay:none;\n  }\n\n.callbacks_nav:active {\n  opacity: 1.0;\n  }\n\n.callbacks_nav.next {\n  left: auto;\n  background-position: right top;\n  right: 0;\n  border-top-left-radius: 4px;\n  border-bottom-left-radius: 4px;\n  }\n.callbacks_nav.prev {\n\tborder-top-right-radius: 4px;\n\tborder-bottom-right-radius: 4px;\t\n}\t\t\t\n.callbacks_tabs {\n  margin-top: 10px;\n  text-align: center;\n  }\n\n.callbacks_tabs li {\n  display: inline;\n  float: none;\n  _float: left;\n  *float: left;\n  margin-right: 5px;\n  }\n\n.callbacks_tabs a {\n  text-indent: -9999px;\n  overflow: hidden;\n  -webkit-border-radius: 15px;\n  -moz-border-radius: 15px;\n  border-radius: 15px;\n  background: #ccc;\n  background: rgba(0,0,0, .2);\n  display: inline-block;\n  _display: block;\n  *display: block;\n  -webkit-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  -moz-box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  box-shadow: inset 0 0 2px 0 rgba(0,0,0,.3);\n  width: 14px;\n  height: 14px;\n  }\n\n.callbacks_here a {\n  background: #222;\n  background: rgba(0,0,0, .8);\n  }\t\t\t\n\t\t");
        $arrCategories = $this->config('categories');
        if (empty($arrCategories)) {
            $arrCategories = array();
        }
        $arrArticles = array();
        foreach ($arrCategories as $intCategoryID) {
            $arrArticles = array_merge($arrArticles, $this->pdh->get('article_categories', 'published_id_list', array($intCategoryID, $this->user->id, false, true)));
        }
        $arrArticles = array_unique($arrArticles);
        $arrSortedArticles = $this->pdh->sort($arrArticles, 'articles', 'date', 'desc');
        $arrSortedArticles = $this->pdh->limit($arrSortedArticles, 0, $intLimit);
        $this->tpl->add_js('		
		$("#slider_' . $this->id . '").responsiveSlides({
	        auto: ' . ($blnAuto ? 'true' : 'false') . ',
	        pager: true,
	        nav: true,
	        speed: 500,
			timeout: ' . $intTimeout . ',
			pause: true,
			namespace: "callbacks",
	      });
		', 'docready');
        $strOut = '<div class="callbacks_container slider_' . $this->id . '"><ul class="rslides" id="slider_' . $this->id . '">';
        foreach ($arrSortedArticles as $intArticleID) {
            $strOut .= '<li><a href="' . $this->controller_path . $this->pdh->get('articles', 'path', array($intArticleID)) . '">';
            $strPreviewImage = $this->pdh->get('articles', 'previewimage', array($intArticleID));
            if (strlen($strPreviewImage)) {
                $strImage = register('pfh')->FileLink($strPreviewImage, 'files', 'absolute');
            } else {
                $strImage = $this->server_path . 'portal/articleslider/images/dummy.jpg';
            }
            $strTitle = $this->pdh->get('articles', 'title', array($intArticleID));
            $strOut .= '<div class="callbacks_imagecontainer"><img src="' . $strImage . '" alt="' . $strTitle . '" /></div>';
            if (strlen($strTitle)) {
                $strText = $this->pdh->get('articles', 'text', array($intArticleID));
                $strText = $this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags($strText));
                $strText = strip_tags(xhtml_entity_decode($strText));
                $strText = truncate($strText, $intWordcount, '...', false, true);
                $strOut .= '<p class="caption"><span style="font-weight:bold;">' . $strTitle . '</span><br />';
                $strOut .= $strText;
                $strOut .= '</p>';
            }
            $strOut .= '</a></li>';
        }
        $strOut .= "</ul></div>";
        return $strOut;
    }
 public function output()
 {
     return xhtml_entity_decode(htmlspecialchars_decode($this->config('useroutput')));
 }
Exemplo n.º 19
0
 public function display()
 {
     if ($this->in->get('page', '')) {
         if (is_numeric($this->in->get('page', ''))) {
             $id = $this->in->get('page', '');
         } else {
             $id = $this->pdh->get('pages', 'alias_to_page', array($this->in->get('page', '')));
         }
     } else {
         message_die($this->user->lang('info_invalid_id'), $this->user->lang('info_invalid_id_title'));
     }
     if (!$this->pdh->get('pages', 'page_exists', array($id))) {
         message_die($this->user->lang('info_invalid_id'), $this->user->lang('info_invalid_id_title'));
     }
     if (!$this->pdh->get('pages', 'check_visibility', array($id))) {
         message_die($this->user->lang('noauth_u_information_view'), $this->user->lang('noauth_default_title'));
     }
     $content = $this->pdh->get('pages', 'content', array($id));
     $arrHooks = $this->hooks->process('pages_parse', array('text' => $content), true);
     $content = $arrHooks['text'];
     $myRatings = array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10');
     $users_voted = $this->pdh->get('pages', 'voters', array($id));
     $u_has_voted = !$users_voted[$this->user->data['user_id']] ? false : true;
     $this->tpl->assign_vars(array('PAGE_ID' => $id, 'INFO_PAGE_CONTENT' => $this->bbcode->parse_shorttags(xhtml_entity_decode($content)), 'INFO_PAGE_TITLE' => sanitize($this->pdh->get('pages', 'title', array($id))), 'EDITED' => $this->pdh->get('pages', 'edit_date', array($id)) ? $this->user->lang('info_edit_user') . $this->pdh->get('user', 'name', array($this->pdh->get('pages', 'edit_user', array($id)))) . $this->user->lang('info_edit_date') . $this->time->user_date($this->pdh->get('pages', 'edit_date', array($id)), false, false, true) : '', 'S_IS_ADMIN' => $this->user->check_auth('a_pages_man', false), 'STAR_RATING' => $this->pdh->get('pages', 'voting', array($id)) == '1' ? $this->jquery->StarRating('info_vote', $myRatings, 'pages.php' . $this->SID . '&page=' . sanitize($id) . '&mode=vote', $this->pdh->get('pages', 'rating', array($id)), $u_has_voted) : ''));
     //Comment-System
     if ($this->pdh->get('pages', 'comments', array($id)) == '1') {
         $this->comments->SetVars(array('attach_id' => $id, 'page' => 'custompages', 'auth' => 'a_pages_man'));
         $this->tpl->assign_vars(array('COMMENTS' => $this->comments->Show()));
     }
     $this->core->set_vars(array('page_title' => sanitize($this->pdh->get('pages', 'title', array($id))), 'template_file' => 'pages.html', 'description' => substr(strip_tags($this->bbcode->remove_embeddedMedia($this->bbcode->remove_shorttags(xhtml_entity_decode($content)))), 0, 250), 'image' => register('socialplugins')->getFirstImage(xhtml_entity_decode($content)), 'display' => true));
 }