Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* minor tweaks

  • Loading branch information...
commit 884f9a4a89065e3aa004c1c55921e84a6174cbec 1 parent aa08d00
Raymond xwisdom authored
236 manager/includes/controls/contextmenu.php
... ... @@ -1,122 +1,114 @@
1   -<?php
2   -
3   -global $ContextMenuCnt;
4   -$ContextMenuCnt = 0;
5   -
6   -class ContextMenu {
7   -
8   - function ContextMenu($id='',$width=120,$visible=false) {
9   - $ContextMenuCnt++;
10   - $this->html = "";
11   - $this->visible = $visible ? $visible:false;
12   - $this->width = is_numeric($width) ? intval($width):120;
13   - $this->id = id ? $id:"cntxMnu".$ContextMenuCnt; // set id
14   - }
15   -
16   - function addItem($text,$action="",$img="",$disabled=0){
17   - global $base_url;
18   - if(!$img) $img = $base_url."manager/media/images/_tx_.gif";
19   - if(substr($action,0,3)=="js:") $action = substr($action,3);
20   - else if(substr($action,0,3)=="hl:") $action = "window.location.href='".substr($action,3)."'";
21   - else $action = "window.location.href='".$action."'";
22   - $action=" onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\"";
23   - if ($disabled) $action="";
24   - $this->html .= "
25   - <div class='".($disabled ? "cntxMnuItemDisabled":"cntxMnuItem")."' $action>
26   - <img src='$img' width='16' height='16' align='absmiddle' />&nbsp;$text
27   - </div>
28   - ";
29   - }
30   -
31   - function addSeparator(){
32   - $this->html .= "
33   - <div class='cntxMnuSeparator'></div>
34   - ";
35   - }
36   -
37   - function render() {
38   - global $modx;
39   - global $ContextMenuScript;
40   -
41   - $html = $ContextMenuScript.
42   - "<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ?'visible':'hidden')."'>".$this->html."</div>";
43   - $ContextMenuScript = ""; // reset css
44   - return $html;
45   - }
46   -
47   - function getClientScriptObject(){
48   - return "getCntxMenu('".$this->id."')";
49   - }
50   -}
51   -
52   -$ContextMenuScript = <<<BLOCK
53   -<script>
54   - function getCntxMenu(id) {
55   - if(self.DynElement) return new DynElement(id);
56   - else return document.getElementById(id);
57   - }
58   - function hideCntxMenu(id){
59   - var cm = getCntxMenu(id);
60   - cm.style.visibility = 'hidden';
61   - }
62   -</script>
63   -<style>
64   -.contextMenu {
65   - background-image: url("media/images/bg/context.gif");
66   - background-color: #fff;
67   - background-position: top left;
68   - background-repeat: repeat-y;
69   - margin: 0px;
70   - padding: 0px;
71   - border: 1px solid #003399;
72   - border-left-color: #eaeaea;
73   - border-top-color: #eaeaea;
74   - border-right-color: #909090;
75   - border-bottom-color: #707070;
76   - position: absolute;
77   - z-index: 10000; }
78   -
79   -.cntxMnuItem {
80   - background-image: url('media/images/_tx_.gif');
81   - cursor: pointer;
82   - font: menu;
83   - color: MenuText;
84   - padding: 3px 16px 3px 2px; }
85   -
86   -.cntxMnuItemOver {
87   - cursor: pointer;
88   - color: #000000;
89   - background-color: #FFCC00;
90   - background-position: bottom left;
91   - background-repeat: repeat-x;
92   - background-image: url("media/images/misc/buttonbar_gs.gif");
93   - font: menu;
94   - padding: 2px 15px 2px 1px;
95   - border: 1px solid #FFAA00; /*#003399;*/
96   -}
97   -
98   -.cntxMnuItemDisabled {
99   - cursor: default;
100   - font: menu;
101   - padding: 3px 16px 3px 2px;
102   - color: graytext;
103   -}
104   -.cntxMnuItem IMG, .cntxMnuItemOver IMG, .cntxMnuItemDisabled IMG {
105   - margin-right: 8px;
106   -}
107   -
108   -.cntxMnuItem IMG, .cntxMnuItemDisabled IMG {
109   - filter: gray();
110   -}
111   -
112   -.cntxMnuSeparator {
113   - font-size: 0pt;
114   - height: 1px;
115   - background-color: #6A8CCB;
116   - overflow: hidden;
117   - margin: 3px 1px 3px 28px; }
118   -
119   -</style>
120   -BLOCK;
121   -
122   -?>
  1 +<?php
  2 +
  3 +global $ContextMenuCnt;
  4 +$ContextMenuCnt = 0;
  5 +
  6 +class ContextMenu {
  7 +
  8 + function ContextMenu($id='',$width=120,$visible=false) {
  9 + $ContextMenuCnt++;
  10 + $this->html = "";
  11 + $this->visible = $visible ? $visible:false;
  12 + $this->width = is_numeric($width) ? intval($width):120;
  13 + $this->id = id ? $id:"cntxMnu".$ContextMenuCnt; // set id
  14 + }
  15 +
  16 + function addItem($text,$action="",$img="",$disabled=0){
  17 + global $base_url;
  18 + if(!$img) $img = $base_url."manager/media/images/_tx_.gif";
  19 + if(substr($action,0,3)=="js:") $action = substr($action,3);
  20 + else if(substr($action,0,3)=="hl:") $action = "window.location.href='".substr($action,3)."'";
  21 + else $action = "window.location.href='".$action."'";
  22 + $action=" onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\"";
  23 + if ($disabled) $action="";
  24 + $this->html .= "
  25 + <div class='".($disabled ? "cntxMnuItemDisabled":"cntxMnuItem")."' $action>
  26 + <img src='$img' width='16' height='16' align='absmiddle' />&nbsp;$text
  27 + </div>
  28 + ";
  29 + }
  30 +
  31 + function addSeparator(){
  32 + $this->html .= "
  33 + <div class='cntxMnuSeparator'></div>
  34 + ";
  35 + }
  36 +
  37 + function render() {
  38 + global $modx;
  39 + global $ContextMenuScript;
  40 +
  41 + $html = $ContextMenuScript.
  42 + "<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ?'visible':'hidden')."'>".$this->html."</div>";
  43 + $ContextMenuScript = ""; // reset css
  44 + return $html;
  45 + }
  46 +
  47 + function getClientScriptObject(){
  48 + return "getCntxMenu('".$this->id."')";
  49 + }
  50 +}
  51 +
  52 +$ContextMenuScript = <<<BLOCK
  53 +<script>
  54 + function getCntxMenu(id) {
  55 + if(self.DynElement) return new DynElement(id);
  56 + else return document.getElementById(id);
  57 + }
  58 + function hideCntxMenu(id){
  59 + var cm = getCntxMenu(id);
  60 + cm.style.visibility = 'hidden';
  61 + }
  62 +</script>
  63 +<style>
  64 +.contextMenu {
  65 + background: #fff url(media/images/bg/context.gif) repeat-y top left;
  66 + margin: 0;
  67 + padding: 0;
  68 + border: 1px solid #003399;
  69 + border-left-color: #eaeaea;
  70 + border-top-color: #eaeaea;
  71 + border-right-color: #909090;
  72 + border-bottom-color: #707070;
  73 + position: absolute;
  74 + z-index: 10000; }
  75 +
  76 +.cntxMnuItem {
  77 + background-image: url(media/images/_tx_.gif);
  78 + cursor: pointer;
  79 + color: #000;
  80 + padding: 3px 16px 3px 2px; }
  81 +
  82 +.cntxMnuItemOver {
  83 + cursor: pointer;
  84 + color: #000;
  85 + background: #fc0 url(media/images/misc/buttonbar_gs.gif) repeat-x bottom left;
  86 + padding: 2px 15px 2px 1px;
  87 + border: 1px solid #fa0; /*#003399;*/
  88 +}
  89 +
  90 +.cntxMnuItemDisabled {
  91 + cursor: default;
  92 + font: menu;
  93 + padding: 3px 16px 3px 2px;
  94 + color: #111;
  95 +}
  96 +.cntxMnuItem IMG, .cntxMnuItemOver IMG, .cntxMnuItemDisabled IMG {
  97 + margin-right: 8px;
  98 +}
  99 +
  100 +.cntxMnuItem IMG, .cntxMnuItemDisabled IMG {
  101 + filter: gray();
  102 +}
  103 +
  104 +.cntxMnuSeparator {
  105 + font-size: 0;
  106 + height: 1px;
  107 + background-color: #6A8CCB;
  108 + overflow: hidden;
  109 + margin: 3px 1px 3px 28px; }
  110 +
  111 +</style>
  112 +BLOCK;
  113 +
  114 +?>
13 manager/includes/document.parser.class.inc.php
@@ -397,7 +397,18 @@ function outputContent($noEvent=false) {
397 397 $header = 'Content-Type: '.$type.'; charset='.$this->config['etomite_charset'];
398 398 header($header);
399 399 if(!$this->checkPreview() && $this->documentObject['content_dispo']==1) {
400   - $name = $this->documentObject['alias'] ? $this->documentObject['alias']:preg_replace("\W","",$this->documentObject['pagetitle']);
  400 + if($this->documentObject['alias']) $name = $this->documentObject['alias'];
  401 + else {
  402 + // strip title of special characters
  403 + $name = $this->documentObject['pagetitle'];
  404 + $name = strip_tags($name);
  405 + $name = strtolower($name);
  406 + $name = preg_replace('/&.+?;/', '', $name); // kill entities
  407 + $name = preg_replace('/[^\.%a-z0-9 _-]/', '', $name);
  408 + $name = preg_replace('/\s+/', '-', $name);
  409 + $name = preg_replace('|-+|', '-', $name);
  410 + $name = trim($name, '-');
  411 + }
401 412 $header = 'Content-Disposition: attachment; filename='.$name;
402 413 header($header);
403 414 }
3  manager/media/browser/mcpuk/connectors/php/config.php
@@ -16,7 +16,8 @@
16 16 */ //FOR MODx
17 17 session_start(); if(!isset($_SESSION['mgrValidated'])) {
18 18 die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the MODx Content Manager instead of accessing this file directly.");
19   -} include("../../../../../includes/config.inc.php");
  19 +}
  20 +include("../../../../../includes/config.inc.php");
20 21 // connect to the database
21 22 if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) {
22 23 die("Failed to create the database connection!");

0 comments on commit 884f9a4

Please sign in to comment.
Something went wrong with that request. Please try again.