Revision 80
Added by ryan about 20 years ago
| trunk/wb/modules/code/save.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
require('../../config.php');
|
|
| 27 |
|
|
| 28 |
// Include WB admin wrapper script |
|
| 29 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
| 30 |
require(WB_PATH.'/modules/admin.php'); |
|
| 31 |
|
|
| 32 |
// Update the mod_wysiwygs table with the contents |
|
| 33 |
if(isset($_POST['content'])) {
|
|
| 34 |
$tags = array('<?php', '?>' , '<?');
|
|
| 35 |
$content = $admin->add_slashes(str_replace($tags, '', $_POST['content'])); |
|
| 36 |
$database = new database(); |
|
| 37 |
$query = "UPDATE ".TABLE_PREFIX."mod_code SET content = '$content' WHERE section_id = '$section_id'"; |
|
| 38 |
$database->query($query); |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
// Check if there is a database error, otherwise say successful |
|
| 42 |
if($database->is_error()) {
|
|
| 43 |
$admin->print_error($database->get_error(), $js_back); |
|
| 44 |
} else {
|
|
| 45 |
$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
| 46 |
} |
|
| 47 |
|
|
| 48 |
// Print admin footer |
|
| 49 |
$admin->print_footer(); |
|
| 50 |
|
|
| 51 |
?> |
|
| 52 | 0 | |
| trunk/wb/modules/code/install.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: install.php,v 1.2 2005/04/02 08:21:46 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
if(defined('WB_URL')) {
|
|
| 27 |
|
|
| 28 |
// Create table |
|
| 29 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_code`");
|
|
| 30 |
$mod_code = 'CREATE TABLE `'.TABLE_PREFIX.'mod_code` ('
|
|
| 31 |
. ' `section_id` INT NOT NULL,' |
|
| 32 |
. ' `page_id` INT NOT NULL,' |
|
| 33 |
. ' `content` TEXT NOT NULL ,' |
|
| 34 |
. ' PRIMARY KEY ( `section_id` ) )' |
|
| 35 |
. ' '; |
|
| 36 |
$database->query($mod_code); |
|
| 37 |
|
|
| 38 |
// Insert info into the search table |
|
| 39 |
// Module query info |
|
| 40 |
$field_info = array(); |
|
| 41 |
$field_info['page_id'] = 'page_id'; |
|
| 42 |
$field_info['title'] = 'page_title'; |
|
| 43 |
$field_info['link'] = 'link'; |
|
| 44 |
$field_info['description'] = 'description'; |
|
| 45 |
$field_info['modified_when'] = 'modified_when'; |
|
| 46 |
$field_info['modified_by'] = 'modified_by'; |
|
| 47 |
$field_info = serialize($field_info); |
|
| 48 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'code', '$field_info')");
|
|
| 49 |
// Query start |
|
| 50 |
$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_code, [TP]pages WHERE "; |
|
| 51 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'code')");
|
|
| 52 |
// Query body |
|
| 53 |
$query_body_code = " [TP]pages.page_id = [TP]mod_code.page_id AND [TP]mod_code.content [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'"; |
|
| 54 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'code')");
|
|
| 55 |
// Query end |
|
| 56 |
$query_end_code = ""; |
|
| 57 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'code')");
|
|
| 58 |
|
|
| 59 |
// Insert blank row (there needs to be at least on row for the search to work) |
|
| 60 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('0','0')");
|
|
| 61 |
|
|
| 62 |
} |
|
| 63 |
|
|
| 64 |
?> |
|
| 65 | 0 | |
| trunk/wb/modules/code/modify.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Setup template object |
|
| 27 |
$template = new Template(WB_PATH.'/modules/code'); |
|
| 28 |
$template->set_file('page', 'modify.html');
|
|
| 29 |
$template->set_block('page', 'main_block', 'main');
|
|
| 30 |
|
|
| 31 |
// Get page content |
|
| 32 |
$query = "SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'"; |
|
| 33 |
$get_content = $database->query($query); |
|
| 34 |
$content = $get_content->fetchRow(); |
|
| 35 |
$content = $admin->strip_slashes_dummy(htmlspecialchars($content['content'])); |
|
| 36 |
|
|
| 37 |
// Insert vars |
|
| 38 |
$template->set_var(array( |
|
| 39 |
'PAGE_ID' => $page_id, |
|
| 40 |
'SECTION_ID' => $section_id, |
|
| 41 |
'WB_URL' => WB_URL, |
|
| 42 |
'CONTENT' => $content, |
|
| 43 |
'TEXT_SAVE' => $TEXT['SAVE'], |
|
| 44 |
'TEXT_CANCEL' => $TEXT['CANCEL'] |
|
| 45 |
) |
|
| 46 |
); |
|
| 47 |
|
|
| 48 |
// Parse template object |
|
| 49 |
$template->parse('main', 'main_block', false);
|
|
| 50 |
$template->pparse('output', 'page');
|
|
| 51 |
|
|
| 52 |
?> |
|
| 53 | 0 | |
| trunk/wb/modules/code/modify.html | ||
|---|---|---|
| 1 |
<!-- BEGIN main_block --> |
|
| 2 |
|
|
| 3 |
<form action="{WB_URL}/modules/code/save.php" method="post">
|
|
| 4 |
|
|
| 5 |
<input type="hidden" name="page_id" value="{PAGE_ID}" />
|
|
| 6 |
<input type="hidden" name="section_id" value="{SECTION_ID}" />
|
|
| 7 |
|
|
| 8 |
<textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 380px">{CONTENT}</textarea>
|
|
| 9 |
|
|
| 10 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
| 11 |
<tr> |
|
| 12 |
<td align="left"> |
|
| 13 |
<input type="submit" value="{TEXT_SAVE}" style="width: 100px; margin-top: 5px;" />
|
|
| 14 |
</td> |
|
| 15 |
<td align="right"> |
|
| 16 |
</form> |
|
| 17 |
<input type="button" value="{TEXT_CANCEL}" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
|
|
| 18 |
</td> |
|
| 19 |
</tr> |
|
| 20 |
</table> |
|
| 21 |
|
|
| 22 |
</form> |
|
| 23 |
|
|
| 24 |
<!-- END main_block --> |
|
| 25 | 0 | |
| trunk/wb/modules/code/view.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Get content |
|
| 27 |
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'");
|
|
| 28 |
$fetch_content = $get_content->fetchRow(); |
|
| 29 |
$content = $this->strip_slashes_dummy($fetch_content['content']); |
|
| 30 |
eval($content); |
|
| 31 |
|
|
| 32 |
?> |
|
| 33 | 0 | |
| trunk/wb/modules/code/add.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: add.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Insert an extra row into the database |
|
| 27 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('$page_id','$section_id')");
|
|
| 28 |
|
|
| 29 |
?> |
|
| 30 | 0 | |
| trunk/wb/modules/code/index.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: index.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
header('Location: ../index.php');
|
|
| 27 |
|
|
| 28 |
?> |
|
| 29 | 0 | |
| trunk/wb/modules/code/delete.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: delete.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Delete record from the database |
|
| 27 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'");
|
|
| 28 |
|
|
| 29 |
?> |
|
| 30 | 0 | |
| trunk/wb/modules/code/info.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: info.php,v 1.3 2005/04/08 09:58:05 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
$module_directory = 'code'; |
|
| 27 |
$module_name = 'Code'; |
|
| 28 |
$module_type = 'page'; |
|
| 29 |
$module_version = '2.5'; |
|
| 30 |
$module_designed_for = '2.x'; |
|
| 31 |
$module_author = 'Ryan Djurovich'; |
|
| 32 |
$module_description = 'This module allows you to edit the contents of a page with a simple, yet powerful, text box'; |
|
| 33 |
|
|
| 34 |
?> |
|
| 35 | 0 | |
| addons/modules/code/save.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
require('../../config.php');
|
|
| 27 |
|
|
| 28 |
// Include WB admin wrapper script |
|
| 29 |
$update_when_modified = true; // Tells script to update when this page was last updated |
|
| 30 |
require(WB_PATH.'/modules/admin.php'); |
|
| 31 |
|
|
| 32 |
// Update the mod_wysiwygs table with the contents |
|
| 33 |
if(isset($_POST['content'])) {
|
|
| 34 |
$tags = array('<?php', '?>' , '<?');
|
|
| 35 |
$content = $admin->add_slashes(str_replace($tags, '', $_POST['content'])); |
|
| 36 |
$database = new database(); |
|
| 37 |
$query = "UPDATE ".TABLE_PREFIX."mod_code SET content = '$content' WHERE section_id = '$section_id'"; |
|
| 38 |
$database->query($query); |
|
| 39 |
} |
|
| 40 |
|
|
| 41 |
// Check if there is a database error, otherwise say successful |
|
| 42 |
if($database->is_error()) {
|
|
| 43 |
$admin->print_error($database->get_error(), $js_back); |
|
| 44 |
} else {
|
|
| 45 |
$admin->print_success($MESSAGE['PAGES']['SAVED'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id); |
|
| 46 |
} |
|
| 47 |
|
|
| 48 |
// Print admin footer |
|
| 49 |
$admin->print_footer(); |
|
| 50 |
|
|
| 51 |
?> |
|
| 0 | 52 | |
| addons/modules/code/view.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Get content |
|
| 27 |
$get_content = $database->query("SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'");
|
|
| 28 |
$fetch_content = $get_content->fetchRow(); |
|
| 29 |
$content = $this->strip_slashes_dummy($fetch_content['content']); |
|
| 30 |
eval($content); |
|
| 31 |
|
|
| 32 |
?> |
|
| 0 | 33 | |
| addons/modules/code/modify.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id$ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Setup template object |
|
| 27 |
$template = new Template(WB_PATH.'/modules/code'); |
|
| 28 |
$template->set_file('page', 'modify.html');
|
|
| 29 |
$template->set_block('page', 'main_block', 'main');
|
|
| 30 |
|
|
| 31 |
// Get page content |
|
| 32 |
$query = "SELECT content FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'"; |
|
| 33 |
$get_content = $database->query($query); |
|
| 34 |
$content = $get_content->fetchRow(); |
|
| 35 |
$content = $admin->strip_slashes_dummy(htmlspecialchars($content['content'])); |
|
| 36 |
|
|
| 37 |
// Insert vars |
|
| 38 |
$template->set_var(array( |
|
| 39 |
'PAGE_ID' => $page_id, |
|
| 40 |
'SECTION_ID' => $section_id, |
|
| 41 |
'WB_URL' => WB_URL, |
|
| 42 |
'CONTENT' => $content, |
|
| 43 |
'TEXT_SAVE' => $TEXT['SAVE'], |
|
| 44 |
'TEXT_CANCEL' => $TEXT['CANCEL'] |
|
| 45 |
) |
|
| 46 |
); |
|
| 47 |
|
|
| 48 |
// Parse template object |
|
| 49 |
$template->parse('main', 'main_block', false);
|
|
| 50 |
$template->pparse('output', 'page');
|
|
| 51 |
|
|
| 52 |
?> |
|
| 0 | 53 | |
| addons/modules/code/info.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: info.php,v 1.3 2005/04/08 09:58:05 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
$module_directory = 'code'; |
|
| 27 |
$module_name = 'Code'; |
|
| 28 |
$module_type = 'page'; |
|
| 29 |
$module_version = '2.5'; |
|
| 30 |
$module_designed_for = '2.x'; |
|
| 31 |
$module_author = 'Ryan Djurovich'; |
|
| 32 |
$module_description = 'This module allows you to edit the contents of a page with a simple, yet powerful, text box'; |
|
| 33 |
|
|
| 34 |
?> |
|
| 0 | 35 | |
| addons/modules/code/delete.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: delete.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Delete record from the database |
|
| 27 |
$database->query("DELETE FROM ".TABLE_PREFIX."mod_code WHERE section_id = '$section_id'");
|
|
| 28 |
|
|
| 29 |
?> |
|
| 0 | 30 | |
| addons/modules/code/modify.html | ||
|---|---|---|
| 1 |
<!-- BEGIN main_block --> |
|
| 2 |
|
|
| 3 |
<form action="{WB_URL}/modules/code/save.php" method="post">
|
|
| 4 |
|
|
| 5 |
<input type="hidden" name="page_id" value="{PAGE_ID}" />
|
|
| 6 |
<input type="hidden" name="section_id" value="{SECTION_ID}" />
|
|
| 7 |
|
|
| 8 |
<textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 380px">{CONTENT}</textarea>
|
|
| 9 |
|
|
| 10 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
|
| 11 |
<tr> |
|
| 12 |
<td align="left"> |
|
| 13 |
<input type="submit" value="{TEXT_SAVE}" style="width: 100px; margin-top: 5px;" />
|
|
| 14 |
</td> |
|
| 15 |
<td align="right"> |
|
| 16 |
</form> |
|
| 17 |
<input type="button" value="{TEXT_CANCEL}" onclick="javascript: window.location = 'index.php';" style="width: 100px; margin-top: 5px;" />
|
|
| 18 |
</td> |
|
| 19 |
</tr> |
|
| 20 |
</table> |
|
| 21 |
|
|
| 22 |
</form> |
|
| 23 |
|
|
| 24 |
<!-- END main_block --> |
|
| 0 | 25 | |
| addons/modules/code/install.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: install.php,v 1.2 2005/04/02 08:21:46 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
if(defined('WB_URL')) {
|
|
| 27 |
|
|
| 28 |
// Create table |
|
| 29 |
$database->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."mod_code`");
|
|
| 30 |
$mod_code = 'CREATE TABLE `'.TABLE_PREFIX.'mod_code` ('
|
|
| 31 |
. ' `section_id` INT NOT NULL,' |
|
| 32 |
. ' `page_id` INT NOT NULL,' |
|
| 33 |
. ' `content` TEXT NOT NULL ,' |
|
| 34 |
. ' PRIMARY KEY ( `section_id` ) )' |
|
| 35 |
. ' '; |
|
| 36 |
$database->query($mod_code); |
|
| 37 |
|
|
| 38 |
// Insert info into the search table |
|
| 39 |
// Module query info |
|
| 40 |
$field_info = array(); |
|
| 41 |
$field_info['page_id'] = 'page_id'; |
|
| 42 |
$field_info['title'] = 'page_title'; |
|
| 43 |
$field_info['link'] = 'link'; |
|
| 44 |
$field_info['description'] = 'description'; |
|
| 45 |
$field_info['modified_when'] = 'modified_when'; |
|
| 46 |
$field_info['modified_by'] = 'modified_by'; |
|
| 47 |
$field_info = serialize($field_info); |
|
| 48 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('module', 'code', '$field_info')");
|
|
| 49 |
// Query start |
|
| 50 |
$query_start_code = "SELECT [TP]pages.page_id, [TP]pages.page_title, [TP]pages.link, [TP]pages.description, [TP]pages.modified_when, [TP]pages.modified_by FROM [TP]mod_code, [TP]pages WHERE "; |
|
| 51 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_start', '$query_start_code', 'code')");
|
|
| 52 |
// Query body |
|
| 53 |
$query_body_code = " [TP]pages.page_id = [TP]mod_code.page_id AND [TP]mod_code.content [O] \'[W][STRING][W]\' AND [TP]pages.searching = \'1\'"; |
|
| 54 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_body', '$query_body_code', 'code')");
|
|
| 55 |
// Query end |
|
| 56 |
$query_end_code = ""; |
|
| 57 |
$database->query("INSERT INTO ".TABLE_PREFIX."search (name,value,extra) VALUES ('query_end', '$query_end_code', 'code')");
|
|
| 58 |
|
|
| 59 |
// Insert blank row (there needs to be at least on row for the search to work) |
|
| 60 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('0','0')");
|
|
| 61 |
|
|
| 62 |
} |
|
| 63 |
|
|
| 64 |
?> |
|
| 0 | 65 | |
| addons/modules/code/index.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: index.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
header('Location: ../index.php');
|
|
| 27 |
|
|
| 28 |
?> |
|
| 0 | 29 | |
| addons/modules/code/add.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: add.php,v 1.1.1.1 2005/01/30 10:32:22 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 |
/* |
|
| 6 |
|
|
| 7 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 8 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 9 |
|
|
| 10 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 11 |
it under the terms of the GNU General Public License as published by |
|
| 12 |
the Free Software Foundation; either version 2 of the License, or |
|
| 13 |
(at your option) any later version. |
|
| 14 |
|
|
| 15 |
Website Baker is distributed in the hope that it will be useful, |
|
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 18 |
GNU General Public License for more details. |
|
| 19 |
|
|
| 20 |
You should have received a copy of the GNU General Public License |
|
| 21 |
along with Website Baker; if not, write to the Free Software |
|
| 22 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 23 |
|
|
| 24 |
*/ |
|
| 25 |
|
|
| 26 |
// Insert an extra row into the database |
|
| 27 |
$database->query("INSERT INTO ".TABLE_PREFIX."mod_code (page_id,section_id) VALUES ('$page_id','$section_id')");
|
|
| 28 |
|
|
| 29 |
?> |
|
| 0 | 30 | |
Also available in: Unified diff
Moved Code module