Skip to content

Commit a43f7a5

Browse files
committed
1 parent 1177887 commit a43f7a5

File tree

17 files changed

+108
-28
lines changed

17 files changed

+108
-28
lines changed

install/languages/en/base.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,8 @@ INSERT INTO `{#}events` (`id`, `event`, `listener`, `ordering`, `is_enabled`) VA
789789
(149, 'content_before_list', 'tags', 149, 1),
790790
(150, 'tags_search_subjects', 'content', 150, 1),
791791
(151, 'images_before_upload', 'typograph', 151, 1),
792-
(152, 'engine_start', 'content', 152, 1);
792+
(152, 'engine_start', 'content', 152, 1),
793+
(153, 'content_category_after_update', 'subscriptions', 153, 1);
793794

794795
DROP TABLE IF EXISTS `{#}groups`;
795796
CREATE TABLE `{#}groups` (

install/languages/ru/base.sql

+2-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,8 @@ INSERT INTO `{#}events` (`id`, `event`, `listener`, `ordering`, `is_enabled`) VA
790790
(149, 'content_before_list', 'tags', 149, 1),
791791
(150, 'tags_search_subjects', 'content', 150, 1),
792792
(151, 'images_before_upload', 'typograph', 151, 1),
793-
(152, 'engine_start', 'content', 152, 1);
793+
(152, 'engine_start', 'content', 152, 1),
794+
(153, 'content_category_after_update', 'subscriptions', 153, 1);
794795

795796
DROP TABLE IF EXISTS `{#}groups`;
796797
CREATE TABLE `{#}groups` (

install/languages/ru/language.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
define('LANG_INSTALLATION_WIZARD', 'Мастер установки');
55
define('LANG_NEXT', 'Далее →');
66

7-
define('LANG_MANUAL', '<a href="http://docs.instantcms.ru/manual/install" target="_blank" rel="noopener noreferrer">Инструкция по установке</a>');
7+
define('LANG_MANUAL', '<a href="https://docs.instantcms.ru/manual/install" target="_blank" rel="noopener noreferrer">Инструкция по установке</a>');
88

99
define('LANG_LANGUAGE_SELECT_RU', 'Пожалуйста, выберите язык');
1010
define('LANG_LANGUAGE_SELECT_EN', 'Please, select a language');

install/steps/paths.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ function step($is_submit){
1414
'cache' => $root . '/' . 'cache' . '/'
1515
);
1616

17+
$protocol = 'http://';
18+
if(
19+
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ||
20+
(!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) ||
21+
(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
22+
){
23+
$protocol = 'https://';
24+
}
25+
1726
$hosts = array(
18-
'root' => 'http://' . $_SERVER['HTTP_HOST'] . $root,
19-
'upload' => 'http://' . $_SERVER['HTTP_HOST'] . $root . '/upload',
27+
'root' => $protocol . $_SERVER['HTTP_HOST'] . $root,
28+
'upload' => $protocol . $_SERVER['HTTP_HOST'] . $root . '/upload',
2029
);
2130

2231
$result = array(

install/templates/main.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<div id="footer" class="section">
4141
<div id="copyright">
42-
<a href="http://www.instantsoft.ru">InstantSoft</a> &copy; 2008 – <?php echo date('Y'); ?>
42+
<a href="http://instantsoft.ru">InstantSoft</a> &copy; 2008 – <?php echo date('Y'); ?>
4343
</div>
4444
<div id="version">
4545
<?php echo get_version(); ?>
@@ -53,4 +53,4 @@
5353
</script>
5454

5555
</body>
56-
</html>
56+
</html>

readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
InstantCMS 2
22
------------
33

4-
Инструкция по установке: http://docs.instantcms.ru/manual/install
4+
Инструкция по установке: https://docs.instantcms.ru/manual/install
55

system/controllers/content/actions/category_edit.php

+16-7
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,43 @@ public function run(){
3030
if ($this->request->has('submit')){
3131

3232
// Парсим форму и получаем поля записи
33-
$category = $form->parse($this->request, true);
33+
$new_category = $form->parse($this->request, true);
3434

3535
// Проверям правильность заполнения
36-
$errors = $form->validate($this, $category);
36+
$errors = $form->validate($this, $new_category);
3737

3838
if (!$errors){
3939

4040
// Обнуляем ручной SLUG, ключевые слова и описание
4141
// если они не разрешены для ручного ввода
42-
if ($ctype['options']['is_cats_auto_url']){ $category['slug_key'] = null; }
43-
if (!$ctype['options']['is_cats_keys']){ $category['seo_keys'] = null; }
44-
if (!$ctype['options']['is_cats_desc']){ $category['seo_desc'] = null; }
42+
if ($ctype['options']['is_cats_auto_url']){ $new_category['slug_key'] = null; }
43+
if (!$ctype['options']['is_cats_keys']){ $new_category['seo_keys'] = null; }
44+
if (!$ctype['options']['is_cats_desc']){ $new_category['seo_desc'] = null; }
4545

4646
// Добавляем категорию и редиректим на ее просмотр
47-
$category = $this->model->updateCategory($ctype_name, $id, $category);
47+
$new_category = $this->model->updateCategory($ctype_name, $id, $new_category);
48+
49+
list($ctype, $category, $new_category) = cmsEventsManager::hook('content_category_after_update', array(
50+
$ctype, $category, $new_category
51+
));
52+
list($ctype, $category, $new_category) = cmsEventsManager::hook('content_'.$ctype['name'].'_category_after_update', array(
53+
$ctype, $category, $new_category
54+
));
4855

4956
if ($back_url){
5057
$this->redirect($back_url);
5158
} else {
5259
if ($ctype['options']['list_on']){
53-
$this->redirectTo($ctype_name, $category['slug']);
60+
$this->redirectTo($ctype_name, $new_category['slug']);
5461
} else {
5562
$this->redirectToHome();
5663
}
5764
}
5865

5966
}
6067

68+
$category = $new_category;
69+
6170
if ($errors){
6271
cmsUser::addSessionMessage(LANG_FORM_ERRORS, 'error');
6372
}

system/controllers/content/actions/item_edit.php

+29-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function run(){
8080
if ($ctype['is_in_groups'] || $ctype['is_in_groups_only']){
8181

8282
$groups_model = cmsCore::getModel('groups');
83-
$groups = $groups_model->getUserGroups($this->cms_user->id);
83+
$groups = $groups_model->getUserGroups($item['user_id']);
8484

8585
if ($groups){
8686
$groups_list = ($ctype['is_in_groups_only']) ? array() : array('0'=>'');
@@ -278,6 +278,19 @@ public function run(){
278278

279279
}
280280

281+
} else {
282+
283+
if($is_moderator && !$is_owner){
284+
285+
$item['reason'] = LANG_PM_MODERATION_REWORK_DRAFT;
286+
$item['page_url'] = href_to_abs($ctype['name'], 'edit', $item['id']);
287+
288+
$this->controller_moderation->moderationNotifyAuthor($item, 'moderation_rework');
289+
290+
cmsUser::addSessionMessage(LANG_MODERATION_REMARK_NOTIFY, 'info');
291+
292+
}
293+
281294
}
282295

283296
$back_url = $this->request->get('back', '');
@@ -300,6 +313,20 @@ public function run(){
300313

301314
$show_save_button = ($is_owner || (!$is_premoderation && $item['is_approved']));
302315

316+
$button_draft_text = LANG_CONTENT_SAVE_DRAFT;
317+
318+
if(!$item['is_draft']){
319+
if($show_save_button){
320+
if($is_moderator && !$is_owner){
321+
$button_draft_text = LANG_MODERATION_RETURN_FOR_REVISION;
322+
} else {
323+
$button_draft_text = LANG_CONTENT_MOVE_DRAFT;
324+
}
325+
} else {
326+
$button_draft_text = LANG_SAVE;
327+
}
328+
}
329+
303330
return $this->cms_template->render('item_form', array(
304331
'do' => 'edit',
305332
'page_title' => $item['title'],
@@ -314,7 +341,7 @@ public function run(){
314341
'is_premoderation' => $is_premoderation,
315342
'show_save_button' => $show_save_button,
316343
'button_save_text' => (($is_premoderation && !$is_moderator) ? LANG_MODERATION_SEND : ($item['is_approved'] ? LANG_SAVE : LANG_PUBLISH)),
317-
'button_draft_text' => (!$item['is_draft'] ? ($show_save_button ? LANG_CONTENT_MOVE_DRAFT : LANG_SAVE) : LANG_CONTENT_SAVE_DRAFT),
344+
'button_draft_text' => $button_draft_text,
318345
'is_multi_cats' => !empty($ctype['options']['is_cats_multi']),
319346
'is_load_props' => false,
320347
'add_cats' => $add_cats,

system/controllers/content/widgets/list/widget.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ public function run(){
3838
}
3939

4040
if ($dataset_id){
41-
4241
$dataset = $model->getContentDataset($dataset_id);
43-
44-
if ($dataset){
45-
$model->applyDatasetFilters($dataset);
46-
} else {
47-
$dataset_id = false;
48-
}
49-
5042
}
5143

5244
if ($relation_id && $current_ctype_item && $current_ctype){
@@ -78,6 +70,10 @@ public function run(){
7870

7971
}
8072

73+
if (!empty($dataset)){
74+
$model->applyDatasetFilters($dataset);
75+
}
76+
8177
if ($category){
8278
$model->filterCategory($ctype['name'], $category, true);
8379
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
class onSubscriptionsContentCategoryAfterUpdate extends cmsAction {
4+
5+
public function run($data){
6+
7+
list($ctype, $old_category, $new_category) = $data;
8+
9+
if($old_category['slug'] != $new_category['slug']){
10+
11+
$old_url = href_to_rel($ctype['name'], $old_category['slug']);
12+
$new_url = href_to_rel($ctype['name'], $new_category['slug']);
13+
14+
$this->model->replaceFieldString('subscriptions', $old_url, $new_url, 'subject_url');
15+
16+
}
17+
18+
return $data;
19+
20+
}
21+
22+
}

system/controllers/subscriptions/manifest.php

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'content_after_add_approve',
1414
'publish_delayed_content',
1515
'user_notify_types',
16+
'content_category_after_update',
1617
'user_tab_show'
1718
)
1819

system/controllers/users/hooks/user_privacy_types.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public function run(){
88

99
$types['users_profile_view'] = array(
1010
'title' => LANG_USERS_PRIVACY_PROFILE_VIEW,
11-
'options' => array('anyone', 'friends')
11+
'options' => array('', 'anyone', 'friends')
1212
);
1313

1414
if(!empty($this->options['is_friends_on'])){

system/controllers/users/hooks/wall_after_add.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private function notifyProfileOwner($profile_id, $entry){
3232
'author_url' => href_to_abs('users', $entry['user_id']),
3333
'author_nickname' => $entry['user_nickname'],
3434
'content' => $entry['content_html']
35-
));
35+
), 'users_wall_write');
3636

3737
}
3838

system/core/model.php

+12
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,18 @@ public function insertOrUpdate($table_name, $insert_data, $update_data = false){
564564
return $this->db->insertOrUpdate($table_name, $insert_data, $update_data);
565565
}
566566

567+
//============================================================================//
568+
//============================================================================//
569+
570+
public function replaceFieldString($table_name, $search, $replace, $field){
571+
572+
$search = $this->db->escape($search);
573+
$replace = $this->db->escape($replace);
574+
575+
return $this->db->query("UPDATE `{#}{$table_name}` SET `{$field}` = REPLACE(`{$field}`, '{$search}', '$replace') WHERE `{$field}` LIKE '%{$search}%'");
576+
577+
}
578+
567579
//============================================================================//
568580
//============================================================================//
569581

system/languages/en/language.php

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@
278278
define('LANG_PM_MODERATION_REFUSED', 'Moderator refused the<b>%1$s</b> publication.%2$s Reason for rejection: %3$s');
279279
define('LANG_PM_MODERATION_COMMENT_REFUSED', 'A moderator has rejected your comment on the page <b>%1$s</b>.%2$s Reason for rejection: %3$s');
280280
define('LANG_PM_MODERATION_REWORK', 'The moderator returned the <b><a href="%2$s">%1$s</a></b> page for revision and pointed remarks:<br />%3$s');
281+
define('LANG_PM_MODERATION_REWORK_DRAFT', 'Please correct the notes in the text.');
281282

282283
//PERMISSIONS
283284
define('LANG_PERMISSIONS', 'Permissions');

system/languages/ru/language.php

+1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277
define('LANG_PM_MODERATION_REFUSED', 'Модератор отклонил размещение и удалил страницу <b>%1$s</b>.%2$s Причина отклонения: %3$s');
278278
define('LANG_PM_MODERATION_COMMENT_REFUSED', 'Модератор отклонил ваш комментарий на странице <b>%1$s</b>.%2$s Причина отклонения: %3$s');
279279
define('LANG_PM_MODERATION_REWORK', 'Модератор возвратил страницу <b><a href="%2$s">%1$s</a></b> на доработку и указал замечания:<br />%3$s');
280+
define('LANG_PM_MODERATION_REWORK_DRAFT', 'Устраните, пожалуйста, замечания в тексте.');
280281

281282
//PERMISSIONS
282283
define('LANG_PERMISSIONS', 'Доступ');

templates/default/controllers/content/item_childs_view.tpl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</div>
8080
</div>
8181
<?php
82-
if ($toolbar_html) {
82+
if (!empty($toolbar_html)) {
8383
echo html_each($toolbar_html);
8484
}
8585
?>

0 commit comments

Comments
 (0)