Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add block2 support #1

Merged
merged 1 commit into from
Apr 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion add_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$commenting = $fetch_settings['commenting'];

// Insert new row into database
$sql = "INSERT INTO `".TABLE_PREFIX."mod_news_img_posts` (`section_id`,`page_id`,`position`,`link`,`content_short`,`content_long`,`commenting`,`active`) VALUES ('$section_id','$page_id','$position','','','','$commenting','1')";
$sql = "INSERT INTO `".TABLE_PREFIX."mod_news_img_posts` (`section_id`,`page_id`,`position`,`link`,`content_short`,`content_long`,`content_block2`,`commenting`,`active`) VALUES ('$section_id','$page_id','$position','','','','','$commenting','1')";
$database->query($sql);

// Say that a new record has been added, then redirect to modify page
Expand Down
7 changes: 5 additions & 2 deletions info.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
$module_directory = 'news_img';
$module_name = 'News with Images';
$module_function = 'page';
$module_version = '3.7.1';
$module_version = '3.7.2';
$module_platform = '2.8.x';
$module_author = 'Ryan Djurovich, Rob Smith, Silvia Reins, Bianka Martinovic';
$module_license = 'GNU General Public License';
$module_description = 'This page type is designed for making a news page with Images and Lightboxeffect.';

/**
* v3.7.2 - 2019-04-12 Martin Hecht
* + added second block
*
* v3.7.1 - 2019-04-12 Bianka Martinovic
* + added Masonry
* + added Gallery setting
Expand All @@ -37,4 +40,4 @@
* v3.6.5 - 2019-04-10 Bianka Martinovic
* + Fix: Warning: sizeof(): Parameter must be an array
* + Fix: Undefined index: crop_preview
**/
**/
2 changes: 2 additions & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
. '`image` VARCHAR(256) NOT NULL DEFAULT \'\','
. '`content_short` TEXT NOT NULL ,'
. '`content_long` TEXT NOT NULL ,'
. '`content_block2` TEXT NOT NULL ,'
. '`commenting` VARCHAR(7) NOT NULL DEFAULT \'\','
. '`published_when` INT NOT NULL DEFAULT \'0\','
. '`published_until` INT NOT NULL DEFAULT \'0\','
Expand Down Expand Up @@ -126,6 +127,7 @@
[TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.title LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_short LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_long LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_posts.page_id AND [TP]mod_news_posts.content_block2 LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.title LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_comments.page_id AND [TP]mod_news_comments.comment LIKE \'%[STRING]%\'
OR [TP]pages.page_id = [TP]mod_news_settings.page_id AND [TP]mod_news_settings.header LIKE \'%[STRING]%\'
Expand Down
12 changes: 11 additions & 1 deletion modify_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function show_wysiwyg_editor($name,$id,$content,$width,$height) {
echo '<textarea name="'.$name.'" id="'.$id.'" rows="10" cols="1" style="width: '.$width.'; height: '.$height.';">'.$content.'</textarea>';
}
} else {
$id_list=array("short","long");
$id_list=array("short","long","block2");
require(WB_PATH.'/modules/'.WYSIWYG_EDITOR.'/include.php');
}

Expand Down Expand Up @@ -195,6 +195,16 @@ function show_wysiwyg_editor($name,$id,$content,$width,$height) {
?>
</td>
</tr>
<tr>
<td valign="top"><?php echo $TEXT['BLOCK']; ?> 2:</td>
</tr>
<tr>
<td>
<?php
show_wysiwyg_editor("block2","block2",htmlspecialchars($fetch_content['content_block2']),"100%","650px");
?>
</td>
</tr>
</table>

<?php
Expand Down
3 changes: 2 additions & 1 deletion save_post.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function image_resize($src, $dst, $width, $height, $crop=0){
$title = $admin->get_post_escaped('title');
$short = $admin->get_post_escaped('short');
$long = $admin->get_post_escaped('long');
$block2 = $admin->get_post_escaped('block2');
$image = $admin->get_post_escaped('image');
$commenting = $admin->get_post_escaped('commenting');
$active = $admin->get_post_escaped('active');
Expand Down Expand Up @@ -360,7 +361,7 @@ function image_resize($src, $dst, $width, $height, $crop=0){
$title = strip_tags($title);

// Update row
$database->query("UPDATE `".TABLE_PREFIX."mod_news_img_posts` SET `group_id` = '$group_id', `title` = '$title', `link` = '$post_link', `content_short` = '$short', `content_long` = '$long', `image` = '$image', `commenting` = '$commenting', `active` = '$active', `published_when` = '$publishedwhen', `published_until` = '$publisheduntil', `posted_when` = '".time()."', `posted_by` = '".$admin->get_user_id()."' WHERE `post_id` = '$post_id'");
$database->query("UPDATE `".TABLE_PREFIX."mod_news_img_posts` SET `group_id` = '$group_id', `title` = '$title', `link` = '$post_link', `content_short` = '$short', `content_long` = '$long', `content_block2` = '$block2', `image` = '$image', `commenting` = '$commenting', `active` = '$active', `published_when` = '$publishedwhen', `published_until` = '$publisheduntil', `posted_when` = '".time()."', `posted_by` = '".$admin->get_user_id()."' WHERE `post_id` = '$post_id'");

//update Bildbeschreibungen der tabelle mod_news_img_img
$query_img = $database->query("SELECT * FROM `".TABLE_PREFIX."mod_news_img_img` WHERE `post_id` = ".$post_id);
Expand Down
4 changes: 2 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function news_img_search($func_vars) {
$table_posts = TABLE_PREFIX."mod_news_img_posts";
$table_groups = TABLE_PREFIX."mod_news_img_groups";
$query = $func_database->query("
SELECT p.`post_id`, p.`title`, p.`content_short`, p.`content_long`, p.`link`, p.`posted_when`, p.`posted_by`
SELECT p.`post_id`, p.`title`, p.`content_short`, p.`content_long`, p.`content_block2`, p.`link`, p.`posted_when`, p.`posted_by`
FROM `$table_posts` AS p LEFT OUTER JOIN `$table_groups` AS g ON p.`group_id` = g.`group_id`
WHERE p.`section_id`='$func_section_id' AND p.`active` = '1' AND ( g.`active` IS NULL OR g.`active` = '1' )
AND (`published_when` = '0' OR `published_when` <= $t) AND (`published_until` = 0 OR `published_until` >= $t)
Expand All @@ -37,7 +37,7 @@ function news_img_search($func_vars) {
// now call print_excerpt() for every single post
if($query->numRows() > 0) {
while($res = $query->fetchRow()) {
$text = $res['title'].$divider.$res['content_short'].$divider.$res['content_long'].$divider;
$text = $res['title'].$divider.$res['content_short'].$divider.$res['content_long'].$divider.$res['content_block2'].$divider;
// fetch comments and add to $text
if($excerpt_from_comments) {
$table = TABLE_PREFIX."mod_news_img_comments";
Expand Down
7 changes: 7 additions & 0 deletions upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ function scandir($directory, $sorting_order = 0)
TABLE_PREFIX
));

// 2019-04-12 by Martin Hecht:
// add second block
$database->query(sprintf(
'ALTER TABLE `%smod_news_img_posts` ADD COLUMN `content_block2` TEXT NOT NULL AFTER `content_long`',
TABLE_PREFIX
));

// Print admin footer
$admin->print_footer();
}
6 changes: 6 additions & 0 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@
// echo post footer
echo str_replace($vars, $values, $setting_post_footer);

// Block2
$post_block2 = ($post['content_block2']);
define("NEWS_BLOCK2", $post_block2);
define("TOPIC_BLOCK2", $post_block2); // re-use the constant from topics for backwards compatibility
if (!defined("MODULES_BLOCK2")) define("MODULES_BLOCK2", $post_block2);

// Show comments section if we have to
if(($post['commenting'] == 'private' AND isset($wb) AND $wb->is_authenticated() == true) OR $post['commenting'] == 'public')
{
Expand Down