We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28957
    • 122 Posts
    Quote from: Segr at Jul 24, 2008, 07:44 AM

    сижу дума. как бы закрыть этот файл от прямого открытия в браузере?
    if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
    

    врядли, ибо этот файл именно директли и вызывается.
    Тогда я вас не понял, именно так поступают в каждом файле в папке /manager/actions и в папке /manager/processors. Объясните, что значит "закрыть этот файл от прямого открытия в браузере"?
      suvit
      РROGWAY
      • 29487
      • 385 Posts
      Я так сделал:

      <?php
      require_once '../../../manager/includes/protect.inc.php';
      include_once '../../../manager/includes/config.inc.php';
      
      startCMSSession();
      if(!isset($_SESSION['mgrValidated'])) {die("Unauthorized access");}
      
      include_once MODX_BASE_PATH.'manager/includes/document.parser.class.inc.php';
      $modx = new DocumentParser;
      
      echo "var tinyMCELinkList = new Array(\n".implode(",\n", getLines())."\n);";
      
      function getLines($parent=0, $level=0) {
      	global $modx;
      	$output = array();
      	$childs = $modx->getActiveChildren($parent);
      	foreach ($childs as $k=>$child) {
          	$caption = str_repeat(' ',$level*4).($level==0?'':'|--').($child['menutitle']?htmlspecialchars($child['menutitle'],ENT_QUOTES):htmlspecialchars($child['pagetitle'],ENT_QUOTES));
      		$output[] = "[\"".$caption." (".$child['id'].")"."\", \"[\"+\"~".$child['id']."~\"+\"]\"]";
      		$output = array_merge($output, getLines($child['id'], $level+1));
      	}
      	return $output;
      }
      ?>