public function index() { $schedulerList = Scheduler::getList(true); $formName = 'SchedulerManager_index'; $id = 'SchedulerManager_table'; $js = "\$().ready ( function () {\n"; $valid = Validator::factory($formName); $html = Tag::table(['id' => $id]) . Tag::tr() . Tag::th() . 'Upd' . Tag::_th() . Tag::th() . 'Del' . Tag::_th() . Tag::th() . 'Command' . Tag::_th() . Tag::th() . 'Start Date' . Tag::_th() . Tag::th() . 'Cron' . Tag::_th() . Tag::th() . 'Active' . Tag::_th() . Tag::th() . 'Last Run' . Tag::_th() . Tag::_tr(); if (count($schedulerList) == 0) { $html .= Tag::tr() . Tag::td(['colspan' => 20]) . 'No Scheduled Tasks' . Tag::_td() . Tag::_tr(); } else { $js .= <<<JS \$('input[type=checkbox][name^=fldUpd]').shiftClick(); JS; $rowIdx = 0; foreach ($schedulerList as $idx => $schedulerItem) { $row = '_' . $idx; $valid->addExists('fldCommand' . $row, 'Command must exist')->addExists('fldCron' . $row, 'Interval must exist'); $js .= <<<JS \$( '#fldStartDate{$row}' ).datetimepicker({ dateFormat: 'yy-mm-dd', timeFormat: 'HH:mm' }); JS; $lastRun = $schedulerItem->lastRun == '' ? '*Never*' : $schedulerItem->lastRun; $html .= Tag::tr() . Tag::td() . Tag::checkBox('fldUpd[]', $idx, false, ['id' => 'U' . $rowIdx]) . Tag::_td() . Tag::td() . Tag::linkButton('?' . Response::factory()->set('fldID', $idx)->action(__CLASS__ . '->deleteItem()'), 'Delete', ['onClick' => "confirm('Are you sure?')"]) . Tag::_td() . Tag::td(['width' => '100%', 'nowrap' => 'nowrap']) . Tag::text('fldCommand' . $row, $schedulerItem->cmd, ['style' => 'width:100%;', 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Tag::text('fldStartDate' . $row, $schedulerItem->start, ['id' => 'fldStartDate' . $row, 'size' => '18', 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Tag::text('fldCron' . $row, $schedulerItem->cron, ['onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . Lists::select('fldActive' . $row, ['Yes', 'No'], ['default' => $schedulerItem->active, 'onChange' => "\$('#U{$rowIdx}').attr('checked',true)"]) . Tag::_td() . Tag::td(['nowrap' => 'nowrap']) . $lastRun . Tag::_td() . Tag::_tr(); $rowIdx++; } } $html .= Tag::_table(); $js .= '});'; return JS::libraryWithDependancies(JS::JQUERY_UI_DATETIME) . JS::library('jquery.shiftclick.js') . JS::javaScript($js) . $valid->toHtml() . Widget::styleTable('#' . $id) . Tag::form(['name' => $formName, 'onSubmit' => $valid->onSubmit()]) . $html . Response::factory()->action(__CLASS__ . '->save()')->toHidden() . Tag::submit('Save') . Tag::linkButton('?' . Response::factory()->action(__CLASS__ . '->newItem()'), 'New Item') . Tag::_form(); }
public static function getMenuItems($menuClasses = null) { if ($menuClasses == null) { $menuClasses = Cfg::get('menu'); } $menuBlock = 0; $menuOptions = []; $resp = Response::factory(); foreach ($menuClasses as $key => $val) { $resp->set(self::ACTIVE_MENU, $menuBlock++); $menuOptions[$key] = $val::menu($resp); } return $menuOptions; }
public function index($tName = '') { if (($tableName = Request::get('tblName', $tName)) == '') { return ''; } $crud = CRUD::factory($tableName, ['topPager' => false])->copyVarsFromRequest('tblName'); if (preg_match('/^tblMod([A-Z]+[a-z]+)/', $tableName, $matches)) { foreach (Cfg::get('modules', []) as $moduleClass) { eval($moduleClass . '::' . Module::CRUD_MOD . '($crud);'); } } else { switch ($tableName) { case 'tblNextNumber': $crud->setColDisplay('fldTable', [CRUD::SELECT, DBMaintenance::getTableList(), true]); break; case 'tblSecPrivUserMap': $userSql = DB::driver() == DB::MYSQL ? Admin::USER_SQL_MYSQL : Admin::USER_SQL_MYSQL; $crud->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true]); $crud->setColDisplay('fldGroupID', [CRUD::SELECT, Admin::GROUP_SQL, true]); $crud->setColDisplay('fldPrivilegeID', [CRUD::SELECT, Admin::PRIV_SQL, true]); $crud->setColDisplay('fldLevelID', [CRUD::SELECT, Admin::LEVEL_SQL]); break; case 'tblUserGroupMap': $userSql = DB::driver() == DB::MYSQL ? Admin::USER_SQL_MYSQL : Admin::USER_SQL_SQLITE; $crud->setColDisplay('fldUserID', [CRUD::SELECT, $userSql, true]); $crud->setColDisplay('fldGroupID', [CRUD::SELECT, Admin::GROUP_SQL, true]); break; case 'tblUser': $crud->setColDisplay('fldLevel', [CRUD::SELECT, Admin::LEVEL_SQL]); $crud->setColDisplay('fldTimeZone', [CRUD::SELECT, Admin::TZ_SQL]); break; } } $resp = Response::factory()->set('tblName', $tableName); return Tag::hTag('b') . 'Editing Table: ' . $tableName . Tag::_hTag('b') . ' ' . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->csv()'), 'CSV') . ' ' . Tag::hRef('ajax.php?' . $resp->action(__CLASS__ . '->xls()'), 'XLS') . $crud->index(); }
public function index() { $sitePath = Cfg::get('site_path'); $sitePathLen = strlen($sitePath); $resp = Response::factory()->action(__CLASS__ . '->zoom()'); $html = Tag::ul(); foreach ($this->findImages($sitePath) as $item) { $relItemName = substr($item, $sitePathLen); $html .= Tag::li() . Tag::hRef('?' . $resp->set('url', $relItemName)->toUrl(), $relItemName) . Tag::_li(); } $html .= Tag::_ul(); return $html; }
public function forgotPassword() { // Initialise the $msg and $action and $disclaimer variables $formName = 'FancyLogin_forgotPassword'; $valid = Validator::factory($formName, 'FP')->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email is in valid format. Must be of the form a@b.com'); $html = $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->set(self::ACTION, __CLASS__ . '->sendPW()')->toHidden() . Tag::table(['align' => 'center', 'border' => 0, 'cellspacing' => 0, 'cellpadding' => 2]) . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text('fldEmail') . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2, 'align' => 'center']) . 'Your Password will be reset and sent to you via email you have provided' . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2, 'align' => 'center']) . Tag::submit('Send Password') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form(); return $html; }
public function fileChecksum() { $messageArray = []; $dirList = PHPExt::dirSearch(Cfg::get('site_path'), '/^[^_].*$/'); $len = strlen(Cfg::get('site_path')) + 1; foreach ($dirList as &$path) { $path = substr($path, $len); } $tab = new DBTable(DB::DEF, 'SELECT * FROM tblFileCheck'); foreach ($tab as $row) { if (in_array($row['fldFileName'], $dirList)) { $fullPath = Cfg::get('site_path') . '/' . $row['fldFileName']; $fileSize = filesize($fullPath); $sha1 = sha1_file($fullPath); if ($fileSize != $row['fldSize']) { $messageArray[$row['fldFileName']] = 'Mismatch file size. was: ' . $row['fldSize'] . ' now: ' . $fileSize; } else { if ($sha1 != $row['fldCRC']) { $messageArray[$row['fldFileName']] = 'Mismatch SHA1. was: ' . $row['fldCRC'] . ' now: ' . $sha1; } } } else { $messageArray[$row['fldFileName']] = 'File deleted'; } } $oldFileList = $tab->getColumn('fldFileName'); foreach ($dirList as $fileName) { if (!in_array($fileName, $oldFileList)) { $messageArray[$fileName] = 'New file'; } } $html = ''; if (count($messageArray) != 0) { foreach ($messageArray as $key => $val) { $html .= $key . ': ' . $val . '<br/>'; } } else { $html = 'No Changes<br/>'; } $rebaseButton = Tag::linkButton('?' . Response::factory()->action(__CLASS__ . '->' . __FUNCTION__ . 'Rebase()'), 'Rebase'); return $rebaseButton . '<br/>' . $html . $rebaseButton; }
public function forgotPassword() { // Initialise the $msg and $action and $disclaimer variables $formName = 'Login_forgotPassword'; $valid = Validator::factory($formName, 'FP')->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email is in valid format. Must be of the form a@b.com'); $html = '<h2>Password Reset</h2>' . $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->action(__CLASS__ . '->sendPW()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email' . Tag::_td() . Tag::td() . Tag::text('fldEmail', ['title' => 'Your Password will be reset and sent to you via email you have provided']) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['align' => 'left']) . Tag::submit('Reset PW') . Tag::_td() . Tag::td(['align' => 'right']) . Tag::linkButton('?' . Response::factory()->action(__CLASS__ . '->index()')->toUrl(), 'Back to Login') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form(); return $html; }
public function newUser() { $formName = 'Admin_newUser'; $valid = Validator::factory($formName)->addExists('fldEmail', 'Email field is empty. Please insert valid email and resubmit')->addEmail('fldEmail', 'Email needs to exist and be correct format')->addExists('fldFirstName', 'First Name must exist')->addExists('fldCaptcha', 'You must enter Captcha Code')->addExists('fldLastName', 'Last Name must exist'); $html = $valid->toHtml() . Tag::form(['id' => $formName, 'name' => $formName, 'onSubmit' => $valid->onSubmit()]) . Response::factory()->action(__CLASS__ . '->newUserSave()')->toHidden() . Tag::table() . Tag::tr() . Tag::td() . 'Email:' . Tag::_td() . Tag::td() . Tag::text('fldEmail', Request::get('fldEmail')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'First Name:' . Tag::_td() . Tag::td() . Tag::text('fldFirstName', Request::get('fldFirstName')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td() . 'Last Name:' . Tag::_td() . Tag::td() . Tag::text('fldLastName', Request::get('fldLastName')) . Tag::_td() . Tag::_tr() . Tag::tr() . Tag::td(['colspan' => 2]) . Tag::submit('Create Account') . Tag::_td() . Tag::_tr() . Tag::_table() . Tag::_form(); return $html; }
public function imageUrl() { $resp = new Response(); $url = Cfg::siteUrl() . '/ajax.php?' . Response::factory()->action(__CLASS__ . '::img()')->set('_CP1', $this->value)->set('_CP4', $this->hatch)->toUrl(Response::UNIQUE_CSRF); return $url; }
public static function errorHandler($errno, $errstr, $errfile, $errline) { if (!preg_match('/^.*\\/3rdparty\\/.*$/', $errfile)) { self::$log->error("{$errno}-{$errstr}: {$errfile}({$errline})"); } switch ($errno) { case E_STRICT: case E_USER_WARNING: return; default: if (self::get('debug')) { $errMsg = sprintf('(!) Fatal error: %s in %s on line: %s', $errstr, $errfile, $errline); $html = Tag::table(['cellpadding' => 3, 'cellspacing' => 0, 'border' => 1]) . Tag::tr(['bgcolor' => 'silver']) . Tag::th(['colspan' => 4, 'align' => 'left']) . $errMsg . Tag::_th() . Tag::_tr() . Tag::tr(['bgcolor' => 'silver']) . Tag::th() . 'Stk' . Tag::_th() . Tag::th() . 'File' . Tag::_th() . Tag::th() . 'Line' . Tag::_th() . Tag::th() . 'Function' . Tag::_th() . Tag::_tr(); foreach (debug_backtrace() as $idx => $row) { if ($idx == 0) { continue; } if (isset($row['file'])) { $file = basename($row['file']); $title = $row['file']; } else { $file = ' '; $title = ' '; } $line = isset($row['line']) ? $row['line'] : ' '; $function = $row['function']; if (isset($row['class'])) { $function = $row['class'] . $row['type'] . $function; } $style = $idx % 2 == 0 ? [] : ['bgcolor' => 'yellow']; $html .= Tag::tr($style) . Tag::td() . $idx . Tag::_td() . Tag::td(['title' => $title]) . $file . Tag::_td() . Tag::td() . $line . Tag::_td() . Tag::td() . $function . Tag::_td() . Tag::_tr(); } $html .= Tag::_table(); $html = str_replace(["\n", "'"], ['', "\\'"], $html); $url = self::siteUrl() . '/ajax.php?' . Response::factory()->action('\\Jackbooted\\Html\\WebPage->blank()')->toUrl(); $js = <<<JS \$().ready(function() { newWindow = window.open ( '{$url}','Error Output','height=300,width=700'); var tmp = newWindow.document; tmp.write ( '<html><head><title>{$errMsg}</title>' ); tmp.write ( '<style type="text/css">' ); tmp.write ( '</style>'); tmp.write ( '</head><body>'); tmp.write ( '{$html}' ); tmp.write ( '</body></html>'); tmp.close(); }); JS; echo JS::library(JS::JQUERY) . JS::javaScript($js) . $errMsg; } break; } }