示例#1
0
 function Init()
 {
     global $langmessage, $dataDir, $page, $upload_extensions_allow, $upload_extensions_deny;
     $this->baseDir = $dataDir . '/data/_uploaded';
     $this->thumbFolder = $dataDir . '/data/_uploaded/image/thumbnails';
     $this->currentDir = $this->baseDir;
     $page->label = $langmessage['uploaded_files'];
     $this->AllowedExtensions = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'bz', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip');
     if (is_array($upload_extensions_allow)) {
         $this->AllowedExtensions = array_merge($this->AllowedExtensions, $upload_extensions_allow);
     }
     if (is_array($upload_extensions_deny)) {
         $this->AllowedExtensions = array_diff($this->AllowedExtensions, $upload_extensions_deny);
     }
     $this->imgTypes = array('bmp' => 1, 'png' => 1, 'jpg' => 1, 'jpeg' => 1, 'gif' => 1, 'tiff' => 1, 'tif' => 1);
     //get the current path
     $parts = str_replace(array('\\', '//'), array('/', '/'), $page->title);
     $parts = trim($parts, '/');
     $parts = explode('/', $parts);
     array_shift($parts);
     if (count($parts) > 0) {
         $this->subdir = '/' . implode('/', $parts);
         $this->subdir = gp_edit::CleanArg($this->subdir);
     }
     if (!empty($_REQUEST['dir'])) {
         $this->subdir .= gp_edit::CleanArg($_REQUEST['dir']);
     }
     $this->subdir = str_replace(array('\\', '//'), array('/', '/'), $this->subdir);
     if ($this->subdir == '/') {
         $this->subdir = false;
     } else {
         $this->currentDir .= $this->subdir;
     }
     //prompt to create the requested subdirectory
     if (!file_exists($this->currentDir)) {
         gpFiles::CheckDir($this->currentDir);
     }
     //is in thumbnail directory?
     if (strpos($this->currentDir, $this->thumbFolder) !== false) {
         $this->isThumbDir = true;
     }
     $this->currentDir_Thumb = $this->thumbFolder . $this->subdir;
 }
示例#2
0
 static function InlineEdit_Text($scripts)
 {
     includeFile('tool/editing.php');
     // autocomplete
     echo gp_edit::AutoCompleteValues(true);
     // ckeditor basepath and configuration
     $options = array('extraPlugins' => 'sharedspace', 'sharedSpaces' => array('top' => 'ckeditor_top', 'bottom' => ' ckeditor_bottom'));
     $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/');
     echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';';
     echo 'var gp_ckconfig = ' . gp_edit::CKConfig($options, 'json', $plugins) . ';';
     // extra plugins
     echo 'var gp_add_plugins = ' . json_encode($plugins) . ';';
     // scripts
     $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js';
     $scripts[] = '/include/js/ckeditor_config.js';
     $scripts[] = '/include/js/inline_edit/inlineck.js';
     return $scripts;
 }
示例#3
0
 /**
  * Perform various section editing commands
  *
  * @return bool true if $section should be saved
  *
  */
 static function SectionEdit($cmd, &$section, $section_num, $title, $file_stats)
 {
     global $langmessage;
     switch ($cmd) {
         case 'preview':
             self::PreviewSection($section, $section_num, $title, $file_stats);
             return false;
         case 'include_dialog':
             self::IncludeDialog($section);
             return false;
         case 'inlineedit':
             includeFile('tool/ajax.php');
             gpAjax::InlineEdit($section);
             die;
         case 'save':
             return gp_edit::SectionFromPost($section, $section_num, $title, $file_stats);
     }
     message($langmessage['OOPS'] . '(Uknown Command)');
     return false;
 }
示例#4
0
 /**
  * Used by slideshow addons
  * @deprecated 3.6rc4
  *
  */
 function SaveSection_Text($section)
 {
     global $config;
     $content =& $_POST['gpcontent'];
     gpFiles::cleanText($content);
     $this->file_sections[$section]['content'] = $content;
     if ($config['resize_images']) {
         gp_edit::ResizeImages($this->file_sections[$section]['content'], $this->file_sections[$section]['resized_imgs']);
     }
     return true;
 }
示例#5
0
 function RedirForm()
 {
     global $langmessage, $page;
     gp_edit::PrepAutoComplete(true, false);
     echo '<div class="inline_box" id="gp_redir">';
     echo '<h2>' . $langmessage['New Redirection'] . '</h2>';
     echo '<form method="post" action="' . common::GetUrl('Admin_Missing') . '">';
     echo '<input type="hidden" name="cmd" value=""/>';
     echo '<input type="hidden" name="orig_source" value=""/>';
     echo '<table class="bordered">';
     echo '<tr><th colspan="2">' . $langmessage['options'] . '</th>';
     echo '</tr>';
     echo '<tr><td>';
     echo $langmessage['Source URL'];
     echo '</td><td>';
     echo common::GetUrl('');
     echo '<input type="text" name="source" value="" size="20" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Target URL'];
     echo '</td><td>';
     echo '<input type="text" name="target" value="" class="autocomplete gpinput" size="40" />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Method'];
     echo '</td><td>';
     echo '<select name="code" class="gpselect">';
     echo '<option value="301">' . $langmessage['301 Moved Permanently'] . '</option>';
     echo '<option value="302">' . $langmessage['302 Moved Temporarily'] . '</option>';
     echo '</select>';
     echo '</td></tr>';
     echo '</table>';
     echo '<p>';
     echo '<input type="submit" name="" value="' . $langmessage['save_changes'] . '" class="gpsubmit" />';
     //not using gppost because of autocomplete
     echo ' <input type="button" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
示例#6
0
 function AltMenu_NewName()
 {
     global $langmessage;
     $menu_name = gp_edit::CleanTitle($_POST['menu_name'], ' ');
     if (empty($menu_name)) {
         message($langmessage['OOPS'] . ' (Empty Name)');
         return false;
     }
     if (array_search($menu_name, $this->avail_menus) !== false) {
         message($langmessage['OOPS'] . ' (Name Exists)');
         return false;
     }
     return $menu_name;
 }
示例#7
0
 /**
  * Display Current Configuration Settings
  *
  */
 function DisplayCurrent()
 {
     includeFile('tool/editing.php');
     $default_config = gp_edit::CKConfig(array(), 'array');
     echo '<pre class="json">';
     echo self::ReadableJson($default_config);
     echo '</pre>';
 }
示例#8
0
 /**
  * Perform various section editing commands
  *
  */
 function SectionEdit($cmd)
 {
     global $page, $langmessage;
     if (empty($_REQUEST['file'])) {
         message($langmessage['OOPS']);
         return false;
     }
     $page->ajaxReplace = array();
     $file = gp_edit::CleanTitle($_REQUEST['file']);
     $data = gpOutput::ExtraContent($file, $file_stats);
     $page->file_sections = array($data);
     //hack so the SaveSection filter works
     $page->file_stats = $file_stats;
     if (!gp_edit::SectionEdit($cmd, $data, 0, '', $file_stats)) {
         return;
     }
     //save the new content
     $file_full = $this->folder . '/' . $file . '.php';
     if (!gpFiles::SaveData($file_full, 'extra_content', $data)) {
         message($langmessage['OOPS']);
         $this->EditExtra();
         return false;
     }
     $page->ajaxReplace[] = array('ck_saved', '', '');
     message($langmessage['SAVED']);
     $this->areas[$file] = $file;
     $this->EditExtra();
     return true;
 }
示例#9
0
 /**
  * Display form for submitting posts (new and edit)
  *
  * @param string $label
  * @param array $array
  * @param string $cmd
  * @param int|string $post_id
  */
 private function PostForm($label, &$array, $cmd = 'save_new', $post_id = null)
 {
     global $langmessage;
     includeFile('tool/editing.php');
     $array += array('title' => '', 'content' => '', 'subtitle' => '', 'isDraft' => false, 'categories' => array(), 'time' => time());
     if ($post_id) {
         $array += array('isDraft' => SimpleBlogCommon::AStrGet('drafts', $post_id));
     }
     $array['title'] = SimpleBlogCommon::Underscores($array['title']);
     $action = common::GetUrl('Admin_Blog');
     if ($post_id) {
         $action = common::GetUrl('Admin_Blog/' . $post_id);
     }
     echo '<form class="post_form" action="' . $action . '" method="post">';
     //save
     echo '<div style="float:right">';
     echo '<input type="hidden" name="cmd" value="' . $cmd . '" />';
     echo '<input class="gpsubmit" type="submit" name="" value="' . $langmessage['save'] . '" /> ';
     echo common::Link('Admin_Blog', $langmessage['cancel'], '', ' class="gpcancel"');
     if ($post_id) {
         echo SimpleBlogCommon::PostLink($post_id, 'View Post', '', 'target="_blank"');
     }
     echo '</div>';
     //heading
     echo '<h2 class="hmargin">' . $label . '</h2>';
     echo '<div class="sb_post_container cf">';
     echo '<div class="sb_post_container_right">';
     //title + sub-title
     echo '<div class="sb_edit_box">';
     echo '<div class="sb_edit_group">';
     echo '<label>Title</label>';
     echo '<input type="text" name="title" value="' . $array['title'] . '" required class="gpinput" />';
     echo '</div>';
     echo '<div class="sb_edit_group">';
     echo '<label>Sub-Title</label>';
     echo '<input type="text" name="subtitle" value="' . $array['subtitle'] . '" class="gpinput" />';
     echo '</div>';
     echo '</div>';
     //.sb_edit_box
     //draft + date
     echo '<div class="sb_edit_box">';
     echo '<div class="sb_edit_group">';
     echo '<label>';
     echo '<input type="checkbox" name="isDraft" value="on" data-cmd="DraftCheckbox" ';
     if ($array['isDraft']) {
         echo 'checked="true"';
     }
     echo '" /> Draft</label>';
     echo '</div>';
     $this->FieldPublish($array);
     echo '</div>';
     //categories
     echo '<div class="sb_edit_box">';
     echo '<div class="sb_edit_group">';
     self::ShowCategoryList($post_id, $array);
     echo '</div>';
     echo '</div>';
     echo '</div>';
     //.sb_container_right
     //content
     echo '<div class="sb_post_container_left">';
     gp_edit::UseCK($array['content'], 'content');
     echo '</div>';
     echo '</div>';
     //save
     echo '<div>';
     echo '</div>';
     echo '</form>';
 }
示例#10
0
 /**
  * Get the content of the file in the trash so we can restore file information
  *  - resized images
  *  - special_galleries::UpdateGalleryInfo($title,$content)
  *
  */
 function RestoreFile($title, $file, $title_info)
 {
     //get the file data
     $file_sections = array();
     ob_start();
     include $file;
     ob_get_clean();
     // Restore resized images
     if (count($file_sections)) {
         includeFile('image.php');
         gp_resized::SetIndex();
         foreach ($file_sections as $section => $section_data) {
             if (!isset($section_data['resized_imgs'])) {
                 continue;
             }
             foreach ($section_data['resized_imgs'] as $image_index => $sizes) {
                 if (!isset(gp_resized::$index[$image_index])) {
                     continue;
                 }
                 $img = gp_resized::$index[$image_index];
                 foreach ($sizes as $size) {
                     list($width, $height) = explode('x', $size);
                     gp_edit::CreateImage($img, $width, $height);
                 }
             }
             gp_edit::ResizedImageUse(array(), $section_data['resized_imgs']);
         }
         gp_resized::SaveIndex();
     }
     // Restore Galleries
     if (strpos($title_info['type'], 'gallery') !== false) {
         includeFile('special/special_galleries.php');
         special_galleries::UpdateGalleryInfo($title, $file_sections);
     }
 }
示例#11
0
 /**
  * @deprecated 3.0
  * Use gp_edit::UseCK();
  */
 static function UseCK($contents, $name = 'gpcontent', $options = array())
 {
     trigger_error('Deprecated Function');
     includeFile('tool/editing.php');
     gp_edit::UseCK($contents, $name, $options);
 }
示例#12
0
 /**
  * Output a list a images in a director for use in inline editing
  * @static
  */
 static function InlineList($dir_piece)
 {
     global $page, $langmessage, $dataDir;
     $page->ajaxReplace = array();
     $dir_piece = common::WinPath($dir_piece);
     $dir = $dataDir . '/data/_uploaded' . $dir_piece;
     $prev_piece = false;
     while ($dir_piece != '/' && !file_exists($dir)) {
         $prev_piece = $dir_piece;
         $dir = common::DirName($dir);
         $dir_piece = common::DirName($dir_piece);
     }
     //new directory?
     if ($prev_piece) {
         $prev_piece = gp_edit::CleanArg($prev_piece);
         $dir_piece = $prev_piece;
         $dir = $dataDir . '/data/_uploaded' . $prev_piece;
         if (!gpFiles::CheckDir($dir)) {
             message($langmessage['OOPS']);
             $dir = common::DirName($dir);
             $dir_piece = common::DirName($prev_piece);
         }
     }
     //folder information
     $folders = $files = array();
     $allFiles = gpFiles::ReadFolderAndFiles($dir);
     list($folders, $files) = $allFiles;
     //folder select
     ob_start();
     echo '<div class="gp_edit_select ckeditor_control">';
     echo '<a class="gp_selected_folder"><span class="folder"></span>';
     if (strlen($dir_piece) > 23) {
         echo '...' . substr($dir_piece, -20);
     } else {
         echo $dir_piece;
     }
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     if ($dir_piece != '/') {
         $temp = common::DirName($dir_piece);
         echo '<a href="?cmd=new_dir&dir=' . rawurlencode($dir_piece) . '" class="gp_gallery_folder" data-cmd="gpabox"><span class="add"></span>' . $langmessage['create_dir'] . '</a>';
         echo '<a class="gp_gallery_folder" data-cmd="gp_gallery_folder" data-arg="' . htmlspecialchars($temp) . '"><span class="folder"></span>../</a>';
     }
     foreach ($folders as $folder) {
         if ($dir_piece == '/') {
             $sub_dir = '/' . $folder;
         } else {
             $sub_dir = $dir_piece . '/' . $folder;
         }
         $full_dir = $dataDir . '/data/_uploaded' . $sub_dir;
         $sub_files = scandir($full_dir);
         $count = 0;
         foreach ($sub_files as $file) {
             if (admin_uploaded::IsImg($file)) {
                 $count++;
             }
         }
         echo '<a class="gp_gallery_folder" data-cmd="gp_gallery_folder" data-arg="' . htmlspecialchars($sub_dir) . '"><span class="folder"></span><span class="gp_count">' . $count . '</span>' . $folder . '</a>';
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //available images
     ob_start();
     $image_count = 0;
     foreach ($files as $file) {
         $img = admin_uploaded::ShowFile_Gallery($dir_piece, $file);
         if ($img) {
             echo $img;
             $image_count++;
         }
     }
     $gp_gallery_avail_imgs = ob_get_clean();
     // Folder controls
     ob_start();
     if ($image_count > 0) {
         echo '<a data-cmd="gp_gallery_add_all" class="ckeditor_control half_width add_all_images">' . $langmessage['Add All Images'] . '</a>';
     }
     if ($dir_piece != '/') {
         echo '<form action="' . common::GetUrl('Admin_Uploaded') . '" method="post"  enctype="multipart/form-data" class="gp_upload_form" id="gp_upload_form">';
         admin_uploaded::Max_File_Size();
         echo '<a class="ckeditor_control half_width">' . $langmessage['upload_files'] . '</a>';
         echo '<div class="gp_object_wrapper">';
         echo '<input type="file" name="userfiles[]" class="file" />';
         echo '<input type="hidden" name="file_cmd" value="inline_upload" />';
         echo '<input type="hidden" name="output" value="gallery" />';
         echo '<input type="hidden" name="dir" value="' . $dir_piece . '" />';
         echo '</div>';
         echo '</form>';
     }
     $folder_options = ob_get_clean();
     //send content according to request
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'gallery_folder':
             $page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
             $page->ajaxReplace[] = array('inner', '#gp_gallery_avail_imgs', $gp_gallery_avail_imgs);
             break;
         default:
             $content = '<div id="gp_option_area">' . $gp_option_area . '</div>' . '<div id="gp_gallery_avail_imgs">' . $gp_gallery_avail_imgs . '</div>';
             $page->ajaxReplace[] = array('inner', '#gp_image_area', $content);
             break;
     }
     $page->ajaxReplace[] = array('inner', '#gp_folder_options', $folder_options);
     $page->ajaxReplace[] = array('gp_gallery_images', '', '');
     //tell the script the images have been loaded
 }
示例#13
0
 /**
  * Save the posted content for an extra content area
  *
  */
 function SaveExtra()
 {
     global $langmessage, $page;
     //for ajax responses
     $page->ajaxReplace = array();
     if (empty($_REQUEST['file'])) {
         message($langmessage['OOPS']);
         return false;
     }
     $title = gp_edit::CleanTitle($_REQUEST['file']);
     $file = $this->folder . '/' . $title . '.php';
     $text =& $_POST['gpcontent'];
     gpFiles::cleanText($text);
     if (!gpFiles::SaveFile($file, $text)) {
         message($langmessage['OOPS']);
         $this->EditExtra();
         return false;
     }
     $page->ajaxReplace[] = array('ck_saved', '', '');
     message($langmessage['SAVED']);
     $this->areas[$title] = $title;
     return true;
 }
示例#14
0
 /**
  * Show the default admin page
  *
  */
 function AdminPanel()
 {
     global $langmessage;
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'embededcheck':
             includeFile('tool/update.php');
             new update_class('embededcheck');
             return;
         case 'autocomplete-titles':
             $opts = array('var_name' => false);
             echo gp_edit::AutoCompleteValues(false, $opts);
             die;
     }
     $this->head_js[] = '/include/js/auto_width.js';
     echo '<h2>' . $langmessage['administration'] . '</h2>';
     echo '<div id="adminlinks2">';
     admin_tools::AdminPanelLinks(false);
     echo '</div>';
 }
示例#15
0
 /**
  * Display form for submitting posts (new and edit)
  *
  */
 function PostForm(&$array, $cmd = 'save_new', $post_id = false)
 {
     global $langmessage;
     includeFile('tool/editing.php');
     $array += array('title' => '', 'content' => '', 'subtitle' => '', 'isDraft' => false, 'categories' => array());
     $array['title'] = SimpleBlogCommon::Underscores($array['title']);
     echo '<form action="' . SimpleBlogCommon::PostUrl($post_id) . '" method="post">';
     echo '<table style="width:100%">';
     echo '<tr><td>';
     echo 'Title';
     echo '</td><td>';
     echo '<input type="text" name="title" value="' . $array['title'] . '" />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo 'Sub-Title';
     echo '</td><td>';
     echo '<input type="text" name="subtitle" value="' . $array['subtitle'] . '" />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo 'Draft';
     echo '</td><td>';
     echo '<input type="checkbox" name="isDraft" value="on" ';
     if ($array['isDraft']) {
         echo 'checked="true"';
     }
     echo '" />';
     echo '</td></tr>';
     $this->show_category_list($post_id, $array);
     echo '<tr><td colspan="2">';
     gp_edit::UseCK($array['content'], 'content');
     echo '</td></tr>';
     echo '<tr><td colspan="2">';
     echo '<input type="hidden" name="cmd" value="' . $cmd . '" />';
     echo '<input type="hidden" name="id" value="' . $post_id . '" />';
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" /> ';
     echo '<input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
 }
示例#16
0
 function Edit404($text = false)
 {
     global $langmessage;
     if ($text === false) {
         if (isset($this->error_data['404_TEXT'])) {
             $text = $this->error_data['404_TEXT'];
         } else {
             $text = special_missing::DefaultContent();
         }
     }
     echo '<h2>' . $langmessage['Link Errors'] . ' &#187; ' . $langmessage['404_Page'] . '</h2>';
     echo '<form action="' . common::GetUrl('Admin_Missing') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="save404" />';
     gp_edit::UseCK($text);
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="gpcancel"/>';
     echo '</form>';
     echo '<table class="bordered">';
     echo '<tr><th>';
     echo $langmessage['Useful Variables'];
     echo '</th>';
     echo '<th>';
     echo '&nbsp;';
     echo '</th>';
     echo '</tr>';
     echo '<tr><td>';
     echo '{{Similar_Titles}}';
     echo '</td>';
     echo '<td>';
     echo $langmessage['Similar_Titles'];
     echo '</td>';
     echo '</tr></table>';
 }
示例#17
0
 /**
  * @deprecated
  * Use gp_edit::CleanArg() instead
  */
 function CleanArg($path)
 {
     includeFile('tool/editing.php');
     return gp_edit::CleanArg($path);
 }
示例#18
0
 /**
  * @deprecated 3.0
  * Use gp_edit::CleanTitle() instead
  * Used by Simple_Blog1
  */
 public static function CleanTitle($title, $spaces = '_')
 {
     trigger_error('Deprecated Function');
     includeFile('tool/editing.php');
     return gp_edit::CleanTitle($title, $spaces);
 }
示例#19
0
 function IncludeDialog()
 {
     global $page, $langmessage, $config;
     $page->ajaxReplace = array();
     $section =& $_GET['section'];
     if (!isset($this->file_sections[$section])) {
         message($langmessage['OOPS']);
         return;
     }
     $include_type =& $this->file_sections[$section]['include_type'];
     $gadget_content = '';
     $file_content = '';
     switch ($include_type) {
         case 'gadget':
             $gadget_content =& $this->file_sections[$section]['content'];
             break;
         default:
             $file_content =& $this->file_sections[$section]['content'];
             break;
     }
     ob_start();
     echo '<form id="gp_include_form">';
     echo '<div class="gp_inlude_edit">';
     echo '<span class="label">';
     echo $langmessage['File Include'];
     echo '</span>';
     echo '<input type="text" size="" id="gp_file_include" name="file_include" class="autocomplete" value="' . htmlspecialchars($file_content) . '" />';
     echo '</div>';
     echo '<div class="gp_inlude_edit">';
     echo '<span class="label">';
     echo $langmessage['gadgets'];
     echo '</span>';
     echo '<input type="text" size="" id="gp_gadget_include" name="gadget_include" class="autocomplete" value="' . htmlspecialchars($gadget_content) . '" />';
     echo '</div>';
     echo '<div class="option_area">';
     echo '<a href="#" name="gp_include_preview" class="ckeditor_control full_width">Preview</a>';
     echo '</div>';
     echo '</form>';
     $content = ob_get_clean();
     $page->ajaxReplace[] = array('gp_include_dialog', '', $content);
     //file include autocomplete
     $options['admin_vals'] = false;
     $options['var_name'] = 'source';
     $file_includes = gp_edit::AutoCompleteValues(false, $options);
     $page->ajaxReplace[] = array('gp_autocomplete_include', 'file', $file_includes);
     //gadget include autocomplete
     $code = 'var source=[';
     if (isset($config['gadgets'])) {
         foreach ($config['gadgets'] as $uniq => $info) {
             $code .= '["' . addslashes($uniq) . '","' . addslashes($uniq) . '"],';
         }
     }
     $code .= ']';
     $page->ajaxReplace[] = array('gp_autocomplete_include', 'gadget', $code);
 }
示例#20
0
 function ExtraJS()
 {
     header('Content-type: application/javascript');
     includeFile('tool/editing.php');
     trigger_error('Deprecated: special_extrajs');
     $_GET += array('which' => array());
     foreach ((array) $_GET['which'] as $which_code) {
         switch ($which_code) {
             case 'autocomplete2':
                 $options['admin_vals'] = false;
                 $options['var_name'] = 'gp_include_titles';
                 echo gp_edit::AutoCompleteValues(false, $options);
                 break;
             case 'autocomplete':
                 echo gp_edit::AutoCompleteValues(true);
                 break;
             case 'gp_ckconfig':
                 $options = array();
                 echo gp_edit::CKConfig($options, 'gp_ckconfig');
                 break;
         }
     }
     die;
 }
示例#21
0
 /**
  * Use ckeditor for to edit content
  *
  *	configuration options
  * 	- http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
  */
 static function UseCK($contents, $name = 'gpcontent', $options = array())
 {
     global $page;
     $options += array('rows' => '20', 'cols' => '50');
     echo "\n\n";
     echo '<textarea name="' . $name . '" style="width:90%" rows="' . $options['rows'] . '" cols="' . $options['cols'] . '" class="CKEDITAREA">';
     echo htmlspecialchars($contents);
     echo '</textarea><br/>';
     //$page->head_js[] = '/include/thirdparty/ckeditor_34/ckeditor.js'; //wasn't working quite right, and it's called seperately for inline editing
     $page->head .= "\n" . '<script type="text/javascript" src="' . common::GetDir('/include/thirdparty/ckeditor_34/ckeditor.js') . '?3.6.2"></script>';
     gp_edit::PrepAutoComplete(false, true);
     ob_start();
     echo 'CKEDITOR.replaceAll( function(tarea,config){';
     echo 'if( tarea.className.indexOf("CKEDITAREA") == -1 ) return false;';
     echo gp_edit::CKConfig($options);
     echo 'return true;';
     echo '});';
     echo "\n\n";
     $page->jQueryCode .= ob_get_clean();
 }
示例#22
0
 function AddonText()
 {
     global $langmessage, $config;
     $addon = gp_edit::CleanArg($_REQUEST['addon']);
     $texts = $this->GetAddonTexts($addon);
     //not set up correctly
     if ($texts === false) {
         $this->EditText();
         return;
     }
     echo '<div class="inline_box" style="text-align:right">';
     echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="saveaddontext" />';
     echo '<input type="hidden" name="return" value="" />';
     //will be populated by javascript
     echo '<input type="hidden" name="addon" value="' . htmlspecialchars($addon) . '" />';
     //will be populated by javascript
     $this->AddonTextFields($texts);
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</form>';
     echo '</div>';
 }
示例#23
0
 function InlineEdit_Text($scripts)
 {
     includeFile('tool/editing.php');
     //autocomplete
     echo gp_edit::AutoCompleteValues(true);
     //ckeditor basepath and configuration
     $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/');
     echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';';
     echo 'var gp_ckconfig = {};';
     //gp_ckconfig options
     $options = array();
     echo gp_edit::CKConfig($options, 'gp_ckconfig');
     $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js';
     $scripts[] = '/include/js/inline_edit/inlineck.js';
     return $scripts;
 }