diff --git a/e107_admin/download.php b/e107_admin/download.php index 7f0c88631..9c2e12dc7 100644 --- a/e107_admin/download.php +++ b/e107_admin/download.php @@ -56,7 +56,6 @@ $frm = new e_form; $download = new download; require_once("auth.php"); -$pst->save_preset(); // unique name(s) for the presets - comma separated. /* One form example (no arrays needed) diff --git a/e107_admin/header.php b/e107_admin/header.php index 8645f81e2..5f6d258bf 100644 --- a/e107_admin/header.php +++ b/e107_admin/header.php @@ -252,7 +252,7 @@ echo "\n"; // Wysiwyg JS support on or off. // your code should run off e_WYSIWYG -if (varset($pref['wysiwyg'], FALSE) && check_class($pref['post_html'])) +if (varset($pref['wysiwyg'], FALSE) ) // posts bbcode by default. { define("e_WYSIWYG", TRUE); } @@ -291,23 +291,6 @@ if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) echo "\n"; } -// XXX - This shouldn't be here as well -if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0")) -{ - echo "\n"; -} - - // [JSManager] Load JS Includes - Zone 3 - before e_meta and headerjs() e107::getJs()->renderJs('header', 3); diff --git a/e107_admin/image.php b/e107_admin/image.php index 0fb8011eb..8666dee96 100644 --- a/e107_admin/image.php +++ b/e107_admin/image.php @@ -645,30 +645,12 @@ class media_admin_ui extends e_admin_ui $this->updateSettings(); } + // filepicker stuff. if($this->getQuery('mode') == 'dialog')//TODO Check this actually does something, as it was changed to 'action'. { if(!ADMIN){ exit; } - $cat = $_GET['for']; - if(!isset($this->cats[$cat])) - { - return; - } - $this->listQry = "SELECT m.*,u.user_id,u.user_name FROM #core_media AS m LEFT JOIN #user AS u ON m.media_author = u.user_id WHERE media_category = '".$cat."' "; // without any Order or Limit. - - unset($this->fields['checkboxes']); - $this->fields['options']['type'] = 'method'; - $this->fields['media_category']['nolist'] = true; - $this->fields['media_userclass']['nolist'] = true; - $this->fields['media_dimensions']['nolist'] = true; - $this->fields['media_description']['nolist'] = true; - $this->fields['media_type']['nolist'] = true; - - foreach($this->fields as $k=>$v) - { - $this->fields[$k]['filter'] = false; - } } @@ -736,26 +718,39 @@ class media_admin_ui extends e_admin_ui { $cat = $this->getQuery('for'); $file = (substr($cat,-5) == "_file") ? TRUE : FALSE; + $mes = e107::getMessage(); + $mes->addDebug("For:".$cat); if($file) { + $cat = $_GET['for']; + if(!isset($this->cats[$cat])) + { + return; + } - echo $this->getUI()->getList(); - - return; + $this->listQry = "SELECT m.*,u.user_id,u.user_name FROM #core_media AS m LEFT JOIN #user AS u ON m.media_author = u.user_id WHERE m.media_category = '".$cat."' "; // without any Order or Limit. + + unset($this->fields['checkboxes']); + $this->fields['options']['type'] = 'method'; + $this->fields['media_category']['nolist'] = true; + $this->fields['media_userclass']['nolist'] = true; + $this->fields['media_dimensions']['nolist'] = true; + $this->fields['media_description']['nolist'] = true; + $this->fields['media_type']['nolist'] = true; + + foreach($this->fields as $k=>$v) + { + $this->fields[$k]['filter'] = false; + } + + echo $this->mediaSelectUpload('file'); } - + else + { + echo $this->mediaSelectUpload(); + } - // $this->getModel()->setAction('create'); - // $this->getUI()->getController()->getRequest()->setAction('create'); - //$this->setAction('create');; - - if($_POST['etrigger_submit']) - { - // $data = $this->beforeCreate($_POST); - // e107::getDb()->db_Insert('core_media',$data); // Replace with Generic (needs parm sent) - } - echo $this->imageSelectUpload(); } @@ -774,7 +769,7 @@ class media_admin_ui extends e_admin_ui } - function imageSelectUpload() + function mediaSelectUpload($type='image') { $frm = e107::getForm(); $bbcodeMode = ($this->getQuery('bbcode')=='img') ? 'bbcode=img' : FALSE; @@ -806,7 +801,14 @@ class media_admin_ui extends e_admin_ui $tag = ($bbcodeMode) ? "" : $this->getQuery('tagid'); - $text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'),$bbcodeMode); // eg. news, news-thumbnail + if($type == 'file') + { + $text .= $this->getUI()->getList(); //FIXME NOT WORKING! + } + else + { + $text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'),$bbcodeMode); // eg. news, news-thumbnail + } $text .= " diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php index 37a217e1d..5778bf0ed 100644 --- a/e107_admin/sql/core_sql.php +++ b/e107_admin/sql/core_sql.php @@ -125,7 +125,7 @@ CREATE TABLE core ( CREATE TABLE core_media ( media_id int(10) unsigned NOT NULL auto_increment, - media_type varchar(15) NOT NULL default '', + media_type varchar(50) NOT NULL default '', media_name varchar(255) NOT NULL default '', media_caption varchar(255) NOT NULL default '', media_description varchar(255) NOT NULL default '', diff --git a/e107_admin/wmessage.php b/e107_admin/wmessage.php index b10d0dbe4..d008eb52c 100644 --- a/e107_admin/wmessage.php +++ b/e107_admin/wmessage.php @@ -25,14 +25,8 @@ include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); $e_sub_cat = 'wmessage'; -require_once(e_HANDLER."preset_class.php"); -$pst = new e_preset; -$pst->form = "wmform"; -$pst->page = "wmessage.php?create"; -$pst->id = "admin_wmessage"; -require_once("auth.php"); -$pst->save_preset(); // save and render result +require_once("auth.php"); require_once(e_HANDLER.'form_handler.php'); require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER."ren_help.php"); @@ -161,15 +155,6 @@ if ($action == "create" || $action == "edit") $row = $sql->db_Fetch(); } - if ($sub_action != 'edit') - { - $preset = $pst->read_preset("admin_wmessage"); - if (is_array($preset)) - { - extract($preset); - } - } - $text = "
diff --git a/e107_handlers/file_class.php b/e107_handlers/file_class.php index 08a26d7dc..dc25cab35 100644 --- a/e107_handlers/file_class.php +++ b/e107_handlers/file_class.php @@ -277,8 +277,10 @@ class e_file } $tmp = stat($path_to_file); + if($tmp) { + $finfo['fsize'] = $tmp['size']; $finfo['modified'] = $tmp['mtime']; } @@ -286,6 +288,7 @@ class e_file // associative array elements: dirname, basename, extension, filename $finfo['pathinfo'] = pathinfo($path_to_file); + $finfo['mime'] = vartrue($finfo['mime'],'application/'.$finfo['pathinfo']['extension']); return $finfo; } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 2d5c30490..75c4e710b 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -410,7 +410,8 @@ class e_form $label = "".basename($default_label).""; - $ret .= $this->mediaUrl($cat, $label,$name_id,"mode=dialog&action=list"); + // $ret .= $this->mediaUrl($cat, $label,$name_id,"mode=dialog&action=list"); + $ret .= $this->mediaUrl($cat, $label,$name_id,"mode=main&action=dialog"); $ret .= ""; return $ret; diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index a36b95250..30ea16d12 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -621,7 +621,8 @@ class e_media if(!vartrue($this->mimePaths[$pmime])) { - $mes->add("Couldn't detect mime-type($mime). Upload failed.", E_MESSAGE_ERROR); + $this->log("Couldn't detect mime-type ($mime)."); + $mes->add("Couldn't detect mime-type ($mime). Upload failed.", E_MESSAGE_ERROR); return FALSE; } @@ -631,6 +632,7 @@ class e_media { if(!mkdir($dir, 0755)) { + $this->log("Couldn't create folder ($dir)."); $mes->add("Couldn't create folder ($dir).", E_MESSAGE_ERROR); return FALSE; }; @@ -650,13 +652,16 @@ class e_media if(!is_readable($path)) { $mes->addError("Couldn't read file: {$path}"); + $this->log("Couldn't read file: {$path}"); return FALSE; } - $info = e107::getFile()->get_file_info($path); + $info = e107::getFile()->get_file_info($path,true); + + $this->log("File info for $path : ".print_r($info,true)); return array( - 'media_type' => $info['mime'], + 'media_type' => vartrue($info['mime']), 'media_datestamp' => time(), 'media_url' => e107::getParser()->createConstants($path, 'rel'), 'media_size' => filesize($path), @@ -667,6 +672,13 @@ class e_media ); } + + + + + + + @@ -691,7 +703,7 @@ class e_media if(!file_exists($oldpath)) { - $this->log("Couldn't find the file: ".$oldpath); + $this->log("Line: ".__LINE__." Couldn't find the file: ".$oldpath); $mes->add("Couldn't find the file: ".$oldpath, E_MESSAGE_ERROR); return; } @@ -699,10 +711,9 @@ class e_media $img_data = $this->mediaData($oldpath); // Basic File Info only if(!$typePath = $this->getPath($img_data['media_type'])) - { - - $this->log("Couldn't generated path from file info:".$oldpath); - $mes->addError("Couldn't generated path from file info:".$oldpath); + { + $this->log("Line: ".__LINE__." Couldn't generate path from file info:".$oldpath); + $mes->addError("Couldn't generate path from file info:".$oldpath); return FALSE; } diff --git a/e107_plugins/chatbox_menu/chatbox_menu.php b/e107_plugins/chatbox_menu/chatbox_menu.php index 1a233c6db..603fe7550 100644 --- a/e107_plugins/chatbox_menu/chatbox_menu.php +++ b/e107_plugins/chatbox_menu/chatbox_menu.php @@ -149,7 +149,7 @@ else $oc = ""; } $texta .= " - +
"; diff --git a/e107_plugins/download/admin_download.php b/e107_plugins/download/admin_download.php index 337d9b1d0..1f57ac17b 100644 --- a/e107_plugins/download/admin_download.php +++ b/e107_plugins/download/admin_download.php @@ -56,19 +56,11 @@ $pst->id = array("admin_downloads","admin_dl_cat"); $download = new download(); // $adminDownload = new adminDownload(); -$pst->save_preset(); // unique name(s) for the presets - comma separated. new plugin_download_admin(); require_once(e_ADMIN."auth.php"); - - /* -One form example (no arrays needed) -$pst->form = "myform"; // form id of the form that will have it's values saved. -$pst->page = "download.php?create"; // display preset options on which page. -$pst->save_preset("admin_downloads"); // unique name for the preset -*/ /* $rs = new form; diff --git a/e107_plugins/download/includes/admin.php b/e107_plugins/download/includes/admin.php index d9b99a334..8dd18c04f 100644 --- a/e107_plugins/download/includes/admin.php +++ b/e107_plugins/download/includes/admin.php @@ -579,8 +579,6 @@ $columnInfo = array( $download_status[0] = DOWLAN_122; $download_status[1] = DOWLAN_123; $download_status[2] = DOWLAN_124; - $preset = $pst->read_preset("admin_downloads"); // read preset values into array - extract($preset); if (!$sql->db_Select("download_category")) { diff --git a/e107_plugins/tinymce/e_meta.php b/e107_plugins/tinymce/e_meta.php index b974283fe..427cdd490 100644 --- a/e107_plugins/tinymce/e_meta.php +++ b/e107_plugins/tinymce/e_meta.php @@ -26,6 +26,17 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") ) e107::js('tinymce','tiny_mce_popup.js','jquery'); } + if(ADMIN) + { + define("SWITCH_TO_BB","$('#'+id).after('
Switch to BBCODE
');"); + } + else + { + define("SWITCH_TO_BB",""); + } + +// print_a($_POST); + //
Toggle WYSIWYG
e107::js('inline'," @@ -34,17 +45,12 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") ) $('.e-wysiwyg').each(function() { var id = $(this).attr('id'); // 'e-wysiwyg'; - $('#'+id).after('
Switch to BBCODE
'); + ".SWITCH_TO_BB." // alert(id); $('#bbcode-panel-'+id+'--preview').hide(); }); - - // jQuery.e-tab-add = function() - // { - // alert('added tab'); - // } - + // When new tab is added - convert textarea to TinyMce. $('.e-tabs-add').on('click',function(){ @@ -55,7 +61,7 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") ) var ct = parseInt($('#e-tab-count').val()); var id = idt + '-' + ct; $('#bbcode-panel-'+id+'--preview').hide(); - $('#'+id).after('
Switch to BBCODE
'); + ".SWITCH_TO_BB." tinyMCE.execCommand('mceAddControl', false, id); }); @@ -93,23 +99,6 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") ) ","jquery"); - e107::css('inline',".e-wysiwyg { width:100% }","jquery"); - - - // require_once(e_PLUGIN."tinymce/wysiwyg.php"); - if(deftrue('TINYMCE_CONFIG')) - { - // $wy = new wysiwyg(TINYMCE_CONFIG); - } - else - { - // $wy = new wysiwyg(); - } - - if(!strpos(e_SELF,e_ADMIN_ABS."image.php")) - { - // $wy -> render(); - } } diff --git a/e107_plugins/tinymce/plugins/e107bbcode/parser.php b/e107_plugins/tinymce/plugins/e107bbcode/parser.php index e68f504e1..ef5247028 100644 --- a/e107_plugins/tinymce/plugins/e107bbcode/parser.php +++ b/e107_plugins/tinymce/plugins/e107bbcode/parser.php @@ -17,7 +17,7 @@ if($_POST['mode'] == 'tohtml') { $content = $tp->toDB($_POST['content']); e107::getBB()->setClass($_SESSION['media_category']); - echo $tp->toHtml($content, true, 'wysiwyg'); + echo $tp->toHtml($content, true); e107::getBB()->clearClass(); } diff --git a/e107_plugins/tinymce/templates/public.xml b/e107_plugins/tinymce/templates/public.xml index d80079445..b19c3f25a 100644 --- a/e107_plugins/tinymce/templates/public.xml +++ b/e107_plugins/tinymce/templates/public.xml @@ -1,7 +1,7 @@ - Simple Users - 252 - e107bbcode,emoticons,jqueryinlinepopups - bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons + Main Admin + advhr,advlink,autosave,contextmenu,directionality,e107bbcode,emoticons,ibrowser,paste,table,visualchars,wordcount,xhtmlxtras,youtube + link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons, youtube + object[*],embed[*] diff --git a/e107_plugins/tinymce/wysiwyg.php b/e107_plugins/tinymce/wysiwyg.php index b4d3e9667..df40a1ec0 100644 --- a/e107_plugins/tinymce/wysiwyg.php +++ b/e107_plugins/tinymce/wysiwyg.php @@ -29,16 +29,8 @@ class wysiwyg { $this->getConfig($config); - - $pref = e107::getConfig(); - - - - - - /* if(strstr(varset($_SERVER["HTTP_ACCEPT_ENCODING"],""), "gzip") && (ini_get("zlib.output_compression") == false) && file_exists(e_PLUGIN."tinymce/tiny_mce_gzip.php")) { @@ -198,32 +190,7 @@ class wysiwyg $newConfig[] = "\t\t ".$key." : ".$val; } - // foreach($this->config as $key=>$val) - // { - // if($val != 'true' && $val !='false') - // { - // $val = "'".$val."'"; - // } - // $text .= "\t\t ".$key." : '".$val."',\n"; - // } - $text .= implode(",\n",$newConfig); - - /* - if($tinyMcePrefs['customjs']) - { - $text .= "\n, - - // Start Custom TinyMce JS ----- - - ".$pref['tinymce']['customjs']." - - // End Custom TinyMce JS --- - - "; - - } - */ $text .= " }); @@ -265,7 +232,7 @@ class wysiwyg $this->config = array( 'language' => $this->tinymce_lang(), - 'mode' => 'textareas', + 'mode' => 'specific_textareas', 'editor_selector' => 'e-wysiwyg', 'editor_deselector' => 'e-wysiwyg-off', 'theme' => 'advanced', @@ -300,7 +267,7 @@ class wysiwyg 'debug' => 'false', 'force_br_newlines' => 'true', 'media_strict' => 'false', - 'width' => '85%', + 'width' => vartrue($config['width'],'100%'), // 'height' => '90%', // higher causes padding at the top? // 'forced_root_block' => '', 'convert_newlines_to_brs' => 'true', // will break [list] if set to true diff --git a/e107_themes/templates/header_default.php b/e107_themes/templates/header_default.php index 62dcbe094..b10638c20 100644 --- a/e107_themes/templates/header_default.php +++ b/e107_themes/templates/header_default.php @@ -137,7 +137,7 @@ echo "".(defined('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME // Wysiwyg JS support on or off. -if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html'])) +if (varset($pref['wysiwyg'],FALSE)) { define("e_WYSIWYG",TRUE); } diff --git a/submitnews.php b/submitnews.php index 58b1a3360..2b0f0e7e1 100644 --- a/submitnews.php +++ b/submitnews.php @@ -209,7 +209,8 @@ $text .= " <tr> <td style='width:20%' class='forumheader3'>".LAN_135."</td> <td style='width:80%' class='forumheader3'> - <textarea class='e-wysiwyg tbox' id='submitnews_item' name='submitnews_item' cols='80' style='max-width:95%' {$insertjs}>".$tp->toHTML($_POST['submitnews_item'],TRUE,'USER_BODY')."</textarea><br />"; + <textarea class='e-wysiwyg tbox' id='submitnews_item' name='submitnews_item' cols='80' style='max-width:95%' {$insertjs}>".$tp->toForm($_POST['submitnews_item'],TRUE,'USER_BODY')."</textarea><br />"; + // toHTML is dangerous. if (!e_WYSIWYG) {