コード例 #1
0
 function build()
 {
     $page = $this->parent;
     $breadcrumb = '    <ul class="breadcrumb">' . PHP_EOL;
     if ($page->parent->config->config['core']['maintenance']) {
         $breadcrumb .= '      <li class="active">Maintenance</li>' . PHP_EOL;
     } elseif (!$page->parent->config->config['core']['database']) {
         $breadcrumb .= '      <li class="active">Site Error</li>' . PHP_EOL;
     } else {
         if ($page->getStatus() != 200) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat3') !== NULL) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '">' . ucfirst(WebApp::get('cat1')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '/' . WebApp::get('cat2') . '">' . ucfirst(WebApp::get('cat2')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat2') !== NULL) {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li><a href="/' . WebApp::get('cat1') . '">' . ucfirst(WebApp::get('cat1')) . '</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } elseif (WebApp::get('cat1') !== 'core') {
             $breadcrumb .= '      <li><a href="/">Home</a></li>' . PHP_EOL;
             $breadcrumb .= '      <li class="active">' . $page->getTitle() . '</li>' . PHP_EOL;
         } else {
             $breadcrumb .= '      <li class="active">Home</li>' . PHP_EOL;
         }
     }
     $breadcrumb .= '    </ul>' . PHP_EOL;
     $this->breadcrumb = $breadcrumb;
 }
コード例 #2
0
ファイル: ajax.php プロジェクト: huwcbjones/WebFramework
 public function menu_pages()
 {
     $q = WebApp::get('q');
     $m = WebApp::get('m');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('pages' => array()));
     }
     if ($m === NULL || $m === '') {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No module selected', B_T_FAIL, array('pages' => array()));
     }
     $pages = array();
     $q = '%' . $q . '%';
     $page_query = $this->mySQL_r->prepare("SELECT `ID`,`title` FROM `core_pages` WHERE `title` LIKE ? AND `module_id`=?");
     if (!$page_query) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'Query failed', B_T_FAIL, array('pages' => array()));
     }
     $page_query->bind_param('si', $q, $m);
     $page_query->execute();
     $page_query->store_result();
     $page_query->bind_result($id, $value);
     while ($page_query->fetch()) {
         $page['id'] = $id;
         $page['text'] = $value;
         if ($id >= pow(10, 6)) {
             $page['text'] = '* ' . $page['text'];
         }
         $pages[] = $page;
     }
     return new ActionResult($this, '/admin/core/menu_add', 0, 'Success', B_T_SUCCESS, array('pages' => $pages));
 }
コード例 #3
0
ファイル: ajax.php プロジェクト: huwcbjones/WebFramework
 public function setAjax()
 {
     //$this->parent->addHeader('content-type', 'application/json');
     // Check to see if we are in maintenance mode
     if (!$this->parent->config->config['core']['database']) {
         $this->setStatus(500);
         return;
     }
     for ($i = 1; $i != 3; $i++) {
         ${'cat' . $i} = WebApp::get('cat' . $i);
     }
     if (!file_exists(__MODULE__ . '/' . $cat2 . '/ajax.php')) {
         $this->parent->debug($this::name_space . ':  Could not find "ajax.php"!');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax Ctrl not found</code>');
         return;
     }
     if (!@(include_once __MODULE__ . '/' . $cat2 . '/ajax.php')) {
         $this->parent->debug($this::name_space . ':  Could not access "ajax.php"! Check r/w permissions');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Failed to open Ajax</code>');
         return;
     }
     if (class_exists('AjaxController')) {
         $this->ctrl = new AjaxController($this);
         $this->parent->debug($this::name_space . ': AjaxController loaded');
     } else {
         $this->parent->debug($this::name_space . ': Could not find AjaxController class in "ajax.php"!');
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax Ctrl Ob not found</code>');
     }
 }
コード例 #4
0
 function getFooter($parent)
 {
     if (WebApp::get('cat1') == 'admin' && $this->parent->parent->user->is_loggedIn()) {
         return $this->_processPage(__LIBDIR__ . '/modules/admin/pages/footer.php');
     } else {
         return $this->_processPage(__LIBDIR__ . '/modules/core/pages/footer.php');
     }
 }
コード例 #5
0
ファイル: admin.php プロジェクト: huwcbjones/WebFramework
 function _getFilename()
 {
     $pagefile = __MODULE__ . '/location/admin/';
     if (WebApp::get('cat3') !== NULL) {
         $pagefile .= WebApp::get('cat3');
     } else {
         $pagefile .= 'dash';
     }
     return $pagefile;
 }
コード例 #6
0
 function processAction()
 {
     $action = WebApp::get('cat3');
     if (is_callable(array($this, $action))) {
         $this->result = $this->{$action}();
         return true;
     } else {
         $this->result = new ActionResult($this, Server::get('Request_URI'), 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Action not found: "' . Server::get('Request_URI') . '"</code>');
         return false;
     }
 }
コード例 #7
0
 function _getFilename()
 {
     $pagefile = __LIBDIR__ . '/modules/' . WebApp::get('cat2') . '/admin/';
     if (WebApp::get('cat3') !== NULL) {
         $pagefile .= WebApp::get('cat3');
         if (WebApp::get('cat4') !== NULL) {
             $pagefile .= '_' . WebApp::get('cat4');
         }
     } else {
         $pagefile .= 'dash';
     }
     return $pagefile;
 }
コード例 #8
0
ファイル: admin.php プロジェクト: huwcbjones/WebFramework
 function _getFilename()
 {
     $pagefile = __MODULE__ . '/modules/admin/';
     if (WebApp::get('cat3') !== NULL) {
         $pagefile .= WebApp::get('cat3');
         if (WebApp::get('cat4') !== NULL && WebApp::get('cat3') == 'install' || WebApp::get('cat5') !== NULL && WebApp::get('cat4') !== NULL && WebApp::get('cat3') == 'update' || WebApp::get('cat4') !== NULL && WebApp::get('cat3') == 'uninstall') {
             $pagefile .= '_fromdir';
         }
     } else {
         $pagefile .= 'dash';
     }
     return $pagefile;
 }
コード例 #9
0
 function processAjax()
 {
     $ajax = WebApp::get('cat3');
     if (WebApp::get('cat4') !== NULL) {
         $ajax .= '_' . WebApp::get('cat4');
     }
     if (is_callable(array($this, $ajax))) {
         $this->result = $this->{$ajax}();
         return true;
     } else {
         $this->result = new ActionResult($this, $_SERVER['REQUEST_URI'], 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Ajax not found</code>');
         return false;
     }
 }
コード例 #10
0
ファイル: action.php プロジェクト: huwcbjones/WebFramework
 public function clear_status_msg()
 {
     $msg_id = WebApp::get('msg_id');
     if ($msg_id === NULL) {
         $msg_id = WebApp::post('msg_id');
     }
     if ($msg_id === NULL) {
         $this->parent->parent->debug($this::name_space . ': MSG ID was not provided!');
         return new ActionResult($this, '/', 0, 'Failed to clear status message. No ID found.', B_T_FAIL);
     }
     $msg_id = trim(str_replace('alert_', '', $msg_id));
     $msg_id = base64_decode($msg_id);
     Session::del('status_msg', $msg_id);
     $this->parent->parent->debug($this::name_space . ': MSG ID "' . $msg_id . '" was ' . (Session::get('status_msg', $msg_id) === NULL ? '' : 'not ') . 'cleared');
     return new ActionResult($this, '/', 0, 'Cleared status message.', B_T_SUCCESS);
 }
コード例 #11
0
ファイル: install.php プロジェクト: huwcbjones/WebFramework
 /**
  * Installer::__construct()
  * 
  * @param mixed $parent
  * @param mixed $details
  * @return
  */
 function __construct($parent, $details = array())
 {
     ignore_user_abort(true);
     $this->parent = $parent;
     $this->mySQL_r = $parent->mySQL_r;
     $this->mySQL_w = $parent->mySQL_w;
     $this->parent->parent->debug('***** ' . $this::name_space . ' - Installer *****');
     $this->parent->parent->debug($this::name_space . ': Version ' . $this::version);
     ignore_user_abort(true);
     if (count($details) == 0) {
         $hash = WebApp::get('id');
         $this->tempModule = Session::get($this::name_space, 'install_from' . $hash);
     } else {
         $this->tempModule = $details['dir'];
         $this->namespace = $details['ns'];
     }
 }
コード例 #12
0
 public function run()
 {
     $jobID = WebApp::get('j');
     $this->parent->parent->_loadCron();
     $cron = $this->parent->parent->cron;
     $cron->loadJobs();
     $job = $cron->getJob($jobID);
     if ($job === false) {
         return new ActionResult($this, '/admin/core/cron_view', 0, 'Failed to run cron job!<br />Error: <code>Job wasn\'t found</code>', B_T_FAIL);
     }
     $result = $cron->runJob($jobID);
     if ($result->status) {
         return new ActionResult($this, '/admin/core/cron_view', 1, 'Job ran successfully!', B_T_SUCCESS);
     } else {
         return new ActionResult($this, '/admin/core/cron_view', 1, 'Failed to run job!<br /><Error: <code>' . $result->msg . '</code>', B_T_INFO);
     }
 }
コード例 #13
0
 function _getFilename($cat1 = '', $cat2 = '', $cat3 = '', $cat4 = '')
 {
     if ($cat1 == '') {
         for ($i = 1; $i <= 4; $i++) {
             ${'cat' . $i} = WebApp::get('cat' . $i);
         }
     }
     $pagefile = __LIBDIR__ . '/modules/' . $cat1 . '/pages/';
     if ($cat2 !== NULL && $cat2 !== '') {
         $pagefile .= $cat2;
         if ($cat3 !== NULL && $cat3 !== '') {
             $pagefile .= '_' . $cat3;
         }
     } else {
         $pagefile .= 'home';
     }
     return $pagefile;
 }
コード例 #14
0
 public function processPage()
 {
     if (WebApp::get('cat2') !== NULL) {
         $pagefile = $this->ctrl->_getFilename();
     } else {
         $pagefile = $this->_getFilename();
     }
     if (!file_exists($pagefile . '.php')) {
         $this->parent->parent->debug($this::name_space . ': Failed to load page file "' . str_replace(__LIBDIR__, '', $pagefile) . '.php!');
         return false;
     }
     $this->parent->parent->debug($this::name_space . ': Loading file "' . str_replace(__LIBDIR__, '', $pagefile . '.php') . '"...');
     if (WebApp::get('cat2') !== NULL) {
         $this->parent->setContent($this->ctrl->_processPage($pagefile . '.php'));
     } else {
         $this->parent->setContent($this->_processPage($pagefile . '.php'));
     }
     return true;
 }
コード例 #15
0
ファイル: ajax.php プロジェクト: huwcbjones/WebFramework
 public function secondary_groups()
 {
     $q = WebApp::get('q');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('groups' => array()));
     }
     $groups = array();
     $q = '%' . $q . '%';
     $group_query = $this->mySQL_r->prepare("SELECT `GID`,`name` FROM `core_groups` WHERE `name` LIKE ? AND `type`='s'");
     $group_query->bind_param('s', $q);
     $group_query->execute();
     $group_query->store_result();
     $group_query->bind_result($id, $value);
     while ($group_query->fetch()) {
         $group['id'] = $id;
         $group['text'] = $value;
         $groups[] = $group;
     }
     return new ActionResult($this, '/admin/email', 0, 'Success', B_T_SUCCESS, array('groups' => $groups));
 }
コード例 #16
0
ファイル: file.php プロジェクト: huwcbjones/WebFramework
 public function setFile()
 {
     include __LIBDIR__ . '/fileMIMEs.php';
     $this->MIMEs = $MIME_type;
     if (WebApp::get('cat1') == 'css' || WebApp::get('cat1') == 'js' || WebApp::get('cat1') == 'images') {
         $filename = strtolower(WebApp::get('cat2')) . '/' . WebApp::get('cat1') . '/' . WebApp::get('cat3');
         $i = 4;
         while (WebApp::get('cat' . $i) !== NULL) {
             $filename .= '/' . WebApp::get('cat' . $i);
             $i++;
         }
         $this->parent->addHeader('file', $filename);
         $file = __MODULE__ . '/' . $filename;
     } elseif (WebApp::get('cat1') == 'fonts') {
         $file = __EXECDIR__ . '/' . Server::get('REQUEST_URI');
     }
     if (file_exists($file)) {
         $this->file = $file;
     } else {
         $this->file = false;
     }
 }
コード例 #17
0
ファイル: ajax.php プロジェクト: huwcbjones/WebFramework
 public function contacts()
 {
     $q = WebApp::get('q');
     if ($q === NULL) {
         return new ActionResult($this, '/admin/email', 0, 'No search term sent', B_T_FAIL, array('contacts' => array()));
     }
     $contacts = array();
     if (filter_var($q, FILTER_VALIDATE_EMAIL)) {
         $contact['id'] = $q;
         $contact['text'] = $q;
         $contacts[] = $contact;
     }
     $q = '%' . $q . '%';
     $user_query = $this->mySQL_r->prepare("SELECT `username`, CONCAT(`f_name`, ' ', `s_name`) FROM `core_users` WHERE CONCAT(`username`, ' ', `email`) LIKE ?");
     $group_query = $this->mySQL_r->prepare("SELECT `name` FROM `core_groups` WHERE `name` LIKE ?");
     $user_query->bind_param('s', $q);
     $user_query->execute();
     $user_query->store_result();
     $user_query->bind_result($id, $value);
     while ($user_query->fetch()) {
         $contact['id'] = $id;
         $contact['text'] = $value;
         $contacts[] = $contact;
     }
     $user_query->free_result();
     $group_query->bind_param('s', $q);
     $group_query->execute();
     $group_query->store_result();
     $group_query->bind_result($value);
     while ($group_query->fetch()) {
         $contact['id'] = $value;
         $contact['text'] = '* ' . $value;
         $contacts[] = $contact;
     }
     return new ActionResult($this, '/admin/email', 0, 'Success', B_T_SUCCESS, array('contacts' => $contacts));
 }
コード例 #18
0
<div class="row pane" id="header">
  <div class="col-xs-12">
    <h1 class="page-header">Uninstalling Module</h1>
    <div class="progress progress-striped active">
      <div id="prog_bar" class="progress-bar"  role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
        <span class="sr-only">0% Complete</span>
      </div>
    </div>
    <p class="text-muted" id="status_txt">Connecting to uninstaller...</p>
    <p class="text-muted" id="close_txt">Do not close this page until the uninstallation finishes.</p>
  </div>
</div>
<script type="text/javascript">
var process = "uninstall";
var module_id = "<?php 
print WebApp::get('cat4');
?>
";
var status_txt = $("#status_txt");
var close_txt = $("#close_txt");
var prog_bar = $("#prog_bar");
$(document).ready(function(e) {
    processStep(1);
});
</script>
コード例 #19
0
<?php

if (WebApp::get('cat4') !== NULL) {
    $option_query = $mySQL_r->prepare("SELECT `core_ip`.`ID`,`time`, CONCAT(`f_name`, ' ', `s_name`, ' (', `username`, ')'),  INET_NTOA(`ip`), `length`,`reason` FROM `core_ip`\nLEFT JOIN `core_users`\nON `user_id`=`core_users`.`id`\nWHERE `core_ip`.`ID`=?\n");
    if (GUMP::is_valid(array('id' => WebApp::get('cat4')), array('id' => 'required|integer'))) {
        $id = WebApp::get('cat4');
        $option_query->bind_param('i', $id);
        $option_query->execute();
        $option_query->bind_result($block_id, $time, $user, $ip, $length, $reason);
        $option_query->store_result();
        if ($option_query->num_rows == 1) {
            $option_query->fetch();
        } else {
            $page->setStatus(404);
            return;
        }
    } else {
        $page->setStatus(404);
        return;
    }
} else {
    $page->setStatus(404);
    return;
}
$closeBtn = array('a' => array('t' => 'url', 'a' => '../ipblock_view'), 'ic' => 'remove-sign');
$saveBtn = array('s' => B_T_SUCCESS, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'ipblock_edit\', this, \'save\')'), 'ic' => 'floppy-disk');
$applyBtn = array('s' => B_T_PRIMARY, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'ipblock_edit\', this, \'apply\')'), 'ic' => 'ok-sign');
$form = $page->getPlugin('form', array('ipblock_edit', WebApp::action('core', 'ipblock_edit', true), 'post'));
$form->setColumns(2, 6)->setIndent('    ')->addTextField('Block ID', 'id', $block_id, array(), array('ro' => true))->addTextField('Block Created', 'time', date(DATET_LONG, strtotime($time)), array('t' => 'Time the block was created'), array('ro' => true))->addTextField('User', 'user', $user, array('t' => 'User that created the block.'), array('ro' => true))->addTextField('IP Address', 'ip', $ip, array('t' => 'IP Address to block.', 'p' => 'xyz.xyz.xyz.xyz'), array('ro' => true))->addTextField('Length', 'length', $length, array('t' => 'Length of block in days.', 'p' => 'Days to block'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'Length of block is required.', 's' => 'danger')), 'vo' => 'validateOn:["blur"]', 'd' => false, 'r' => true, 'vt' => 'integer', 't' => 'number'))->addTextField('Reason', 'reason', $reason, array('t' => 'Reason for block.', 'p' => 'Reason'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A Reason is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A Reason is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Reason is limited to 255 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 255, validateOn:["blur"]', 'r' => true))->addBtnLine(array('close' => $closeBtn, 'save' => $saveBtn, 'apply' => $applyBtn));
$form->build();
?>
コード例 #20
0
 public function remove()
 {
     $MID = WebApp::get('cat4') === NULL ? '' : WebApp::get('cat4');
     $this->parent->parent->debug($this::name_space . ': MID ' . $MID);
     $remove_query = $this->mySQL_w->prepare("DELETE FROM `core_menu` WHERE `MID`=?");
     if (!$remove_query) {
         return new ActionResult($this, '/admin/core/menu_view', 0, 'Failed to remove menu item!<br />Error: <code>Query failed</code>', B_T_FAIL);
     }
     $remove_query->bind_param('i', $MID);
     $remove_query->execute();
     $remove_query->store_result();
     if ($remove_query->affected_rows != 0) {
         return new ActionResult($this, '/admin/core/menu_view', 1, 'Removed menu item!', B_T_SUCCESS);
     } else {
         return new ActionResult($this, '/admin/core/menu_view', 0, 'Failed to remove menu item!<br />Error: <code>Unknown</code>', B_T_FAIL);
     }
 }
コード例 #21
0
ファイル: login.php プロジェクト: huwcbjones/WebFramework
<?php

$loginBtn = array('s' => B_T_PRIMARY, 'a' => array('t' => 'submit'), 'ic' => 'login');
$registerBtn = array('a' => array('t' => 'url', 'a' => '/user/register'));
$forgotBtn = array('a' => array('t' => 'url', 'a' => '/user/recover'), 'l' => 'Forgot Details?');
$return = WebApp::get('r') !== NULL ? WebApp::get('r') : '';
$form = $page->getPlugin('form', array('u_login', WebApp::action('user', 'login'), 'post'));
$form->setIndent('  ')->setAutofill(true)->setColumns(3, 6)->addHiddenField('r', $return)->addHTML('    <div class="col-xs-12">' . PHP_EOL . '      <h2 class="form-signin-heading">' . $page->getTitle() . '</h2>' . PHP_EOL . '    </div>' . PHP_EOL)->addTextField('Username/Email', 'user', '', array('t' => 'Your username or email address.', 'p' => 'Username/Email'), array('r' => true, 'v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A Username or Email is required.', 's' => 'danger')), 'vo' => 'validateOn:["blur", "change"]'))->addPasswordField('Password', 'pwd', '', array('t' => 'Your password', 'p' => 'Password'), array('t' => 'password', 'r' => true))->addBtnLine(array('login' => $loginBtn))->addBtnLine(array('register' => $registerBtn, 'forgot' => $forgotBtn))->build();
?>

<div class="row pane">
  <div class="col-sm-12 col-md-11 col-lg-11 col-lg-offset-1 col-md-offset-1">
<?php 
print $form->getForm();
?>
  </div>
</div>
コード例 #22
0
ファイル: activate.php プロジェクト: huwcbjones/WebFramework
<div class="row pane">
  <div class="col-xs-12">
    <div class="row">
      <div class="col-xs-12">
        <h2>Activate Account</h2>
      </div>
    </div>
    <div class="row">
      <div class="col-xs-12">
        <p>To activate your account, copy and paste the activation code from your activation email and paste into the box below. Set your new password and click activate.</p>
        <p>If you did not get this email within 30 minutes, please <a href="/user/resend">click here</a> to resend the activation email.</p>
<?php 
$activateBtn = array('s' => B_T_PRIMARY, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'activate\', this, \'activate\')'), 'ic' => 'ok-sign');
$form = $page->getPlugin('form', array('activate', WebApp::action('user', 'activate', true), 'post'));
$form->setIndent('        ')->setColumns(3, 6, 3)->addTextField('Code', 'code', WebApp::get('code'), array('t' => 'Copy and paste your activation code here', 'p' => 'aaaabbbbccccddddeeeeffff11112222'), array('r' => true))->addPasswordField('New Password', 'n_pwd', '', array('t' => 'Enter your new password', 'p' => 'New Password'), array('r' => true, 'v' => true, 'w' => true))->addTextField('Confirm Password', 'c_pwd', '', array('t' => 'Confirm your new password.', 'p' => 'Confirm Password'), array('t' => 'password', 'vt' => 'confirm', 'v' => true, 'vm' => array('confirmInvalidMsg' => array('m' => 'Passwords do not match.', 's' => 'danger')), 'vc' => 'activate\\:\\:n_pwd', 'vo' => 'validateOn:["blur"]'))->addBtnLine(array('activate' => $activateBtn));
$form->build();
print $form->getForm();
?>
      </div>
    </div>
  </div>
</div>
コード例 #23
0
<?php

if (WebApp::get('cat4') === NULL || is_numeric(WebApp::get('cat4')) === false) {
    $page->setStatus(404);
}
$parentID = intval(WebApp::get('cat4'));
// Get Module info
$module_query = $mySQL_r->prepare("SELECT `namespace`,`module_id` FROM `core_modules` ORDER BY `name` ASC");
$module_query->execute();
$module_query->bind_result($mname, $module_id);
$module_data = array();
while ($module_query->fetch()) {
    $module_data[$module_id] = $mname;
}
$modules = array('-1' => array('v' => '-1', 'n' => 'Select a module', 's' => true, 'd' => true));
foreach ($module_data as $k => $v) {
    $modules[$k]['v'] = $k;
    $modules[$k]['n'] = $v;
    $modules[$k]['s'] = false;
    $modules[$k]['d'] = false;
}
$closeBtn = array('a' => array('t' => 'url', 'a' => '../menu_edit/' . $parentID), 'ic' => 'remove-sign');
$saveBtn = array('s' => B_T_SUCCESS, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'menu_add\', this, \'save\')'), 'ic' => 'floppy-disk');
$form = $page->getPlugin('form', array('menu_add', WebApp::action('core', 'menu_addsub', true), 'post'));
$form->setColumns(3, 9)->setIndent('    ')->addHiddenField('parent', $parentID)->addSelect('Module', 'module', $modules, array('t' => 'The module for the menu item.'), array('v' => true, 'vm' => array('selectRequiredMsg' => array('m' => 'A module is required.', 's' => 'danger')), 'vo' => 'validateOn:["blur"]', 'r' => true))->addSelect2('Page', 'PID', '', array('t' => 'The page the menu item will link to. * denotes admin page'), array('r' => true))->addBtnLine(array('close' => $closeBtn, 'save' => $saveBtn));
$form->build();
?>

<div class="row pane">
  <div class="col-xs-12">
    <h1 class="page-header">New Dropdown Menu Item</h1>
コード例 #24
0
ファイル: event_log.php プロジェクト: huwcbjones/WebFramework
<?php

$start_record = WebApp::get('s') === NULL ? 0 : WebApp::get('s');
$record_length = WebApp::get('n') === NULL ? 30 : WebApp::get('n');
?>
<div class="row pane">
  <div class="col-xs-12">
     <div class="row">
<?php 
if ($this->inGroup(1)) {
    print '        <div class="col-md-2 col-xs-3">' . PHP_EOL;
    print '          <a class="btn btn-xs btn-block btn-danger disabled" href="#" id="event_delete_btn" onclick="delete_mod()">Delete Event(s)&nbsp;&nbsp;&nbsp;<span class="' . B_ICON . ' ' . B_ICON . '-trash"></span></a>' . PHP_EOL;
    print '        </div>' . PHP_EOL;
}
if ($this->inGroup(1)) {
    print '        <div class="col-md-2 col-xs-3">' . PHP_EOL;
    print '          <a class="btn btn-xs btn-block btn-danger" href="#" onclick="clear_mod()">Clear Event Log&nbsp;&nbsp;&nbsp;<span class="' . B_ICON . ' ' . B_ICON . '-trash"></span></a>' . PHP_EOL;
    print '        </div>' . PHP_EOL;
}
print '        <div class="col-md-2 col-xs-3">' . PHP_EOL;
if ($record_length > 30) {
    print '          <a class="btn btn-xs btn-block btn-info" href="?s=' . $start_record . '&amp;n=' . ($record_length - 30) . '">Show Less&nbsp;&nbsp;&nbsp;<span class="' . B_ICON . ' ' . B_ICON . '-minus"></span></a>' . PHP_EOL;
}
print '        </div>' . PHP_EOL;
print '        <div class="col-md-2 col-xs-3">' . PHP_EOL;
print '          <a class="btn btn-xs btn-block btn-info" href="?s=' . $start_record . '&amp;n=' . ($record_length + 30) . '">Show More&nbsp;&nbsp;&nbsp;<span class="' . B_ICON . ' ' . B_ICON . '-plus"></span></a>' . PHP_EOL;
print '        </div>' . PHP_EOL;
print '        <div class="col-md-2 col-xs-3">' . PHP_EOL;
if ($start_record > 30) {
    print '          <a class="btn btn-xs btn-block btn-default" href="?s=' . ($start_record - $record_length) . '&amp;n=' . $record_length . '"><span class="' . B_ICON . ' ' . B_ICON . '-chevron-left"></span>&nbsp;&nbsp;&nbsp;Previous Page</a>' . PHP_EOL;
}
コード例 #25
0
ファイル: page.php プロジェクト: huwcbjones/WebFramework
 /**
  * Page::create()
  * 
  * @return
  */
 public function execute()
 {
     $this->_generating = true;
     if ($this->getStatus() != 200) {
         if ($this->parent->user->is_loggedIn() && $this->getStatus() == 401) {
             $this->setStatus(403);
         }
         if (!$this->parent->user->is_loggedIn() && WebApp::get('cat1') === 'admin') {
             $this->setStatus(404);
         }
     }
     require_once __MODULE__ . '/core/controller.php';
     $coreController = new CorePageController($this);
     $this->parent->debug($this::name_space . ': Page title is "' . $this->getTitle() . '"');
     $this->parent->debug($this::name_space . ': Getting page header');
     $page = $coreController->getHeader($this);
     $this->parent->debug($this::name_space . ': Getting navbar');
     $page .= $coreController->getNavBar($this);
     $this->parent->debug($this::name_space . ': Getting status bar');
     $page .= $coreController->getStatusBar($this);
     if ($this->getStatus() == 200) {
         $this->parent->debug($this::name_space . ': Getting page content');
         $page .= $this->content;
     } else {
         $this->parent->debug($this::name_space . ': Generating error message');
         $error = new Error($this, $this->getStatus());
         $page .= $error->getError();
     }
     $page .= '</div>' . PHP_EOL;
     $this->parent->debug($this::name_space . ': Getting page footer');
     $page .= $coreController->getFooter($this);
     $this->_generating = false;
     $this->parent->debug($this::name_space . ': Page created!');
     $this->parent->content = $page;
     if ($this->_regen) {
         $this->parent->debug($this::name_space . ': Regenerating page... something changed whilst creating the page');
         $this->_regen = false;
         $this->execute();
     }
 }
コード例 #26
0
ファイル: home.php プロジェクト: huwcbjones/WebFramework
if ($meet_query !== false && $meet_query->num_rows != 0) {
    if (WebApp::get('details')) {
        $numRows_q = $mySQL_r->prepare("SELECT COUNT(*) FROM `comp_meet` " . $statements['0_where']);
        $numRows_q->execute();
        $numRows_q->store_result();
        $numRows_q->bind_result($numRows);
        $numRows_q->fetch();
        if ($numRows < WebApp::get('page')) {
            WebApp::get('page', $numRows);
        }
        $numRows_q->free_result();
        $paginator = $page->getPlugin('paginator');
        $paginator->setItems($numRows);
        $paginator->setItemsPerPage(WebApp::get('disp'));
        $paginator->setPageLink("?disp=" . WebApp::get('disp') . "&details=" . WebApp::get('details') . "&old=" . WebApp::get('old') . "&order=" . WebApp::get('order') . "&sort=" . WebApp::get('sort'));
        $paginator->setCurrentPage(WebApp::get('page'));
        $paginator->createPaginator();
        if ($meet = $page->getResource('competitions')) {
            while ($meet_query->fetch()) {
                if ($comp = $meet->fetchCompetition($comp_id)) {
                    print $comp->format();
                }
            }
            print $paginator->getPaginator();
        } else {
            print '<div class="row pane">' . PHP_EOL;
            print '  <div class="col-xs-12">' . PHP_EOL;
            print '    <h4>Failed to load competitions.</h4>' . PHP_EOL;
            print '  </div>' . PHP_EOL;
            print '</div>' . PHP_EOL;
        }
コード例 #27
0
ファイル: plugin.php プロジェクト: huwcbjones/WebFramework
 private function is_tabActive($pageID, $active)
 {
     return WebApp::get('tp') === $pageID || $active && (WebApp::get('tp') === null || WebApp::get('tp') === $pageID);
 }
コード例 #28
0
ファイル: user.php プロジェクト: huwcbjones/WebFramework
 function disable()
 {
     $users = WebApp::post('users') === NULL ? array() : strgetcsv(WebApp::post('users'));
     if (count($users) == 0) {
         $users = WebApp::get('u') === NULL ? array() : strgetcsv(WebApp::get('u'));
     }
     if (count($users) == 0) {
         return new ActionResult($this, '/admin/user/group_view', 0, 'No user(s) were selected!', B_T_FAIL);
     }
     $check_query = $this->mySQL_w->prepare("SELECT `p_group` FROM `core_users` WHERE `id`=?");
     if ($check_query === false) {
         return new ActionResult($this, '/admin/user/user_view', 0, 'Failed to disable users!<br />Error: <code>Check query failed</code>', B_T_FAIL);
     }
     if (in_array($this->parent->parent->user->getUserID(), $users)) {
         $this->parent->parent->logEvent($this::name_space, 'Failed to disable user: disable current user');
         return new ActionResult($this, '/admin/user/user_view', 0, 'Failed to disable user!<br />Error: <code>Cannot disable yourself</code>', B_T_FAIL);
     }
     foreach ($users as $UID) {
         $check_query->bind_param('i', $UID);
         $check_query->execute();
         $check_query->bind_result($p_group);
         $check_query->fetch();
         if ($p_group == 1 && !$this->parent->parent->user->inGroup(1)) {
             $this->parent->parent->logEvent($this::name_space, 'Failed to disable user: disable Super Admin');
             return new ActionResult($this, '/admin/user/group_view', 0, 'Failed to disable user!<br />Error: <code>You cannot disable Super Administrators</code>', B_T_FAIL);
         }
     }
     $check_query->free_result();
     $update_query = $this->mySQL_w->prepare("UPDATE `core_users` SET `en`=0 WHERE `id`=?");
     if ($update_query === false) {
         return new ActionResult($this, '/admin/user/user_view', 0, 'Failed disable users!<br />Error: <code>Update query failed</code>', B_T_FAIL);
     }
     $affected_rows = 0;
     foreach ($users as $UID) {
         $update_query->bind_param('i', $UID);
         $update_query->execute();
         $update_query->store_result();
         $affected_rows += $update_query->affected_rows;
     }
     if ($affected_rows == count($users)) {
         $this->parent->parent->logEvent($this::name_space, 'Disabled users ' . csvgetstr($users));
         return new ActionResult($this, '/admin/user/user_view', 1, 'Successfully disabled selected user(s)!', B_T_SUCCESS);
     } else {
         $this->parent->parent->logEvent($this::name_space, 'Disabled some of users ' . csvgetstr($users));
         return new ActionResult($this, '/admin/user/user_view', 1, 'Successfully disabled ' . $affected_rows . '/' . count($users) . ' selected user(s)!<br /><small>Possible cause: <code>User was already disabled</code></small>', B_T_WARNING);
     }
 }
コード例 #29
0
ファイル: action.php プロジェクト: huwcbjones/WebFramework
 public function backup()
 {
     if (!$this->accessAdminPage(3)) {
         return new ActionResult($this, '/admin/modules/', 1, 'You are not allowed to do that', B_T_FAIL);
     }
     $backups = WebApp::post('backups') === NULL ? array() : strgetcsv(WebApp::post('backups'));
     if (count($backups) == 0) {
         $backups = WebApp::get('m') === NULL ? array() : array(WebApp::get('m'));
     }
     if (count($backups) == 0) {
         return new ActionResult($this, '/admin/modules/backup', 0, 'No module(s) were selected!', B_T_FAIL);
     }
     foreach ($backups as $backup) {
         $validated = GUMP::is_valid(array('bk' => $backup), array('bk' => 'integer'));
         if ($validated !== true) {
             return new ActionResult($this, '/admin/modules/backup', 0, 'No module(s) were selected!', B_T_FAIL);
         }
     }
     $location = __BACKUP__ . DIRECTORY_SEPARATOR . date(DATET_BKUP) . DIRECTORY_SEPARATOR;
     require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'backup.php';
     $result = array();
     foreach ($backups as $module) {
         $backup = new Backup($this->parent);
         if (!$backup->setLocation($location)) {
             return new CronResult($this, false, 'Failed to create backup dir: ' . DIRECTORY_SEPARATOR . 'backup' . str_replace(__BACKUP__, '', $location . $module));
         }
         if (!$backup->setID($module)) {
             return new CronResult($this, false, 'Failed to setID for ' . $module);
         }
         $results[$module] = $backup->backup();
         unset($backup);
     }
     $msg = '';
     $status = true;
     foreach ($results as $ns => $data) {
         $msg .= '"' . $ns . '": ' . $data['msg'] . PHP_EOL;
         if (!$data['s']) {
             $status = false;
         }
     }
     if ($status) {
         $msg = 'Backup was completed for selected module(s)!';
         $type = B_T_SUCCESS;
     } else {
         $msg = 'Backup was completed but failed for some/all module(s). Details as follows:' . PHP_EOL . $msg;
         $type = B_T_WARNING;
     }
     $this->parent->parent->logEvent($this::name_space, 'Back up modules: ' . csvgetstr($backups));
     return new ActionResult($this, '/admin/modules/backup', 1, $msg, $type);
 }
コード例 #30
0
ファイル: edit.php プロジェクト: huwcbjones/WebFramework
<?php

if (WebApp::get('cat4') === NULL || is_numeric(WebApp::get('cat4')) === false) {
    $page->setStatus(404);
}
$ID = intval(WebApp::get('cat4'));
$location = $page->getResource('location');
if ($location->getLocation($ID) === false) {
    $page->setStatus(404);
    return false;
}
$closeBtn = array('a' => array('t' => 'url', 'a' => '../'), 'ic' => 'remove-sign');
$saveBtn = array('s' => B_T_SUCCESS, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'location_edit\', this, \'save\')'), 'ic' => 'floppy-disk');
$applyBtn = array('s' => B_T_PRIMARY, 'a' => array('t' => 'url', 'a' => '#', 'oc' => 'processForm(\'location_edit\', this, \'apply\')'), 'ic' => 'ok-sign');
$form = $page->getPlugin('form', array('location_edit', WebApp::action('location', 'edit', true), 'post'));
$form->setIndent('    ');
$form->addTextField('Location ID', 'id', $ID, array('t' => 'ID of Location.', 'p' => 'ID'), array('ro' => true, 'd' => false))->addTextField('Venue Name', 'name', $location->name, array('t' => 'Name of venue', 'p' => 'Venue'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A Venue Name is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A Venu Name is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Venu Name is limited to 100 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 100, validateOn:["blur"]', 'r' => true))->addTextField('Address Line 1', 'addr1', $location->address['line1'], array('t' => 'Address Line 1', 'p' => 'Address Line 1'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'Address Line 1 is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'Address Line 1 is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Address Line 1 is limited to 250 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 250, validateOn:["blur"]', 'r' => true))->addTextField('Address Line 2', 'addr2', $location->address['line2'], array('t' => 'Address Line 2', 'p' => 'Address Line 2'), array('v' => true, 'vm' => array('textfieldMaxCharsMsg' => array('m' => 'Address Line 2 is limited to 250 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 250, validateOn:["blur"]'))->addTextField('Town/City', 'city', $location->address['city'], array('t' => 'City', 'p' => 'City'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A City is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A City is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'City is limited to 100 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 100, validateOn:["blur"]', 'r' => true))->addTextField('County', 'county', $location->address['county'], array('t' => 'County', 'p' => 'County'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A County is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A County is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'County is limited to 100 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 100, validateOn:["blur"]', 'r' => true))->addTextField('Postcode', 'post', $location->address['postcode'], array('t' => 'Postcode', 'p' => 'AB012CD'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A Postcode is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A Postcode is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Postcode is limited to 7 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 7, validateOn:["blur"]', 'r' => true))->addTextField('Phone Number', 'phone', $location->phone['number'], array('t' => 'Phone', 'p' => '01234 123455'), array('v' => true, 'vm' => array('textfieldRequiredMsg' => array('m' => 'A phone number is required.', 's' => B_T_FAIL), 'textfieldMinCharsMsg' => array('m' => 'A phone number is required.', 's' => B_T_FAIL), 'textfieldMaxCharsMsg' => array('m' => 'Phone number is limited to a max of 15 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 15, validateOn:["blur"]', 't' => 'tel', 'vt' => 'text', 'r' => true))->addTextField('Phone extension', 'ext', $location->phone['ext'], array('t' => 'Extension for phone (if required)', 'p' => 'Extension Number'), array('v' => true, 'vm' => array('textfieldMaxCharsMsg' => array('m' => 'Extension is limited to 11 chars.', 's' => B_T_FAIL)), 'vo' => 'minChars: 0, maxChars: 50, validateOn:["blur"]'))->addButtonGroup('Google Maps', 'maps', array(array('i' => 'mapsY', 's' => B_T_SUCCESS, 'v' => 1, 'l' => 'Yes', 'c' => $location->map), array('i' => 'mapsN', 's' => B_T_FAIL, 'v' => 0, 'l' => 'No', 'c' => !$location->map)), array('t' => 'Enable Google Maps integration on the location\'s page.'))->addBtnLine(array('close' => $closeBtn, 'save' => $saveBtn, 'apply' => $applyBtn));
$form->build();
?>

<div class="row pane">
  <div class="col-xs-12">
  <h1 class="page-header">Edit Location</h1>
<?php 
print $form->getForm();
?>
  </div>
</div>