rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
afterUpdate: function(effect) { effect.element.firstChild.style.bottom = (effect.originalHeight - effect.element.clientHeight) + 'px'; }, afterFinish: function(effect) { | scaleMode: 'box', scaleFrom: 100, restoreAfterFinish: true, beforeStartInternal: function(effect) { Element.makePositioned(effect.element.firstChild); if (window.opera) effect.element.firstChild.style.top = ""; Element.makeClipping(effect.element); Element.show(element); }, afterUpdateInternal: function(effect) { effect.element.firstChild.style.bottom = (effect.originalHeight - effect.element.clientHeight) + 'px'; }, afterFinishInternal: function(effect) { | Effect.SlideUp = function(element) { element = $(element); Element.makeClipping(element); Element.cleanWhitespace(element); Element.makePositioned(element.firstChild); Element.show(element); new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, afterUpdate: function(effect) { effect.element.firstChild.style.bottom = (effect.originalHeight - effect.element.clientHeight) + 'px'; }, afterFinish: function(effect) { Element.hide(effect.element); Element.undoClipping(effect.element); } }, arguments[1] || {}) );} |
Element.undoClipping(effect.element); } | Element.undoClipping(effect.element); Element.undoPositioned(effect.element.firstChild); effect.element.firstChild.style.bottom = oldInnerBottom; } | Effect.SlideUp = function(element) { element = $(element); Element.makeClipping(element); Element.cleanWhitespace(element); Element.makePositioned(element.firstChild); Element.show(element); new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, afterUpdate: function(effect) { effect.element.firstChild.style.bottom = (effect.originalHeight - effect.element.clientHeight) + 'px'; }, afterFinish: function(effect) { Element.hide(effect.element); Element.undoClipping(effect.element); } }, arguments[1] || {}) );} |
return new Effect.Scale(element, 0, | return new Effect.Scale(element, window.opera ? 0 : 1, | Effect.SlideUp = function(element) { element = $(element); element.cleanWhitespace(); var oldInnerBottom = $(element.firstChild).getStyle('bottom'); return new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'box', scaleFrom: 100, restoreAfterFinish: true, beforeStartInternal: function(effect) { effect.element.makePositioned(); effect.element.firstChild.makePositioned(); if(window.opera) effect.element.setStyle({top: ''}); effect.element.makeClipping(); effect.element.show(); }, afterUpdateInternal: function(effect) { effect.element.firstChild.setStyle({bottom: (effect.dims[0] - effect.element.clientHeight) + 'px' }); }, afterFinishInternal: function(effect) { effect.element.hide(); effect.element.undoClipping(); effect.element.firstChild.undoPositioned(); effect.element.undoPositioned(); effect.element.setStyle({bottom: oldInnerBottom}); } }, arguments[1] || {}) );} |
undoPositioned(effect.element); | Effect.SlideUp = function(element) { element = $(element); Element.cleanWhitespace(element); var oldInnerBottom = Element.getStyle(element.firstChild, 'bottom'); return new Effect.Scale(element, 0, Object.extend({ scaleContent: false, scaleX: false, scaleMode: 'box', scaleFrom: 100, restoreAfterFinish: true, beforeStartInternal: function(effect) { with(Element) { makePositioned(effect.element.firstChild); if(window.opera) setStyle(effect.element, {top: ''}); makeClipping(effect.element); show(element); }}, afterUpdateInternal: function(effect) { with(Element) { setStyle(effect.element.firstChild, {bottom: (effect.dims[0] - effect.element.clientHeight) + 'px' }); }}, afterFinishInternal: function(effect) { with(Element) { [hide, undoClipping].call(effect.element); undoPositioned(effect.element.firstChild); setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); }} }, arguments[1] || {}) );} |
|
dividerDragEnd(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd); | dividerDragEnd(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd, event); | function sourceDividerDragEnd(event) { dividerDragEnd(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd);} |
dividerDragStart(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd, event); | dividerDragStart(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd, event, "row-resize"); | function sourceDividerDragStart(event) { dividerDragStart(document.getElementById("divider"), dividerDrag, sourceDividerDragEnd, event);} |
this.textbox.value = recorder.testManager.getSourceForTestCase(this.testCase); | this.textbox.value = this.lastValue = recorder.testManager.getSourceForTestCase(this.testCase); | function SourceView(recorder, textbox) { this.textbox = textbox; this.recorder = recorder; this.updateView = function() { var scrollTop = this.textbox.inputField.scrollTop; //this.textbox.value = this.testCase.getSource(this.recorder.options, "New Test"); this.textbox.value = recorder.testManager.getSourceForTestCase(this.testCase); this.textbox.inputField.scrollTop = scrollTop; //log.debug("source=" + getSource()); };} |
new Effect.Scale(element, 0, { afterFinish: function(effect) { Element.hide(effect.element); } }); | return new Effect.Scale(element, window.opera ? 1 : 0, { restoreAfterFinish: true, beforeSetup: function(effect) { Element.makeClipping(effect.element); }, afterFinishInternal: function(effect) { Element.hide(effect.element); Element.undoClipping(effect.element); } }); | Effect.Squish = function(element) { new Effect.Scale(element, 0, { afterFinish: function(effect) { Element.hide(effect.element); } });} |
selenium.reset(); | this.start = function() { this.continueCurrentTest(); }; |
|
if (this.options.snap) document.addEvent('mousemove', this.checkAndDrag.bindWithEvent(this)); else document.addEvent('mousemove', this.drag.bindWithEvent(this)); document.addEvent('mouseup', this.stop.bind(this)); | this.bound.drag = this.checkAndDrag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); if (this.options.snap) document.addEvent('mousemove', this.bound.checkAndDrag); else document.addEvent('mousemove', this.bound.drag); document.addEvent('mouseup', this.bound.stop); | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } if (this.options.snap) document.addEvent('mousemove', this.checkAndDrag.bindWithEvent(this)); else document.addEvent('mousemove', this.drag.bindWithEvent(this)); document.addEvent('mouseup', this.stop.bind(this)); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if (!$chk(limit[z][i])) continue; if (limit[z][i].apply) this.limit[z][i] = limit[z][i].call(this); else this.limit[z][i] = limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
if(!this.options.sync) if(this.options.delay > 0) { this.timeout = setTimeout(this.loop.bind(this), this.options.delay*1000); } else { this.loop(); } | if(!this.options.sync) Effect.Queue.add(this); | start: function(options) { this.setOptions(options || {}); this.currentFrame = 0; this.startOn = new Date().getTime() + (this.options.delay*1000); this.finishOn = this.startOn + (this.options.duration*1000); if(this.options.beforeStart) this.options.beforeStart(this); if(!this.options.sync) if(this.options.delay > 0) { this.timeout = setTimeout(this.loop.bind(this), this.options.delay*1000); } else { this.loop(); } }, |
this.bound.drag = this.checkAndDrag.bindWithEvent(this); | this.bound.drag = this.drag.bindWithEvent(this); | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } this.bound.drag = this.checkAndDrag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); if (this.options.snap) document.addEvent('mousemove', this.bound.checkAndDrag); else document.addEvent('mousemove', this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if (!$chk(limit[z][i])) continue; if (limit[z][i].apply) this.limit[z][i] = limit[z][i].call(this); else this.limit[z][i] = limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
if (this.options.snap) document.addEvent('mousemove', this.bound.checkAndDrag); else document.addEvent('mousemove', this.bound.drag); | document.addEvent('mousemove', this.options.snap ? this.bound.checkAndDrag : this.bound.drag); | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } this.bound.drag = this.checkAndDrag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); if (this.options.snap) document.addEvent('mousemove', this.bound.checkAndDrag); else document.addEvent('mousemove', this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if (!$chk(limit[z][i])) continue; if (limit[z][i].apply) this.limit[z][i] = limit[z][i].call(this); else this.limit[z][i] = limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
if (!$chk(limit[z][i])) continue; if (limit[z][i].apply) this.limit[z][i] = limit[z][i].call(this); else this.limit[z][i] = limit[z][i]; | if ($chk(limit[z][i])) this.limit[z][i] = limit[z][i].apply ? limit[z][i].call(this) : limit[z][i]; | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } this.bound.drag = this.checkAndDrag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); if (this.options.snap) document.addEvent('mousemove', this.bound.checkAndDrag); else document.addEvent('mousemove', this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if (!$chk(limit[z][i])) continue; if (limit[z][i].apply) this.limit[z][i] = limit[z][i].call(this); else this.limit[z][i] = limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
document.addEvent('mousemove', this.move.bindWithEvent(this, el)); document.addEvent('mouseup', this.end.bind(this, el)); | this.bound.move = this.move.bindWithEvent(this, el); this.bound.end = this.end.bind(this, el); document.addEvent('mousemove', this.bound.move); document.addEvent('mouseup', this.bound.end); | start: function(event, el){ document.addEvent('mousemove', this.move.bindWithEvent(this, el)); document.addEvent('mouseup', this.end.bind(this, el)); this.fireEvent('onStart', el); event.stop(); }, |
this.startOn = new Date().getTime(); | this.state = 'idle'; this.startOn = this.options.delay*1000; | start: function(options) { this.setOptions(options || {}); this.currentFrame = 0; this.startOn = new Date().getTime(); this.finishOn = this.startOn + (this.options.duration*1000); if(this.options.beforeStart) this.options.beforeStart(this); if(!this.options.sync) this.loop(); }, |
if(this.options.beforeStart) this.options.beforeStart(this); if(!this.options.sync) this.loop(); | this.event('beforeStart'); if(!this.options.sync) Effect.Queue.add(this); | start: function(options) { this.setOptions(options || {}); this.currentFrame = 0; this.startOn = new Date().getTime(); this.finishOn = this.startOn + (this.options.duration*1000); if(this.options.beforeStart) this.options.beforeStart(this); if(!this.options.sync) this.loop(); }, |
this.mouse.start[z] = event.page[z]; } this.bound.drag = this.drag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); document.addEvent('mousemove', this.options.snap ? this.bound.checkAndDrag : this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } this.bound.drag = this.drag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); document.addEvent('mousemove', this.options.snap ? this.bound.checkAndDrag : this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if ($chk(limit[z][i])) this.limit[z][i] = limit[z][i].apply ? limit[z][i].call(this) : limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
|
this.bound.drag = this.drag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); document.addEvent('mousemove', this.options.snap ? this.bound.checkAndDrag : this.bound.drag); document.addEvent('mouseup', this.bound.stop); | start: function(event){ for (var z in this.options.modifiers){ this.value.now[z] = this.element.getStyle(this.options.modifiers[z]).toInt(); this.mouse.pos[z] = event.page[z] - this.value.now[z]; this.mouse.start[z] = event.page[z]; } this.bound.drag = this.drag.bindWithEvent(this); this.bound.checkAndDrag = this.checkAndDrag.bindWithEvent(this); this.bound.stop = this.stop.bind(this); document.addEvent('mousemove', this.options.snap ? this.bound.checkAndDrag : this.bound.drag); document.addEvent('mouseup', this.bound.stop); var limit = this.options.limit; this.limit = {'x': [], 'y': []}; for (var z in this.options.modifiers){ if (limit && limit[z]){ for (var i = 0; i < 2; i++){ if ($chk(limit[z][i])) this.limit[z][i] = limit[z][i].apply ? limit[z][i].call(this) : limit[z][i]; } } } this.fireEvent('onStart', this.element); event.stop(); }, |
|
this.nameCell.className = "nameCell"; | start: function(testName) { if (!this.log) return; this.testName = testName; this.lastLogLine = document.createElement('tr'); this.statusCell = document.createElement('td'); this.nameCell = document.createElement('td'); this.nameCell.appendChild(document.createTextNode(testName)); this.messageCell = document.createElement('td'); this.lastLogLine.appendChild(this.statusCell); this.lastLogLine.appendChild(this.nameCell); this.lastLogLine.appendChild(this.messageCell); this.loglines.appendChild(this.lastLogLine); }, |
|
dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) | dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) } else if (dm.addDownload.length == 9) { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, null, persist) | this.start = function() { GM_log("> ScriptDownloader.start"); try { if(dm.addDownload.length == 8) { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) } else { dm.addDownload(sourceUri, targetUri, parseScriptName(sourceUri), null, null, persist); } download = dm.getDownload(targetFile.path); try { dm.open(window._content, targetFile.path) } catch (e) { dm.open(window, download) } persist.progressListener = download; persist.saveURI(sourceUri, null, null, null, null, targetFile); // this seems like a huge hack, but it was actually the most reliable // way I could find to determine when downloading is complete timerId = window.setInterval(checkLoad, 200); } catch (e) { handleErrors(e); } GM_log("< ScriptDownloader.start"); } |
var o = HopDrag.obj = this; e = HopDrag.fixE(e); | var o = this.hop_window; | start : function(e) { var o = HopDrag.obj = this; e = HopDrag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.style.zIndex = ++HopDrag.zIndex; o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; } else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; } if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; } else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; } document.onmousemove = HopDrag.drag; document.onmouseup = HopDrag.end; return false; }, |
e = HopDrag.fixE(e); HopDrag.obj = o; | start : function(e) { var o = HopDrag.obj = this; e = HopDrag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.style.zIndex = ++HopDrag.zIndex; o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; } else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; } if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; } else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; } document.onmousemove = HopDrag.drag; document.onmouseup = HopDrag.end; return false; }, |
|
dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) dm.open(window._content, targetFile.path) | if(dm.addDownload.length == 8) { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) } else { dm.addDownload(sourceUri, targetUri, parseScriptName(sourceUri), null, null, persist); } | this.start = function() { try { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) dm.open(window._content, targetFile.path) download = dm.getDownload(targetFile.path); persist.progressListener = download; persist.saveURI(sourceUri, null, null, null, null, targetFile); // this seems like a huge hack, but it was actually the most reliable // way I could find to determine when downloading is complete timerId = window.setInterval(checkLoad, 200); } catch (e) { handleErrors(e); } } |
try { dm.open(window._content, targetFile.path) } catch (e) { dm.open(window, download) } | this.start = function() { try { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) dm.open(window._content, targetFile.path) download = dm.getDownload(targetFile.path); persist.progressListener = download; persist.saveURI(sourceUri, null, null, null, null, targetFile); // this seems like a huge hack, but it was actually the most reliable // way I could find to determine when downloading is complete timerId = window.setInterval(checkLoad, 200); } catch (e) { handleErrors(e); } } |
|
LOG.debug("testLoop.start()"); | this.start = function() { selenium.reset(); this.continueTest(); }; |
|
o.root.style.zIndex = ++Drag.zIndex; | start : function(e) { var o = Drag.obj = this; e = Drag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; } else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; } if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; } else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; } document.onmousemove = Drag.drag; document.onmouseup = Drag.end; return false; }, |
|
download.persist = persist; | persist.progressListener = download; | this.start = function() { try { dm.addDownload(0, sourceUri, targetUri, parseScriptName(sourceUri), null, null, null, persist) dm.open(window._content, targetFile.path) download = dm.getDownload(targetFile.path); download.persist = persist; persist.saveURI(sourceUri, null, null, null, null, targetFile); // this seems like a huge hack, but it was actually the most reliable // way I could find to determine when downloading is complete timerId = window.setInterval(checkLoad, 200); } catch (e) { handleErrors(e); } } |
testCase.debugContext.failed = false; | function start(baseURL) { if (!stopAndDo("start", baseURL)) return; selenium = createSelenium(baseURL); commandFactory = new CommandHandlerFactory(); commandFactory.registerAll(selenium); currentTest = new TestLoop(commandFactory); currentTest.getCommandInterval = function() { return stopping ? -1 : getInterval(); } currentTest.nextCommand = function() { if (testCase.debugContext.debugIndex >= 0) editor.view.rowUpdated(testCase.debugContext.debugIndex); var command = testCase.debugContext.nextCommand(); if (command == null) return null; return new SeleniumCommand(command.command, command.target, command.value); } currentTest.firstCommand = currentTest.nextCommand; // Selenium <= 0.6 only currentTest.commandStarted = function() { editor.setState("playing"); editor.view.rowUpdated(testCase.debugContext.debugIndex); editor.view.scrollToRow(testCase.debugContext.debugIndex); } currentTest.commandComplete = function(result) { if (result.failed) { testCase.debugContext.currentCommand().result = 'failed'; } else if (result.passed) { testCase.debugContext.currentCommand().result = 'passed'; } else { testCase.debugContext.currentCommand().result = 'done'; } editor.view.rowUpdated(testCase.debugContext.debugIndex); } currentTest.commandError = function() { LOG.debug("commandError"); testCase.debugContext.currentCommand().result = 'failed'; editor.view.rowUpdated(testCase.debugContext.debugIndex); } // override _testComplete to ensure testComplete is called even when // ensureNoUnhandledPopups throws any errors currentTest._testComplete = function() { try { selenium.ensureNoUnhandledPopups(); } catch (e) { LOG.error(e); } this.testComplete(); } currentTest.testComplete = function() { LOG.debug("testComplete"); editor.setState(null); currentTest = null; testCase.debugContext.reset(); editor.view.rowUpdated(testCase.debugContext.debugIndex); } currentTest.pause = function() { editor.setState("paused"); } testCase.debugContext.reset(); currentTest.start();} |
|
function start() { | function start(baseURL) { | function start() { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow('navigator:browser'); selenium = Selenium.createForFrame(window.getBrowser()); selenium.browserbot.getCurrentPage(); commandFactory = new CommandHandlerFactory(); commandFactory.registerAll(selenium); testCase.debugIndex = -1; testLoop = new TestLoop(commandFactory); testLoop.getCommandInterval = function() { return getInterval(); } testLoop.nextCommand = function() { recorder.view.rowUpdated(testCase.debugIndex); if (++testCase.debugIndex >= testCase.commands.length) { return null; } var command = testCase.commands[testCase.debugIndex]; return new SeleniumCommand(command.command, command.target, command.value); } testLoop.firstCommand = function() { testCase.debugIndex = -1; //testLoop.nextCommand.apply(this); if (++testCase.debugIndex >= testCase.commands.length) { return null; } var command = testCase.commands[testCase.debugIndex]; return new SeleniumCommand(command.command, command.target, command.value); } testLoop.commandStarted = function() { recorder.view.rowUpdated(testCase.debugIndex); } testLoop.commandComplete = function(result) { if (result.failed) { testCase.commands[testCase.debugIndex].result = 'failed'; } else if (result.passed) { testCase.commands[testCase.debugIndex].result = 'passed'; } else { testCase.commands[testCase.debugIndex].result = null; } recorder.view.rowUpdated(testCase.debugIndex); } testLoop.commandError = function() { testCase.commands[testCase.debugIndex].result = 'failed'; recorder.view.rowUpdated(testCase.debugIndex); } testLoop.testComplete = function() { testLoop = null; testCase.debugIndex = -1; recorder.view.rowUpdated(testCase.debugIndex); } testLoop.pause = function() {} testLoop.start();} |
selenium.baseURL = baseURL; | function start() { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow('navigator:browser'); selenium = Selenium.createForFrame(window.getBrowser()); selenium.browserbot.getCurrentPage(); commandFactory = new CommandHandlerFactory(); commandFactory.registerAll(selenium); testCase.debugIndex = -1; testLoop = new TestLoop(commandFactory); testLoop.getCommandInterval = function() { return getInterval(); } testLoop.nextCommand = function() { recorder.view.rowUpdated(testCase.debugIndex); if (++testCase.debugIndex >= testCase.commands.length) { return null; } var command = testCase.commands[testCase.debugIndex]; return new SeleniumCommand(command.command, command.target, command.value); } testLoop.firstCommand = function() { testCase.debugIndex = -1; //testLoop.nextCommand.apply(this); if (++testCase.debugIndex >= testCase.commands.length) { return null; } var command = testCase.commands[testCase.debugIndex]; return new SeleniumCommand(command.command, command.target, command.value); } testLoop.commandStarted = function() { recorder.view.rowUpdated(testCase.debugIndex); } testLoop.commandComplete = function(result) { if (result.failed) { testCase.commands[testCase.debugIndex].result = 'failed'; } else if (result.passed) { testCase.commands[testCase.debugIndex].result = 'passed'; } else { testCase.commands[testCase.debugIndex].result = null; } recorder.view.rowUpdated(testCase.debugIndex); } testLoop.commandError = function() { testCase.commands[testCase.debugIndex].result = 'failed'; recorder.view.rowUpdated(testCase.debugIndex); } testLoop.testComplete = function() { testLoop = null; testCase.debugIndex = -1; recorder.view.rowUpdated(testCase.debugIndex); } testLoop.pause = function() {} testLoop.start();} |
|
selenium = Selenium.createForFrame(window.getBrowser()); | selenium = Selenium.createForFrame(window.getBrowser().selectedBrowser); | function start(baseURL) { if (!stopAndDo("start", baseURL)) return; var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow('navigator:browser'); selenium = Selenium.createForFrame(window.getBrowser()); selenium.browserbot.getCurrentPage(); selenium.baseURL = baseURL; commandFactory = new CommandHandlerFactory(); commandFactory.registerAll(selenium); testLoop = new TestLoop(commandFactory); testLoop.getCommandInterval = function() { return stopping ? -1 : getInterval(); } testLoop.nextCommand = function() { if (testCase.debugContext.debugIndex >= 0) editor.view.rowUpdated(testCase.debugContext.debugIndex); var command = testCase.debugContext.nextCommand(); if (command == null) return null; return new SeleniumCommand(command.command, command.target, command.value); } testLoop.firstCommand = testLoop.nextCommand; // Selenium <= 0.6 only testLoop.commandStarted = function() { editor.setState("playing"); editor.view.rowUpdated(testCase.debugContext.debugIndex); editor.view.scrollToRow(testCase.debugContext.debugIndex); } testLoop.commandComplete = function(result) { if (result.failed) { testCase.debugContext.currentCommand().result = 'failed'; } else if (result.passed) { testCase.debugContext.currentCommand().result = 'passed'; } else { testCase.debugContext.currentCommand().result = 'done'; } editor.view.rowUpdated(testCase.debugContext.debugIndex); } testLoop.commandError = function() { LOG.debug("commandError"); testCase.debugContext.currentCommand().result = 'failed'; editor.view.rowUpdated(testCase.debugContext.debugIndex); } testLoop.testComplete = function() { LOG.debug("testComplete"); editor.setState(null); testLoop = null; testCase.debugContext.reset(); editor.view.rowUpdated(testCase.debugContext.debugIndex); } testLoop.pause = function() { editor.setState("paused"); } testCase.debugContext.reset(); testLoop.start();} |
setRunInterval(); | function start() { loadSuiteFrame();} |
|
queryString = null; | function start() { setRunInterval(); loadSuiteFrame();} |
|
if (win.inFrame) { document.getElementById(iframe).style.display= "none"; el.style.opacity= 0.8; } | el.style.opacity= 0.8; | function start_resize(w, h) { el.style.overflow = "auto"; if (win.inFrame) { document.getElementById(iframe).style.display= "none"; el.style.opacity= 0.8; } } |
this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); | if(this.handles.indexOf(handle)!=-1) { this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } | startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; var track = handle; if(track==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } Event.stop(event); } }, |
this.originalY = this.element.offsetTop - this.currentTop(); - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft(); - this.originalLeft; | this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; | startDrag: function(event) { if(Event.isLeftClick(event)) { this.active = true; var style = this.element.style; this.originalY = this.element.offsetTop - this.currentTop(); - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft(); - this.originalLeft; this.offsetY = event.clientY - this.originalY - this.originalTop; this.offsetX = event.clientX - this.originalX - this.originalLeft; Event.stop(event); } }, |
if(handle==this.track) { | var track = handle; if(track==this.track) { | startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; if(handle==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } Event.stop(event); } }, |
this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; | if(this.options.ghosting) { Position.prepare(); var offsets = Position.cumulativeOffset(this.element); this.originalY = offsets[1] - this.currentTop() - this.originalTop; this.originalX = offsets[0] - this.currentLeft() - this.originalLeft; } else { this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; } | startDrag: function(event) { if(Event.isLeftClick(event)) { this.active = true; var style = this.element.style; this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; this.offsetY = event.clientY - this.originalY - this.originalTop; this.offsetX = event.clientX - this.originalX - this.originalLeft; Event.stop(event); } }, |
var src = Event.element(event); if(src.tagName && ( src.tagName=='INPUT' || src.tagName=='SELECT' || src.tagName=='BUTTON' || src.tagName=='TEXTAREA')) return; | startDrag: function(event) { if(Event.isLeftClick(event)) { this.registerEvents(); this.active = true; var pointer = [Event.pointerX(event), Event.pointerY(event)]; var offsets = Position.cumulativeOffset(this.element); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); Event.stop(event); } }, |
|
this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0] | (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) | startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; if(handle==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0] )); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } Event.stop(event); } }, |
var style = this.element.style; this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; this.offsetY = event.clientY - this.originalY - this.originalTop; this.offsetX = event.clientX - this.originalX - this.originalLeft; | var pointer = [Event.pointerX(event), Event.pointerY(event)]; var offsets = Position.cumulativeOffset(this.element); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); | startDrag: function(event) { if(Event.isLeftClick(event)) { this.active = true; var style = this.element.style; this.originalY = this.element.offsetTop - this.currentTop() - this.originalTop; this.originalX = this.element.offsetLeft - this.currentLeft() - this.originalLeft; this.offsetY = event.clientY - this.originalY - this.originalTop; this.offsetX = event.clientX - this.originalX - this.originalLeft; Event.stop(event); } }, |
offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); | startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; if(handle==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0] )); offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } Event.stop(event); } }, |
|
this.registerEvents(); | startDrag: function(event) { if(Event.isLeftClick(event)) { // abort on form elements, fixes a Firefox issue var src = Event.element(event); if(src.tagName && ( src.tagName=='INPUT' || src.tagName=='SELECT' || src.tagName=='BUTTON' || src.tagName=='TEXTAREA')) return; this.registerEvents(); this.active = true; var pointer = [Event.pointerX(event), Event.pointerY(event)]; var offsets = Position.cumulativeOffset(this.element); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); Event.stop(event); } }, |
|
var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); | startDrag: function(event) { if(Event.isLeftClick(event)) { if(!this.disabled){ this.active = true; var handle = Event.element(event); var pointer = [Event.pointerX(event), Event.pointerY(event)]; if(handle==this.track) { var offsets = Position.cumulativeOffset(this.track); this.event = event; this.setValue(this.translateToValue( (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2) )); } else { // find the handle (prevents issues with Safari) while((this.handles.indexOf(handle) == -1) && handle.parentNode) handle = handle.parentNode; this.activeHandle = handle; this.activeHandleIdx = this.handles.indexOf(this.activeHandle); this.updateStyles(); var offsets = Position.cumulativeOffset(this.activeHandle); this.offsetX = (pointer[0] - offsets[0]); this.offsetY = (pointer[1] - offsets[1]); } } Event.stop(event); } }, |
|
new Effect2.Opacity(element, {duration:0.2, from:1.0, to:0.7}); | new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); | starteffect: function(element) { new Effect2.Opacity(element, {duration:0.2, from:1.0, to:0.7}); }, |
element._opacity = Element.getOpacity(element); Draggable._dragging[element] = true; new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); }, | element._opacity = Element.getOpacity(element); Draggable._dragging[element] = true; new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); } | starteffect: function(element) { element._opacity = Element.getOpacity(element); Draggable._dragging[element] = true; new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); }, |
starteffect: function(element) { new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); | starteffect: function(element) { element._opacity = Element.getOpacity(element); new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); | starteffect: function(element) { new Effect.Opacity(element, {duration:0.2, from:1.0, to:0.7}); }, |
element._opacity = Element.getOpacity(element); | element._opacity = Element.getOpacity(element); Draggable._dragging[element] = true; | starteffect: function(element) { element._opacity = Element.getOpacity(element); new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); }, |
new RegisterHandler().handleWindow(contentWindow); | callForWindow(new RegisterHandler(), contentWindow); | this.startForContentWindow = function(contentWindow) { new RegisterHandler().handleWindow(contentWindow); } |
if(this.indicator) Element.show(this.indicator); | if(this.options.indicator) Element.show(this.options.indicator); | startIndicator: function() { if(this.indicator) Element.show(this.indicator); }, |
xmlHttpMainMenu.open("GET", "include/submenu.php?sub=" + val, true); | xmlHttpMainMenu.open("GET", "../include/submenu.php?sub=" + val, true); | function startMenuRequest(val) { var val; createXMLHttpRequestMainMenu(); xmlHttpMainMenu.onreadystatechange = handleMenuStateChange; xmlHttpMainMenu.open("GET", "include/submenu.php?sub=" + val, true); xmlHttpMainMenu.send(null);} |
callback.argument = [ mycid ]; | startRequest:function(mycid, action) { // argument formId can be the id or name attribute value of the // HTML form, or an HTML form object. pageElements = document.getElementById(mycid); formElements = pageElements.getElementsByTagName("form"); YAHOO.util.Connect.setForm(formElements[0]); var sUrl = "/gridsphere/gridsphere" + "?ajax=true&cid=" + encodeURIComponent(mycid) + "&" + YAHOO.util.Connect._sFormData; callback.argument = [ mycid ]; var postData = null; var transaction = YAHOO.util.Connect.asyncRequest('POST', sUrl, {success:this.handleSuccess, failure:this.handleFailure, argument:[], scope:this}, postData); //Abort the transaction if it isn't completed in ten seconds. //setTimeout("YAHOO.util.Connect.abort(transaction)",10000); }, |
|
{success:this.handleSuccess, failure:this.handleFailure, argument:[], scope:this}, | {success:this.handleSuccess, failure:this.handleFailure, argument:[ mycid ], scope:this}, | startRequest:function(mycid, action) { // argument formId can be the id or name attribute value of the // HTML form, or an HTML form object. pageElements = document.getElementById(mycid); formElements = pageElements.getElementsByTagName("form"); YAHOO.util.Connect.setForm(formElements[0]); var sUrl = "/gridsphere/gridsphere" + "?ajax=true&cid=" + encodeURIComponent(mycid) + "&" + YAHOO.util.Connect._sFormData; callback.argument = [ mycid ]; var postData = null; var transaction = YAHOO.util.Connect.asyncRequest('POST', sUrl, {success:this.handleSuccess, failure:this.handleFailure, argument:[], scope:this}, postData); //Abort the transaction if it isn't completed in ten seconds. //setTimeout("YAHOO.util.Connect.abort(transaction)",10000); }, |
if(!(speed[0] || speed[1])) return; | startScrolling: function(speed) { this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; this.lastScrolled = new Date(); this.scrollInterval = setInterval(this.scroll.bind(this), 10); }, |
|
testFrame.scrollToTop(); | currentHtmlTestCase = new HtmlTestCase(testFrame.getDocument()); currentHtmlTestCase.addBreakpointSupport(); | function startTest() { //todo move testFrame init to testcase.rest() testFrame.removeLoadListener(startTest); setHighlightOption(); testFrame.scrollToTop(); currentTest = new HtmlRunnerTestLoop(currentHtmlTestCase, commandFactory); //todo: move testFailed and storedVars to TestCase testFailed = false; storedVars = new Object(); currentTest.start(); // PL: for the purpose of testing //testLoop.waitForConditionTimeout = 2000;} |
runOptions.reset(); | function startTest() { testFrame.scrollToTop(); //todo: move testFailed and storedVars to TestCase testFailed = false; storedVars = new Object(); currentTest = new HtmlRunnerTestLoop(testFrame.getCurrentTestCase(), commandFactory); currentTest.start();} |
|
} | function startTest() { // // invoke test setup // setUpPage(); try { runTest(); if (builder.initializationError == null) { setResult(null, null); } else { setResult("skip", builder.initializationError); } } catch(ex) { if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") { setResult("failure", ex.substring(8)); } else { setResult("error", ex); } }} |
|
this.htmlTestSuite.reset(); | this.getTestSuite().reset(); | startTestSuite: function() { this.controlPanel.reset(); this.metrics.resetMetrics(); this.htmlTestSuite.reset(); this.runAllTests = true; this.runNextTest(); }, |
expression.suffix = "_ok"; | function statement(expression) { return expression.toString() + ";";} |
|
console.gotoxy(1,1); if(insert) console.write("Insert Mode"); else console.write("Overwrite Mode"); console.cleartoeol(); console.gotoxy(xpos,ypos); | if(insert != lastinsert) { lastinsert=insert; console.gotoxy(1,1); if(insert) console.write("Insert Mode"); else console.write("Overwrite Mode"); console.cleartoeol(); set_cursor(); } | function status_line(){ console.gotoxy(1,1); if(insert) console.write("Insert Mode"); else console.write("Overwrite Mode"); console.cleartoeol(); console.gotoxy(xpos,ypos);} |
Drupal.collapseScrollIntoView(fieldset); } | Drupal.collapseScrollIntoView(this.parentNode); } | step: function() { Drupal.collapseScrollIntoView(fieldset); } |
pauseOnNextStatement = false; steppingOut = false; steppingOver = false; steppingStack = 0; | function stepInto(){ DebuggerDocument.stepInto();} |
|
pauseOnNextStatement = false; | pauseOnNextStatement = pausedWhileLeavingFrame; | function stepOut(){ pauseOnNextStatement = false; steppingOver = false; steppingStack = 0; steppingOut = true; DebuggerDocument.resume();} |
document.removeEvent('mousemove', this.drag.bindWithEvent(this)); document.removeEvent('mouseup', this.stop.bind(this)); | document.removeEvent('mousemove', this.bound.drag); document.removeEvent('mouseup', this.bound.stop); | stop: function(){ document.removeEvent('mousemove', this.drag.bindWithEvent(this)); document.removeEvent('mouseup', this.stop.bind(this)); this.fireEvent('onComplete', this.element); } |
event.cancelBubble = true; | stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else { event.returnValue = false; } }, |
|
LOG.debug("stopping..."); | LOG.debug("stopping... (state=" + recorder.state + ")"); | function stopAndDo(func, arg1, arg2) { if (testLoop && recorder.state != 'paused') { LOG.debug("stopping..."); stopping = true; setTimeout(func, 500, arg1, arg2); return false; } stopping = false; testLoop = null; testCase.debugContext.reset(); for (var i = 0; i < testCase.commands.length; i++) { delete testCase.commands[i].result; recorder.view.rowUpdated(i); } return true;} |
if(this.indicator) Element.hide(this.indicator); | if(this.options.indicator) Element.hide(this.options.indicator); | stopIndicator: function() { if(this.indicator) Element.hide(this.indicator); }, |
if (element.removeEventListener) { | if (element && element.removeEventListener) { | stopObserving: function(elementParam, name, observer, useCapture) { var element = $(elementParam); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
} else if (element.detachEvent) { | } else if (element && element.detachEvent) { | stopObserving: function(elementParam, name, observer, useCapture) { var element = $(elementParam); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
((navigator.appVersion.indexOf('AppleWebKit') > 0) | (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && ((navigator.appVersion.indexOf('AppleWebKit') > 0) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) | ((/Konqueror|Safari|KHTML/.test(navigator.userAgent)) | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
((navigator.appVersion.indexOf('AppleWebKit') > 0) | ((/Konqueror|Safari|KHTML/.test(navigator.userAgent)) | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && ((navigator.appVersion.indexOf('AppleWebKit') > 0) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
stopObserving: function(element, name, observer, useCapture) { var element = $(element); | stopObserving: function(elementParam, name, observer, useCapture) { var element = $(elementParam); | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
((/Konqueror|Safari|KHTML/.test(navigator.userAgent)) | ((navigator.appVersion.indexOf('AppleWebKit') > 0) | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && ((/Konqueror|Safari|KHTML/.test(navigator.userAgent)) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
((navigator.appVersion.indexOf('AppleWebKit') > 0) | (navigator.appVersion.match(/Konqueror|Safari|KHTML/) | stopObserving: function(element, name, observer, useCapture) { var element = $(element); useCapture = useCapture || false; if (name == 'keypress' && ((navigator.appVersion.indexOf('AppleWebKit') > 0) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { element.detachEvent('on' + name, observer); } } |
Draggables._lastScrollPointer = null; | stopScrolling: function() { if(this.scrollInterval) { clearInterval(this.scrollInterval); this.scrollInterval = null; } }, |
|
bbs.edit_user(str); | if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { /* ToDo extra check here... if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { /* ToDo extra check here... if(cfg.lib[usrlib[curlib]]->offline_dir ==usrdir[curlib][i]) */ bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
editfile(str); | console.editfile(str); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); // ToDo: Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tToDo: This *should* download the specified file"); writeln("\tThis is not currently possible from JS however."); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tToDo: This *should* upload the specified file"); writeln("\tThis is not currently possible from JS however."); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quit setting (you are not lised as online)."); if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; | curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented write("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented write("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented write("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); | curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented write("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented write("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented write("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { | curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented write("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented write("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented write("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); | l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented write("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented write("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented write("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); | l=bbs.list_file_info(undefined,s,m); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented write("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } // ToDo: Is bbs.curlib and bbs.curdir an index to the *_list array? else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].number,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented write("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented write("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
if(str=="MEM") { writeln("\r\n\001h\001rMEM command not implemented."); return; } | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented writeln("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; /* ToDo bbs.curdir is not necessarily correct */ str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
|
curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; | str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented writeln("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; /* ToDo bbs.curdir is not necessarily correct */ str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); | for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented writeln("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; /* ToDo bbs.curdir is not necessarily correct */ str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { | for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented writeln("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; /* ToDo bbs.curdir is not necessarily correct */ str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); | l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="MEM") { // ToDo "MEM" not implemented writeln("\r\n\001h\001rMEM command not implemented."); return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; /* ToDo bbs.curdir is not necessarily correct */ str=file_area.lib_list[curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { curlib=get_lib_index(bbs.curlib); if(curlib==-1) return; for(j=0;j<file_area.lib_list[curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
if(user.compare_ars("QUIET")) | if(system.node_list[bbs.node_num-1].status==NODE_QUIET) | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); | writeln("UEDIT [Number or Name]"); writeln("\tEdits specified user or starts at user #1"); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) { console.editfile(plan); if(file_exists(plan)) console.printfile(plan); } } }} |
if(parseInt(str)) bbs.edit_user(str); | if(str.length) bbs.edit_user(bbs.finduser(get_arg(str))); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) { console.editfile(plan); if(file_exists(plan)) console.printfile(plan); } } }} |
if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
|
if(console.yesno("Edit/Create .plan")) | if(console.yesno("Edit/Create .plan")) { console.editfile(plan); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
console.editfile(plan); | } | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) | if(file_area.lib_list[i].offline_dir != undefined && file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [Number or Name]"); writeln("\tEdits specified user or starts at user #1"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(str.length) bbs.edit_user(bbs.finduser(get_arg(str))); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) { console.editfile(plan); if(file_exists(plan)) console.printfile(plan); } } }} |
if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) | if(file_area.lib_list[bbs.curlib].offline_dir != undefined && file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [Number or Name]"); writeln("\tEdits specified user or starts at user #1"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(str.length) bbs.edit_user(bbs.finduser(get_arg(str))); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(system.cmd_shell+" -i" ,EX_OUTR|EX_INR|EX_NATIVE); else bbs.exec(system.cmd_shell ,EX_OUTR|EX_INR|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tDownload the specified file"); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; bbs.send_file(str); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tUpload the specified file"); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!bbs.check_syspass()) return; bbs.receive_file(str); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quiet setting (you are not lised as online)."); if(str=="QUIET") { if(system.node_list[bbs.node_num-1].status==NODE_QUIET) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) { console.editfile(plan); if(file_exists(plan)) console.printfile(plan); } } }} |
writeln("QUIET\tToggles quit setting (you are not lised as online)."); | writeln("QUIET\tToggles quiet setting (you are not lised as online)."); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(str=="HELP") write("\r\nAvailable STR commands (prefix with a semi-colon)\r\n\r\n"); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="HELP") { writeln("ERR\tDisplay currrent error log and opptionally delete it as well as"); writeln("\toptionally clearing all nodes error counters."); } if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="HELP") writeln("GURU\tDisplay and optionally clear current guru log."); if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="HELP") writeln("CHUSER\tBecome a different user."); if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="HELP") writeln("ANSCAP\tToggle ANSI capture."); if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="HELP") { writeln("LIST <filename>"); writeln("\tDisplays a file."); } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="HELP") writeln("EDIT\tEdits a specified file using your message editor."); if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { console.editfile(str); } } } if(str=="HELP") writeln("LOG\tDisplays todays activity log"); if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="HELP") writeln("YLOG\tDisplays yesterdays activity log."); if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="HELP") writeln("SS\tDisplays current system stats"); if(str=="SS") { bbs.sys_stats(); return; } if(str=="HELP") writeln("NS <#>\tDisplays the current node stats for node #."); if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(str=="HELP") { writeln("EXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected."); } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(str=="HELP") { writeln("NEXEC [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tit's a native binary."); } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") { writeln("FOSSIL [command]"); writeln("\texecutes command (or prompts for it) with I/O redirected, and assuming"); writeln("\tthe internal FOSSIL driver will be used."); } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(str=="HELP") { writeln("CALL <HubID>"); writeln("\tforces callout to HubID"); } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(str=="HELP") { writeln("NODE [parameters]"); writeln("\texecutes the node utility with the passed parameters."); } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("DOWN [#]"); writeln("\tdowns node #. If # is omitted, downs the current node."); } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(str=="HELP") { writeln("RERUN [#]"); writeln("\tMarks node # for rerun. If # is omitted, reruns the current node."); } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="HELP") writeln("SLOG\tExecutes the slog utility to display system statistics."); if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("NLOG [#]"); writeln("\tExecutes the slog utility to display node stats for the specified node."); writeln("\tIf # is omitted, uses the current node."); } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="HELP") { writeln("UEDIT [#]"); writeln("\tEdits user # or starts at user 0"); } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="HELP") writeln("MAIL\tRead all mail currently in the mail base"); if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="HELP") { writeln("BULKMAIL"); writeln("\tSends a mail to all users which match a specified ARS."); } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="HELP") { writeln("DOS\tExecutes the DOS shell (command.com) with I/O redirected."); } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") writeln("SHELL\tExecutes the native shell (COMSPEC or SHELL env variable)."); // ToDo: Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(str=="HELP") { writeln("SPY <#>"); writeln("\tSpys on node #."); } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="HELP") { writeln("DIR [path]"); writeln("\tDisplays a full directory of specified path or the current file area if"); writeln("\tnot specified"); } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(str=="HELP") { writeln("LOAD [filespec]"); writeln("\tLoads the text.dat from the specified filespec."); } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(str=="HELP") { writeln("UPLOAD [areaspec]"); writeln("\tPerforms a bulk upload in areaspec where area spec is ALL, LIB, or"); writeln("\tomitted."); writeln("\tIf areaspec is ALL performs the bulk upload in all file areas."); writeln("\tIf areaspec is LIB, does the same in all areas of the current lib."); } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(str=="HELP") { writeln("ALTUL [path]"); writeln("\tSets the ALT upload path to <path>. If path is omitted, turns off the"); writeln("\talt upload path."); } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(str=="HELP") { writeln("RESORT [ALL|LIB|blank]"); writeln("\tResorts the specified file areas."); } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(str=="HELP") { writeln("OLDUL [ALL|LIB|blank]"); writeln("\tLists all files uploaded before your last scan time."); writeln("OLD [ALL|LIB|blank]"); writeln("\tLists all files not downloaded since your last scan time."); writeln("OFFLINE [ALL|LIB|blank]"); writeln("\tLists all offline files."); writeln("CLOSE [ALL|LIB|blank]"); writeln("\tLists all files currently open."); } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { if(file_area.lib_list[i].offline_dir == file_area.lib_list[i].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { if(file_area.lib_list[bbs.curlib].offline_dir == file_area.lib_list[bbs.curlib].dir[j]) continue; l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(str=="HELP") { writeln("GET [path]"); writeln("\tToDo: This *should* download the specified file"); writeln("\tThis is not currently possible from JS however."); } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(str=="HELP") { writeln("PUT [path]"); writeln("\tToDo: This *should* upload the specified file"); writeln("\tThis is not currently possible from JS however."); } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="HELP") writeln("QUIET\tToggles quit setting (you are not lised as online)."); if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="HELP") { writeln("ANON\tToggles anonymous setting (the node is listed online, but you are not"); writeln("\tmentioned)."); } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(str=="HELP") { writeln("LOCK [#]"); writeln("\tLocks the specified node, or the current node if none specified."); } if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(str=="HELP") { writeln("INTR [#]"); writeln("\tInterrupts the specified node, or the current node if none specified."); } if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); if(!i) i=bbs.node_num; i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="HELP") writeln("CHAT\tPages the sysop"); if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="HELP") writeln("POFF\tToggles if other users can page you for this session."); if(str=="POFF") { bbs.node_settings ^= NODE_POFF; write("Paging is "); if(bbs.node_settings & NODE_POFF) writeln("OFF"); else writeln("ON"); }// Edit .plan if(user.compare_ars("rest not G")) { if(str=="HELP") writeln("PLAN\tEdits or deletes your .plan file (displayed when somebody fingers you)."); if(str=="PLAN") { var plan=format("%suser/%04d.plan",system.data_dir,user.number); if(file_exists(plan)) { if(console.yesno("Display current .plan")) console.printfile(plan); if(!console.noyes("Delete current .plan")) file_remove(plan); } if(console.yesno("Edit/Create .plan")) console.printfile(plan); console.editfile(plan); } }} |
bbs.bulk_upload(str); | if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); bbs.edit_user(str); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { // ToDo This apparently is broken. str=str.substr(7); bbs.bulk_upload(str); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
if(!i) i=bbs.node_num; | function str_cmds(str){ var file; // File var word; // First word of args var i; // Temp integer var j; // Temp integer var k; // Temp integer var l; // Temp integer var m; // Temp integer var a; // Temp array var s; // Temp string // Remove any trailing spaces str=truncsp(str); // Upper-Case first word str=str.replace(/^\s*([^\s]*)/, function(st, p, oset, s) { word=p.toUpperCase(); return(word); } ); log(str); if(user.compare_ars("SYSOP")) { // Change node action to "sysop activities" bbs.node_action=NODE_SYSP; //sync // ######################## SYSOP Functions ############################## if(str=="ERR") { if(file_exists(system.logs_dir+"error.log")) { write(bbs.text(ErrorLogHdr)); console.printfile(system.logs_dir+"error.log"); if(!console.noyes(bbs.text(DeleteErrorLogQ))) file_remove(system.logs_dir+"error.log"); } else { write(bbs.text(NoErrorLogExists)); } for(i=0;i<system.nodes;i++) { if(system.node_list[i].errors) break; } if(i<system.nodes) { if(!console.noyes(bbs.text(ClearErrCounter))) { for(i=0;i<system.nodes; i++) { system.node_list[i].errors=0; } } } return; } if(str=="GURU") { if(file_exists(system.logs_dir+"guru.log")) { console.printfile(system.logs_dir+"guru.log"); console.crlf(); if(!console.noyes(bbs.text(DeleteGuruLogQ))) file_remove(system.logs_dir+"guru.log"); } } if(str=="CHUSER") { // Prompts for syspass bbs.change_user(); return; } if(str=="ANSCAP") { bbs.sys_status^=SS_ANSCAP; printf(bbs.text(ANSICaptureIsNow),bbs.sys_status&SS_ANSCAP?bbs.text(ON):bbs.text(OFF)); return; } if(str=="LIST") { if(bbs.check_syspass()) { str=str.substr(4); console.printfile(get_arg(str)); return; } } if(str=="EDIT") { if(bbs.check_syspass()) { write(bbs.text(Filename)); if((str=console.getstr("",60))!=null) { editfile(str); } } } if(str=="LOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()); console.printfile(str); } return; } if(str=="YLOG") { if(bbs.check_syspass()) { str=system.logs_dir+strftime("logs/%m%d%y.log",time()-24*60*60); console.printfile(str); } return; } if(str=="SS") { bbs.sys_stats(); return; } if(word=="NS") { str=str.substr(2); str=str.replace(/^\s+/,""); bbs.node_stats(parseInt(str)); return; } if(word=="EXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL); } return; } if(word=="NEXEC") { if(bbs.check_syspass()) { str=str.substr(4); bbs.exec(get_arg(str),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="FOSSIL") { if(bbs.check_syspass()) { str=str.substr(6); bbs.exec(get_arg(str)); } return; } if(word=="CALL") { if(bbs.check_syspass()) { str=str.substr(4); file=new File(system.data_dir+"qnet/"+get_arg(str)+".now"); if(file.open("w")) file.close(); } return; } if(word=="NODE") { bbs.exec(system.exec_dir+str.toLowerCase(), EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="DOWN") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { if(system.node_list[i].status==NODE_WFC) system.node_list[i].status=NODE_OFFLINE; else system.node_list[i].misc^=NODE_DOWN; display_node(i+1); } return; } if(word=="RERUN") { str=str.substr(5); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_RRUN; display_node(i+1); } return; } if(str=="SLOG") { bbs.exec(system.exec_dir+"slog /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(str=="NLOG") { bbs.exec(system.exec_dir+"slog "+system.node_dir+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="NLOG") { str=str.substr(5); bbs.exec(system.exec_dir+"slog "+system.node_dir+"../node"+get_arg(str)+" /p",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); return; } if(word=="UEDIT") { // Prompts for syspass str=str.substr(5); if(parseInt(str)) bbs.edit_user(str); else bbs.edit_user(); return; } if(str=="MAIL") { bbs.read_mail(MAIL_ALL); return; } if(str=="BULKMAIL") { write("\r\nEnter ARS matches to send mail to or [CR] to send "); write("by name/number\r\nARS to match: "); str=console.getstr("", 40); if(str!=null) bbs.bulk_mail(str); return; } if(str=="DOS") { // DOS/Windows shell if(bbs.check_syspass()) { bbs.exec("command.com",EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } // ToDo %y doesn't do the trick here baby. // Isn't there a JS thing that tells me this one? if(str=="SHELL") { // Unix shell (-i for interactive) if(bbs.check_syspass()) { if(system.platform != 'Win32') bbs.exec(bbs.cmdstr("%y -i"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); else bbs.exec(bbs.cmdstr("%y"),EX_OUTR|EX_INR|EX_OUTL|EX_NATIVE); } return; } if(word=="SPY") { if(bbs.check_syspass()) { str=str.substr(3); writeln(""); bbs.spy(parseInt(get_arg(str))); write("\1n\r\nSpy session complete.\r\n"); } return; } if(str=="DIR") { // Dir of current lib: if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].path; write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); if(system.settings & SYS_EURODATE) write(strftime("%d/%m/%Y %I:%M %p ",j).toUpperCase()); else write(strftime("%m/%d/%Y %I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="LOAD") { str=str.substr(4); bbs.load_text(get_arg(str)); return; } if(word=="DIR") { if(bbs.check_syspass()) { var files=0; var bytes=0; var dirs=0; str=str.substr(3); str=get_arg(str); str=backslash(str); write("\r\nDirectory of: "+str+"\r\n\r\n"); a=directory(str+"*",GLOB_NOSORT); for(i=0; i<a.length; i++) { j=file_date(a[i]); write(system.datestr(j)+" "); write(strftime("%I:%M %p ",j).toUpperCase()); if(file_isdir(a[i])) { write("<DIR> "); dirs++; } else { j=file_size(a[i]); write(add_commas(j,14)+" "); files++; bytes+=j; } write(file_getname(a[i])); console.crlf(); } write(add_commas(files,16)+" File(s)"); writeln(add_commas(bytes,15)+" bytes"); write(add_commas(dirs,16)+" Dir(s)"); writeln(add_commas(dir_freespace(str),16)+" bytes free"); } return; } if(word=="UPLOAD") { str=str.substr(7); if(str.toUpperCase()=="ALL") { for(i=0; i<file_area.lib_list.length; i++) { for(j=0; j<file_area.lib_list[i].dir_list.length; j++) { /* ToDo extra check here... if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ bbs.bulk_upload(file_area.lib_list[i].dir_list[j].number); } } return; } if(str.toUpperCase()=="LIB") { for(i=0; i<file_area.lib_list[bbs.curlib].dir_list.length; i++) { /* ToDo extra check here... if(cfg.lib[usrlib[curlib]]->offline_dir ==usrdir[curlib][i]) */ bbs.bulk_upload(file_area.lib_list[bbs.curlib].dir_list[i].number); } return; } bbs.bulk_upload(); return; } if(word=="ALTUL") { str=str.substr(6); bbs.alt_ul_dir=(str+0); printf(bbs.text(AltULPathIsNow),bbs.alt_ul_dir?bbs.alt_ul_dir:bbs.text(OFF)); return; } if(word=="RESORT") { for(i=0;i<system.nodes;i++) { if(i!=bbs.node_num-1) { if(system.node_list[i].stats==NODE_INUSE || system.node_list[i].stats==NODE_QUIET) break; } } if(i<system.nodes) { write(bbs.text(ResortWarning)); return; } if(str.search(/^ALL$/i)!=-1) { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[i].dir_list[j].number); } } } else if(str.search(/^LIB$/i)!=-1) { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { bbs.resort_dir(file_area.lib_list[bbs.curlib].dir_list[j].number); } } else { bbs.resort_dir(undefined); } str=str.substr(7); return; } if(word=="OLDUL" || word=="OLD" || word=="OFFLINE" || word=="CLOSE") { str=str.replace(/^[A-Z]*\s/,""); if(file_area.lib_list.length<1) return; s=bbs.get_filespec(); if(s==null) return; s=s.replace(/^(.*)(\..*)?$/, function(s, p1, p2, oset, s) { if(p2==undefined) return(format("%-8.8s ",p1)); return(format("%-8.8s%-4.4s",p1,p2)); } ); write("\r\nSearching "); if(str.toUpperCase()=="ALL") write("all libraries"); else if(str.toUpperCase()=="LIB") write("library"); else write("directory"); write(" for files "); if(word=="OLDUL") { printf("uploaded before %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLDUL; } else if(word=="OLD") { printf("not downloaded since %s\r\n", system.timestr(bbs.new_file_time)); m=FI_OLD; } else if(word=="OFFLINE") { write("not online...\r\n"); m=FI_OFFLINE; } else { write("currently open...\r\n"); m=FI_CLOSE; } k=0; if(str.toUpperCase()=="ALL") { for(i=0;i<file_area.lib_list.length;i++) { for(j=0;j<file_area.lib_list[i].dir_list.length;j++) { /* ToDo... there's an offline check in here */ /* if(cfg.lib[i]->offline_dir==usrdir[i][j]) continue; */ l=bbs.list_file_info(file_area.lib_list[i].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } } else if(str.toUpperCase()=="LIB") { for(j=0;j<file_area.lib_list[bbs.curlib].dir_list.length;j++) { /* ToDo... there's an offliune check in here */ /* if(cfg.lib[usrlib[curlib]]->offline_dir==usrdir[curlib][i]) continue; */ l=bbs.list_file_info(file_area.lib_list[bbs.curlib].dir_list[j].number,s,m); if(l==-1) return; k+=l; } } else { l=bbs.list_file_info(undefined,s,m); if(l==-1) return; k+=l; } if(k>1) printf(bbs.text(NFilesListed),k); return; } if(word=="GET") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "GET" not implemented writeln("\r\nFILE_GET not implemented!"); return; } if(word=="PUT") { str=str.substr(3); str=str.replace(/^\s+/,""); if(str=="") { write("\r\nPath and filename: "); str=console.getstr("",60); if(str=="") return; } if(!file_exists(str)) { write(bbs.text(FileNotFound)); return; } if(!bbs.check_syspass()) return; // ToDo "PUT" not implemented writeln("\r\nPUT not implemented!"); return; } }//############################# Exemption Functions #############################//# Quiet Node if(user.compare_ars("exempt Q")) { if(str=="QUIET") { if(user.compare_ars("QUIET")) system.node_list[bbs.node_num-1].status=NODE_INUSE; else system.node_list[bbs.node_num-1].status=NODE_QUIET; display_node(bbs.node_num); return; } if(str=="ANON") { bbs.node_settings ^= NODE_ANON; display_node(bbs.node_num); return; } }// Lock Node if(user.compare_ars("exempt N")) { if(word=="LOCK") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_LOCK; display_node(i+1); } return; } } // Interrupt Node if(user.compare_ars("exempt I")) { if(word=="INTR") { str=str.substr(4); i=parseInt(get_arg(str)); i--; if(i<0 || i>=system.nodes) write("\r\n\001h\001rInvalid Node!"); else { system.node_list[i].misc^=NODE_INTR; display_node(i+1); } return; } }// Chat if(user.compare_ars("exempt C")) { if(str=="CHAT") { bbs.page_sysop(); return; } } if(str=="POFF") { bbs.node_settings ^= NODE_POFF; }} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.