コード例 #1
0
 /**
  * Get The Image
  *
  */
 function Child($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //get the image
     $content = section_content::Render($file_sections, $title, $file_stats);
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         return;
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         return;
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         return;
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     // check for resized image, get original source if img is resized
     if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
         $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
     }
     $thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     echo '<li>';
     echo '<img src="' . $thumb_path . '"/>';
     //echo $img;
     $label = common::GetLabel($title);
     echo common::Link($title, $label);
     echo '</li>';
 }
コード例 #2
0
ファイル: Catalog_Easy.php プロジェクト: a2exfr/Catalog-Easy
 function getImageandInfo($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     //check if page not special!
     if (!file_exists($file)) {
         return;
     }
     $file_sections = $file_stats = array();
     ob_start();
     include $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //avoid error- maximum function nesting level of '250' reached
     foreach ($file_sections as $key => $val) {
         if ($val['type'] == 'include' or $val['type'] == 'Catalog_easy_section') {
             unset($file_sections[$key]);
             //dummy section instead of include
             $file_sections[$key] = array('type' => 'text', 'content' => '<div><p>Lorem ipsum </p></div>', 'attributes' => array());
         }
     }
     if (!$file_sections) {
         return;
     }
     $file_sections = array_values($file_sections);
     //get short info and datafilter
     //new data-filter 1.8.1 from menu settt
     $datafilter = $this->getNewdatafilter($title);
     foreach ($file_sections as $sect) {
         if (isset($sect['attributes'])) {
             if (isset($sect['attributes']['class'])) {
                 //if ($sect['attributes']['class'] == "short_info"){
                 if (strpos($sect['attributes']['class'], 'short_info') !== false) {
                     $short_info = $sect['content'];
                 }
             }
         }
         if (isset($sect['attributes']['data-filter'])) {
             $datafilter = $sect['attributes']['data-filter'];
         }
     }
     //end section foreach
     if (!isset($datafilter)) {
         $datafilter = "";
     }
     if (!isset($short_info)) {
         $short_info = "";
     }
     //get the image + check abrev + check for custom page image
     $custom_image = $this->getCustomPageImage($title);
     $content = section_content::Render($file_sections, $title, $file_stats);
     if ($this->ShortInfo == "abrev") {
         $short_info = $this->GetAbrev($content, $title, $this->AbbrevL);
     } elseif ($this->ShortInfo == "no") {
         $short_info = "";
     }
     $img_flag = true;
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         $img_flag = false;
         //   return array('',$short_info,$datafilter);
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         $img_flag = false;
         // return array('',$short_info,$datafilter);
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         $img_flag = false;
         // return array('',$short_info,$datafilter);
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     //$thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     //no img on page+custom exist
     if (!$img_flag and $custom_image != "") {
         $src = $custom_image;
     } elseif (!$img_flag) {
         return array('', $short_info, $datafilter);
     }
     if ($custom_image != "") {
         $src = $custom_image;
     }
     if ($this->ImageCircle) {
         $a = "img-circle";
     } else {
         $a = "";
     }
     if ($this->catalog_layout == 1 or $this->catalog_layout == 4 or $this->catalog_layout == 2) {
         $style = 'max-height:' . $this->ImagesizeH . 'px!important;';
     } elseif ($this->catalog_layout == 0) {
         $style = 'max-width:' . $this->ImagesizeW . 'px!important; ';
     } elseif ($this->catalog_layout == 3 or $this->catalog_layout == 5) {
         $style = "";
     } else {
         $style = 'width:' . $this->ImagesizeW . 'px!important; height:' . $this->ImagesizeH . 'px!important;';
     }
     if ($this->ECthumb) {
         $style = "";
         $image_real = $this->GetRealImage($src);
         //get source of resized image
         if ($image_real == "resized_img") {
             foreach ($file_sections as $sect) {
                 if ($sect['type'] == 'image') {
                     $image_real = $sect['orig_src'];
                     break;
                 }
             }
         }
         $catalog_thumb = $this->MakeCatalogThumbhail($image_real);
         $src = $catalog_thumb;
     }
     $label = common::GetLabel($title);
     if ($this->ShowImage) {
         if ($this->catalog_layout == 5 and $this->imagelinked == 1) {
             $show = '<img class="img-responsive thumbnail ' . $a . '" style="' . $style . '" alt="' . $label . '" src="' . $src . '"/>';
             if ($this->ECthumb) {
                 $src = $image_real;
             }
             $show = '<a name="gallery" rel="EC_pf" title="' . $label . '" href="' . $src . '">' . $show . '</a>';
         } elseif ($this->catalog_layout > 5) {
             $style = $this->addLayImgStyle();
             $show = '<img  ' . $style . '  alt="' . $label . '" src="' . $src . '"/>';
         } else {
             $show = '<img class="img-responsive ' . $a . '" style="' . $style . '" alt="' . $label . '" src="' . $src . '"/>';
             $show = common::Link($title, $show);
         }
     } else {
         $show = "";
     }
     return array($show, $short_info, $datafilter);
 }
コード例 #3
0
ファイル: display.php プロジェクト: jozefkrz/gpEasy-CMS
 function RunScript()
 {
     if (!$this->SetVars()) {
         return;
     }
     //allow addons to effect page actions and how a page is displayed
     $cmd = common::GetCommand();
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     $this->GetFile();
     includeFile('tool/SectionContent.php');
     $this->contentBuffer = section_content::Render($this->file_sections, $this->title, $this->file_stats);
 }
コード例 #4
0
 function SearchPage($title, $index)
 {
     global $gp_menu, $gp_titles;
     //search hidden?
     if (!$this->search_hidden && !isset($gp_menu[$index])) {
         return;
     }
     //private pages
     if (!common::LoggedIn()) {
         if (isset($gp_titles[$index]['vis'])) {
             return;
         }
     }
     $full_path = gpFiles::PageFile($title);
     $file_sections = gpFiles::Get($full_path, 'file_sections');
     if (!$file_sections) {
         return;
     }
     $content = section_content::Render($file_sections, $title, gpFiles::$last_stats);
     $label = common::GetLabel($title);
     $this->FindString($content, $label, $title);
 }
コード例 #5
0
 /**
  * Return the formatted content of the title
  *
  */
 public function TitleContent($title)
 {
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return '';
     }
     //prevent infinite loops
     foreach ($file_sections as $key => $val) {
         if ($val['type'] == 'include') {
             unset($file_sections[$key]);
         }
     }
     if (!$file_sections) {
         return '';
     }
     $file_sections = array_values($file_sections);
     return section_content::Render($file_sections, $title, $file_stats);
 }
コード例 #6
0
ファイル: editing_page.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Display the contents of a past revision
  *
  */
 function ViewRevision()
 {
     global $langmessage;
     $time = $_REQUEST['time'];
     $full_path = $this->BackupFile($time);
     if (!$full_path) {
         return false;
     }
     $file_sections = $file_stats = array();
     //if it's a compressed file, we need an uncompressed version
     if (strpos($full_path, '.gze') !== false) {
         ob_start();
         readgzfile($full_path);
         $contents = ob_get_clean();
         $dir = common::DirName($full_path);
         $full_path = tempnam($dir, 'backup');
         gpFiles::Save($full_path, $contents);
         $file_sections = gpFiles::Get($full_path, 'file_sections');
         unlink($full_path);
     } else {
         $file_sections = gpFiles::Get($full_path, 'file_sections');
     }
     $this->contentBuffer = section_content::Render($file_sections, $this->title, gpFiles::$last_stats);
     $date = common::date($langmessage['strftime_datetime'], $time);
     $message = sprintf($langmessage['viewing_revision'], $date);
     $message .= ' <br/> ' . common::Link($this->title, $langmessage['Restore this revision'], 'cmd=use_revision&time=' . $time, array('data-cmd' => 'cnreq'));
     $message .= ' &nbsp; ' . common::Link($this->title, $langmessage['Revision History'], 'cmd=view_history', array('title' => $langmessage['Revision History'], 'data-cmd' => 'gpabox'));
     message($message);
 }
コード例 #7
0
ファイル: editing_page.php プロジェクト: jozefkrz/gpEasy-CMS
 /**
  * View the current public facing version of the file
  *
  */
 public function ViewCurrent()
 {
     $file_sections = gpFiles::Get($this->file, 'file_sections');
     $this->contentBuffer = section_content::Render($file_sections, $this->title, $this->file_stats);
 }
コード例 #8
0
ファイル: admin_trash.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * View the contents of a trash file
  *
  */
 function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = admin_trash::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo common::Link('Admin_Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = gpFiles::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo section_content::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }