Skip to content
This repository
Browse code

Added page revomal via a link. Closed #892.

  • Loading branch information...
commit cecbcc6983b75d0c56d97189e0c6f351d4951409 1 parent 8632500
Vladimir Sibirov authored May 26, 2012
21  modules/page/inc/page.edit.php
@@ -51,7 +51,7 @@
51 51
 		include $pl;
52 52
 	}
53 53
 	/* ===== */
54  
-	
  54
+
55 55
 	cot_block($usr['isadmin'] || $usr['auth_write'] && $usr['id'] == $row_page['page_ownerid']);
56 56
 
57 57
 	$rpage['page_keywords'] = cot_import('rpagekeywords', 'P', 'TXT');
@@ -74,7 +74,7 @@
74 74
 	$rpage['page_expire'] = (int)cot_import_date('rpageexpire');
75 75
 	$rpage['page_expire'] = ($rpage['page_expire'] <= $rpage['page_begin']) ? 0 : $rpage['page_expire'];
76 76
 	$rpage['page_updated'] = $sys['now'];
77  
-	
  77
+
78 78
 	$rpublish = cot_import('rpublish', 'P', 'ALP'); // For backwards compatibility
79 79
 	$rpage['page_state'] = ($rpublish == 'OK') ? 0 : cot_import('rpagestate', 'P', 'INT');
80 80
 
@@ -90,7 +90,16 @@
90 90
 		$rpage['page_ownerid'] = cot_import('rpageownerid', 'P', 'INT');
91 91
 		$rpage['page_filecount'] = cot_import('rpagefilecount', 'P', 'INT');
92 92
 	}
93  
-	$rpagedelete = cot_import('rpagedelete', 'P', 'BOL');
  93
+
  94
+	if ($_SERVER['REQUEST_METHOD'] == 'POST')
  95
+	{
  96
+		$rpagedelete = cot_import('rpagedelete', 'P', 'BOL');
  97
+	}
  98
+	else
  99
+	{
  100
+		$rpagedelete = cot_import('delete', 'G', 'BOL');
  101
+		cot_check_xg();
  102
+	}
94 103
 
95 104
 	if ($rpagedelete)
96 105
 	{
@@ -126,7 +135,7 @@
126 135
 		}
127 136
 		cot_redirect(cot_url('page', "c=" . $row_page['page_cat'], '', true));
128 137
 	}
129  
-	
  138
+
130 139
 	cot_check(empty($rpage['page_cat']), 'page_catmissing', 'rpagecat');
131 140
 	cot_check(mb_strlen($rpage['page_title']) < 2, 'page_titletooshort', 'rpagetitle');
132 141
 	cot_check(!empty($rpage['page_alias']) && preg_match('`[+/?%#&]`', $rpage['page_alias']), 'page_aliascharacters', 'rpagealias');
@@ -145,7 +154,7 @@
145 154
 		include $pl;
146 155
 	}
147 156
 	/* ===== */
148  
-	
  157
+
149 158
 	if (!cot_error_found())
150 159
 	{
151 160
 		if (!empty($rpage['page_alias']))
@@ -303,7 +312,7 @@
303 312
 	$exfld_title = isset($L['page_'.$exfld['field_name'].'_title']) ?  $L['page_'.$exfld['field_name'].'_title'] : $exfld['field_description'];
304 313
 
305 314
 	$t->assign(array(
306  
-		'PAGEEDIT_FORM_'.$uname => $exfld_val, 
  315
+		'PAGEEDIT_FORM_'.$uname => $exfld_val,
307 316
 		'PAGEEDIT_FORM_'.$uname.'_TITLE' => $exfld_title,
308 317
 		'PAGEEDIT_FORM_EXTRAFLD' => $exfld_val,
309 318
 		'PAGEEDIT_FORM_EXTRAFLD_TITLE' => $exfld_title
18  modules/page/inc/page.functions.php
@@ -23,7 +23,7 @@
23 23
 
24 24
 $cot_extrafields[$db_pages] = (!empty($cot_extrafields[$db_pages]))	? $cot_extrafields[$db_pages] : array();
25 25
 
26  
-$structure['page'] = (is_array($structure['page'])) ? $structure['page'] : array();	
  26
+$structure['page'] = (is_array($structure['page'])) ? $structure['page'] : array();
27 27
 
28 28
 /**
29 29
  * Cuts the page after 'more' tag or after the first page (if multipage)
@@ -81,7 +81,7 @@ function cot_selectbox_categories($check, $name, $subcat = '', $hideprivate = tr
81 81
 	global $db, $db_structure, $usr, $structure, $L, $R;
82 82
 
83 83
 	$structure['page'] = (is_array($structure['page'])) ? $structure['page'] : array();
84  
-	
  84
+
85 85
 	$result_array = array();
86 86
 	foreach ($structure['page'] as $i => $x)
87 87
 	{
@@ -118,7 +118,7 @@ function cot_selectbox_categories($check, $name, $subcat = '', $hideprivate = tr
118 118
 function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $pagepath_home = false, $emptytitle = '')
119 119
 {
120 120
 	global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_pages, $usr, $sys, $cot_yesno, $structure, $db_structure;
121  
-	
  121
+
122 122
 	static $extp_first = null, $extp_main = null;
123 123
 	static $pag_auth = array();
124 124
 
@@ -182,10 +182,11 @@ function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $a
182 182
 		$validate_url = cot_url('admin', "m=page&a=validate&id={$page_data['page_id']}&x={$sys['xk']}");
183 183
 		$unvalidate_url = cot_url('admin', "m=page&a=unvalidate&id={$page_data['page_id']}&x={$sys['xk']}");
184 184
 		$edit_url = cot_url('page', "m=edit&id={$page_data['page_id']}");
  185
+		$delete_url = cot_url('page', "m=edit&a=update&delete=1&id={$page_data['page_id']}&x={$sys['xk']}");
185 186
 
186 187
 		$page_data['page_status'] = cot_page_status(
187  
-			$page_data['page_state'], 
188  
-			$page_data['page_begin'], 
  188
+			$page_data['page_state'],
  189
+			$page_data['page_begin'],
189 190
 			$page_data['page_expire']
190 191
 		);
191 192
 
@@ -241,6 +242,7 @@ function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $a
241 242
 		{
242 243
 			$validate_confirm_url = cot_confirm_url($validate_url, 'page', 'page_confirm_validate');
243 244
 			$unvalidate_confirm_url = cot_confirm_url($unvalidate_url, 'page', 'page_confirm_unvalidate');
  245
+			$delete_confirm_url = cot_confirm_url($delete_url, 'page', 'page_confirm_delete');
244 246
 			$temp_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
245 247
 			$temp_array['ADMIN_EDIT_URL'] = $edit_url;
246 248
 			$temp_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ?
@@ -248,6 +250,8 @@ function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $a
248 250
 				cot_rc_link($unvalidate_confirm_url, $L['Putinvalidationqueue'], 'class="confirmLink"');
249 251
 			$temp_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ?
250 252
 				$validate_confirm_url : $unvalidate_confirm_url;
  253
+			$temp_array['ADMIN_DELETE'] = cot_rc_link($delete_confirm_url, $L['Delete'], 'class="confirmLink"');
  254
+			$temp_array['ADMIN_DELETE_URL'] = $delete_confirm_url;
251 255
 		}
252 256
 		else if ($usr['id'] == $page_data['page_ownerid'])
253 257
 		{
@@ -292,7 +296,7 @@ function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $a
292 296
 			'SHORTTITLE' => (!empty($emptytitle)) ? $emptytitle : $L['Deleted'],
293 297
 		);
294 298
 	}
295  
-	
  299
+
296 300
 	$return_array = array();
297 301
 	foreach ($temp_array as $key => $val)
298 302
 	{
@@ -347,7 +351,7 @@ function cot_page_config_order()
347 351
 function cot_page_status($page_state, $page_begin, $page_expire)
348 352
 {
349 353
 	global $sys;
350  
-	
  354
+
351 355
 	if ($page_state == 0)
352 356
 	{
353 357
 		if ($page_expire > 0 && $page_expire <= $sys['now'])
1  modules/page/tpl/page.tpl
@@ -48,6 +48,7 @@
48 48
 					<li><a href="{PAGE_CAT|cot_url('page','m=add&c=$this')}">{PHP.L.page_addtitle}</a></li>
49 49
 					<li>{PAGE_ADMIN_UNVALIDATE}</li>
50 50
 					<li>{PAGE_ADMIN_EDIT}</li>
  51
+					<li>{PAGE_ADMIN_DELETE}</li>
51 52
 				</ul>
52 53
 			</div>
53 54
 <!-- END: PAGE_ADMIN -->

0 notes on commit cecbcc6

Please sign in to comment.
Something went wrong with that request. Please try again.