Re: editPage plugin experiment
Nice https://github.com/nakome/Panel/blob/ma … age/gr.php
You are not logged in. Please login or register.
Nice https://github.com/nakome/Panel/blob/ma … age/gr.php
brother in line 16 gr.php be the change from
'New Image' => 'Νέα εικόναe',
change in
'New Image' => 'Νέα εικόνα',
Hi nakome
for me does not work on my server!
what could be wrong;
while works in localhost without any problems!
Php version ? I have 5.3
Php version ? I have 5.3
my php version 5.3
I fix the problem please update and try https://github.com/nakome/Panel
The problem was
$_SERVER['REQUEST_URI']
I have changed for this
trim(Morfy::factory()->getUrl(), '/')
And i fix css also.
Note: In folder images remeber create folder public/images and cmod 755
yes now it works!
a quick question: how do I add two new categories;
example blog, test1, test2
I make only for pages and blog but you can add more code, the problem is make for example new file in portfolio folder, you can edit or update but you can't make new file in new page section you need add in link like this:
http://localhost:8080/morfy/panel?updateFile=portfolio/the-name-of-file
And now you can edit or update the file.
If not understand i make a video ok.
This is a example of portfolio folder:
Go to file plugins/panel/panel.php and for example in 277 in empty line paste this code
Morfy::factory()->addAction('getPortfolioPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'portfolio'; // This is the name of folder // show folder files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = 'Portfolio:
'; // this is the title foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); $html .= ''; } } $html .= ''; echo $html; });
Now go to line 144 and add this
Morfy::factory()->runAction('getPortfolioPages');
This is the complete code
addAction('theme_header', function () { $editor_styles = ' '; // only load in panel if(trim(Morfy::factory()->getUrl(), '/') == 'panel') { echo $editor_styles; }; }); Morfy::factory()->addAction('theme_content_after', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); if(trim(Morfy::factory()->getUrl(), '/') == 'panel') { Morfy::factory()->runAction('panel'); // use default if empty in config.php $password = Panel::Config(Morfy::$config['password'],'demo'); $secret_key1 = Panel::Config(Morfy::$config['secret_key_1'],'secret_key1'); $secret_key2 = Panel::Config(Morfy::$config['secret_key_2'],'secret_key2'); $hash = md5($secret_key1.$password.$secret_key2); // get actions if (Panel::Request_Get('action')) { $action = Panel::Request_Get('action'); // swich switch ($action) { case 'login': // isset if ((Panel::Request_Post('password')) && (Panel::Request_Post('token')) && (Panel::Request_Post('password') === $password)) { $_SESSION['login'] = $hash; Panel::Cookie_set('login',10); Panel::isLogin(); // redirect if true Panel::Notification('success','Success',$lang['Hello Admin'],Panel::Root('panel')); }else{ Panel::Notification('error','Error',$lang['You need provide a password'],Panel::Root('panel')); } break; case 'logout': Panel::Cookie_delete('login'); Panel::isLogout(); Panel::redirect(Panel::Root()); break; } } // Delete images function Morfy::factory()->runAction('deleteImages'); } }); // Call plugin with echo Morfy::factory()->runAction('files'); Morfy::factory()->addAction('files', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // edit File ?editFile= file if (Panel::Request_Get('editFile')) { // get file $file = Panel::getContent(CONTENT_PATH.'/'.$_GET['editFile'].'.md'); $filename = Panel::Request_Get('editFile'); require_once('library/includes/update.php'); }else if (Panel::Request_Get('deleteFile')) { // get delete file $file = CONTENT_PATH.'/'.Panel::Request_Get('deleteFile').'.md'; if (!empty($file) || (!Panel::Request_Post('token'))) { unlink($file); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.Panel::Request_Get('deleteFile').' '.$lang['has been deleted'],Panel::Root('panel')); } }else if (Panel::Request_Get('saveFile')) { // get content if(Panel::Request_Post('filename')) $filename = Panel::Request_Post('filename'); else $filename = ''; if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; if(Panel::Request_Post('isBlog')){ // save Panel::setContent(CONTENT_PATH.'/blog/'.Panel::seoLink($filename).'.md',$content); }else{ // save Panel::setContent(CONTENT_PATH.'/'.Panel::seoLink($filename).'.md',$content); } // show Notification Panel::Notification('success','Success',$lang['The File'].' '.$filename.' '.$lang['has been save'],Panel::Root('panel')); }else if (Panel::Request_Get('updateFile')) { // name of file $filename = Panel::Request_Get('updateFile'); // get content if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; // save Panel::setContent(CONTENT_PATH.'/'.$filename.'.md',$content); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.$filename.' '.$lang['has been save'],Panel::Root('panel')); }else{ Morfy::factory()->runAction('getPages'); Morfy::factory()->runAction('getBlogPages'); Morfy::factory()->runAction('getPortfolioPages'); } }); // Call plugin with echo Morfy::factory()->runAction('getPages'); Morfy::factory()->addAction('getPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // content folder $content_path_dir = CONTENT_PATH; // show pages $files = Panel::File_scan($content_path_dir); $html = ''.$lang['Pages'].':
'; foreach ($files as $file) { if(is_file($content_path_dir.'/'.$file)){ // get only name $filename = str_replace('.md','',$file); if($filename != 'panel' && $filename != 'blog'){ $html .= ''; } } } $html .= ''; echo $html; }); // Call plugin with echo Morfy::factory()->runAction('getBlogPages'); Morfy::factory()->addAction('getBlogPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'blog'; // name of new folder here // show blog files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = ''.$lang['Blog'].':
'; foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); // not show index if($folder_filename != 'index'){ $html .= ''; } } } $html .= ''; echo $html; }); // Call plugin with echo Morfy::factory()->runAction('getPortfolioPages'); Morfy::factory()->addAction('getPortfolioPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'portfolio'; // This is the name of folder // show folder files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = 'Portfolio:
'; // this is the title foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); $html .= ''; } } $html .= ''; echo $html; }); // Call plugin with Morfy::factory()->runAction('deleteImages'); Morfy::factory()->addAction('deleteImages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // delete image file if(Panel::Request_Get('deleteImage')){ // Remove full an tumb image unlink('public/images/full/'.Panel::Request_Get('deleteImage')); unlink('public/images/tumb/'.Panel::Request_Get('deleteImage')); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.Panel::Request_Get('deleteImage').' '.$lang['has been deleted'],Panel::Root('panel?get=images')); } }); // Call plugin with echo Morfy::factory()->runAction('add'); Morfy::factory()->addAction('add', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require_once('library/add.php'); }); // Call plugin with echo Morfy::factory()->runAction('auth'); Morfy::factory()->addAction('auth', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/login.php'); }); // Call plugin with echo Morfy::factory()->runAction('panel'); Morfy::factory()->addAction('panel', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/panel.php'); }); // Call plugin with echo Morfy::factory()->runAction('content'); Morfy::factory()->addAction('content', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/content.php'); }); ?>
I make only for pages and blog but you can add more code, the problem is make for example new file in portfolio folder, you can edit or update but you can't make new file in new page section you need add in link like this:
http://localhost:8080/morfy/panel?updateFile=portfolio/the-name-of-file
And now you can edit or update the file.
If not understand i make a video ok.
This is a example of portfolio folder:
Go to file plugins/panel/panel.php and for example in 277 in empty line paste this code
Morfy::factory()->addAction('getPortfolioPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'portfolio'; // This is the name of folder // show folder files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = 'Portfolio:
'; // this is the title foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); $html .= ''; } } $html .= ''; echo $html; });
Now go to line 144 and add this
Morfy::factory()->runAction('getPortfolioPages');
This is the complete code
addAction('theme_header', function () { $editor_styles = ' '; // only load in panel if(trim(Morfy::factory()->getUrl(), '/') == 'panel') { echo $editor_styles; }; }); Morfy::factory()->addAction('theme_content_after', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); if(trim(Morfy::factory()->getUrl(), '/') == 'panel') { Morfy::factory()->runAction('panel'); // use default if empty in config.php $password = Panel::Config(Morfy::$config['password'],'demo'); $secret_key1 = Panel::Config(Morfy::$config['secret_key_1'],'secret_key1'); $secret_key2 = Panel::Config(Morfy::$config['secret_key_2'],'secret_key2'); $hash = md5($secret_key1.$password.$secret_key2); // get actions if (Panel::Request_Get('action')) { $action = Panel::Request_Get('action'); // swich switch ($action) { case 'login': // isset if ((Panel::Request_Post('password')) && (Panel::Request_Post('token')) && (Panel::Request_Post('password') === $password)) { $_SESSION['login'] = $hash; Panel::Cookie_set('login',10); Panel::isLogin(); // redirect if true Panel::Notification('success','Success',$lang['Hello Admin'],Panel::Root('panel')); }else{ Panel::Notification('error','Error',$lang['You need provide a password'],Panel::Root('panel')); } break; case 'logout': Panel::Cookie_delete('login'); Panel::isLogout(); Panel::redirect(Panel::Root()); break; } } // Delete images function Morfy::factory()->runAction('deleteImages'); } }); // Call plugin with echo Morfy::factory()->runAction('files'); Morfy::factory()->addAction('files', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // edit File ?editFile= file if (Panel::Request_Get('editFile')) { // get file $file = Panel::getContent(CONTENT_PATH.'/'.$_GET['editFile'].'.md'); $filename = Panel::Request_Get('editFile'); require_once('library/includes/update.php'); }else if (Panel::Request_Get('deleteFile')) { // get delete file $file = CONTENT_PATH.'/'.Panel::Request_Get('deleteFile').'.md'; if (!empty($file) || (!Panel::Request_Post('token'))) { unlink($file); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.Panel::Request_Get('deleteFile').' '.$lang['has been deleted'],Panel::Root('panel')); } }else if (Panel::Request_Get('saveFile')) { // get content if(Panel::Request_Post('filename')) $filename = Panel::Request_Post('filename'); else $filename = ''; if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; if(Panel::Request_Post('isBlog')){ // save Panel::setContent(CONTENT_PATH.'/blog/'.Panel::seoLink($filename).'.md',$content); }else{ // save Panel::setContent(CONTENT_PATH.'/'.Panel::seoLink($filename).'.md',$content); } // show Notification Panel::Notification('success','Success',$lang['The File'].' '.$filename.' '.$lang['has been save'],Panel::Root('panel')); }else if (Panel::Request_Get('updateFile')) { // name of file $filename = Panel::Request_Get('updateFile'); // get content if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; // save Panel::setContent(CONTENT_PATH.'/'.$filename.'.md',$content); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.$filename.' '.$lang['has been save'],Panel::Root('panel')); }else{ Morfy::factory()->runAction('getPages'); Morfy::factory()->runAction('getBlogPages'); Morfy::factory()->runAction('getPortfolioPages'); } }); // Call plugin with echo Morfy::factory()->runAction('getPages'); Morfy::factory()->addAction('getPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // content folder $content_path_dir = CONTENT_PATH; // show pages $files = Panel::File_scan($content_path_dir); $html = ''.$lang['Pages'].':
'; foreach ($files as $file) { if(is_file($content_path_dir.'/'.$file)){ // get only name $filename = str_replace('.md','',$file); if($filename != 'panel' && $filename != 'blog'){ $html .= ''; } } } $html .= ''; echo $html; }); // Call plugin with echo Morfy::factory()->runAction('getBlogPages'); Morfy::factory()->addAction('getBlogPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'blog'; // name of new folder here // show blog files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = ''.$lang['Blog'].':
'; foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); // not show index if($folder_filename != 'index'){ $html .= ''; } } } $html .= ''; echo $html; }); // Call plugin with echo Morfy::factory()->runAction('getPortfolioPages'); Morfy::factory()->addAction('getPortfolioPages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); $folder = 'portfolio'; // This is the name of folder // show folder files $folder_path_dir = CONTENT_PATH.'/'.$folder; $folder_files = Panel::File_scan($folder_path_dir); $html = 'Portfolio:
'; // this is the title foreach ($folder_files as $folder_file) { if(is_file($folder_path_dir.'/'.$folder_file)){ // get blog pages $folder_filename = str_replace('.md','',$folder_file); $html .= ''; } } $html .= ''; echo $html; }); // Call plugin with Morfy::factory()->runAction('deleteImages'); Morfy::factory()->addAction('deleteImages', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); // delete image file if(Panel::Request_Get('deleteImage')){ // Remove full an tumb image unlink('public/images/full/'.Panel::Request_Get('deleteImage')); unlink('public/images/tumb/'.Panel::Request_Get('deleteImage')); // show Notification Panel::Notification('success','Success',$lang['The File'].' '.Panel::Request_Get('deleteImage').' '.$lang['has been deleted'],Panel::Root('panel?get=images')); } }); // Call plugin with echo Morfy::factory()->runAction('add'); Morfy::factory()->addAction('add', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require_once('library/add.php'); }); // Call plugin with echo Morfy::factory()->runAction('auth'); Morfy::factory()->addAction('auth', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/login.php'); }); // Call plugin with echo Morfy::factory()->runAction('panel'); Morfy::factory()->addAction('panel', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/panel.php'); }); // Call plugin with echo Morfy::factory()->runAction('content'); Morfy::factory()->addAction('content', function () { // require language require('library/language/'.Panel::Config(Morfy::$config['Panel_lang'],'es').'.php'); require('library/content.php'); }); ?>
plugins/panel/library/includes/add.php
I think something is not right
how to save a porfolio?
Yes but you need more code and if need other folder this is the problem
Yes but you need more code and if need other folder this is the problem
can you tell me what more code;
Ok go to plugins/panel/panel.php and update the code like this ( in line 122 ).
Before:
if(Panel::Request_Post('filename')) $filename = Panel::Request_Post('filename'); else $filename = ''; if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; if(Panel::Request_Post('isBlog')){ // save Panel::setContent(CONTENT_PATH.'/blog/'.Panel::seoLink($filename).'.md',$content); }else{ // save Panel::setContent(CONTENT_PATH.'/'.Panel::seoLink($filename).'.md',$content); }
After:
if(Panel::Request_Post('filename')) $filename = Panel::Request_Post('filename'); else $filename = ''; if(Panel::Request_Post('content')) $content = Panel::Request_Post('content'); else $content = ''; if(Panel::Request_Post('isBlog')){ // save Panel::setContent(CONTENT_PATH.'/blog/'.Panel::seoLink($filename).'.md',$content); // --------------------- Start new code // For Form name isPortfolio }else if(Panel::Request_Post('isPortfolio')){ $folder = 'portfolio'; // folder name // save in folder portfolio Panel::setContent(CONTENT_PATH.'/'.$folder.'/'.Panel::seoLink($filename).'.md',$content); // --------------------- End of new code }else{ // save Panel::setContent(CONTENT_PATH.'/'.Panel::seoLink($filename).'.md',$content); }
If you checked blog and porfolio this save only in blog.
Go to plugins/panel/includes/add.php and clone checkbox with name isPortfolio like this:
There are some errors in the code
panel.php bad success
look video here https://dl.dropboxusercontent.com/u/834 … uccess.mp4
plugins/panel/library/panel.php line 7
change in
tnx nakome!!!!
I try to look at the code to learn
Yes i update code in gitHub but not show
Take this with option select for select folders in new page.
Plugin
Preview mp4
good
look here https://github.com/nakome/Panel/pulls
Update Github Demo
password change from panel settings
plugins\panel\library\includes\settings.php
'http://localhost/morfy', 'site_charset' => 'UTF-8', 'site_timezone' => 'Kwajalein', 'site_theme' => 'default', 'site_title' => 'demo', 'site_description' => '', 'site_keywords' => '', 'email' => 'test@gmail.com', 'Panel_lang' => 'en', // language see library/language 'password' => '{$post_password}', 'secret_key_1' => '12sdf3321a321asdfas', // secret key for md5 'secret_key_2' => '4561dsf232gdfd1asdf3', // secret key for md5 'Panel_Images' => 'full', // name of full image folder 'Panel_Thumbnails' => 'tumb', // name of tumb images 'plugins' => array( 'markdown', 'sitemap', 'panel' ), ); "); } ?>
Video here
my problem is that I want to change only the password only
how to accomplish this;
I think make a unique config file for admin panel
Xm...
we can do something about it;
This is the idea:
panel/library/config.json
{ "Panel_lang": "en", "Password": "demo", "Secret_key_1": "12sdf3321a321asdfas", "Secret_key_2": "4561dsf232gdfd1asdf3", "Panel_Images": "full", "Panel_Thumbnails": "tumb" }
panel/library/includes/settings.php file
Panel::Request_post('Panel_lang'), "Password" => Panel::Request_post('Password'), "Secret_key_1" => Panel::Request_post('Secret_key_1'), "Secret_key_2" => Panel::Request_post('Secret_key_2'), "Panel_Images" => Panel::Request_post('Panel_Images'), "Panel_Thumbnails" => Panel::Request_post('Panel_Thumbnails') ); Panel::setContent('../../../../../../topic/526/editpage-plugin-experiment/page/2/plugins/panel/library/forum_subdomain/config.js',json_encode($result)); Panel::Notification('success','Success','Save config file',Panel::Root('panel?get=settings')); } ?>
bro something is wrong!
I put password 123456 and I have access to the panel
password demo while I normally access
look video https://www.dropbox.com/s/rkh6ujs2difj6 … 5.MP4?dl=0
This is only a idea i need change all config data first, you can try this link