commit 28e2772c1372e49e8b5f99e5d189d1a0383a612c Author: g7sim <30436307+g7sim@users.noreply.github.com> Date: Wed Sep 8 19:52:21 2021 +0200 1st diff --git a/.easymin/ignore_prefixes b/.easymin/ignore_prefixes new file mode 100644 index 0000000..c7e2b1a --- /dev/null +++ b/.easymin/ignore_prefixes @@ -0,0 +1,17 @@ +x_ +X_ +-- +data/_ +data/index.html +.git +xx_ +XX_ +.easymin +Boxfile +phpunit +phpunit.xml +.travis.yml +codecov.yml +composer.json +composer.lock +vendor/ diff --git a/.easymin/ignore_types b/.easymin/ignore_types new file mode 100644 index 0000000..3d9bd91 --- /dev/null +++ b/.easymin/ignore_types @@ -0,0 +1,5 @@ +.svn +.psd +.xcf +.exe +.pxm \ No newline at end of file diff --git a/.easymin/noshrink_paths b/.easymin/noshrink_paths new file mode 100644 index 0000000..1249e9b --- /dev/null +++ b/.easymin/noshrink_paths @@ -0,0 +1,2 @@ +/include/thirdparty/ckeditor +/include/thirdparty/elFinder diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d77719b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = tab +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bdda58e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +x_* +X_* +data/_* +xx_* +lock_admin +coverage.xml +composer.lock +/vendor/* diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..a16c72e --- /dev/null +++ b/.htaccess @@ -0,0 +1,5 @@ +AddType application/x-javascript .js +AddType text/css .css +AddType text/xml .xml + +AcceptPathInfo On \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..83b3e1d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: php + +jobs: + include: + - php: 5.6 + - php: 7.0 + - php: 7.1 + - php: 7.2 + - php: 7.3 + - php: 7.4 + - php: 7.2 + env: gp_data_type=.json + + +# phpunit 8 will result in an error +# https://www.reddit.com/r/PHPhelp/comments/apipqs/travis_specifying_phpunit_version/ +before_script: + - composer init -n + - composer require phpunit/phpunit "<8 >=4" + - composer require symfony/process + - composer require guzzlehttp/guzzle + - composer require phpunit/php-code-coverage "<7" # for phpunit compat + #- phpenv config-add phpunit/phpconfig.ini + +script: + - vendor/bin/phpunit + - php phpunit/ServerCombineCoverage.php + - bash <(curl -s https://codecov.io/bash) -s ./x_coverage # Submit coverage report to https://codecov.io diff --git a/Addon.ini b/Addon.ini new file mode 100644 index 0000000..22cef2c --- /dev/null +++ b/Addon.ini @@ -0,0 +1,5 @@ + + +Addon_Name = 'Typesetter Core' +Addon_Unique_ID = 40 +Addon_Version = 5.2-rc diff --git a/README.md b/README.md new file mode 100644 index 0000000..05e95ae --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ + +
+Open source CMS written in PHP focused on ease of use with true WYSIWYG editing and flat-file storage.
Lorem ipsum
,,, Add comments to any Typesetter page ';
+ echo 'No comments to display';
+ echo '
,,,,,,,,,
+About = 'Most Recent Comments
';
+
+ if( count($this->index['recent']) > 0 ){
+ echo '';
+ echo '
';
+ }else{
+ echo 'No comments to display';
+ }
+
+
+ echo ' ';
+ $recent = array_reverse($this->index['recent']);
+ foreach($recent as $comment){
+ $this->CommentRow($comment['page'],$comment);
+ }
+ echo 'Page Comment Time Commenter Comment Options
';
+
+ echo 'Recently Commented Pages
';
+
+ if( count($this->index['pages']) > 0 ){
+ echo '';
+ echo '
';
+ }else{
+ echo ' ';
+ $pages = array_reverse($this->index['pages'],true);
+ foreach($pages as $page_key => $comment){
+ $this->CommentRow($page_key,$comment);
+ }
+ echo 'Page Comment Time Commenter Comment Options ';
+ echo ' ';
+
+ }
+
+
+ /**
+ * Prompt the administrator if they really want to remove the comment
+ *
+ */
+ public function CommentRm(){
+ global $page, $langmessage;
+
+ $page->ajaxReplace = [];
+
+ if( !isset($_REQUEST['i']) ){
+ msg($langmessage['OOPS'].' (Invalid Request)');
+ return false;
+ }
+
+ if( !isset($this->comment_data[$_REQUEST['i']]) ){
+ msg($langmessage['OOPS'].' (Invalid Request)');
+ return false;
+ }
+
+ $comment_key = $_REQUEST['i'];
+ $nonce_str = 'easy_comment_rm:'.count($this->comment_data).':'.$comment_key;
+
+ //prompt for confirmation first
+ if( !isset($_POST['confirmed']) ){
+ $this->CommentRm_Prompt();
+ return true;
+ }
+
+ if( !\gp\tool::verify_nonce($nonce_str,$_POST['nonce']) ){
+ msg($langmessage['OOPS'].' (Invalid Nonce)');
+ return false;
+ }
+
+
+ //remove from this page's comment data
+ unset($this->comment_data[$comment_key]);
+ if( !$this->SaveCommentData() ){
+ msg($langmessage['OOPS'].' (Not Saved)');
+ return false;
+ }
+
+
+ //update the index file
+ $this->UpdateIndex($comment_key);
+
+ $class = '.easy_comment_'.$this->current_index.'_'.$comment_key;
+ $page->ajaxReplace[] = array('detach',$class);
+ $page->ajaxReplace[] = array('detach','.messages');
+
+ return true;
+ }
+
+ public function CommentRm_Prompt(){
+ global $page, $langmessage;
+
+ $page->ajaxReplace = array();
+ $del_comment = \gp\tool\Output::SelectText('Delete Comment');
+ $nonce_str = 'easy_comment_rm:'.count($this->comment_data).':'.$_REQUEST['i'];
+
+ ob_start();
+
+ echo '';
+
+ $message = ob_get_clean();
+ msg($message);
+ }
+
+
+
+
+}
diff --git a/addons/--Easy_Comments/EasyComments_Config.php b/addons/--Easy_Comments/EasyComments_Config.php
new file mode 100644
index 0000000..b462341
--- /dev/null
+++ b/addons/--Easy_Comments/EasyComments_Config.php
@@ -0,0 +1,142 @@
+SaveConfig();
+ default:
+ $this->ShowConfig();
+ break;
+
+ }
+ }
+
+
+ /**
+ * Save posted configuration options
+ *
+ */
+ public function SaveConfig(){
+ global $langmessage;
+
+ $format = htmlspecialchars($_POST['date_format']);
+ if( @date($format) ){
+ $this->config['date_format'] = $format;
+ }
+
+ $this->config['commenter_website'] = (string)$_POST['commenter_website'];
+
+ if( isset($_POST['comment_captcha']) ){
+ $this->config['comment_captcha'] = true;
+ }else{
+ $this->config['comment_captcha'] = false;
+ }
+
+
+ if( !\gp\tool\Files::SaveData($this->config_file, 'config', $this->config) ){
+ message($langmessage['OOPS']);
+ return false;
+ }
+
+ message($langmessage['SAVED']);
+ return true;
+ }
+
+
+ /**
+ * Show EasyComments configuration options
+ *
+ */
+ public function ShowConfig(){
+ global $langmessage;
+
+ $defaults = $this->Defaults();
+
+ $array = $_POST + $this->config;
+
+ echo '';
+ $title = \gp\tool::IndexToTitle($page_index);
+ if( $title === false ){
+ echo 'Deleted page';
+ }else{
+ $label = \gp\tool::GetLabelIndex($page_index);
+ echo \gp\tool::Link($title,$label);
+ }
+ echo ' ';
+ echo date('D, j M Y H:i',$comment['time']);
+ echo ' ';
+ if( !empty($comment['website']) ){
+ echo ''.$comment['name'].'';
+ }else{
+ echo 'no website';
+ echo $comment['name'];
+ }
+ echo ' ';
+ echo $comment['abbr'];
+ echo ' ';
+
+ echo \gp\tool::Link('Admin_Recent_Comments',$langmessage['delete'],'cmd=easy_comment_rm&pg='.$page_index.'&i='.$key,' data-cmd="gpajax"');
+
+ echo ' Easy Comments Configuration
';
+
+ echo '
,,, ,,, This is an example of a Typesetter Addon in the form of a Admin page. Admin pages are only accessible to users with appropriate permissions on your installation of Typesetter CMS. ';
+ echo \common::Link('Special_Example','An Example Link');
+ echo ' You can download a plugin with addtional examples from typesettercms.com This portion was loaded automatically This is an example of a Typesetter Addon in the form of a Special page. Special pages can be used to add more than just content to a Typesetter CMS installation. ';
+ echo \gp\tool::Link('Admin_Example','An Example Link');
+ echo ' You can download a plugin with addtional examples from typesettercms.com This is an example of a Typesetter Addon in the form of a Special page. Special pages can be used to add more than just content to a Typesetter CMS installation. ';
+ echo \gp\tool::Link('Admin_Example','An Example Link');
+ echo ' You can download a plugin with addtional examples from typesettercms.com Cannot install this addon. Your installation of PHP has the symlink() function disabled. Cannot install this addon. $_SERVER[\'SCRIPT_FILENAME\'] and GETENV(\'SCRIPT_FILENAME\') are unavailable. ';
+ echo $langmessage['easily add installations'];
+ echo $langmessage['multi_site_notes'];
+ echo ' ';
+ echo \gp\tool::Link('Admin_Site_Setup',$langmessage['back']);
+ echo ' ';
+ echo \gp\tool::Link('Admin_Site_Setup',$langmessage['back']);
+ echo ' Sorry, the selected folder could not be written to. You may still be able to install in this folder by doing one of the following: ';
+ echo 'Sorry, '.$dir.' is not readable.';
+ echo ' Oops, this page no longer has any content. ';
+
+ if( isset($Inherit_Info[$index]['parent_layout']) ){
+ $parent_layout = $Inherit_Info[$index]['parent_layout'];
+ }else{
+ $parent_layout = $config['gpLayout'];
+ }
+ $parent_info = $gpLayouts[$parent_layout];
+
+ echo $langmessage['restore'].': ';
+ $span = ' ';
+ echo \gp\tool::Link($url,$span.$parent_info['label'],$query_string.'cmd=restorelayout&index='.urlencode($index),array('data-cmd'=>'postlink','title'=>$langmessage['restore']),'restore');
+ echo ' '.$langmessage['about_layout_change'].' ';
+
+ $label = \gp\tool::GetLabelIndex($index,false);
+ echo \gp\tool::LabelSpecialChars($label);
+
+ $i = 0;
+ foreach($affected as $affected_label){
+ $i++;
+ echo ', '.$affected_label;
+ }
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$langmessage['see_also'].' ';
+ echo \gp\tool::Link('Admin_Theme_Content',$langmessage['layouts']);
+ echo '
,,,,,,,,,
+About = 'A collection of examples to demonstrate plugin functionality';
+
+;Map Example
+[Special_Link:Example_Map]
+label = 'Example_Map'
+script = '01_Map.php'
+class = 'Example_Map'
+
+;Ajax Example
+[Special_Link:Example_Ajax]
+label = 'Example_Ajax'
+script = '02_Ajax.php'
+class = 'Example_Ajax'
+
+
diff --git a/addons/--Plugin_Examples/navigation.php b/addons/--Plugin_Examples/navigation.php
new file mode 100644
index 0000000..d1965dd
--- /dev/null
+++ b/addons/--Plugin_Examples/navigation.php
@@ -0,0 +1,23 @@
+All Examples';
+ echo '';
+ foreach($examples as $slug => $label){
+ if( $page->gp_index == $slug ){
+ echo '
';
+}
diff --git a/addons/--Plugin_Examples/static/01_script.js b/addons/--Plugin_Examples/static/01_script.js
new file mode 100644
index 0000000..92bd2a8
--- /dev/null
+++ b/addons/--Plugin_Examples/static/01_script.js
@@ -0,0 +1,40 @@
+ var directionDisplay;
+ var directionsService = new google.maps.DirectionsService();
+ var map;
+
+ $(function(){
+ directionsDisplay = new google.maps.DirectionsRenderer();
+ var chicago = new google.maps.LatLng(50.903315,13.67583);
+ var myOptions = {
+ zoom:17,
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
+ center: chicago
+ }
+ map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
+ directionsDisplay.setMap(map);
+ directionsDisplay.setPanel(document.getElementById("directionsPanel"));
+ var chicago = new google.maps.Marker({
+ position: chicago,
+ map: map,
+ title:"Sportpark Dippoldiswalde",
+ zIndex: 1
+ });
+
+ $('#calc_route_button').click(calcRoute);
+
+ });
+
+
+ function calcRoute(){
+ var start = document.getElementById("map_address").value;
+ var request = {
+ origin:start,
+ destination:"50.903315,13.67583",
+ travelMode: google.maps.DirectionsTravelMode.DRIVING
+ };
+ directionsService.route(request, function(response, status){
+ if (status == google.maps.DirectionsStatus.OK){
+ directionsDisplay.setDirections(response);
+ }
+ });
+ }
diff --git a/addons/--Plugin_Examples/static/02_script.js b/addons/--Plugin_Examples/static/02_script.js
new file mode 100644
index 0000000..85b0f63
--- /dev/null
+++ b/addons/--Plugin_Examples/static/02_script.js
@@ -0,0 +1,5 @@
+gplinks.refresh_content = function(rel,evt){
+ evt.preventDefault();
+ var href = jPrep(this.href)+'&cmd=refresh';
+ $.getJSON(href,ajaxResponse);
+}
diff --git a/addons/--ReplaceContentVars/Addon.ini b/addons/--ReplaceContentVars/Addon.ini
new file mode 100644
index 0000000..04337cc
--- /dev/null
+++ b/addons/--ReplaceContentVars/Addon.ini
@@ -0,0 +1,8 @@
+Addon_Name = 'Replace Content Variables'
+Addon_Version = 1.0-b1
+min_gpeasy_version = 5.1-b1
+About = 'For Typesetter 5.1-b1+ Customize replacable variables. See Sections.php on Github.';
+
+[ReplaceContentVars]
+script = Replace.php
+method = ReplaceCVs::ReplaceContentVars
diff --git a/addons/--ReplaceContentVars/Replace.php b/addons/--ReplaceContentVars/Replace.php
new file mode 100644
index 0000000..13701d7
--- /dev/null
+++ b/addons/--ReplaceContentVars/Replace.php
@@ -0,0 +1,21 @@
+John Doe'; // use $myNameIs in text content
+
+ // you may also unset or change preset variables
+ // $vars['fileModTime'] = 'i won’t tell!';
+
+ return $vars;
+ }
+
+}
diff --git a/addons/--Shadow_Box_Gallery/Addon.ini b/addons/--Shadow_Box_Gallery/Addon.ini
new file mode 100644
index 0000000..9577fcb
--- /dev/null
+++ b/addons/--Shadow_Box_Gallery/Addon.ini
@@ -0,0 +1,44 @@
+
+;Addon_Name
+Addon_Name = 'Shadow Box Gallery'
+
+;Addon_Unique_ID
+Addon_Unique_ID = 231
+
+;Addon_Version
+Addon_Version = 1.1
+
+;min_gpeasy_version
+min_gpeasy_version = 4.0rc2
+
+
+;A description about your addon,
+; may contain some html:
/g,"\n");
+ f=f.replace(/&/g,"&");
+ f=f.replace(/</g,"<");
+ f=f.replace(/>/g,">");
+ f=f.replace(/"/g,'"');
+ return f
+ };
+ var e=function(f) {
+ var f=new Object();
+ f.hideGutter=false;
+ f.hideControls=false;
+ f.collapse=false;
+ f.showColumns=false;
+ f.noWrap=false;
+ f.firstLineChecked=false;
+ f.firstLine=0;
+ f.highlightChecked=false;
+ f.highlight=null;
+ f.lang=null;
+ f.code='';
+ return f
+ };
+ var b=function(i) {
+ var h=e();
+ if(i) {
+ if(i.indexOf('brush')>-1) {
+ var g=/brush:[ ]{0,1}(\w*)/.exec(i);
+ if(g!=null&&g.length>0) {
+ h.lang=g[1].replace(/^\s+|\s+$/g,'')
+ }
+ }
+ if(i.indexOf('gutter')>-1) {
+ h.hideGutter=true
+ }
+ if(i.indexOf('toolbar')>-1) {
+ h.hideControls=true
+ }
+ if(i.indexOf('collapse')>-1) {
+ h.collapse=true
+ }
+ if(i.indexOf('first-line')>-1) {
+ var g=/first-line:[ ]{0,1}([0-9]{1,4})/.exec(i);
+ if(g!=null&&g.length>0&&g[1]>1) {
+ h.firstLineChecked=true;
+ h.firstLine=g[1]
+ }
+ }
+ if(i.indexOf('highlight')>-1) {
+ if(i.match(/highlight:[ ]{0,1}\[[0-9]+(,[0-9]+)*\]/)) {
+ var f=/highlight:[ ]{0,1}\[(.*)\]/.exec(i);
+ if(f!=null&&f.length>0) {
+ h.highlightChecked=true;
+ h.highlight=f[1]
+ }
+ }
+ }
+ if(i.indexOf('ruler')>-1) {
+ h.showColumns=true
+ }
+ if(i.indexOf('wrap-lines')>-1) {
+ h.noWrap=true
+ }
+ }
+ return h
+ };
+ var d=function(g) {
+ var f='brush:'+g.lang+';';
+ if(g.hideGutter) {
+ f+='gutter:false;'
+ }
+ if(g.hideControls) {
+ f+='toolbar:false;'
+ }
+ if(g.collapse) {
+ f+='collapse:true;'
+ }
+ if(g.showColumns) {
+ f+='ruler:true;'
+ }
+ if(g.noWrap) {
+ f+='wrap-lines:false;'
+ }
+ if(g.firstLineChecked&&g.firstLine>1) {
+ f+='first-line:'+g.firstLine+';'
+ }
+ if(g.highlightChecked&&g.highlight!='') {
+ f+='highlight: ['+g.highlight.replace(/\s/gi,'')+'];'
+ }
+ return f
+ };
+ return {
+ title : editor.lang.syntaxhighlight.title,
+ minWidth : 500,
+ minHeight : 400,
+ contents : [
+ {
+ id : 'source',
+ label : editor.lang.syntaxhighlight.sourceTab,
+ accessKey : 'S',
+ elements : [
+ {
+ type : 'vbox',
+ children : [
+ {
+ id : 'cmbLang',
+ type : 'select',
+ labelLayout : 'horizontal',
+ label : editor.lang.syntaxhighlight.langLbl,
+ 'default' : 'java',
+ widths : ['25%','75%'],
+ items : [
+ //['Bash (Shell)','bash'],
+ //['C#','csharp'],
+ //['C++','cpp'],
+ ['CSS','css'],
+ //['Delphi','delphi'],
+ ['Diff','diff'],
+ //['Groovy','groovy'],
+ ['Javascript','jscript'],
+ //['Java','java'],
+ //['Java FX','javafx'],
+ //['Perl','perl'],
+ ['PHP','php'],
+ ['Plain (Text)','plain'],
+ //['Python','python'],
+ //['Ruby','ruby'],
+ //['Scala','scala'],
+ ['SQL','sql'],
+ //['VB','vb'],
+ ['XML/XHTML','xml']
+ ],
+ setup : function(f) {
+ if(f.lang) {
+ this.setValue(f.lang)
+ }
+ },
+ commit : function(f) {
+ f.lang=this.getValue()
+ }
+ }
+ ]
+ },
+ {
+ type : 'textarea',
+ id : 'hl_code',
+ rows : 22,
+ style : 'width:100%',
+ validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.syntaxhighlight.sourceTextareaEmptyError ),
+ setup : function(f) {
+ if(f.code) {
+ this.setValue(f.code)
+ }
+ },
+ commit : function(f) {
+ f.code=this.getValue()
+ }
+ }
+ ]
+ },
+ {
+ id : 'advanced',
+ label : editor.lang.syntaxhighlight.advancedTab,
+ accessKey : 'A',
+ elements : [
+ {
+ type : 'vbox',
+ children : [
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.hideGutter+''
+ },
+ {
+ type : 'checkbox',
+ id : 'hide_gutter',
+ label : editor.lang.syntaxhighlight.hideGutterLbl,
+ setup : function(f) {
+ this.setValue(f.hideGutter)
+ },
+ commit : function(f) {
+ f.hideGutter=this.getValue()
+ }
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.hideControls+''
+ },
+ {
+ type : 'checkbox',
+ id : 'hide_controls',
+ label : editor.lang.syntaxhighlight.hideControlsLbl,
+ setup : function(f) {
+ this.setValue(f.hideControls)
+ },
+ commit : function(f) {
+ f.hideControls=this.getValue()
+ }
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.collapse+''
+ },
+ {
+ type : 'checkbox',
+ id : 'collapse',
+ label : editor.lang.syntaxhighlight.collapseLbl,
+ setup : function(f) {
+ this.setValue(f.collapse)
+ },
+ commit : function(f) {
+ f.collapse=this.getValue()
+ }
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.showColumns+''
+ },
+ {
+ type : 'checkbox',
+ id : 'show_columns',
+ label : editor.lang.syntaxhighlight.showColumnsLbl,
+ setup : function(f) {
+ this.setValue(f.showColumns)
+ },
+ commit : function(f) {
+ f.showColumns=this.getValue()
+ }
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.lineWrap+''
+ },
+ {
+ type : 'checkbox',
+ id : 'line_wrap',
+ label : editor.lang.syntaxhighlight.lineWrapLbl,
+ setup : function(f) {
+ this.setValue(f.noWrap)
+ },
+ commit : function(f) {
+ f.noWrap=this.getValue()
+ }
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.lineCount+''
+ },
+ {
+ type : 'hbox',
+ widths : ['5%','95%'],
+ children : [
+ {
+ type : 'checkbox',
+ id : 'lc_toggle',
+ label : '',
+ setup : function(f) {
+ this.setValue(f.firstLineChecked)
+ },
+ commit : function(f) {
+ f.firstLineChecked=this.getValue()
+ }
+ },
+ {
+ type : 'text',
+ id : 'default_lc',
+ style : 'width:15%;',
+ label : '',
+ setup : function(f) {
+ if(f.firstLine>1) {
+ this.setValue(f.firstLine)
+ }
+ },
+ commit : function(f) {
+ if(this.getValue()&&this.getValue()!='') {
+ f.firstLine=this.getValue()
+ }
+ }
+ }
+ ]
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.highlight+''
+ },
+ {
+ type : 'hbox',
+ widths : ['5%','95%'],
+ children : [
+ {
+ type : 'checkbox',
+ id : 'hl_toggle',
+ label : '',
+ setup : function(f) {
+ this.setValue(f.highlightChecked)
+ },
+ commit : function(f) {
+ f.highlightChecked=this.getValue()
+ }
+ },
+ {
+ type : 'text',
+ id : 'default_hl',
+ style : 'width:40%;',
+ label : '',
+ setup : function(f) {
+ if(f.highlight!=null) {
+ this.setValue(f.highlight)
+ }
+ },
+ commit : function(f) {
+ if(this.getValue()&&this.getValue()!='') {
+ f.highlight=this.getValue()
+ }
+ }
+ }
+ ]
+ },
+ {
+ type : 'hbox',
+ widths : ['5%','95%'],
+ children : [
+ {
+ type : 'html',
+ html : ''
+ },
+ {
+ type : 'html',
+ html : ''+editor.lang.syntaxhighlight.highlightLbl+''
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ onShow : function() {
+ var i=this.getParentEditor();
+ var h=i.getSelection();
+ var g=h.getStartElement();
+ var k=g&&g.getAscendant('pre',true);
+ var j='';
+ var f=null;
+ if(k) {
+ code=a(k.getHtml());
+ f=b(k.getAttribute('class'));
+ f.code=code
+ } else {
+ f=e()
+ }
+ this.setupContent(f)
+ },
+ onOk : function() {
+ var h=this.getParentEditor();
+ var g=h.getSelection();
+ var f=g.getStartElement();
+ var k=f&&f.getAscendant('pre',true);
+ var i=e();
+ this.commitContent(i);
+ var j=d(i);
+ if(k) {
+ k.setAttribute('class',j);
+ k.setText(i.code)
+ } else {
+ var l=new CKEDITOR.dom.element('pre');
+ l.setAttribute('class',j);
+ l.setText(i.code);
+ h.insertElement(l)
+ }
+ }
+ }
+})
\ No newline at end of file
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/icons/syntaxhighlight.png b/addons/--Syntax_Highlighting/syntaxhighlight/icons/syntaxhighlight.png
new file mode 100644
index 0000000..3c5c917
Binary files /dev/null and b/addons/--Syntax_Highlighting/syntaxhighlight/icons/syntaxhighlight.png differ
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/lang/de.js b/addons/--Syntax_Highlighting/syntaxhighlight/lang/de.js
new file mode 100644
index 0000000..3c49565
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/lang/de.js
@@ -0,0 +1,21 @@
+CKEDITOR.plugins.setLang( 'syntaxhighlight', 'de', {
+ title:'Einen Quelltextabschnitt einfügen oder aktualisieren',
+ contextTitle:'Quelltext bearbeiten',
+ sourceTab:'Quelltext',
+ langLbl:'Sprache auswählen',
+ sourceTextareaEmptyError:'Das Quelltext-Feld darf nicht leer sein.',
+ advancedTab:'Erweitert',
+ hideGutter:'Verstecke Seitenleiste',
+ hideGutterLbl:'Verstecke Seitenleiste und Zeilennummern.',
+ hideControls:'Verstecke Kontrollfelder',
+ hideControlsLbl:'Verstecke die Menüleiste über dem Quelltextblock.',
+ collapse:'Einklappen',
+ collapseLbl:'Klappe den Quelltextblock standartmäßig ein. (Kontrollfelder müssen aktiviert werden)',
+ showColumns:'Spalten anzeigen',
+ showColumnsLbl:'Zeige Spalten jeder Zeile in der Kopfzeile an.',
+ lineWrap:'Zeilenumbruch',
+ lineWrapLbl:'Deaktiviere den Zeilenumbruch.',
+ lineCount:'Standart Zeilenanzahl',
+ highlight:'Zeilen hervorheben',
+ highlightLbl:'Geben Sie kommasepariert die Zeilen ein, die sie hervorheben wollen, z.B. 3,10,15.'
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/lang/en.js b/addons/--Syntax_Highlighting/syntaxhighlight/lang/en.js
new file mode 100644
index 0000000..1f822b6
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/lang/en.js
@@ -0,0 +1,21 @@
+CKEDITOR.plugins.setLang( 'syntaxhighlight', 'en', {
+ title:'Add or update a code snippet',
+ contextTitle:'Edit source code',
+ sourceTab:'Source code',
+ langLbl:'Select language',
+ sourceTextareaEmptyError:'Source code mustn\'t be empty.',
+ advancedTab:'Advanced',
+ hideGutter:'Hide gutter',
+ hideGutterLbl:'Hide gutter & line numbers.',
+ hideControls:'Hide controls',
+ hideControlsLbl:'Hide code controls at the top of the code block.',
+ collapse:'Collapse',
+ collapseLbl:'Collapse the code block by default. (controls need to be turned on)',
+ showColumns:'Show columns',
+ showColumnsLbl:'Show row columns in the first line.',
+ lineWrap:'Disable line wrapping',
+ lineWrapLbl:'Switch off line wrapping.',
+ lineCount:'Default line count',
+ highlight:'Highlight lines',
+ highlightLbl:'Enter a comma seperated lines of lines you want to highlight, eg 3,10,15.'
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/lang/fr.js b/addons/--Syntax_Highlighting/syntaxhighlight/lang/fr.js
new file mode 100644
index 0000000..4548ade
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/lang/fr.js
@@ -0,0 +1,21 @@
+CKEDITOR.plugins.setLang('syntaxhighlight', 'fr', {
+ title:'Ajouter ou modifier un morceau de code source',
+ contextTitle:'Éditer le code source',
+ sourceTab:'Code source',
+ langLbl:'Sélectionnez le langage:',
+ sourceTextareaEmptyError:'Le code source ne doit pas être vide',
+ advancedTab:'Avancé',
+ hideGutter:'Cacher la marge',
+ hideGutterLbl:'Cacher la marge et les numéros de ligne.',
+ hideControls:'Cacher la barre d\'outils',
+ hideControlsLbl:'Cacher la barre d\'outils en haut du bloc de code.',
+ collapse:'Réduire le code',
+ collapseLbl:'Réduire le bloc de code par défaut. (la barre d\'outils doit être activée)',
+ showColumns:'Montrer les colonnes',
+ showColumnsLbl:'Montrer les colonnes sur la première ligne.',
+ lineWrap:'Désactiver le retour à la ligne automatique',
+ lineWrapLbl:'Désactiver le retour à la ligne automatique (ne fonctionne plus avec SyntaxHighlighter 3).',
+ lineCount:'Numéro de la première ligne (différent de 1)',
+ highlight:'Surligner les lignes',
+ highlightLbl:'Entrez les numéros des lignes que vous souhaitez surligner, séparés par des virgules. ex 3,10,15.'
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/lang/ja.js b/addons/--Syntax_Highlighting/syntaxhighlight/lang/ja.js
new file mode 100644
index 0000000..e567e3b
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/lang/ja.js
@@ -0,0 +1,21 @@
+CKEDITOR.plugins.setLang( 'syntaxhighlight', 'ja', {
+ title:'コードスニペットの追加または更新',
+ contextTitle:'ソースコードの編集',
+ sourceTab:'ソースコード',
+ langLbl:'ソースコードの言語',
+ sourceTextareaEmptyError:'空のソースコードは登録できません。',
+ advancedTab:'詳細',
+ hideGutter:'行番号',
+ hideGutterLbl:'行番号を非表示にする',
+ hideControls:'codeタグ',
+ hideControlsLbl:'コードブロックの先頭に置かれたcodeタグを非表示にする',
+ collapse:'折りたたみ',
+ collapseLbl:'デフォルトでコードブロックを折りたたむ(コントロールをONにする必要があります)',
+ showColumns:'列',
+ showColumnsLbl:'最初の行に行カラムを表示する',
+ lineWrap:'改行',
+ lineWrapLbl:'行が長くても改行しない',
+ lineCount:'デフォルトの行数',
+ highlight:'行のハイライト表示',
+ highlightLbl:'ハイライトで表示する行をカンマ区切りで指定します(例: 3,10,15)'
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/lang/uk.js b/addons/--Syntax_Highlighting/syntaxhighlight/lang/uk.js
new file mode 100644
index 0000000..32147d5
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/lang/uk.js
@@ -0,0 +1,21 @@
+CKEDITOR.plugins.setLang( 'syntaxhighlight', 'uk', {
+ title:'Додати або оновити фрагмент коду',
+ contextTitle:'Редагувати вихідний код',
+ sourceTab:'Вихідний код',
+ langLbl:'Оберіть мову',
+ sourceTextareaEmptyError:'Вихідний код не повинен бути порожнім.',
+ advancedTab:'Розширені',
+ hideGutter:'Сховати бічну панель',
+ hideGutterLbl:'Сховати бічну панель та номери рядків.',
+ hideControls:'Сховати елементи керування',
+ hideControlsLbl:'Сховати елементи управління кодом у верхній частині блоку коду.',
+ collapse:'Згорнути',
+ collapseLbl:'Згорнути блок коду за замовчуванням. (елементи управління повинні бути включені)',
+ showColumns:'Показати стовпці',
+ showColumnsLbl:'Показувати стовпці кожного рядка у заголовку.',
+ lineWrap:'Вимкнути перенесення рядків',
+ lineWrapLbl:'Відключити перенесення рядків.',
+ lineCount:'Кількість рядків за замовчуванням',
+ highlight:'Виділення рядків',
+ highlightLbl:'Введіть через кому лінії рядків, які ви хочете виділити, наприклад 3,10,15.'
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlight/plugin.js b/addons/--Syntax_Highlighting/syntaxhighlight/plugin.js
new file mode 100644
index 0000000..82d4980
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlight/plugin.js
@@ -0,0 +1,31 @@
+CKEDITOR.plugins.add( 'syntaxhighlight', {
+ requires : 'dialog',
+ lang : 'en,de,fr,ja,uk', // %REMOVE_LINE_CORE%
+ icons : 'syntaxhighlight', // %REMOVE_LINE_CORE%
+ init : function( editor ) {
+ editor.addCommand( 'syntaxhighlightDialog', new CKEDITOR.dialogCommand( 'syntaxhighlightDialog' ) );
+ editor.ui.addButton && editor.ui.addButton( 'Syntaxhighlight',
+ {
+ label : editor.lang.syntaxhighlight.title,
+ command : 'syntaxhighlightDialog',
+ toolbar : 'insert,98'
+ } );
+
+ if ( editor.contextMenu ) {
+ editor.addMenuGroup( 'syntaxhighlightGroup' );
+ editor.addMenuItem( 'syntaxhighlightItem', {
+ label: editor.lang.syntaxhighlight.contextTitle,
+ icon: this.path + 'icons/syntaxhighlight.png',
+ command: 'syntaxhighlightDialog',
+ group: 'syntaxhighlightGroup'
+ });
+ editor.contextMenu.addListener( function( element ) {
+ if ( element.getAscendant( 'pre', true ) ) {
+ return { syntaxhighlightItem: CKEDITOR.TRISTATE_OFF };
+ }
+ });
+ }
+
+ CKEDITOR.dialog.add( 'syntaxhighlightDialog', this.path + 'dialogs/syntaxhighlight.js' );
+ }
+});
diff --git a/addons/--Syntax_Highlighting/syntaxhighlighter/scripts/shAutoloader.js b/addons/--Syntax_Highlighting/syntaxhighlighter/scripts/shAutoloader.js
new file mode 100644
index 0000000..4e29bdd
--- /dev/null
+++ b/addons/--Syntax_Highlighting/syntaxhighlighter/scripts/shAutoloader.js
@@ -0,0 +1,17 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/SyntaxHighlighter
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
+ *
+ * @version
+ * 3.0.83 (July 02 2010)
+ *
+ * @copyright
+ * Copyright (C) 2004-2010 Alex Gorbatchev.
+ *
+ * @license
+ * Dual licensed under the MIT and GPL licenses.
+ */
+eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(2(){1 h=5;h.I=2(){2 n(c,a){4(1 d=0;d\\\\w+)\\\\]$","U"),i=1,p=0;p
,,,,,,,,,
+About = 'A simple plugin to demonstrate some of the basic capabilities of Typesetter Addons';
+
+
+
+;Define a script that is accessible to all visitors and will show up in the menu_arrangement script
+[Special_Link:Special_Example]
+label = 'Special Example'
+class = '\Addon\Example\Special'
+class_admin = '\Addon\Example\Special_Admin'
+
+
+; Define a script that can add content content to a layout
+[Gadget:Example_Content]
+class = '\Addon\Example\Gadget'
+
+
+;Define a script that is only accessible to administrators with appropriate permissions
+[Admin_Link:Admin_Example]
+label = 'Admin Example'
+class = '\Addon\Example\Admin'
+
+
+
diff --git a/addons/Example/Admin.php b/addons/Example/Admin.php
new file mode 100644
index 0000000..77dbf2a
--- /dev/null
+++ b/addons/Example/Admin.php
@@ -0,0 +1,25 @@
+This is an Admin Only Script';
+
+ echo '
';
+ echo '
';
+
+ echo '
';
+ echo '
';
+
+ echo '';
+ echo \gp\tool::Link('Admin_Site_Setup',$langmessage['Settings'],'cmd=settings');
+ echo '';
+
+ echo '
';
+ echo '
';
+
+ echo '';
+ echo '
';
+
+ echo '';
+ echo ' ';
+ }
+
+
+ /**
+ * Remove the files and folders of an installation as determined by the post request
+ *
+ */
+ public function UninstallSite(){
+ global $langmessage, $config;
+
+ $site =& $_POST['site'];
+ if( empty($site) ){
+ return false;
+ }
+ if( !isset($this->siteData['sites'][$site]) ){
+ msg($langmessage['OOPS'].' (Invalid Site)');
+ return false;
+ }
+
+ if( !$this->RmSite($site) ){
+ msg($langmessage['OOPS'].'(Files not completely removed)');
+ return false;
+ }
+
+ msg($langmessage['SAVED']);
+
+ unset($this->siteData['sites'][$site]);
+ $this->SaveSiteData();
+ }
+
+ /**
+ * Remove the files and folders of an installation
+ *
+ */
+ public function RmSite($site){
+ global $config;
+
+ if( !$this->EmptyDir($site) ){
+ return false;
+ }
+
+ return $this->RmDir($site);
+ }
+
+ /**
+ * Remove a folder that was created by the multi-site manager
+ *
+ */
+ public function RmDir($dir){
+ global $config;
+
+ if( @rmdir($dir) ){
+ return true;
+ }
+
+ if( empty($config['ftp_server']) ){
+ return false;
+ }
+
+ if( !function_exists('ftp_connect') ){
+ return false;
+ }
+
+ $conn_id = self::FTPConnect();
+ if( !$conn_id ){
+ return false;
+ }
+
+ $ftp_site = \gp\tool\FileSystemFtp::GetFTPRoot($conn_id,$dir);
+ if( $ftp_site === false ){
+ return false;
+ }
+ return ftp_rmdir($conn_id,$ftp_site);
+ }
+
+ /**
+ * Remove all the contents of a directory
+ *
+ */
+ public function EmptyDir($dir){
+
+ if( !file_exists($dir) ){
+ return true;
+ }
+
+ if( is_link($dir) ){
+ return unlink($dir);
+ }
+
+ $dh = @opendir($dir);
+ if( !$dh ){
+ return false;
+ }
+
+ $dh = @opendir($dir);
+ if( !$dh ){
+ return false;
+ }
+ $success = true;
+
+ $subDirs = array();
+ while( ($file = readdir($dh)) !== false){
+ if( $file == '.' || $file == '..' ){
+ continue;
+ }
+
+ $fullPath = $dir.'/'.$file;
+
+ if( is_link($fullPath) ){
+ if( !unlink($fullPath) ){
+ $success = false;
+ }
+ continue;
+ }
+
+
+ if( is_dir($fullPath) ){
+ $subDirs[] = $fullPath;
+ continue;
+ }
+ if( !unlink($fullPath) ){
+ $success = false;
+ }
+ }
+ closedir($dh);
+
+ foreach($subDirs as $subDir){
+ if( !$this->EmptyDir($subDir) ){
+ $success = false;
+ }
+ if( !\gp\tool\Files::RmDir($subDir) ){
+ $success = false;
+ }
+
+ }
+
+ return $success;
+ }
+
+
+
+
+ public function GetSiteData(){
+ global $addonPathData;
+
+ $this->dataFile = $addonPathData.'/data.php';
+ $this->siteData = \gp\tool\Files::Get($this->dataFile,'siteData');
+ $this->siteData += array('sites'=>array());
+ $this->checksum = $this->CheckSum($this->siteData);
+ }
+
+ public function SaveSiteData(){
+ $check = $this->CheckSum($this->siteData);
+ if( $check === $this->checksum ){
+ return true;
+ }
+
+ unset($this->siteData['destination']); //no longer used
+
+ return \gp\tool\Files::SaveData( $this->dataFile,'siteData',$this->siteData );
+ }
+
+ public function CheckSum($array){
+ return crc32( serialize($array) );
+ }
+
+
+ public function CreatePlugins($destination,$args = false){
+ global $rootDir;
+
+ if( $args === false ){
+ $args = $_POST;
+ }
+
+ //may be valid even if plugins is not set
+ $args += array('plugins'=>array());
+
+ //selection of themes
+ if( !\gp\tool\Files::CheckDir($destination.'/addons') ){
+ msg('Failed to create '.$destination.'/addons'.'');
+ return false;
+ }
+
+ foreach($args['plugins'] as $plugin){
+ $target = $rootDir.'/addons/'.$plugin;
+ if( !file_exists($target) ){
+ continue;
+ }
+ $name = $destination.'/addons/'.$plugin;
+ $this->Create_Symlink($target,$name);
+ }
+
+
+ return true;
+ }
+
+
+ //Don't create symlink for /themes, users may want to add to their collection of themes
+ public function CopyThemes($destination,$args=false){
+ global $rootDir;
+
+ if( $args === false ){
+ $args = $_POST;
+ }
+
+ //selection of themes
+ if( !\gp\tool\Files::CheckDir($destination.'/themes') ){
+ msg('Failed to create '.$destination.'/themes'.'');
+ return false;
+ }
+
+ $count = 0;
+ foreach($args['themes'] as $theme){
+ $target = $rootDir.'/themes/'.$theme;
+ if( !file_exists($target) ){
+ continue;
+ }
+ $name = $destination.'/themes/'.$theme;
+ if( $this->Create_Symlink($target,$name) ){
+ $count++;
+ }
+ }
+ if( $count == 0 ){
+ msg('Failed to populate '.$destination.'/themes'.'');
+ return false;
+ }
+
+ return true;
+ }
+
+ //create the index.php file
+ public function CreateIndex($destination,$unique){
+
+ $path = $destination.'/index.php';
+
+
+ $indexA = array();
+ $indexA[] = '<'.'?'.'php';
+ if( isset($this->siteData['service_provider_id']) ){
+ $indexA[] = 'define(\'service_provider_id\',\''.(int)$this->siteData['service_provider_id'].'\');';
+ }
+ if( isset($this->siteData['service_provider_name']) ){
+ $indexA[] = 'define(\'service_provider_name\',\''.addslashes($this->siteData['service_provider_name']).'\');';
+ }
+ $indexA[] = 'define(\'multi_site_unique\',\''.$unique.'\');';
+ $indexA[] = 'require_once(\'include/main.php\');';
+ $index = implode("\n",$indexA);
+ if( !\gp\tool\Files::Save($path,$index) ){
+ return false;
+ }
+
+ @chmod($path,0644); //to prevent 500 Internal Server Errors on some servers
+
+ return true;
+ }
+
+ public function NewId(){
+
+ do{
+ $unique = \gp\tool::RandomString(20);
+ foreach($this->siteData['sites'] as $array){
+ if( isset($array['unique']) && ($array['unique'] == $unique) ){
+ $unique = false;
+ break;
+ }
+ }
+ }while($unique==false);
+
+ return $unique;
+ }
+
+ //create a symbolic link and test for $test_file
+ public function Create_Symlink($target,$path,$test_file = false ){
+
+ echo '';
+ echo '';
+ echo ' ';
+ echo '';
+ echo '';
+ echo '';
+ echo ' ';
+ echo '
';
+ echo '';
+ $ready = true;
+ $ready = $this->InstallStatus_Step($cmd,$ready,'Destination','new_destination','folder');
+ $ready = $this->InstallStatus_Step($cmd,$ready,'Themes','new_themes','themes');
+ $this->InstallStatus_Step($cmd,$ready,'Plugins','new_plugins','plugins','plugins_submitted');
+
+
+ if( $ready ){
+ echo '
';
+
+ echo '
';
+ }
+
+
+ /**
+ * Show an installation step and it's status
+ *
+ */
+ public function InstallStatus_Step(&$cmd,$ready,$label,$step_cmd,$step_key,$step_key2=false){
+
+ $class = 'ready';
+
+ if( isset($_REQUEST['install'][$step_key]) ){
+ $step_value = $_REQUEST['install'][$step_key];
+ if( is_array($step_value) ){
+ $link_label = implode(', ',$step_value);
+ if( strlen($link_label) > 40 ){
+ $link_label = substr($link_label,0,40).'...';
+ }
+ }else{
+ $link_label = $step_value;
+ }
+ }elseif( $step_key2 && isset($_REQUEST['install'][$step_key2]) ){
+ $link_label = 'Empty';
+ }else{
+ $ready = false;
+ $query_array = array('cmd'=>'new_destination');
+ $link_label = 'Not Set';
+ $class = '';
+
+ if( !$cmd ){
+ $cmd = $step_cmd;
+ }
+ }
+
+ if( empty($link_label) ){
+ $link_label = 'Empty';
+ }
+ $query_array = array('cmd'=>$step_cmd);
+
+ echo '';
+ $message .= '
';
+
+
+
+ //msg($langmessage['not_created'].' (FTP Connection Failed)');
+ unset($_REQUEST['install']['folder']);
+ msg($message);
+ }
+
+ public function NewInstall(){
+
+ echo '';
+ }
+
+
+ public function NewDestination(){
+ global $rootDir,$config;
+
+ if( empty($this->siteData['last_folder']) ){
+ $folder = $rootDir;
+ }else{
+ $folder = $this->siteData['last_folder'];
+ }
+
+ $this->InstallFolder($folder);
+ }
+
+
+ /**
+ * Display form for selecting which themes should be included
+ *
+ */
+ public function NewThemes($values=array()){
+ global $rootDir;
+
+ if( !isset($values['themes']) ){
+ $values += array('all_themes'=>'all');
+ }
+ $values += array('themes'=>array());
+
+
+
+ $all_themes = false;
+ if( isset($values['all_themes']) && $values['all_themes'] == 'all' ){
+ $all_themes = true;
+ }
+
+ echo '';
+ }
+
+ public function NewPlugins($values = array()){
+ global $rootDir;
+
+ $values += array('plugins'=>array());
+
+
+ echo '';
+ }
+
+
+
+ public function InstallLink($label,$query_array=array(),$attr=''){
+ return ''.\gp\tool::Ampersands($label).'';
+ }
+
+ public function InstallUrl($query_array=array()){
+ $query_array += array('install'=>array());
+ $query_array['install'] = $query_array['install'] + $_REQUEST['install'];
+ $query = http_build_query($query_array);
+
+ return \gp\tool::GetUrl('Admin_Site_Setup',$query);
+ }
+
+ public function InstallFields($array,$key=null){
+ foreach($array as $k => $v){
+
+ if( !empty($key) || ($key === 0) ){
+ $k = $key.'['.urlencode($k).']';
+ }
+
+ if (is_array($v) || is_object($v)) {
+ $this->InstallFields($v,$k);
+ } else {
+ echo '';
+ }
+ }
+ }
+
+
+ /**
+ * Display window for selecting where to install
+ *
+ */
+ public function InstallFolder($destination){
+
+ echo '';
+ echo '
';
+
+
+ $previous = $destination;
+ $parent = $destination;
+ $links = array();
+ do{
+ $previous = $parent;
+ $query_array = array('cmd'=>'expandfolder','folder'=>$parent);
+ $links[] = $this->InstallLink(basename($parent).'/',$query_array,' data-cmd="gpajax" ');
+ $parent = dirname($parent);
+ }while( $previous != $parent );
+
+
+ echo '';
+ echo 'Select Destination Folder';
+ echo ' ';
+ $i = 0;
+ $classes = array('even','odd');
+ if( count($subdirs) > 0 ){
+ natcasesort($subdirs);
+ $temp = rtrim($dir,'/');
+ foreach($subdirs as $subdir){
+ echo '
';
+ }
+
+ public function GetSubdirs($dir){
+ global $config;
+
+ if( is_readable($dir) ){
+ return \gp\tool\Files::readDir($dir,1);
+ }
+
+ return false;
+ }
+
+ public function FolderLink($base,$full,$class){
+ echo ' ';
+ }
+
+
+ /*
+ * Check for /addons, /data, /include, /themes and /index.php
+ */
+ public function InstallLinks($dir){
+ global $config;
+
+ $check_short = array('addons','data','include','themes','index.php');
+ $failed = array();
+
+ //readable
+ if( !is_readable($dir) ){
+ return false;
+ }
+
+ //existing contents
+ foreach($check_short as $short){
+ $check_full = rtrim($dir,'/').'/'.$short;
+ if( file_exists($check_full) ){
+ $failed[] = $check_short;
+ }
+ }
+
+ if( count($failed) > 0 ){
+ return false;
+ }
+
+ $query_array = array('cmd'=>'Continue','install'=>array('folder'=>$dir));
+ echo $this->InstallLink('Install Here',$query_array,' class="select" ');
+
+ $query_array = array('cmd'=>'rmdir','dir'=>$dir);
+ echo $this->InstallLink('Delete',$query_array,' class="rm" data-cmd="gpajax" ');
+ }
+
+
+ /**
+ * Show the contents of folder
+ *
+ */
+ public function ExpandFolder(){
+ global $page, $langmessage,$config;
+
+ $_REQUEST += array('install'=>array());
+ $page->ajaxReplace = array();
+ $page->ajaxReplace[] = 'messages';
+
+ $folder =& $_REQUEST['folder'];
+ if( empty($folder) || !file_exists($folder) || !is_dir($folder) ){
+ msg($langmessage['OOPS']);
+ return;
+ }
+
+ $this->LoadFolder($folder);
+ }
+
+ /**
+ * Go to a user supplied sub directory in the browser
+ *
+ */
+ public function SubFolder(){
+ global $langmessage;
+
+ $folder =& $_REQUEST['folder'];
+ if( !empty($_REQUEST['sub_dir']) ){
+ $folder .= '/'.$_REQUEST['sub_dir'];
+ }
+ if( empty($folder) || !file_exists($folder) || !is_dir($folder) ){
+ msg($langmessage['OOPS']);
+ return;
+ }
+
+ $this->LoadFolder($folder);
+ }
+
+
+ public function LoadFolder($folder){
+ global $page;
+
+ ob_start();
+ echo $this->InstallFolder($folder);
+ $content = ob_get_clean();
+
+ $page->ajaxReplace[] = array('inner','#install_step',$content);
+
+ //save the folder location
+ if( !isset($this->siteData['last_folder']) || $this->siteData['last_folder'] !== $folder ){
+ $this->siteData['last_folder'] = $folder;
+ unset($this->siteData['last_folder_ftp']);
+ $this->SaveSiteData();
+ }
+ }
+
+
+ /*
+ * Create a new folder
+ *
+ */
+ public function NewFolder(){
+ global $page, $langmessage;
+
+ $page->ajaxReplace = array();
+ $page->ajaxReplace[] = 'messages';
+
+ $folder =& $_POST['folder'];
+ if( empty($folder) || !file_exists($folder) || !is_dir($folder) ){
+ msg($langmessage['OOPS']. ' (Parent Dir)');
+ return false;
+ }
+
+ $new_name =& $_POST['new_folder'];
+ if( empty($new_name) ){
+ msg($langmessage['OOPS']. ' (Empty Name)');
+ return false;
+ }
+
+ $new_name = trim($new_name,'/\\');
+ $folder = rtrim($folder,'/\\');
+
+ $new_folder = $folder.'/'.$new_name;
+
+ if( file_exists($new_folder) ){
+ msg($langmessage['OOPS']. ' (Already Exists)');
+ return false;
+ }
+
+ if( !$this->MakeDir($folder,$new_name) ){
+ return false;
+ }
+
+ $this->ExpandFolder();
+ }
+
+ public function RemoveDirPrompt(){
+ global $page, $langmessage;
+
+ $page->ajaxReplace = array();
+ $page->ajaxReplace[] = 'messages';
+
+
+ $dir = $_REQUEST['dir'];
+ if( !$this->RemoveDirCheck($dir) ){
+ return;
+ }
+
+ ob_start();
+
+ echo '';
+ $langmessage['not_created'] .= '
';
+
+ $langmessage['not_created'] = sprintf($langmessage['not_created'],\gp\tool::GetUrl('Admin_Site_Setup','cmd=settings'));
+
+
+ $new_folder = $parent.'/'.$new_name;
+
+ if( mkdir($new_folder,0755) ){
+ chmod($new_folder,0755); //some systems need more than just the 0755 in the mkdir() function
+ return true;
+ }
+
+ if( $this->HasFTP() ){
+ msg($langmessage['not_created']);
+ return false;
+ }
+
+ $conn_id = self::FTPConnect();
+ if( !$conn_id ){
+ msg($langmessage['not_created'].' (FTP Connection Failed)');
+ return false;
+ }
+
+
+ $ftp_parent = \gp\tool\FileSystemFtp::GetFTPRoot($conn_id,$parent);
+ if( $ftp_parent === false ){
+ msg('Oops, could not find the ftp location of '.$parent.' using the current ftp login.');
+ return false;
+ }
+
+ $ftp_destination = $ftp_parent.'/'.$new_name;
+ if( !ftp_mkdir($conn_id,$ftp_destination) ){
+ msg('Oops, could not create the folder using the current ftp login.');
+ return false;
+ }
+
+ ftp_site($conn_id, 'CHMOD 0755 '. $ftp_destination );
+ return true;
+ }
+
+
+ public function NewCreate(){
+ global $rootDir,$config,$checkFileIndex;
+ global $dataDir; //for SaveTitle(), SaveConfig()
+
+ $_POST += array('themes'=>array(),'plugins'=>array());
+ $destination = $_REQUEST['install']['folder'];
+ $this->site_uniq_id = $this->NewId();
+ $checkFileIndex = false;
+
+
+ //prevent reposting
+ if( isset($this->siteData['sites'][$destination]) ){
+ msg('Oops, there\'s already an installation in '.htmlspecialchars($destination));
+ return false;
+ }
+
+ echo '';
+ echo '
';
+ if( $destination ){
+ $this->EmptyDir($destination);
+ }
+ }
+
+ public function Install_Success(){
+ echo '';
+ echo '';
+ echo 'Installation was completed successfully. ';
+
+ //show the options
+ $_REQUEST['site'] = $_REQUEST['install']['folder'];
+ $this->Options();
+
+ }
+
+ /**
+ * Return true if FTP can be used
+ *
+ */
+ public function HasFTP(){
+ global $config;
+
+ if( empty($config['ftp_server']) || !function_exists('ftp_connect') ){
+ return false;
+ }
+
+ return true;
+ }
+
+
+ /**
+ * Multi Site Heading
+ *
+ */
+ public function Heading($sub_heading=false){
+ echo '';
+ echo \gp\tool::Link('Admin_Site_Setup','Multi-Site');
+
+ if( $sub_heading ){
+ echo ' » ';
+ echo $sub_heading;
+ }
+ echo '
';
+ }
+
+
+ /**
+ * FTP Functions
+ *
+ */
+ public static function FTPConnect(){
+ global $config;
+
+ static $conn_id = false;
+
+ if( $conn_id ){
+ return $conn_id;
+ }
+
+ if( empty($config['ftp_server']) ){
+ return false;
+ }
+
+ $conn_id = @ftp_connect($config['ftp_server'], 21, 6);
+ if( !$conn_id ){
+ //trigger_error('ftp_connect() failed for server : '.$config['ftp_server']);
+ return false;
+ }
+
+ $login_result = @ftp_login($conn_id, $config['ftp_user'], $config['ftp_pass']);
+ if( !$login_result ){
+ //trigger_error('ftp_login() failed for server : '.$config['ftp_server'].' and user: '.$config['ftp_user']);
+ return false;
+ }
+ register_shutdown_function(array('SetupSite', 'ftpClose'), $conn_id);
+ return $conn_id;
+ }
+
+
+ public static function ftpClose($connection=false){
+ if( $connection !== false ){
+ @ftp_quit($connection);
+ }
+ }
+
+}
diff --git a/addons/Multi Site/multi_site.scss b/addons/Multi Site/multi_site.scss
new file mode 100644
index 0000000..91a5136
--- /dev/null
+++ b/addons/Multi Site/multi_site.scss
@@ -0,0 +1,221 @@
+
+@import 'include/thirdparty/Bootstrap3/scss/bootstrap/_variables.scss';
+@import 'include/css/variables.scss';
+
+
+//@import 'include/thirdparty/Bootstrap3/less/variables.less';
+//@import 'include/css/variables.less';
+
+
+
+#install_step{
+ margin-top:30px;
+ }
+
+#install_step th{
+ font-size:20px !important;
+ font-weight:normal;
+ border:none;
+ background:#fff;
+ padding:0 0 10px;
+ text-align:left;
+ }
+
+#install_step .label{
+ white-space:nowrap;
+ padding-right:20px;
+ }
+
+#parent_folders{
+ margin-bottom:10px;
+ background: #eee;
+ border-radius:3px;
+ }
+
+#parent_folders a{
+ display:inline-block;
+ padding:0;
+ margin:0;
+ padding: 5px 10px;
+ color:#333 !important;
+ line-height:18px;
+ }
+#parent_folders a:hover{
+ background:#f5f5f5;
+ }
+
+#parent_folders form,
+#parent_folders input{
+ display:inline;
+ }
+
+#parent_folders input{
+ display:inline-block;
+ background: #fff;
+ border: 1px solid #efefef;
+ border-radius: 5px;
+ padding:0;
+ margin:1px;
+ height:24px;
+ width:200px;
+ }
+
+#destination_select ul{
+ list-style:none;
+ margin:1px 0;
+ padding:0;
+ }
+#destination_select ul li{
+ overflow:hidden;
+ padding: 0 0 0 20px;
+ padding: 0;
+ }
+#destination_select li span{
+ display:block;
+ white-space:nowrap;
+ padding:0;
+
+ background: #e9e9e9 url('../../../include/imgs/folder.png') 4px 50% no-repeat;
+ }
+#destination_select li span.odd{
+ background-color:#f7f7f7;
+ }
+
+#destination_select span:hover{
+ background-color: #ccc !important;
+ }
+
+#destination_select li a{
+ display:block;
+ padding: 5px 10px 5px 24px;
+ color:#333 !important;
+ margin-right:100px;
+ }
+
+#destination_select a.select,
+#destination_select input.gppost{
+ float:right;
+ padding:2px 5px;
+ margin:3px;
+ border:0;
+ border-radius:3px;
+ font-size:13px;
+
+ color:#fff !important;
+ background-color:#6aa84f;
+ }
+
+#destination_select a.rm{
+ float:right;
+ padding:2px 5px;
+ margin:3px;
+ display:none;
+ }
+#destination_select span.expand a.rm{
+ display:block;
+ }
+
+/*
+#destination_select a.not_installable{
+ color:#990000 !important;
+ background:none;
+ }
+*/
+
+#destination_select form{
+ display:block;
+ background: #e9e9e9;
+ border:2px solid #e9e9e9;
+ border-width:2px 0 2px 2px;
+ }
+#destination_select form.odd{
+ background-color:#f7f7f7;
+ border-color:#f7f7f7;
+ }
+#destination_select input.text{
+ border:1px solid #ccc;
+ padding: 4px;
+ display: block;
+ }
+
+
+
+#install_status{
+ width:100%;
+ border-radius:5px;
+ padding:0;
+ color:#555;
+ box-sizing:border-box;
+ margin-top:20px;
+ }
+
+#install_status ul{
+ list-style:none;
+ margin:0;
+ padding:0;
+ }
+
+#install_status li{
+ display:inline-block;
+ }
+
+#install_status li a{
+ color: #333;
+ padding: 7px 10px;
+ margin-right: 10px;
+ display: inline-block;
+ max-width: 200px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+
+ color: $btn-warning-color !important;
+ background-color: $btn-warning-bg;
+ border: 1px solid $btn-warning-border;
+ border-radius:3px;
+ }
+
+#install_status li.ready a{
+ color: $btn-success-color !important;
+ background-color: $btn-success-bg;
+ border: 1px solid $btn-success-border;
+}
+
+#install_state{
+ float:right;
+ }
+#install_state.ready a{
+ font-weight:bold;
+ }
+
+#install_continue{
+ text-align:right;
+ margin-top:10px;
+ }
+
+#install_continue input{
+ border:1px solid #ccc;
+ border-radius:5px;
+ padding:1px 5px;
+ margin:5px;
+ cursor:pointer;
+ }
+
+#install_continue .continue{
+ padding:4px 26px;
+ font-size:15px;
+
+ color: $btn-success-color;
+ background-color: $btn-success-bg;
+ border: 1px solid $btn-success-border;
+ border-radius:5px;
+ }
+
+#ms_links{
+ padding:25px 0;
+ }
+
+#ms_links a{
+ font-size:17px;
+ margin:3px 7px 3px 0;
+ }
diff --git a/addons/index.html b/addons/index.html
new file mode 100644
index 0000000..e69de29
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..69cb760
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1 @@
+comment: false
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..82dd246
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,18 @@
+{
+ "name": "typesetter/typesetter",
+ "type": "project",
+ "description":"Open source CMS written in PHP focused on ease of use with true WYSIWYG editing and flat-file storage.",
+ "hoempage":"http://www.typesettercms.com/",
+ "require": {},
+ "require-dev": {
+ "phpcompatibility/php-compatibility": "^9.3",
+ "symfony/process": "<4",
+ "guzzlehttp/guzzle": "^6.5",
+ "phpunit/php-code-coverage": "<7",
+ "phpunit/phpunit": "<8 >=4"
+ },
+ "scripts": {
+ "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
+ "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
+ }
+}
diff --git a/data/example_htaccess b/data/example_htaccess
new file mode 100644
index 0000000..1b0bbed
--- /dev/null
+++ b/data/example_htaccess
@@ -0,0 +1,8 @@
+
+# blocks direct access to data files
+# Note: this setting could conflict with some addons
+';
+
+ echo '
';
+ echo self::SectionClipboardLinks();
+ echo '
';
+ echo '';
+ echo '
';
+ echo '' . $stacker_label . '';
+ echo '
';
+ echo '';
+ echo $langmessage['current_layout'].': ';
+ echo ' ';
+ echo str_replace('_',' ',$curr_info['label']);
+ echo '
';
+
+ if( !empty($gp_titles[$index]['gpLayout']) ){
+ echo '';
+
+ echo '
';
+ echo \gp\tool::Link('Admin_Theme_Content',$langmessage['new_layout']);
+ echo ' ';
+
+ if( count($gpLayouts) < 2 ){
+ echo '';
+ echo $langmessage['available_layouts'];
+ echo ' ';
+ echo $langmessage['theme'];
+ echo ' ';
+ echo '';
+ echo $langmessage['Empty'];
+ echo ' ';
+
+ }
+ echo '';
+
+
+ //show affected pages
+ $affected = self::GetAffectedFiles($index);
+
+ echo '';
+ echo '';
+ echo ' ';
+ if( $layout != $curr_layout ){
+ echo \gp\tool::Link($url,$info['label'],$query_string.'cmd=uselayout&index='.urlencode($index).'&layout='.urlencode($layout),array('data-cmd'=>'postlink'),'use_'.$layout);
+
+ }
+ echo ' ';
+ echo $info['theme'];
+ echo '
';
+
+ echo '';
+ echo '
';
+
+ echo ''.$langmessage['affected_files'].'
You\'re currently using version '.\gpversion.' of our free, open source and easy to use content management system.'; + echo ' Our code is hosted on GitHub '; + echo 'and licensed under version 2 of the GNU General Public License. '; + echo '
'; + + echo ''; + echo 'We\'ve worked very hard to find a balance between the ease of use and functionality in Content Management Systems and we think we\'ve done a pretty good job. '; + echo ' You may agree or disagree though, and the only way for us to know is to hear from you. '; + echo ' We want to know what you think. Here\'s how:'; + echo '
'; + + echo 'Does '.\CMS_NAME.' Work?'; + echo 'Obviously the first step is to get '.\CMS_NAME.' working correctly.'; + echo ' If it\'s not working for you and you think it\'s because of a bug, you can report it and we\'ll work on fixing it.'; + echo '
'; + + echo 'Does '.\CMS_NAME.' Work Well?'; + echo 'This one is a bit more subjective, but just as important. '; + echo ' There are multiple ways to give us feedback. The following services allow you to rate and comment on '.\CMS_NAME.'. '; + echo '
'; + echo ''; + echo ''; + + + $projects = []; + $projects['ckEditor'] = 'ckeditor.com/ckeditor-4'; + $projects['elFinder'] = 'studio-42.github.io/elFinder'; + $projects['ColorBox'] = 'www.jacklmoore.com/colorbox'; + $projects['Bootstrap'] = 'getbootstrap.com'; + $projects['Bootswatch'] = 'bootswatch.com'; + $projects['jQuery'] = 'jquery.com'; + $projects['jQuery UI'] = 'jqueryui.com'; + $projects['ScssPhp'] = 'github.com/leafo/scssphp'; + $projects['PHPMailer'] = 'github.com/PHPMailer/PHPMailer'; + + + echo ''.\CMS_NAME.' would not have been possible if it wasn\'t for the prosperous open source community and rich selection of successful open source projects. '; + echo ' We have benefited tremendously from the community and have borrowed ideas as well as integrated other freely available code. '; + echo ' Here are some of the projects we have benefited the most from. '; + echo '
'; + + echo 'Project | Website |
---|---|
'; + echo $name; + echo ' | '; + echo ''.$url.''; + echo ' |
'; + echo $langmessage['name']; + echo ' | '; + echo $langmessage['version']; + echo ' | '; + echo $langmessage['options']; + echo ' | '; + echo $langmessage['description']; + echo ' |
---|---|---|---|
';
+ echo str_replace(' ', ' ', $info['Addon_Name']);
+ echo ' /addons/' . $folder . ''; + echo ' | '; + echo $info['Addon_Version']; + echo ' | '; + echo \gp\tool::Link( + 'Admin/Addons', + $langmessage['Install'], + 'cmd=LocalInstall&source=' . $folder, + array('data-cmd' => 'cnreq') + ); + echo ' | ';
+ echo $info['About'];
+ if( isset($info['Addon_Unique_ID']) && is_numeric($info['Addon_Unique_ID']) ){
+ echo ' '; + echo $this->DetailLink('plugins', $info['Addon_Unique_ID'], 'More Info...'); + } + echo ' |
'.$langmessage['Addon_Install_Warning'].'
'; + echo ''.sprintf($langmessage['Selected_Install'],$name,\CMS_READABLE_DOMAIN).'
'; + + $_REQUEST += array('order'=>''); + + echo ''; + } + + public function RemoteInstallConfirmed($type = 'plugin'){ + + $_POST += array('order'=>''); + + + $installer = new \gp\admin\Addon\Installer(); + + $installer->code_folder_name = $this->code_folder_name; + $installer->config_index = $this->config_index; + + $installer->InstallRemote( $type, $_POST['id'], $_POST['order'] ); + $installer->OutputMessages(); + + return $installer; + } + + + public function SearchOrder(){ + + if( isset($_REQUEST['order']) && isset($this->searchOrderOptions[$_REQUEST['order']]) ){ + $this->searchOrder = $_REQUEST['order']; + $this->searchQuery .= '&order='.rawurlencode($_REQUEST['order']); + }else{ + reset($this->searchOrderOptions); + $this->searchOrder = key($this->searchOrderOptions); + } + + } + + /** + * Display available search options + * + */ + public function SearchOptions( $nav_on_top = true ){ + echo ' '; + } + + + public function FindForm(){ + global $langmessage; + + $_GET += array('q'=>''); + + echo ''; + echo $langmessage['name']; + echo ' | |
---|---|
'; + echo htmlspecialchars($folder); + echo ' | '; + echo htmlspecialchars($msg); + echo ' |
'.$langmessage['name'].' | '.$langmessage['version'].' | '.$langmessage['Statistics'].' | '.$langmessage['description'].' | |
---|---|---|---|---|
'; + echo self::DetailLink($row['type'], $row['id'], '','',' class="shot"'); + echo ' | '; + echo '';
+ echo ''.$row['name'].'';
+ echo ' '; + echo self::DetailLink($row['type'], $row['id'] ); + echo ' | '; + $this->InstallLink($row); + echo ' | '; + echo $row['version']; + echo ' | ';
+ echo sprintf($langmessage['_downloads'],number_format($row['downloads']));
+ echo ' '; + $this->CurrentRating($row['rating_weighted']); + echo ' '; + echo $row['rating_count'].' ratings'; + echo ' | '; + echo $row['short_description']; + echo ' |
'; + echo $langmessage['search_no_results']; + echo '
'; + return false; + } + + //save the cache + if( !$cache_used ){ + \gp\tool\Files::Save($cache_file,$result); + } + + return $data; + } + + + + /** + * Display option to limit search results to addons that are compat with the current cms version + * + */ + public function VersionOption(){ + global $langmessage, $config; + + echo ''; + echo 'Limit results to addons that are compatible with your version of '.\CMS_NAME.' ('.\gpversion.') '; + + if( !isset($config['search_version']) || $config['search_version'] ){ + echo ''.$langmessage['On'].' '; + echo \gp\tool::Link($this->searchUrl,$langmessage['Off'],$this->searchQuery.'&search_option=noversion',' data-cmd="gpajax"'); + + }else{ + echo \gp\tool::Link($this->searchUrl,$langmessage['On'],$this->searchQuery.'&search_option=version',' data-cmd="gpajax"'); + echo ' '.$langmessage['Off'].''; + } + echo '
'; + + $this->ViewOnline(); + } + + + /** + * Convert the response string to an array + * Serialized or json (serialized data may be cached) + * + */ + protected function ParseResponse($result){ + + //no response + if( !$result ){ + echo ''.\gp\tool\RemoteGet::Debug('Sorry, data not fetched').'
'; + return false; + } + + $data = false; + if( strpos($result,'a:') === 0 ){ + $data = unserialize($result); + + }elseif( strpos($result,'{') === 0 ){ + $data = json_decode($result,true); + } + + if( !is_array($data) ){ + $debug = array(); + $debug['Two'] = substr($result,0,2); + $debug['Twotr'] = substr(trim($result),0,2); + echo ''.\gp\tool\RemoteGet::Debug('Sorry, data not fetched',$debug).'
'; + return false; + } + + return $data; + } + + + /** + * Link to view search resuls on typesettercms.com + * + */ + public function ViewOnline(){ + $slug = 'Plugins'; + if( $this->config_index == 'themes' ){ + $slug = 'Themes'; + } + $url = \addon_browse_path.'/'.$slug.'?'.$this->searchQuery.'&page='.$this->searchPage; + echo 'View search results on '.CMS_READABLE_DOMAIN.'
'; + } +} diff --git a/include/admin/Addon/Tools.php b/include/admin/Addon/Tools.php new file mode 100644 index 0000000..8db9ea6 --- /dev/null +++ b/include/admin/Addon/Tools.php @@ -0,0 +1,775 @@ +page ){ + $this->page->head_js[] = '/include/js/rate.js'; + } + + //clear the data file ... + $this->GetAddonData(); + } + + + + /** + * Get addon history and review data + * + */ + public function GetAddonData(){ + global $dataDir; + + $this->dataFile = $dataDir.'/data/_site/addonData.php'; + $addonData = \gp\tool\Files::Get('_site/addonData'); + + if( $addonData ){ + $this->addonHistory = $addonData['history']; + $this->addonReviews = $addonData['reviews']; + } + + } + + + + public function SaveAddonData(){ + + if( !isset($this->dataFile) ){ + trigger_error('dataFile not set'); + return; + } + + $addonData = array(); + + while( count($this->addonHistory) > 30 ){ + array_shift($this->addonHistory); + } + + $addonData['history'] = $this->addonHistory; + $addonData['reviews'] = $this->addonReviews; + return \gp\tool\Files::SaveData($this->dataFile, 'addonData', $addonData); + } + + + + /** + * Display clickable rating stars + * $arg is the addon id for plugins, folder for themes + * + */ + public function ShowRating($arg,$rating){ + + ob_start(); + echo ' '; + + return ob_get_clean(); + } + + + + /** + * Return ini info if the addon is installable + * + * @return false|array + */ + public function GetAvailInstall($dir){ + global $langmessage; + + $iniFile = $dir . '/Addon.ini'; + $dirname = basename($dir); + + if( !file_exists($iniFile) ){ + + if( is_readable($dir) ){ + $this->invalid_folders[$dirname] = 'Addon.ini is not readable or does not exist'; + }else{ + $this->invalid_folders[$dirname] = 'Directory is not readable'; + } + + return false; + } + + $array = \gp\tool\Ini::ParseFile($iniFile); + if( $array === false ){ + $this->invalid_folders[$dirname] = $langmessage['Ini_Error']; + return false; + } + + if( !isset($array['Addon_Name']) ){ + $this->invalid_folders[$dirname] = $langmessage['Ini_No_Name']; + return false; + } + + $array += array('Addon_Version' => ''); + return $array; + } + + + + /** + * Manage addon ratings + * + */ + public function AdminAddonRating(){ + + $cmd = \gp\tool::GetCommand(); + switch($cmd){ + case 'SendAddonReview'; + if( $this->SendAddonReview() ){ + return; + } + } + + $this->ReviewAddonForm(); + } + + + + public function ReviewAddonForm(){ + global $config, $dirPrefix, $langmessage; + + if( !$this->CanRate() ){ + return; + } + + $this->page->head_js[] = '/include/js/rate.js'; + + //get appropriate variables + $id = $this->addon_info['id']; + + if( isset($_REQUEST['rating']) ){ + $rating = $_REQUEST['rating']; + }elseif( isset($this->addonReviews[$id]) ){ + $rating = $this->addonReviews[$id]['rating']; + }else{ + $rating = 5; + } + + if( isset($_REQUEST['review']) ){ + $review = $_REQUEST['review']; + }elseif( isset($this->addonReviews[$id]) ){ + $review = $this->addonReviews[$id]['review']; + }else{ + $review = ''; + } + + echo ''; + echo ''; + echo $langmessage['see_also']; + echo ' '; + echo \gp\tool::Link('Admin/Preferences',$langmessage['Preferences'],'','data-cmd="gpabox"'); + echo '
'; + + } + + + /** + * Display Save All buttons + * @param boolean $is_last If true include admin notice and hidden cmd input + */ + protected function SaveAllButton($is_last=true){ + global $langmessage; + + echo ''; + echo ''; + echo $langmessage['see_also']; + echo ' '; + echo \gp\tool::Link('Admin/Preferences',$langmessage['Preferences'],'','data-cmd="gpabox"'); + echo '
'; + } + + } + + + + /** + * Form Functions + * + */ + + public function formCheckbox($key,$value){ + $checked = ''; + if( $value && $value !== 'false' ){ + $checked = ' checked="checked"'; + } + echo ' '; + echo ' '; + } + + public function formInput($name,$value,$type='text'){ + echo "\n'; + echo $langmessage['file_name']; + echo ' | '; + echo $langmessage['Content Type']; + echo ' | '; + echo $langmessage['options']; + echo ' |
---|
'; + echo '
'; + echo ''; + } + + + public function EditExtra(){ + global $langmessage, $page; + + + $action = \gp\tool::GetUrl('Admin/Extra/' . rawurlencode($this->title), 'cmd=EditExtra'); + $page->head_js[] = '/include/js/admin/extra_edit.js'; + + echo ''; + echo $langmessage['DRAG-N-DROP-DESC2']; + echo '
'; + + $this->EditableArea(); + + } + + + + public function EditableArea(){ + global $gp_titles, $gp_index, $langmessage; + + + echo '';
+ echo ''.$langmessage['visible_galleries'].''; + echo ' | ';
+ echo ''.$langmessage['hidden_galleries'].''; + echo ' |
';
+ echo ' ';
+
+ foreach($this->galleries as $title => $info ){
+
+ if( !$this->GalleryVisible($title,$info) ){
+ continue;
+ }
+
+ $this->GalleryEditBox( $title, $info );
+ }
+
+
+ echo ' ';
+ echo ' | ';
+
+
+ echo ' ';
+ if( count($this->not_visible) > 0 ){
+ foreach($this->not_visible as $title => $info){
+ $this->GalleryEditBox( $title, $info );
+ }
+ }
+
+
+ echo ' ';
+
+ echo ' |
' . $langmessage['Modified'] . ' | '; + echo '' . $langmessage['File Size'] . ' | '; + echo '' . $langmessage['username'] . ' | '; + echo '' . $langmessage['options'] . ' | '; + echo '
---|
' . $langmessage['history_limit'] . ': ' . $config['history_limit'] . '
'; + } + + + + /** + * Return content for history row + * + */ + protected function HistoryRow($time, $size, $username, $which='history'){ + global $langmessage; + static $i = 1; + + ob_start(); + $date = \gp\tool::date($langmessage['strftime_datetime'], $time); + echo 'This page no longer has any content
'; + } + } + +} + diff --git a/include/admin/Content/Uploaded.php b/include/admin/Content/Uploaded.php new file mode 100644 index 0000000..279fe42 --- /dev/null +++ b/include/admin/Content/Uploaded.php @@ -0,0 +1,1064 @@ +do_admin_uploaded($file_cmd); + }else{ + $this->Finder(); + } + } + + public function Finder(){ + global $config, $dataDir; + + $this->page->head .= "\n".''; + $this->page->css_admin[] = '/include/css/admin_finder.scss'; + + echo ''; + + \gp\tool::LoadComponents('selectable,draggable,droppable,resizable,dialog,slider,button'); + + + //get the finder language + $language = $config['langeditor']; + if( $language == 'inherit' ){ + $language = $config['language']; + } + $lang_file = '/include/thirdparty/elFinder/js/i18n/elfinder.'.$language.'.js'; + $lang_full = $dataDir.$lang_file; + if( file_exists($lang_full) ){ + // elFinder 2.3.2 will liad the lang file via require.js + // $this->page->head .= "\n".''; + }else{ + $language = 'en'; + } + $this->finder_opts['lang'] = $language; + $this->finder_opts['customData']['verified'] = \gp\tool\Nonce::Create('post',true); + + + $this->finder_opts['uiOptions'] = array( + + // toolbar configuration + 'toolbar' => array( + array('back', 'forward','up','reload'), + array('home','netmount'), + array('mkdir', 'upload'), //'mkfile', + array('open', 'download', 'getfile'), + array('info'), + array('quicklook'), + array('copy', 'cut', 'paste'), + array('rm'), + array('duplicate', 'rename', 'edit', 'resize'), + array('extract', 'archive'), + array('search'), + array('view','sort'), + array('help') + ), + + // directories tree options + 'tree' => array( + // expand current root on init + 'openRootOnLoad' => true, + // auto load current dir parents + 'syncTree' => true, + ), + + // navbar options + 'navbar' => array( + 'minWidth' => 150, + 'maxWidth' => 500 + ), + + // current working directory options + 'cwd' => array( + // display parent directory in listing as ".." + 'oldSchool' => false + ) + ); + + + $this->FinderPrep(); + + $this->finder_opts = \gp\tool\Plugins::Filter('FinderOptionsClient',array($this->finder_opts)); + gpSettingsOverride('finder_options_client',$this->finder_opts); + + $this->page->head_script .= "\n".'var finder_opts = '.json_encode($this->finder_opts).';'; + } + + public function FinderPrep(){ + $this->finder_opts['url'] = \gp\tool::GetUrl('Admin_Finder'); + $this->finder_opts['height'] = '100%'; + $this->finder_opts['resizable'] = false; + } + + + public function do_admin_uploaded($file_cmd){ + + $this->Init(); + $this->page->ajaxReplace = array(); + + switch($file_cmd){ + case 'delete': + $this->DeleteConfirmed(); + return; + + case 'inline_upload': + $this->InlineUpload(); + //dies + } + } + + public function Init(){ + global $langmessage, $dataDir; + + $this->baseDir = $dataDir.'/data/_uploaded'; + $this->thumbFolder = $dataDir.'/data/_uploaded/image/thumbnails'; + $this->currentDir = $this->baseDir; + $this->page->label = $langmessage['uploaded_files']; + + $this->imgTypes = array('bmp'=>1,'png'=>1,'jpg'=>1,'jpeg'=>1,'gif'=>1,'tiff'=>1,'tif'=>1,'svg'=>1); + + $this->SetDirectory(); + + //prompt to create the requested subdirectory + if( !file_exists($this->currentDir) ){ + \gp\tool\Files::CheckDir($this->currentDir); + } + + + //is in thumbnail directory? + if( strpos($this->currentDir,$this->thumbFolder) !== false ){ + $this->isThumbDir = true; + } + $this->currentDir_Thumb = $this->thumbFolder.$this->subdir; + + } + + /** + * Set the upload directory + * + */ + public function SetDirectory(){ + + $subdir = ''; + $path = \gp\tool::WhichPage(); // get the current path, not using $page->requested since space characters will have been changed to underscores + $path = str_replace('\\','/',$path); + + //@since 5.0 + if( strpos($path,'Admin/Uploaded') === 0 ){ + $path = substr($path,14); + $path = trim($path,'/'); + $parts = explode('/',$path); + + + //backwards compat + }else{ + $path = trim($path,'/'); + $parts = explode('/',$path); + array_shift($parts); + } + + if( count($parts) > 0 ){ + $subdir = '/'.implode('/',$parts); + $subdir = \gp\tool\Editing::CleanArg($subdir); + } + + + if( !empty($_REQUEST['dir']) ){ + $subdir .= \gp\tool\Editing::CleanArg($_REQUEST['dir']); + } + + $subdir = \gp\tool\Files::Canonicalize($subdir); + $subdir = rtrim($subdir,'/'); + $current_dir = $this->currentDir . $subdir; + + if( !\gp\tool\Files::CheckPath( $current_dir, $this->currentDir ) ){ + return; + } + + $this->subdir = $subdir; + $this->currentDir = $current_dir; + } + + + public function ReadableMax(){ + $value = ini_get('upload_max_filesize'); + + if( empty($value) ){ + return '2 Megabytes';//php default + } + return $value; + } + + + public static function Max_File_Size(){ + $value = ini_get('upload_max_filesize'); + if( empty($value) ){ + return; + } + $max = \gp\tool::getByteValue($value); + if( $max !== false ){ + echo ''; + } + } + + + /** + * Upload one image + * + */ + public function InlineUpload(){ + + if( count($_FILES['userfiles']['name']) != 1 ){ + $this->InlineResponse('failed','Empty Array'); + } + + $name = $_FILES['userfiles']['name'][0]; + if( empty($name) ){ + $this->InlineResponse('failed','Empty Name'); + } + + $uploaded = $this->UploadFile(0); + if( $uploaded === false ){ + reset($this->errorMessages); + $this->InlineResponse('failed',current($this->errorMessages)); + } + \gp\tool\Plugins::Action('FileUploaded',$uploaded); + + $return_content = self::ShowFile_Gallery($this->subdir,$uploaded); + + if( is_string($return_content) ){ + $this->InlineResponse('success',$return_content); + }else{ + $this->InlineResponse('notimage',''); + } + + } + + /** + * Output a list a images in a director for use in inline editing + * @static + */ + public static function InlineList($dir_piece){ + global $langmessage, $dataDir, $page; + + $page->ajaxReplace = array(); + + + $dir_piece = \gp\tool::WinPath($dir_piece); + $dir = $dataDir.'/data/_uploaded'.$dir_piece; + + $prev_piece = false; + + while( ($dir_piece != '/') && !file_exists($dir) ){ + $prev_piece = $dir_piece; + $dir = \gp\tool::DirName($dir); + $dir_piece = \gp\tool::DirName($dir_piece); + } + + //new directory? + if( $prev_piece ){ + $prev_piece = \gp\tool\Editing::CleanArg($prev_piece); + $dir_piece = $prev_piece; + $dir = $dataDir.'/data/_uploaded'.$prev_piece; + + if( !\gp\tool\Files::CheckDir($dir) ){ + msg($langmessage['OOPS']); + $dir = \gp\tool::DirName($dir); + $dir_piece = \gp\tool::DirName($prev_piece); + } + } + + + //folder information + $folders = $files = array(); + $allFiles = \gp\tool\Files::ReadFolderAndFiles($dir); + list($folders,$files) = $allFiles; + + //available images + ob_start(); + $image_count = 0; + foreach($files as $file){ + $img = self::ShowFile_Gallery($dir_piece,$file); + if( is_string($img) ){ + echo $img; + $image_count++; + } + } + $gp_gallery_avail_imgs = ob_get_clean(); + + + $gp_option_area = self::InlineList_Options($dir_piece, $folders); + $folder_options = self::InlineList_Folder($image_count, $dir_piece); + + + + //send content according to request + $cmd = \gp\tool::GetCommand(); + switch($cmd){ + case 'gallery_folder': + $page->ajaxReplace[] = array('inner','#gp_option_area',$gp_option_area); + $page->ajaxReplace[] = array('inner','#gp_gallery_avail_imgs',$gp_gallery_avail_imgs); + break; + default: + $content = ''; + echo $langmessage['see_also'] . ' '; + echo \gp\tool::Link('Admin/Menu', $langmessage['file_manager']); + echo '
'; + + $this->ColorSelector(); + } + + + /** + * Display a list of all the titles using the current layout + * + */ + public function ShowTitles(){ + global $langmessage; + + //affected titles + $titles_count = $this->TitlesCount($this->curr_layout); + + echo ''; + echo $langmessage['Empty']; + echo ' | |
'; + echo str_replace('_', ' ', $gadget); + echo ' | '; + if( isset($gadget_info[$gadget]) ){ + echo $this->LayoutLink( + $this->curr_layout, + $langmessage['remove'], + 'cmd=RmGadget&gadget=' . urlencode($gadget), + ['data-cmd' => 'gpabox'] + ); + }else{ + echo $langmessage['disabled']; + } + echo ' |
Paragraph (larger): Lorem ipsum dolor sit amet, consectetur adipisicing elit, '; + echo 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '; + echo 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
'; + + echo 'Paragraph: Excepteur sint emphasize cupidatat non strong proident, sunt in ';
+ echo 'emphasized strong culpa qui officia anchor ';
+ echo 'deserunt underline mollit anim id est laborum. Duis aute irure dolor in reprehenderit in voluptate ';
+ echo 'velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ';
+ echo 'abbr officia deserunt mollit mark anim id est code
laborum.
Blockquote: Lorem ipsum dolor sit amet, consectetur adipisicing elit.'; + + echo '
Paragraph (smaller): Excepteur sint cupidatat non proident, sunt in '; + echo 'culpa qui officia deserunt mollit anim id est laborum. Duis aute irure dolor in reprehenderit '; + echo 'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat '; + echo 'non proident.
'; + echo 'Unstyled Table - Heading | '; + echo '||
---|---|---|
Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |
Row 3, Cell 1 | Row 3, Cell 2 | Row 3, Cell 3 |
Row 4, Cell 1 | Row 4, Cell 2 | Row 4, Cell 3 |
Row 5, Cell 1 | Row 5, Cell 2 | Row 5, Cell 3 |
Lead: Lorem ipsum dolor sit amet, consectetur adipisicing elit, '; + echo 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. '; + echo 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
'; + + echo 'Default paragraph: Excepteur sint emphasize cupidatat non strong proident, sunt in ';
+ echo 'emphasized strong culpa qui officia anchor ';
+ echo 'deserunt underline mollit anim id est laborum. Duis aute irure dolor in reprehenderit in voluptate ';
+ echo 'velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint kbd occaecat cupidatat non proident, sunt in culpa qui ';
+ echo 'abbr officia deserunt mollit mark anim id est code
laborum.
'; + echo 'text-muted '; + echo 'text-primary '; + echo 'text-secondary '; + echo 'text-success '; + echo 'text-info '; + echo 'text-warning '; + echo 'text-danger '; + echo 'badge'; + // echo ' label label-default'; + echo '
'; + + echo 'Blockquote: Lorem ipsum dolor sit amet, consectetur adipisicing elit.'; + + echo '
Small text paragraph: Excepteur sint cupidatat non proident, sunt in '; + echo 'culpa qui officia deserunt mollit anim id est laborum. Duis aute irure dolor in reprehenderit '; + echo 'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat '; + echo 'non proident. '; + echo '
'; + echo ''; + echo 'btn-primary '; + echo 'btn-secondary '; + echo 'btn-success'; + echo '
'; + echo ''; + echo ''; + echo 'btn-info '; + echo 'btn-warning '; + echo 'btn-danger'; + echo '
'; + echo ''; + echo ''; + echo 'btn-default '; + echo 'btn-link'; + echo '
'; + echo 'Table Heading | '; + echo ''; + echo ''; + echo '<table class="table table-bordered table-striped table-hover">'; + echo ''; + echo ' | '; + echo '|
---|---|---|
Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |
Row 3, Cell 1 | Row 3, Cell 2 | Row 3, Cell 3 |
Row 4, Cell 1 | Row 4, Cell 2 | Row 4, Cell 3 |
Row 5, Cell 1 | Row 5, Cell 2 | Row 5, Cell 3 |
Row 6, Cell 1 | Row 6, Cell 2 | Row 6, Cell 3 |
Row 7, Cell 1 | Row 7, Cell 2 | Row 7, Cell 3 |
'; + if( ($this->config['commenter_website'] == 'nofollow') && !empty($comment['website']) ){ + echo ''.$comment['name'].''; + }elseif( ($this->config['commenter_website'] == 'link') && !empty($comment['website']) ){ + echo ''.$comment['name'].''; + }else{ + echo ''.$comment['name'].''; + } + echo ' '; + echo ''; + echo date($this->config['date_format'],$comment['time']); + echo ''; + + + if( \gp\tool::LoggedIn() ){ + echo ' '; + echo \gp\tool::Link('Admin_Recent_Comments',$langmessage['delete'],'cmd=easy_comment_rm&i='.$key.'&pg='.$this->current_index,' data-cmd="gpajax"'); + } + + + echo '
'; + echo ''; + echo $comment['comment']; + echo '
'; + echo '