Rev 977 | Rev 1050 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 977 | Rev 991 | ||
---|---|---|---|
Line 113... | Line 113... | ||
113 | // TODO: Split our OIDplus root OIDs into the real OID tree (1, 1.3, 1.3.6, ...) |
113 | // TODO: Split our OIDplus root OIDs into the real OID tree (1, 1.3, 1.3.6, ...) |
114 | $cont .= make_line(CMD_DESCRIPTION, 'Here, you can find the root OIDs'); |
114 | $cont .= make_line(CMD_DESCRIPTION, 'Here, you can find the root OIDs'); |
115 | } else { |
115 | } else { |
116 | $res = OIDplus::db()->query("select * from ###objects where id = 'oid:$oid';"); |
116 | $res = OIDplus::db()->query("select * from ###objects where id = 'oid:$oid';"); |
117 | $row = $res->fetch_object(); |
117 | $row = $res->fetch_object(); |
118 | $desc = trim(trim(strip_tags($row->description))); |
- | |
119 | $desc = str_replace("\r", "", $desc); |
118 | $desc_ary1 = handleDesc($row->title); |
120 | $desc = str_replace("\n", " ", $desc); |
119 | $desc_ary2 = handleDesc($row->description); |
121 | $desc_ary1 = explode("\r\n", wordwrap($desc, 80/*TREEVIEW_WIDTH*/, "\r\n", true)); |
- | |
122 | $desc_ary2 = explode("\r\n", wordwrap($row->title, 80/*TREEVIEW_WIDTH*/, "\r\n", true)); |
- | |
123 | if (implode('',$desc_ary1) == '') $desc_ary1 = array(); |
- | |
124 | if (implode('',$desc_ary2) == '') $desc_ary2 = array(); |
- | |
125 | $desc_ary = array_merge($desc_ary1, $desc_ary2); |
120 | $desc_ary = array_merge($desc_ary1, $desc_ary2); |
- | 121 | $prev_line = ''; |
|
126 | foreach ($desc_ary as $line_idx => $line) { |
122 | foreach ($desc_ary as $line_idx => $line) { |
- | 123 | if ($line == $prev_line) continue; |
|
127 | if ($line_idx >= 10/*DESCEDIT_LINES*/) break; |
124 | if ($line_idx >= 10/*DESCEDIT_LINES*/) break; |
128 | $cont .= make_line(CMD_DESCRIPTION, $line); |
125 | $cont .= make_line(CMD_DESCRIPTION, $line); |
- | 126 | $prev_line = $line; |
|
129 | } |
127 | } |
130 | } |
128 | } |
131 | 129 | ||
132 | //echo "****$dos_id.OID\r\n"; |
130 | //echo "****$dos_id.OID\r\n"; |
133 | //echo "$cont\r\n"; |
131 | //echo "$cont\r\n"; |
Line 151... | Line 149... | ||
151 | } |
149 | } |
152 | 150 | ||
153 | unlink($tmp_file); |
151 | unlink($tmp_file); |
154 | 152 | ||
155 | OIDplus::invoke_shutdown(); |
153 | OIDplus::invoke_shutdown(); |
- | 154 | ||
- | 155 | # --- |
|
- | 156 | ||
- | 157 | function handleDesc($desc) { |
|
- | 158 | $desc = preg_replace('/\<br(\s*)?\/?\>/i', "\n", $desc); // br2nl |
|
- | 159 | $desc = strip_tags($desc); |
|
- | 160 | $desc = str_replace(' ', ' ', $desc); |
|
- | 161 | $desc = html_entity_decode($desc); |
|
- | 162 | $desc = str_replace("\r", "", $desc); |
|
- | 163 | $desc = str_replace("\n", " ", $desc); |
|
- | 164 | $desc = str_replace("\t", " ", $desc); |
|
- | 165 | $desc = trim($desc); |
|
- | 166 | $desc_ary = explode("\r\n", wordwrap($desc, 75, "\r\n", true)); |
|
- | 167 | if (implode('',$desc_ary) == '') $desc_ary = array(); |
|
- | 168 | return $desc_ary; |
|
- | 169 | } |