@@ -1,12 +1,12 @@ 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_module')) { |
| 6 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -$id = (int)$_POST['id']; |
|
| 9 | +$id = (int) $_POST['id']; |
|
| 10 | 10 | $name = $modx->db->escape(trim($_POST['name'])); |
| 11 | 11 | $description = $modx->db->escape($_POST['description']); |
| 12 | 12 | $resourcefile = $modx->db->escape($_POST['resourcefile']); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | //Kyle Jaebker - added category support |
| 27 | 27 | if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) { |
| 28 | - $categoryid = (int)$_POST['categoryid']; |
|
| 28 | + $categoryid = (int) $_POST['categoryid']; |
|
| 29 | 29 | } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) { |
| 30 | 30 | $categoryid = 0; |
| 31 | 31 | } else { |
| 32 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 32 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 33 | 33 | $categoryid = checkCategory($_POST['newcategory']); |
| 34 | 34 | if (!$categoryid) { |
| 35 | 35 | $categoryid = newCategory($_POST['newcategory']); |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | $name = isset($parsed['name']) ? $parsed['name'] : $name; |
| 46 | 46 | $properties = isset($parsed['properties']) ? $parsed['properties'] : $properties; |
| 47 | 47 | $guid = isset($parsed['guid']) ? $parsed['guid'] : $guid; |
| 48 | - $enable_sharedparams = isset($parsed['shareparams']) ? (int)$parsed['shareparams'] : $enable_sharedparams; |
|
| 48 | + $enable_sharedparams = isset($parsed['shareparams']) ? (int) $parsed['shareparams'] : $enable_sharedparams; |
|
| 49 | 49 | |
| 50 | 50 | $description = isset($parsed['description']) ? $parsed['description'] : $description; |
| 51 | - $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : ''; |
|
| 51 | + $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : ''; |
|
| 52 | 52 | if ($version) { |
| 53 | - $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 53 | + $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description)); |
|
| 54 | 54 | } |
| 55 | 55 | if (isset($parsed['modx_category'])) { |
| 56 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
| 56 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
| 57 | 57 | $categoryid = getCategory($parsed['modx_category']); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // finished emptying cache - redirect |
| 112 | 112 | if ($_POST['stay'] != '') { |
| 113 | 113 | $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107"; |
| 114 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 114 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 115 | 115 | header($header); |
| 116 | 116 | } else { |
| 117 | 117 | $header = "Location: index.php?a=106&r=2"; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | // finished emptying cache - redirect |
| 169 | 169 | if ($_POST['stay'] != '') { |
| 170 | 170 | $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107"; |
| 171 | - $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay']; |
|
| 171 | + $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']; |
|
| 172 | 172 | header($header); |
| 173 | 173 | } else { |
| 174 | 174 | $modx->unlockElement(6, $id); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | public $role; |
| 8 | 8 | public $duplicateDoc = false; |
| 9 | 9 | |
| 10 | - public function checkPermissions() { |
|
| 10 | + public function checkPermissions(){ |
|
| 11 | 11 | |
| 12 | 12 | global $udperms_allowroot; |
| 13 | 13 | global $modx; |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | $document = $this->document; |
| 20 | 20 | $role = $this->role; |
| 21 | 21 | |
| 22 | - if($role==1) { |
|
| 23 | - return true; // administrator - grant all document permissions |
|
| 22 | + if ($role == 1) { |
|
| 23 | + return true; // administrator - grant all document permissions |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - if($modx->config['use_udperms']==0 || $modx->config['use_udperms']=="" || !isset($modx->config['use_udperms'])) { |
|
| 26 | + if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) { |
|
| 27 | 27 | return true; // permissions aren't in use |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $parent = $modx->db->getValue($modx->db->select('parent', $tblsc, "id='{$this->document}'")); |
| 31 | - if($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | - if (($this->duplicateDoc==true || $document==0) && $parent==0 && $udperms_allowroot==0) { |
|
| 31 | + if ($document == 0 && $parent == NULL && $udperms_allowroot == 1) return true; // User is allowed to create new document in root |
|
| 32 | + if (($this->duplicateDoc == true || $document == 0) && $parent == 0 && $udperms_allowroot == 0) { |
|
| 33 | 33 | return false; // deny duplicate || create new document at root if Allow Root is No |
| 34 | 34 | } |
| 35 | 35 | |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | are private to the manager users will not be private to web users if the |
| 45 | 45 | document group is not assigned to a web user group and visa versa. |
| 46 | 46 | */ |
| 47 | - $permissionsok = false; // set permissions to false |
|
| 47 | + $permissionsok = false; // set permissions to false |
|
| 48 | 48 | |
| 49 | 49 | $rs = $modx->db->select( |
| 50 | 50 | 'count(DISTINCT sc.id)', |
| 51 | 51 | "{$tblsc} AS sc |
| 52 | 52 | LEFT JOIN {$tbldg} AS dg on dg.document = sc.id |
| 53 | 53 | LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group", |
| 54 | - "sc.id='{$this->document}' AND (". (empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||" ) . " sc.privatemgr = 0)" |
|
| 54 | + "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)" |
|
| 55 | 55 | ); |
| 56 | 56 | $limit = $modx->db->getValue($rs); |
| 57 | - if($limit==1) $permissionsok = true; |
|
| 57 | + if ($limit == 1) $permissionsok = true; |
|
| 58 | 58 | |
| 59 | 59 | return $permissionsok; |
| 60 | 60 | } |
@@ -1,29 +1,29 @@ 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('new_module')) { |
|
| 5 | +if (!$modx->hasPermission('new_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 | |
| 14 | 14 | // create globally unique identifiers (guid) |
| 15 | 15 | function createGUID(){ |
| 16 | - srand((double)microtime()*1000000); |
|
| 17 | - $r = rand() ; |
|
| 18 | - $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1); |
|
| 19 | - $m = md5 ($u); |
|
| 16 | + srand((double) microtime() * 1000000); |
|
| 17 | + $r = rand(); |
|
| 18 | + $u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1); |
|
| 19 | + $m = md5($u); |
|
| 20 | 20 | return $m; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | // count duplicates |
| 24 | 24 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'")); |
| 25 | 25 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 26 | -if($count>=1) $count = ' '.($count+1); |
|
| 26 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 27 | 27 | else $count = ''; |
| 28 | 28 | |
| 29 | 29 | // duplicate module |
@@ -68,5 +68,5 @@ discard block |
||
| 68 | 68 | $_SESSION['itemname'] = $name; |
| 69 | 69 | |
| 70 | 70 | // finish duplicating - redirect to new module |
| 71 | -$header="Location: index.php?r=2&a=108&id=$newid"; |
|
| 71 | +$header = "Location: index.php?r=2&a=108&id=$newid"; |
|
| 72 | 72 | header($header); |
@@ -1,27 +1,27 @@ 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('new_document') || !$modx->hasPermission('save_document')) { |
|
| 5 | +if (!$modx->hasPermission('new_document') || !$modx->hasPermission('save_document')) { |
|
| 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 | $children = array(); |
| 15 | 15 | |
| 16 | 16 | // check permissions on the document |
| 17 | -include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php"; |
|
| 17 | +include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php"; |
|
| 18 | 18 | $udperms = new udperms(); |
| 19 | 19 | $udperms->user = $modx->getLoginUserID(); |
| 20 | 20 | $udperms->document = $id; |
| 21 | 21 | $udperms->role = $_SESSION['mgrRole']; |
| 22 | 22 | $udperms->duplicateDoc = true; |
| 23 | 23 | |
| 24 | -if(!$udperms->checkPermissions()) { |
|
| 24 | +if (!$udperms->checkPermissions()) { |
|
| 25 | 25 | $modx->webAlertAndQuit($_lang["access_permission_denied"]); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $_SESSION['itemname'] = $name; |
| 34 | 34 | |
| 35 | 35 | // finish cloning - redirect |
| 36 | -$header="Location: index.php?r=1&a=3&id=$id"; |
|
| 36 | +$header = "Location: index.php?r=1&a=3&id=$id"; |
|
| 37 | 37 | header($header); |
| 38 | 38 | |
| 39 | -function duplicateDocument($docid, $parent=null, $_toplevel=0) { |
|
| 39 | +function duplicateDocument($docid, $parent = null, $_toplevel = 0){ |
|
| 40 | 40 | global $modx, $_lang; |
| 41 | 41 | |
| 42 | 42 | // invoke OnBeforeDocDuplicate event |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $content = $modx->db->getRow($rs); |
| 58 | 58 | |
| 59 | 59 | // Handle incremental ID |
| 60 | - switch($modx->config['docid_incrmnt_method']) |
|
| 60 | + switch ($modx->config['docid_incrmnt_method']) |
|
| 61 | 61 | { |
| 62 | 62 | case '1': |
| 63 | 63 | $from = "{$tblsc} AS T0 LEFT JOIN {$tblsc} AS T1 ON T0.id + 1 = T1.id"; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $content['id'] = $modx->db->getValue($rs); |
| 66 | 66 | break; |
| 67 | 67 | case '2': |
| 68 | - $rs = $modx->db->select('MAX(id)+1',$tblsc); |
|
| 68 | + $rs = $modx->db->select('MAX(id)+1', $tblsc); |
|
| 69 | 69 | $content['id'] = $modx->db->getValue($rs); |
| 70 | 70 | break; |
| 71 | 71 | |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | $pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$docid}'")); |
| 80 | 80 | $pagetitle = $modx->db->escape($pagetitle); |
| 81 | 81 | $count = $modx->db->getRecordCount($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
| 82 | - if($count>=1) $count = ' '.($count+1); |
|
| 82 | + if ($count >= 1) $count = ' '.($count + 1); |
|
| 83 | 83 | else $count = ''; |
| 84 | 84 | |
| 85 | 85 | $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
| 86 | 86 | $content['alias'] = null; |
| 87 | - } elseif($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 87 | + } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
|
| 88 | 88 | $content['alias'] = null; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Duplicate Document TVs |
| 140 | -function duplicateTVs($oldid,$newid){ |
|
| 140 | +function duplicateTVs($oldid, $newid){ |
|
| 141 | 141 | global $modx; |
| 142 | 142 | |
| 143 | 143 | $tbltvc = $modx->getFullTableName('site_tmplvar_contentvalues'); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | // Duplicate Document Access Permissions |
| 152 | -function duplicateAccess($oldid,$newid){ |
|
| 152 | +function duplicateAccess($oldid, $newid){ |
|
| 153 | 153 | global $modx; |
| 154 | 154 | |
| 155 | 155 | $tbldg = $modx->getFullTableName('document_groups'); |
@@ -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('exec_module')) { |
|
| 5 | +if (!$modx->hasPermission('exec_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 | |
| 14 | 14 | // check if user has access permission, except admins |
| 15 | -if($_SESSION['mgrRole']!=1){ |
|
| 15 | +if ($_SESSION['mgrRole'] != 1) { |
|
| 16 | 16 | $rs = $modx->db->select( |
| 17 | 17 | 'sma.usergroup,mg.member', |
| 18 | 18 | $modx->getFullTableName("site_module_access")." sma |
@@ -24,18 +24,18 @@ discard block |
||
| 24 | 24 | $permissionAccessInt = -1; |
| 25 | 25 | |
| 26 | 26 | while ($row = $modx->db->getRow($rs)) { |
| 27 | - if($row["usergroup"] && $row["member"]) { |
|
| 27 | + if ($row["usergroup"] && $row["member"]) { |
|
| 28 | 28 | //if there are permissions and this member has permission, ofcourse |
| 29 | 29 | //this is granted |
| 30 | 30 | $permissionAccessInt = 1; |
| 31 | - } elseif ($permissionAccessInt==-1) { |
|
| 31 | + } elseif ($permissionAccessInt == -1) { |
|
| 32 | 32 | //if there are permissions but this member has no permission and the |
| 33 | 33 | //variable was still in init state we set permission to 0; no permissions |
| 34 | 34 | $permissionAccessInt = 0; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if($permissionAccessInt==0) { |
|
| 38 | + if ($permissionAccessInt == 0) { |
|
| 39 | 39 | $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106"); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | // get module data |
| 44 | 44 | $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'"); |
| 45 | 45 | $content = $modx->db->getRow($rs); |
| 46 | -if(!$content) { |
|
| 46 | +if (!$content) { |
|
| 47 | 47 | $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106"); |
| 48 | 48 | } |
| 49 | -if($content['disabled']) { |
|
| 49 | +if ($content['disabled']) { |
|
| 50 | 50 | $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106"); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -59,15 +59,15 @@ discard block |
||
| 59 | 59 | // Set the item name for logger |
| 60 | 60 | $_SESSION['itemname'] = $content['name']; |
| 61 | 61 | |
| 62 | -$output = evalModule($content["modulecode"],$parameter); |
|
| 62 | +$output = evalModule($content["modulecode"], $parameter); |
|
| 63 | 63 | echo $output; |
| 64 | 64 | include MODX_MANAGER_PATH."includes/sysalert.display.inc.php"; |
| 65 | 65 | |
| 66 | 66 | // evalModule |
| 67 | -function evalModule($moduleCode,$params){ |
|
| 67 | +function evalModule($moduleCode, $params){ |
|
| 68 | 68 | global $modx; |
| 69 | 69 | $modx->event->params = &$params; // store params inside event object |
| 70 | - if(is_array($params)) { |
|
| 70 | + if (is_array($params)) { |
|
| 71 | 71 | extract($params, EXTR_SKIP); |
| 72 | 72 | } |
| 73 | 73 | ob_start(); |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | if (isset($php_errormsg)) |
| 78 | 78 | { |
| 79 | 79 | $error_info = error_get_last(); |
| 80 | - switch($error_info['type']) |
|
| 80 | + switch ($error_info['type']) |
|
| 81 | 81 | { |
| 82 | 82 | case E_NOTICE : |
| 83 | 83 | $error_level = 1; |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | default: |
| 92 | 92 | $error_level = 99; |
| 93 | 93 | } |
| 94 | - if($modx->config['error_reporting']==='99' || 2<$error_level) |
|
| 94 | + if ($modx->config['error_reporting'] === '99' || 2 < $error_level) |
|
| 95 | 95 | { |
| 96 | - $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 96 | + $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
| 97 | 97 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -1,20 +1,20 @@ 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('new_snippet')) { |
|
| 5 | +if (!$modx->hasPermission('new_snippet')) { |
|
| 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 | // count duplicates |
| 15 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'")); |
| 16 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
| 17 | -if($count>=1) $count = ' '.($count+1); |
|
| 17 | +if ($count >= 1) $count = ' '.($count + 1); |
|
| 18 | 18 | else $count = ''; |
| 19 | 19 | |
| 20 | 20 | // duplicate Snippet |
@@ -33,5 +33,5 @@ discard block |
||
| 33 | 33 | $_SESSION['itemname'] = $name; |
| 34 | 34 | |
| 35 | 35 | // finish duplicating - redirect to new snippet |
| 36 | -$header="Location: index.php?r=2&a=22&id=$newid"; |
|
| 36 | +$header = "Location: index.php?r=2&a=22&id=$newid"; |
|
| 37 | 37 | header($header); |
@@ -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); |
@@ -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,33 +1,32 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | //:: EVO Installer Setup file |
| 3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
| 4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
| 5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
| 4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
| 5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
| 6 | 6 | } |
| 7 | -if(!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
| 7 | +if (!defined('MGR_DIR')) define('MGR_DIR', 'manager'); |
|
| 8 | 8 | |
| 9 | 9 | require_once('../'.MGR_DIR.'/includes/version.inc.php'); |
| 10 | 10 | |
| 11 | -$chunkPath = $base_path .'install/assets/chunks'; |
|
| 12 | -$snippetPath = $base_path .'install/assets/snippets'; |
|
| 13 | -$pluginPath = $base_path .'install/assets/plugins'; |
|
| 14 | -$modulePath = $base_path .'install/assets/modules'; |
|
| 15 | -$templatePath = $base_path .'install/assets/templates'; |
|
| 16 | -$tvPath = $base_path .'install/assets/tvs'; |
|
| 11 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
| 12 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
| 13 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
| 14 | +$modulePath = $base_path.'install/assets/modules'; |
|
| 15 | +$templatePath = $base_path.'install/assets/templates'; |
|
| 16 | +$tvPath = $base_path.'install/assets/tvs'; |
|
| 17 | 17 | |
| 18 | 18 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
| 19 | 19 | $mt = &$moduleTemplates; |
| 20 | -if(is_dir($templatePath) && is_readable($templatePath)) { |
|
| 20 | +if (is_dir($templatePath) && is_readable($templatePath)) { |
|
| 21 | 21 | $d = dir($templatePath); |
| 22 | 22 | while (false !== ($tplfile = $d->read())) |
| 23 | 23 | { |
| 24 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 24 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
| 25 | 25 | $params = parse_docblock($templatePath, $tplfile); |
| 26 | - if(is_array($params) && (count($params)>0)) |
|
| 26 | + if (is_array($params) && (count($params) > 0)) |
|
| 27 | 27 | { |
| 28 | 28 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 29 | - $mt[] = array |
|
| 30 | - ( |
|
| 29 | + $mt[] = array( |
|
| 31 | 30 | $params['name'], |
| 32 | 31 | $description, |
| 33 | 32 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -45,12 +44,12 @@ discard block |
||
| 45 | 44 | |
| 46 | 45 | // setup Template Variable template files |
| 47 | 46 | $mtv = &$moduleTVs; |
| 48 | -if(is_dir($tvPath) && is_readable($tvPath)) { |
|
| 47 | +if (is_dir($tvPath) && is_readable($tvPath)) { |
|
| 49 | 48 | $d = dir($tvPath); |
| 50 | 49 | while (false !== ($tplfile = $d->read())) { |
| 51 | - if(substr($tplfile, -4) != '.tpl') continue; |
|
| 50 | + if (substr($tplfile, -4) != '.tpl') continue; |
|
| 52 | 51 | $params = parse_docblock($tvPath, $tplfile); |
| 53 | - if(is_array($params) && (count($params)>0)) { |
|
| 52 | + if (is_array($params) && (count($params) > 0)) { |
|
| 54 | 53 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 55 | 54 | $mtv[] = array( |
| 56 | 55 | $params['name'], |
@@ -62,9 +61,9 @@ discard block |
||
| 62 | 61 | $params['output_widget'], |
| 63 | 62 | $params['output_widget_params'], |
| 64 | 63 | "$templatePath/{$params['filename']}", /* not currently used */ |
| 65 | - $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */ |
|
| 64 | + $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */ |
|
| 66 | 65 | $params['modx_category'], |
| 67 | - $params['lock_tv'], /* value should be 1 or 0 */ |
|
| 66 | + $params['lock_tv'], /* value should be 1 or 0 */ |
|
| 68 | 67 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 69 | 68 | ); |
| 70 | 69 | } |
@@ -74,14 +73,14 @@ discard block |
||
| 74 | 73 | |
| 75 | 74 | // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content |
| 76 | 75 | $mc = &$moduleChunks; |
| 77 | -if(is_dir($chunkPath) && is_readable($chunkPath)) { |
|
| 76 | +if (is_dir($chunkPath) && is_readable($chunkPath)) { |
|
| 78 | 77 | $d = dir($chunkPath); |
| 79 | 78 | while (false !== ($tplfile = $d->read())) { |
| 80 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 79 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 81 | 80 | continue; |
| 82 | 81 | } |
| 83 | 82 | $params = parse_docblock($chunkPath, $tplfile); |
| 84 | - if(is_array($params) && count($params) > 0) { |
|
| 83 | + if (is_array($params) && count($params) > 0) { |
|
| 85 | 84 | $mc[] = array( |
| 86 | 85 | $params['name'], |
| 87 | 86 | $params['description'], |
@@ -97,14 +96,14 @@ discard block |
||
| 97 | 96 | |
| 98 | 97 | // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties |
| 99 | 98 | $ms = &$moduleSnippets; |
| 100 | -if(is_dir($snippetPath) && is_readable($snippetPath)) { |
|
| 99 | +if (is_dir($snippetPath) && is_readable($snippetPath)) { |
|
| 101 | 100 | $d = dir($snippetPath); |
| 102 | 101 | while (false !== ($tplfile = $d->read())) { |
| 103 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 102 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 104 | 103 | continue; |
| 105 | 104 | } |
| 106 | 105 | $params = parse_docblock($snippetPath, $tplfile); |
| 107 | - if(is_array($params) && count($params) > 0) { |
|
| 106 | + if (is_array($params) && count($params) > 0) { |
|
| 108 | 107 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 109 | 108 | $ms[] = array( |
| 110 | 109 | $params['name'], |
@@ -121,14 +120,14 @@ discard block |
||
| 121 | 120 | |
| 122 | 121 | // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties |
| 123 | 122 | $mp = &$modulePlugins; |
| 124 | -if(is_dir($pluginPath) && is_readable($pluginPath)) { |
|
| 123 | +if (is_dir($pluginPath) && is_readable($pluginPath)) { |
|
| 125 | 124 | $d = dir($pluginPath); |
| 126 | 125 | while (false !== ($tplfile = $d->read())) { |
| 127 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 126 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 128 | 127 | continue; |
| 129 | 128 | } |
| 130 | 129 | $params = parse_docblock($pluginPath, $tplfile); |
| 131 | - if(is_array($params) && count($params) > 0) { |
|
| 130 | + if (is_array($params) && count($params) > 0) { |
|
| 132 | 131 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 133 | 132 | $mp[] = array( |
| 134 | 133 | $params['name'], |
@@ -140,7 +139,7 @@ discard block |
||
| 140 | 139 | $params['modx_category'], |
| 141 | 140 | $params['legacy_names'], |
| 142 | 141 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
| 143 | - (int)$params['disabled'] |
|
| 142 | + (int) $params['disabled'] |
|
| 144 | 143 | ); |
| 145 | 144 | } |
| 146 | 145 | } |
@@ -150,14 +149,14 @@ discard block |
||
| 150 | 149 | // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams |
| 151 | 150 | $mm = &$moduleModules; |
| 152 | 151 | $mdp = &$moduleDependencies; |
| 153 | -if(is_dir($modulePath) && is_readable($modulePath)) { |
|
| 152 | +if (is_dir($modulePath) && is_readable($modulePath)) { |
|
| 154 | 153 | $d = dir($modulePath); |
| 155 | 154 | while (false !== ($tplfile = $d->read())) { |
| 156 | - if(substr($tplfile, -4) != '.tpl') { |
|
| 155 | + if (substr($tplfile, -4) != '.tpl') { |
|
| 157 | 156 | continue; |
| 158 | 157 | } |
| 159 | 158 | $params = parse_docblock($modulePath, $tplfile); |
| 160 | - if(is_array($params) && count($params) > 0) { |
|
| 159 | + if (is_array($params) && count($params) > 0) { |
|
| 161 | 160 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 162 | 161 | $mm[] = array( |
| 163 | 162 | $params['name'], |
@@ -165,12 +164,12 @@ discard block |
||
| 165 | 164 | "$modulePath/{$params['filename']}", |
| 166 | 165 | $params['properties'], |
| 167 | 166 | $params['guid'], |
| 168 | - (int)$params['shareparams'], |
|
| 167 | + (int) $params['shareparams'], |
|
| 169 | 168 | $params['modx_category'], |
| 170 | 169 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 171 | 170 | ); |
| 172 | 171 | } |
| 173 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
| 172 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
| 174 | 173 | $dependencies = explode(',', $params['dependencies']); |
| 175 | 174 | foreach ($dependencies as $dependency) { |
| 176 | 175 | $dependency = explode(':', $dependency); |
@@ -241,103 +240,103 @@ discard block |
||
| 241 | 240 | // setup callback function |
| 242 | 241 | $callBackFnc = "clean_up"; |
| 243 | 242 | |
| 244 | -function clean_up($sqlParser) { |
|
| 243 | +function clean_up($sqlParser){ |
|
| 245 | 244 | $ids = array(); |
| 246 | 245 | |
| 247 | 246 | // secure web documents - privateweb |
| 248 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
| 249 | - $sql = "SELECT DISTINCT sc.id |
|
| 247 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1"); |
|
| 248 | + $sql = "SELECT DISTINCT sc.id |
|
| 250 | 249 | FROM `".$sqlParser->prefix."site_content` sc |
| 251 | 250 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
| 252 | 251 | LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group |
| 253 | 252 | WHERE wga.id>0"; |
| 254 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
| 255 | - if(!$ds) { |
|
| 253 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
| 254 | + if (!$ds) { |
|
| 256 | 255 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 257 | 256 | } |
| 258 | 257 | else { |
| 259 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 260 | - if(count($ids)>0) { |
|
| 261 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
| 258 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
| 259 | + if (count($ids) > 0) { |
|
| 260 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
| 262 | 261 | unset($ids); |
| 263 | 262 | } |
| 264 | 263 | } |
| 265 | 264 | |
| 266 | 265 | // secure manager documents privatemgr |
| 267 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
| 268 | - $sql = "SELECT DISTINCT sc.id |
|
| 266 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1"); |
|
| 267 | + $sql = "SELECT DISTINCT sc.id |
|
| 269 | 268 | FROM `".$sqlParser->prefix."site_content` sc |
| 270 | 269 | LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id |
| 271 | 270 | LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group |
| 272 | 271 | WHERE mga.id>0"; |
| 273 | - $ds = mysqli_query($sqlParser->conn,$sql); |
|
| 274 | - if(!$ds) { |
|
| 272 | + $ds = mysqli_query($sqlParser->conn, $sql); |
|
| 273 | + if (!$ds) { |
|
| 275 | 274 | echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn); |
| 276 | 275 | } |
| 277 | 276 | else { |
| 278 | - while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"]; |
|
| 279 | - if(count($ids)>0) { |
|
| 280 | - mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")"); |
|
| 277 | + while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"]; |
|
| 278 | + if (count($ids) > 0) { |
|
| 279 | + mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")"); |
|
| 281 | 280 | unset($ids); |
| 282 | 281 | } |
| 283 | 282 | } |
| 284 | 283 | } |
| 285 | 284 | |
| 286 | -function parse_docblock($element_dir, $filename) { |
|
| 285 | +function parse_docblock($element_dir, $filename){ |
|
| 287 | 286 | $params = array(); |
| 288 | - $fullpath = $element_dir . '/' . $filename; |
|
| 289 | - if(is_readable($fullpath)) { |
|
| 287 | + $fullpath = $element_dir.'/'.$filename; |
|
| 288 | + if (is_readable($fullpath)) { |
|
| 290 | 289 | $tpl = @fopen($fullpath, "r"); |
| 291 | - if($tpl) { |
|
| 290 | + if ($tpl) { |
|
| 292 | 291 | $params['filename'] = $filename; |
| 293 | 292 | $docblock_start_found = false; |
| 294 | 293 | $name_found = false; |
| 295 | 294 | $description_found = false; |
| 296 | 295 | |
| 297 | - while(!feof($tpl)) { |
|
| 296 | + while (!feof($tpl)) { |
|
| 298 | 297 | $line = fgets($tpl); |
| 299 | - if(!$docblock_start_found) { |
|
| 298 | + if (!$docblock_start_found) { |
|
| 300 | 299 | // find docblock start |
| 301 | - if(strpos($line, '/**') !== false) { |
|
| 300 | + if (strpos($line, '/**') !== false) { |
|
| 302 | 301 | $docblock_start_found = true; |
| 303 | 302 | } |
| 304 | 303 | continue; |
| 305 | - } elseif(!$name_found) { |
|
| 304 | + } elseif (!$name_found) { |
|
| 306 | 305 | // find name |
| 307 | 306 | $ma = null; |
| 308 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 307 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 309 | 308 | $params['name'] = trim($ma[1]); |
| 310 | 309 | $name_found = !empty($params['name']); |
| 311 | 310 | } |
| 312 | 311 | continue; |
| 313 | - } elseif(!$description_found) { |
|
| 312 | + } elseif (!$description_found) { |
|
| 314 | 313 | // find description |
| 315 | 314 | $ma = null; |
| 316 | - if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 315 | + if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) { |
|
| 317 | 316 | $params['description'] = trim($ma[1]); |
| 318 | 317 | $description_found = !empty($params['description']); |
| 319 | 318 | } |
| 320 | 319 | continue; |
| 321 | 320 | } else { |
| 322 | 321 | $ma = null; |
| 323 | - if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
| 322 | + if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) { |
|
| 324 | 323 | $param = trim($ma[1]); |
| 325 | 324 | $val = trim($ma[2]); |
| 326 | - if(!empty($param) && !empty($val)) { |
|
| 327 | - if($param == 'internal') { |
|
| 325 | + if (!empty($param) && !empty($val)) { |
|
| 326 | + if ($param == 'internal') { |
|
| 328 | 327 | $ma = null; |
| 329 | - if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
| 328 | + if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) { |
|
| 330 | 329 | $param = trim($ma[1]); |
| 331 | 330 | $val = trim($ma[2]); |
| 332 | 331 | } |
| 333 | 332 | //if($val !== '0' && (empty($param) || empty($val))) { |
| 334 | - if(empty($param)) { |
|
| 333 | + if (empty($param)) { |
|
| 335 | 334 | continue; |
| 336 | 335 | } |
| 337 | 336 | } |
| 338 | 337 | $params[$param] = $val; |
| 339 | 338 | } |
| 340 | - } elseif(preg_match("/^\s*\*\/\s*$/", $line)) { |
|
| 339 | + } elseif (preg_match("/^\s*\*\/\s*$/", $line)) { |
|
| 341 | 340 | break; |
| 342 | 341 | } |
| 343 | 342 | } |