@@ -1,13 +1,13 @@ discard block |
||
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 | if (!$modx->hasPermission('save_plugin') && !$modx->hasPermission('save_snippet') && !$modx->hasPermission('save_template') && !$modx->hasPermission('save_module')) { |
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['catId'])? (int)$_GET['catId'] : 0; |
|
10 | -if ($id==0) { |
|
9 | +$id = isset($_GET['catId']) ? (int) $_GET['catId'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -19,5 +19,5 @@ discard block |
||
19 | 19 | deleteCategory($id); |
20 | 20 | |
21 | 21 | // finished emptying cache - redirect |
22 | -$header="Location: index.php?a=76"; |
|
22 | +$header = "Location: index.php?a=76"; |
|
23 | 23 | header($header); |
@@ -3,17 +3,17 @@ discard block |
||
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 | if(!$modx->hasPermission('delete_user')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the user, but first check if we are deleting our own record |
15 | 15 | if($id==$modx->getLoginUserID()) { |
16 | - $modx->webAlertAndQuit("You can't delete yourself!"); |
|
16 | + $modx->webAlertAndQuit("You can't delete yourself!"); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Set the item name for logger |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | // invoke OnBeforeUserFormDelete event |
24 | 24 | $modx->invokeEvent("OnBeforeUserFormDelete", |
25 | - array( |
|
26 | - "id" => $id |
|
27 | - )); |
|
25 | + array( |
|
26 | + "id" => $id |
|
27 | + )); |
|
28 | 28 | |
29 | 29 | // delete the user. |
30 | 30 | $modx->db->delete($modx->getFullTableName('manager_users'), "id='{$id}'"); |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | // invoke OnManagerDeleteUser event |
41 | 41 | $modx->invokeEvent("OnManagerDeleteUser", |
42 | - array( |
|
43 | - "userid" => $id, |
|
44 | - "username" => $username |
|
45 | - )); |
|
42 | + array( |
|
43 | + "userid" => $id, |
|
44 | + "username" => $username |
|
45 | + )); |
|
46 | 46 | |
47 | 47 | // invoke OnUserFormDelete event |
48 | 48 | $modx->invokeEvent("OnUserFormDelete", |
49 | - array( |
|
50 | - "id" => $id |
|
51 | - )); |
|
49 | + array( |
|
50 | + "id" => $id |
|
51 | + )); |
|
52 | 52 | |
53 | 53 | $header="Location: index.php?a=75"; |
54 | 54 | header($header); |
@@ -1,18 +1,18 @@ discard block |
||
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('delete_user')) { |
|
5 | +if (!$modx->hasPermission('delete_user')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // delete the user, but first check if we are deleting our own record |
15 | -if($id==$modx->getLoginUserID()) { |
|
15 | +if ($id == $modx->getLoginUserID()) { |
|
16 | 16 | $modx->webAlertAndQuit("You can't delete yourself!"); |
17 | 17 | } |
18 | 18 | |
@@ -50,5 +50,5 @@ discard block |
||
50 | 50 | "id" => $id |
51 | 51 | )); |
52 | 52 | |
53 | -$header="Location: index.php?a=75"; |
|
53 | +$header = "Location: index.php?a=75"; |
|
54 | 54 | header($header); |
@@ -3,12 +3,12 @@ discard block |
||
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 | if(!$modx->hasPermission('save_document')||!$modx->hasPermission('publish_document')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /************webber ********/ |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
34 | 34 | |
35 | 35 | if(!$udperms->checkPermissions()) { |
36 | - $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
36 | + $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // update the document |
40 | 40 | $modx->db->update( |
41 | - array( |
|
42 | - 'published' => 0, |
|
43 | - 'pub_date' => 0, |
|
44 | - 'unpub_date' => 0, |
|
45 | - 'editedby' => $modx->getLoginUserID(), |
|
46 | - 'editedon' => time(), |
|
47 | - 'publishedby' => 0, |
|
48 | - 'publishedon' => 0, |
|
49 | - ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
41 | + array( |
|
42 | + 'published' => 0, |
|
43 | + 'pub_date' => 0, |
|
44 | + 'unpub_date' => 0, |
|
45 | + 'editedby' => $modx->getLoginUserID(), |
|
46 | + 'editedon' => time(), |
|
47 | + 'publishedby' => 0, |
|
48 | + 'publishedon' => 0, |
|
49 | + ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
|
50 | 50 | |
51 | 51 | // invoke OnDocUnPublished event |
52 | 52 | $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
@@ -1,38 +1,38 @@ discard block |
||
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('save_document')||!$modx->hasPermission('publish_document')) { |
|
5 | +if (!$modx->hasPermission('save_document') || !$modx->hasPermission('publish_document')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
14 | 14 | /************webber ********/ |
15 | -$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | -$pid=($content['parent']==0?$id:$content['parent']); |
|
15 | +$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'")); |
|
16 | +$pid = ($content['parent'] == 0 ? $id : $content['parent']); |
|
17 | 17 | |
18 | 18 | /************** webber *************/ |
19 | -$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC'; |
|
20 | -$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon'; |
|
21 | -$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:''; |
|
22 | -$add_path=$sd.$sb.$pg; |
|
19 | +$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC'; |
|
20 | +$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon'; |
|
21 | +$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : ''; |
|
22 | +$add_path = $sd.$sb.$pg; |
|
23 | 23 | |
24 | 24 | /***********************************/ |
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | 28 | // check permissions on the document |
29 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
29 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
30 | 30 | $udperms = new udperms(); |
31 | 31 | $udperms->user = $modx->getLoginUserID(); |
32 | 32 | $udperms->document = $id; |
33 | 33 | $udperms->role = $_SESSION['mgrRole']; |
34 | 34 | |
35 | -if(!$udperms->checkPermissions()) { |
|
35 | +if (!$udperms->checkPermissions()) { |
|
36 | 36 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
37 | 37 | } |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ), $modx->getFullTableName('site_content'), "id='{$id}'"); |
50 | 50 | |
51 | 51 | // invoke OnDocUnPublished event |
52 | -$modx->invokeEvent("OnDocUnPublished",array("docid"=>$id)); |
|
52 | +$modx->invokeEvent("OnDocUnPublished", array("docid"=>$id)); |
|
53 | 53 | |
54 | 54 | // Set the item name for logger |
55 | 55 | $_SESSION['itemname'] = $content['pagetitle']; |
@@ -57,6 +57,6 @@ discard block |
||
57 | 57 | // empty cache |
58 | 58 | $modx->clearCache('full'); |
59 | 59 | |
60 | -$header="Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
60 | +$header = "Location: index.php?a=3&id=$pid&r=1".$add_path; |
|
61 | 61 | |
62 | 62 | header($header); |
@@ -3,12 +3,12 @@ discard block |
||
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 | if(!$modx->hasPermission('delete_module')) { |
6 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | $id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
10 | 10 | if($id==0) { |
11 | - $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
11 | + $modx->webAlertAndQuit($_lang["error_no_id"]); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Set the item name for logger |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | |
18 | 18 | // invoke OnBeforeModFormDelete event |
19 | 19 | $modx->invokeEvent("OnBeforeModFormDelete", |
20 | - array( |
|
21 | - "id" => $id |
|
22 | - )); |
|
20 | + array( |
|
21 | + "id" => $id |
|
22 | + )); |
|
23 | 23 | |
24 | 24 | // delete the module. |
25 | 25 | $modx->db->delete($modx->getFullTableName('site_modules'), "id='{$id}'"); |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | // invoke OnModFormDelete event |
34 | 34 | $modx->invokeEvent("OnModFormDelete", |
35 | - array( |
|
36 | - "id" => $id |
|
37 | - )); |
|
35 | + array( |
|
36 | + "id" => $id |
|
37 | + )); |
|
38 | 38 | |
39 | 39 | // empty cache |
40 | 40 | $modx->clearCache('full'); |
@@ -1,13 +1,13 @@ discard block |
||
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('delete_module')) { |
|
5 | +if (!$modx->hasPermission('delete_module')) { |
|
6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
7 | 7 | } |
8 | 8 | |
9 | -$id = isset($_GET['id'])? (int)$_GET['id'] : 0; |
|
10 | -if($id==0) { |
|
9 | +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; |
|
10 | +if ($id == 0) { |
|
11 | 11 | $modx->webAlertAndQuit($_lang["error_no_id"]); |
12 | 12 | } |
13 | 13 | |
@@ -40,5 +40,5 @@ discard block |
||
40 | 40 | $modx->clearCache('full'); |
41 | 41 | |
42 | 42 | // finished emptying cache - redirect |
43 | -$header="Location: index.php?a=106&r=2"; |
|
43 | +$header = "Location: index.php?a=106&r=2"; |
|
44 | 44 | header($header); |
@@ -1,128 +1,128 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
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 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | 14 | function parsePh($tpl, $ph) { |
15 | - global $modx, $_lang; |
|
16 | - $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
17 | - return $modx->parseText($tpl, $ph); |
|
15 | + global $modx, $_lang; |
|
16 | + $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
|
17 | + return $modx->parseText($tpl, $ph); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | function renderViewSwitchButtons($cssId) { |
21 | - global $modx, $_lang, $tpl; |
|
21 | + global $modx, $_lang, $tpl; |
|
22 | 22 | |
23 | - return parsePh($tpl['viewForm'], array( |
|
24 | - 'cssId' => $cssId |
|
25 | - )); |
|
23 | + return parsePh($tpl['viewForm'], array( |
|
24 | + 'cssId' => $cssId |
|
25 | + )); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | function createResourceList($resourceTable, $resources) { |
29 | - global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
30 | - |
|
31 | - $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
32 | - |
|
33 | - if( ! is_array($items) || empty($items)) { |
|
34 | - return $_lang['no_results']; |
|
35 | - } |
|
36 | - |
|
37 | - // Prepare elements- and categories-list |
|
38 | - $elements = array(); |
|
39 | - $categories = array(); |
|
40 | - foreach($items as $row) { |
|
41 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
42 | - $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
43 | - $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
44 | - } |
|
45 | - |
|
46 | - // Now render categories / panel-collapse |
|
47 | - $panelGroup = ''; |
|
48 | - foreach($elements as $catid => $elList) { |
|
49 | - // Add panel-heading / category-collapse to output |
|
50 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
51 | - 'tab' => $resourceTable, |
|
52 | - 'category' => $categories[$catid]['name'], |
|
53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
54 | - 'catid' => $catid, |
|
55 | - )); |
|
56 | - |
|
57 | - // Prepare content for panel-collapse |
|
58 | - $panelCollapse = ''; |
|
59 | - foreach($elList as $el) { |
|
60 | - $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
61 | - } |
|
62 | - |
|
63 | - // Add panel-collapse with elements to output |
|
64 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
65 | - 'tab' => $resourceTable, |
|
66 | - 'catid' => $catid, |
|
67 | - 'wrapper' => $panelCollapse, |
|
68 | - )); |
|
69 | - } |
|
70 | - |
|
71 | - return parsePh($tpl['panelGroup'], array( |
|
72 | - 'resourceTable' => $resourceTable, |
|
73 | - 'wrapper' => $panelGroup |
|
74 | - )); |
|
29 | + global $modx, $_lang, $_style, $modx_textdir, $tpl; |
|
30 | + |
|
31 | + $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
|
32 | + |
|
33 | + if( ! is_array($items) || empty($items)) { |
|
34 | + return $_lang['no_results']; |
|
35 | + } |
|
36 | + |
|
37 | + // Prepare elements- and categories-list |
|
38 | + $elements = array(); |
|
39 | + $categories = array(); |
|
40 | + foreach($items as $row) { |
|
41 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
42 | + $categories[$catid] = array('name' => stripslashes($row['category'])); |
|
43 | + $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
|
44 | + } |
|
45 | + |
|
46 | + // Now render categories / panel-collapse |
|
47 | + $panelGroup = ''; |
|
48 | + foreach($elements as $catid => $elList) { |
|
49 | + // Add panel-heading / category-collapse to output |
|
50 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
51 | + 'tab' => $resourceTable, |
|
52 | + 'category' => $categories[$catid]['name'], |
|
53 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
54 | + 'catid' => $catid, |
|
55 | + )); |
|
56 | + |
|
57 | + // Prepare content for panel-collapse |
|
58 | + $panelCollapse = ''; |
|
59 | + foreach($elList as $el) { |
|
60 | + $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
|
61 | + } |
|
62 | + |
|
63 | + // Add panel-collapse with elements to output |
|
64 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
65 | + 'tab' => $resourceTable, |
|
66 | + 'catid' => $catid, |
|
67 | + 'wrapper' => $panelCollapse, |
|
68 | + )); |
|
69 | + } |
|
70 | + |
|
71 | + return parsePh($tpl['panelGroup'], array( |
|
72 | + 'resourceTable' => $resourceTable, |
|
73 | + 'wrapper' => $panelGroup |
|
74 | + )); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | function createCombinedView($resources) { |
78 | - global $modx, $_lang, $_style, $modx_textdir; |
|
79 | - |
|
80 | - $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
81 | - $types = isset($resources->types) ? $resources->types : false; |
|
82 | - $categories = isset($resources->categories) ? $resources->categories : false; |
|
83 | - |
|
84 | - if(!$itemsPerCategory) { |
|
85 | - return $_lang['no_results']; |
|
86 | - } |
|
87 | - |
|
88 | - $tpl = array( |
|
89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
93 | - ); |
|
94 | - |
|
95 | - // Easily loop through $itemsPerCategory-Array |
|
96 | - $panelGroup = ''; |
|
97 | - foreach($categories as $catid => $category) { |
|
98 | - // Prepare collapse content / elements-list |
|
99 | - $panelCollapse = ''; |
|
100 | - foreach($itemsPerCategory[$catid] as $el) { |
|
101 | - $resourceTable = $el['type']; |
|
102 | - $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
103 | - $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
104 | - } |
|
105 | - |
|
106 | - // Add panel-heading / button |
|
107 | - $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
108 | - 'tab' => 'categories_list', |
|
109 | - 'category' => $categories[$catid], |
|
110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
111 | - 'catid' => $catid, |
|
112 | - )); |
|
113 | - |
|
114 | - // Add panel |
|
115 | - $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
116 | - 'tab' => 'categories_list', |
|
117 | - 'catid' => $catid, |
|
118 | - 'wrapper' => $panelCollapse, |
|
119 | - )); |
|
120 | - } |
|
121 | - |
|
122 | - return parsePh($tpl['panelGroup'], array( |
|
123 | - 'resourceTable' => 'categories_list', |
|
124 | - 'wrapper' => $panelGroup |
|
125 | - )); |
|
78 | + global $modx, $_lang, $_style, $modx_textdir; |
|
79 | + |
|
80 | + $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
|
81 | + $types = isset($resources->types) ? $resources->types : false; |
|
82 | + $categories = isset($resources->categories) ? $resources->categories : false; |
|
83 | + |
|
84 | + if(!$itemsPerCategory) { |
|
85 | + return $_lang['no_results']; |
|
86 | + } |
|
87 | + |
|
88 | + $tpl = array( |
|
89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
93 | + ); |
|
94 | + |
|
95 | + // Easily loop through $itemsPerCategory-Array |
|
96 | + $panelGroup = ''; |
|
97 | + foreach($categories as $catid => $category) { |
|
98 | + // Prepare collapse content / elements-list |
|
99 | + $panelCollapse = ''; |
|
100 | + foreach($itemsPerCategory[$catid] as $el) { |
|
101 | + $resourceTable = $el['type']; |
|
102 | + $ph = prepareElementRowPh($el, $resourceTable, $resources); |
|
103 | + $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
|
104 | + } |
|
105 | + |
|
106 | + // Add panel-heading / button |
|
107 | + $panelGroup .= parsePh($tpl['panelHeading'], array( |
|
108 | + 'tab' => 'categories_list', |
|
109 | + 'category' => $categories[$catid], |
|
110 | + 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
111 | + 'catid' => $catid, |
|
112 | + )); |
|
113 | + |
|
114 | + // Add panel |
|
115 | + $panelGroup .= parsePh($tpl['panelCollapse'], array( |
|
116 | + 'tab' => 'categories_list', |
|
117 | + 'catid' => $catid, |
|
118 | + 'wrapper' => $panelCollapse, |
|
119 | + )); |
|
120 | + } |
|
121 | + |
|
122 | + return parsePh($tpl['panelGroup'], array( |
|
123 | + 'resourceTable' => 'categories_list', |
|
124 | + 'wrapper' => $panelGroup |
|
125 | + )); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | * @return array |
133 | 133 | */ |
134 | 134 | function prepareElementRowPh($row, $resourceTable, $resources) { |
135 | - global $modx, $modx_textdir, $_style, $_lang; |
|
135 | + global $modx, $modx_textdir, $_style, $_lang; |
|
136 | 136 | |
137 | - $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
137 | + $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
|
138 | 138 | |
139 | - $_lang["confirm_delete"] = $_lang["delete"]; |
|
139 | + $_lang["confirm_delete"] = $_lang["delete"]; |
|
140 | 140 | |
141 | - switch($resourceTable){ |
|
141 | + switch($resourceTable){ |
|
142 | 142 | case 'site_templates': |
143 | 143 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
144 | 144 | $lockElementType = 1; |
@@ -172,77 +172,77 @@ discard block |
||
172 | 172 | return array(); |
173 | 173 | } |
174 | 174 | |
175 | - // Prepare displaying user-locks |
|
176 | - $lockedByUser = ''; |
|
177 | - $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
178 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | - if($rowLock['sid'] == $modx->sid) { |
|
180 | - $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
181 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
182 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
183 | - )); |
|
184 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
185 | - } else { |
|
186 | - $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
187 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
188 | - 'username' => $rowLock['username'], |
|
189 | - 'lasthit_df' => $rowLock['lasthit_df'] |
|
190 | - )); |
|
191 | - if($modx->hasPermission('remove_locks')) { |
|
192 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
193 | - } else { |
|
194 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
195 | - } |
|
196 | - } |
|
197 | - } |
|
198 | - if($lockedByUser) { |
|
199 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
200 | - } |
|
201 | - |
|
202 | - // Caption |
|
203 | - if($resourceTable == 'site_tmplvars') { |
|
204 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
205 | - } else { |
|
206 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
207 | - } |
|
208 | - |
|
209 | - // Special marks |
|
210 | - $tplInfo = array(); |
|
211 | - if($row['locked']) { |
|
212 | - $tplInfo[] = $_lang['locked']; |
|
213 | - } |
|
214 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | - $tplInfo[] = $_lang['defaulttemplate_title']; |
|
216 | - } |
|
217 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
218 | - |
|
219 | - /* row buttons */ |
|
220 | - $buttons = ''; |
|
221 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
223 | - } |
|
224 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
226 | - } |
|
227 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
229 | - } |
|
230 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
231 | - |
|
232 | - $catid = $row['catid'] ? $row['catid'] : 0; |
|
233 | - |
|
234 | - // Placeholders for elements-row |
|
235 | - return array( |
|
236 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
237 | - 'lockedByUser' => $lockedByUser, |
|
238 | - 'name' => $row['name'], |
|
239 | - 'caption' => $caption, |
|
240 | - 'buttons' => $buttons, |
|
241 | - 'marks' => $marks, |
|
242 | - 'id' => $row['id'], |
|
243 | - 'resourceTable' => $resourceTable, |
|
244 | - 'actionEdit' => $types['actions']['edit'][0], |
|
245 | - 'catid' => $catid, |
|
246 | - 'textdir' => $modx_textdir ? '‏' : '', |
|
247 | - ); |
|
175 | + // Prepare displaying user-locks |
|
176 | + $lockedByUser = ''; |
|
177 | + $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
|
178 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | + if($rowLock['sid'] == $modx->sid) { |
|
180 | + $title = $modx->parseText($_lang["lock_element_editing"], array( |
|
181 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
182 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
183 | + )); |
|
184 | + $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
185 | + } else { |
|
186 | + $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
|
187 | + 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
188 | + 'username' => $rowLock['username'], |
|
189 | + 'lasthit_df' => $rowLock['lasthit_df'] |
|
190 | + )); |
|
191 | + if($modx->hasPermission('remove_locks')) { |
|
192 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
193 | + } else { |
|
194 | + $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
195 | + } |
|
196 | + } |
|
197 | + } |
|
198 | + if($lockedByUser) { |
|
199 | + $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
200 | + } |
|
201 | + |
|
202 | + // Caption |
|
203 | + if($resourceTable == 'site_tmplvars') { |
|
204 | + $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
205 | + } else { |
|
206 | + $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
207 | + } |
|
208 | + |
|
209 | + // Special marks |
|
210 | + $tplInfo = array(); |
|
211 | + if($row['locked']) { |
|
212 | + $tplInfo[] = $_lang['locked']; |
|
213 | + } |
|
214 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | + $tplInfo[] = $_lang['defaulttemplate_title']; |
|
216 | + } |
|
217 | + $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
218 | + |
|
219 | + /* row buttons */ |
|
220 | + $buttons = ''; |
|
221 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | + $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
223 | + } |
|
224 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
226 | + } |
|
227 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | + $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
229 | + } |
|
230 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
231 | + |
|
232 | + $catid = $row['catid'] ? $row['catid'] : 0; |
|
233 | + |
|
234 | + // Placeholders for elements-row |
|
235 | + return array( |
|
236 | + 'class' => $class ? ' class="' . $class . '"' : '', |
|
237 | + 'lockedByUser' => $lockedByUser, |
|
238 | + 'name' => $row['name'], |
|
239 | + 'caption' => $caption, |
|
240 | + 'buttons' => $buttons, |
|
241 | + 'marks' => $marks, |
|
242 | + 'id' => $row['id'], |
|
243 | + 'resourceTable' => $resourceTable, |
|
244 | + 'actionEdit' => $types['actions']['edit'][0], |
|
245 | + 'catid' => $catid, |
|
246 | + 'textdir' => $modx_textdir ? '‏' : '', |
|
247 | + ); |
|
248 | 248 | } |
@@ -1,23 +1,23 @@ discard block |
||
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 | $tpl = array( |
7 | - 'viewForm' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_viewForm.tpl'), |
|
8 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
9 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
10 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
|
7 | + 'viewForm' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_viewForm.tpl'), |
|
8 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
9 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
10 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
11 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl') |
|
12 | 12 | ); |
13 | 13 | |
14 | -function parsePh($tpl, $ph) { |
|
14 | +function parsePh($tpl, $ph){ |
|
15 | 15 | global $modx, $_lang; |
16 | 16 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
17 | 17 | return $modx->parseText($tpl, $ph); |
18 | 18 | } |
19 | 19 | |
20 | -function renderViewSwitchButtons($cssId) { |
|
20 | +function renderViewSwitchButtons($cssId){ |
|
21 | 21 | global $modx, $_lang, $tpl; |
22 | 22 | |
23 | 23 | return parsePh($tpl['viewForm'], array( |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | )); |
26 | 26 | } |
27 | 27 | |
28 | -function createResourceList($resourceTable, $resources) { |
|
28 | +function createResourceList($resourceTable, $resources){ |
|
29 | 29 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
30 | 30 | |
31 | 31 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
32 | 32 | |
33 | - if( ! is_array($items) || empty($items)) { |
|
33 | + if (!is_array($items) || empty($items)) { |
|
34 | 34 | return $_lang['no_results']; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Prepare elements- and categories-list |
38 | 38 | $elements = array(); |
39 | 39 | $categories = array(); |
40 | - foreach($items as $row) { |
|
40 | + foreach ($items as $row) { |
|
41 | 41 | $catid = $row['catid'] ? $row['catid'] : 0; |
42 | 42 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
43 | 43 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -45,18 +45,18 @@ discard block |
||
45 | 45 | |
46 | 46 | // Now render categories / panel-collapse |
47 | 47 | $panelGroup = ''; |
48 | - foreach($elements as $catid => $elList) { |
|
48 | + foreach ($elements as $catid => $elList) { |
|
49 | 49 | // Add panel-heading / category-collapse to output |
50 | 50 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
51 | 51 | 'tab' => $resourceTable, |
52 | 52 | 'category' => $categories[$catid]['name'], |
53 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
53 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
54 | 54 | 'catid' => $catid, |
55 | 55 | )); |
56 | 56 | |
57 | 57 | // Prepare content for panel-collapse |
58 | 58 | $panelCollapse = ''; |
59 | - foreach($elList as $el) { |
|
59 | + foreach ($elList as $el) { |
|
60 | 60 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
61 | 61 | } |
62 | 62 | |
@@ -74,30 +74,30 @@ discard block |
||
74 | 74 | )); |
75 | 75 | } |
76 | 76 | |
77 | -function createCombinedView($resources) { |
|
77 | +function createCombinedView($resources){ |
|
78 | 78 | global $modx, $_lang, $_style, $modx_textdir; |
79 | 79 | |
80 | 80 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
81 | 81 | $types = isset($resources->types) ? $resources->types : false; |
82 | 82 | $categories = isset($resources->categories) ? $resources->categories : false; |
83 | 83 | |
84 | - if(!$itemsPerCategory) { |
|
84 | + if (!$itemsPerCategory) { |
|
85 | 85 | return $_lang['no_results']; |
86 | 86 | } |
87 | 87 | |
88 | 88 | $tpl = array( |
89 | - 'panelGroup' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelGroup.tpl'), |
|
90 | - 'panelHeading' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelHeading.tpl'), |
|
91 | - 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | - 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl'), |
|
89 | + 'panelGroup' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelGroup.tpl'), |
|
90 | + 'panelHeading' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelHeading.tpl'), |
|
91 | + 'panelCollapse' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_panelCollapse.tpl'), |
|
92 | + 'elementsRow' => file_get_contents(MODX_MANAGER_PATH.'actions/resources/tpl_elementsRow.tpl'), |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | // Easily loop through $itemsPerCategory-Array |
96 | 96 | $panelGroup = ''; |
97 | - foreach($categories as $catid => $category) { |
|
97 | + foreach ($categories as $catid => $category) { |
|
98 | 98 | // Prepare collapse content / elements-list |
99 | 99 | $panelCollapse = ''; |
100 | - foreach($itemsPerCategory[$catid] as $el) { |
|
100 | + foreach ($itemsPerCategory[$catid] as $el) { |
|
101 | 101 | $resourceTable = $el['type']; |
102 | 102 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
103 | 103 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
108 | 108 | 'tab' => 'categories_list', |
109 | 109 | 'category' => $categories[$catid], |
110 | - 'categoryid' => $catid != '' ? ' <small>(' . $catid . ')</small>' : '', |
|
110 | + 'categoryid' => $catid != '' ? ' <small>('.$catid.')</small>' : '', |
|
111 | 111 | 'catid' => $catid, |
112 | 112 | )); |
113 | 113 | |
@@ -131,14 +131,14 @@ discard block |
||
131 | 131 | * @param $resources |
132 | 132 | * @return array |
133 | 133 | */ |
134 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
134 | +function prepareElementRowPh($row, $resourceTable, $resources){ |
|
135 | 135 | global $modx, $modx_textdir, $_style, $_lang; |
136 | 136 | |
137 | 137 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
138 | 138 | |
139 | 139 | $_lang["confirm_delete"] = $_lang["delete"]; |
140 | 140 | |
141 | - switch($resourceTable){ |
|
141 | + switch ($resourceTable) { |
|
142 | 142 | case 'site_templates': |
143 | 143 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
144 | 144 | $lockElementType = 1; |
@@ -175,65 +175,65 @@ discard block |
||
175 | 175 | // Prepare displaying user-locks |
176 | 176 | $lockedByUser = ''; |
177 | 177 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
178 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | - if($rowLock['sid'] == $modx->sid) { |
|
178 | + if ($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | + if ($rowLock['sid'] == $modx->sid) { |
|
180 | 180 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
181 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
181 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
182 | 182 | 'lasthit_df' => $rowLock['lasthit_df'] |
183 | 183 | )); |
184 | - $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
|
184 | + $lockedByUser = '<span title="'.$title.'" class="editResource" style="cursor:context-menu;">'.$_style['tree_preview_resource'].'</span> '; |
|
185 | 185 | } else { |
186 | 186 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
187 | - 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
|
187 | + 'element_type' => $_lang["lock_element_type_".$lockElementType], |
|
188 | 188 | 'username' => $rowLock['username'], |
189 | 189 | 'lasthit_df' => $rowLock['lasthit_df'] |
190 | 190 | )); |
191 | - if($modx->hasPermission('remove_locks')) { |
|
192 | - $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
|
191 | + if ($modx->hasPermission('remove_locks')) { |
|
192 | + $lockedByUser = '<a href="javascript:;" onclick="unlockElement('.$lockElementType.', '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource"><i class="'.$_style['icons_secured'].'"></i></a>'; |
|
193 | 193 | } else { |
194 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
|
194 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource" style="cursor:context-menu;"><i class="'.$_style['icons_secured'].'"></i></span>'; |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | } |
198 | - if($lockedByUser) { |
|
199 | - $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
|
198 | + if ($lockedByUser) { |
|
199 | + $lockedByUser = '<div class="lockCell">'.$lockedByUser.'</div>'; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | // Caption |
203 | - if($resourceTable == 'site_tmplvars') { |
|
204 | - $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
|
203 | + if ($resourceTable == 'site_tmplvars') { |
|
204 | + $caption = !empty($row['description']) ? ' '.$row['caption'].' <small>('.$row['description'].')</small>' : ' '.$row['caption']; |
|
205 | 205 | } else { |
206 | - $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
|
206 | + $caption = !empty($row['description']) ? ' '.$row['description'] : ''; |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | // Special marks |
210 | 210 | $tplInfo = array(); |
211 | - if($row['locked']) { |
|
211 | + if ($row['locked']) { |
|
212 | 212 | $tplInfo[] = $_lang['locked']; |
213 | 213 | } |
214 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
214 | + if ($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | 215 | $tplInfo[] = $_lang['defaulttemplate_title']; |
216 | 216 | } |
217 | - $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
|
217 | + $marks = !empty($tplInfo) ? ' <em>('.implode(', ', $tplInfo).')</em>' : ''; |
|
218 | 218 | |
219 | 219 | /* row buttons */ |
220 | 220 | $buttons = ''; |
221 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | - $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
221 | + if ($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | + $buttons .= '<li><a title="'.$_lang["edit_resource"].'" href="index.php?a='.$types['actions']['edit'][0].'&id='.$row['id'].'"><i class="fa fa-edit fa-fw"></i></a></li>'; |
|
223 | 223 | } |
224 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
224 | + if ($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_duplicate_record"].'\')" title="'.$_lang["resource_duplicate"].'" href="index.php?a='.$types['actions']['duplicate'][0].'&id='.$row['id'].'"><i class="fa fa-clone fa-fw"></i></a></li>'; |
|
226 | 226 | } |
227 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | - $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
227 | + if ($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | + $buttons .= '<li><a onclick="return confirm(\''.$_lang["confirm_delete"].'\')" title="'.$_lang["delete"].'" href="index.php?a='.$types['actions']['remove'][0].'&id='.$row['id'].'"><i class="fa fa-trash fa-fw"></i></a></li>'; |
|
229 | 229 | } |
230 | - $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
|
230 | + $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">'.$buttons.'</ul></div>' : ''; |
|
231 | 231 | |
232 | 232 | $catid = $row['catid'] ? $row['catid'] : 0; |
233 | 233 | |
234 | 234 | // Placeholders for elements-row |
235 | 235 | return array( |
236 | - 'class' => $class ? ' class="' . $class . '"' : '', |
|
236 | + 'class' => $class ? ' class="'.$class.'"' : '', |
|
237 | 237 | 'lockedByUser' => $lockedByUser, |
238 | 238 | 'name' => $row['name'], |
239 | 239 | 'caption' => $caption, |
@@ -1,5 +1,5 @@ discard block |
||
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 | |
@@ -11,13 +11,15 @@ discard block |
||
11 | 11 | 'elementsRow' => file_get_contents(MODX_MANAGER_PATH . 'actions/resources/tpl_elementsRow.tpl') |
12 | 12 | ); |
13 | 13 | |
14 | -function parsePh($tpl, $ph) { |
|
14 | +function parsePh($tpl, $ph) |
|
15 | +{ |
|
15 | 16 | global $modx, $_lang; |
16 | 17 | $tpl = $modx->parseText($tpl, $_lang, '[%', '%]'); |
17 | 18 | return $modx->parseText($tpl, $ph); |
18 | 19 | } |
19 | 20 | |
20 | -function renderViewSwitchButtons($cssId) { |
|
21 | +function renderViewSwitchButtons($cssId) |
|
22 | +{ |
|
21 | 23 | global $modx, $_lang, $tpl; |
22 | 24 | |
23 | 25 | return parsePh($tpl['viewForm'], array( |
@@ -25,19 +27,20 @@ discard block |
||
25 | 27 | )); |
26 | 28 | } |
27 | 29 | |
28 | -function createResourceList($resourceTable, $resources) { |
|
30 | +function createResourceList($resourceTable, $resources) |
|
31 | +{ |
|
29 | 32 | global $modx, $_lang, $_style, $modx_textdir, $tpl; |
30 | 33 | |
31 | 34 | $items = isset($resources->items[$resourceTable]) ? $resources->items[$resourceTable] : false; |
32 | 35 | |
33 | - if( ! is_array($items) || empty($items)) { |
|
36 | + if( ! is_array($items) || empty($items)) { |
|
34 | 37 | return $_lang['no_results']; |
35 | 38 | } |
36 | 39 | |
37 | 40 | // Prepare elements- and categories-list |
38 | 41 | $elements = array(); |
39 | 42 | $categories = array(); |
40 | - foreach($items as $row) { |
|
43 | + foreach($items as $row) { |
|
41 | 44 | $catid = $row['catid'] ? $row['catid'] : 0; |
42 | 45 | $categories[$catid] = array('name' => stripslashes($row['category'])); |
43 | 46 | $elements[$catid][] = prepareElementRowPh($row, $resourceTable, $resources); |
@@ -45,7 +48,7 @@ discard block |
||
45 | 48 | |
46 | 49 | // Now render categories / panel-collapse |
47 | 50 | $panelGroup = ''; |
48 | - foreach($elements as $catid => $elList) { |
|
51 | + foreach($elements as $catid => $elList) { |
|
49 | 52 | // Add panel-heading / category-collapse to output |
50 | 53 | $panelGroup .= parsePh($tpl['panelHeading'], array( |
51 | 54 | 'tab' => $resourceTable, |
@@ -56,7 +59,7 @@ discard block |
||
56 | 59 | |
57 | 60 | // Prepare content for panel-collapse |
58 | 61 | $panelCollapse = ''; |
59 | - foreach($elList as $el) { |
|
62 | + foreach($elList as $el) { |
|
60 | 63 | $panelCollapse .= parsePh($tpl['elementsRow'], $el); |
61 | 64 | } |
62 | 65 | |
@@ -74,14 +77,15 @@ discard block |
||
74 | 77 | )); |
75 | 78 | } |
76 | 79 | |
77 | -function createCombinedView($resources) { |
|
80 | +function createCombinedView($resources) |
|
81 | +{ |
|
78 | 82 | global $modx, $_lang, $_style, $modx_textdir; |
79 | 83 | |
80 | 84 | $itemsPerCategory = isset($resources->itemsPerCategory) ? $resources->itemsPerCategory : false; |
81 | 85 | $types = isset($resources->types) ? $resources->types : false; |
82 | 86 | $categories = isset($resources->categories) ? $resources->categories : false; |
83 | 87 | |
84 | - if(!$itemsPerCategory) { |
|
88 | + if(!$itemsPerCategory) { |
|
85 | 89 | return $_lang['no_results']; |
86 | 90 | } |
87 | 91 | |
@@ -94,10 +98,10 @@ discard block |
||
94 | 98 | |
95 | 99 | // Easily loop through $itemsPerCategory-Array |
96 | 100 | $panelGroup = ''; |
97 | - foreach($categories as $catid => $category) { |
|
101 | + foreach($categories as $catid => $category) { |
|
98 | 102 | // Prepare collapse content / elements-list |
99 | 103 | $panelCollapse = ''; |
100 | - foreach($itemsPerCategory[$catid] as $el) { |
|
104 | + foreach($itemsPerCategory[$catid] as $el) { |
|
101 | 105 | $resourceTable = $el['type']; |
102 | 106 | $ph = prepareElementRowPh($el, $resourceTable, $resources); |
103 | 107 | $panelCollapse .= parsePh($tpl['elementsRow'], $ph); |
@@ -131,14 +135,15 @@ discard block |
||
131 | 135 | * @param $resources |
132 | 136 | * @return array |
133 | 137 | */ |
134 | -function prepareElementRowPh($row, $resourceTable, $resources) { |
|
138 | +function prepareElementRowPh($row, $resourceTable, $resources) |
|
139 | +{ |
|
135 | 140 | global $modx, $modx_textdir, $_style, $_lang; |
136 | 141 | |
137 | 142 | $types = isset($resources->types[$resourceTable]) ? $resources->types[$resourceTable] : false; |
138 | 143 | |
139 | 144 | $_lang["confirm_delete"] = $_lang["delete"]; |
140 | 145 | |
141 | - switch($resourceTable){ |
|
146 | + switch($resourceTable) { |
|
142 | 147 | case 'site_templates': |
143 | 148 | $class = $row['selectable'] ? '' : 'disabledPlugin'; |
144 | 149 | $lockElementType = 1; |
@@ -175,56 +180,56 @@ discard block |
||
175 | 180 | // Prepare displaying user-locks |
176 | 181 | $lockedByUser = ''; |
177 | 182 | $rowLock = $modx->elementIsLocked($lockElementType, $row['id'], true); |
178 | - if($rowLock && $modx->hasPermission('display_locks')) { |
|
179 | - if($rowLock['sid'] == $modx->sid) { |
|
183 | + if($rowLock && $modx->hasPermission('display_locks')) { |
|
184 | + if($rowLock['sid'] == $modx->sid) { |
|
180 | 185 | $title = $modx->parseText($_lang["lock_element_editing"], array( |
181 | 186 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
182 | 187 | 'lasthit_df' => $rowLock['lasthit_df'] |
183 | 188 | )); |
184 | 189 | $lockedByUser = '<span title="' . $title . '" class="editResource" style="cursor:context-menu;">' . $_style['tree_preview_resource'] . '</span> '; |
185 | - } else { |
|
190 | + } else { |
|
186 | 191 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
187 | 192 | 'element_type' => $_lang["lock_element_type_" . $lockElementType], |
188 | 193 | 'username' => $rowLock['username'], |
189 | 194 | 'lasthit_df' => $rowLock['lasthit_df'] |
190 | 195 | )); |
191 | - if($modx->hasPermission('remove_locks')) { |
|
196 | + if($modx->hasPermission('remove_locks')) { |
|
192 | 197 | $lockedByUser = '<a href="javascript:;" onclick="unlockElement(' . $lockElementType . ', ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource"><i class="' . $_style['icons_secured'] . '"></i></a>'; |
193 | - } else { |
|
198 | + } else { |
|
194 | 199 | $lockedByUser = '<span title="' . $title . '" class="lockedResource" style="cursor:context-menu;"><i class="' . $_style['icons_secured'] . '"></i></span>'; |
195 | 200 | } |
196 | 201 | } |
197 | 202 | } |
198 | - if($lockedByUser) { |
|
203 | + if($lockedByUser) { |
|
199 | 204 | $lockedByUser = '<div class="lockCell">' . $lockedByUser . '</div>'; |
200 | 205 | } |
201 | 206 | |
202 | 207 | // Caption |
203 | - if($resourceTable == 'site_tmplvars') { |
|
208 | + if($resourceTable == 'site_tmplvars') { |
|
204 | 209 | $caption = !empty($row['description']) ? ' ' . $row['caption'] . ' <small>(' . $row['description'] . ')</small>' : ' ' . $row['caption']; |
205 | - } else { |
|
210 | + } else { |
|
206 | 211 | $caption = !empty($row['description']) ? ' ' . $row['description'] : ''; |
207 | 212 | } |
208 | 213 | |
209 | 214 | // Special marks |
210 | 215 | $tplInfo = array(); |
211 | - if($row['locked']) { |
|
216 | + if($row['locked']) { |
|
212 | 217 | $tplInfo[] = $_lang['locked']; |
213 | 218 | } |
214 | - if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
219 | + if($row['id'] == $modx->config['default_template'] && $resourceTable == 'site_templates') { |
|
215 | 220 | $tplInfo[] = $_lang['defaulttemplate_title']; |
216 | 221 | } |
217 | 222 | $marks = !empty($tplInfo) ? ' <em>(' . implode(', ', $tplInfo) . ')</em>' : ''; |
218 | 223 | |
219 | 224 | /* row buttons */ |
220 | 225 | $buttons = ''; |
221 | - if($modx->hasPermission($types['actions']['edit'][1])) { |
|
226 | + if($modx->hasPermission($types['actions']['edit'][1])) { |
|
222 | 227 | $buttons .= '<li><a title="' . $_lang["edit_resource"] . '" href="index.php?a=' . $types['actions']['edit'][0] . '&id=' . $row['id'] . '"><i class="fa fa-edit fa-fw"></i></a></li>'; |
223 | 228 | } |
224 | - if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
229 | + if($modx->hasPermission($types['actions']['duplicate'][1])) { |
|
225 | 230 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_duplicate_record"] . '\')" title="' . $_lang["resource_duplicate"] . '" href="index.php?a=' . $types['actions']['duplicate'][0] . '&id=' . $row['id'] . '"><i class="fa fa-clone fa-fw"></i></a></li>'; |
226 | 231 | } |
227 | - if($modx->hasPermission($types['actions']['remove'][1])) { |
|
232 | + if($modx->hasPermission($types['actions']['remove'][1])) { |
|
228 | 233 | $buttons .= '<li><a onclick="return confirm(\'' . $_lang["confirm_delete"] . '\')" title="' . $_lang["delete"] . '" href="index.php?a=' . $types['actions']['remove'][0] . '&id=' . $row['id'] . '"><i class="fa fa-trash fa-fw"></i></a></li>'; |
229 | 234 | } |
230 | 235 | $buttons = $buttons ? '<div class="btnCell"><ul class="elements_buttonbar">' . $buttons . '</ul></div>' : ''; |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.'); |
|
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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | 8 | if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
9 | - // seems to be a new install - send the user to the configuration page |
|
10 | - exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
9 | + // seems to be a new install - send the user to the configuration page |
|
10 | + exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // set placeholders |
@@ -17,70 +17,70 @@ discard block |
||
17 | 17 | |
18 | 18 | // setup message info |
19 | 19 | if($modx->hasPermission('messages')) { |
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | - $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | - $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | - |
|
24 | - $msg = array(); |
|
25 | - $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | - $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | - $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | - $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | - $ph['MessageInfo'] = implode("\n", $msg); |
|
20 | + include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
21 | + $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
|
22 | + $_SESSION['nrnewmessages'] = $nrnewmessages; |
|
23 | + |
|
24 | + $msg = array(); |
|
25 | + $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
27 | + $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
29 | + $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
|
30 | + $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
|
31 | + $ph['MessageInfo'] = implode("\n", $msg); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | 35 | if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
36 | - $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | - $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
36 | + $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
|
37 | + $ph['SecurityIcon'] = wrapIcon($icon, 75); |
|
38 | 38 | } |
39 | 39 | if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
40 | - $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | - $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
40 | + $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
|
41 | + $ph['WebUserIcon'] = wrapIcon($icon, 99); |
|
42 | 42 | } |
43 | 43 | if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
44 | - $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | - $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
44 | + $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
|
45 | + $ph['ModulesIcon'] = wrapIcon($icon, 106); |
|
46 | 46 | } |
47 | 47 | if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
48 | - $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | - $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
48 | + $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
|
49 | + $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
|
50 | 50 | } |
51 | 51 | if($modx->hasPermission('bk_manager')) { |
52 | - $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | - $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
52 | + $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
|
53 | + $ph['BackupIcon'] = wrapIcon($icon, 93); |
|
54 | 54 | } |
55 | 55 | if($modx->hasPermission('help')) { |
56 | - $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | - $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
56 | + $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
|
57 | + $ph['HelpIcon'] = wrapIcon($icon, 9); |
|
58 | 58 | } |
59 | 59 | // do some config checks |
60 | 60 | if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | - $ph['config_check_results'] = $config_check_results; |
|
64 | - $ph['config_display'] = 'block'; |
|
65 | - } else { |
|
66 | - $ph['config_display'] = 'none'; |
|
67 | - } |
|
61 | + include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | + $ph['config_check_results'] = $config_check_results; |
|
64 | + $ph['config_display'] = 'block'; |
|
65 | + } else { |
|
66 | + $ph['config_display'] = 'none'; |
|
67 | + } |
|
68 | 68 | } else { |
69 | - $ph['config_display'] = 'none'; |
|
69 | + $ph['config_display'] = 'none'; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | 73 | if(isset($_SESSION['show_logout_reminder'])) { |
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | - case 'logout_reminder': |
|
76 | - $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | - $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | - break; |
|
79 | - } |
|
80 | - $ph['show_logout_reminder'] = 'block'; |
|
81 | - unset($_SESSION['show_logout_reminder']); |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | + case 'logout_reminder': |
|
76 | + $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
|
77 | + $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
|
78 | + break; |
|
79 | + } |
|
80 | + $ph['show_logout_reminder'] = 'block'; |
|
81 | + unset($_SESSION['show_logout_reminder']); |
|
82 | 82 | } else { |
83 | - $ph['show_logout_reminder'] = 'none'; |
|
83 | + $ph['show_logout_reminder'] = 'none'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Check multiple sessions |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | - 'username' => $modx->getLoginUserName(), |
|
132 | - 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | - 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | - 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | - 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
131 | + 'username' => $modx->getLoginUserName(), |
|
132 | + 'role' => $_SESSION['mgrPermissions']['name'], |
|
133 | + 'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time), |
|
134 | + 'logincount' => $_SESSION['mgrLogincount'] + 1, |
|
135 | + 'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages) |
|
136 | 136 | )); |
137 | 137 | |
138 | 138 | $from = array(); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | 143 | if($modx->db->getRecordCount($rs) < 1) { |
144 | - $html = '<p>[%no_active_users_found%]</p>'; |
|
144 | + $html = '<p>[%no_active_users_found%]</p>'; |
|
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | - $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | - $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | - $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | - $html = ' |
|
146 | + include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
147 | + $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
|
148 | + $ph['now'] = strftime('%H:%M:%S', $now); |
|
149 | + $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
|
150 | + $html = ' |
|
151 | 151 | <div class="card-body"> |
152 | 152 | [%onlineusers_message%] |
153 | 153 | <b>[+now+]</b>): |
@@ -165,33 +165,33 @@ discard block |
||
165 | 165 | </thead> |
166 | 166 | <tbody>'; |
167 | 167 | |
168 | - $userList = array(); |
|
169 | - $userCount = array(); |
|
170 | - // Create userlist with session-count first before output |
|
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
172 | - $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | - |
|
174 | - $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | - $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | - $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | - $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | - $userList[] = array( |
|
179 | - $idle, |
|
180 | - '', |
|
181 | - $activeusers['username'], |
|
182 | - $webicon, |
|
183 | - abs($activeusers['internalKey']), |
|
184 | - $ip, |
|
185 | - strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | - $currentaction |
|
187 | - ); |
|
188 | - } |
|
189 | - foreach($userList as $params) { |
|
190 | - $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | - } |
|
193 | - |
|
194 | - $html .= ' |
|
168 | + $userList = array(); |
|
169 | + $userCount = array(); |
|
170 | + // Create userlist with session-count first before output |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | + $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
|
173 | + |
|
174 | + $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
|
175 | + $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" /> ' : ''; |
|
176 | + $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip']; |
|
177 | + $currentaction = getAction($activeusers['action'], $activeusers['id']); |
|
178 | + $userList[] = array( |
|
179 | + $idle, |
|
180 | + '', |
|
181 | + $activeusers['username'], |
|
182 | + $webicon, |
|
183 | + abs($activeusers['internalKey']), |
|
184 | + $ip, |
|
185 | + strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time), |
|
186 | + $currentaction |
|
187 | + ); |
|
188 | + } |
|
189 | + foreach($userList as $params) { |
|
190 | + $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
|
191 | + $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | + } |
|
193 | + |
|
194 | + $html .= ' |
|
195 | 195 | </tbody> |
196 | 196 | </table> |
197 | 197 | </div> |
@@ -232,17 +232,17 @@ discard block |
||
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | 234 | if(is_array($evtOut)) { |
235 | - $output = implode('', $evtOut); |
|
236 | - $ph['OnManagerWelcomePrerender'] = $output; |
|
235 | + $output = implode('', $evtOut); |
|
236 | + $ph['OnManagerWelcomePrerender'] = $output; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | $widgets['welcome'] = array( |
240 | - 'menuindex' => '10', |
|
241 | - 'id' => 'welcome', |
|
242 | - 'cols' => 'col-sm-6', |
|
243 | - 'icon' => 'fa-home', |
|
244 | - 'title' => '[%welcome_title%]', |
|
245 | - 'body' => ' |
|
240 | + 'menuindex' => '10', |
|
241 | + 'id' => 'welcome', |
|
242 | + 'cols' => 'col-sm-6', |
|
243 | + 'icon' => 'fa-home', |
|
244 | + 'title' => '[%welcome_title%]', |
|
245 | + 'body' => ' |
|
246 | 246 | <div class="wm_buttons card-body"> |
247 | 247 | <!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> |
248 | 248 | <span class="wm_button"> |
@@ -320,25 +320,25 @@ discard block |
||
320 | 320 | </table> |
321 | 321 | </div> |
322 | 322 | ', |
323 | - 'hide'=>'0' |
|
323 | + 'hide'=>'0' |
|
324 | 324 | ); |
325 | 325 | $widgets['onlineinfo'] = array( |
326 | - 'menuindex' => '20', |
|
327 | - 'id' => 'onlineinfo', |
|
328 | - 'cols' => 'col-sm-6', |
|
329 | - 'icon' => 'fa-user', |
|
330 | - 'title' => '[%onlineusers_title%]', |
|
331 | - 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | - 'hide'=>'0' |
|
326 | + 'menuindex' => '20', |
|
327 | + 'id' => 'onlineinfo', |
|
328 | + 'cols' => 'col-sm-6', |
|
329 | + 'icon' => 'fa-user', |
|
330 | + 'title' => '[%onlineusers_title%]', |
|
331 | + 'body' => '<div class="userstable">[+OnlineInfo+]</div>', |
|
332 | + 'hide'=>'0' |
|
333 | 333 | ); |
334 | 334 | $widgets['recentinfo'] = array( |
335 | - 'menuindex' => '30', |
|
336 | - 'id' => 'modxrecent_widget', |
|
337 | - 'cols' => 'col-sm-12', |
|
338 | - 'icon' => 'fa-pencil-square-o', |
|
339 | - 'title' => '[%activity_title%]', |
|
340 | - 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | - 'hide'=>'0' |
|
335 | + 'menuindex' => '30', |
|
336 | + 'id' => 'modxrecent_widget', |
|
337 | + 'cols' => 'col-sm-12', |
|
338 | + 'icon' => 'fa-pencil-square-o', |
|
339 | + 'title' => '[%activity_title%]', |
|
340 | + 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
|
341 | + 'hide'=>'0' |
|
342 | 342 | ); |
343 | 343 | if ($modx->config['rss_url_news']) { |
344 | 344 | $widgets['news'] = array( |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | 368 | if(is_array($sitewidgets)) { |
369 | - $newwidgets = array(); |
|
369 | + $newwidgets = array(); |
|
370 | 370 | foreach($sitewidgets as $widget){ |
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | usort($widgets, function ($a, $b) { |
377 | - return $a['menuindex'] - $b['menuindex']; |
|
377 | + return $a['menuindex'] - $b['menuindex']; |
|
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | 382 | foreach($widgets as $widget) { |
383 | - if ($widget['hide'] != '1'){ |
|
384 | - $output .= $modx->parseText($tpl, $widget); |
|
385 | - } |
|
383 | + if ($widget['hide'] != '1'){ |
|
384 | + $output .= $modx->parseText($tpl, $widget); |
|
385 | + } |
|
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | 390 | if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
@@ -396,27 +396,27 @@ discard block |
||
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | 398 | if(substr($target, 0, 1) === '@') { |
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | - $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | - $content = file_get_contents(trim(substr($target, 6))); |
|
403 | - } else { |
|
404 | - $content = ''; |
|
405 | - } |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | + $content = $modx->getChunk(trim(substr($target, 7))); |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | + $content = file_get_contents(trim(substr($target, 6))); |
|
403 | + } else { |
|
404 | + $content = ''; |
|
405 | + } |
|
406 | 406 | } else { |
407 | - $chunk = $modx->getChunk($target); |
|
408 | - if($chunk !== false && !empty($chunk)) { |
|
409 | - $content = $chunk; |
|
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | - { |
|
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | - } |
|
407 | + $chunk = $modx->getChunk($target); |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | + $content = $chunk; |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
415 | + { |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | + } else { |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
419 | + } |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | // merge placeholders |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | 426 | if(strpos($content, '[+') !== false) { |
427 | - $modx->toPlaceholders($ph); |
|
428 | - $content = $modx->mergePlaceholderContent($content); |
|
427 | + $modx->toPlaceholders($ph); |
|
428 | + $content = $modx->mergePlaceholderContent($content); |
|
429 | 429 | } |
430 | 430 | $content = $modx->parseDocumentSource($content); |
431 | 431 | $content = $modx->parseText($content, $_lang, '[%', '%]'); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | 435 | if($js = $modx->getRegisteredClientScripts()) { |
436 | - $content .= $js; |
|
436 | + $content .= $js; |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | echo $content; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | 445 | function getTplWidget() { // recent document info |
446 | - return ' |
|
446 | + return ' |
|
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
449 | 449 | <div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div> |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | } |
455 | 455 | |
456 | 456 | function getRecentInfo() { // recent document info |
457 | - global $modx; |
|
457 | + global $modx; |
|
458 | 458 | |
459 | - $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
459 | + $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
|
460 | 460 | |
461 | - $html = ' |
|
461 | + $html = ' |
|
462 | 462 | <div class="table-responsive"> |
463 | 463 | <table class="table data"> |
464 | 464 | <thead> |
@@ -476,96 +476,96 @@ discard block |
||
476 | 476 | </table> |
477 | 477 | </div> |
478 | 478 | '; |
479 | - return $html; |
|
479 | + return $html; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | function getRecentInfoList() { |
483 | - global $modx; |
|
484 | - |
|
485 | - $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | - |
|
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
488 | - return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | - } |
|
490 | - |
|
491 | - $tpl = getRecentInfoRowTpl(); |
|
492 | - |
|
493 | - $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | - $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | - |
|
496 | - $output = array(); |
|
497 | - while($ph = $modx->db->getRow($rs)) { |
|
498 | - $docid = $ph['id']; |
|
499 | - $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | - $ph['username'] = $_['username']; |
|
501 | - |
|
502 | - if($ph['deleted'] == 1) { |
|
503 | - $ph['status'] = 'deleted text-danger'; |
|
504 | - } elseif($ph['published'] == 0) { |
|
505 | - $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | - } else { |
|
507 | - $ph['status'] = 'published'; |
|
508 | - } |
|
509 | - |
|
510 | - if($modx->hasPermission('edit_document')) { |
|
511 | - $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | - } else { |
|
513 | - $ph['edit_btn'] = ''; |
|
514 | - } |
|
515 | - |
|
516 | - $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | - $ph['preview_btn'] = str_replace(array( |
|
518 | - '[+id+]', |
|
519 | - '[+preview_disabled+]' |
|
520 | - ), array( |
|
521 | - $docid, |
|
522 | - $preview_disabled |
|
523 | - ), $btntpl['preview_btn']); |
|
524 | - |
|
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
527 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | - } else { |
|
529 | - $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | - } |
|
531 | - $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | - } else { |
|
533 | - $ph['delete_btn'] = ''; |
|
534 | - } |
|
535 | - |
|
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | - $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | - $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | - } else { |
|
543 | - $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | - } |
|
545 | - $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | - |
|
547 | - $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | - |
|
549 | - if($ph['longtitle'] == '') { |
|
550 | - $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | - } |
|
552 | - if($ph['description'] == '') { |
|
553 | - $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | - } |
|
555 | - if($ph['introtext'] == '') { |
|
556 | - $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | - } |
|
558 | - if($ph['alias'] == '') { |
|
559 | - $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | - } |
|
561 | - |
|
562 | - $output[] = $modx->parseText($tpl, $ph); |
|
563 | - } |
|
564 | - return implode("\n", $output); |
|
483 | + global $modx; |
|
484 | + |
|
485 | + $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
|
486 | + |
|
487 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | + return '<tr><td>[%no_activity_message%]</td></tr>'; |
|
489 | + } |
|
490 | + |
|
491 | + $tpl = getRecentInfoRowTpl(); |
|
492 | + |
|
493 | + $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> '; |
|
494 | + $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
|
495 | + |
|
496 | + $output = array(); |
|
497 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | + $docid = $ph['id']; |
|
499 | + $_ = $modx->getUserInfo($ph['editedby']); |
|
500 | + $ph['username'] = $_['username']; |
|
501 | + |
|
502 | + if($ph['deleted'] == 1) { |
|
503 | + $ph['status'] = 'deleted text-danger'; |
|
504 | + } elseif($ph['published'] == 0) { |
|
505 | + $ph['status'] = 'unpublished font-italic text-muted'; |
|
506 | + } else { |
|
507 | + $ph['status'] = 'published'; |
|
508 | + } |
|
509 | + |
|
510 | + if($modx->hasPermission('edit_document')) { |
|
511 | + $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
|
512 | + } else { |
|
513 | + $ph['edit_btn'] = ''; |
|
514 | + } |
|
515 | + |
|
516 | + $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : ''; |
|
517 | + $ph['preview_btn'] = str_replace(array( |
|
518 | + '[+id+]', |
|
519 | + '[+preview_disabled+]' |
|
520 | + ), array( |
|
521 | + $docid, |
|
522 | + $preview_disabled |
|
523 | + ), $btntpl['preview_btn']); |
|
524 | + |
|
525 | + if($modx->hasPermission('delete_document')) { |
|
526 | + if($ph['deleted'] == 0) { |
|
527 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
|
528 | + } else { |
|
529 | + $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
|
530 | + } |
|
531 | + $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
|
532 | + } else { |
|
533 | + $ph['delete_btn'] = ''; |
|
534 | + } |
|
535 | + |
|
536 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
538 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | + $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
540 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | + $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
|
542 | + } else { |
|
543 | + $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
|
544 | + } |
|
545 | + $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
|
546 | + |
|
547 | + $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
|
548 | + |
|
549 | + if($ph['longtitle'] == '') { |
|
550 | + $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
|
551 | + } |
|
552 | + if($ph['description'] == '') { |
|
553 | + $ph['description'] = '(<i>[%not_set%]</i>)'; |
|
554 | + } |
|
555 | + if($ph['introtext'] == '') { |
|
556 | + $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
|
557 | + } |
|
558 | + if($ph['alias'] == '') { |
|
559 | + $ph['alias'] = '(<i>[%not_set%]</i>)'; |
|
560 | + } |
|
561 | + |
|
562 | + $output[] = $modx->parseText($tpl, $ph); |
|
563 | + } |
|
564 | + return implode("\n", $output); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | function getRecentInfoRowTpl() { |
568 | - $tpl = ' |
|
568 | + $tpl = ' |
|
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
571 | 571 | <td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&id=[+id+]" target="main">[+pagetitle+]</a></td> |
@@ -589,16 +589,16 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | </td> |
591 | 591 | </tr>'; |
592 | - return $tpl; |
|
592 | + return $tpl; |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | 596 | function wrapIcon($i, $action) { |
597 | - return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
597 | + return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | function getStartUpScript() { |
601 | - $script = ' |
|
601 | + $script = ' |
|
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
604 | 604 | var xhr = new XMLHttpRequest(); |
@@ -622,5 +622,5 @@ discard block |
||
622 | 622 | })(jQuery); |
623 | 623 | </script> |
624 | 624 | '; |
625 | - return $script; |
|
625 | + return $script; |
|
626 | 626 | } |
@@ -1,11 +1,11 @@ discard block |
||
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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,50 +16,50 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
20 | - include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
|
19 | +if ($modx->hasPermission('messages')) { |
|
20 | + include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php'); |
|
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
23 | 23 | |
24 | 24 | $msg = array(); |
25 | 25 | $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']); |
26 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : ''; |
|
26 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : ''; |
|
27 | 27 | $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold"> <a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages); |
28 | - $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0'; |
|
28 | + $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0'; |
|
29 | 29 | $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages); |
30 | 30 | $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages); |
31 | 31 | $ph['MessageInfo'] = implode("\n", $msg); |
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
47 | +if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if ($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if ($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | - include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
|
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
60 | +if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | + include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php'); |
|
62 | + if ($config_check_results != $_lang['configcheck_ok']) { |
|
63 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | 65 | } else { |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if (isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch ($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | </tr> |
126 | 126 | </table>'; |
127 | 127 | |
128 | -$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>'; |
|
128 | +$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>'; |
|
129 | 129 | |
130 | 130 | $ph['UserInfo'] = $modx->parseText($tpl, array( |
131 | 131 | 'username' => $modx->getLoginUserName(), |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if ($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | 145 | } else { |
146 | - include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
|
146 | + include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php'); |
|
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
149 | 149 | $timetocheck = ($now - (60 * 20)); //+$server_offset_time; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while ($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,9 +186,9 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach ($userList as $params) { |
|
190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
191 | - $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
191 | + $html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $html .= ' |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $ph['OnlineInfo'] = $html; |
201 | 201 | |
202 | 202 | // include rss feeds for important forum topics |
203 | -include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php'); |
|
203 | +include_once(MODX_MANAGER_PATH.'includes/rss.inc.php'); |
|
204 | 204 | $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content']; |
205 | 205 | $ph['modx_news_content'] = $feedData['modx_news_content']; |
206 | 206 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if (is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -365,57 +365,57 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if (is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach ($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach ($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | - $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
|
390 | +if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | + $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl'; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | $target = $modx->config['manager_welcome_tpl']; |
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if (substr($target, 0, 1) === '@') { |
|
399 | + if (substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif (substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | 403 | } else { |
404 | 404 | $content = ''; |
405 | 405 | } |
406 | 406 | } else { |
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if ($chunk !== false && !empty($chunk)) { |
|
409 | 409 | $content = $chunk; |
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | - $content = file_get_contents(MODX_BASE_PATH . $target); |
|
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
|
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
410 | + } elseif (is_file(MODX_BASE_PATH.$target)) { |
|
411 | + $content = file_get_contents(MODX_BASE_PATH.$target); |
|
412 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) { |
|
413 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl'); |
|
414 | + } elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible |
|
415 | 415 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
416 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html'); |
|
417 | 417 | } else { |
418 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
|
418 | + $content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl'); |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 424 | $content = $modx->mergeSettingsContent($content); |
425 | 425 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
426 | +if (strpos($content, '[+') !== false) { |
|
427 | 427 | $modx->toPlaceholders($ph); |
428 | 428 | $content = $modx->mergePlaceholderContent($content); |
429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 433 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 434 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
435 | +if ($js = $modx->getRegisteredClientScripts()) { |
|
436 | 436 | $content .= $js; |
437 | 437 | } |
438 | 438 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 443 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 444 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
445 | +function getTplWidget(){ // recent document info |
|
446 | 446 | return ' |
447 | 447 | <div class="[+cols+]" id="[+id+]"> |
448 | 448 | <div class="card"[+cardAttr+]> |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | '; |
454 | 454 | } |
455 | 455 | |
456 | -function getRecentInfo() { // recent document info |
|
456 | +function getRecentInfo(){ // recent document info |
|
457 | 457 | global $modx; |
458 | 458 | |
459 | 459 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | return $html; |
480 | 480 | } |
481 | 481 | |
482 | -function getRecentInfoList() { |
|
482 | +function getRecentInfoList(){ |
|
483 | 483 | global $modx; |
484 | 484 | |
485 | 485 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 486 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
487 | + if ($modx->db->getRecordCount($rs) < 1) { |
|
488 | 488 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 489 | } |
490 | 490 | |
@@ -494,20 +494,20 @@ discard block |
||
494 | 494 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
495 | 495 | |
496 | 496 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
497 | + while ($ph = $modx->db->getRow($rs)) { |
|
498 | 498 | $docid = $ph['id']; |
499 | 499 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 500 | $ph['username'] = $_['username']; |
501 | 501 | |
502 | - if($ph['deleted'] == 1) { |
|
502 | + if ($ph['deleted'] == 1) { |
|
503 | 503 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
504 | + } elseif ($ph['published'] == 0) { |
|
505 | 505 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | 506 | } else { |
507 | 507 | $ph['status'] = 'published'; |
508 | 508 | } |
509 | 509 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
510 | + if ($modx->hasPermission('edit_document')) { |
|
511 | 511 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | 512 | } else { |
513 | 513 | $ph['edit_btn'] = ''; |
@@ -522,8 +522,8 @@ discard block |
||
522 | 522 | $preview_disabled |
523 | 523 | ), $btntpl['preview_btn']); |
524 | 524 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
525 | + if ($modx->hasPermission('delete_document')) { |
|
526 | + if ($ph['deleted'] == 0) { |
|
527 | 527 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
528 | 528 | } else { |
529 | 529 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | $ph['delete_btn'] = ''; |
534 | 534 | } |
535 | 535 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
536 | + if ($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 537 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
538 | + } elseif ($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 539 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
540 | + } elseif ($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 541 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
542 | 542 | } else { |
543 | 543 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
@@ -546,16 +546,16 @@ discard block |
||
546 | 546 | |
547 | 547 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
548 | 548 | |
549 | - if($ph['longtitle'] == '') { |
|
549 | + if ($ph['longtitle'] == '') { |
|
550 | 550 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 551 | } |
552 | - if($ph['description'] == '') { |
|
552 | + if ($ph['description'] == '') { |
|
553 | 553 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 554 | } |
555 | - if($ph['introtext'] == '') { |
|
555 | + if ($ph['introtext'] == '') { |
|
556 | 556 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 557 | } |
558 | - if($ph['alias'] == '') { |
|
558 | + if ($ph['alias'] == '') { |
|
559 | 559 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 560 | } |
561 | 561 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | return implode("\n", $output); |
565 | 565 | } |
566 | 566 | |
567 | -function getRecentInfoRowTpl() { |
|
567 | +function getRecentInfoRowTpl(){ |
|
568 | 568 | $tpl = ' |
569 | 569 | <tr> |
570 | 570 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +593,11 @@ discard block |
||
593 | 593 | } |
594 | 594 | |
595 | 595 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
596 | +function wrapIcon($i, $action){ |
|
597 | 597 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
598 | 598 | } |
599 | 599 | |
600 | -function getStartUpScript() { |
|
600 | +function getStartUpScript(){ |
|
601 | 601 | $script = ' |
602 | 602 | <script type="text/javascript"> |
603 | 603 | function hideConfigCheckWarning(key) { |
@@ -1,11 +1,11 @@ discard block |
||
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 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
7 | 7 | |
8 | -if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
8 | +if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) { |
|
9 | 9 | // seems to be a new install - send the user to the configuration page |
10 | 10 | exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>'); |
11 | 11 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $_SESSION['nrnewmessages'] = 0; |
17 | 17 | |
18 | 18 | // setup message info |
19 | -if($modx->hasPermission('messages')) { |
|
19 | +if($modx->hasPermission('messages')) { |
|
20 | 20 | include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php'); |
21 | 21 | $_SESSION['nrtotalmessages'] = $nrtotalmessages; |
22 | 22 | $_SESSION['nrnewmessages'] = $nrnewmessages; |
@@ -32,46 +32,46 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | // setup icons |
35 | -if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
35 | +if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) { |
|
36 | 36 | $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]'; |
37 | 37 | $ph['SecurityIcon'] = wrapIcon($icon, 75); |
38 | 38 | } |
39 | -if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
39 | +if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) { |
|
40 | 40 | $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]'; |
41 | 41 | $ph['WebUserIcon'] = wrapIcon($icon, 99); |
42 | 42 | } |
43 | -if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
43 | +if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) { |
|
44 | 44 | $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]'; |
45 | 45 | $ph['ModulesIcon'] = wrapIcon($icon, 106); |
46 | 46 | } |
47 | -if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
47 | +if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) { |
|
48 | 48 | $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]'; |
49 | 49 | $ph['ResourcesIcon'] = wrapIcon($icon, 76); |
50 | 50 | } |
51 | -if($modx->hasPermission('bk_manager')) { |
|
51 | +if($modx->hasPermission('bk_manager')) { |
|
52 | 52 | $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]'; |
53 | 53 | $ph['BackupIcon'] = wrapIcon($icon, 93); |
54 | 54 | } |
55 | -if($modx->hasPermission('help')) { |
|
55 | +if($modx->hasPermission('help')) { |
|
56 | 56 | $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]'; |
57 | 57 | $ph['HelpIcon'] = wrapIcon($icon, 9); |
58 | 58 | } |
59 | 59 | // do some config checks |
60 | -if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
60 | +if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) { |
|
61 | 61 | include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php'); |
62 | - if($config_check_results != $_lang['configcheck_ok']) { |
|
62 | + if($config_check_results != $_lang['configcheck_ok']) { |
|
63 | 63 | $ph['config_check_results'] = $config_check_results; |
64 | 64 | $ph['config_display'] = 'block'; |
65 | - } else { |
|
65 | + } else { |
|
66 | 66 | $ph['config_display'] = 'none'; |
67 | 67 | } |
68 | -} else { |
|
68 | +} else { |
|
69 | 69 | $ph['config_display'] = 'none'; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check logout-reminder |
73 | -if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | - switch($_SESSION['show_logout_reminder']['type']) { |
|
73 | +if(isset($_SESSION['show_logout_reminder'])) { |
|
74 | + switch($_SESSION['show_logout_reminder']['type']) { |
|
75 | 75 | case 'logout_reminder': |
76 | 76 | $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly'); |
77 | 77 | $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | $ph['show_logout_reminder'] = 'block'; |
81 | 81 | unset($_SESSION['show_logout_reminder']); |
82 | -} else { |
|
82 | +} else { |
|
83 | 83 | $ph['show_logout_reminder'] = 'none'; |
84 | 84 | } |
85 | 85 | |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'"; |
141 | 141 | $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC'); |
142 | 142 | |
143 | -if($modx->db->getRecordCount($rs) < 1) { |
|
143 | +if($modx->db->getRecordCount($rs) < 1) { |
|
144 | 144 | $html = '<p>[%no_active_users_found%]</p>'; |
145 | -} else { |
|
145 | +} else { |
|
146 | 146 | include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php'); |
147 | 147 | $now = $_SERVER['REQUEST_TIME'] + $server_offset_time; |
148 | 148 | $ph['now'] = strftime('%H:%M:%S', $now); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $userList = array(); |
169 | 169 | $userCount = array(); |
170 | 170 | // Create userlist with session-count first before output |
171 | - while($activeusers = $modx->db->getRow($rs)) { |
|
171 | + while($activeusers = $modx->db->getRow($rs)) { |
|
172 | 172 | $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1; |
173 | 173 | |
174 | 174 | $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : ''; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $currentaction |
187 | 187 | ); |
188 | 188 | } |
189 | - foreach($userList as $params) { |
|
189 | + foreach($userList as $params) { |
|
190 | 190 | $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : ''; |
191 | 191 | $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params); |
192 | 192 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // invoke event OnManagerWelcomePrerender |
233 | 233 | $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender'); |
234 | -if(is_array($evtOut)) { |
|
234 | +if(is_array($evtOut)) { |
|
235 | 235 | $output = implode('', $evtOut); |
236 | 236 | $ph['OnManagerWelcomePrerender'] = $output; |
237 | 237 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | 'body' => '<div class="widget-stage">[+RecentInfo+]</div>', |
341 | 341 | 'hide'=>'0' |
342 | 342 | ); |
343 | -if ($modx->config['rss_url_news']) { |
|
343 | +if ($modx->config['rss_url_news']) { |
|
344 | 344 | $widgets['news'] = array( |
345 | 345 | 'menuindex' => '40', |
346 | 346 | 'id' => 'news', |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | 'hide'=>'0' |
352 | 352 | ); |
353 | 353 | } |
354 | -if ($modx->config['rss_url_security']) { |
|
354 | +if ($modx->config['rss_url_security']) { |
|
355 | 355 | $widgets['security'] = array( |
356 | 356 | 'menuindex' => '50', |
357 | 357 | 'id' => 'security', |
@@ -365,29 +365,29 @@ discard block |
||
365 | 365 | |
366 | 366 | // invoke OnManagerWelcomeHome event |
367 | 367 | $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets)); |
368 | -if(is_array($sitewidgets)) { |
|
368 | +if(is_array($sitewidgets)) { |
|
369 | 369 | $newwidgets = array(); |
370 | - foreach($sitewidgets as $widget){ |
|
370 | + foreach($sitewidgets as $widget) { |
|
371 | 371 | $newwidgets = array_merge($newwidgets, unserialize($widget)); |
372 | 372 | } |
373 | 373 | $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets; |
374 | 374 | } |
375 | 375 | |
376 | -usort($widgets, function ($a, $b) { |
|
376 | +usort($widgets, function ($a, $b){ |
|
377 | 377 | return $a['menuindex'] - $b['menuindex']; |
378 | 378 | }); |
379 | 379 | |
380 | 380 | $tpl = getTplWidget(); |
381 | 381 | $output = ''; |
382 | -foreach($widgets as $widget) { |
|
383 | - if ($widget['hide'] != '1'){ |
|
382 | +foreach($widgets as $widget) { |
|
383 | + if ($widget['hide'] != '1') { |
|
384 | 384 | $output .= $modx->parseText($tpl, $widget); |
385 | 385 | } |
386 | 386 | } |
387 | 387 | $ph['widgets'] = $output; |
388 | 388 | |
389 | 389 | // load template |
390 | -if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
390 | +if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) { |
|
391 | 391 | $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'; |
392 | 392 | } |
393 | 393 | |
@@ -395,26 +395,28 @@ discard block |
||
395 | 395 | $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target); |
396 | 396 | $target = $modx->mergeSettingsContent($target); |
397 | 397 | |
398 | -if(substr($target, 0, 1) === '@') { |
|
399 | - if(substr($target, 0, 6) === '@CHUNK') { |
|
398 | +if(substr($target, 0, 1) === '@') { |
|
399 | + if(substr($target, 0, 6) === '@CHUNK') { |
|
400 | 400 | $content = $modx->getChunk(trim(substr($target, 7))); |
401 | - } elseif(substr($target, 0, 5) === '@FILE') { |
|
401 | + } elseif(substr($target, 0, 5) === '@FILE') { |
|
402 | 402 | $content = file_get_contents(trim(substr($target, 6))); |
403 | - } else { |
|
403 | + } else { |
|
404 | 404 | $content = ''; |
405 | 405 | } |
406 | -} else { |
|
406 | +} else { |
|
407 | 407 | $chunk = $modx->getChunk($target); |
408 | - if($chunk !== false && !empty($chunk)) { |
|
408 | + if($chunk !== false && !empty($chunk)) { |
|
409 | 409 | $content = $chunk; |
410 | - } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
410 | + } elseif(is_file(MODX_BASE_PATH . $target)) { |
|
411 | 411 | $content = file_get_contents(MODX_BASE_PATH . $target); |
412 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
412 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) { |
|
413 | 413 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl'); |
414 | - } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible |
|
414 | + } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) { |
|
415 | + // ClipperCMS compatible |
|
415 | 416 | { |
416 | - $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
417 | - } else { |
|
417 | + $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html'); |
|
418 | + } |
|
419 | + } else { |
|
418 | 420 | $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl'); |
419 | 421 | } |
420 | 422 | } |
@@ -423,7 +425,7 @@ discard block |
||
423 | 425 | $content = $modx->mergeConditionalTagsContent($content); |
424 | 426 | $content = $modx->mergeSettingsContent($content); |
425 | 427 | $content = $modx->parseText($content, $ph); |
426 | -if(strpos($content, '[+') !== false) { |
|
428 | +if(strpos($content, '[+') !== false) { |
|
427 | 429 | $modx->toPlaceholders($ph); |
428 | 430 | $content = $modx->mergePlaceholderContent($content); |
429 | 431 | } |
@@ -432,7 +434,7 @@ discard block |
||
432 | 434 | $content = $modx->parseText($content, $_style, '[&', '&]'); |
433 | 435 | $content = $modx->cleanUpMODXTags($content); //cleanup |
434 | 436 | |
435 | -if($js = $modx->getRegisteredClientScripts()) { |
|
437 | +if($js = $modx->getRegisteredClientScripts()) { |
|
436 | 438 | $content .= $js; |
437 | 439 | } |
438 | 440 | |
@@ -442,7 +444,9 @@ discard block |
||
442 | 444 | // <a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a> |
443 | 445 | // <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a> |
444 | 446 | //</span> |
445 | -function getTplWidget() { // recent document info |
|
447 | +function getTplWidget() |
|
448 | +{ |
|
449 | +// recent document info |
|
446 | 450 | return ' |
447 | 451 | <div class="[+cols+]" id="[+id+]"> |
448 | 452 | <div class="card"[+cardAttr+]> |
@@ -453,7 +457,9 @@ discard block |
||
453 | 457 | '; |
454 | 458 | } |
455 | 459 | |
456 | -function getRecentInfo() { // recent document info |
|
460 | +function getRecentInfo() |
|
461 | +{ |
|
462 | +// recent document info |
|
457 | 463 | global $modx; |
458 | 464 | |
459 | 465 | $modx->addSnippet('recentInfoList', 'getRecentInfoList'); |
@@ -479,12 +485,13 @@ discard block |
||
479 | 485 | return $html; |
480 | 486 | } |
481 | 487 | |
482 | -function getRecentInfoList() { |
|
488 | +function getRecentInfoList() |
|
489 | +{ |
|
483 | 490 | global $modx; |
484 | 491 | |
485 | 492 | $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10); |
486 | 493 | |
487 | - if($modx->db->getRecordCount($rs) < 1) { |
|
494 | + if($modx->db->getRecordCount($rs) < 1) { |
|
488 | 495 | return '<tr><td>[%no_activity_message%]</td></tr>'; |
489 | 496 | } |
490 | 497 | |
@@ -494,22 +501,22 @@ discard block |
||
494 | 501 | $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> '; |
495 | 502 | |
496 | 503 | $output = array(); |
497 | - while($ph = $modx->db->getRow($rs)) { |
|
504 | + while($ph = $modx->db->getRow($rs)) { |
|
498 | 505 | $docid = $ph['id']; |
499 | 506 | $_ = $modx->getUserInfo($ph['editedby']); |
500 | 507 | $ph['username'] = $_['username']; |
501 | 508 | |
502 | - if($ph['deleted'] == 1) { |
|
509 | + if($ph['deleted'] == 1) { |
|
503 | 510 | $ph['status'] = 'deleted text-danger'; |
504 | - } elseif($ph['published'] == 0) { |
|
511 | + } elseif($ph['published'] == 0) { |
|
505 | 512 | $ph['status'] = 'unpublished font-italic text-muted'; |
506 | - } else { |
|
513 | + } else { |
|
507 | 514 | $ph['status'] = 'published'; |
508 | 515 | } |
509 | 516 | |
510 | - if($modx->hasPermission('edit_document')) { |
|
517 | + if($modx->hasPermission('edit_document')) { |
|
511 | 518 | $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']); |
512 | - } else { |
|
519 | + } else { |
|
513 | 520 | $ph['edit_btn'] = ''; |
514 | 521 | } |
515 | 522 | |
@@ -522,40 +529,40 @@ discard block |
||
522 | 529 | $preview_disabled |
523 | 530 | ), $btntpl['preview_btn']); |
524 | 531 | |
525 | - if($modx->hasPermission('delete_document')) { |
|
526 | - if($ph['deleted'] == 0) { |
|
532 | + if($modx->hasPermission('delete_document')) { |
|
533 | + if($ph['deleted'] == 0) { |
|
527 | 534 | $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> '; |
528 | - } else { |
|
535 | + } else { |
|
529 | 536 | $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> '; |
530 | 537 | } |
531 | 538 | $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn); |
532 | - } else { |
|
539 | + } else { |
|
533 | 540 | $ph['delete_btn'] = ''; |
534 | 541 | } |
535 | 542 | |
536 | - if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
543 | + if($ph['deleted'] == 1 && $ph['published'] == 0) { |
|
537 | 544 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
538 | - } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
545 | + } elseif($ph['deleted'] == 1 && $ph['published'] == 1) { |
|
539 | 546 | $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
540 | - } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
547 | + } elseif($ph['deleted'] == 0 && $ph['published'] == 0) { |
|
541 | 548 | $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> '; |
542 | - } else { |
|
549 | + } else { |
|
543 | 550 | $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> '; |
544 | 551 | } |
545 | 552 | $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn); |
546 | 553 | |
547 | 554 | $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>'); |
548 | 555 | |
549 | - if($ph['longtitle'] == '') { |
|
556 | + if($ph['longtitle'] == '') { |
|
550 | 557 | $ph['longtitle'] = '(<i>[%not_set%]</i>)'; |
551 | 558 | } |
552 | - if($ph['description'] == '') { |
|
559 | + if($ph['description'] == '') { |
|
553 | 560 | $ph['description'] = '(<i>[%not_set%]</i>)'; |
554 | 561 | } |
555 | - if($ph['introtext'] == '') { |
|
562 | + if($ph['introtext'] == '') { |
|
556 | 563 | $ph['introtext'] = '(<i>[%not_set%]</i>)'; |
557 | 564 | } |
558 | - if($ph['alias'] == '') { |
|
565 | + if($ph['alias'] == '') { |
|
559 | 566 | $ph['alias'] = '(<i>[%not_set%]</i>)'; |
560 | 567 | } |
561 | 568 | |
@@ -564,7 +571,8 @@ discard block |
||
564 | 571 | return implode("\n", $output); |
565 | 572 | } |
566 | 573 | |
567 | -function getRecentInfoRowTpl() { |
|
574 | +function getRecentInfoRowTpl() |
|
575 | +{ |
|
568 | 576 | $tpl = ' |
569 | 577 | <tr> |
570 | 578 | <td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td> |
@@ -593,11 +601,13 @@ discard block |
||
593 | 601 | } |
594 | 602 | |
595 | 603 | // setup icons |
596 | -function wrapIcon($i, $action) { |
|
604 | +function wrapIcon($i, $action) |
|
605 | +{ |
|
597 | 606 | return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i); |
598 | 607 | } |
599 | 608 | |
600 | -function getStartUpScript() { |
|
609 | +function getStartUpScript() |
|
610 | +{ |
|
601 | 611 | $script = ' |
602 | 612 | <script type="text/javascript"> |
603 | 613 | function hideConfigCheckWarning(key) { |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | $modx->getSettings(); |
6 | 6 | $modx->invokeEvent('OnWebPageInit'); |
7 | 7 | |
8 | -$vword = new VeriWord(148,60); |
|
8 | +$vword = new VeriWord(148, 60); |
|
9 | 9 | $vword->output_image(); |
10 | 10 | $vword->destroy_image(); |
11 | 11 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord{ |
|
45 | 45 | |
46 | 46 | /* path to font directory*/ |
47 | 47 | public $dir_font = "ttf/"; |
@@ -52,44 +52,44 @@ discard block |
||
52 | 52 | public $im_height = 0; |
53 | 53 | public $im; |
54 | 54 | |
55 | - public function __construct($w=200, $h=80) { |
|
55 | + public function __construct($w = 200, $h = 80){ |
|
56 | 56 | /* create session to set word for verification */ |
57 | 57 | $this->set_veriword(); |
58 | - $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
|
58 | + $this->dir_font = dirname(__FILE__).'/'.$this->dir_font; |
|
59 | 59 | $this->im_width = $w; |
60 | 60 | $this->im_height = $h; |
61 | 61 | } |
62 | 62 | |
63 | - public function set_veriword() { |
|
63 | + public function set_veriword(){ |
|
64 | 64 | /* create session variable for verification, |
65 | 65 | you may change the session variable name */ |
66 | 66 | $this->word = $this->pick_word(); |
67 | 67 | $_SESSION['veriword'] = $this->word; |
68 | 68 | } |
69 | 69 | |
70 | - public function output_image() { |
|
70 | + public function output_image(){ |
|
71 | 71 | /* output the image as jpeg */ |
72 | 72 | $this->draw_image(); |
73 | 73 | header("Content-type: image/jpeg"); |
74 | 74 | imagejpeg($this->im); |
75 | 75 | } |
76 | 76 | |
77 | - public function pick_word() { |
|
77 | + public function pick_word(){ |
|
78 | 78 | global $modx; |
79 | 79 | // set default words |
80 | - $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
80 | + $words = "MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
|
81 | 81 | $words = $modx->config['captcha_words'] ? $modx->config['captcha_words'] : $words; |
82 | 82 | $arr_words = array_filter(array_map('trim', explode(',', $words))); |
83 | 83 | |
84 | 84 | /* pick one randomly for text verification */ |
85 | - return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
|
85 | + return (string) $arr_words[array_rand($arr_words)].rand(10, 999); |
|
86 | 86 | } |
87 | 87 | |
88 | - public function draw_text() { |
|
88 | + public function draw_text(){ |
|
89 | 89 | $dir = dir($this->dir_font); |
90 | 90 | $fontstmp = array(); |
91 | 91 | while (false !== ($file = $dir->read())) { |
92 | - if(substr($file, -4) == '.ttf') { |
|
92 | + if (substr($file, -4) == '.ttf') { |
|
93 | 93 | $fontstmp[] = $this->dir_font.$file; |
94 | 94 | } |
95 | 95 | } |
@@ -97,35 +97,35 @@ discard block |
||
97 | 97 | $text_font = (string) $fontstmp[array_rand($fontstmp)]; |
98 | 98 | |
99 | 99 | /* angle for text inclination */ |
100 | - $text_angle = rand(-9,9); |
|
100 | + $text_angle = rand(-9, 9); |
|
101 | 101 | /* initial text size */ |
102 | 102 | $text_size = 30; |
103 | 103 | /* calculate text width and height */ |
104 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
105 | - $text_width = $box[2]-$box[0]; //text width |
|
106 | - $text_height= $box[5]-$box[3]; //text height |
|
104 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
105 | + $text_width = $box[2] - $box[0]; //text width |
|
106 | + $text_height = $box[5] - $box[3]; //text height |
|
107 | 107 | |
108 | 108 | /* adjust text size */ |
109 | - $text_size = round((20 * $this->im_width)/$text_width); |
|
109 | + $text_size = round((20 * $this->im_width) / $text_width); |
|
110 | 110 | |
111 | 111 | /* recalculate text width and height */ |
112 | - $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word); |
|
113 | - $text_width = $box[2]-$box[0]; //text width |
|
114 | - $text_height= $box[5]-$box[3]; //text height |
|
112 | + $box = imagettfbbox($text_size, $text_angle, $text_font, $this->word); |
|
113 | + $text_width = $box[2] - $box[0]; //text width |
|
114 | + $text_height = $box[5] - $box[3]; //text height |
|
115 | 115 | |
116 | 116 | /* calculate center position of text */ |
117 | - $text_x = ($this->im_width - $text_width)/2; |
|
118 | - $text_y = ($this->im_height - $text_height)/2; |
|
117 | + $text_x = ($this->im_width - $text_width) / 2; |
|
118 | + $text_y = ($this->im_height - $text_height) / 2; |
|
119 | 119 | |
120 | 120 | /* create canvas for text drawing */ |
121 | - $im_text = imagecreate ($this->im_width, $this->im_height); |
|
122 | - $bg_color = imagecolorallocate ($im_text, 255, 255, 255); |
|
121 | + $im_text = imagecreate($this->im_width, $this->im_height); |
|
122 | + $bg_color = imagecolorallocate($im_text, 255, 255, 255); |
|
123 | 123 | |
124 | 124 | /* pick color for text */ |
125 | - $text_color = imagecolorallocate ($im_text, 0, 51, 153); |
|
125 | + $text_color = imagecolorallocate($im_text, 0, 51, 153); |
|
126 | 126 | |
127 | 127 | /* draw text into canvas */ |
128 | - imagettftext ( $im_text, |
|
128 | + imagettftext($im_text, |
|
129 | 129 | $text_size, |
130 | 130 | $text_angle, |
131 | 131 | $text_x, |
@@ -140,19 +140,19 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | |
143 | - public function draw_image() { |
|
143 | + public function draw_image(){ |
|
144 | 144 | |
145 | 145 | /* pick one background image randomly from image directory */ |
146 | - $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
|
146 | + $img_file = $this->dir_noise."noise".rand(1, 4).".jpg"; |
|
147 | 147 | |
148 | 148 | /* create "noise" background image from your image stock*/ |
149 | - $noise_img = @imagecreatefromjpeg ($img_file); |
|
149 | + $noise_img = @imagecreatefromjpeg($img_file); |
|
150 | 150 | $noise_width = imagesx($noise_img); |
151 | 151 | $noise_height = imagesy($noise_img); |
152 | 152 | |
153 | 153 | /* resize the background image to fit the size of image output */ |
154 | - $this->im = imagecreatetruecolor($this->im_width,$this->im_height); |
|
155 | - imagecopyresampled ($this->im, |
|
154 | + $this->im = imagecreatetruecolor($this->im_width, $this->im_height); |
|
155 | + imagecopyresampled($this->im, |
|
156 | 156 | $noise_img, |
157 | 157 | 0, 0, 0, 0, |
158 | 158 | $this->im_width, |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | $noise_height); |
162 | 162 | |
163 | 163 | /* put text image into background image */ |
164 | - imagecopymerge ( $this->im, |
|
164 | + imagecopymerge($this->im, |
|
165 | 165 | $this->draw_text(), |
166 | 166 | 0, 0, 0, 0, |
167 | 167 | $this->im_width, |
168 | 168 | $this->im_height, |
169 | - 70 ); |
|
169 | + 70); |
|
170 | 170 | |
171 | 171 | return $this->im; |
172 | 172 | } |
173 | 173 | |
174 | - public function destroy_image() { |
|
174 | + public function destroy_image(){ |
|
175 | 175 | |
176 | 176 | imagedestroy($this->im); |
177 | 177 |
@@ -41,7 +41,8 @@ discard block |
||
41 | 41 | ## see sample.php for test and usage |
42 | 42 | ## sample URL: http://www.program-ruti.org/veriword/ |
43 | 43 | #### |
44 | -class VeriWord { |
|
44 | +class VeriWord |
|
45 | +{ |
|
45 | 46 | |
46 | 47 | /* path to font directory*/ |
47 | 48 | public $dir_font = "ttf/"; |
@@ -52,7 +53,8 @@ discard block |
||
52 | 53 | public $im_height = 0; |
53 | 54 | public $im; |
54 | 55 | |
55 | - public function __construct($w=200, $h=80) { |
|
56 | + public function __construct($w=200, $h=80) |
|
57 | + { |
|
56 | 58 | /* create session to set word for verification */ |
57 | 59 | $this->set_veriword(); |
58 | 60 | $this->dir_font = dirname(__FILE__) . '/' . $this->dir_font; |
@@ -60,21 +62,24 @@ discard block |
||
60 | 62 | $this->im_height = $h; |
61 | 63 | } |
62 | 64 | |
63 | - public function set_veriword() { |
|
65 | + public function set_veriword() |
|
66 | + { |
|
64 | 67 | /* create session variable for verification, |
65 | 68 | you may change the session variable name */ |
66 | 69 | $this->word = $this->pick_word(); |
67 | 70 | $_SESSION['veriword'] = $this->word; |
68 | 71 | } |
69 | 72 | |
70 | - public function output_image() { |
|
73 | + public function output_image() |
|
74 | + { |
|
71 | 75 | /* output the image as jpeg */ |
72 | 76 | $this->draw_image(); |
73 | 77 | header("Content-type: image/jpeg"); |
74 | 78 | imagejpeg($this->im); |
75 | 79 | } |
76 | 80 | |
77 | - public function pick_word() { |
|
81 | + public function pick_word() |
|
82 | + { |
|
78 | 83 | global $modx; |
79 | 84 | // set default words |
80 | 85 | $words="MODX,Access,Better,BitCode,Chunk,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Oscope,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote"; |
@@ -85,7 +90,8 @@ discard block |
||
85 | 90 | return (string) $arr_words[array_rand($arr_words)].rand(10,999); |
86 | 91 | } |
87 | 92 | |
88 | - public function draw_text() { |
|
93 | + public function draw_text() |
|
94 | + { |
|
89 | 95 | $dir = dir($this->dir_font); |
90 | 96 | $fontstmp = array(); |
91 | 97 | while (false !== ($file = $dir->read())) { |
@@ -140,7 +146,8 @@ discard block |
||
140 | 146 | } |
141 | 147 | |
142 | 148 | |
143 | - public function draw_image() { |
|
149 | + public function draw_image() |
|
150 | + { |
|
144 | 151 | |
145 | 152 | /* pick one background image randomly from image directory */ |
146 | 153 | $img_file = $this->dir_noise."noise".rand(1,4).".jpg"; |
@@ -171,7 +178,8 @@ discard block |
||
171 | 178 | return $this->im; |
172 | 179 | } |
173 | 180 | |
174 | - public function destroy_image() { |
|
181 | + public function destroy_image() |
|
182 | + { |
|
175 | 183 | |
176 | 184 | imagedestroy($this->im); |
177 | 185 |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | global $site_sessionname; |
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | -function genEvoSessionName() { |
|
6 | +function genEvoSessionName(){ |
|
7 | 7 | $_ = crc32(__FILE__); |
8 | 8 | $_ = sprintf('%u', $_); |
9 | - return 'evo' . base_convert($_,10,36); |
|
9 | + return 'evo'.base_convert($_, 10, 36); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | function startCMSSession(){ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | session_name($site_sessionname); |
17 | 17 | removeInvalidCmsSessionIds($site_sessionname); |
18 | - $cookieExpiration= 0; |
|
18 | + $cookieExpiration = 0; |
|
19 | 19 | $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port); |
20 | 20 | $cookiePath = !empty($session_cookie_path) ? $session_cookie_path : MODX_BASE_URL; |
21 | 21 | $cookieDomain = !empty($session_cookie_domain) ? $session_cookie_domain : ''; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | session_start(); |
24 | 24 | $key = "modx.mgr.session.cookie.lifetime"; |
25 | 25 | if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
26 | - $cookieLifetime= (int)$_SESSION[$key]; |
|
27 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
26 | + $cookieLifetime = (int) $_SESSION[$key]; |
|
27 | + if ($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME'] + $cookieLifetime; |
|
28 | 28 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
29 | 29 | } |
30 | 30 | if (!isset($_SESSION['modx.session.created.time'])) { |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) { |
|
35 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name){ |
|
36 | 36 | if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
37 | 37 | { |
38 | 38 | unset($storage[$session_name]); |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -function removeInvalidCmsSessionIds($session_name) { |
|
42 | +function removeInvalidCmsSessionIds($session_name){ |
|
43 | 43 | // session ids is invalid iff it is empty string |
44 | 44 | // storage priorioty can see in PHP source ext/session/session.c |
45 | 45 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |
@@ -3,13 +3,15 @@ discard block |
||
3 | 3 | global $site_sessionname; |
4 | 4 | $site_sessionname = genEvoSessionName(); // For legacy extras not using startCMSSession |
5 | 5 | |
6 | -function genEvoSessionName() { |
|
6 | +function genEvoSessionName() |
|
7 | +{ |
|
7 | 8 | $_ = crc32(__FILE__); |
8 | 9 | $_ = sprintf('%u', $_); |
9 | 10 | return 'evo' . base_convert($_,10,36); |
10 | 11 | } |
11 | 12 | |
12 | -function startCMSSession(){ |
|
13 | +function startCMSSession() |
|
14 | +{ |
|
13 | 15 | |
14 | 16 | global $site_sessionname, $https_port, $session_cookie_path, $session_cookie_domain; |
15 | 17 | |
@@ -22,24 +24,27 @@ discard block |
||
22 | 24 | session_set_cookie_params($cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
23 | 25 | session_start(); |
24 | 26 | $key = "modx.mgr.session.cookie.lifetime"; |
25 | - if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
27 | + if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) { |
|
26 | 28 | $cookieLifetime= (int)$_SESSION[$key]; |
27 | - if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
29 | + if($cookieLifetime) { |
|
30 | + $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime; |
|
31 | + } |
|
28 | 32 | setcookie(session_name(), session_id(), $cookieExpiration, $cookiePath, $cookieDomain, $secure, true); |
29 | 33 | } |
30 | - if (!isset($_SESSION['modx.session.created.time'])) { |
|
34 | + if (!isset($_SESSION['modx.session.created.time'])) { |
|
31 | 35 | $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME']; |
32 | 36 | } |
33 | 37 | } |
34 | 38 | |
35 | -function removeInvalidCmsSessionFromStorage(&$storage, $session_name) { |
|
36 | - if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) |
|
37 | - { |
|
39 | +function removeInvalidCmsSessionFromStorage(&$storage, $session_name) |
|
40 | +{ |
|
41 | + if (isset($storage[$session_name]) && ($storage[$session_name] === '' || $storage[$session_name] === 'deleted')) { |
|
38 | 42 | unset($storage[$session_name]); |
39 | 43 | } |
40 | 44 | } |
41 | 45 | |
42 | -function removeInvalidCmsSessionIds($session_name) { |
|
46 | +function removeInvalidCmsSessionIds($session_name) |
|
47 | +{ |
|
43 | 48 | // session ids is invalid iff it is empty string |
44 | 49 | // storage priorioty can see in PHP source ext/session/session.c |
45 | 50 | removeInvalidCmsSessionFromStorage($_COOKIE, $session_name); |