From 8f1b932a2b892e8bc76b221929d10ba5d90d86d4 Mon Sep 17 00:00:00 2001 From: AgelxNash Date: Mon, 12 Aug 2013 00:28:42 +0600 Subject: [PATCH 1/5] #10073 --- manager/includes/document.parser.class.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manager/includes/document.parser.class.inc.php b/manager/includes/document.parser.class.inc.php index 97ef7d0b5a..dd7d783e85 100755 --- a/manager/includes/document.parser.class.inc.php +++ b/manager/includes/document.parser.class.inc.php @@ -4,6 +4,9 @@ * Function: This class contains the main document parsing functions * */ +if (!defined('E_DEPRECATED')) define('E_DEPRECATED', 8192); +if (!defined('E_USER_DEPRECATED')) define('E_USER_DEPRECATED', 16384); + class DocumentParser { var $db; // db object var $event, $Event; // event object From b029959fc449b01420fd29896df3124684bb5c7e Mon Sep 17 00:00:00 2001 From: AgelxNash Date: Mon, 12 Aug 2013 01:02:52 +0600 Subject: [PATCH 2/5] #10074 --- manager/includes/document.parser.class.inc.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/manager/includes/document.parser.class.inc.php b/manager/includes/document.parser.class.inc.php index dd7d783e85..3efb0cb36e 100755 --- a/manager/includes/document.parser.class.inc.php +++ b/manager/includes/document.parser.class.inc.php @@ -2615,15 +2615,14 @@ function parseProperties($propertyString) { $parameter= array (); if (!empty ($propertyString)) { $tmpParams= explode("&", $propertyString); - for ($x= 0; $x < count($tmpParams); $x++) { + $count = count($tmpParams); + for ($x= 0; $x < $count; $x++) { if (strpos($tmpParams[$x], '=', 0)) { - $pTmp= explode("=", $tmpParams[$x]); - $pvTmp= explode(";", trim($pTmp[1])); - if ($pvTmp[1] == 'list' && $pvTmp[3] != "") - $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default - else - if ($pvTmp[1] != 'list' && $pvTmp[2] != "") - $parameter[trim($pTmp[0])]= $pvTmp[2]; + $pTmp= explode("=", $tmpParams[$x], 2); + $pvTmp= explode(";", trim($pTmp[1]), 3); + $pvTmp[2] = isset($pvTvm[2]) ? $pvTmp[2] : null; + $pvTmp[3] = isset($pvTmp[3]) ? $pvTmp[3] : null; + $parameter[trim($pTmp[0])] = ($pvTmp[1] == 'list') ? $pvTmp[3] : $pvTmp[2]; } } } From 4b2057e1d356604b253b77811af46a37d9bf1248 Mon Sep 17 00:00:00 2001 From: AgelxNash Date: Mon, 12 Aug 2013 01:06:14 +0600 Subject: [PATCH 3/5] Undefined variable: usemm --- assets/plugins/qm/qm.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/plugins/qm/qm.inc.php b/assets/plugins/qm/qm.inc.php index e398a54425..f28b16db2c 100755 --- a/assets/plugins/qm/qm.inc.php +++ b/assets/plugins/qm/qm.inc.php @@ -24,7 +24,7 @@ function Qm(&$modx, $jqpath='', $loadmanagerjq='', $loadfrontendjq='', $noconfli $this->loadtb = $loadtb; $this->tbwidth = $tbwidth; $this->tbheight = $tbheight; - $this->usemm = $usemm; + $this->usemm = null; $this->hidefields = $hidefields; $this->hidetabs = $hidetabs; $this->hidesections = $hidesections; From 01a165a3d9805e9b0d126cc41e40af39fd0190b8 Mon Sep 17 00:00:00 2001 From: AgelxNash Date: Mon, 12 Aug 2013 02:34:00 +0600 Subject: [PATCH 4/5] #10075 --- manager/frames/1.php | 2 +- manager/frames/menu.php | 1 + manager/frames/nodes.php | 348 +++++++------- manager/frames/tree.php | 12 +- manager/includes/controls/contextmenu.php | 66 +-- manager/includes/controls/datagrid.class.php | 454 +++++++++--------- .../includes/document.parser.class.inc.php | 14 +- manager/includes/header.inc.php | 1 + manager/includes/log.class.inc.php | 4 +- manager/includes/paginate.inc.php | 146 +++--- manager/includes/sniff/phpSniff.class.php | 2 +- manager/index.php | 2 +- 12 files changed, 530 insertions(+), 522 deletions(-) diff --git a/manager/frames/1.php b/manager/frames/1.php index 05692303bf..ebadac3e69 100755 --- a/manager/frames/1.php +++ b/manager/frames/1.php @@ -10,7 +10,7 @@ if(!isset($modx->config['manager_tree_width'])) $modx->config['manager_tree_width'] = '260'; ?> -> +> <?php echo $site_name?> - (MODX CMS Manager) diff --git a/manager/frames/menu.php b/manager/frames/menu.php index 6dce737aab..5eac3dc52f 100644 --- a/manager/frames/menu.php +++ b/manager/frames/menu.php @@ -3,6 +3,7 @@ if (!array_key_exists('mail_check_timeperiod', $modx->config) || !is_numeric($modx->config['mail_check_timeperiod'])) { $modx->config['mail_check_timeperiod'] = 5; } +$modx_textdir = isset($modx_textdir) ? $modx_textdir : null; if ($manager_theme) $manager_theme .= '/'; $mxla = $modx_lang_attribute ? $modx_lang_attribute : 'en'; ?> diff --git a/manager/frames/nodes.php b/manager/frames/nodes.php index 8ec8d810ca..b3679386a7 100644 --- a/manager/frames/nodes.php +++ b/manager/frames/nodes.php @@ -6,116 +6,116 @@ */ if(IN_MANAGER_MODE!="true") die("INCLUDE_ORDERING_ERROR

Please use the MODx Content Manager instead of accessing this file directly."); - // save folderstate - if (isset($_GET['opened'])) $_SESSION['openedArray'] = $_GET['opened']; - if (isset($_GET['savestateonly'])) { - echo 'send some data'; //?? - exit; +// save folderstate +if (isset($_GET['opened'])) $_SESSION['openedArray'] = $_GET['opened']; +if (isset($_GET['savestateonly'])) { + echo 'send some data'; //?? + exit; +} + +$indent = $_GET['indent']; +$parent = $_GET['parent']; +$expandAll = $_GET['expandAll']; +$output = ""; +$theme = $manager_theme ? "$manager_theme/":""; + +// setup sorting +if(isset($_REQUEST['tree_sortby'])) { + $_SESSION['tree_sortby'] = $_REQUEST['tree_sortby']; +} +if(isset($_REQUEST['tree_sortdir'])) { + $_SESSION['tree_sortdir'] = $_REQUEST['tree_sortdir']; +} + +// icons by content type + +$icons = array( + 'application/rss+xml' => $_style["tree_page_rss"], + 'application/pdf' => $_style["tree_page_pdf"], + 'application/vnd.ms-word' => $_style["tree_page_word"], + 'application/vnd.ms-excel' => $_style["tree_page_excel"], + 'text/css' => $_style["tree_page_css"], + 'text/html' => $_style["tree_page_html"], + 'text/plain' => $_style["tree_page"], + 'text/xml' => $_style["tree_page_xml"], + 'text/javascript' => $_style["tree_page_js"], + 'image/gif' => isset($_style["tree_page_gif"]) ? $_style["tree_page_gif"] : $_style["tree_page"], + 'image/jpg' => isset($_style["tree_page_jpg"]) ? $_style["tree_page_jpg"] : $_style["tree_page"], + 'image/png' => isset($_style["tree_page_png"]) ? $_style["tree_page_png"] : $_style["tree_page"] +); +$iconsPrivate = array( + 'application/rss+xml' => $_style["tree_page_rss_secure"], + 'application/pdf' => $_style["tree_page_pdf_secure"], + 'application/vnd.ms-word' => $_style["tree_page_word_secure"], + 'application/vnd.ms-excel' => $_style["tree_page_excel_secure"], + 'text/css' => $_style["tree_page_css_secure"], + 'text/html' => $_style["tree_page_html_secure"], + 'text/plain' => $_style["tree_page_secure"], + 'text/xml' => $_style["tree_page_xml_secure"], + 'text/javascript' => $_style["tree_page_js_secure"], + 'image/gif' => isset($_style["tree_page_gif_secure"]) ? $_style["tree_page_gif_secure"] : $_style["tree_page_secure"], + 'image/jpg' => isset($_style["tree_page_jpg_secure"]) ? $_style["tree_page_jpg_secure"] : $_style["tree_page_secure"], + 'image/png' => isset($_style["tree_page_png_secure"]) ? $_style["tree_page_png_secure"] : $_style["tree_page_secure"] +); + +if (isset($_SESSION['openedArray'])) { + $opened = explode("|", $_SESSION['openedArray']); +} else { + $opened = array(); +} +$opened2 = array(); +$closed2 = array(); + +makeHTML($indent,$parent,$expandAll,$theme); +echo $output; + +// check for deleted documents on reload +if ($expandAll==2) { + $sql = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content` WHERE deleted=1"; + $rs = mysql_query($sql); + $row = mysql_fetch_row($rs); + $count = $row[0]; + if ($count>0) echo ''; // add a special element to let system now that the bin is full +} + +function makeHTML($indent,$parent,$expandAll,$theme) { + global $modx; + global $icons, $iconsPrivate, $theme, $_style; + global $modxDBConn, $output, $dbase, $table_prefix, $_lang, $opened, $opened2, $closed2; //added global vars + + $pad = "     "; + + // setup spacer + $spacer = ""; + for ($i = 1; $i <= $indent; $i++){ + $spacer .= "     "; } - $indent = $_GET['indent']; - $parent = $_GET['parent']; - $expandAll = $_GET['expandAll']; - $output = ""; - $theme = $manager_theme ? "$manager_theme/":""; - - // setup sorting - if(isset($_REQUEST['tree_sortby'])) { - $_SESSION['tree_sortby'] = $_REQUEST['tree_sortby']; - } - if(isset($_REQUEST['tree_sortdir'])) { - $_SESSION['tree_sortdir'] = $_REQUEST['tree_sortdir']; + if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { + // This is the first startup, set default sort order + $_SESSION['tree_sortby'] = 'menuindex'; + $_SESSION['tree_sortdir'] = 'ASC'; } - - // icons by content type - - $icons = array( - 'application/rss+xml' => $_style["tree_page_rss"], - 'application/pdf' => $_style["tree_page_pdf"], - 'application/vnd.ms-word' => $_style["tree_page_word"], - 'application/vnd.ms-excel' => $_style["tree_page_excel"], - 'text/css' => $_style["tree_page_css"], - 'text/html' => $_style["tree_page_html"], - 'text/plain' => $_style["tree_page"], - 'text/xml' => $_style["tree_page_xml"], - 'text/javascript' => $_style["tree_page_js"], - 'image/gif' => $_style["tree_page_gif"], - 'image/jpg' => $_style["tree_page_jpg"], - 'image/png' => $_style["tree_page_png"] - ); - $iconsPrivate = array( - 'application/rss+xml' => $_style["tree_page_rss_secure"], - 'application/pdf' => $_style["tree_page_pdf_secure"], - 'application/vnd.ms-word' => $_style["tree_page_word_secure"], - 'application/vnd.ms-excel' => $_style["tree_page_excel_secure"], - 'text/css' => $_style["tree_page_css_secure"], - 'text/html' => $_style["tree_page_html_secure"], - 'text/plain' => $_style["tree_page_secure"], - 'text/xml' => $_style["tree_page_xml_secure"], - 'text/javascript' => $_style["tree_page_js_secure"], - 'image/gif' => $_style["tree_page_gif_secure"], - 'image/jpg' => $_style["tree_page_jpg_secure"], - 'image/png' => $_style["tree_page_png_secure"] - ); - - if (isset($_SESSION['openedArray'])) { - $opened = explode("|", $_SESSION['openedArray']); - } else { - $opened = array(); + $orderby = $_SESSION['tree_sortby']." ".$_SESSION['tree_sortdir']; + + // Folder sorting gets special setup ;) Add menuindex and pagetitle + if($_SESSION['tree_sortby'] == 'isfolder') $orderby .= ", menuindex ASC, pagetitle"; + + $tblsc = $dbase.".`".$table_prefix."site_content`"; + $tbldg = $dbase.".`".$table_prefix."document_groups`"; + $tbldgn = $dbase.".`".$table_prefix."documentgroup_names`"; + // get document groups for current user + $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(",",$_SESSION['mgrDocgroups']) : ''; + $showProtected= false; + if (isset ($modx->config['tree_show_protected'])) { + $showProtected= (boolean) $modx->config['tree_show_protected']; } - $opened2 = array(); - $closed2 = array(); - - makeHTML($indent,$parent,$expandAll,$theme); - echo $output; - - // check for deleted documents on reload - if ($expandAll==2) { - $sql = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content` WHERE deleted=1"; - $rs = mysql_query($sql); - $row = mysql_fetch_row($rs); - $count = $row[0]; - if ($count>0) echo ''; // add a special element to let system now that the bin is full + $mgrRole= (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole']==='1') ? '1' : '0'; + if ($showProtected == false) { + $access = "AND (1={$mgrRole} OR sc.privatemgr=0". + (!$docgrp ? ")":" OR dg.document_group IN ({$docgrp}))"); } - - function makeHTML($indent,$parent,$expandAll,$theme) { - global $modx; - global $icons, $iconsPrivate, $theme, $_style; - global $modxDBConn, $output, $dbase, $table_prefix, $_lang, $opened, $opened2, $closed2; //added global vars - - $pad = "     "; - - // setup spacer - $spacer = ""; - for ($i = 1; $i <= $indent; $i++){ - $spacer .= "     "; - } - - if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) { - // This is the first startup, set default sort order - $_SESSION['tree_sortby'] = 'menuindex'; - $_SESSION['tree_sortdir'] = 'ASC'; - } - $orderby = $_SESSION['tree_sortby']." ".$_SESSION['tree_sortdir']; - - // Folder sorting gets special setup ;) Add menuindex and pagetitle - if($_SESSION['tree_sortby'] == 'isfolder') $orderby .= ", menuindex ASC, pagetitle"; - - $tblsc = $dbase.".`".$table_prefix."site_content`"; - $tbldg = $dbase.".`".$table_prefix."document_groups`"; - $tbldgn = $dbase.".`".$table_prefix."documentgroup_names`"; - // get document groups for current user - if($_SESSION['mgrDocgroups']) $docgrp = implode(",",$_SESSION['mgrDocgroups']); - $showProtected= false; - if (isset ($modx->config['tree_show_protected'])) { - $showProtected= (boolean) $modx->config['tree_show_protected']; - } - $mgrRole= (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole']==='1') ? '1' : '0'; - if ($showProtected == false) { - $access = "AND (1={$mgrRole} OR sc.privatemgr=0". - (!$docgrp ? ")":" OR dg.document_group IN ({$docgrp}))"); - } - $sql = "SELECT DISTINCT sc.id, pagetitle, parent, isfolder, published, deleted, type, menuindex, hidemenu, alias, contentType, privateweb, privatemgr, + $sql = "SELECT DISTINCT sc.id, pagetitle, parent, isfolder, published, deleted, type, menuindex, hidemenu, alias, contentType, privateweb, privatemgr, MAX(IF(1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? "":" OR dg.document_group IN ({$docgrp})") . ", 1, 0)) AS has_access FROM {$tblsc} AS sc LEFT JOIN {$tbldg} dg on dg.document = sc.id @@ -123,85 +123,85 @@ function makeHTML($indent,$parent,$expandAll,$theme) { $access GROUP BY sc.id ORDER BY {$orderby}"; - $result = mysql_query($sql, $modxDBConn); - if(mysql_num_rows($result)==0) { - $output .= '
'.$spacer.$pad.' '.$_lang['empty_folder'].'
'; - } + $result = mysql_query($sql, $modxDBConn); + if(mysql_num_rows($result)==0) { + $output .= '
'.$spacer.$pad.' '.$_lang['empty_folder'].'
'; + } - // Make sure to pass in the $modx_textdir variable to the node builder - global $modx_textdir; - - while(list($id,$pagetitle,$parent,$isfolder,$published,$deleted,$type,$menuindex,$hidemenu,$alias,$contenttype,$privateweb,$privatemgr,$hasAccess) = mysql_fetch_row($result)) - { - $pagetitle = htmlspecialchars(str_replace(array("\r\n", "\n", "\r"), '', $pagetitle)); - $protectedClass = $hasAccess==0 ? ' protectedNode' : ''; - $pagetitleDisplay = $published==0 ? "$pagetitle" : ($hidemenu==1 ? "$pagetitle":"$pagetitle"); - $pagetitleDisplay = $deleted==1 ? "$pagetitle" : $pagetitleDisplay; - $weblinkDisplay = $type=="reference" ? ' ' : '' ; - $pageIdDisplay = '('.($modx_textdir ? '‏':'').$id.')'; - $url = $modx->makeUrl($id); - - $alt = !empty($alias) ? $_lang['alias'].": ".$alias : $_lang['alias'].": -"; - $alt.= " ".$_lang['resource_opt_menu_index'].": ".$menuindex; - $alt.= " ".$_lang['resource_opt_show_menu'].": ".($hidemenu==1 ? $_lang['no']:$_lang['yes']); - $alt.= " ".$_lang['page_data_web_access'].": ".($privateweb ? $_lang['private']:$_lang['public']); - $alt.= " ".$_lang['page_data_mgr_access'].": ".($privatemgr ? $_lang['private']:$_lang['public']); - - if (!$isfolder) { - $icon = ($privateweb||$privatemgr) ? $_style["tree_page_secure"] : $_style["tree_page"]; - - if ($privateweb||$privatemgr) { - if (isset($iconsPrivate[$contenttype])) { - $icon = $iconsPrivate[$contenttype]; - } - } else { - if (isset($icons[$contenttype])) { - $icon = $icons[$contenttype]; - } + // Make sure to pass in the $modx_textdir variable to the node builder + global $modx_textdir; + + while(list($id,$pagetitle,$parent,$isfolder,$published,$deleted,$type,$menuindex,$hidemenu,$alias,$contenttype,$privateweb,$privatemgr,$hasAccess) = mysql_fetch_row($result)) + { + $pagetitle = htmlspecialchars(str_replace(array("\r\n", "\n", "\r"), '', $pagetitle)); + $protectedClass = $hasAccess==0 ? ' protectedNode' : ''; + $pagetitleDisplay = $published==0 ? "$pagetitle" : ($hidemenu==1 ? "$pagetitle":"$pagetitle"); + $pagetitleDisplay = $deleted==1 ? "$pagetitle" : $pagetitleDisplay; + $weblinkDisplay = $type=="reference" ? ' ' : '' ; + $pageIdDisplay = '('.($modx_textdir ? '‏':'').$id.')'; + $url = $modx->makeUrl($id); + + $alt = !empty($alias) ? $_lang['alias'].": ".$alias : $_lang['alias'].": -"; + $alt.= " ".$_lang['resource_opt_menu_index'].": ".$menuindex; + $alt.= " ".$_lang['resource_opt_show_menu'].": ".($hidemenu==1 ? $_lang['no']:$_lang['yes']); + $alt.= " ".$_lang['page_data_web_access'].": ".($privateweb ? $_lang['private']:$_lang['public']); + $alt.= " ".$_lang['page_data_mgr_access'].": ".($privatemgr ? $_lang['private']:$_lang['public']); + + if (!$isfolder) { + $icon = ($privateweb||$privatemgr) ? $_style["tree_page_secure"] : $_style["tree_page"]; + + if ($privateweb||$privatemgr) { + if (isset($iconsPrivate[$contenttype])) { + $icon = $iconsPrivate[$contenttype]; + } + } else { + if (isset($icons[$contenttype])) { + $icon = $icons[$contenttype]; + } + } + if($id == $modx->config['site_start']) $icon = $_style["tree_page_home"]; + elseif($id == $modx->config['error_page']) $icon = $_style["tree_page_404"]; + elseif($id == $modx->config['site_unavailable_page']) $icon = $_style["tree_page_hourglass"]; + elseif($id == $modx->config['unauthorized_page']) $icon = $_style["tree_page_info"]; + $output .= '
'.$spacer.$pad.' '; + $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; + } + else { + // expandAll: two type for partial expansion + if ($expandAll ==1 || ($expandAll == 2 && in_array($id, $opened))) + { + if ($expandAll == 1) { + array_push($opened2, $id); } if($id == $modx->config['site_start']) $icon = $_style["tree_page_home"]; elseif($id == $modx->config['error_page']) $icon = $_style["tree_page_404"]; elseif($id == $modx->config['site_unavailable_page']) $icon = $_style["tree_page_hourglass"]; elseif($id == $modx->config['unauthorized_page']) $icon = $_style["tree_page_info"]; - $output .= '
'.$spacer.$pad.' '; - $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; + $output .= '
'.$spacer.'  '; + $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; + makeHTML($indent+1,$id,$expandAll,$theme); + $output .= '
'; } else { - // expandAll: two type for partial expansion - if ($expandAll ==1 || ($expandAll == 2 && in_array($id, $opened))) - { - if ($expandAll == 1) { - array_push($opened2, $id); - } - if($id == $modx->config['site_start']) $icon = $_style["tree_page_home"]; - elseif($id == $modx->config['error_page']) $icon = $_style["tree_page_404"]; - elseif($id == $modx->config['site_unavailable_page']) $icon = $_style["tree_page_hourglass"]; - elseif($id == $modx->config['unauthorized_page']) $icon = $_style["tree_page_info"]; - $output .= '
'.$spacer.'  '; - $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; - makeHTML($indent+1,$id,$expandAll,$theme); - $output .= '
'; - } - else { - $output .= '
'.$spacer.'  '; - $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; - array_push($closed2, $id); - } + $output .= '
'.$spacer.'  '; + $output .= ''.$pagetitleDisplay.$weblinkDisplay.' '.$pageIdDisplay.'
'; + array_push($closed2, $id); } - // store vars in Javascript - if ($expandAll == 1) { - echo ' '; - } elseif ($expandAll == 0) { - echo ' '; + } + // store vars in Javascript + if ($expandAll == 1) { + echo ' '; + } elseif ($expandAll == 0) { + echo ' '; } } +} ?> \ No newline at end of file diff --git a/manager/frames/tree.php b/manager/frames/tree.php index 50dd3f60c5..ad74b63a50 100755 --- a/manager/frames/tree.php +++ b/manager/frames/tree.php @@ -1,7 +1,7 @@ INCLUDE_ORDERING_ERROR

Please use the MODx Content Manager instead of accessing this file directly."); $theme = $manager_theme ? "$manager_theme/":""; - + $modx_textdir = isset($modx_textdir) ? $modx_textdir : null; function constructLink($action, $img, $text, $allowed) { if($allowed==1) { ?>