Completed
Push — develop ( 5613ed...d17f77 )
by Maxim
11:03 queued 05:33
created
manager/actions/resources/mgrResources.class.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-class mgrResources {
6
+class mgrResources{
7 7
     /**
8 8
      * @var array
9 9
      */
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * mgrResources constructor.
26 26
      */
27
-    public function __construct() {
27
+    public function __construct(){
28 28
 		$this->setTypes();
29 29
 		$this->queryItemsFromDB();
30 30
 		$this->prepareCategoryArrays();
@@ -33,47 +33,47 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @return void
35 35
      */
36
-    public function setTypes() {
36
+    public function setTypes(){
37 37
 		global $_lang;
38
-		$this->types['site_templates']    = array(
38
+		$this->types['site_templates'] = array(
39 39
 			'title'=>$_lang["manage_templates"],
40
-			'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
41
-			'permissions'=>array('new_template','edit_template'),
40
+			'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')),
41
+			'permissions'=>array('new_template', 'edit_template'),
42 42
 			'name'=>'templatename'
43 43
 		);
44
-		$this->types['site_tmplvars']     = array(
44
+		$this->types['site_tmplvars'] = array(
45 45
 			'title'=>$_lang["tmplvars"],
46
-			'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
47
-			'permissions'=>array('new_template','edit_template'),
46
+			'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')),
47
+			'permissions'=>array('new_template', 'edit_template'),
48 48
 		);
49 49
 		$this->types['site_htmlsnippets'] = array(
50 50
 			'title'=>$_lang["manage_htmlsnippets"],
51
-			'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
52
-			'permissions'=>array('new_chunk','edit_chunk'),
51
+			'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')),
52
+			'permissions'=>array('new_chunk', 'edit_chunk'),
53 53
 		);
54
-		$this->types['site_snippets']     = array(
54
+		$this->types['site_snippets'] = array(
55 55
 			'title'=>$_lang["manage_snippets"],
56
-			'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
57
-			'permissions'=>array('new_snippet','edit_snippet'),
56
+			'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')),
57
+			'permissions'=>array('new_snippet', 'edit_snippet'),
58 58
 		);
59
-		$this->types['site_plugins']      = array(
59
+		$this->types['site_plugins'] = array(
60 60
 			'title'=>$_lang["manage_plugins"],
61
-			'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
62
-			'permissions'=>array('new_plugin','edit_plugin'),
61
+			'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')),
62
+			'permissions'=>array('new_plugin', 'edit_plugin'),
63 63
 		);
64
-		$this->types['site_modules']      = array(
64
+		$this->types['site_modules'] = array(
65 65
 			'title'=>$_lang["manage_modules"],
66
-			'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
67
-			'permissions'=>array('new_module','edit_module'),
66
+			'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')),
67
+			'permissions'=>array('new_module', 'edit_module'),
68 68
 		);
69 69
 	}
70 70
 
71 71
     /**
72 72
      * @return void
73 73
      */
74
-    public function queryItemsFromDB() {
75
-		foreach($this->types as $resourceTable=>$type) {
76
-			if($this->hasAnyPermissions($type['permissions'])) {
74
+    public function queryItemsFromDB(){
75
+		foreach ($this->types as $resourceTable=>$type) {
76
+			if ($this->hasAnyPermissions($type['permissions'])) {
77 77
 				$nameField = isset($type['name']) ? $type['name'] : 'name';
78 78
 				$this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
79 79
 		   }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
      * @param array $permissions
85 85
      * @return bool
86 86
      */
87
-    public function hasAnyPermissions($permissions) {
87
+    public function hasAnyPermissions($permissions){
88 88
 		global $modx;
89 89
 
90
-		foreach($permissions as $p)
91
-			if($modx->hasPermission($p)) return true;
90
+		foreach ($permissions as $p)
91
+			if ($modx->hasPermission($p)) return true;
92 92
 
93 93
 		return false;
94 94
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      * @param string $nameField
99 99
      * @return array|bool
100 100
      */
101
-    public function queryResources($resourceTable, $nameField = 'name') {
101
+    public function queryResources($resourceTable, $nameField = 'name'){
102 102
 		global $modx, $_lang;
103 103
 
104 104
         $allowed = array(
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
             'site_plugins',
108 108
             'site_modules'
109 109
         );
110
-		$pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : '';
110
+		$pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : '';
111 111
 
112 112
 		$tvsql  = '';
113 113
 		$tvjoin = '';
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 
123 123
 		$rs = $modx->db->select(
124 124
 			"{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
125
-			$modx->getFullTableName($resourceTable) . " AS {$resourceTable}
126
-	            LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
125
+			$modx->getFullTableName($resourceTable)." AS {$resourceTable}
126
+	            LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
127 127
 			"",
128 128
 			"category,name"
129 129
 		);
130 130
 		$limit = $modx->db->getRecordCount($rs);
131 131
 
132
-		if($limit < 1) return false;
132
+		if ($limit < 1) return false;
133 133
 
134 134
 		$result = array();
135 135
 		while ($row = $modx->db->getRow($rs)) {
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
     /**
142 142
      * @return void
143 143
      */
144
-    public function prepareCategoryArrays() {
145
-		foreach($this->items as $type=>$items) {
146
-			foreach((array)$items as $item) {
144
+    public function prepareCategoryArrays(){
145
+		foreach ($this->items as $type=>$items) {
146
+			foreach ((array) $items as $item) {
147 147
 				$catid = $item['catid'] ? $item['catid'] : 0;
148 148
 				$this->categories[$catid] = $item['category'];
149 149
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 		natcasesort($this->categories);
157 157
 
158 158
 		// Now sort by name
159
-		foreach($this->itemsPerCategory as $catid=>$items) {
160
-			usort($this->itemsPerCategory[$catid], function ($a, $b) {
159
+		foreach ($this->itemsPerCategory as $catid=>$items) {
160
+			usort($this->itemsPerCategory[$catid], function($a, $b){
161 161
 				return strcasecmp($a['name'], $b['name']);
162 162
 			});
163 163
 		}
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 1 patch
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
7
-$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC';
8
-$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon';
9
-$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
10
-$add_path = $sd . $sb . $pg;
7
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
8
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
9
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
10
+$add_path = $sd.$sb.$pg;
11 11
 /*******************/
12 12
 
13 13
 // check permissions
14
-switch($modx->manager->action) {
14
+switch ($modx->manager->action) {
15 15
 	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
16
+		if (!$modx->hasPermission('edit_document')) {
17 17
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 		}
19 19
 		break;
20 20
 	case 85:
21 21
 	case 72:
22 22
 	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
23
+		if (!$modx->hasPermission('new_document')) {
24 24
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
25
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26 26
 			// check user has permissions for parent
27
-			include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
27
+			include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
28 28
 			$udperms = new udperms();
29 29
 			$udperms->user = $modx->getLoginUserID();
30 30
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31 31
 			$udperms->role = $_SESSION['mgrRole'];
32
-			if(!$udperms->checkPermissions()) {
32
+			if (!$udperms->checkPermissions()) {
33 33
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34 34
 			}
35 35
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
39 39
 }
40 40
 
41
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
41
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
42 42
 
43 43
 // Get table names (alphabetical)
44 44
 $tbl_categories = $modx->getFullTableName('categories');
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates');
54 54
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
55 55
 
56
-if($modx->manager->action == 27) {
56
+if ($modx->manager->action == 27) {
57 57
 	//editing an existing document
58 58
 	// check permissions on the document
59
-	include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
59
+	include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
60 60
 	$udperms = new udperms();
61 61
 	$udperms->user = $modx->getLoginUserID();
62 62
 	$udperms->document = $id;
63 63
 	$udperms->role = $_SESSION['mgrRole'];
64 64
 
65
-	if(!$udperms->checkPermissions()) {
65
+	if (!$udperms->checkPermissions()) {
66 66
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
67 67
 	}
68 68
 }
69 69
 
70 70
 // check to see if resource isn't locked
71
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
71
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
72 72
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
73 73
 }
74 74
 // end check for lock
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 $modx->lockElement(7, $id);
78 78
 
79 79
 // get document groups for current user
80
-if($_SESSION['mgrDocgroups']) {
80
+if ($_SESSION['mgrDocgroups']) {
81 81
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
82 82
 }
83 83
 
84
-if(!empty ($id)) {
84
+if (!empty ($id)) {
85 85
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
-	if($docgrp) {
86
+	if ($docgrp) {
87 87
 		$access .= " OR dg.document_group IN ({$docgrp})";
88 88
 	}
89 89
 	$rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90 90
 	$content = array();
91 91
 	$content = $modx->db->getRow($rs);
92 92
 	$modx->documentObject = &$content;
93
-	if(!$content) {
93
+	if (!$content) {
94 94
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
95 95
 	}
96 96
 	$_SESSION['itemname'] = $content['pagetitle'];
97 97
 } else {
98 98
 	$content = array();
99 99
 
100
-	if(isset($_REQUEST['newtemplate'])) {
100
+	if (isset($_REQUEST['newtemplate'])) {
101 101
 		$content['template'] = $_REQUEST['newtemplate'];
102 102
 	} else {
103 103
 		$content['template'] = getDefaultTemplate();
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 
109 109
 // restore saved form
110 110
 $formRestored = $modx->manager->loadFormValues();
111
-if(isset($_REQUEST['newtemplate'])) {
111
+if (isset($_REQUEST['newtemplate'])) {
112 112
 	$formRestored = true;
113 113
 }
114 114
 
115 115
 // retain form values if template was changed
116 116
 // edited to convert pub_date and unpub_date
117 117
 // sottwell 02-09-2006
118
-if($formRestored == true) {
118
+if ($formRestored == true) {
119 119
 	$content = array_merge($content, $_POST);
120 120
 	$content['content'] = $_POST['ta'];
121
-	if(empty ($content['pub_date'])) {
121
+	if (empty ($content['pub_date'])) {
122 122
 		unset ($content['pub_date']);
123 123
 	} else {
124 124
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125 125
 	}
126
-	if(empty ($content['unpub_date'])) {
126
+	if (empty ($content['unpub_date'])) {
127 127
 		unset ($content['unpub_date']);
128 128
 	} else {
129 129
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 // increase menu index if this is a new document
134
-if(!isset ($_REQUEST['id'])) {
135
-	if(!isset ($modx->config['auto_menuindex'])) {
134
+if (!isset ($_REQUEST['id'])) {
135
+	if (!isset ($modx->config['auto_menuindex'])) {
136 136
 		$modx->config['auto_menuindex'] = 1;
137 137
 	}
138
-	if($modx->config['auto_menuindex']) {
139
-		$pid = (int)$_REQUEST['pid'];
138
+	if ($modx->config['auto_menuindex']) {
139
+		$pid = (int) $_REQUEST['pid'];
140 140
 		$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141 141
 		$content['menuindex'] = $modx->db->getValue($rs);
142 142
 	} else {
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 }
146 146
 
147
-if(isset ($_POST['which_editor'])) {
147
+if (isset ($_POST['which_editor'])) {
148 148
 	$modx->config['which_editor'] = $_POST['which_editor'];
149 149
 }
150 150
 
151 151
 // Add lock-element JS-Script
152 152
 $lockElementId = $id;
153 153
 $lockElementType = 7;
154
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
154
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
155 155
 ?>
156 156
 	<script type="text/javascript">
157 157
 		/* <![CDATA[ */
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			},
182 182
 			cancel: function() {
183 183
 				documentDirty = false;
184
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
184
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
185 185
 			},
186 186
 			duplicate: function() {
187 187
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				}
190 190
 			},
191 191
 			view: function() {
192
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
192
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
193 193
 			}
194 194
 		};
195 195
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			'template' => $content['template']
552 552
 		));
553 553
 
554
-		if(is_array($evtOut)) {
554
+		if (is_array($evtOut)) {
555 555
 			echo implode('', $evtOut);
556 556
 		}
557 557
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 		<fieldset id="create_edit">
576 576
 
577 577
 			<h1>
578
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
579
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
579
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
580 580
 				} else {
581 581
 				    if ($modx->manager->action == '4') {
582 582
                         echo $_lang['add_resource'];
@@ -592,36 +592,36 @@  discard block
 block discarded – undo
592 592
 
593 593
 			<?php
594 594
 			// breadcrumbs
595
-			if($modx->config['use_breadcrumbs']) {
595
+			if ($modx->config['use_breadcrumbs']) {
596 596
 				$temp = array();
597 597
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598 598
 
599
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
599
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
600 600
 					$bID = (int) $_REQUEST['id'];
601 601
 					$temp = $modx->getParentIds($bID);
602
-				} else if(isset($_REQUEST['pid'])) {
602
+				} else if (isset($_REQUEST['pid'])) {
603 603
 					$bID = (int) $_REQUEST['pid'];
604 604
 					$temp = $modx->getParentIds($bID);
605 605
 					array_unshift($temp, $bID);
606 606
 				}
607 607
 
608
-				if($temp) {
608
+				if ($temp) {
609 609
 					$parents = implode(',', $temp);
610 610
 
611
-					if(!empty($parents)) {
611
+					if (!empty($parents)) {
612 612
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
613 613
 						$rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
-						while($row = $modx->db->getRow($rs)) {
614
+						while ($row = $modx->db->getRow($rs)) {
615 615
 							$out .= '<li class="breadcrumbs__li">
616
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
616
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
617 617
                                 <span class="breadcrumbs__sep">&gt;</span>
618 618
                             </li>';
619 619
 						}
620 620
 					}
621 621
 				}
622 622
 
623
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
624
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
625 625
 			}
626 626
 			?>
627 627
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639 639
 						'id' => $id
640 640
 					));
641
-					if(is_array($evtOut)) {
641
+					if (is_array($evtOut)) {
642 642
 						echo implode('', $evtOut);
643 643
 					} else {
644 644
 						?>
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 									</td>
695 695
 								</tr>
696 696
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
697
+								<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698 698
 
699 699
 									<tr>
700 700
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -730,17 +730,17 @@  discard block
 block discarded – undo
730 730
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731 731
 											$rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732 732
 											$currentCategory = '';
733
-											while($row = $modx->db->getRow($rs)) {
734
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+											while ($row = $modx->db->getRow($rs)) {
734
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
735 735
 													continue;
736 736
 												};
737 737
 												// Skip if not selectable but show if selected!
738 738
 												$thisCategory = $row['category'];
739
-												if($thisCategory == null) {
739
+												if ($thisCategory == null) {
740 740
 													$thisCategory = $_lang["no_category"];
741 741
 												}
742
-												if($thisCategory != $currentCategory) {
743
-													if($closeOptGroup) {
742
+												if ($thisCategory != $currentCategory) {
743
+													if ($closeOptGroup) {
744 744
 														echo "\t\t\t\t\t</optgroup>\n";
745 745
 													}
746 746
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -749,10 +749,10 @@  discard block
 block discarded – undo
749 749
 
750 750
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
751 751
 
752
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
752
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
753 753
 												$currentCategory = $thisCategory;
754 754
 											}
755
-											if($thisCategory != '') {
755
+											if ($thisCategory != '') {
756 756
 												echo "\t\t\t\t\t</optgroup>\n";
757 757
 											}
758 758
 											?>
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 									<td valign="top">
797 797
 										<?php
798 798
 										$parentlookup = false;
799
-										if(isset ($_REQUEST['id'])) {
800
-											if($content['parent'] == 0) {
799
+										if (isset ($_REQUEST['id'])) {
800
+											if ($content['parent'] == 0) {
801 801
 												$parentname = $site_name;
802 802
 											} else {
803 803
 												$parentlookup = $content['parent'];
804 804
 											}
805
-										} elseif(isset ($_REQUEST['pid'])) {
806
-											if($_REQUEST['pid'] == 0) {
805
+										} elseif (isset ($_REQUEST['pid'])) {
806
+											if ($_REQUEST['pid'] == 0) {
807 807
 												$parentname = $site_name;
808 808
 											} else {
809 809
 												$parentlookup = $_REQUEST['pid'];
810 810
 											}
811
-										} elseif(isset($_POST['parent'])) {
812
-											if($_POST['parent'] == 0) {
811
+										} elseif (isset($_POST['parent'])) {
812
+											if ($_POST['parent'] == 0) {
813 813
 												$parentname = $site_name;
814 814
 											} else {
815 815
 												$parentlookup = $_POST['parent'];
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 											$parentname = $site_name;
819 819
 											$content['parent'] = 0;
820 820
 										}
821
-										if($parentlookup !== false && is_numeric($parentlookup)) {
821
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
822 822
 											$rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823 823
 											$parentname = $modx->db->getValue($rs);
824
-											if(!$parentname) {
824
+											if (!$parentname) {
825 825
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
826 826
 											}
827 827
 										}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 								}*/
864 864
 								?>
865 865
 
866
-								<?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?>
866
+								<?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?>
867 867
 									<tr>
868 868
 										<td colspan="2">
869 869
 											<hr>
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 														<?php
877 877
 														// invoke OnRichTextEditorRegister event
878 878
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
-														if(is_array($evtOut)) {
880
-															for($i = 0; $i < count($evtOut); $i++) {
879
+														if (is_array($evtOut)) {
880
+															for ($i = 0; $i < count($evtOut); $i++) {
881 881
 																$editor = $evtOut[$i];
882 882
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883 883
 															}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 											</div>
889 889
 											<div id="content_body">
890 890
 												<?php
891
-												if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
891
+												if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892 892
 													$htmlContent = $content['content'];
893 893
 													?>
894 894
 													<div class="section-editor clearfix">
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902 902
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903 903
 												} else {
904
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
904
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n";
905 905
 												}
906 906
 												?>
907 907
 											</div>
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
                             if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) {
919 919
                                 $template = $default_template;
920
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
920
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
921 921
                                 if (isset ($_REQUEST['newtemplate'])) {
922 922
                                     $template = $_REQUEST['newtemplate'];
923 923
                                 } else {
@@ -945,10 +945,10 @@  discard block
 block discarded – undo
945 945
                                 );
946 946
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
947 947
                                 if ($group_tvs) {
948
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
948
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
949 949
                                     $from .= '
950
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
951
-                                    $sort = 'cat.rank,cat.id,' . $sort;
950
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
951
+                                    $sort = 'cat.rank,cat.id,'.$sort;
952 952
                                 }
953 953
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
954 954
                                 $rs = $modx->db->select($field, $from, $where, $sort);
@@ -957,37 +957,37 @@  discard block
 block discarded – undo
957 957
                         <!-- Template Variables -->' . "\n";
958 958
                                     if (!$group_tvs) {
959 959
                                         $templateVariables .= '
960
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
960
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
961 961
                                         <div class="sectionBody tmplvars">
962 962
                                             <table>';
963 963
                                     } else if ($group_tvs == 2) {
964 964
                                         $templateVariables .= '
965 965
                     <div class="tab-section">
966
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
966
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
967 967
                         <div class="tab-pane" id="paneTemplateVariables">
968 968
                             <script type="text/javascript">
969
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
969
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
970 970
                             </script>';
971 971
                                     } else if ($group_tvs == 3) {
972 972
                                         $templateVariables .= '
973 973
                         <div id="templateVariables" class="tab-page tmplvars">
974
-                            <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
974
+                            <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
975 975
                             <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>';
976 976
                                     } else if ($group_tvs == 4) {
977 977
                                         $templateVariables .= '
978 978
                     <div id="templateVariables" class="tab-page tmplvars">
979
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
979
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
980 980
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
981 981
                         
982 982
                         <div class="tab-pane" id="paneTemplateVariables">
983 983
                             <script type="text/javascript">
984
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
984
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
985 985
                             </script>';
986 986
                                     }
987 987
 
988 988
                                     $tvsArray = $modx->db->makeArray($rs, 'name');
989
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php');
990
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
989
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php');
990
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
991 991
                                     $i = 0;
992 992
                                     $tab = '';
993 993
                                     foreach ($tvsArray as $row) {
@@ -995,8 +995,8 @@  discard block
 block discarded – undo
995 995
                                             if ($group_tvs == 1 || $group_tvs == 3) {
996 996
                                                 if ($i === 0) {
997 997
                                                     $templateVariables .= '
998
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
999
-                                <div class="tab-header">' . $row['category'] . '</div>
998
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
999
+                                <div class="tab-header">' . $row['category'].'</div>
1000 1000
                                 <div class="tab-body tmplvars">
1001 1001
                                     <table>' . "\n";
1002 1002
                                                 } else {
@@ -1005,17 +1005,17 @@  discard block
 block discarded – undo
1005 1005
                                 </div>
1006 1006
                             </div>
1007 1007
                             
1008
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
1009
-                                <div class="tab-header">' . $row['category'] . '</div>
1008
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
1009
+                                <div class="tab-header">' . $row['category'].'</div>
1010 1010
                                 <div class="tab-body tmplvars">
1011 1011
                                     <table>';
1012 1012
                                                 }
1013 1013
                                             } else if ($group_tvs == 2 || $group_tvs == 4) {
1014 1014
                                                 if ($i === 0) {
1015 1015
                                                     $templateVariables .= '
1016
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1017
-                                <h2 class="tab">' . $row['category'] . '</h2>
1018
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1016
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1017
+                                <h2 class="tab">' . $row['category'].'</h2>
1018
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1019 1019
                                 
1020 1020
                                 <div class="tab-body tmplvars">
1021 1021
                                     <table>';
@@ -1025,9 +1025,9 @@  discard block
 block discarded – undo
1025 1025
                                 </div>
1026 1026
                             </div>
1027 1027
                             
1028
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1029
-                                <h2 class="tab">' . $row['category'] . '</h2>
1030
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1028
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1029
+                                <h2 class="tab">' . $row['category'].'</h2>
1030
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1031 1031
                                 
1032 1032
                                 <div class="tab-body tmplvars">
1033 1033
                                     <table>';
@@ -1035,18 +1035,18 @@  discard block
 block discarded – undo
1035 1035
                                             } else if ($group_tvs == 5) {
1036 1036
                                                 if ($i === 0) {
1037 1037
                                                     $templateVariables .= '
1038
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1039
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1040
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1038
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1039
+                                    <h2 class="tab">' . $row['category'].'</h2>
1040
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1041 1041
                                     <table>';
1042 1042
                                                 } else {
1043 1043
                                                     $templateVariables .= '
1044 1044
                                     </table>
1045 1045
                                 </div>
1046 1046
                                 
1047
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1048
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1049
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1047
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1048
+                                    <h2 class="tab">' . $row['category'].'</h2>
1049
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1050 1050
                                     
1051 1051
                                     <table>';
1052 1052
                                                 }
@@ -1064,8 +1064,8 @@  discard block
 block discarded – undo
1064 1064
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1065 1065
                                             };
1066 1066
                                             // Add richtext editor to the list
1067
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1068
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1067
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1068
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1069 1069
                                         }
1070 1070
                                         // splitter
1071 1071
                                         if ($group_tvs) {
@@ -1079,24 +1079,24 @@  discard block
 block discarded – undo
1079 1079
                                         }
1080 1080
 
1081 1081
                                         // post back value
1082
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1083
-                                            if (is_array($_POST['tv' . $row['id']])) {
1084
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1082
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1083
+                                            if (is_array($_POST['tv'.$row['id']])) {
1084
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1085 1085
                                             } else {
1086
-                                                $tvPBV = $_POST['tv' . $row['id']];
1086
+                                                $tvPBV = $_POST['tv'.$row['id']];
1087 1087
                                             }
1088 1088
                                         } else {
1089 1089
                                             $tvPBV = $row['value'];
1090 1090
                                         }
1091 1091
 
1092
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1093
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1094
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1092
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1093
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1094
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1095 1095
 
1096 1096
                                         $templateVariables .= '
1097 1097
                                         <tr>
1098
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1099
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1098
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1099
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1100 1100
                                         </tr>';
1101 1101
 
1102 1102
                                         $tab = $row['category_id'];
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 								<?php
1192 1192
 
1193
-								if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1193
+								if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1194 1194
 									?>
1195 1195
 									<tr>
1196 1196
 										<td>
@@ -1213,13 +1213,13 @@  discard block
 block discarded – undo
1213 1213
 										<td>
1214 1214
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1215 1215
 												<?php
1216
-												if(!$content['contentType']) {
1216
+												if (!$content['contentType']) {
1217 1217
 													$content['contentType'] = 'text/html';
1218 1218
 												}
1219 1219
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1220 1220
 												$ct = explode(",", $custom_contenttype);
1221
-												for($i = 0; $i < count($ct); $i++) {
1222
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1221
+												for ($i = 0; $i < count($ct); $i++) {
1222
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1223 1223
 												}
1224 1224
 												?>
1225 1225
 											</select>
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 									</tr>
1246 1246
 									<?php
1247 1247
 								} else {
1248
-									if($content['type'] != 'reference' && $modx->manager->action != '72') {
1248
+									if ($content['type'] != 'reference' && $modx->manager->action != '72') {
1249 1249
 										// non-admin managers creating or editing a document resource
1250 1250
 										?>
1251 1251
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1345,15 +1345,15 @@  discard block
 block discarded – undo
1345 1345
 						<?php
1346 1346
 					/*******************************
1347 1347
 					 * Document Access Permissions */
1348
-					if($use_udperms == 1) {
1348
+					if ($use_udperms == 1) {
1349 1349
 						$groupsarray = array();
1350 1350
 						$sql = '';
1351 1351
 
1352 1352
 						$documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1353
-						if($documentId > 0) {
1353
+						if ($documentId > 0) {
1354 1354
 							// Load up, the permissions from the parent (if new document) or existing document
1355 1355
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1356
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1356
+							while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1357 1357
 
1358 1358
 							// Load up the current permissions and names
1359 1359
 							$vs = array(
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
 						}
1370 1370
 
1371 1371
 						// retain selected doc groups between post
1372
-						if(isset($_POST['docgroups'])) {
1372
+						if (isset($_POST['docgroups'])) {
1373 1373
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1374 1374
 						}
1375 1375
 
@@ -1388,26 +1388,26 @@  discard block
 block discarded – undo
1388 1388
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1389 1389
 
1390 1390
 						// Loop through the permissions list
1391
-						while($row = $modx->db->getRow($rs)) {
1391
+						while ($row = $modx->db->getRow($rs)) {
1392 1392
 
1393 1393
 							// Create an inputValue pair (group ID and group link (if it exists))
1394
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1395
-							$inputId = 'group-' . $row['id'];
1394
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1395
+							$inputId = 'group-'.$row['id'];
1396 1396
 
1397 1397
 							$checked = in_array($inputValue, $groupsarray);
1398
-							if($checked) {
1398
+							if ($checked) {
1399 1399
 								$notPublic = true;
1400 1400
 							} // Mark as private access (either web or manager)
1401 1401
 
1402 1402
 							// Skip the access permission if the user doesn't have access...
1403
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1403
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1404 1404
 								continue;
1405 1405
 							}
1406 1406
 
1407 1407
 							// Setup attributes for this Input box
1408 1408
 							$inputAttributes['id'] = $inputId;
1409 1409
 							$inputAttributes['value'] = $inputValue;
1410
-							if($checked) {
1410
+							if ($checked) {
1411 1411
 								$inputAttributes['checked'] = 'checked';
1412 1412
 							} else {
1413 1413
 								unset($inputAttributes['checked']);
@@ -1415,10 +1415,10 @@  discard block
 block discarded – undo
1415 1415
 
1416 1416
 							// Create attribute string list
1417 1417
 							$inputString = array();
1418
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1418
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1419 1419
 
1420 1420
 							// Make the <input> HTML
1421
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1421
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1422 1422
 
1423 1423
 							// does user have this permission?
1424 1424
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1429,23 +1429,23 @@  discard block
 block discarded – undo
1429 1429
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1430 1430
 							$rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1431 1431
 							$count = $modx->db->getValue($rsp);
1432
-							if($count > 0) {
1432
+							if ($count > 0) {
1433 1433
 								++$permissions_yes;
1434 1434
 							} else {
1435 1435
 								++$permissions_no;
1436 1436
 							}
1437
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1437
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1438 1438
 						}
1439 1439
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1440
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1440
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1441 1441
 							$permissions = array();
1442 1442
 						}
1443 1443
 
1444 1444
 						// See if the Access Permissions section is worth displaying...
1445
-						if(!empty($permissions)) {
1445
+						if (!empty($permissions)) {
1446 1446
 							// Add the "All Document Groups" item if we have rights in both contexts
1447
-							if($isManager && $isWeb) {
1448
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1447
+							if ($isManager && $isWeb) {
1448
+								array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>');
1449 1449
 							}
1450 1450
 							// Output the permissions list...
1451 1451
 							?>
@@ -1478,12 +1478,12 @@  discard block
 block discarded – undo
1478 1478
 								</script>
1479 1479
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1480 1480
 								<ul>
1481
-									<?= implode("\n", $permissions) . "\n" ?>
1481
+									<?= implode("\n", $permissions)."\n" ?>
1482 1482
 								</ul>
1483 1483
 							</div><!--div class="tab-page" id="tabAccess"-->
1484 1484
 							<?php
1485 1485
 						} // !empty($permissions)
1486
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1486
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1487 1487
 							?>
1488 1488
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1489 1489
 							<?php
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 						'template' => $content['template']
1504 1504
 					));
1505 1505
 
1506
-					if(is_array($evtOut)) {
1506
+					if (is_array($evtOut)) {
1507 1507
 						echo implode('', $evtOut);
1508 1508
 					}
1509 1509
 					?>
@@ -1516,16 +1516,16 @@  discard block
 block discarded – undo
1516 1516
 		storeCurTemplate();
1517 1517
 	</script>
1518 1518
 <?php
1519
-if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1520
-	if(is_array($richtexteditorIds)) {
1521
-		foreach($richtexteditorIds as $editor => $elements) {
1519
+if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1520
+	if (is_array($richtexteditorIds)) {
1521
+		foreach ($richtexteditorIds as $editor => $elements) {
1522 1522
 			// invoke OnRichTextEditorInit event
1523 1523
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1524 1524
 				'editor' => $editor,
1525 1525
 				'elements' => $elements,
1526 1526
 				'options' => $richtexteditorOptions[$editor]
1527 1527
 			));
1528
-			if(is_array($evtOut)) {
1528
+			if (is_array($evtOut)) {
1529 1529
 				echo implode('', $evtOut);
1530 1530
 			}
1531 1531
 		}
@@ -1535,37 +1535,37 @@  discard block
 block discarded – undo
1535 1535
 /**
1536 1536
  * @return string
1537 1537
  */
1538
-function getDefaultTemplate() {
1538
+function getDefaultTemplate(){
1539 1539
 	global $modx;
1540 1540
 
1541 1541
     $default_template = '';
1542
-	switch($modx->config['auto_template_logic']) {
1542
+	switch ($modx->config['auto_template_logic']) {
1543 1543
 		case 'sibling':
1544
-			if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1544
+			if (!isset($_GET['pid']) || empty($_GET['pid'])) {
1545 1545
 				$site_start = $modx->config['site_start'];
1546 1546
 				$where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1547 1547
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1548
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1548
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1549 1549
 					$default_template = $sibl[0]['template'];
1550 1550
 				}
1551 1551
 			} else {
1552 1552
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1553
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1553
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1554 1554
 					$default_template = $sibl[0]['template'];
1555 1555
 				} else {
1556 1556
 					$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1557
-					if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1557
+					if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1558 1558
 						$default_template = $sibl[0]['template'];
1559 1559
 					}
1560 1560
 				}
1561 1561
 			}
1562
-			if(isset($default_template)) {
1562
+			if (isset($default_template)) {
1563 1563
 				break;
1564 1564
 			} // If $default_template could not be determined, fall back / through to "parent"-mode
1565 1565
 		case 'parent':
1566
-			if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1566
+			if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1567 1567
 				$parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1568
-				if(isset($parent['template'])) {
1568
+				if (isset($parent['template'])) {
1569 1569
 					$default_template = $parent['template'];
1570 1570
 				}
1571 1571
 			}
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('import_static')) {
5
+if (!$modx->hasPermission('import_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
46
+			if (!isset($_POST['import'])) {
47
+				echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>";
48 48
 				?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
 /**
105 105
  * @return string
106 106
  */
107
-function run() {
107
+function run(){
108 108
 	global $modx, $_lang;
109 109
 
110 110
 	$tbl_site_content = $modx->getFullTableName('site_content');
111 111
 	$output = '';
112 112
 	$maxtime = $_POST['maxtime'];
113 113
 
114
-	if(!is_numeric($maxtime)) {
114
+	if (!is_numeric($maxtime)) {
115 115
 		$maxtime = 30;
116 116
 	}
117 117
 
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	$mtime = $mtime[1] + $mtime[0];
123 123
 	$importstart = $mtime;
124 124
 
125
-	if($_POST['reset'] == 'on') {
125
+	if ($_POST['reset'] == 'on') {
126 126
 		$modx->db->truncate($tbl_site_content);
127 127
 		$modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
128 128
 	}
129 129
 
130
-	$parent = (int)$_POST['parent'];
130
+	$parent = (int) $_POST['parent'];
131 131
 
132
-	if(is_dir(MODX_BASE_PATH . 'temp/import')) {
133
-		$filedir = MODX_BASE_PATH . 'temp/import/';
134
-	} elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
135
-		$filedir = MODX_BASE_PATH . 'assets/import/';
132
+	if (is_dir(MODX_BASE_PATH.'temp/import')) {
133
+		$filedir = MODX_BASE_PATH.'temp/import/';
134
+	} elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
135
+		$filedir = MODX_BASE_PATH.'assets/import/';
136 136
 	} else {
137 137
         $filedir = '';
138 138
     }
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	$files = pop_index($files);
144 144
 
145 145
 	// no. of files to import
146
-	$output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
146
+	$output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
147 147
 
148 148
 	// import files
149
-	if(0 < count($files)) {
149
+	if (0 < count($files)) {
150 150
 		$modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
151 151
 		importFiles($parent, $filedir, $files, 'root');
152 152
 	}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	$mtime = $mtime[1] + $mtime[0];
157 157
 	$importend = $mtime;
158 158
 	$totaltime = ($importend - $importstart);
159
-	$output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
159
+	$output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
160 160
 
161
-	if($_POST['convert_link'] == 'on') {
161
+	if ($_POST['convert_link'] == 'on') {
162 162
 		convertLink();
163 163
 	}
164 164
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  * @param array $files
172 172
  * @param string $mode
173 173
  */
174
-function importFiles($parent, $filedir, $files, $mode) {
174
+function importFiles($parent, $filedir, $files, $mode){
175 175
 	global $modx;
176 176
 	global $_lang, $allowedfiles;
177 177
 	global $search_default, $cache_default, $publish_default;
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
 	$tbl_system_settings = $modx->getFullTableName('system_settings');
181 181
 
182 182
 	$createdby = $modx->getLoginUserID();
183
-	if(!is_array($files)) {
183
+	if (!is_array($files)) {
184 184
 		return;
185 185
 	}
186
-	if($_POST['object'] === 'all') {
186
+	if ($_POST['object'] === 'all') {
187 187
 		$modx->config['default_template'] = '0';
188 188
 		$richtext = '0';
189 189
 	} else {
190 190
 		$richtext = '1';
191 191
 	}
192 192
 
193
-	foreach($files as $id => $value) {
194
-		if(is_array($value)) {
193
+	foreach ($files as $id => $value) {
194
+		if (is_array($value)) {
195 195
 			// create folder
196 196
 			$alias = $id;
197
-			printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
197
+			printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
198 198
 			$field = array();
199 199
 			$field['type'] = 'document';
200 200
 			$field['contentType'] = 'text/html';
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
 			$field['isfolder'] = 1;
210 210
 			$field['menuindex'] = 1;
211 211
 			$find = false;
212
-			foreach(array(
212
+			foreach (array(
213 213
 						'index.html',
214 214
 						'index.htm'
215 215
 					) as $filename) {
216
-				$filepath = $filedir . $alias . '/' . $filename;
217
-				if($find === false && file_exists($filepath)) {
216
+				$filepath = $filedir.$alias.'/'.$filename;
217
+				if ($find === false && file_exists($filepath)) {
218 218
 					$file = getFileContent($filepath);
219 219
 					list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
220 220
 
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 					$field['createdon'] = $date;
227 227
 					$field['editedon'] = $date;
228 228
 					$newid = $modx->db->insert($field, $tbl_site_content);
229
-					if($newid) {
229
+					if ($newid) {
230 230
 						$find = true;
231
-						echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
232
-						importFiles($newid, $filedir . $alias . '/', $value, 'sub');
231
+						echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
232
+						importFiles($newid, $filedir.$alias.'/', $value, 'sub');
233 233
 					} else {
234
-						echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
234
+						echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
235 235
 						exit;
236 236
 					}
237 237
 				}
238 238
 			}
239
-			if($find === false) {
239
+			if ($find === false) {
240 240
 				$date = time();
241 241
 				$field['pagetitle'] = '---';
242 242
 				$field['content'] = '';
@@ -244,30 +244,30 @@  discard block
 block discarded – undo
244 244
 				$field['editedon'] = $date;
245 245
 				$field['hidemenu'] = '1';
246 246
 				$newid = $modx->db->insert($field, $tbl_site_content);
247
-				if($newid) {
247
+				if ($newid) {
248 248
 					$find = true;
249
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
250
-					importFiles($newid, $filedir . $alias . '/', $value, 'sub');
249
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
250
+					importFiles($newid, $filedir.$alias.'/', $value, 'sub');
251 251
 				} else {
252
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
252
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
253 253
 					exit;
254 254
 				}
255 255
 			}
256 256
 		} else {
257 257
 			// create document
258
-			if($mode == 'sub' && $value == 'index.html') {
258
+			if ($mode == 'sub' && $value == 'index.html') {
259 259
 				continue;
260 260
 			}
261 261
 			$filename = $value;
262 262
 			$fparts = explode('.', $value);
263 263
 			$alias = $fparts[0];
264 264
 			$ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
265
-			printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
265
+			printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
266 266
 
267
-			if(!in_array($ext, $allowedfiles)) {
268
-				echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
267
+			if (!in_array($ext, $allowedfiles)) {
268
+				echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
269 269
 			} else {
270
-				$filepath = $filedir . $filename;
270
+				$filepath = $filedir.$filename;
271 271
 				$file = getFileContent($filepath);
272 272
 				list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
273 273
 
@@ -292,18 +292,18 @@  discard block
 block discarded – undo
292 292
 				$field['isfolder'] = 0;
293 293
 				$field['menuindex'] = ($alias == 'index') ? 0 : 2;
294 294
 				$newid = $modx->db->insert($field, $tbl_site_content);
295
-				if($newid) {
296
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
295
+				if ($newid) {
296
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
297 297
 				} else {
298
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
298
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
299 299
 					exit;
300 300
 				}
301 301
 
302 302
 				$is_site_start = false;
303
-				if($filename == 'index.html') {
303
+				if ($filename == 'index.html') {
304 304
 					$is_site_start = true;
305 305
 				}
306
-				if($is_site_start == true && $_POST['reset'] == 'on') {
306
+				if ($is_site_start == true && $_POST['reset'] == 'on') {
307 307
 					$modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
308 308
 					$modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
309 309
 				}
@@ -318,26 +318,26 @@  discard block
 block discarded – undo
318 318
  * @param int $count
319 319
  * @return array
320 320
  */
321
-function getFiles($directory, $listing = array(), $count = 0) {
321
+function getFiles($directory, $listing = array(), $count = 0){
322 322
 	global $_lang;
323 323
 	global $filesfound;
324 324
 	$dummy = $count;
325
-	if( ! empty($directory) && $files = scandir($directory)) {
326
-		foreach($files as $file) {
327
-			if($file == '.' || $file == '..') {
325
+	if (!empty($directory) && $files = scandir($directory)) {
326
+		foreach ($files as $file) {
327
+			if ($file == '.' || $file == '..') {
328 328
 				continue;
329
-			} elseif($h = @opendir($directory . $file . "/")) {
329
+			} elseif ($h = @opendir($directory.$file."/")) {
330 330
 				closedir($h);
331 331
 				$count = -1;
332
-				$listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
333
-			} elseif(strpos($file, '.htm') !== false) {
332
+				$listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
333
+			} elseif (strpos($file, '.htm') !== false) {
334 334
 				$listing[$dummy] = $file;
335 335
 				$dummy = $dummy + 1;
336 336
 				$filesfound++;
337 337
 			}
338 338
 		}
339 339
 	} else {
340
-		echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
340
+		echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
341 341
 	}
342 342
 	return ($listing);
343 343
 }
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
  * @param string $filepath
347 347
  * @return bool|string
348 348
  */
349
-function getFileContent($filepath) {
349
+function getFileContent($filepath){
350 350
 	global $_lang;
351 351
 	// get the file
352
-	if(!$buffer = file_get_contents($filepath)) {
353
-		echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
352
+	if (!$buffer = file_get_contents($filepath)) {
353
+		echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
354 354
 	} else {
355 355
 		return $buffer;
356 356
 	}
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
  * @param array $array
361 361
  * @return array
362 362
  */
363
-function pop_index($array) {
363
+function pop_index($array){
364 364
 	$new_array = array();
365
-	foreach($array as $k => $v) {
366
-		if($v !== 'index.html' && $v !== 'index.htm') {
365
+	foreach ($array as $k => $v) {
366
+		if ($v !== 'index.html' && $v !== 'index.htm') {
367 367
 			$new_array[$k] = $v;
368 368
 		} else {
369 369
 			array_unshift($new_array, $v);
370 370
 		}
371 371
 	}
372
-	foreach($array as $k => $v) {
373
-		if(is_array($v)) {
372
+	foreach ($array as $k => $v) {
373
+		if (is_array($v)) {
374 374
 			$new_array[$k] = $v;
375 375
 		}
376 376
 	}
@@ -383,34 +383,34 @@  discard block
 block discarded – undo
383 383
  * @param string $alias
384 384
  * @return array
385 385
  */
386
-function treatContent($src, $filename, $alias) {
386
+function treatContent($src, $filename, $alias){
387 387
 	global $modx;
388 388
 
389 389
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
390 390
 
391
-	if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
391
+	if (preg_match("@<title>(.*)</title>@i", $src, $matches)) {
392 392
 		$pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
393 393
 		$pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
394 394
 	} else {
395 395
 		$pagetitle = $alias;
396 396
 	}
397
-	if(!$pagetitle) {
397
+	if (!$pagetitle) {
398 398
 		$pagetitle = $alias;
399 399
 	}
400 400
 
401
-	if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
401
+	if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
402 402
 		$description = ($matches[1] !== '') ? $matches[1] : $filename;
403 403
 		$description = str_replace('[*description*]', '', $description);
404 404
 	} else {
405 405
 		$description = '';
406 406
 	}
407 407
 
408
-	if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
408
+	if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
409 409
 		$content = $matches[1];
410 410
 	} else {
411 411
 		$content = $src;
412 412
 		$s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
413
-		$r = '$1' . $modx->config['modx_charset'] . '$2';
413
+		$r = '$1'.$modx->config['modx_charset'].'$2';
414 414
 		$content = preg_replace($s, $r, $content);
415 415
 		$content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
416 416
 	}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 /**
428 428
  * @return void
429 429
  */
430
-function convertLink() {
430
+function convertLink(){
431 431
 	global $modx;
432 432
 	$tbl_site_content = $modx->getFullTableName('site_content');
433 433
 
@@ -435,33 +435,33 @@  discard block
 block discarded – undo
435 435
 	$p = array();
436 436
     $target = array();
437 437
 	$dir = '';
438
-	while($row = $modx->db->getRow($rs)) {
438
+	while ($row = $modx->db->getRow($rs)) {
439 439
 		$id = $row['id'];
440 440
 		$array = explode('<a href=', $row['content']);
441 441
 		$c = 0;
442
-		foreach($array as $v) {
443
-			if($v[0] === '"') {
442
+		foreach ($array as $v) {
443
+			if ($v[0] === '"') {
444 444
 				$v = substr($v, 1);
445 445
 				list($href, $v) = explode('"', $v, 2);
446 446
 				$_ = $href;
447
-				if(strpos($_, $modx->config['site_url']) !== false) {
448
-					$_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
447
+				if (strpos($_, $modx->config['site_url']) !== false) {
448
+					$_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
449 449
 				}
450
-				if($_[0] === '/') {
450
+				if ($_[0] === '/') {
451 451
 					$_ = substr($_, 1);
452 452
 				}
453 453
 				$_ = str_replace('/index.html', '.html', $_);
454 454
 				$level = substr_count($_, '../');
455
-				if(1 < $level) {
456
-					if(!isset($p[$id])) {
455
+				if (1 < $level) {
456
+					if (!isset($p[$id])) {
457 457
 						$p[$id] = $modx->getParentIds($id);
458 458
 					}
459 459
 					$k = array_keys($p[$id]);
460
-					while(0 < $level) {
460
+					while (0 < $level) {
461 461
 						$dir = array_shift($k);
462 462
 						$level--;
463 463
 					}
464
-					if($dir != '') {
464
+					if ($dir != '') {
465 465
 						$dir .= '/';
466 466
 					}
467 467
 				} else {
@@ -469,18 +469,18 @@  discard block
 block discarded – undo
469 469
 				}
470 470
 
471 471
 				$_ = trim($_, './');
472
-				if(strpos($_, '/') !== false) {
472
+				if (strpos($_, '/') !== false) {
473 473
 					$_ = substr($_, strrpos($_, '/'));
474 474
 				}
475
-				$_ = $dir . str_replace('.html', '', $_);
476
-				if(!isset($target[$_])) {
475
+				$_ = $dir.str_replace('.html', '', $_);
476
+				if (!isset($target[$_])) {
477 477
 					$target[$_] = $modx->getIdFromAlias($_);
478 478
 				}
479 479
 				$target[$_] = trim($target[$_]);
480
-				if(!empty($target[$_])) {
481
-					$href = '[~' . $target[$_] . '~]';
480
+				if (!empty($target[$_])) {
481
+					$href = '[~'.$target[$_].'~]';
482 482
 				}
483
-				$array[$c] = '<a href="' . $href . '"' . $v;
483
+				$array[$c] = '<a href="'.$href.'"'.$v;
484 484
 			}
485 485
 			$c++;
486 486
 		}
Please login to merge, or discard this patch.
manager/actions/mutate_role.dynamic.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-switch((int) $modx->manager->action) {
6
+switch ((int) $modx->manager->action) {
7 7
 	case 35:
8
-		if(!$modx->hasPermission('edit_role')) {
8
+		if (!$modx->hasPermission('edit_role')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 38:
13
-		if(!$modx->hasPermission('new_role')) {
13
+		if (!$modx->hasPermission('new_role')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$role = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$role = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_user_roles = $modx->getFullTableName('user_roles');
24 24
 
25 25
 // check to see the snippet editor isn't locked
26
-if($lockedEl = $modx->elementIsLocked(8, $role)) {
26
+if ($lockedEl = $modx->elementIsLocked(8, $role)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['role']));
28 28
 }
29 29
 // end check for lock
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 // Lock snippet for other users to edit
32 32
 $modx->lockElement(8, $role);
33 33
 
34
-if($modx->manager->action == '35') {
34
+if ($modx->manager->action == '35') {
35 35
 	$rs = $modx->db->select('*', $tbl_user_roles, "id='{$role}'");
36 36
 	$roledata = $modx->db->getRow($rs);
37
-	if(!$roledata) {
37
+	if (!$roledata) {
38 38
 		$modx->webAlertAndQuit("No role returned!");
39 39
 	}
40 40
 	$_SESSION['itemname'] = $roledata['name'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 // Add lock-element JS-Script
47 47
 $lockElementId = $role;
48 48
 $lockElementType = 8;
49
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
49
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
50 50
 ?>
51 51
 	<script type="text/javascript">
52 52
 		function changestate(element) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		<input type="hidden" name="id" value="<?= $_GET['id'] ?>">
83 83
 
84 84
 		<h1>
85
-            <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'] . '<small>(' . $roledata['id'] . ')</small>' : $_lang['role_title']) ?>
85
+            <i class="fa fa-legal"></i><?= ($roledata['name'] ? $roledata['name'].'<small>('.$roledata['id'].')</small>' : $_lang['role_title']) ?>
86 86
         </h1>
87 87
 
88 88
 		<?= $_style['actionbuttons']['dynamic']['savedelete'] ?>
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  * @param string $status
300 300
  * @return string
301 301
  */
302
-function render_form($name, $label, $status = '') {
302
+function render_form($name, $label, $status = ''){
303 303
 	global $modx, $roledata;
304 304
 
305 305
 	$tpl = '<label class="d-block" for="[+name+]check">
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 
311 311
 	$checked = ($roledata[$name] == 1) ? 'checked' : '';
312 312
 	$value = ($roledata[$name] == 1) ? 1 : 0;
313
-	if($status == 'disabled') {
313
+	if ($status == 'disabled') {
314 314
 		$checked = 'checked';
315 315
 		$value = 1;
316 316
 		$set = 'fix';
Please login to merge, or discard this patch.
manager/includes/tmplvars.inc.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
  * @param array $tvsArray
13 13
  * @return string
14 14
  */
15
-function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()) {
15
+function renderFormElement($field_type, $field_id, $default_text = '', $field_elements = '', $field_value = '', $field_style = '', $row = array(), $tvsArray = array()){
16 16
 	global $modx;
17 17
 	global $_style;
18 18
 	global $_lang;
19 19
 	global $content;
20 20
 	global $which_browser;
21 21
 
22
-	if(substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
22
+	if (substr($default_text, 0, 6) === '@@EVAL' && $field_value === $default_text) {
23 23
 		$eval_str = trim(substr($default_text, 7));
24 24
 		$default_text = eval($eval_str);
25 25
 		$field_value = $default_text;
@@ -27,74 +27,74 @@  discard block
 block discarded – undo
27 27
 
28 28
 	$field_html = '';
29 29
 	$cimode = strpos($field_type, ':');
30
-	if($cimode === false) {
31
-		switch($field_type) {
30
+	if ($cimode === false) {
31
+		switch ($field_type) {
32 32
 
33 33
 			case "text": // handler for regular text boxes
34 34
 			case "rawtext"; // non-htmlentity converted text boxes
35
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
35
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
36 36
 				break;
37 37
 			case "email": // handles email input fields
38
-				$field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
38
+				$field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
39 39
 				break;
40 40
 			case "number": // handles the input of numbers
41
-				$field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
41
+				$field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
42 42
 				break;
43 43
 			case "textareamini": // handler for textarea mini boxes
44
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
44
+				$field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
45 45
 				break;
46 46
 			case "textarea": // handler for textarea boxes
47 47
 			case "rawtextarea": // non-htmlentity convertex textarea boxes
48 48
 			case "htmlarea": // handler for textarea boxes (deprecated)
49 49
 			case "richtext": // handler for textarea boxes
50
-				$field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
50
+				$field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
51 51
 				break;
52 52
 			case "date":
53 53
 				$field_id = str_replace(array(
54 54
 					'-',
55 55
 					'.'
56 56
 				), '_', urldecode($field_id));
57
-				if($field_value == '') {
57
+				if ($field_value == '') {
58 58
 					$field_value = 0;
59 59
 				}
60
-				$field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
61
-				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
60
+				$field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />';
61
+				$field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>';
62 62
 
63 63
 				break;
64 64
 			case "dropdown": // handler for select boxes
65
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
65
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
66 66
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
67
-				while(list($item, $itemvalue) = each($index_list)) {
67
+				while (list($item, $itemvalue) = each($index_list)) {
68 68
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
69
-					if(strlen($itemvalue) == 0) {
69
+					if (strlen($itemvalue) == 0) {
70 70
 						$itemvalue = $item;
71 71
 					}
72
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
72
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
73 73
 				}
74 74
 				$field_html .= "</select>";
75 75
 				break;
76 76
 			case "listbox": // handler for select boxes
77
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
77
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
78 78
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
79
-				while(list($item, $itemvalue) = each($index_list)) {
79
+				while (list($item, $itemvalue) = each($index_list)) {
80 80
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
81
-					if(strlen($itemvalue) == 0) {
81
+					if (strlen($itemvalue) == 0) {
82 82
 						$itemvalue = $item;
83 83
 					}
84
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
84
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
85 85
 				}
86 86
 				$field_html .= "</select>";
87 87
 				break;
88 88
 			case "listbox-multiple": // handler for select boxes where you can choose multiple items
89 89
 				$field_value = explode("||", $field_value);
90
-				$field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
90
+				$field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
91 91
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
92
-				while(list($item, $itemvalue) = each($index_list)) {
92
+				while (list($item, $itemvalue) = each($index_list)) {
93 93
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
94
-					if(strlen($itemvalue) == 0) {
94
+					if (strlen($itemvalue) == 0) {
95 95
 						$itemvalue = $item;
96 96
 					}
97
-					$field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue, $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
97
+					$field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue, $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
98 98
 				}
99 99
 				$field_html .= "</select>";
100 100
 				break;
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 					'ftp://' => 'ftp://',
107 107
 					'mailto:' => 'mailto:'
108 108
 				);
109
-				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
110
-				foreach($urls as $k => $v) {
111
-					if(strpos($field_value, $v) === false) {
112
-						$field_html .= '<option value="' . $v . '">' . $k . '</option>';
109
+				$field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">';
110
+				foreach ($urls as $k => $v) {
111
+					if (strpos($field_value, $v) === false) {
112
+						$field_html .= '<option value="'.$v.'">'.$k.'</option>';
113 113
 					} else {
114 114
 						$field_value = str_replace($v, '', $field_value);
115
-						$field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
115
+						$field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
116 116
 					}
117 117
 				}
118 118
 				$field_html .= '</select></td><td>';
119
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
119
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
120 120
 				break;
121 121
 			case 'checkbox': // handles check boxes
122 122
 				$values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 				$tpl = '<label class="checkbox"><input type="checkbox" value="%s" id="tv_%s" name="tv%s[]" %s onchange="documentDirty=true;" />%s</label><br />';
125 125
 				static $i = 0;
126 126
 				$_ = array();
127
-				foreach($index_list as $c => $item) {
128
-					if(is_array($item)) {
127
+				foreach ($index_list as $c => $item) {
128
+					if (is_array($item)) {
129 129
 						$name = trim($item[0]);
130 130
 						$value = isset($item[1]) ? $item[1] : $name;
131 131
 					} else {
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
151 151
 			case "option": // handles radio buttons
152 152
 				$index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform', $tvsArray));
153 153
 				static $i = 0;
154
-				while(list($item, $itemvalue) = each($index_list)) {
154
+				while (list($item, $itemvalue) = each($index_list)) {
155 155
 					list($item, $itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==", $itemvalue);
156
-					if(strlen($itemvalue) == 0) {
156
+					if (strlen($itemvalue) == 0) {
157 157
 						$itemvalue = $item;
158 158
 					}
159
-					$field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
159
+					$field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />';
160 160
 					$i++;
161 161
 				}
162 162
 				break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 				global $_lang;
165 165
 				global $ResourceManagerLoaded;
166 166
 				global $content, $use_editor, $which_editor;
167
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
167
+				if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
168 168
 					$field_html .= "
169 169
 						<script type=\"text/javascript\">
170 170
 							/* <![CDATA[ */
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
 									lastImageCtrl = ctrl;
187 187
 									var w = screen.width * 0.5;
188 188
 									var h = screen.height * 0.5;
189
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
189
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
190 190
 								}
191 191
 								function BrowseFileServer(ctrl) {
192 192
 									lastFileCtrl = ctrl;
193 193
 									var w = screen.width * 0.5;
194 194
 									var h = screen.height * 0.5;
195
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
195
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
196 196
 								}
197 197
 								function SetUrlChange(el) {
198 198
 									if ('createEvent' in document) {
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 						</script>";
227 227
 					$ResourceManagerLoaded = true;
228 228
 				}
229
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
229
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
230 230
 				break;
231 231
 			case "file": // handles the input of file uploads
232 232
 				/* Modified by Timon for use with resource browser */
233 233
 				global $_lang;
234 234
 				global $ResourceManagerLoaded;
235 235
 				global $content, $use_editor, $which_editor;
236
-				if(!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
236
+				if (!$ResourceManagerLoaded && !(($content['richtext'] == 1 || $modx->manager->action == 4) && $use_editor == 1 && $which_editor == 3)) {
237 237
 					/* I didn't understand the meaning of the condition above, so I left it untouched ;-) */
238 238
 					$field_html .= "
239 239
 						<script type=\"text/javascript\">
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 									lastImageCtrl = ctrl;
257 257
 									var w = screen.width * 0.5;
258 258
 									var h = screen.height * 0.5;
259
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
259
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
260 260
 								}
261 261
 								function BrowseFileServer(ctrl) {
262 262
 									lastFileCtrl = ctrl;
263 263
 									var w = screen.width * 0.5;
264 264
 									var h = screen.height * 0.5;
265
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
265
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
266 266
 								}
267 267
 								function SetUrlChange(el) {
268 268
 									if ('createEvent' in document) {
@@ -296,39 +296,39 @@  discard block
 block discarded – undo
296 296
 						</script>";
297 297
 					$ResourceManagerLoaded = true;
298 298
 				}
299
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
299
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />';
300 300
 
301 301
 				break;
302 302
 
303 303
 			case 'custom_tv':
304 304
 				$custom_output = '';
305 305
 				/* If we are loading a file */
306
-				if(substr($field_elements, 0, 5) == "@FILE") {
307
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
308
-					if(!file_exists($file_name)) {
309
-						$custom_output = $file_name . ' does not exist';
306
+				if (substr($field_elements, 0, 5) == "@FILE") {
307
+					$file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
308
+					if (!file_exists($file_name)) {
309
+						$custom_output = $file_name.' does not exist';
310 310
 					} else {
311 311
 						$custom_output = file_get_contents($file_name);
312 312
 					}
313
-				} elseif(substr($field_elements, 0, 8) == '@INCLUDE') {
314
-					$file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
315
-					if(!file_exists($file_name)) {
316
-						$custom_output = $file_name . ' does not exist';
313
+				} elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
314
+					$file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
315
+					if (!file_exists($file_name)) {
316
+						$custom_output = $file_name.' does not exist';
317 317
 					} else {
318 318
 						ob_start();
319 319
 						include $file_name;
320 320
 						$custom_output = ob_get_contents();
321 321
 						ob_end_clean();
322 322
 					}
323
-				} elseif(substr($field_elements, 0, 6) == "@CHUNK") {
323
+				} elseif (substr($field_elements, 0, 6) == "@CHUNK") {
324 324
 					$chunk_name = trim(substr($field_elements, 7));
325 325
 					$chunk_body = $modx->getChunk($chunk_name);
326
-					if($chunk_body == false) {
327
-						$custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
326
+					if ($chunk_body == false) {
327
+						$custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
328 328
 					} else {
329 329
 						$custom_output = $chunk_body;
330 330
 					}
331
-				} elseif(substr($field_elements, 0, 5) == "@EVAL") {
331
+				} elseif (substr($field_elements, 0, 5) == "@EVAL") {
332 332
 					$eval_str = trim(substr($field_elements, 6));
333 333
 					$custom_output = eval($eval_str);
334 334
 				} else {
@@ -349,15 +349,15 @@  discard block
 block discarded – undo
349 349
 				break;
350 350
 
351 351
 			default: // the default handler -- for errors, mostly
352
-				$field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
352
+				$field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
353 353
 
354 354
 		} // end switch statement
355 355
 	} else {
356 356
 		$custom = explode(":", $field_type);
357 357
 		$custom_output = '';
358
-		$file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
359
-		if(!file_exists($file_name)) {
360
-			$custom_output = $file_name . ' does not exist';
358
+		$file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
359
+		if (!file_exists($file_name)) {
360
+			$custom_output = $file_name.' does not exist';
361 361
 		} else {
362 362
 			ob_start();
363 363
 			include $file_name;
@@ -384,13 +384,13 @@  discard block
 block discarded – undo
384 384
  * @param string|array|mysqli_result $v
385 385
  * @return array
386 386
  */
387
-function ParseIntputOptions($v) {
387
+function ParseIntputOptions($v){
388 388
 	global $modx;
389 389
 	$a = array();
390
-	if(is_array($v)) {
390
+	if (is_array($v)) {
391 391
 		return $v;
392
-	} else if($modx->db->isResult($v)) {
393
-		while($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
392
+	} else if ($modx->db->isResult($v)) {
393
+		while ($cols = $modx->db->getRow($v, 'num')) $a[] = $cols;
394 394
 	} else {
395 395
 		$a = explode("||", $v);
396 396
 	}
Please login to merge, or discard this patch.
manager/includes/template.parser.class.inc.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,53 +7,53 @@  discard block
 block discarded – undo
7 7
  *
8 8
  */
9 9
 
10
-Class TemplateParser {
10
+Class TemplateParser{
11 11
 
12 12
     /**
13 13
 	 * @param array $config [action, tabs, toArray]
14 14
 	 * @param array $data
15 15
 	 * @return string
16 16
 	 */
17
-	public function output($config = array(), $data = array()) {
17
+	public function output($config = array(), $data = array()){
18 18
 		global $modx;
19 19
 
20 20
 		$output = '';
21 21
 		$action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : '');
22
-		$tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
22
+		$tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
23 23
 
24
-		if($action) {
24
+		if ($action) {
25 25
 			$sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
26
-			FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
27
-			INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
28
-			WHERE t1.action IN(' . $action . ') ' . $tab . '
26
+			FROM ' . $modx->getFullTableName('system_templates').' AS t1
27
+			INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category
28
+			WHERE t1.action IN(' . $action.') '.$tab.'
29 29
 			ORDER BY t1.tab ASC, t1.rank ASC');
30 30
 
31
-			if($modx->db->getRecordCount($sql)) {
31
+			if ($modx->db->getRecordCount($sql)) {
32 32
 				$tabs = array();
33
-				while($row = $modx->db->getRow($sql)) {
34
-					if(!$row['value'] && !empty($data[$row['name']])) {
33
+				while ($row = $modx->db->getRow($sql)) {
34
+					if (!$row['value'] && !empty($data[$row['name']])) {
35 35
 						$row['value'] = $data[$row['name']];
36 36
 					}
37 37
 					$tabs[$row['tab']]['category_name'] = $row['category_name'];
38 38
 					$tabs[$row['tab']][$row['name']] = TemplateParser::render($row);
39 39
 				}
40 40
 
41
-				if(!empty($config['toArray'])) {
41
+				if (!empty($config['toArray'])) {
42 42
 					$output = $tabs;
43 43
 				} else {
44
-					$output .= '<div class="tab-pane" id="pane_' . $action . '">';
44
+					$output .= '<div class="tab-pane" id="pane_'.$action.'">';
45 45
 					$output .= '
46 46
 					<script type="text/javascript">
47
-						var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
47
+						var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
48 48
 					</script>';
49 49
 
50
-					foreach($tabs as $idTab => $tab) {
51
-						$output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">';
50
+					foreach ($tabs as $idTab => $tab) {
51
+						$output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">';
52 52
 						$output .= '
53
-						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2>
54
-						<script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
53
+						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2>
54
+						<script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
55 55
 						unset($tab['category_name']);
56
-						foreach($tab as $item) {
56
+						foreach ($tab as $item) {
57 57
 							$output .= $item;
58 58
 						}
59 59
 						$output .= '</div>';
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param array $data
71 71
      * @return string
72 72
      */
73
-	private function render($data) {
73
+	private function render($data){
74 74
 		global $modx, $_lang, $_country_lang;
75 75
 
76 76
 		$data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 		$output = '';
81 81
 		$output .= '<div class="form-group row">';
82 82
 
83
-		switch($data['type']) {
83
+		switch ($data['type']) {
84 84
 
85 85
 			case 'text':
86 86
 				$output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 				$output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
115 115
 				$output .= '<div class="col-sm-7">';
116 116
 				$output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">';
117
-				if($data['name'] == 'country' && isset($_country_lang)) {
117
+				if ($data['name'] == 'country' && isset($_country_lang)) {
118 118
 					$chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country'];
119
-					$output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '>&nbsp;</option>';
120
-					foreach($_country_lang as $key => $value) {
121
-						$output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>';
119
+					$output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'>&nbsp;</option>';
120
+					foreach ($_country_lang as $key => $value) {
121
+						$output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>';
122 122
 					}
123 123
 				} else {
124
-					if($data['elements']) {
124
+					if ($data['elements']) {
125 125
 						$elements = explode('||', $data['elements']);
126
-						foreach($elements as $key => $value) {
126
+						foreach ($elements as $key => $value) {
127 127
 							$value = explode('==', $value);
128
-							$output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>';
128
+							$output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>';
129 129
 						}
130 130
 					}
131 131
 				}
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 				$output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
140 140
 				$output .= '<div class="col-sm-7">';
141 141
 				$output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
142
-				if($data['elements']) {
142
+				if ($data['elements']) {
143 143
 					$elements = explode('||', $data['elements']);
144
-					foreach($elements as $key => $value) {
144
+					foreach ($elements as $key => $value) {
145 145
 						$value = explode('==', $value);
146
-						$output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
146
+						$output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
147 147
 					}
148 148
 				}
149 149
 				$output .= $data['content'];
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 				$output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
156 156
 				$output .= '<div class="col-sm-7">';
157 157
 				$output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
158
-				if($data['elements']) {
158
+				if ($data['elements']) {
159 159
 					$elements = explode('||', $data['elements']);
160
-					foreach($elements as $key => $value) {
160
+					foreach ($elements as $key => $value) {
161 161
 						$value = explode('==', $value);
162
-						$output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
162
+						$output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
163 163
 					}
164 164
 				}
165 165
 				$output .= $data['content'];
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
         $action = "",
37 37
         $itemid = "",
38 38
         $itemname = ""
39
-    ) {
39
+    ){
40 40
         global $modx;
41 41
         $this->entry['msg'] = $msg; // writes testmessage to the object
42
-        $this->entry['action'] = empty($action) ? $modx->manager->action : $action;    // writes the action to the object
42
+        $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object
43 43
 
44 44
         // User Credentials
45 45
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
46 46
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
47 47
 
48
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
48
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
49 49
         if ($this->entry['itemId'] == 0) {
50 50
             $this->entry['itemId'] = "-";
51 51
         } // to stop items having id 0
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
         $fields['message'] = $modx->db->escape($this->entry['msg']);
94 94
         $insert_id = $modx->db->insert($fields, $tbl_manager_log);
95 95
         if (!$insert_id) {
96
-            $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->db->getLastError());
96
+            $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError());
97 97
         } else {
98
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
99
-            $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100;
98
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
99
+            $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
100 100
             if (($insert_id % $trim) === 0) {
101 101
                 $modx->rotate_log('manager_log', $limit, $trim);
102 102
             }
Please login to merge, or discard this patch.
manager/includes/extenders/manager.api.class.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -144,33 +144,33 @@  discard block
 block discarded – undo
144 144
             $algorithm = 'UNCRYPT';
145 145
         }
146 146
 
147
-        $salt = md5($password . $seed);
147
+        $salt = md5($password.$seed);
148 148
 
149 149
         switch ($algorithm) {
150 150
             case 'BLOWFISH_Y':
151
-                $salt = '$2y$07$' . substr($salt, 0, 22);
151
+                $salt = '$2y$07$'.substr($salt, 0, 22);
152 152
                 break;
153 153
             case 'BLOWFISH_A':
154
-                $salt = '$2a$07$' . substr($salt, 0, 22);
154
+                $salt = '$2a$07$'.substr($salt, 0, 22);
155 155
                 break;
156 156
             case 'SHA512':
157
-                $salt = '$6$' . substr($salt, 0, 16);
157
+                $salt = '$6$'.substr($salt, 0, 16);
158 158
                 break;
159 159
             case 'SHA256':
160
-                $salt = '$5$' . substr($salt, 0, 16);
160
+                $salt = '$5$'.substr($salt, 0, 16);
161 161
                 break;
162 162
             case 'MD5':
163
-                $salt = '$1$' . substr($salt, 0, 8);
163
+                $salt = '$1$'.substr($salt, 0, 8);
164 164
                 break;
165 165
         }
166 166
 
167 167
         if ($algorithm !== 'UNCRYPT') {
168
-            $password = sha1($password) . crypt($password, $salt);
168
+            $password = sha1($password).crypt($password, $salt);
169 169
         } else {
170
-            $password = sha1($salt . $password);
170
+            $password = sha1($salt.$password);
171 171
         }
172 172
 
173
-        $result = strtolower($algorithm) . '>' . md5($salt . $password) . substr(md5($salt), 0, 8);
173
+        $result = strtolower($algorithm).'>'.md5($salt.$password).substr(md5($salt), 0, 8);
174 174
 
175 175
         return $result;
176 176
     }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $check_files = explode("\n", $check_files);
253 253
         foreach ($check_files as $file) {
254 254
             $file = trim($file);
255
-            $file = MODX_BASE_PATH . $file;
255
+            $file = MODX_BASE_PATH.$file;
256 256
             if (!is_file($file)) {
257 257
                 continue;
258 258
             }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $checksum = unserialize($checksum);
276 276
         foreach ($check_files as $file) {
277 277
             $file = trim($file);
278
-            $filePath = MODX_BASE_PATH . $file;
278
+            $filePath = MODX_BASE_PATH.$file;
279 279
             if (!is_file($filePath)) {
280 280
                 continue;
281 281
             }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     {
295 295
         global $modx;
296 296
         $tbl_system_settings = $modx->getFullTableName('system_settings');
297
-        $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','" . $modx->db->escape($checksum) . "')";
297
+        $sql = "REPLACE INTO {$tbl_system_settings} (setting_name, setting_value) VALUES ('sys_files_checksum','".$modx->db->escape($checksum)."')";
298 298
         $modx->db->query($sql);
299 299
     }
300 300
 
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
             foreach ($settings as $key => $val) {
372 372
                 $f = array();
373 373
                 $f['user'] = $_SESSION['mgrInternalKey'];
374
-                $f['setting_name'] = '_LAST_' . $key;
374
+                $f['setting_name'] = '_LAST_'.$key;
375 375
                 $f['setting_value'] = $val;
376 376
                 $f = $modx->db->escape($f);
377
-                $f = "(`" . implode("`, `", array_keys($f)) . "`) VALUES('" . implode("', '", array_values($f)) . "')";
377
+                $f = "(`".implode("`, `", array_keys($f))."`) VALUES('".implode("', '", array_values($f))."')";
378 378
                 $f .= " ON DUPLICATE KEY UPDATE setting_value = VALUES(setting_value)";
379 379
                 $modx->db->insert($f, $modx->getFullTableName('user_settings'));
380 380
             }
Please login to merge, or discard this patch.
manager/includes/extenders/export.class.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $this->count = 0;
58 58
         $this->setUrlMode();
59 59
         $this->generate_mode = 'crawl';
60
-        $this->targetDir = $modx->config['base_path'] . 'temp/export';
60
+        $this->targetDir = $modx->config['base_path'].'temp/export';
61 61
         if (!isset($this->total)) {
62 62
             $this->getTotal();
63 63
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
         $ignore_ids = array_filter(array_map('intval', explode(',', $ignore_ids)));
114 114
         if (count($ignore_ids) > 0) {
115
-            $ignore_ids = "AND NOT id IN ('" . implode("','", $ignore_ids) . "')";
115
+            $ignore_ids = "AND NOT id IN ('".implode("','", $ignore_ids)."')";
116 116
         } else {
117 117
             $ignore_ids = '';
118 118
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         $noncache = ($noncache == 1) ? '' : 'AND cacheable=1';
123 123
         $where = "deleted=0 AND ((published=1 AND type='document') OR (isfolder=1)) {$noncache} {$ignore_ids}";
124 124
         $rs = $modx->db->select('count(id)', $tbl_site_content, $where);
125
-        $this->total = (int)$modx->db->getValue($rs);
125
+        $this->total = (int) $modx->db->getValue($rs);
126 126
 
127 127
         return $this->total;
128 128
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         } elseif (!is_readable($directory)) {
152 152
             return $rs;
153 153
         } else {
154
-            $files = glob($directory . '/*');
154
+            $files = glob($directory.'/*');
155 155
             if (!empty($files)) {
156 156
                 foreach ($files as $path) {
157 157
                     $rs = is_dir($path) ? $this->removeDirectoryAll($path) : unlink($path);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
             $_lang = $back_lang;
182 182
         } else {
183
-            $src = $this->curl_get_contents(MODX_SITE_URL . "index.php?id={$docid}");
183
+            $src = $this->curl_get_contents(MODX_SITE_URL."index.php?id={$docid}");
184 184
         }
185 185
 
186 186
 
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
         global $modx;
216 216
 
217 217
         if ($alias === '') {
218
-            $filename = $prefix . $docid . $suffix;
218
+            $filename = $prefix.$docid.$suffix;
219 219
         } else {
220 220
             if ($modx->config['suffix_mode'] === '1' && strpos($alias, '.') !== false) {
221 221
                 $suffix = '';
222 222
             }
223
-            $filename = $prefix . $alias . $suffix;
223
+            $filename = $prefix.$alias.$suffix;
224 224
         }
225 225
 
226 226
         return $filename;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         $tbl_site_content = $modx->getFullTableName('site_content');
239 239
 
240 240
         $ignore_ids = $this->ignore_ids;
241
-        $dirpath = $this->targetDir . '/';
241
+        $dirpath = $this->targetDir.'/';
242 242
 
243 243
         $prefix = $modx->config['friendly_url_prefix'];
244 244
         $suffix = $modx->config['friendly_url_suffix'];
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
         $ph['status'] = 'fail';
250 250
         $ph['msg1'] = $_lang['export_site_failed'];
251
-        $ph['msg2'] = $_lang["export_site_failed_no_write"] . ' - ' . $dirpath;
251
+        $ph['msg2'] = $_lang["export_site_failed_no_write"].' - '.$dirpath;
252 252
         $msg_failed_no_write = $this->parsePlaceholder($tpl, $ph);
253 253
 
254 254
         $ph['msg2'] = $_lang["export_site_failed_no_retrieve"];
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
             if (!$row['wasNull']) { // needs writing a document
283 283
                 $docname = $this->getFileName($row['id'], $row['alias'], $prefix, $suffix);
284
-                $filename = $dirpath . $docname;
284
+                $filename = $dirpath.$docname;
285 285
                 if (!is_file($filename)) {
286 286
                     if ($row['published'] === '1') {
287 287
                         $status = $this->makeFile($row['id'], $filename);
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             if ($row['isfolder'] === '1' && ($modx->config['suffix_mode'] !== '1' || strpos($row['alias'],
310 310
                         '.') === false)) { // needs making a folder
311 311
                 $end_dir = ($row['alias'] !== '') ? $row['alias'] : $row['id'];
312
-                $dir_path = $dirpath . $end_dir;
312
+                $dir_path = $dirpath.$end_dir;
313 313
                 if (strpos($dir_path, MODX_BASE_PATH) === false) {
314 314
                     return false;
315 315
                 }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 
326 326
                 if ($modx->config['make_folders'] === '1' && $row['published'] === '1') {
327 327
                     if (!empty($filename) && is_file($filename)) {
328
-                        rename($filename, $dir_path . '/index.html');
328
+                        rename($filename, $dir_path.'/index.html');
329 329
                     }
330 330
                 }
331 331
                 $this->targetDir = $dir_path;
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 
350 350
         $ch = curl_init();
351 351
         curl_setopt($ch, CURLOPT_URL, $url);
352
-        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);    // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT
353
-        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);    // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER
352
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // 0 = DO NOT VERIFY AUTHENTICITY OF SSL-CERT
353
+        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // 2 = CERT MUST INDICATE BEING CONNECTED TO RIGHT SERVER
354 354
         curl_setopt($ch, CURLOPT_HEADER, false);
355 355
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
356 356
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
Please login to merge, or discard this patch.