diff --git a/UPDATE.txt b/UPDATE.txt new file mode 100644 index 0000000..5300bad --- /dev/null +++ b/UPDATE.txt @@ -0,0 +1,49 @@ +Miniblog Update Instructions +============================ + +The package contains code for the standard +filebrowser plugin. Therefore install the unzipped +package into the base folder of your site. This will +install the additional code in the filebrowser and +overwrite your old Miniblog version. + +Log in to CMSimple_XH and go to Plugins > Miniblog. +Miniblog will create an new config file keeping your old +setting. + +From Miniblog version 0.4 there may remain 2 files: +css/0.4_default.css +css/0-4_default.css + +They are not used and should be deleted. + +CHANGE from v. 0.4 to 0.5: The pagename for backlinks +has gone from the config file to the language file. You +will have to enter that again. + +******************************************************** + + +Miniblog Update-Beschreibung +============================ + +Das Paket enthlt Code fr das Filebrowser-Plugin. Daher +das Paket so wie es entpackt ist, in das Basisverzeichnis +der Website kopieren. Dadurch wird die Filebrowserergnzung +installiert und die alte Miniblogversion berschrieben. + +In CMSimple einloggen und zu Plugins > Miniblog gehen. +Miniblog sucht nun nach der Config-Datei. Wenn es eine +alte Version findet, liet es deren Einstellungen. +Danach generiert es eine neue Config-Datei unter +Bercksichtigung der alten Einstellungen. + +Aus Version 0.4 finden sich eventuell noch 2 alte Dateien: +css/0.4_default.css +css/0-4_default.css + +Diese werden nicht mehr genutzt und sollten gelscht werden. + +nderung Version 0.4 zu 0.5: Der Eintrag fr die Backlinks +ist aus der Konfig-Datei in die Sprach-Datei gelegt worden +und muss neu eingegeben werden. \ No newline at end of file diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..e38f59e --- /dev/null +++ b/admin.php @@ -0,0 +1,584 @@ +Miniblog_XH ' . MINIBLOG_VERSION . ' © 2016 by' + . ' svasti'; + + if ($plugin_cf['miniblog']['posts_from_single_files']) $o .= Miniblog_adminPosts(); + } + if ($admin == 'plugin_config') { + $o .= $plugin_tx['miniblog']['hint_language_var']; + if (isset($_POST['mblogarchive'])) $o .= Miniblog_updateArchive(); + if ($plugin_cf['miniblog']['archive_archiving_date'] && $plugin_cf['miniblog']['posts_from_single_files']) { + $o .= '
' + . '' + . '
'; + } + if (!$plugin_cf['miniblog']['posts_from_single_files'] && $plugin_cf['miniblog']['posts_from_members']) { + $o .= '

' . $plugin_tx['miniblog']['text_if_member_check_single_file'] . '

'; + } + } + if ($admin == 'plugin_language') { Miniblog_updateLangFile(); + $o .= $plugin_tx['miniblog']['hint_language_var']; + if (isset($_POST['mblogarchive'])) $o .= Miniblog_updateArchive(); + if ($plugin_cf['miniblog']['archive_archiving_date'] && $plugin_cf['miniblog']['posts_from_single_files']) { + $o .= '
' + . '' + . '
'; + } + } + + $o .= plugin_admin_common($action, $admin, $plugin); +} + +/** + * Creates json file with data for memberpostings if it doesn't exist + */ +function Miniblog_checkFile() +{ + global $pth, $plugin_cf; + + // create userfiles under content if missing + if (!is_file($pth['folder']['content'].'miniblog/miniblog.php')) { + if (!is_dir($pth['folder']['content'].'miniblog')) { + if (!mkdir($pth['folder']['content'].'miniblog', 0777, true)) + e('missing', 'folder', $pth['folder']['content'].'miniblog'); + } + if (file_put_contents($pth['folder']['content'].'miniblog/miniblog.php','') === FALSE) + e('missing', 'file', $pth['folder']['content'].'miniblog/miniblog.php'); + } + if (!is_dir($pth['folder']['content'] . 'extedit')) { + if (mkdir($pth['folder']['content'] . 'extedit', 0777, true) === FALSE) + e('missing', 'folder', $pth['folder']['content'].'extedit'); + } +} + + + +/** + * Adds the blog posts with their URLs to the standard CMSimple_XH internal link list in edit mode + * Active only from the plugin backend for the admin to edit blog posts + * + */ +function Miniblog_addUrls() +{ + global $pth, $u, $cl, $h, $l, $c, $f, $plugin_tx; + + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + if ($posts) { + foreach ($posts as $folder => $postings) { + foreach ($postings as $post => $postdata) { + if (isset($postdata['publish']) && $postdata['publish'] && $postdata['publish'] != 'false') { + $h[] = $u[] = $plugin_tx['miniblog']['single-file_blogname_in_url'] . '/' . $folder . '/' . $post; + //$c[] = $f == 'sitemap' ? '#CMSimple hide#' : ''; + $l[] = 1; + //if ($f == 'sitemap') $cl ++; + } + } + } + } +} + + + +/** + * Updates the archive settings of all member postings + * Also eliminates stray values in the blog post data file +*/ +function Miniblog_updateArchive() +{ + global $pth, $e, $plugin_cf, $plugin_tx; + $cf = $plugin_cf['miniblog']; + $ptx = $plugin_tx['miniblog']; + + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + // eliminate possible stray values + foreach ($posts as $key=>$value) { + if ($key == 'folder') continue; + if (!is_array($value) || empty($value)) unset($posts[$key]); + foreach ($value as $key2=>$value2) { + if (!is_array($value2) || empty($value2)) unset($posts[$key][$key2]); + } + } + + foreach ($posts as $folder=>$postings) { + if ($folder == 'folder') continue; + foreach ($posts[$folder] as $post=>$value) { + if ($plugin_cf['miniblog']['archive_archiving_date'] + && isset($posts[$folder][$post]['date']) + && $posts[$folder][$post]['date'] < strtotime($cf['archive_archiving_date'])) { + + if($ptx['single-file_archive_page']) { + $posts[$folder][$post]['blog'] = $ptx['single-file_archive_page']; + $posts[$folder][$post]['archive'] = false; + } else { + $posts[$folder][$post]['archive'] = true; + } + + } else { + if(!isset($posts[$folder][$post]['blog']) || + $posts[$folder][$post]['blog'] == $ptx['single-file_archive_page']) { + $blogarray = explode(',',$plugin_tx['miniblog']['single-file_backlinks_to']); + $posts[$folder][$post]['blog'] = $blogarray[0]; + } + $posts[$folder][$post]['archive'] = false; + } + } + } + + if(file_put_contents($pth['folder']['content'].'miniblog/miniblog.php',json_encode($posts), LOCK_EX)) { + return '

Archiv-Werte neu zugeordnet

'; + } +} + + +/** + * Administration of member postings from the plugin backend * + */ +function Miniblog_adminPosts() +{ + global $pth, $plugin_cf, $plugin_tx, $tx, $bjs; + $o = ''; + $ptx = $plugin_tx['miniblog']; + + // keep scroll positions of page and file list + if(isset($_COOKIE['listScroll'])) { + $bjs .= ''; + } + if(isset($_COOKIE['pageScroll'])) { + $bjs .= ''; + } + + // read the data file of the blog postings + if (isset($_POST['mblognewdata'])) $o .= Miniblog_receivePostData(); + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + $posts = Miniblog_includeOrphans($posts); + $posts = Miniblog_deleteUnusedFolders($posts); + + if ($plugin_cf['miniblog']['posts_from_members']) $o .= Miniblog_showFolders($posts); + + + // prepare to open the selected blog file + if(isset($_GET['posting'])) { + $get = $_GET['posting']; + list($folder,$post) = explode('---',$get); + } else $folder = $user = $post = $get = ''; + + $o .= '

' . $ptx['text_file_based_blog_posts'] . '

'; + + $o .= ''; + + $o .= '
'; + + if ($posts) { + ksort($posts); + foreach ($posts as $onefolder => $folderposts) { + if ($onefolder == 'folder') continue; + ksort($folderposts); + foreach ($folderposts as $onepost => $onepostdata) { + $start = $end = ''; + if ($folder == $onefolder && $post == $onepost) { + $start .= '
' + . '

'; + $end .= ' ' + . '' + . '' + . '' + . '

'; + } else { + $start .= '

' . a('','&miniblog&normal&posting='.$onefolder.'---'. $onepost + . '" OnClick=" + document.cookie = \'listScroll=\' + document.getElementById(\'mbloglist\').scrollTop;'); + $end .= '

'; + } + $o .= "\n"; + $o .= $start; + $o .= ''. $onefolder . '/' . $onepost . ' '; + + if(isset($onepostdata['title'])) { + $o .= ' ' . $onepostdata['name'] . ': '; + $o .= '' + . $onepostdata['title']; + $o .= $onepostdata['cat'] ? ' (' . str_replace('__', ' ', $onepostdata['cat']) .')' : ''; + $o .= ''; + $o .= $onepostdata['date'] > 10000 + ? ' ' . date($plugin_cf['miniblog']['date_format'], (int)$onepostdata['date']) + : ''; + $blog = isset($onepostdata['blog']) && $onepostdata['blog'] + ? ' ' . $onepostdata['blog'] + : ''; + $o .= $onepostdata['publish'] && $onepostdata['publish'] != 'false' + ? ', (' . $ptx['text_publ'] . $blog . ')' + : ''; + } + $o .= $end; + } + } + } + $o .= '
'; + + if($get) { + if(isset($_POST['editposting'])) { + file_put_contents($pth['folder']['content'] . 'extedit/' . $get . '.htm',$_POST['editposting']); + } + $posting = is_file($pth['folder']['content'] . 'extedit/' . $get . '.htm') + ? file_get_contents($pth['folder']['content'] . 'extedit/' . $get . '.htm') + : ''; + + $name = isset($posts[$folder][$post]['name']) ? $posts[$folder][$post]['name'] : ''; + $o .= Miniblog_viewEditHeader($folder, $name, $post, $posts, true); + + $o .= ''; + + // switch editing the blog posting on or off + if(isset($_GET['editposting'])) { + $o .= a('','&miniblog&normal&posting=' + . $folder.'---'. $post . '" OnClick=" +document.cookie = \'pageScroll=\' + document.documentElement.scrollTop;') + . $plugin_tx['miniblog']['text_mode_view'] . ''; + $o .= '
'; + $o .= '
'; + init_editor(array('xh-editor'), false); + + } else { + $o .= a('','&miniblog&normal&posting=' . $folder . '---' . $post . '&editposting=true') + . $plugin_tx['miniblog']['text_mode_edit'] . ''; + $o .= evaluate_scripting($posting) ; + if ($plugin_cf['miniblog']['comments_plugin'] + && isset($posts[$folder][$post]['comments']) + && $posts[$folder][$post]['comments'] == 'true') + $o .= evaluate_scripting('{{{' . $plugin_cf['miniblog']['comments_plugin'] + . ' "' . $folder . '---' . $post . '"}}}'); + } + } + + // js for the filebrowser + $editorbrowser = defined('CMSIMPLE_XH_VERSION') + && version_compare(CMSIMPLE_XH_VERSION, "CMSimple_XH 1.7", ">=") + ? $pth['folder']['base'].'?filebrowser=editorbrowser&editor' + : $pth['folder']['plugins'].'filebrowser/editorbrowser.php?editor'; + + $bjs .= ''; + + return $o; +} + + + +function Miniblog_deleteUnusedFolders($posts) +{ + foreach ($posts as $key=>$value) { + if (!$value) unset($posts[$key]); + } + return $posts; +} + + + +/** + * create button/link for editing the memberfolders + */ +function Miniblog_showFolders($posts) +{ + global $plugin_tx; + + $o = '

'; + if (isset($_GET['editfolders'])) { + $o .= a('','&miniblog&normal') . $plugin_tx['miniblog']['text_close_user_folder_mapping'] . ''; + $o .= Miniblog_editFolders($posts); + } else { + $o .= a('','&miniblog&normal&editfolders') . $plugin_tx['miniblog']['text_edit_user_folder_mapping'] . ''; + } + return $o . '

'; +} + + + +function Miniblog_editFolders($posts) +{ + global $plugin_tx, $pth, $tx; + $o = ''; + $folderlist = array(); + $ptx = $plugin_tx['miniblog']; + + $folderlist = $posts['folder']; + natsort($folderlist); + $o .= '

' + . $ptx['text_folder'] + . '' . $ptx['text_user_name'] . '

'; + foreach ($folderlist as $key=>$value) { + $o .= '
' + . '' + . '' + . '
' + . $key .'
' + . '' + . '' + . '' + . '
'; + } + $o .= '
' + . '' + . '' + . '' + . '' + . '' + . '
'; + + $strayfolderlist = $usedfolders = array(); + foreach ($posts as $folder=>$posting) { + if ($folder == 'folder') continue; + $usedfolders[] = $folder; + if (!in_array($folder,$folderlist)) $strayfolderlist[] = $folder; + } + + natsort($usedfolders); + $o .= '

' . sprintf($ptx['text_usage_of_folder'], count($usedfolders)) . '

'; + $o .= implode(', ',$usedfolders); + + if($strayfolderlist) { + natsort($strayfolderlist); + $o .= '

' . count($strayfolderlist) . ' ' + . $ptx['text_posts_without_user'] . '

'; + $o .= implode(', ',$strayfolderlist); + } + $o .= '
'; + + return $o; +} + + +/** + * Reads important values from the old language file und updates these + * files with default files keeping the important values + */ +function Miniblog_updateLangFile() +{ + global $pth; + $langfiles = array(); + $defaultfiles = array('en'); + + $langdir = scandir($pth['folder']['plugins'] . 'miniblog/languages'); + foreach ($langdir as $file) { + if(strlen($file) == 6) $langfiles[] = str_replace('.php','',$file); + if(strpos($file, '_default.php')) $defaultfiles[] = str_replace('_default.php','',$file); + } + foreach ($defaultfiles as $value) { + $defaultlang = $value == 'en' + ? file_get_contents($pth['folder']['plugins'] . 'miniblog/languages/default.php') + : file_get_contents($pth['folder']['plugins'] . 'miniblog/languages/' . $value . '_default.php'); + if (in_array($value, $langfiles)) { + $lang = file_get_contents($pth['folder']['plugins'] . 'miniblog/languages/' . $value . '.php'); + + $defaultlang = Miniblog_updateVar($lang,$defaultlang, array( + 'page-posts_backlinks_from', + 'page-posts_backlinks_to', + 'single-file_blogname_in_url', + 'single-file_category_list', + 'single-file_backlinks_to', + 'single-file_archive_page' + )); + } + if (!file_put_contents($pth['folder']['plugins'] . 'miniblog/languages/' . stsl($value) . '.php', $defaultlang)) + e('cntwriteto', 'file', $pth['folder']['plugins'] . 'miniblog/languages/' . $value . '.php'); + } +} +/** + * Helper function for updating language files, reads a valuearray from a file string und puts it into another file string + * + */ +function Miniblog_updateVar($lang, $defaultlang, $vararray) +{ + foreach ($vararray as $value) { + preg_match('!\[\'' . $value . '\'\]="(.*)"!',$lang,$matches); + $var1 = isset($matches[1])? trim($matches[1]) : ''; + if ($var1) { + $defaultlang = preg_replace('!\[\'' . $value . '\'\]="(.*)"!','[\'' . $value . '\']="' . $var1 . '"', $defaultlang); + } + } + Return $defaultlang; +} + + + +/** + * Easy updating, old config file is first read, then replaced by new one + */ +function Miniblog_createConfig() +{ + global $pth ,$plugin_tx; + + // make sure that the plugin css really gets put into the generated plugincss + touch($pth['folder']['plugins'] . 'miniblog/css/stylesheet.css'); + + $text = '' . "\n"; + + $config = $pth['folder']['plugins'] . 'miniblog/config/config.php'; + + if (!file_put_contents($config, $text)) { + e('cntwriteto', 'file', $config); + return false; + } else { + // give out notice that updating was successful + return '
' + . '

' + . sprintf($plugin_tx['miniblog']['update_successful'], MINIBLOG_VERSION) + . '

'; + } +} + +/** + * Checks if old config value exist and creates new config values + */ +function Miniblog_findConfigValue($itemArray) +{ + global $plugin_cf; + $o = ''; + + foreach ($itemArray as $value) { + list($item, $default, $oldname) = array_pad(explode(';',$value), 3, ''); + $name = $oldname ? $oldname : $item; + $value = isset($plugin_cf['miniblog'][$name]) + ? $plugin_cf['miniblog'][$name] + : (isset($plugin_cf['miniblog'][$item]) + ? $plugin_cf['miniblog'][$item] + : $default); + + $o .= '$plugin_cf[\'miniblog\'][\'' . $item . '\']="' + . $value . '";' . "\n"; + } + return $o; +} \ No newline at end of file diff --git a/ajax.php b/ajax.php new file mode 100644 index 0000000..f9b6a45 --- /dev/null +++ b/ajax.php @@ -0,0 +1,113 @@ + +// ajax for blog head data +function mblogSendHeader () { + window.onerror = function() { + alert("' . $ptx['error_ajax'] . '"); + return true; + }; + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (xhttp.readyState == 4 && xhttp.status == 200) { + var return_data = xhttp.responseText; + var answer = document.getElementById("mblogEditAnswer"); + answer.innerHTML = return_data; + setTimeout(function(){answer.innerHTML = ""},4000); + } + } + + function mblogShowHeader (item1,item2,txt) { + if (typeof document.getElementById(item1) != "undefined" + && typeof document.getElementsByName(item2)[0] != "undefined") { + if (document.getElementsByName(item2)[0].value) { + document.getElementById(item1).innerHTML = document.getElementsByName(item2)[0].value; + } else { + document.getElementById(item1).innerHTML = txt; + } + } + } + + var publ = document.getElementsByName("mblogpublish")[0].checked; + if (publ == true) { + document.getElementById("mblogPublStatus").innerHTML = "' . $ptx['text_published'] . '"; + document.getElementById("mblogPublStatus").className = "mblogPublOn"; + } + else if (publ == false) { + document.getElementById("mblogPublStatus").innerHTML = "' . $ptx['text_not_published'] . '"; + document.getElementById("mblogPublStatus").className = "mblogPublOff"; + } +'; + +if($pcf['keyword_show_keyword']) { + $bjs .= ' + //author s name or keyword + mblogShowHeader ("mblog_name","mblogname","");'; +} +if($pcf['date_show_date']) { + $bjs .= ' + //date + if (typeof document.getElementById("mblog_date") != "undefined" + && typeof document.getElementsByName("mblogdate")[0] !== "undefined") { + document.getElementById("mblog_date").innerHTML = document.getElementsByName("mblogdate")[0].value < 1 + ? "' . $ptx['error_date_missing'] . '" + : document.getElementsByName("mblogdate")[0].value ; + }'; +} +$bjs .= ' + //title + mblogShowHeader ("mblog_title","mblogtitle","' . $ptx['error_title_missing'] . '"); + + //category + var cat = ""; +'; +if ($ptx['single-file_category_list']) $bjs .= ' + var x = document.getElementById("mblogcat"); + for (var i = 0; i < x.options.length; i++) { + if(x.options[i].selected == true) { + if(cat) cat += " "; + cat += x.options[i].value; + } + } +'; +if ($pcf['category_show_category_in_teaser']) $bjs .= ' + if (!cat) { + document.getElementById("mblog_cat").innerHTML = "' . $ptx['error_category_missing'] . '"; + } else document.getElementById("mblog_cat").innerHTML = cat.replace(/__/g," "); +'; + +$bjs .= ' + //send ajax + xhttp.open("POST", "' . $sn . '?miniblog&mblogwriter_ajax", true); + xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + + var vars = '. $nameajax . ' + + "&mblogfolder=" + "'. $folder . '" + + "&mblogpost=" + "'. $post . '" + + "&mblogblog=" + document.getElementsByName("mblogblog")[0].value + + "&mblogdate=" + document.getElementsByName("mblogdate")[0].value + + "&mblogtitle=" + document.getElementsByName("mblogtitle")[0].value + + "&mblogcat=" + cat + + "&mblogpublish=" + document.getElementsByName("mblogpublish")[0].checked + + "&mblogcomments=" + document.getElementsByName("mblogcomments")[0].checked + + "&mblogteaser=" + document.getElementsByName("mblogteaser")[0].value + + "&mblogstyle=" + document.getElementsByName("mblogstyle")[0].value + + "&mblogimg=" + document.getElementsByName("mblogimg")[0].value; + xhttp.send(vars); +} +// autogrowing text area input field +function makeExpandingArea(container) { + var area = container.querySelector("textarea"); + var span = container.querySelector("span"); + if (area.addEventListener) { + area.addEventListener("input", function() { + span.textContent = area.value; + }, false); + span.textContent = area.value; + } + container.className += " active"; +} +var areas = document.querySelectorAll(".mblog_expandingArea"); +var l = areas.length; +while (l--) { + makeExpandingArea(areas[l]); +}'; diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..d893910 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,65 @@ +Miniblog-XH + +0.1 March 2014: Study of concept + +0.2 July 2014: Working plugin + +0.3 July 2014 +- easier image use, image found in category page will be used, + no more necessity, as in 0.2, of css manipulation +- date and blog ordering can be turned off +- alternative headings will be used when set +- more configuration possibilities for teaser and keyword generation + +0.4 Feb 2016 +- exchanged mb_substr with utf8_substr as the mb extension seems + not to be installed on all php servers. +- Plugin will not be executed during CMSimple_XH search +- Added button "all active blogs" with corresponding java script +- Added config setting for automatic archiving + (used to be "on" when an archiving date was entered, but this was maybe not so clear) +- Added config setting which allows categories via keywords in the headline of hidden category pages + without an additional sublevel. +- Short help overview in plugin main admin +- Generated teaser text now free of any plugin calls, no {{{ in the teaser +- Backlinks to blog contents page can be generated +- Undocumented features (only for demo purposes, may be changed in later versions): + - Miniblog can take any page as starting page + - Config settings (show archive, category, date, keyword) can be overruled in plugin call + + +0.5 July 2016 +- The start page of the blog doesn't have to be the page above the blog postings. The blog postings can be + entered as subpages of another page, which has to be given as first argument in the miniblog plugin call. + To make backlinks work in this case, this page has to be entered additionally in the language file. +- Backlinks can additionally be created below the blog posting. +- Number of posts shown blog starting page can be put into several numbered page views with a limited amout of posts each. +- 2 columns in blog page possible, responsive goes to 1 column below 500px viewport width +- With the help of cmb's extedit every logged-in member can create, edit and delete his own blog postings in single files. + Members are assigned a private folder for their posts. This mapping (member -> folder) can be edited by the admin. +- Thus different authors can post articles using the same title. +- Posts from single files can be mixed with posts from pages. +- Posts from single files get URL like CMSimple pages 3. level. +- Admin backend, where postings can be edited, deleted and created. +- In admin mode links to single file posts are listed in internal pages link list. +- Posts can be ordert newest first, oldest first, alphabetically and no order. +- Search function incorporated into standard search of CMSimple. +- multiple single file blogs per language enabled. +- multiple categories enabled. +- Archive can be put on extra page. +- Routine to make sure the plugin css is added to the core plugin css when testing plugin on localhost in windows. +- Important language values are retained while updating the language files. +- Error message if ajax fails. +- Sorting options newest first, oldest first or alphabetically according to title, keyword, or category. +- Comments enabled for single file posts. +- Image browser of filebrowser for single file posts in admin. +- Position of teaser img can be set in config, and individually per teaser by admin +- Teasers can be set individually by admin to span 2 columns in 2 column setting +- Counting and displaying the number of comments made, works with comments_XH and twocents_XH +- Added defaultconfig.php, thus eliminating error messages while installing the plugins. +- Comma separated list of users authorised to write posts can be entered in plugin config +- Enabled commentcount on page based posts + +0.5.1 August 2016 +- Bugfix counting twocents comments +- Added "left" to display options, displaying an image left and the teaser text on the right \ No newline at end of file diff --git a/config/defaultconfig.php b/config/defaultconfig.php new file mode 100644 index 0000000..0618471 --- /dev/null +++ b/config/defaultconfig.php @@ -0,0 +1,31 @@ + diff --git a/config/metaconfig.php b/config/metaconfig.php new file mode 100644 index 0000000..8d13b76 --- /dev/null +++ b/config/metaconfig.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/css/add.png b/css/add.png new file mode 100644 index 0000000..a3969f1 Binary files /dev/null and b/css/add.png differ diff --git a/css/arrow.png b/css/arrow.png new file mode 100644 index 0000000..1980c19 Binary files /dev/null and b/css/arrow.png differ diff --git a/css/delete.png b/css/delete.png new file mode 100644 index 0000000..a19db38 Binary files /dev/null and b/css/delete.png differ diff --git a/css/stylesheet.css b/css/stylesheet.css new file mode 100644 index 0000000..af83b04 --- /dev/null +++ b/css/stylesheet.css @@ -0,0 +1,258 @@ +.mblog_selectors { + margin:0 0 2em; + /* border-bottom: 2px solid #ccc; */ +} +.mblog_item { + margin:1em 0 2em; + overflow: hidden; + width:100%; +} +.mblog_columns { + width: 47%; + width: calc(50% - 20px); + margin-right:16px; + vertical-align: top; + box-sizing: border-box; + display:inline-block; +} +@media screen and (max-width:500px) { + .mblog_columns { + width:100%; + } +} +.mblog_postHeader { + margin:0 0 2em; +} +.mblog_item p, +.mblog_postHeader p, +#mblog_posting .mblog_postHeader p { + margin:0; +} + +/* memberpostings admin */ +.mblog_list { + margin:0 0 1em; + border:1px solid grey; + padding:.2em; + width:100%; + max-height:15em; + overflow:auto; +} +.mblog_list span { + font-size:small; +} +.mblog_list p { + text-indent: -1em; + margin:0; + padding-left:1em; +} +.mblog_list p.mblog_selectedPost { + background: #def; + color:black; +} +.mblog_folder { + margin:0 auto 1em; + padding:.2em; + border: 2px solid grey; + width:100%; + max-width:40em; + box-sizing:border-box; +} +.mblog_folder div { + display: table; + width:100%; +} +.mblog_folder div p { + display: table-row; + text-align:center; + font-weight:bold; + background:#ddd; + line-height:1.8; +} +.mblog_folder p span { + display: table-cell; + text-align:center; + width:50%; +} +.mblog_nowrap { + white-space: nowrap; +} + +.mblog_cat { + font-style: italic; +} +.mblog_date { + font-weight: bold; +} +.mblog_headword { + margin-left:1em; +} +.mblog_title { + margin:0; + padding:0; +} +.mblog_title a { + text-decoration:none; + color:#579; +} +.mblog_title a:hover, +.mblog_teaser a:hover { + background:#ffd; + color:#d00; +} + +.mblog_on { + background:#dff; + border-style: inset ; +} +.mblog_teaser span a { + text-decoration:none; + font-style: italic; + font-weight:bold; + white-space: nowrap; +} +.mblog_item img { + float:left; + margin:4px 1em 0 0; + max-width:100%; + height:auto; +} +.mblog_archive { + display:none; + margin:.5em 0; +} + +.mblog_backlink { + display:inline-block; + margin:0 0 1.5em; +} +.mblog_backlinkBottom { + display:inline-block; + margin:1em 0 0; + float:right; +} +#mblog_posting { + margin:0 0 1em; +} +#mblog_posting p { + margin:1em 0 0; +} +#mblog_posting input[type="text"] { + box-sizing:border-box; + padding:2px .2em; +} + +#mblog_posting .mblog_input, +.mblog_input { + box-sizing:border-box; + width:12em; + font-size:inherit; +} +#mblog_posting .mblog_titleInput { + box-sizing:border-box; + width:100%; + font-size:200%; +} +#editMblogHeader, #viewMblogHeader { + margin-top:1em; +} +.mblog_headEditStart { + margin:0; + padding-left:.3em; + background:#666; + color:white; +} +#mblogPublStatus { + font-weight:bold; +} +.mblogPublOn { + color:#dfd; +} +.mblogPublOff { + color:#fdd; +} +.mblog_error { + color:#900; + background:white; + padding:0 .5em; + display:block; +} +.mblog_ok { + color:#090; + background:white; + padding:0 .5em; +} +#mblogPublStatus:before { + content:"("; +} +#mblogPublStatus:after { + content:")"; +} +.mblog_commentcount { + text-align:right; +} +.mblog_commentcount span { + background:#eee; + padding:0 1em; + color:black; +} +.mblog_imgleft img{ + padding-right:1em; + /* width:8em !important; + height:auto !important; */ +} +.mblog_textright { + display: table-cell; +} +@media screen and (max-width:500px) { + .mblog_textright { + display:inline; + } + .mblog_imgleft img{ + padding-right:0; + } +} + +/* the following code is adapted from Opera's Neil Jenkins, from +http://www.alistapart.com/articles/expanding-text-areas-made-elegant/ */ +.mblog_expandingArea textarea, +.mblog_expandingArea pre { + margin: 0; + padding: 0; + outline: 0; + border: 0; + width:100%; +} +.mblog_expandingArea { + position: relative; + border: 1px solid #888; + background: #fff; +} +.mblog_expandingArea > textarea, +.mblog_expandingArea > pre { + background: transparent; + font: normal normal 1em Consolas, monospace; + /* Make the text soft-wrap */ + white-space: pre-wrap; + word-wrap: break-word; +} +.mblog_expandingArea > textarea { + box-sizing: border-box; +} +.mblog_expandingArea.active > textarea { + /* Hide any scrollbars */ + overflow: hidden; + position: absolute; + top: 0; + left: 0; + height: 100%; + /* Remove WebKit user-resize widget */ + resize: none; +} +.mblog_expandingArea > pre { + display: none; +} +.mblog_expandingArea.active > pre { + display: block; + visibility: hidden; +} diff --git a/filebrowser/editorhooks/miniblog/script.php b/filebrowser/editorhooks/miniblog/script.php new file mode 100644 index 0000000..dee5c10 --- /dev/null +++ b/filebrowser/editorhooks/miniblog/script.php @@ -0,0 +1,19 @@ + Miniblog_XH + * + */ + +$script = << +/* */ + +EOS; + +?> diff --git a/help/help.htm b/help/help.htm new file mode 100644 index 0000000..b5548ce --- /dev/null +++ b/help/help.htm @@ -0,0 +1,148 @@ + + + + + +Miniblog_XH + + + + + +
+
+

Miniblog 0.5

+
For CMSimple_XH 1.6.2 or higher
+ +

Miniblog can use normal CMSimple_XH pages and also single files as blog posts. Both methods can be mixed. Multiple blogs per site are possible. +Posts of page based blogs have to be created by the webmaster, posts of single file blogs can also be created by other users after log-in via Register_XH or Memberpages.

+

With blog features turned off, Miniblog can also be used as table of contents for sub-pages.

+ +

Plugin call

+

Usually you would need only to call {{{miniblog}}}.
+The following options are only needed for running more multiple different Miniblogs on a site.

+

{{{miniblog ['different_startpage', 'sorting', 'category'_buttons', 'archive_link', + 'limit_posts', 'columns', 'show_categories', 'show_date', 'show_keyword'] }}}

+

Arguments in [] optional. Arguments are needed only to create different types of blogs on the same site. Normally setting will be done via plugin config.

+
    +
  1. different_startpage: usually empty, however if page based posts aren't subpages of the blog page but of another page, enter that page name here.
  2. +
  3. sorting: 'alphabet', 'newest', 'title', 'keyword', 'category' or 0 for no sorting
  4. +
  5. category_buttons; enter 0 for off, or enter 1 for on, or enter '' to follow config setting
  6. +
  7. archive_link; as above, enter 0 or 1 for on or off, or '' to follows config setting
  8. +
  9. limit_posts; This setting limits the number of posts displayed on the blog page. If there are more posts, additional blog pages are generated. Enter a number, or enter 0 for off, or enter '' to follow config setting.
  10. +
  11. columns; as above, 0 or 1 for on or off, or '' to follow config setting
  12. +
  13. show_categories; as above, 0 or 1 for on or off, or '' to follow config setting
  14. +
  15. show_date; as above, 0 0 or 1 for on or off, '' follows config setting
  16. +
  17. show_keyword; mostly used for author's name, 0 or 1 for on or off, '' to follow config setting
  18. +
+

Example:
+{{{miniblog '','alphabet',0,0,'',1,0,0}}} alphabetical sorting, no category buttons, no archive link, number of posts on the blog page as in config, 2 columns, categories and dates not shown. +

+ + +

New in 0.5

+
    +
  • Single file based posts
  • +
  • Comments
  • +
  • Multiple blogs.
  • +
  • Multiple categories.
  • +
  • Archive on extra page.
  • +
  • Posts with URL like 3rd level pages, URL doesn't change when post gets moved to the archive.
  • +
  • Searchable via standard CMSimple search.
  • +
  • Internal links to single file posts in admin mode selectable just like normal CMSimple pages.
  • +
  • External users can write blog posts after log-in.
  • +
  • Teaser in 2 columns.
  • +
  • The number of teasers on the blog page can be limited. The blog page will be divided into multiple subpages each with the stated limit of teasers.
  • +
  • Teasers can be sorted newest first, oldest first, title, keyword (=author's name), category and no sorting.
  • +
  • Positioning of teaser images can be set in config.
  • +
  • The image browser for teaser images in admin mode.
  • +
  • Backlinks also at the end of a blog post.
  • +
  • Page based post don't have to be subpages of blog page
  • +
+

Updating: Unzip package. This contains additional code for the filebrowser, therefore install package as it is in the base folder. Then go to Miniblog plugin backend. This triggers the reading of the old + config and generation of a new one.
From Miniblog version 0.4 there may remain 2 files: +css/0.4_default.css and +css/0-4_default.css. +They are not used and should be deleted.

+ +

Blog from single files

+ +

Plugin call for blog page: {{{miniblog}}}
+ Plugin call for writing blogs by logged-in users: {{{miniblogwriter}}}

+ +

Single html files are created either by logged-in users with Christoph Becker's Extedit_XH or by the admin in the plugin backend. Next to these html files there is a small json database where category, publishing date, keyword, title, teaser, teaser image link are stored. From this databank the blog page is generated.

+ +

Images can be added to the teasers of the blog page to make the teasers more attractive. +To enable external logged-in authors to use teaser images, you need to specify in the config a subfolder of the standard images folder, as folder for teaser images. External authors can select images only from that folder. If you write posts as admin however, you have the standard image browser of CMSimple_XH at your disposal (works in Tinymce and CKeditor, but not yet in Tinymce4) and you are not restricted to one folder. Moreover, you can also choose the position of the image. If you have set the blog page in 2 columns, it is possible to select that a teaser to an important post should span +over both columns, which can serve as an eye catcher, especially if +used together with a rather wide image that reaches over both columns.

+ +

Each post gets an URL similar to a 3rd level CMSimple page:
+www.basedomain.xx/?blogname/foldername/postname. +
The blogname can be any name except existing page names of the 1st level. +Different users get different folders for saving their +posts. When a user logs in for the first time, +he will be asked to choose a name for his folder. This name will be +mapped as folder belonging to the user. This mapping can be edited by the admin in the backend. +All posts of the user will have the user's full name as stored in Memberpages or Register_XH as keyword. +Thus the keyword is used as author's name.

+ +

Standard CMSimple functions like plugin calls and image placement work as usual, +however Extedit_XH is relatively restricting towards users. +There are no such restrictions for composing post as admin from the backend.

+ +

Archive for both types of blogs

+

The archive is activated by entering an archiving date. For single file posts the archive mapping has to be updated additionally. It is possible to have a special archive page for single file posts. Create the page, write {{{miniblog}}} into the content and enter the page name into the language file. The "archive" button on the blog page will now function as link to the archive page. Archived posts will get a backlink to the archive. Older page based posts however will not be included in that archive and will simply continue to be displayed as normal posts on the blog post page.

+ +

If one of the 2 blog functions (single files/CMSimple pages) is not used, this function can be switched off in the backend.

+ + +

Blog from CMSimple pages

+ +

Only when your blog posts are not subpages of the blog page but subpages of another page, that other page name must be entered as 1st argument in the plugin call. If you want backlinks, that page name has to be entered also in the language file at page-posts backlinks from.

+ +

Date:
Use Pagedata > Page > Publication Period (1st field). +If a Publication date has been entered in the page data, +this date will serve as blog publication date, otherwise the date of the last edit will be taken. +If the publication date has not yet been reached, the page will not be listed. +If automatic archiving is set and the date is older than the archiving date, +the page will be listed in the blog archive. +Note: If a date for "expires" has been entered into the page data of a page +and this date is past, the page cannot be reached by link any more and will not be listed by miniblog, +not even in the archive.

+ +

Keyword: +
Use Pagedata > Meta-Tags > Keywords
The Keyword is taken form the page data meta tag Keywords. +If that is empty, the keyword (i.e. blog author's name) will be taken +from the first h4, h5, or h6 headline, or first bold or italic text or will be left +empty as specified in the plugin config.

+ +

Teaser Text:
Use Pagedata > Meta-Tags > Description
The teaser is taken from the pagedata meta tag Description. +Is that empty, the teaser text will be taken, depending on the config setting, +either from the beginning of the text after the headline or from the beginning +of the first <p> paragraph, with teaser character length being set in plugin config..

+

Categories:

+
Via Subpages,
+Post on 3rd level pages

+

|
Blog Table of Contents
|
|__Category 1
| |
| |__Blog1
| |
| |__Blog2
| |
| |__Blog3
|
|__Category 2
|
|__Blog4

Via Keyphrase, e.g. \"Cat_\",
in the beginning of a page name

|
Blog Table of Contents
|
|__Cat_Category 1
|
|__Blog1
|
|__Blog2
|
|__Blog3
|
|__Cat_Category 2
|
|__Blog4

+ + +

Miniblog usually gives every post a category. For page based posts, categories are provided by intermediate pages, either on an intermediate level or from pages whose name start with a key phrase. Usually you want to hide these +pages so that they don't appear in the menu. You can as well hide all blog pages, if you don't want them to appear in the page menu.

+

Posts without category are also possible. For the Keyphrase type category this are pages that don't have a preceding category page, for the normal 3 level arrangement this ar pages that are on the same level as the category pages and contain text.

+

Teaser images: If you place an image in a category page, that image will appear in the teasers of all posts belonging to that category.

diff --git a/help/help_de.htm b/help/help_de.htm new file mode 100644 index 0000000..695cf2d --- /dev/null +++ b/help/help_de.htm @@ -0,0 +1,162 @@ + + + + + +Miniblog_XH + + + + + +
+
+

Miniblog 0.5

+
Für CMSimple_XH ab Version 1.6.2
+ + +

Miniblog erzeugt Blogs mit Beiträgen aus normalen Seiten der content.htm +oder aus einzelnen externen HTML-Dateien oder einer Mischung von beidem.

+ +

Beliebig viele Blogs innerhalb einer Website möglich. +Blogbeiträge aus normalen Seiten (=seitenbasierte Beiträge) kann nur der +Webmaster schreiben, einzeldatei-basierte Beträge hingegen können nach Login (via Memberpages/Register_XH) auch von anderen Nutzern verfasst werden.

+

Miniblog kann durch seine Fähigkeit, die normale CMSimple-Seitenstruktur zu nutzen, auch als Inhaltsverzeichnis für Unterseiten verwendet werden, wenn man blog-typische Funktionen abschaltet.

+ +

Pluginaufruf

+

Normalerweise reicht der Aufruf {{{miniblog}}}. +
Wenn man jedoch mehrere Miniblogs mit verschiedenen Funktionen innerhalb einer Website nebeneinander betreiben will, kann man +diese per Pluginaufruf individuell konfigurieren.

+

{{{miniblog ['Oberseite', 'Sortierung', 'Kategoriebuttons', 'Archivlink', + 'Anzahlbegrenzung', 'Spalten', 'Zeige_Kategorie', 'Zeige_Datum', 'Zeige_Keyword'] }}}

+

Angaben in [] optional.

+
    +
  1. Oberseite: Normalerweise leer, wenn seitenbasierte Beiträge nicht unter der Blogseite stehen, hier Namen der zugehörenden Oberseite eingeben.
  2. +
  3. Sortierung: 'newest', 'oldest', 'title', 'keyword', 'category' oder 0 für keine Sortierung. Bei Beiträgen externer Nutzer wird automatisch der Autorenname in die Variable 'keyword' geschreiben.
  4. +
  5. Kategoriebuttons: 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  6. +
  7. Archivlink: 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  8. +
  9. Anzahlbegrenzung: Begrenzt die Anzahl der Teaser auf der Blogseite. + Wenn es mehr Teaser gibt, werden Folgeblogseiten erzeugt. + Hier eine Zahl für die maximale Teaseranzahl pro Seite eingeben oder eine 0 für ausgeschaltet. Bei + Eingabe von '' gilt der Konfigwert.
  10. +
  11. Spalten: 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  12. +
  13. Zeige_Kategorie: 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  14. +
  15. Zeige_Datum: 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  16. +
  17. Zeige_Keyword: meist für Autorennamen genutzt, 0 oder 1 für an oder aus, bei '' gilt Konfigwert
  18. +
+

Beispiel:
+{{{miniblog '','alphabet',0,0,'',1,0,0}}} alphabetische Sortierung, keine Kategoriebuttons und kein Archivlink, Höchstanzahl der angezeigten Beiträge wie in Konfig, zweispaltige Ausgabe ohne Kategorien und Datumsanzeige. +

+ + +

Neu in 0.5

+
    +
  • Einzeldatei-basierte Blogbeiträge.
  • +
  • Multiblog-fähig.
  • +
  • Kommentarfunktion einschaltbar mit Angabe der Kommentaranzahl pro Beitrag.
  • +
  • Multikategorie-fähig.
  • +
  • Archiv auf eigener Archiv-Seite möglich.
  • +
  • Einzeldatei-Blogs mit URL wie normale Seiten. URL ändert sich nicht, wenn Beitrag ins Archiv kommt.
  • +
  • Mit Standard-Suchfunktion durchsuchbar.
  • +
  • Links zu Blogbeiträgen im Bearbeitungsmodus auswählbar wie zu normalen CMSimple-Seiten.
  • +
  • Externe Nutzer können Blogbeiträge via Memberpages/Register_XH verfassen.
  • +
  • Responsive zweispaltige Teaser.
  • +
  • Position des Teaserbildes konfigurierbar.
  • +
  • Image Browser für Teaserbilder im Admin-Modus.
  • +
  • Anzahl der Teaser auf der Blogseite kann begrenzt werden. Die Blogseite wird dann in mehrere Folgeseiten aufgeteilt.
  • +
  • Anordnung Neuestes zuerst, Ältestes zuerst, + nach Titel, Keyword (=Autorennamen), Kategorien oder keine besondere Anordnung.
  • +
  • Backlinks auch am Ende der Beiträge möglich.
  • +
  • Seiten-basierte Beiträge brauchen keine Unterseiten der Blogseite mehr zu sein.
  • +
+

Updaten: Zip entpacken, das Verzeichnis enthält auch Code für die Nutzung des Filebrowsers aus Miniblogf heraus. Daher das Paket so wie es ist in den Basisordner der Website kopieren. Die alte Miniblog-Version wird dann mit der neuen überschreiben. Nun zum Plugin-Backend wechseln. +Das Plugin liest dann die alte Konfig aus und generiert eine neue. +
+Aus Version 0.4 finden sich eventuell noch 2 alte Dateien: +css/0.4_default.css und +css/0-4_default.css. +Diese werden nicht mehr genutzt und sollten gelöscht werden.

+ +

Blog mit Beiträgen aus Einzeldateien

+ +

Hier werden einzelne HTML-Dateien entweder durch eingeloggte Mitglieder mithilfe von Christoph Beckers Plugin Extedit_XH erstellt oder vom Admin im Plugin-Backend. Zu diesen Dateien gibt es jeweils einen Artikelkopf mit Kategorie, Veröffentlichungsdatum, Schlagwort bzw. Autorennamen, Titel, Teaser und Teaserbild, der in einer kleinen Json-Datenbank gespeichert wird. Aus dieser Datenbank wird automatisch die Blogstartseite mit Links zu den einzelnen HTML-Blogbeiträgen generiert.

+ +

Auch Bilder können in die Teaser eingefügt werden. +Um eingeloggten externen Autoren diese Bildernutzung zu ermöglichen, muss man einen Ordner dafür in der Konfig angeben. +Die Externen können dann Bilder aus diesem Ordner auswählen. Wenn man als Admin Beiträge +verfasst, hat man den Standard-CMSimple_XH-Bild-Browser zur Verfügung und ist nicht mehr auf einen Ordner begrenzt (funktioniert mit Tinymce und CKeditor, zurzeit jedoch noch nicht mit Tinymce4). +Hat man die Teaser in 2 Spalten angeordnet (Konfigeinstellung), kann man für einzelne Teaser auch einstellen, dass sie über beide Spalten laufen, z.B. um eine Art Blickpunkt in der Teaserliste zu schaffen.

+ + +

Die Blogbeiträge haben eine URL wie normale Seiten der 3. Ebene: +www.Basisdomain.xx/?Blogname/Ordnername/Beitragsname. Der Blogname ist frei wählbar, er darf nur nicht mit einem bestehenden Namen einer Seite der 1. Ebene übereinstimmen. Die Beiträge selbst sind nach Ordnername und Betragskurzname gekennzeichnet. Verschiedene Ordner werden dabei verschiedenen Mitgliedern zugeordnet. Beim ersten Erstellen eines Beitrags werden Mitglieder aufgefordert sich einen passenden Ordnernamen für ihre Beiträge auszudenken. Dieser Ordner ist dann dauerhaft mit dem Mitglied verbunden. Wenn der Admin Beiträge erstellt, kann er allerdings beliebige Ordnernamen verwenden. Die Zuordnung von Ordnernamen zu Mitgliedern kann im Backend editiert werden. Der volle Name des Autors, so wie dieser bei Memberpages oder Register_XH gespeichert ist, wird automatisch als Keyword des Beitrags gespeichert.

+ +

Die üblichen CMSimple-Funktionen wie Plugins und Bilder funktionieren auf den Blogseiten, +werden allerdings durch Extedit_XH für Mitglieder stark beschränkt. +Wenn man die Einzeldateifunktion als Admin nutzt, unterliegt man keinen Beschränkungen. +Die Bedienung ist ansonsten selbsterklärend. Falls eine der beiden Blogfunktionsweisen +(Einzeldatei-besierte Blogbeiträge/seitenbasierte Blog-Beiträge) nicht genutzt wird, kann man diese zur Resourcenschonung im Backend abstellen.

+ +

Für beide Blogtypen

+

Archiv

Um ein Archiv zu erstellen, ein Datum dafür in der Konfig eingeben. Für die Einzeldateibeiträge muss man anschließend die Archivzuordnung updaten. Danach werden Beiträge, die älter als das gewählte Archivierungsdatum sind, versteckt und erst gezeigt, wenn auf den Button "Archiv" geklickt wird. Bei Einzeldateien kann man das Archiv auch auf einer eigenen Seite zeigen. Dazu eine Seite erstellen, dort {{{miniblog}}} hineinschreiben, und den Seitennamen (z.B. "Archiv") in der Sprachdatei eintragen. Anschließend im Backend wieder die Archivzuordnung aktualisieren. Danach fungiert der Button "Archiv" auf der Blogseite als Link zur Archivseite.

+ +

Blogbeiträge aus Seiten werden bei einer eigenen Archivseite allerdings nicht berücksichtigt. Um zu vermeiden, dass sie gar nicht mehr gezeigt werden, werden sie beim Vorhandensein einer eigenen Archivseite – auch wenn sie älter als das Archivierungsdatum sind – weiterhin auf der Blogseite aufgelistet.

+ +

Angabe der Kommentaranzahl zu einem Beitrag

+

Wenn man ein Kommentarplugin wie Twocents_XH oder Comments_XH bei einzeldateibasierten Beiträgen nutzt, wird die Anzahl der Kommentare auf der Blogseite automatisch angezeigt.

+

Bei seitenbasierten Beiträgen muss man das Kommentarplugin extra +unten auf der Seite installieren, z.B. {{{twocents 'passendkodierterSeitenname'}}}. Es kommt darauf an, den Seitennamen auf passend kodierte Art einzugeben, denn nur alphanumerische Zeichen, - und _ werden so wie sie sind akzeptiert. Wenn noch andere Zeichen im Seitennamen vorkommen, müssen diese entsprechend den Einstellungen, die man in CMSimple getätigt hat, verändert werden. Normalerweise wird statt dem Leerzeichen ein Bindestrich genommen und in deutschsprachigen Seiten werden Ö Ä Ü ö ä ü ß zu Oe Ae Ue oe ae ue ss. Andere Zeichen werden URL-encodiert, was allerdings in manchen Browsern in der Anzeige wieder zurückkodiert wird, so dass einem dann die Anzeige in der Adressliste nicht weiter hilft. Hier kann man über einen online URL Decoder/Encoder den passenden Code finden.

+ + +

Blog mit seitenbasierten Beiträgen

+ +

Normalerweise auch hier nur {{{miniblog}}} aufrufen. +Liegen aber die Seiten der Blogbeiträge nicht unterhalb der eigentlichen Blogseite, dann muss man die entsprechende Seite Oberseite als 1. Argument im Pluginaufruf eintragen, {{{miniblog ['Oberseite der Blogbeiträge' , etc. ] }}}. So weiß das Plugin, wo es die Beiträge zu suchen hat. Für Backlinks muss in der Sprachdatei immer die eigentliche Blogseite eingetragen werden. Falls die Beiträge aber unterhalb einer anderen Seite stehen, muss man diese Seite ebenfalls in dem entsprechenden Feld der Sprachdatei eingeben.

+

Blog-Datum:
Hier nimmt Miniblog das Datum, das es +in Pagedata > Seite > Veröffentlichungszeitraum (1. Feld) findet
+Wenn das Feld leer ist, wird das Bearbeitungsdatum genommen.

+

Schlüsselwort(e):
Zuerst schaut Miniblog in Pagedata > Meta > Keywords
Wenn leer, wird Text je nach +Konfig.-Einstellung aus einer ersten h6, h5, h4 Überschrift oder dem ersten fetten oder kursiven Textstelle +genommen oder leer gelassen.

+

Teaser-Text:
Die erste Quelle ist Pagedata > Meta > Description
Wenn leer, wird je +nach Konfig.-Einstellung Text vom Anfang des ersten +<p>-Absatzes oder vom dem was der Überschrift folgt genommen.

+

Kategorien:

+
Unterseiten = Kategoriennamen
bei Blogs in Unterunterseiten
+
|
Blog-Inhaltsverzeichnis
|
|__Kategorie 1
| |
| |__Blog1
| |
| |__Blog2
| |
| |__Blog3
|
|__Kategorie 2
|
|__Blog4
+
+
über ausgewählte Zeichenfolgen, z.B. Cat_
am Anfang von Überschriften versteckter Seiten

|
Blog-Inhaltsverzeichnis
|
|__Cat_Kategorie 1
|
|__Blog1
|
|__Blog2
|
|__Blog3
|
|__Cat_Kategorie 2
|
|__Blog4
+ +

Kategorien: Miniblog-Blogeinträge haben normalerweise +eine Kategorie, entweder die Ebene über den eigentlichen Blogeinträgen oder Seiten mit Schlüsselwort. +Die Kategorieseiten haben selbst keinen Text. Man versteckt sie am besten, damit sie nicht im Menü erscheinen. +Man kann zusätzlich noch alle Blogseiten verstecken, wenn man nicht möchte, dass sie im Seitenmenü erscheinen.

+

Teaser-Bilder: Ein Bild in den Kategorieseiten erscheint in der Blogübersicht am Anfang aller Teaser die zu der jeweiligen Kategorie gehören.

+ +

Blogeinträge ohne Kategorie sind auch möglich: Bei Nutzung der Unterseitenmethode sind das Einträge mit Text auf der Kategorie-Ebene. Bei Nutzung der Schlüsselwortmethode +sind es Seiten, über denen keine Seite mit Schlüsselwort steht.

+

Datum: Ist das Veröffentlichungsdatum noch nicht erreicht, wird der Blogeintrag nicht gelistet

+

Archiv: Ist automatische Archivierung eingestellt und wird das Archivierungsdatum unterschritten, wird der + Blogeintrag nur im Blog-Archiv gelistet

+

Ablaufdatum: Ist bei einem Blogeintrag im Pagedata-Veröffentlichungszeitraum ein Ablaufdatum eingetragen, Kann +diese Seite nach Ablauf des Datums nicht mehr per Link erreicht werden und wird dann von Miniblog überhaupt nicht mehr +gelistet.

+ + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..aa67c93 --- /dev/null +++ b/index.php @@ -0,0 +1,726 @@ + + * last edit 20.08.2016 11:49:04 + */ + +/** + * Prevent direct access. + */ +if (!defined('CMSIMPLE_XH_VERSION')) { + header('HTTP/1.0 403 Forbidden'); + exit; +} + +define('MINIBLOG_VERSION','0.5.1'); +if ((!isset($plugin_cf['miniblog']['version']) + || $plugin_cf['miniblog']['version'] != MINIBLOG_VERSION)) { + include_once $pth['folder']['plugins'] . 'miniblog/config/defaultconfig.php'; +} + + +if (!(XH_ADM && $edit) + && $plugin_tx['miniblog']['page-posts_backlinks_to'] + && $plugin_cf['miniblog']['posts_from_pages']) +{ + Miniblog_makeBackLink(); +} + +if ($plugin_cf['miniblog']['posts_from_members']) include_once 'writer.php'; + + +/** + * Creates a back link for page based posts + * on all sub- and sub-sub-pages of the blog start page + */ +function Miniblog_makeBackLink() +{ + global $c, $h, $u, $pth, $plugin_cf, $plugin_tx; + $blogpages = array(); + + $bcklinkto = array_search($plugin_tx['miniblog']['page-posts_backlinks_to'], $h); + $bcklinkfrom = $plugin_tx['miniblog']['page-posts_backlinks_from'] + ? array_search($plugin_tx['miniblog']['page-posts_backlinks_from'], $h) + : $bcklinkto; + + if ($bcklinkfrom !== false) { + + foreach (Miniblog_childPages($bcklinkfrom) as $value) { + if (!Miniblog_childPages($value)) { + $blogpages[] = $value; + } else { + foreach (Miniblog_childPages($value) as $subvalue) { + $blogpages[] = $subvalue; + } + } + } + if ($plugin_cf['miniblog']['backlinks_also_below_content']) { + foreach ($blogpages as $k) { + $c[$k] = Miniblog_backLinkButton($u[$bcklinkto]) . $c[$k] + . Miniblog_backLinkButton($u[$bcklinkto], true); + } + } else { + foreach ($blogpages as $k) { + $c[$k] = Miniblog_backLinkButton($u[$bcklinkto]) . $c[$k]; + } + } + } +} + +/** + * Creates a Backlink for single file posts + */ +function Miniblog_backLink($page, $bottom = null) +{ + global $h, $u; + + $bcklinkto = array_search($page, $h); + return Miniblog_backLinkButton($u[$bcklinkto], $bottom); +} + +/** + * Makes the back link button + */ +function Miniblog_backLinkButton($link = '', $bottom = NULL) +{ + global $plugin_tx, $plugin_cf; + + if (!$link) return false; + + $o = "\n" . '
'; + + return $o; +} + + + +/** + * Returns Array of pagenumbers of subpages of a page + */ +function Miniblog_childPages($n = NULL ) +{ + global $s , $cl, $l, $cf; + $n = is_numeric($n) ? $n : $s; + + $res = array(); + $ll = $cf['menu']['levelcatch']; + for ($i = $n + 1; $i < $cl; $i++) { + if ($l[$i] <= $l[$n]) { + break; + } + if ($l[$i] <= $ll) { + $res[] = $i; + $ll = $l[$i]; + } + } + return $res; +} + + + +/** + * Adds data of blog pages to existing array of such data. + */ +function Miniblog_blogData($mblog, $page, $cat = '', $catpagenr = '', $style = '') +{ + global $plugin_cf, $plugin_tx, $h, $c, $pd_router; + + // make long plugin config var names a little shorter + $pcf = $plugin_cf['miniblog']; + + $page_data = $pd_router->find_page($page); + + if (isset($page_data['expires']) && $page_data['expires']) { + if (strtotime($page_data['expires']) < time()) return $mblog; + } + if (isset($page_data['publication_date']) && $page_data['publication_date']) { + if (strtotime($page_data['publication_date']) > time()) { + return $mblog; + } else $mblog['date'][] = $date = strtotime($page_data['publication_date']); + } else $mblog['date'][] = $date = $page_data['last_edit']; + + $mblog['archive'][] = $pcf['archive_archiving_date'] + && $date < strtotime($pcf['archive_archiving_date']) + && !$plugin_tx['miniblog']['single-file_archive_page'] + ? true + : false; + + $mblog['cat'][] = $cat; + + if ($catpagenr && $x = strpos($c[$catpagenr],'')+1); + } else $mblog['img'][] = ''; + + $mblog['pagenr'][] = $page; + $mblog['ext'][] = ''; + $mblog['style'][] = $style; + $mblog['title'][] = $page_data['show_heading'] && $page_data['heading'] + ? $page_data['heading'] + : $h[$page]; + + + if ($pcf['keyword_show_keyword']) { + if (isset($page_data['keywords']) && $page_data['keywords']) { + $mblog['keyword'][] = $page_data['keywords']; + } elseif ($pcf['keyword_2nd_source']) { + preg_match ('!'.$pcf['keyword_2nd_source'].'.*>(.*)' + . str_replace('__', ' ', $cat) + . ''; + $catlist[] = $cat; + } + } else { + $mblog = Miniblog_blogData($mblog, $value, $cat, $catpage, $style); + } + } + } else { + // 2nd case: category from subpages and content from subsubpages + + foreach (Miniblog_childPages($page) as $value) { + + if (!Miniblog_childPages($value)) { + // if there are no subsubpages the content of the subpages is used as categoryless content + $mblog = Miniblog_blogData($mblog, $value); + } else { + // standard case subsubpages as content + foreach (Miniblog_childPages($value) as $subvalue) { + $mblog = Miniblog_blogData($mblog, $subvalue, $h[$value], $value, $style); + } + } + } + } + } + + // create sortable array for single file posts + if ($pcf['posts_from_single_files']) { + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + if ($posts) { + foreach ($posts as $folder => $postings) { + if ($folder == 'folder') continue; + foreach ($postings as $post => $postdata) { + + if (isset($postdata['publish']) && $postdata['publish'] && $postdata['publish'] != 'false' + && ((!isset($postdata['blog']) || $postdata['blog'] == $h[$s]) + || !(strpos($ptx['single-file_backlinks_to'],',') || $ptx['single-file_archive_page'])) + ) + { + if ($pcf['archive_archiving_date'] && isset($postdata['archive']) && $postdata['archive'] == true) { + $mblog['archive'][] = true; + $mblog['teaser'][] = ''; + $mblog['img'][] = ''; + $mblog['style'][] = ''; + } else { + $mblog['archive'][] = false; + $mblog['teaser'][] = isset($postdata['teaser']) ? nl2br($postdata['teaser']) :''; + $mblog['img'][] = isset($postdata['img']) && $postdata['img'] + ? '' . substr(basename($postdata['img']), 0, -4) . '' + :''; + $mblog['style'][]= isset($postdata['style']) ? $style :''; + } + $mblog['date'][] = isset($postdata['date']) ? $postdata['date'] :''; + $mblog['cat'][] = isset($postdata['cat']) ? $postdata['cat'] :''; + $mblog['keyword'][] = isset($postdata['name']) ? $postdata['name'] :''; + $mblog['pagenr'][] = ''; + $mblog['ext'][] = $ptx['single-file_blogname_in_url'] . '/' . $folder . '/' . $post; + $mblog['title'][] = $postdata['title']; + } + } + } + } + } + + // sort posts + if ($sort && $sort != '-') { + if ($sort == 'title' || $sort == 'keyword' || $sort == 'category') { + if ($sort == 'category') $sort = 'cat'; + array_multisort(array_map('uenc',$mblog[$sort]), + $mblog['title'], + $mblog['date'], + $mblog['cat'], + $mblog['keyword'], + $mblog['pagenr'], + $mblog['ext'], + $mblog['teaser'], + $mblog['archive'], + $mblog['style'], + $mblog['img']); + } else { + $sortdir = $sort == 'newest'? SORT_DESC : SORT_ASC; + array_multisort($mblog['date'], $sortdir, SORT_NUMERIC, + $mblog['cat'], + $mblog['keyword'], + $mblog['pagenr'], + $mblog['ext'], + $mblog['title'], + $mblog['teaser'], + $mblog['archive'], + $mblog['style'], + $mblog['img']); + } + } + + // start Html + $o .= "\n\n\n" . '
' . "\n"; + + // create buttons to toggle between different categories + if ($showcatbuttons || $showarchivelink) { + $buttonall = isset($ptx['single-file_archive_page']) + && $ptx['single-file_archive_page'] == $h[$s] + ? $ptx['text_archive'] + : $ptx['text_no_selection']; + $o .= '
'; + + // in case the blogpage has to be devided into multiple pages + if ($postsperpage && count($mblog['title'])) { + $k = ceil((count($mblog['title']) - count(array_filter($mblog['archive']))) + / $postsperpage); + for ($i = 1; $i <= $k; $i++) { + $o .= $i == 1? ''; + } + + } else { + // no subpages of the blogpage + $o .= ''; + } + + if ($pcf['posts_from_pages']) { + if ($showcatbuttons && !$pcf['category_from_pagenames_with']) { + foreach (Miniblog_childPages() as $cat) { + if (Miniblog_childPages($cat)) { + $o .= ''; + $catlist[] = $h[$cat]; + } + } + } elseif ($showcatbuttons) $o .= $catselect; + + } + if ($showcatbuttons && $pcf['posts_from_single_files'] && $ptx['single-file_category_list']) { + $cats = explode(',',$ptx['single-file_category_list']); + $teasercats = $pcf['category_enable_multicategory'] + ? explode(' ', implode(' ', $mblog['cat'])) + : $mblog['cat']; + foreach ($cats as $cat) { + $cat = str_replace(' ','__',trim($cat)); + if (in_array($cat, $teasercats) && !in_array($cat,$catlist)) { + $o .= ''; + } + } + } + + if ($showarchivelink) { + if ($ptx['single-file_archive_page']) { + $archivepage = array_search($ptx['single-file_archive_page'], $h); + $o .= $archivepage === false || $archivepage == $s + ? '' + : ''; + } else { + $o .= ''; + } + } + + $bjs = '' . "\n"; + $o .= '
' . "\n\n"; + } + + // create the items of the blog menu + $page = $style = ''; + foreach ($mblog['date'] as $k=>$value) { + if ($postsperpage) { + $page = ' page' . (ceil(($k + 1) / $postsperpage)); + $style = (ceil(($k + 1) / $postsperpage)) > 1 + ? ' style="display:none;"' + : ''; + } + $columnclass = $columns && strpos($mblog['style'][$k],'wide') !== 0 + ? 'mblog_columns ' + : ''; + $o .= $mblog['archive'][$k] && !$ptx['single-file_archive_page'] + ? ''."\n\n\n\n\n"; + + return $o; +} + + +/** + * Displays the header of a blog post + */ +function Miniblog_header($cat='', $date='', $keyword = '', $title = '', $img = '', + $teaser = '', $link = '', $archive = '', $admin = '', $style = '', + $showcat = '', $showdate = '', $showkeyword = '', $id = '') +{ + global $plugin_cf, $plugin_tx, $pth; + $o = $catId = $dateId = $nameId = $titleId = ''; + $pcf = $plugin_cf['miniblog']; + $ptx = $plugin_tx['miniblog']; + + $style = !$style ? $pcf['teaser_img_position'] : $style; + + + $showcat = $showcat !== ''? $showcat : $pcf['category_show_category_in_teaser']; + $showdate = $showdate !== ''? $showdate : $pcf['date_show_date']; + $showkeyword = $showkeyword !== ''? $showkeyword : $pcf['keyword_show_keyword']; + + if ($admin) { + if (!$cat) $cat = $ptx['error_category_missing']; + $catId = 'id="mblog_cat"'; + $dateId = 'id="mblog_date"'; + $nameId = 'id="mblog_name"'; + $titleId = 'id="mblog_title"'; + } + $date = $date? date($pcf['date_format'],(int)$date) : $ptx['error_date_missing']; + if (!$title) $title = $ptx['error_title_missing']; + + $img = $archive ? '' : $link . $img . ''; + + + $o .= $style == 'top' || $style == 'wide_top' + ? $img + : ($style == 'left' + ? '' . $img . '' + : '') ; + + $o .= $showcat && $style != 'left' + ? "\n" . '

' . str_replace('__', ' ', $cat) . '

' + : ''; + $o .= '

'; + $o .= $showdate + ? "\n" . '' . $date . '' + : ''; + $o .= $showkeyword + ? "\n" . ' ' . $keyword . '' + : ''; + if ($style == 'left' && $showcat) $o .= ' (' . str_replace('__', ' ', $cat) . ')'; + $o .= '

'; + + $headstyle = $archive ? $pcf['archive_archive_headline_style'] : $pcf['teaser_headline_style']; + $o .= "\n" . '<' . $headstyle . ' class="mblog_title" ' . $titleId . '>'; + $o .= $style == 'title' || $style == 'wide_title' ? $img : '' ; + $o .= $link && $pcf['teaser_headline_is_link'] + ? $link . $title . '' + : $title; + $o .= '' + . "\n"; + $o .= '

' + . ($style == 'teaser' || $style == 'wide_teaser' ? $img : '') + . $teaser . ($admin ? '' : ' ' + . $link . $ptx['text_more'] .'') . '

'; + + if ($pcf['comments_plugin'] && !$admin && $id) { + $o .= Miniblog_commentCount($id); + } + if ($style == 'left') $o .= '
'; + return $o; +} + + + +/** + * Count the number of Comments for a post, works with twocents_XH + comments_XH + */ +function Miniblog_commentCount($id) +{ + global $pth, $plugin_cf, $plugin_tx; + $o = $comments = ''; + + if ($plugin_cf['miniblog']['comments_plugin'] == "comments") { + $filetype = '.txt'; + $comments = true; + } else $filetype = '.csv'; + + if (is_file($pth['folder']['content'] . $plugin_cf['miniblog']['comments_plugin'] . '/' . $id . $filetype)) { + $file = $pth['folder']['content'] . $plugin_cf['miniblog']['comments_plugin'] . '/' . $id . $filetype; + $linecount = $comments ? -1 : 0; + $handle = fopen($file, "r"); + while(!feof($handle)){ + $line = fgets($handle); + if ($comments) $linecount++; + elseif (is_numeric($line[0])) $linecount++; + } + fclose($handle); + if($linecount > 0) { + return '

' + . sprintf($plugin_tx['miniblog']['text_comments' . XH_numberSuffix($linecount)], $linecount) + . '

'; + } + } +} + + + +/** + * Make sure the next function will load after other plugins + */ +XH_afterPluginLoading( + function () { + global $s, $su, $o, $plugin_tx; + + if ($s == -1 && strpos($su, $plugin_tx['miniblog']['single-file_blogname_in_url'] . '/') === 0 + && strlen($su) > strlen(($plugin_tx['miniblog']['single-file_blogname_in_url']) + 2)) { + $o = Miniblog_extPage($su); + } + } +); + + + +/** + * Creates a temporary CMSimple_XH page from a single file blog post + */ +function Miniblog_extPage($url) { + + global $pth, $plugin_cf, $plugin_tx, $s, $tx, $su, $f, $title; + $o = ''; + + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + list($blog,$folder,$post) = explode('/',$url); + + $tx['meta']['description'] = $posts[$folder][$post]['name'] + . ' (' . $posts[$folder][$post]['cat'] . '): ' + . $posts[$folder][$post]['teaser']; + $title = $posts[$folder][$post]['title']; + + $backlink = isset($posts[$folder][$post]['blog']) && $posts[$folder][$post]['blog'] + ? $posts[$folder][$post]['blog'] + : (!strpos($plugin_tx['miniblog']['single-file_backlinks_to'],',') + ? $plugin_tx['miniblog']['single-file_backlinks_to'] + : substr($plugin_tx['miniblog']['single-file_backlinks_to'], 0, strpos($plugin_tx['miniblog']['single-file_backlinks_to'],','))); + $o .= Miniblog_backLink($backlink); + + $o .= '
'; + + $o .= Miniblog_header( + $posts[$folder][$post]['cat'], + $posts[$folder][$post]['date'], + $posts[$folder][$post]['name'], + $posts[$folder][$post]['title'],'','','','',true); + + $o .= '
'; + + $t = file_get_contents($pth['folder']['content'] . 'extedit/' . $folder . '---' . $post . '.htm'); + if ($plugin_cf['miniblog']['comments_plugin'] && $posts[$folder][$post]['comments'] == 'true') + $t .= '{{{' . $plugin_cf['miniblog']['comments_plugin'] . ' "' . $folder . '---' . $post . '"}}}'; + $o .= evaluate_scripting($t); + + if ($plugin_cf['miniblog']['backlinks_also_below_content']) { + $o .= Miniblog_backLink($backlink, true); + } + return $o; +} + + + +/** + * Enlarges the standard search function to single file blog posts + */ +function Miniblog_search() +{ + global $pth, $u, $cl, $h, $l, $c, $f, $plugin_tx; + + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + foreach ($posts as $folder => $postings) { + foreach ($postings as $post => $postdata) { + if (isset($postdata['publish']) && $postdata['publish'] && $postdata['publish'] != 'false') { + $h[] = $posts[$folder][$post]['title']; + $u[] = $plugin_tx['miniblog']['single-file_blogname_in_url'] . '/' . $folder . '/' . $post; + $c[] = file_get_contents($pth['folder']['content'] . 'extedit/' . $folder . '---' . $post . '.htm'); + } + } + } +} + +if ($f == 'search') Miniblog_search(); + + diff --git a/languages/de_default.php b/languages/de_default.php new file mode 100644 index 0000000..2efca6d --- /dev/null +++ b/languages/de_default.php @@ -0,0 +1,117 @@ +normalerweise leer! Miniblogs seitenbasierte Beiträge benötigen standartmäßig 3 Ebenen, die Überschriften der 2. Ebene dienen als Kategoriennamen.
Hat man nur 2 Ebenen, dienen Seiten deren Namen mit den hier einzugebenden Schlüsselwort beginnen, z.B. \"Cat_\", als Kategorienamen für die folgenden Unterseiten der gleichen Ebene."; +$plugin_tx['miniblog']['cf_comments_plugin']="Um Kommentare bei Einzeldatei-Beiträgen zu ermöglichen, muss ein Kommentarplugin installiert werden und hier der Namen dieses Plugins eingegeben werden, so wie er in Pluginaufrufen eingegeben wird, z.B. für Twocents_XH ist einzugeben \"twocents\".

P.S.: Um Kommentare auf seitenbasierten Beiträgen zu ermöglichen, das Kommentarplugin auf der entsprechenden Seite am Textende mit Pluginbefehl aufrufen."; +$plugin_tx['miniblog']['cf_keyword_2nd_source']="Erste Quelle ist das Pagedata-Meta-Tag Keywords. Ist es leer, dient als 2. Quelle der Seitentext, und zwar entwerder die erste h6, h5, oder h4 Überschrift oder der erste fette oder kursive Text. Bleibt das Feld leer, gibt es keine 2. Quelle."; +$plugin_tx['miniblog']['cf_posts_from_members']="Wenn angekreuzt und \"From single files\" auch angekreuzt, können (über Memberpages/Register_XH) eingeloggte Nutzer/Mitglieder Blogbeiträge als Einzeldateien erstellen. Pluginaufruf {{{miniblogwriter}}}"; +$plugin_tx['miniblog']['cf_posts_from_pages']="Wenn angekreuzt nimmt Miniblog normale CMSimple-Seiten als Blogeinträge."; +$plugin_tx['miniblog']['cf_posts_from_single_files']="Wenn angekreuzt, werden Einzeldatei-Blogbeiträge gezeigt und der Admin kann sie erstellen und verwalten."; +$plugin_tx['miniblog']['cf_teaser_2nd_source']="Betrifft nur seitenbasierte Beiträge. Was ist die Textquelle der Teaser? Erste Quelle ist das Pagedata-Meta-Tag \"Description\". Ist es leer, dient als 2. Quelle der Seitentext, und zwar entwerder der Text ab der Überschrift oder ab des ersten <p>;-Absatzes."; +$plugin_tx['miniblog']['cf_teaser_generated_length']="Betrifft nur seitenbasierte Beiträge, bei denen der Teaser automatisch erzeugt wird. Hier die Zeichenanzahl eingeben, maximale Einstellung: 500"; +$plugin_tx['miniblog']['cf_teaser_headline_style']="HTML-Stil für Teaser-Überschriften auf der Blog Übersichtsseite."; +$plugin_tx['miniblog']['cf_teaser_img_path_for_members']="Pfad vom Standard-Bilder-Ordner zum Ordner, in dem Externe Artikelschreiber Bilder für den Teaser ausgewählen können. Wenn leer, kann kein Bild ausgewählt werden."; +$plugin_tx['miniblog']['cf_teaser_img_position']="Einstellung des Aussehens der Teaser auf der Blog-Seite:
top: Bild über dem Teaser
left: Bild links vom Teaser und der ganze Text rechts
title: Bild links neben Titel (als Float)
teaser: Bild links im eigentlichen Teasertext als Float unter dem Title."; +$plugin_tx['miniblog']['error_ajax']="Fehler beim Speichern der Kopfdaten. Bitte den Webmaster benachrichtigen. Der Inhalt des Blogbeitrags wird davon nicht beeinträchtigt und kann weiter bearbeitet werden."; +$plugin_tx['miniblog']['error_allowed_chars1']="Nur alphanumerische Zeichen, Bindestich, Unterstrich erlaubt"; +$plugin_tx['miniblog']['error_allowed_chars2']="Nur alphanumerische Zeichen und Bindestich erlaubt"; +$plugin_tx['miniblog']['error_category_missing']="Kategorie fehlt noch"; +$plugin_tx['miniblog']['error_date_missing']="kein Datum"; +$plugin_tx['miniblog']['error_folder_already_in_use']="Ordner wird schon von einem anderen User genutzt. Bitte anderen Ordnernamen wählen.'"; +$plugin_tx['miniblog']['error_javascript_missing']="Bitte Java-Script einschalten, andernfalls keine Funktionalität"; +$plugin_tx['miniblog']['error_no_extedit']="Das Plugin Extedit_XH ist nicht installiert"; +$plugin_tx['miniblog']['error_publishing_needs_date']="Zur Veröffentlichung benötigt der Beitrag noch ein Datum. "; +$plugin_tx['miniblog']['error_publishing_needs_title']="Zur Veröffentlichung benötigt der Beitrag noch einen Titel. "; +$plugin_tx['miniblog']['error_save_before_publishing']="Noch keine gespeicherte Textdatei gefunden. Für eine Veröffentlichung muss diese erst gespeichert werden. "; +$plugin_tx['miniblog']['error_title_missing']="Titel fehlt noch"; +$plugin_tx['miniblog']['error_not_authorised']="Zurzeit nicht freigeschaltet für das Erstellen von Beiträgen"; +$plugin_tx['miniblog']['hint_archive_config_page']="nach Änderung des Archivierungsdatums"; +$plugin_tx['miniblog']['hint_archive_language_page']="nach Änderung der Archivseite"; +$plugin_tx['miniblog']['hint_language_var']="Nicht vergessen folgende Angaben in die Sprachdatei einzutragen:
    Für Blogbeträge aus CMSimple-Seiten
  • page-posts_backlinks_to: Name der Seite, zu der die Backlinks gehen. Wenn leer, werden keine Backlinks gesetzt.
  • page-posts_backlinks_from: Leer lassen, außer wenn die Blogseiten keine Unterseiten der Blogstartseite sind. Dann hier die Oberseite eintragen, unter denen die Blogseiten stehen.

  • Für Blogbeiträge aus Einzeldateien
  • single-file_blogname_in_url: Name mit dem die URLs zu den Beiträgen beginnen. Darf nicht mit einem Seitennamen von Level 1 übereinstimmen.
  • single-file_category_list: Komma-getrennte Liste aller Kategorien.
  • single-file_backlinks_to: Seitenname, wohin die Backlinks gehen sollen. Gibt es mehrere Blogs, dann die Seitennamen durch Kommata getrennt eingeben (nach Komma kein Leerzeichen). Beim Verfassen wird dann gefragt, für welchen Blog der Beitrag ist.
  • single-file_archive_page: Wenn ein Blogarchiv auf einer Extraseite angelegt werden soll, die Seite hier angeben. Auf der Seite selbst das Archiv mit {{{miniblog}}} aufrufen.
"; +$plugin_tx['miniblog']['menu_main']="Beiträge"; +$plugin_tx['miniblog']['text_active_blog']="Aktiver Blog"; +$plugin_tx['miniblog']['text_add_new_post']="Neuen Beitrag verfassen"; +$plugin_tx['miniblog']['text_allow_comments']="Kommentare ermöglichen"; +$plugin_tx['miniblog']['text_comments_1']="%s Kommentar"; +$plugin_tx['miniblog']['text_comments_2_4']="%s Kommentare"; +$plugin_tx['miniblog']['text_comments_5']="%s Kommentare"; +$plugin_tx['miniblog']['text_alt_delete']="Beitrag löschen"; +$plugin_tx['miniblog']['text_archive']="Archiv"; +$plugin_tx['miniblog']['text_as_config']="Pos. wie Konfig"; +$plugin_tx['miniblog']['text_author_or_keyword']="Autorenname oder Keyword des Beitrags"; +$plugin_tx['miniblog']['text_backlink']="Zurück zur Blog-Auswahl"; +$plugin_tx['miniblog']['text_blog_post_content']="Blogbeitrag:"; +$plugin_tx['miniblog']['text_category']="Kategorie"; +$plugin_tx['miniblog']['text_choose_blog']="Blog auswählen, zu dem der Beitrag gehören soll"; +$plugin_tx['miniblog']['text_close_user_folder_mapping']="Schließe User-Ordner-Zuordnung"; +$plugin_tx['miniblog']['text_confirm_delete']="Unwiederruflich löschen?"; +$plugin_tx['miniblog']['text_continue_editing_blog_post']="An vorhandenem Beitrag weiterarbeiten? Oder neuen Beitrag verfassen?"; +$plugin_tx['miniblog']['text_date_of_post']="Erscheinungsdatum"; +$plugin_tx['miniblog']['text_delete']="löschen"; +$plugin_tx['miniblog']['text_delete_post']="Beitrag löschen"; +$plugin_tx['miniblog']['text_edit_header']="Kopfdaten bearbeiten"; +$plugin_tx['miniblog']['text_edit_user_folder_mapping']="Edit User-Ordner-Zuordnung"; +$plugin_tx['miniblog']['text_enter_category_list']="Kategorieliste erst in Sprachdatei eintragen"; +$plugin_tx['miniblog']['text_explain_blog_writing']="Bei Blogbeiträgen werden Kopfdaten und Inhalt jeweils einzeln gespeichert"; +$plugin_tx['miniblog']['text_file_based_blog_posts']="Blogbeiträge in Einzeldateien"; +$plugin_tx['miniblog']['text_folder']="Ordner"; +$plugin_tx['miniblog']['text_foldernaming_request']="

Guten Tag %s!

Bevor Sie Beiträge verfassen können, muss für Sie ein Ordner eingerichtet werden, in dem Ihre Beiträge gespeichert werden. Der Name dieses Ordners wird in der URL Ihrer Beiträge genutzt. Er sollte aus Sicherheitsgründen besser nicht mit Ihrem Benutzernamen übereinstimmen. Nach einmaliger Eingabe werden Sie nie wieder danach gefragt.

Bitte denken Sie sich einen kurzen Ordnernamen aus, ohne Umlaute, ß, Leerzeichen und geben Sie ihn hier ein:

"; +$plugin_tx['miniblog']['text_header_blogpost']="Kopfdaten für"; +$plugin_tx['miniblog']['text_if_member_check_single_file']="Posts From members benötigt das Anschalten von Post From single files"; +$plugin_tx['miniblog']['text_image_browser']="Bild"; +$plugin_tx['miniblog']['text_image_teaser']="Bild im Teasertext"; +$plugin_tx['miniblog']['text_image_left']="Bild links, Text rechts"; +$plugin_tx['miniblog']['text_image_title']="Bild links vom Titel"; +$plugin_tx['miniblog']['text_image_top']="Bild oben"; +$plugin_tx['miniblog']['text_login_required']="Sie müssen eingeloggt sein um Blogbeiträge verfassen zu können."; +$plugin_tx['miniblog']['text_mode_edit']="Blogbeitrag: bearbeiten"; +$plugin_tx['miniblog']['text_mode_view']="Blogbeitrag: ansehen"; +$plugin_tx['miniblog']['text_more']="… mehr »"; +$plugin_tx['miniblog']['text_name_of_delete']="Name des zu löschenden Beitrags"; +$plugin_tx['miniblog']['text_name_of_my_folder']="Mein Ordnername"; +$plugin_tx['miniblog']['text_new_blog_post']="Neuen Blogbeitrag anlegen"; +$plugin_tx['miniblog']['text_new_folder_user_mapping']="Neue Beziehung Ordner zu User eintragen"; +$plugin_tx['miniblog']['text_new_post']="Neuer Beitrag"; +$plugin_tx['miniblog']['text_no_selection']="ohne Auswahl"; +$plugin_tx['miniblog']['text_no_teaser_img']="kein Teaser-Bild"; +$plugin_tx['miniblog']['text_not_published']="nicht veröffentlicht"; +$plugin_tx['miniblog']['text_please_choose']="Bitte auswählen"; +$plugin_tx['miniblog']['text_posts_without_user']="Ordner mit Posts ohne Userzuordnung"; +$plugin_tx['miniblog']['text_publ']="veröff."; +$plugin_tx['miniblog']['text_publish_post']="Beitrag veröffentlichen"; +$plugin_tx['miniblog']['text_published']="veröffentlicht"; +$plugin_tx['miniblog']['text_save_changes']="Änderungen speichern"; +$plugin_tx['miniblog']['text_save_header']="Kopfdaten speichern"; +$plugin_tx['miniblog']['text_saved']="Gespeichert"; +$plugin_tx['miniblog']['text_send']="Absenden"; +$plugin_tx['miniblog']['text_short_blog_title']="Kurztitel"; +$plugin_tx['miniblog']['text_teaser_editing']="Teaser (erscheint nur auf Blog-Startseite)"; +$plugin_tx['miniblog']['text_teaser_img']="Teaser-Bild"; +$plugin_tx['miniblog']['text_title_editing']="Titel (erscheint auf Blog-Startseite und über dem Blog-Beitrag)"; +$plugin_tx['miniblog']['text_today']="heute"; +$plugin_tx['miniblog']['text_usage_multicategory']="STRG → multiple Auswahl"; +$plugin_tx['miniblog']['text_usage_of_folder']="Zurzeit %s verschiedene Ordner bei Blogbeiträgen genutzt"; +$plugin_tx['miniblog']['text_user_name']="User Name"; +$plugin_tx['miniblog']['text_warning_archive']="Beiträge älter als %s werden als Archiv gekennzeichnet"; +$plugin_tx['miniblog']['text_warning_save_header']="Erst Kopf speichern"; +$plugin_tx['miniblog']['text_welcome']="Willkommen beim Verfassen von Blogbeträgen"; +$plugin_tx['miniblog']['text_wide']="2 Spalten breit"; +$plugin_tx['miniblog']['update_archive']="Aktualisiere Archiv-Zuordnung der Einzeldateibeiträge"; +$plugin_tx['miniblog']['update_archive_success']="Archiv-Werte neu zugeordnet"; +$plugin_tx['miniblog']['update_successful']="Miniblog Konfig-Datei soeben erfolgreich auf Version %s aktualisiert."; + +?> diff --git a/languages/default.php b/languages/default.php new file mode 100644 index 0000000..9a66098 --- /dev/null +++ b/languages/default.php @@ -0,0 +1,118 @@ +usually left empty! For page based posts Miniblog usually needs 3 levels: blog page 1st level, categories 2nd level, blog posts 3rd level. If you have only 2 levels, page names of 2nd level pages starting with the characters entered here, e.g. \"Cat_\" will serve as categories, while the remaining pages of the 2nd level serve as blog posts."; +$plugin_tx['miniblog']['cf_comments_plugin']="If you want to enable comments on single file posts, you have to install a comment plugin and enter the name of that plugin the way it is used in its plugin call, i.e. for Twocents_XH enter \"twocents\".
P.S.: For comments on page based posts enter the plugin call on the content area just as a any other plugin call."; +$plugin_tx['miniblog']['cf_keyword_2nd_source']="1st source is page data meta keywords. If empty, the keyword is taken from the page text, either the first h6, h5, h4 heading of the first bold or italic text. Without entry no 2nd source will be used."; +$plugin_tx['miniblog']['cf_posts_from_members']="If checked and \"From single files\" also checked (!), logged in (via Memberpages/Register_XH) users/members can write blog posts which will be stored as single files. Plugin call {{{miniblogwriter}}}"; +$plugin_tx['miniblog']['cf_posts_from_pages']="If checked, Miniblog will look for blog posts in standard CMSimple pages."; +$plugin_tx['miniblog']['cf_posts_from_single_files']="If checked, miniblog will look for blog post in single files, which can be edited by the admin."; +$plugin_tx['miniblog']['cf_teaser_2nd_source']="Concerns only page based blog posts. What is the source ot the teaser text? 1st source is page data meta description. If empty, the teaser is taken from the page text, either starting right after the heading or starting from the first <p>;-paragraph."; +$plugin_tx['miniblog']['cf_teaser_generated_length']="Concerns only page based blog posts, where the teaser is generated automatically. Enter the number of characters, maximum value: 500"; +$plugin_tx['miniblog']['cf_teaser_headline_style']="HTML style for teaser headlines in the blog page."; +$plugin_tx['miniblog']['cf_teaser_img_path_for_members']="Path from the standard image folder to a folder, in which external posters can select an image for the blog post teaser. If empty, no image can be selected."; +$plugin_tx['miniblog']['cf_teaser_img_position']="Setting which determines the look of the teaser on the blog page:
top: image on top of the teaser
left: image left of the teaser and all the text right of it
title: image left of the title (as float)
teaser: image left in the teaser text as float below the title."; +$plugin_tx['miniblog']['error_ajax']="An error occured trying to save the header of your blog post. Please inform the webmaster. The contents of your blog post is not affected and you may continue working on it."; +$plugin_tx['miniblog']['error_allowed_chars1']="Only alphanumeric chars, hyphen and underscore allowed"; +$plugin_tx['miniblog']['error_allowed_chars2']="Only alphanumeric chars and hyphen allowed"; +$plugin_tx['miniblog']['error_category_missing']="Category missing"; +$plugin_tx['miniblog']['error_date_missing']="No date"; +$plugin_tx['miniblog']['error_folder_already_in_use']="Folder already in use by another user. Please choose a different folder name.'"; +$plugin_tx['miniblog']['error_javascript_missing']="Please enable java script. otherwise no funktionality"; +$plugin_tx['miniblog']['error_no_extedit']="The plugin Extedit_XH is not installed"; +$plugin_tx['miniblog']['error_publishing_needs_date']="Please enter a date for publication of the post. "; +$plugin_tx['miniblog']['error_publishing_needs_title']="Please enter a title for publication of the post. "; +$plugin_tx['miniblog']['error_save_before_publishing']="Blog contents not yet saved! For publication the blog's contents must be saved. "; +$plugin_tx['miniblog']['error_title_missing']="Title not yet given"; +$plugin_tx['miniblog']['error_not_authorised']="Presently not activated for writing of posts"; +$plugin_tx['miniblog']['hint_archive_config_page']="after changing the archiving date"; +$plugin_tx['miniblog']['hint_archive_language_page']="after changing the archive page"; +$plugin_tx['miniblog']['hint_language_var']="Important values to be set in the languages file:

    For blog posts from CMSimple pages
  • page-posts_backlinks_to: Enter here the name of the blog page. If left empty there will be no backlinks.
  • page-posts_backlinks_from: Leave this empty, except if your blogpages aren't subpages of the blog page but subpages of a different page. Then enter the name of that page

  • For blog posts from single files
  • single-file_blogname_in_url: The start of the URLs to the blog posts. Must differ from page names of level 1.
  • single-file_category_list: Comma separated list of all your categories.
  • single-file_backlinks_to: Name of page(s), towards which the backlinks lead. If you have multiple blogs, enter the names of all your blog pages as comma separated list (no spaces after commas). In the blog post header you can select to which blog the post should belong.
  • single-file_archive_page: If the blog archive should be put on an extra page, enter the page name here and call the archive with {{{miniblog}}} on that page.
"; +$plugin_tx['miniblog']['menu_main']="Blog posts"; +$plugin_tx['miniblog']['text_active_blog']="Active blog"; +$plugin_tx['miniblog']['text_add_new_post']="create new post"; +$plugin_tx['miniblog']['text_allow_comments']="allow comments"; +$plugin_tx['miniblog']['text_comments_1']="%s comment"; +$plugin_tx['miniblog']['text_comments_2_4']="%s comments"; +$plugin_tx['miniblog']['text_comments_5']="%s comments"; +$plugin_tx['miniblog']['text_alt_delete']="Delete post"; +$plugin_tx['miniblog']['text_archive']="Archive"; +$plugin_tx['miniblog']['text_as_config']="Pos. as config"; +$plugin_tx['miniblog']['text_author_or_keyword']="Author's name or keyword"; +$plugin_tx['miniblog']['text_backlink']="Back to Blog Selection"; +$plugin_tx['miniblog']['text_blog_post_content']="Blog post content:"; +$plugin_tx['miniblog']['text_category']="Category"; +$plugin_tx['miniblog']['text_choose_blog']="Choose blog to which your article will be posted"; +$plugin_tx['miniblog']['text_close_user_folder_mapping']="Close user-folder-mapping"; +$plugin_tx['miniblog']['text_confirm_delete']="Delete definitely?"; +$plugin_tx['miniblog']['text_continue_editing_blog_post']="Continue working on existing post? Or start a new post?"; +$plugin_tx['miniblog']['text_date_of_post']="Date of post"; +$plugin_tx['miniblog']['text_delete']="delete"; +$plugin_tx['miniblog']['text_delete_post']="Delete post"; +$plugin_tx['miniblog']['text_edit_header']="edit header"; +$plugin_tx['miniblog']['text_edit_user_folder_mapping']="Edit user-folder-mapping"; +$plugin_tx['miniblog']['text_enter_category_list']="Enter category list first in language file"; +$plugin_tx['miniblog']['text_explain_blog_writing']="In blog posts head data and contents are saved separately"; +$plugin_tx['miniblog']['text_file_based_blog_posts']="Single File Blog Posts"; +$plugin_tx['miniblog']['text_folder']="Folder"; +$plugin_tx['miniblog']['text_foldernaming_request']="

Hello %s:

Before you can write blog posts, a folder has to be created for saving your posts. The name of this folder will be used in the URL to your posts. For security reasons it would be better not to use your user name als folder name. Once you entered a folder name, we won't ask for it again.

Please choose a name (without accented chars) and enter it here:

"; +$plugin_tx['miniblog']['text_header_blogpost']="Head data for"; +$plugin_tx['miniblog']['text_if_member_check_single_file']="Posts From members requires checking Post From single files"; +$plugin_tx['miniblog']['text_image_browser']="Image"; +$plugin_tx['miniblog']['text_image_teaser']="image in teaser text"; +$plugin_tx['miniblog']['text_image_left']="image left, text right"; +$plugin_tx['miniblog']['text_image_title']="image left of title"; +$plugin_tx['miniblog']['text_image_top']="image on top"; +$plugin_tx['miniblog']['text_login_required']="You have to log in to be able to write blog posts."; +$plugin_tx['miniblog']['text_mode_edit']="Blog content: edit"; +$plugin_tx['miniblog']['text_mode_view']="Blog content: view"; +$plugin_tx['miniblog']['text_more']="… more »"; +$plugin_tx['miniblog']['text_name_of_delete']="Name of the post to be deleted"; +$plugin_tx['miniblog']['text_name_of_my_folder']="Name of my folder"; +$plugin_tx['miniblog']['text_new_blog_post']="Start new blog post"; +$plugin_tx['miniblog']['text_new_folder_user_mapping']="Enter new folder-user-mapping"; +$plugin_tx['miniblog']['text_new_post']="New blog post"; +$plugin_tx['miniblog']['text_no_selection']="No selection"; +$plugin_tx['miniblog']['text_no_teaser_img']="no teaser image"; +$plugin_tx['miniblog']['text_not_published']="not published"; +$plugin_tx['miniblog']['text_please_choose']="Please choose"; +$plugin_tx['miniblog']['text_posts_without_user']="Folders with posts without matching user"; +$plugin_tx['miniblog']['text_publ']="publ."; +$plugin_tx['miniblog']['text_publish_post']="Publish post"; +$plugin_tx['miniblog']['text_published']="published"; +$plugin_tx['miniblog']['text_save_changes']="Save changes"; +$plugin_tx['miniblog']['text_save_header']="save header"; +$plugin_tx['miniblog']['text_saved']="Saved"; +$plugin_tx['miniblog']['text_send']="Send"; +$plugin_tx['miniblog']['text_short_blog_title']="Short title"; +$plugin_tx['miniblog']['text_teaser_editing']="Teaser (appears only on the blog page)"; +$plugin_tx['miniblog']['text_teaser_img']="Teaser image"; +$plugin_tx['miniblog']['text_title_editing']="Title (appears on the blog page and on top of blog post)"; +$plugin_tx['miniblog']['text_today']="today"; +$plugin_tx['miniblog']['text_usage_multicategory']="CTRL → multiple selection"; +$plugin_tx['miniblog']['text_usage_of_folder']="Presently %s different folders in use for blog posts"; +$plugin_tx['miniblog']['text_user_name']="User Name"; +$plugin_tx['miniblog']['text_warning_archive']="Posts older as %s will be mapped as archived"; +$plugin_tx['miniblog']['text_warning_save_header']="Save head data first"; +$plugin_tx['miniblog']['text_welcome']="Welcome to writing blog posts"; +$plugin_tx['miniblog']['text_wide']="2 columns wide"; +$plugin_tx['miniblog']['update_archive']="Update archive mapping of single file posts"; +$plugin_tx['miniblog']['update_archive_success']="Archive mapping sucessfully updated"; +$plugin_tx['miniblog']['update_successful']="Miniblog Config succesfully updated to version %s."; + + +?> \ No newline at end of file diff --git a/languages/en.php b/languages/en.php new file mode 100644 index 0000000..dbb96f3 --- /dev/null +++ b/languages/en.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/languages/sk.php b/languages/sk.php new file mode 100644 index 0000000..46f8d30 --- /dev/null +++ b/languages/sk.php @@ -0,0 +1,18 @@ +;-odstavcom."; +$plugin_tx['miniblog']['cf_teaser_generated_length']="Maximálne 500"; +$plugin_tx['miniblog']['cf_teaser_headline_style']="HTML-štýl pre nadpisy na zozname blogov."; +$plugin_tx['miniblog']['menu_main']="Nápoveda"; +$plugin_tx['miniblog']['more']="… viac »"; +$plugin_tx['miniblog']['usage']="

Príkaz pre plugin:
{{{miniblog}}}

Blog-Dátum:
Údaje v Page-Data > Strana > Doba zobrazenia (1. Feld)
Ak necháte prázdne, Použije sa dátum vytvorenia.

Kľúčové slovo (á):
Údaje v Page-Data > Meta > Kľúčové slová
Ak necháte prázdne, použije sa ako kľúčové slovo text stránky podľa konfigurácie.

Teaser-Text:
Údaje v Page-Data > Meta > Popis
Ak necháte prázdne, použije sa ako Teaser-Text obsah stránky podľa konfigurácie.

Kategórie:

Podstránky = Názvy kategórií
pri blogoch na podstránkach

|
Blog-obsah
|
|__Kategória 1
| |
| |__Blog1
| |
| |__Blog2
| |
| |__Blog3
|
|__Kategória 2
|
|__Blog4
o kľúčových slovách, napr. \"Cat_\"
v nadpisoch ukrytých stránok

|
Blog-Obsah
|
|__Cat_Kategória 1
|
|__Blog1
|
|__Blog2
|
|__Blog3
|
|__Cat_Kategória 2
|
|__Blog4
"; +$plugin_tx['miniblog']['config_update']="Miniblog konfiguračný súbor úspešne aktualizovaný na verziu %s."; + +?> diff --git a/version.nfo b/version.nfo new file mode 100644 index 0000000..5fc226a --- /dev/null +++ b/version.nfo @@ -0,0 +1 @@ +Miniblog,0.5.1,0.5.1,,,http://svasti.de/?Start:Miniblog,http://svasti.de/downloads/versioninfo/miniblog_version.nfo diff --git a/writer.php b/writer.php new file mode 100644 index 0000000..a179c47 --- /dev/null +++ b/writer.php @@ -0,0 +1,573 @@ +
' + . $ptx['error_javascript_missing'] + . '
' + . '
'; + + // read the data file of the blog postings + if (isset($_POST['mblognewdata'])) Miniblog_receivePostData(); + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + $posts = Miniblog_includeOrphans($posts); + + // check if extedit is there + if (!function_exists ('extedit')) return '

'.$tx['heading']['error'].'

'.$ptx['error_no_extedit'].'

'; + + // proceed only for logged in users + if (isset($_SESSION['username'])) { + + $user = $_SESSION['username']; + + if ($plugin_cf['miniblog']['posts_authorised_members']) { + $authorised = explode(',',$plugin_cf['miniblog']['posts_authorised_members']); + if (!in_array($user,$authorised)) return $plugin_tx['miniblog']['error_not_authorised']; + } + + $name = isset($_SESSION['fullname'])? $_SESSION['fullname'] : $user; + + + if (!isset($posts['folder'][$user])) { + $o .= '

' . $ptx['text_welcome'] . '

'; + $o .= "\n" . sprintf($ptx['text_foldernaming_request'], $name); + + $o .= '
' + . '' + . '' + . '' + . '
' ; + + } else { + $folder = $posts['folder'][$user]; + + // find the active post + // start with looking into $_POST + if (isset($_POST['mblogpostname'])) { + // in case of delete there is no active post + if($_POST['mblogpostname'] == 'del') { + $post = ''; + } else { + // if a post was added, this should be the active one + $post = $_POST['addpost'] + ? $_POST['addpost'] + // if neither add nor delete, the active one should be in $_POST + : ($_POST['mblogpostname'] != 'add' + ? $_POST['mblogpostname'] + : ''); + // write the found active post into a cookie + if ($post) setcookie ('mblogpostname', $post); + } + } + // if $_POST doesn't give the active post, look into $_COOKIE + if (!$post && isset($_COOKIE['mblogpostname'])) $post = $_COOKIE['mblogpostname']; + // However, wenn $_COOKIE gives the post which was deleted, no active post should be set + // and the cookie should be deleted + if (isset($_POST['mblogdelpost']) && $_POST['mblogdelpost'] + && isset($_COOKIE['mblogpostname']) + && $_COOKIE['mblogpostname'] == $_POST['mblogdelpost']) { + $post = ''; + setcookie ('mblogpostname', "", time() - 3600); + } + + // Give the user the possibility to select the post he wants to work upon + $o .= '
'; + $o .= $post + ? '

' . $ptx['text_explain_blog_writing'] . '

' + : '

' . $ptx['text_continue_editing_blog_post'] . '

'; + $o .= ''; + $o .= ''; + $o .= ''; + $o .= "\n" . '
'; + + + if ($post) $o .= Miniblog_viewEditHeader($folder, $name, $post, $posts); + + $o .= $post + ? '' + . $ptx['text_blog_post_content'] . ' ' + . extedit($user, $folder . '---' . $post) + : ''; + } + } else { + $o .= '

' . $ptx['text_login_required'] . '

'; + } + + return "\n" . $o . "\n" ; +} + +/** + * Displays the header of a post, switchable to edit mode + */ +function Miniblog_viewEditHeader($folder = '', $name = '', $post, $posts, $admin = '') +{ + global $plugin_tx, $plugin_cf; + $ptx = $plugin_tx['miniblog']; + + $o = ''; + $date = isset($posts[$folder][$post]['date']) ? $posts[$folder][$post]['date'] : ''; + $title = isset($posts[$folder][$post]['title']) ? $posts[$folder][$post]['title'] : ''; + $cat = isset($posts[$folder][$post]['cat']) ? $posts[$folder][$post]['cat'] : ''; + $img = isset($posts[$folder][$post]['img']) ? $posts[$folder][$post]['img'] : ''; + $publish = isset($posts[$folder][$post]['publish']) ? $posts[$folder][$post]['publish'] : ''; + $comments= isset($posts[$folder][$post]['comments'])? $posts[$folder][$post]['comments'] : ''; + $teaser = isset($posts[$folder][$post]['teaser']) ? $posts[$folder][$post]['teaser'] : ''; + $archive = isset($posts[$folder][$post]['archive']) ? $posts[$folder][$post]['archive'] : ''; + $blog = isset($posts[$folder][$post]['blog']) ? $posts[$folder][$post]['blog'] : ''; + $style = isset($posts[$folder][$post]['style']) ? $posts[$folder][$post]['style'] : ''; + + $publ = $publish == 'true' + ? ' class="mblogPublOn">' . $ptx['text_published'] + : ' class="mblogPublOff">' . $ptx['text_not_published']; + $o .= '

' . $ptx['text_header_blogpost'] . ' ' + . $ptx['single-file_blogname_in_url'] . '/' . $folder . '/' . $post + . '

'; + + $o .= $archive + ? '

' + . sprintf($ptx['text_warning_archive'],$plugin_cf['miniblog']['archive_archiving_date']) + . '

' + : ''; + + $o .= ''; + + $o .= '
'; + $o .= Miniblog_Header($cat, $date, $name, $title, '', '', '', '', true); + $o .= '
'; + + + // start dialog for displaying or editing blog header + $o .= "\n" . '
' + . '
'; + + return $o; +} + + +/** + * Catches external files which may have been forgotten in the mblog data file + */ +function Miniblog_includeOrphans($posts) +{ + global $pth; + + $files = scandir($pth['folder']['content'] . 'extedit'); + foreach ($files as $file) { + if ($file != '.' && $file != '..' && strpos($file, '---') !== false) { + list($folder, $post) = array_pad(explode('---',$file), -2,''); + $post = substr($post,0,-4); + if ($folder && !isset($posts[$folder][$post])) { + $posts[$folder][$post] = array(); + } + } + } + return $posts; +} + + +/** + * Receives the ajax request, starts the connected function and returns the functions answer + */ +if (isset($_GET['mblogwriter_ajax'])) { + header('Content-Type: text/plain'); + echo Miniblog_receivePostData(); + exit; +} + + +/** + * displays the header of a members posting as editable ajax fields + */ +function Miniblog_editHeader($folder, $name, $blog, $post, $publish, $comments, + $date, $cat, $title, $teaser, $img, $style, $admin = '') +{ + global $pth, $plugin_cf, $plugin_tx, $bjs, $sn; + $o = ''; + $pcf = $plugin_cf['miniblog']; + $ptx = $plugin_tx['miniblog']; + + $nameajax = $admin + ? '"mblogname=" + document.getElementsByName("mblogname")[0].value' + : '"mblogname=" + "'. $name . '"'; + + include 'ajax.php'; + + // this div is only to get styling right in overstyled templates + $o .= "\n" . '
' . "\n" ; + + If (!$admin) $o .= "\n" . ''; + $o .= "\n" . '' + . "\n" . ''; + + // publish blog post? + $publishchecked = $publish && $publish != 'false' ? ' checked' : ''; + $o .= "\n" + . ' '; + + // allow comments? + $commentschecked = $pcf['comments_default_on'] + ? ($comments != 'false' ? ' checked' : '') + : ($comments && $comments != 'false' ? ' checked' : ''); + $o .= $plugin_cf['miniblog']['comments_plugin'] + ? "\n" + . '   ' + : ''; + + $o .= '
'; + + // author's name or the keyword of the blog post + if ($admin) { + $o .= "\n" + . '
'; + } + + // date of the blog post + $dateDisplay = $pcf['date_show_date'] || $pcf['archive_archiving_date'] ? '' : 'style="display:none;"'; + $text = $date > 1 ? date($pcf['date_format'], (int)$date) : ''; + $o .= "\n" . '' + . ' ' + . '
'; + + // Select a blog in case of multiple blogs on the site + if (strpos($ptx['single-file_backlinks_to'], ',') || $admin && $ptx['single-file_archive_page']) { + $o .= "\n" . '
'; + } else { + $o .= ''; + } + + + // Select a category for the blog post + if ($ptx['single-file_category_list']) { + $cats = explode(',',$ptx['single-file_category_list']); + $thiscats = explode(' ',$cat); + $multiple = $pcf['category_enable_multicategory'] ? ' multiple' : ''; + $o .= "\n" . '
'; + } elseif ($pcf['category_show_category_in_teaser'] || $pcf['category_category_selection_buttons']) { + $o .= "\n" . '

' + . $ptx['text_enter_category_list'] . '

'; + } else { + $o .= "\n" . ''; + } + + + // Title of the blog post + $o .= '
' + . "\n" . '
'; + + // Teaser for the blog post, teaser with expanding text area. + $o .= "\n" + . '
' + . '
' . '
' + . '
' + . "\n"; + + // Select an Image for the teaser + if (!$admin) { + if ($pcf['teaser_img_path_for_members']) { + $o .= "\n" . '
'; + } else { + $o .= "\n" . ''; + } + $o .= ''; + } else { + $o .= '
'; + $o .= "\n" . '' + . ''; + $o .= '' + . ''; + $o .= ''; + $o .= "\n" . '
'; + + } + + $o .= "\n" . '
'; + + return $o; +} + + +/** + * enters new values into the data base of member's postings, also deletes posts + */ +function Miniblog_receivePostData() +{ + global $pth, $e, $plugin_cf, $plugin_tx; + $o = ''; + $pcf = $plugin_cf['miniblog']; + $ptx = $plugin_tx['miniblog']; + + $posts = json_decode(file_get_contents($pth['folder']['content'].'miniblog/miniblog.php'), true); + + + $name =isset($_POST['mblogname']) ? htmlspecialchars($_POST['mblogname']) : ''; + $newfolder =isset($_POST['mblognewfolder']) ? $_POST['mblognewfolder'] : ''; + $delfolder =isset($_POST['mblogdelfolder_x'])? $_POST['mblogdelfolder_x'] : ''; + $folderuser =isset($_POST['mblogfolderuser']) ? htmlspecialchars($_POST['mblogfolderuser']) : ''; + $folder =isset($_POST['mblogfolder']) ? htmlspecialchars($_POST['mblogfolder']) : ''; + $blog =isset($_POST['mblogblog']) ? $_POST['mblogblog'] : ''; + $post =isset($_POST['mblogpost']) ? htmlspecialchars($_POST['mblogpost']) : ''; + $date =isset($_POST['mblogdate']) ? $_POST['mblogdate'] : ''; + $title =isset($_POST['mblogtitle']) ? htmlspecialchars($_POST['mblogtitle']) : ''; + $cat =isset($_POST['mblogcat']) ? $_POST['mblogcat'] : ''; + $publish =isset($_POST['mblogpublish']) ? $_POST['mblogpublish'] : false; + $comments =isset($_POST['mblogcomments']) ? $_POST['mblogcomments'] : false; + $archive =isset($_POST['mblogarchive']) ? $_POST['mblogarchive'] : false; + $teaser =isset($_POST['mblogteaser']) ? htmlspecialchars($_POST['mblogteaser']) : ''; + $img =isset($_POST['mblogimg']) ? $_POST['mblogimg'] : ''; + $style =isset($_POST['mblogstyle']) ? $_POST['mblogstyle'] : ''; + $del =isset($_POST['mblogdelpost']) ? $_POST['mblogdelpost'] : ''; + + + if ($folder && $del) { + unset($posts[$folder][$del]); + if (is_file($pth['folder']['content'] . 'extedit/' . $folder . '---' . $del . '.htm')) { + unlink($pth['folder']['content'] . 'extedit/' . $folder . '---' . $del . '.htm'); + } + } + + if ($post) { + + // check if actually a posting file exists + if ($publish == 'true' && !is_file($pth['folder']['content'] . 'extedit/' . $folder . '---' . $post . '.htm')) { + $o .= '' . $ptx['error_save_before_publishing'] . ''; + } + if ($publish == 'true' && !$title) { + $o .= '' . $plugin_tx['miniblog']['error_publishing_needs_title'] . ''; + } + if ($date && strtotime($date) > 1 ) { + $date = strtotime($date); + } else { + $date = ''; + } + if ($publish == 'true' && !$date && + ($pcf['blogpage_order_posts'] == 'newest' || $pcf['blogpage_order_posts'] == 'oldest')) { + $o .= '' . $ptx['error_publishing_needs_date'] . ''; + } + + if ($pcf['archive_archiving_date'] && + strtotime($plugin_cf['miniblog']['archive_archiving_date']) > $date) $archive = true; + + $posts[$folder][$post]['blog'] = $blog; + $posts[$folder][$post]['date'] = $date; + $posts[$folder][$post]['name'] = $name; + $posts[$folder][$post]['title'] = $title; + $posts[$folder][$post]['cat'] = $cat; + $posts[$folder][$post]['publish'] = $publish; + $posts[$folder][$post]['comments'] = $comments; + $posts[$folder][$post]['archive'] = $archive; + $posts[$folder][$post]['teaser'] = $teaser; + $posts[$folder][$post]['img'] = $img; + $posts[$folder][$post]['style'] = $style; + } + + if ($folderuser & $newfolder) { + if ($delfolder) { + unset($posts['folder'][$folderuser]); + } else { + if (preg_match('/^[A-Z0-9-_]+$/i', $newfolder)) { + // in case no change was detected + if (isset($posts['folder'][$folderuser]) && $posts['folder'][$folderuser] == $newfolder) return false; + // in case the folder is already in use + if (in_array($newfolder, $posts['folder'])) { + $e .= $ptx['error_folder_already_in_use']; + return false; + } + // new folder gets registered + $posts['folder'][$folderuser] = $newfolder; + } else { + // illegal chars used + $e .= $ptx['text_short_blog_title'] . ': ' . $ptx['error_allowed_chars2']; + return false; + } + } + } + + // saving the changed file + $jsonposts = json_encode($posts); + if (file_put_contents($pth['folder']['content'].'miniblog/miniblog.php', + $jsonposts, LOCK_EX) === FALSE) { + e('cntsave', 'file', $pth['folder']['content'].'miniblog/miniblog.php'); + return 'ERROR'; + } else return $o ? $o : '' . $ptx['text_saved'] . '' ; +} +?> \ No newline at end of file