Changeset 17023
- Timestamp:
- 08/19/13 16:32:16 (11 years ago)
- Location:
- trunk/FACT++/www/smartfact
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/smartfact/index.js
r15165 r17023 203 203 204 204 205 function submit(script )205 function submit(script, isIrq) 206 206 { 207 207 var inputs = document.getElementsByTagName("input"); 208 208 209 var args = "start="+script+".js"; 209 var args = isIrq ? "interrupt="+script : "start="+script+".js"; 210 210 211 for (var i=0; i<inputs.length; i++) 211 212 args += "&"+inputs[i].name+"="+inputs[i].value; … … 241 242 242 243 var title = lines[0]; 243 var is_cmd = title[0]=='*'; 244 var is_cmd = title[0]=='*' || title[0]=='!'; 245 var is_irq = title[0]=='!'; 244 246 var script = title.split('|'); 245 247 if (is_cmd) … … 347 349 if (is_cmd) 348 350 { 349 sp1.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(script ); this.style.backgroundColor=''; };351 sp1.onclick = function () { this.style.backgroundColor='rgba(0,0,0,0.77)'; submit(script, is_irq); this.style.backgroundColor=''; }; 350 352 } 351 353 else -
trunk/FACT++/www/smartfact/index.php
r15164 r17023 169 169 // -------------------------------------------------------------------- 170 170 171 if (!isset($_GET['start']) && !isset($_GET['stop']) )171 if (!isset($_GET['start']) && !isset($_GET['stop']) && !isset($_GET['interrupt'])) 172 172 return header('HTTP/1.0 400 Command not supported'); 173 173 … … 217 217 if (isset($_GET['msg'])) 218 218 { 219 if ($_GET['msg']>=0) 220 $msg = $_GET['msg']; 219 $msg = $_GET['msg']; 221 220 unset($_GET['msg']); 222 221 } … … 271 270 } 272 271 272 if (isset($_GET['interrupt'])) 273 { 274 unset($_GET['interrupt']); 275 276 $irq = ""; 277 if (isset($_GET['interrupt'])) 278 { 279 $irq = $_GET['irq']; 280 unset($_GET['interrupt']); 281 } 282 283 $args = ""; 284 foreach ($_GET as $key => $value) 285 $args .= ' "'.$key.'"="'.$value.'"'; 286 287 $cmd = $path.'/dimctrl --user "'.$_SERVER['PHP_AUTH_USER'].'" --interrupt '.escapeshellarg($irq.$args); 288 289 // Execute 290 $str = exec($cmd, $out, $rc); 291 292 // Logging (mainly for debugging) 293 $d = date("Y/m"); 294 $path = "log/".$d; 295 if (!file_exists($path)) 296 mkdir($path, 0777, true); 297 $file = fopen($path."/exec.log", "a"); 298 fwrite($file, $cmd."\n".$str."\n\n"); 299 fclose($file); 300 } 301 273 302 if ($rc>1) 274 303 return header('HTTP/1.0 500 Execution failed [rc='.$rc."]");
Note:
See TracChangeset
for help on using the changeset viewer.