예제 #1
0
파일: Login.php 프로젝트: frycnx/jxc
 function security()
 {
     $_SESSION['verify'] = strtolower(randStr(4));
     loadLib('Image');
     Image::verify($_SESSION['verify'], 50, 33);
     //Image::security($_SESSION['verify'], 80, 35, 20, CORE_PATH.'font/t1.ttf');
 }
예제 #2
0
파일: Acl.php 프로젝트: frycnx/jxc
 function __construct()
 {
     global $_G;
     parent::__construct();
     loadLib('Session');
     Session::start(db(), "{$_G['db_prefix']}session");
     if (empty($_SESSION['user_id'])) {
         header('Location: ' . url('Login'));
     }
     //$this->checkRole();
 }
예제 #3
0
 function loadSubCapsule($path, $params = '', $sname = null)
 {
     // echo " [loading subCapsule $path with $params] ";
     $name = strtolower($path);
     if (!file_exists(CAPSULES_PATH . $path . '.view')) {
         if (file_exists(CAPSULES_PATH . $path . '/' . $path . '.view')) {
             $path = $path . '/' . $path;
         }
     }
     if (strstr($path, '/')) {
         $a = explode('/', $path);
         $controller = ucwords($a[count($a) - 1]);
         $name = strtolower($controller);
     } else {
         $controller = ucwords($path);
     }
     if (file_exists(CAPSULES_PATH . $path . '.controller')) {
         require_once CAPSULES_PATH . $path . '.controller';
     } else {
         if (DEFAULT_BUFFERTIME > 0) {
             loadLib('bufferedcapsule');
             $controller = 'Bufferedcapsule';
             $params = name2url($path);
         } else {
             $controller = 'Capsule';
         }
     }
     $view = $path . '.view';
     $capsuleobject = new $controller($view);
     $capsuleobject->init($params);
     if (!is_null($sname)) {
         $name = $sname;
     }
     // echo " [name=$name] ";
     $this->params[$name] = $capsuleobject->getHtml();
     return $capsuleobject;
 }
예제 #4
0
function getCapsuleFromAutomapping($surl)
{
    if (strlen($surl) == 0) {
        return array();
    }
    if ($surl[0] == '/') {
        $surl = substr($surl, 1);
    }
    //accept only existing Capsules
    $aurlparts = explode("/", $surl);
    $capsulename = $aurlparts[0];
    if (!is_dir(CAPSULES_PATH . $capsulename)) {
        return array();
    }
    $params = '';
    $nurlparts = count($aurlparts);
    if ($nurlparts == 2) {
        //url like /capsulename/view
        $path_parts = pathinfo($surl);
        $filename = $path_parts['basename'];
        $filename = str_replace(' ', '_', $filename);
        $filename = str_replace('%20', '_', $filename);
        $capspath = CAPSULES_PATH . $capsulename . '/' . $filename . '.controller';
        if (file_exists($capspath)) {
            return array('capsule' => $capsulename, 'controller' => $filename, 'view' => $filename, 'params' => '');
        }
        $viewpath = CAPSULES_PATH . $capsulename . '/' . $filename . '.view';
        if (DEFAULT_BUFFERTIME > 0) {
            loadLib('bufferedcapsule');
            $controller = 'bufferedcapsule';
            $params = name2url($path);
        } else {
            $controller = 'capsule';
        }
        if (file_exists($viewpath)) {
            return array('capsule' => $capsulename, 'controller' => $controller, 'view' => $filename, 'params' => $params);
        }
    }
    if ($nurlparts == 1) {
        //url like /capsulename
        $viewpath = CAPSULES_PATH . $capsulename . '/' . $capsulename . '.view';
        // echo " mapping $capsulename ";
        if (file_exists(CAPSULES_PATH . $capsulename . '/' . $capsulename . '.controller')) {
            $controller = $capsulename;
        } else {
            if (DEFAULT_BUFFERTIME > 0) {
                loadLib('bufferedcapsule');
                $controller = 'bufferedcapsule';
                $params = name2url($path);
            } else {
                $controller = 'capsule';
            }
        }
        if (file_exists($viewpath)) {
            return array('capsule' => $capsulename, 'controller' => $controller, 'view' => $capsulename, 'params' => $params);
        }
        if (file_exists(CAPSULES_PATH . $capsulename . '/' . $capsulename . '.controller')) {
            return array('capsule' => $capsulename, 'controller' => $controller, 'view' => $capsulename, 'params' => $params);
        }
    }
    return array();
}
예제 #5
0
<?php

loadLib('appointment');
loadJS('add_payment.js', 'payment');
$patient_id = getVar('patient_id');
$patient = getPatient($patient_id);
//get all the patient appointments to display in the side menu
$appointments = Appointment::getAppointments($patient_id);
include 'views/patient_menu.php';
예제 #6
0
파일: settings.php 프로젝트: tapuz/alice
<?php

//Component Settings
loadCSS('settings.css', 'settings');
loadJS('settings.js', 'settings');
loadLib('invoice');
switch (getTask()) {
    case 'save_template':
        $wpdb->update('table_letter_templates', array('template' => getVar('template'), 'name' => getVar('template_name')), array('id' => getVar('template_id')));
        break;
    case 'delete_template':
        $wpdb->delete('table_letter_templates', array('id' => getVar('template_id')));
        break;
    case 'add_new_template':
        $wpdb->insert('table_letter_templates', array('category_id' => getVar('category_id'), 'name' => 'New template'));
        //get the letter_id just created to pass to the select_category view
        $template_id = $wpdb->insert_id;
        break;
}
switch (getView()) {
    case 'general':
        // display the settings menu
        include 'views/general.php';
        break;
    case 'select_category':
        // get letter categories to select from
        $query = "SELECT * from table_letter_categories";
        $categories = $wpdb->get_results($query);
        include 'views/select_category.php';
        break;
    case 'templates':
예제 #7
0
 function queueHtml($srecipient, $ssubject, $sbody, $sfroms = false, $scc = false, $sbcc = false, $sattachmentspath = false)
 {
     // echo "queueHtml($srecipient, $ssubject, $sbody, $sfroms, $scc, $sbcc, $sattachmentspath) \n";
     if (!$sfroms) {
         $sfroms = EMAIL_FROM;
     }
     loadLib('string');
     $sfrom = strip_to_bare_email($sfroms);
     $sfromname = strip_email_to_bare_name($sfroms);
     $sdir = Mailer::findFreeDir();
     // echo " sdir=$sdir ";
     file_put_contents($sdir . 'body.mail', $sbody);
     $details = "subject={$ssubject}\n";
     $details .= "to={$srecipient}\n";
     $details .= "cc={$scc}\n";
     $details .= "bcc={$sbcc}\n";
     $details .= "mode=text/html\n";
     $details .= "from={$sfrom}\n";
     $details .= "fromname={$sfromname}\n";
     file_put_contents($sdir . 'details.mail', $details);
     $headers = '';
     $headers .= "Content-type: text/html; charset=" . EMAIL_CHARSET . "\r\n";
     $headers .= "From: {$sfrom}\r\n";
     if ($scc) {
         $headers .= "Cc: {$scc}\r\n";
     }
     if ($sbcc) {
         $headers .= "Bcc: {$sbcc}\r\n";
     }
     file_put_contents($sdir . 'headers.mail', $headers);
     // echo "aqq [$sattachmentspath] ";
     if ($sattachmentspath) {
         loadLib('filesystem');
         // echo "dircopy ";
         Filesystem::dircopy($sattachmentspath, $sdir);
     }
     return file_put_contents(EMAIL_OUTBOX_PATH . 'jobs.queue', $sdir);
 }
예제 #8
0
define('INIT', true);
define('PAGE_DIR', __DIR__ . '/page/');
define('CONFIG_DIR', __DIR__ . '/config/');
define('LIB_DIR', __DIR__ . '/lib/');
define('TEMPLATE_DIR', __DIR__ . '/template/');
define('VIEW_DIR', PAGE_DIR . 'view/');
ob_start();
session_start();
function loadLib($name)
{
    require_once LIB_DIR . $name . '.php';
}
loadLib('profiler');
startProfiler();
foreach (array('account', 'auth', 'config', 'database', 'view') as $lib) {
    loadLib($lib);
}
connectDatabase();
/* @var $pages array */
$pages = getConfig('pages');
/* @var $page string */
$page = 'home';
if (isset($_GET['page']) && isset($pages[$_GET['page']])) {
    $page = $_GET['page'];
}
/* @var $content string */
$content = (include_once PAGE_DIR . $pages[$page]);
echo renderTemplate(getConfigValue('main', 'template'), $content);
disconnectDatabase();
finishProfiler();
saveProfilerResult();
예제 #9
0
파일: tasks.php 프로젝트: tapuz/alice
<?php

//Component Tasks
loadLib('task');
loadJS('tasks.js', 'tasks');
//loadCSS('payment.css','payment');
switch (getVar('task')) {
    case 'add_task':
        Task::addTask(getVar('creator_id'), getVar('assigned_to_id'), getVar('taskname'), getVar('note'));
        setResponse('Task added...');
        break;
    case 'complete_task':
        break;
    case 'delete_task':
        break;
    case 'get_users':
        echo $users = json_encode(get_users());
        break;
}
switch (getView()) {
    case 'list':
        $user_id = get_current_user_id();
        //get all the tasks for the user
        $tasks = Task::getTasks();
        //set the backLink
        //$backLink = "index.php?com=patient&view=patient&patient_id=" . $patient_id;
        include 'views/list.php';
        break;
}
예제 #10
0
<?php

/**
 * This is an example of a script running in background
 * with Semaphore
 */
require_once '../config.php';
require_once ENGINE_PATH . 'engine.functions.php';
//one instance at a time
loadLib('semaphore');
$semaphore = new Semaphore('maintenance', 'takeover mode', true);
if (!$semaphore->isMine()) {
    die(0);
}
//establish db connection
// $odb = getOdb();
//clean cache
loadLib('filesystem');
echo "\n" . date('Y-m-d H:i:s') . "\n";
Filesystem::removeFromPublic('*', true);
Filesystem::remove(TEMP_PATH . '*', true);
//clear the semaphore
$semaphore->clear();
예제 #11
0
파일: payment.php 프로젝트: tapuz/alice
<?php

//Component Payment
loadLib('payment');
loadLib('clinic');
//loadJS('payment.js','payment');
//loadCSS('payment.css','payment');
switch (getVar('task')) {
    case 'add_payment':
        //check if the user has rights to add a payment
        if (current_user_can('add_payment')) {
            Payment::addPayment(getVar('patient_id'), getVar('clinic'), getVar('practitioner_id'), getVar('description'), getVar('amount'));
            error_log("Adding the payment", 0);
            setResponse('Payment Registered... !!');
        }
        break;
    case 'get_clinics':
        //get the clinics to use in the payment
        echo $clinics = json_encode(Clinic::getClinics());
        break;
    case 'get_fees':
        echo $fees = json_encode(Payment::getFees());
        break;
    case 'get_users':
        echo $users = json_encode(get_users('role=practitioner'));
        break;
}
switch (getView()) {
    case 'list':
        //get all the payments from the clinics
        $payments = Payment::getAllPayments();
예제 #12
0
파일: invoice.php 프로젝트: tapuz/alice
<?php

//Component Invoice
loadLib('invoice');
loadLib('payment');
loadJS('invoice.js', 'invoice');
loadCSS('invoice.css', 'invoice');
$patient_id = getVar('patient_id');
switch (getVar('task')) {
    case 'create_new_invoice':
        $patient = getPatient($patient_id);
        $invoice = new Invoice();
        $invoice->patient_id = $patient_id;
        $invoice->clinic_id = $patient->clinic;
        $invoice->address = $patient->patient_surname . ' ' . $patient->patient_firstname . '<br>' . $patient->address . '<br>' . $patient->postcode . ' ' . $patient->city . '<br>' . $patient->country;
        $invoice->insertInvoice();
        $invoice_id = $invoice->invoice_id;
        // get the ID to be used in edit_invoice view
        break;
    case 'delete_invoice':
        Invoice::deleteInvoice(getVar('invoice_id'));
        break;
    case 'add_invoice_item':
        //set payment to invoiced
        Payment::setPaymentInvoicedStatus(getVar('payment_id'), 1);
        $invoice_item = new Invoice();
        $invoice_item->invoice_id = getVar('invoice_id');
        $invoice_item->payment_id = getVar('payment_id');
        $invoice_item->item_description = getVar('item_description');
        $invoice_item->item_price = getVar('item_price');
        $invoice_item->addInvoiceItem();