Ejemplo n.º 1
0
 if (getGPC($_POST, 'plannedTransactionsBox', 'checkbox')) {
     $showPlannedTransactions = 1;
 } else {
     $showPlannedTransactions = 0;
 }
 if (getGPC($_POST, 'savingTargetBox', 'checkbox')) {
     $showSavingTarget = 1;
 } else {
     $showSavingTarget = 0;
 }
 if (getGPC($_POST, 'pocketMoney1Box', 'checkbox')) {
     $showPocketMoney1 = 1;
 } else {
     $showPocketMoney1 = 0;
 }
 if (getGPC($_POST, 'pocketMoney2Box', 'checkbox')) {
     $showPocketMoney2 = 1;
 } else {
     $showPocketMoney2 = 0;
 }
 if (count($errors) != 0) {
     echo '<errors>';
     foreach ($errors as $error) {
         echo "<error>{$error}</error>";
     }
     echo '</errors>';
 }
 //create the chart
 $insertChart = InsertChart(BADGER_ROOT . "/includes/charts/charts.swf", BADGER_ROOT . "/includes/charts/charts_library", BADGER_ROOT . "/modules/forecast/forecastChart.php?endDate={$endDate}&account={$account}&savingTarget={$savingTarget}&pocketMoney1={$pocketMoney1}&pocketMoney2={$pocketMoney2}&showLowerLimit={$showLowerLimit}&showUpperLimit={$showUpperLimit}&showPlannedTransactions={$showPlannedTransactions}&showSavingTarget={$showSavingTarget}&showPocketMoney1={$showPocketMoney1}&showPocketMoney2={$showPocketMoney2}", 800, 400, "ECE9D8", true);
 $am = new AccountManager($badgerDb);
 $totals = array();
**/
define("BADGER_ROOT", "../..");
require_once BADGER_ROOT . '/includes/fileHeaderBackEnd.inc.php';
require_once BADGER_ROOT . '/core/pageSettings/PageSettings.class.php';
require_once BADGER_ROOT . '/core/pageSettings/JSON.php';
$logger->log('getPageSetting: REQUEST_URI: ' . $_SERVER['REQUEST_URI']);
$pageSettings = new PageSettings($badgerDb);
$page = getGPC($_REQUEST, 'page');
switch (getGPC($_REQUEST, 'action')) {
    case 'getSettingNamesList':
        $json = new Services_JSON();
        echo $json->encode($pageSettings->getSettingNamesList($page));
        break;
    case 'getSettingRaw':
        echo $pageSettings->getSettingRaw($page, getGPC($_REQUEST, 'settingName'));
        break;
    case 'setSettingRaw':
        $pageSettings->setSettingRaw($page, getGPC($_REQUEST, 'settingName'), getGPC($_REQUEST, 'setting'));
        break;
    case 'getSettingSer':
        $json = new Services_JSON();
        echo $json->encode($pageSettings->getSettingSer($page, getGPC($_REQUEST, 'settingName')));
        break;
    case 'setSettingSer':
        $json = new Services_JSON();
        $pageSettings->setSettingSer($page, getGPC($_REQUEST, 'settingName'), $json->decode(getGPC($_REQUEST, 'setting')));
        break;
    case 'deleteSetting':
        $pageSettings->deleteSetting($page, getGPC($_REQUEST, 'settingName'));
        break;
}
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://www.badger-finance.org 
*
**/
define("BADGER_ROOT", "../..");
require_once BADGER_ROOT . "/includes/fileHeaderFrontEnd.inc.php";
require_once BADGER_ROOT . "/core/widgets/DataGrid.class.php";
require_once BADGER_ROOT . '/modules/account/AccountManager.class.php';
require_once BADGER_ROOT . '/modules/account/accountCommon.php';
if (isset($_GET['accountID'])) {
    $accountID = getGPC($_GET, 'accountID', 'integer');
} else {
    throw new badgerException('accountOverview', 'noAccountID', '');
}
$am = new AccountManager($badgerDb);
$account = $am->getAccountById($accountID);
$pageTitle = getBadgerTranslation2('accountOverview', 'pageTitle');
$pageTitle .= ": " . $account->getTitle();
$widgets = new WidgetEngine($tpl);
$widgets->addToolTipJS();
$widgets->addCalendarJS();
$widgets->addTwistieSectionJS();
$dataGrid = new DataGrid($tpl, "Account{$accountID}");
$dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=Account&qp={$accountID}";
$dataGrid->headerName = array(getBadgerTranslation2('accountOverview', 'colValutaDate'), getBadgerTranslation2('accountOverview', 'colTitle'), getBadgerTranslation2('accountOverview', 'colType'), getBadgerTranslation2('accountOverview', 'colAmount'), getBadgerTranslation2('accountOverview', 'colBalance'), getBadgerTranslation2('accountOverview', 'colCategoryTitle'));
$dataGrid->columnOrder = array("valutaDate", "title", "type", "amount", "balance", "concatCategoryTitle");
Ejemplo n.º 4
0
    $showLowerLimit = getGPC($_GET, 'showLowerLimit', 'boolean');
}
if (isset($_GET['showUpperLimit'])) {
    $showUpperLimit = getGPC($_GET, 'showUpperLimit', 'boolean');
}
if (isset($_GET['showPlannedTransactions'])) {
    $showPlannedTransactions = getGPC($_GET, 'showPlannedTransactions', 'boolean');
}
if (isset($_GET['showSavingTarget'])) {
    $showSavingTarget = getGPC($_GET, 'showSavingTarget', 'boolean');
}
if (isset($_GET['showPocketMoney1'])) {
    $showPocketMoney1 = getGPC($_GET, 'showPocketMoney1', 'boolean');
}
if (isset($_GET['pocketMoney2'])) {
    $showPocketMoney2 = getGPC($_GET, 'showPocketMoney2', 'boolean');
}
//get daily amounts from db
$am = new AccountManager($badgerDb);
$totals = array();
$currentAccount = $am->getAccountById($accountId);
//get LowerLimit for account from db
#$currentAccount->SetLowerLimit(NULL);
if (!is_null($currentAccount->getLowerLimit()->get())) {
    $lowerLimit = $currentAccount->getLowerLimit();
}
#$currentAccount->SetUpperLimit(NULL);
if (!is_null($currentAccount->getUpperLimit()->get())) {
    $upperLimit = $currentAccount->getUpperLimit();
}
//calculate every days balance
/**
 * This file is called by StandardNavigation. It externalizes the CSS and JS code of
 * StandardNavigation, assuming it does not change for each side. This saves some
 * bandwith, as this file should be cached.
 * 
 * @author Eni Kao
 */
define('BADGER_ROOT', '../..');
require_once BADGER_ROOT . '/includes/fileHeaderBackEnd.inc.php';
require_once BADGER_ROOT . '/core/navi/StandardNavigation.class.php';
require_once BADGER_ROOT . '/core/navi/NavigationFromDB.class.php';
//require_once(BADGER_ROOT . '/core/UserSettings.class.php'); // sollte das nicht auch in die Includes??
if (isset($_GET['part'])) {
    $callerBadgerRoot = isset($_GET['badger_root']) ? getGPC($_GET, 'badger_root') : "";
    $navi = NavigationFromDB::getNavigation($callerBadgerRoot);
    $naviObj = new StandardNavigation();
    $naviObj->setStructure($navi);
    //We do our best to get this cached
    //header('Cache-Control: public');
    //header('Expires: ' . date('r', time() + 24 * 60 * 60));
    switch (getGPC($_GET, 'part')) {
        case 'css':
            header('Content-Type: text/css');
            echo $naviObj->getCSS();
            break;
        case 'js':
            header('Content-Type: text/javascript');
            echo "function loadNavigation() {\n" . $naviObj->getJS() . "\n}";
            break;
    }
}
<?php

/*
* ____          _____   _____ ______ _____  
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://badger.berlios.org 
*
**/
define('BADGER_ROOT', '../..');
require_once BADGER_ROOT . '/includes/fileHeaderBackEnd.inc.php';
require_once BADGER_ROOT . '/modules/account/accountCommon.php';
//help functions for automatical calculation of pocket money from the finished transactions
$startSpendingDate = getGPC($_POST, 'startDate', 'DateFormatted');
$accountId = getGPC($_POST, 'selectedAccount', 'int');
$spendingMoney = getSpendingMoney($accountId, $startSpendingDate);
$spendingMoney->mul(-1);
$calculatedPocketMoney = $spendingMoney->getFormatted();
echo $calculatedPocketMoney;
require_once BADGER_ROOT . "/includes/fileFooter.php";
Ejemplo n.º 7
0
function updatePreselection()
{
    global $us;
    $accountIds = getGPC($_GET, 'accounts', 'integerList');
    $us->setProperty('statisticsPreselectedAccounts', $accountIds);
}
            $us->setProperty('badgerThousandSeparator', ",");
        }
        if ($change_password == true) {
            $us->setProperty('badgerPassword', md5(getGPC($_POST, 'NewPassword')));
            //set new valid session, with new password
            set_session_var('password', md5(getGPC($_POST, 'NewPassword')));
        }
        if (isset($_POST['futureCalcSpan'])) {
            $us->setProperty('amountFutureCalcSpan', getGPC($_POST, 'futureCalcSpan', 'integer'));
        }
        if (isset($_POST['autoExpandPlannedTransactions'])) {
            $us->setProperty('autoExpandPlannedTransactions', getGPC($_POST, 'autoExpandPlannedTransactions', 'checkbox'));
        }
        $us->setProperty('matchingDateDelta', getGPC($_POST, 'matchingDateDelta', 'integer'));
        $us->setProperty('matchingAmountDelta', getGPC($_POST, 'matchingAmountDelta', 'integer') / 100);
        $us->setProperty('matchingTextSimilarity', getGPC($_POST, 'matchingTextSimilarity', 'integer') / 100);
    }
} else {
    $change_password = false;
}
// Re-Initialization of the tpl-engine after tpl change
$tpl = new TemplateEngine($us, BADGER_ROOT);
$tpl->addCSS("style.css", "print, screen");
$tpl->addCSS("print.css", "print");
$tpl->addJavaScript("js/jsval.js");
$widgets = new WidgetEngine($tpl);
$widgets->addJSValMessages();
$widgets->addToolTipJS();
$widgets->addNavigationHead();
$pageHeading = getBadgerTranslation2('UserSettingsAdmin', 'title');
echo $tpl->getHeader($pageHeading);
function updateRecord()
{
    global $redirectPageAfterSave;
    global $cm;
    switch (getGPC($_POST, 'hiddenID')) {
        case 'new':
            //add new record
            //check if $_POST['symbol'], $_POST['longName'] is set?????
            $ID = $cm->addCurrency(getGPC($_POST, 'symbol'), getGPC($_POST, 'longname'));
            break;
        default:
            //update record
            $currency = $cm->getCurrencyById(getGPC($_POST, 'hiddenID', 'integer'));
            $currency->setSymbol(getGPC($_POST, 'symbol'));
            $currency->setLongName(getGPC($_POST, 'longname'));
            //$ID = $currency->getId();
    }
    //REDIRECT
    header("Location: {$redirectPageAfterSave}");
}
Ejemplo n.º 10
0
 private function __construct()
 {
     self::$_sessionid = getGPC('sessionid', 'cookie');
     if (empty(self::$_sessionid)) {
         self::$_sessionid = uniqid('session_', true);
         setGPC('sessionid', self::$_sessionid);
     } else {
         self::$_sessionData = GilCache::get(self::$_sessionid);
     }
 }
Ejemplo n.º 11
0
/*
* ____          _____   _____ ______ _____  
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://www.badger-finance.org 
*
**/
define("BADGER_ROOT", "..");
require_once BADGER_ROOT . "/includes/fileHeaderBackEnd.inc.php";
//require_once(BADGER_ROOT . "/core/UserSettings.class.php"); // sollte das nicht auch in die Includes??
header('Content-Type: text/javascript');
$badgerRoot = getGPC($_GET, 'badgerRoot');
//we need this bagerRoot for images path
$settings = new UserSettings($badgerDb);
$badgerTemplate = $settings->getProperty("badgerTemplate");
//We do our best to get this cached
//header('Cache-Control: public');
//header('Expires: ' . date('r', time() + 24 * 60 * 60));
?>
 
//	written	by Tan Ling Wee
//	last updated 28 July 2003
//	email :	info@sparrowscripts.com
//	modified by ALQUANTO 30 July 2003 - german language included.
//									  - modified languageLogic with the ISO-2letter-strings
//									  - changes in in showCalendar: defaultLanguage is already set...
//									  - js and html corrected... more xhtml-compliant... simplier css
Ejemplo n.º 12
0
define('MAX_LABELS', 8);
$graph = new Graph(800, 400);
$graph->setScale('textlin');
$accountIds = getGPC($_GET, 'accounts', 'integerList');
$accountManager = new AccountManager($badgerDb);
$totals = array();
$labels = array();
$values = array();
$orderMin = array(array('key' => 'valutaDate', 'dir' => 'asc'));
$orderMax = array(array('key' => 'valutaDate', 'dir' => 'desc'));
if (getGPC($_GET, 'start') !== 'b') {
    $startWithBalance = false;
} else {
    $startWithBalance = true;
}
if (getGPC($_GET, 'ticks') !== 's') {
    $showTickMarks = false;
} else {
    $showTickMarks = true;
}
$displayStartDate = null;
$displayEndDate = null;
$displayStartDateFound = false;
$displayEndDateFound = false;
$valutaDateFilterAnalysed = false;
foreach ($accountIds as $currentAccountId) {
    $currentAccount = $accountManager->getAccountById($currentAccountId);
    $labels[$currentAccount->getId()] = $currentAccount->getTitle();
    $filter = getDataGridFilter($currentAccount);
    if (!$valutaDateFilterAnalysed) {
        foreach ($filter as $currentFilter) {
Ejemplo n.º 13
0
    } elseif (method_exists($control, '_call')) {
        $data = $control->_call('on' . $action, '');
    } else {
        exit('Action not found!');
    }
    if (method_exists($control, 'on_afterhandler')) {
        $m = 'on_afterhandler';
        $control->{$m}();
    }
    if (isset($data)) {
        //ob_clean();
        header('Content-Type: application/json; charset=UTF-8');
        $ret = json_encode($data);
    } else {
        header('Content-type: text/html; charset=UTF-8');
    }
} catch (Exception $e) {
    $error_msg = $e->__toString();
    $ret = json_encode(array('status' => 'ERROR', 'error_code' => $e->getCode(), 'error_msg' => $e->getMessage()));
}
$callback = getGPC('callback', 'string');
if (!empty($callback)) {
    $ret = "{$callback}({$ret});";
}
if (!empty($ret)) {
    die($ret);
}
if (!empty($view_datas)) {
    extract($view_datas, EXTR_SKIP);
}
@(include renderTemplate($module, $action));
Ejemplo n.º 14
0
* ____          _____   _____ ______ _____
*|  _ \   /\   |  __ \ / ____|  ____|  __ \
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  /
*| |_) / ____ \| |__| | |__| | |____| | \ \
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Financial Management
* Visit http://badger.berlios.org
*
**/
define('BADGER_ROOT', '../..');
require_once BADGER_ROOT . '/includes/fileHeaderFrontEnd.inc.php';
require_once BADGER_ROOT . '/modules/importExport/exportLogic.php';
require_once BADGER_ROOT . '/modules/account/Account.class.php';
if (isset($_GET['mode'])) {
    $action = getGPC($_GET, 'mode');
} else {
    $action = 'displayProcedure';
}
switch ($action) {
    case 'backupDatabase':
        backupDatabase();
        break;
    case 'update':
        update();
        break;
    case 'displayProcedure':
    default:
        displayProcedure();
        break;
}
Ejemplo n.º 15
0
require_once BADGER_ROOT . '/core/XML/dataGridCommon.php';
require_once BADGER_ROOT . '/includes/jpGraph/src/jpgraph.php';
require_once BADGER_ROOT . '/includes/jpGraph/src/jpgraph_pie.php';
require_once BADGER_ROOT . '/includes/jpGraph/src/jpgraph_pie3d.php';
require_once BADGER_ROOT . '/modules/account/AccountManager.class.php';
require_once BADGER_ROOT . '/modules/statistics2/colors.php';
define('MAX_CATEGORIES', 12);
define('MIN_PERCENTAGE', 0.02);
$graph = new PieGraph(800, 400);
$accountIds = getGPC($_GET, 'accounts', 'integerList');
$accountManager = new AccountManager($badgerDb);
$type = getGPC($_GET, 'type');
if ($type !== 'o') {
    $type = 'i';
}
if (getGPC($_GET, 'summarize') !== 't') {
    $summarize = false;
} else {
    $summarize = true;
}
$amounts = array();
$amounts['none'] = new Amount(0);
$labels = array();
$labels['none'] = getBadgerTranslation2('statistics', 'noCategoryAssigned');
foreach ($accountIds as $currentAccountId) {
    $currentAccount = $accountManager->getAccountById($currentAccountId);
    $filter = getDataGridFilter($currentAccount);
    $currentAccount->setFilter($filter);
    while ($currentTransaction = $currentAccount->getNextTransaction()) {
        if ($type == 'i') {
            if ($currentTransaction->getAmount()->compare(0) < 0) {
Ejemplo n.º 16
0
             $account3 = $am3->getAccountById(getGPC($_POST, 'account2Select' . $selectedTransactionNumber, 'integer'));
             $targetAccounts['x' . $account3->getId()] = $account3;
             $transactionCategory = NULL;
             if (!getGPC($_POST, 'categorySelect' . $selectedTransactionNumber) == NULL) {
                 if (getGPC($_POST, 'categorySelect' . $selectedTransactionNumber) != "NULL") {
                     $transactionCategory = $cm1->getCategoryById(getGPC($_POST, 'categorySelect' . $selectedTransactionNumber, 'integer'));
                 }
             }
             $account3->addFinishedTransaction(getGPC($_POST, 'amount' . $selectedTransactionNumber, 'AmountFormatted'), getGPC($_POST, 'title' . $selectedTransactionNumber), getGPC($_POST, 'description' . $selectedTransactionNumber), getGPC($_POST, 'valutaDate' . $selectedTransactionNumber, 'DateFormatted'), getGPC($_POST, 'transactionPartner' . $selectedTransactionNumber), $transactionCategory, getGPC($_POST, "outside" . $selectedTransactionNumber, 'checkbox'), getGPC($_POST, "exceptional" . $selectedTransactionNumber, 'checkbox'), getGPC($_POST, 'periodical' . $selectedTransactionNumber, 'checkbox'));
         } else {
             //Update existing transaction
             $transaction = $baseAccount->getFinishedTransactionById(getGPC($_POST, 'matchingTransactionSelect' . $selectedTransactionNumber, 'integer'));
             $transaction->setTitle($transaction->getTitle() . ' - ' . getGPC($_POST, 'title' . $selectedTransactionNumber));
             $transaction->setDescription($transaction->getDescription() . "\n" . getGPC($_POST, 'description' . $selectedTransactionNumber) . "\n" . getBadgerTranslation2('importCsv', 'descriptionFieldImportedPartner') . getGPC($_POST, 'transactionPartner' . $selectedTransactionNumber) . "\n" . getBadgerTranslation2('importCsv', 'descriptionFieldOrigValutaDate') . $transaction->getValutaDate()->getFormatted() . "\n" . getBadgerTranslation2('importCsv', 'descriptionFieldOrigAmount') . $transaction->getAmount()->getFormatted());
             $transaction->setValutaDate(getGPC($_POST, 'valutaDate' . $selectedTransactionNumber, 'DateFormatted'));
             $transaction->setAmount(getGPC($_POST, 'amount' . $selectedTransactionNumber, 'AmountFormatted'));
             if (strpos($transaction->getType(), 'Planned') !== false) {
                 $transaction->setPlannedTransaction(null);
             }
         }
     }
 }
 $submitTitle = getBadgerTranslation2('importCsv', 'submitTitle');
 echo "<h1>{$submitTitle}</h1>\n";
 if ($selectedTransactionNumber > 0) {
     // echo success message & number of written transactions
     echo $selectedTransactionNumber . ' ' . getBadgerTranslation2("importCsv", "successfullyWritten") . '<ul>';
     foreach ($targetAccounts as $currentAccount) {
         echo '<li><a href="' . BADGER_ROOT . '/modules/account/AccountOverview.php?accountID=' . $currentAccount->getId() . '">' . htmlentities($currentAccount->getTitle()) . '</a></li>';
     }
     echo '</ul>';
Ejemplo n.º 17
0
function getRedirectPage($accountId)
{
    if (isset($_REQUEST['backToId'])) {
        $accountId = getGPC($_REQUEST, 'backToId', 'integer');
    }
    if (isset($_REQUEST['backTo'])) {
        if (getGPC($_REQUEST, 'backTo') === 'planned') {
            return 'AccountOverviewPlanned.php?accountID=' . $accountId;
        }
    }
    return 'AccountOverview.php?accountID=' . $accountId;
}
Ejemplo n.º 18
0
function printInsert()
{
    global $tpl, $us, $badgerDb;
    $widgets = new WidgetEngine($tpl);
    $widgets->addNavigationHead();
    $insertTitle = getBadgerTranslation2('importExport', 'insertTitle');
    $updateInfo = '';
    echo $tpl->getHeader($insertTitle);
    $goToStartPagePreLink = getBadgerTranslation2('importExport', 'goToStartPagePreLink');
    $goToStartPageLinkText = getBadgerTranslation2('importExport', 'goToStartPageLinkText');
    $goToStartPagePostLink = getBadgerTranslation2('importExport', 'goToStartPagePostLink');
    if (!isset($_POST['confirmUpload']) || getGPC($_POST, 'confirmUpload') !== 'yes') {
        $insertMsg = getBadgerTranslation2('importExport', 'insertNoInsert');
    } else {
        if (!isset($_FILES['sqlDump']) || !is_uploaded_file($_FILES['sqlDump']['tmp_name'])) {
            $insertMsg = getBadgerTranslation2('importExport', 'insertNoFile');
        } else {
            $insertMsg = getBadgerTranslation2('importExport', 'insertSuccessful');
            $newerVersionMsg = getBadgerTranslation2('importExport', 'newerVersion');
            if (applySqlDump() === 'newerVersion') {
                eval(' $updateInfo = "' . $tpl->getTemplate('importExport/newerVersion') . '";');
            }
        }
    }
    $us = new UserSettings($badgerDb);
    $startPageURL = BADGER_ROOT . '/' . $us->getProperty('badgerStartPage');
    eval('echo "' . $tpl->getTemplate('importExport/insert') . '";');
    eval('echo "' . $tpl->getTemplate('badgerFooter') . '";');
}
 /**
  * 验证rest服务必须的参数
  */
 protected function validate()
 {
     $params =& $_REQUEST;
     if (!isset($params['sig'], $params['timestamp'], $params['method'], $params['sig_appkey'])) {
         $this->errorMessage(ELEX_API_CODE_PARAMETER_ERROR, 'request parameters error.');
     }
     $request_time = $_SERVER['REQUEST_TIME'];
     if (empty($request_time)) {
         $request_time = time();
     }
     // 验证时间戳
     $timestamp = getGPC('timestamp', 'int');
     if (abs($timestamp - $request_time) > 30) {
         $this->errorMessage(ELEX_API_CODE_PARAMETER_ERROR, 'timestamp error');
     }
     // 验证签名
     require_once FRAMEWORK . '/rest/Signature.class.php';
     $sign = Signature::sign($params, API_SIG_KEY);
     $sig_request = $params['sig'];
     if ($sign != $sig_request) {
         $this->errorMessage(ELEX_API_CODE_SIGNATURE_ERROR, 'signature error.');
     }
 }
Ejemplo n.º 20
0
<?php

/*
* ____          _____   _____ ______ _____  
*|  _ \   /\   |  __ \ / ____|  ____|  __ \ 
*| |_) | /  \  | |  | | |  __| |__  | |__) |
*|  _ < / /\ \ | |  | | | |_ |  __| |  _  / 
*| |_) / ____ \| |__| | |__| | |____| | \ \ 
*|____/_/    \_\_____/ \_____|______|_|  \_\
* Open Source Finance Management
* Visit http://www.badger-finance.org 
*
**/
//Retrieve md5´ed password from user settings
$readoutpassword = $us->getProperty('badgerPassword');
$passwordcorrect = false;
if (isset($_session['password']) && $readoutpassword == $_session['password']) {
    $passwordcorrect = true;
} elseif (isset($_POST['password']) && md5(getGPC($_POST, 'password')) == $readoutpassword) {
    $passwordcorrect = true;
    //create session variable
    set_session_var('password', md5(getGPC($_POST, 'password')));
}
if ($passwordcorrect != true) {
    die(getBadgerTranslation2('badger_login', 'backend_not_login'));
}
Ejemplo n.º 21
0
        //print(getBadgerTranslation2('badger_login', 'wrong_password')."<br /><br />");
        $Feedback .= getBadgerTranslation2('badger_login', 'wrong_password') . "<br /><br />";
    }
    if (isset($_GET['send_password']) && getGPC($_GET, 'send_password') == "true") {
        //print(getBadgerTranslation2('badger_login', 'ask_really_send')."<br/>");
        $Feedback .= getBadgerTranslation2('badger_login', 'ask_really_send') . "<br/>";
        //print("<a href=\"".$_SERVER['PHP_SELF'].$signature."send_password=truetrue\">".getBadgerTranslation2('badger_login', 'ask_really_send_link')."</a><br/>");
        $Feedback .= "<a href=\"" . $_SERVER['PHP_SELF'] . $signature . "send_password=truetrue\">" . getBadgerTranslation2('badger_login', 'ask_really_send_link') . "</a><br/>";
    }
    if (isset($_GET['send_password']) && getGPC($_GET, 'send_password') == "truetrue") {
        //send an E-Mail with a new password to the email adress read from the user settings object
        $newpassword = rand(0, 16000);
        $newpassword = md5($newpassword);
        $newpassword = substr($newpassword, 0, 12);
        if (mail($us->getProperty('badgerPassword'), getBadgerTranslation2('badger_login', 'password_sent_mail_subject'), getBadgerTranslation2('badger_login', 'password_sent_mail_part_1') . $newpassword . getBadgerTranslation2('badger_login', 'password_sent_mail_part_2'), 'From: forgottenpassword@donotreply.com')) {
            //print(getBadgerTranslation2('badger_login', 'sent_password')."<br /><br />");
            $Feedback .= getBadgerTranslation2('badger_login', 'sent_password') . "<br /><br />";
        } else {
            //print(getBadgerTranslation2('badger_login', 'sent_password_failed')."<br/>");
            $Feedback .= getBadgerTranslation2('badger_login', 'sent_password_failed') . "<br/>";
        }
    }
    if (isset($_GET['logout']) && getGPC($_GET, 'logout', 'boolean') == true) {
        //echo getBadgerTranslation2('badger_login', 'you_are_logout');
        $Feedback .= getBadgerTranslation2('badger_login', 'you_are_logout');
    }
    eval("echo \"" . $tpl->getTemplate("Login/login2") . "\";");
    exit;
} else {
    set_session_var('number_of_login_attempts', 0);
}
Ejemplo n.º 22
0
function getBarcode($barcode)
{
    $data = mysql_fetch_assoc(query("select * from panelie_barcode where value='{$barcode}'"));
    $res['barcode_qty'] = $data['product_qty'];
    $res['measure'] = $data['product_measure'];
    $res['product_name'] = $data['attribute_1'];
    $res['company_name'] = $data['company_name'];
    $brands = array('BrandOwner_ID' => array('table' => 'panelie_brand_owners', 'field' => 'brand_owner'), 'Brand_ID' => array('table' => 'panelie_brands', 'field' => 'brand'), 'SubBrand_ID' => array('table' => 'panelie_brand_subunits', 'field' => 'subbrand'), 'ProductGeneralType_ID' => array('table' => 'panelie_brand_generaltype', 'field' => 'generaltype'));
    foreach ($brands as $k => $v) {
        if (!$data[$k]) {
            continue;
        }
        $tmp = mysql_fetch_assoc(query('select * from ' . $v['table'] . ' where id=' . $data[$k]));
        $res[$v['field'] . '_name'] = $tmp['name'];
        $res[$v['field'] . '_id'] = $data[$k];
    }
    $res = array_merge($res, getGPC($data['GPC_SegmentID'], 'segments', 'segment'));
    $res = array_merge($res, getGPC($data['GPC_Family_ID'], 'families', 'family'));
    $res = array_merge($res, getGPC($data['GPC_Class_ID'], 'classes', 'class'));
    $res = array_merge($res, getGPC($data['GPC_Brick_ID'], 'bricks', 'brick'));
    for ($i = 1; $i <= 7; $i++) {
        $res = array_merge($res, getGpcAttrib($data, $i));
    }
    $res = array_merge($res, getCover($data['CoverCode']));
    return $res;
}
Ejemplo n.º 23
0
function updateRecord()
{
    global $redirectPageAfterSave;
    global $cm;
    if (isset($_POST['expense'])) {
        if (getGPC($_POST, 'expense') === 'expense') {
            $expense = true;
        } else {
            $expense = false;
        }
    } else {
        $expense = null;
    }
    switch (getGPC($_POST, 'hiddenID')) {
        case 'new':
            //add new record
            //check if $_POST['symbol'], $_POST['longName'] is set?????
            $Cat = $cm->addCategory(getGPC($_POST, 'title'), getGPC($_POST, 'description'), getGPC($_POST, 'outsideCapital', 'checkbox'), getGPC($_POST, 'keywords'), $expense);
            if (isset($_POST['parent']) && getGPC($_POST, 'parent') != "") {
                $Cat->setParent($cm->getCategoryById(getGPC($_POST, 'parent', 'integer')));
            }
            break;
        default:
            //update record
            $Cat = $cm->getCategoryById(getGPC($_POST, 'hiddenID', 'integer'));
            $Cat->setTitle(getGPC($_POST, 'title'));
            $Cat->setDescription(getGPC($_POST, 'description'));
            $Cat->setOutsideCapital(getGPC($_POST, 'outsideCapital', 'checkbox'));
            $Cat->setKeywords(getGPC($_POST, 'keywords'));
            $Cat->setExpense($expense);
            if (isset($_POST['parent']) && getGPC($_POST, 'parent') != "") {
                $Cat->setParent($cm->getCategoryById(getGPC($_POST, 'parent', 'integer')));
            }
            //elseif(isset($_POST['parent']) && getGPC($_POST, 'parent') == ""){
            //$Cat->setParent(null);
            //};
    }
    //REDIRECT
    header("Location: {$redirectPageAfterSave}");
}
Ejemplo n.º 24
0
function updateRecord()
{
    global $redirectPageAfterSave;
    global $am;
    //Account Manager
    global $curMan;
    //Currency Manager
    global $us;
    if (isset($_POST['hiddenID'])) {
        switch (getGPC($_POST, 'hiddenID')) {
            case 'new':
                //add new record
                $ID = $am->addAccount(getGPC($_POST, 'title'), $curMan->getCurrencyById(getGPC($_POST, 'currency', 'integer')), getGPC($_POST, 'description'), getGPC($_POST, 'lowerLimit', 'AmountFormatted'), getGPC($_POST, 'upperLimit', 'AmountFormatted'), getGPC($_POST, 'csvParser'), !getGPC($_POST, 'deleteOldPlannedTransactions', 'checkbox'));
                $naviId = addToNavi($us->getProperty('accountNaviParent'), $us->getProperty('accountNaviNextPosition'), 'item', 'Account' . $ID->getId(), 'account.gif', '{BADGER_ROOT}/modules/account/AccountOverview.php?accountID=' . $ID->getId());
                $us->setProperty('accountNaviId_' . $ID->getId(), $naviId);
                $us->setProperty('accountNaviNextPosition', $us->getProperty('accountNaviNextPosition') + 1);
                addTranslation('Navigation', 'Account' . $ID->getId(), getGPC($_POST, 'title'), getGPC($_POST, 'title'));
                $account = $ID;
                break;
            default:
                //update record
                $account = $am->getAccountById(getGPC($_POST, 'hiddenID', 'integer'));
                $account->setTitle(getGPC($_POST, 'title'));
                $account->setDescription(getGPC($_POST, 'description'));
                $account->setCurrency($curMan->getCurrencyById(getGPC($_POST, 'currency', 'integer')));
                $account->setLowerLimit(getGPC($_POST, 'lowerLimit', 'AmountFormatted'));
                $account->setUpperLimit(getGPC($_POST, 'upperLimit', 'AmountFormatted'));
                $account->setDeleteOldPlannedTransactions(!getGPC($_POST, 'deleteOldPlannedTransactions', 'checkbox'));
                $account->setCsvParser(getGPC($_POST, 'csvParser'));
                modifyTranslation('Navigation', 'Account' . $account->getId(), getGPC($_POST, 'title'), getGPC($_POST, 'title'));
        }
        $account->expandPlannedTransactions(new Date('1000-01-01'));
        //REDIRECT
        header("Location: {$redirectPageAfterSave}");
    }
}
Ejemplo n.º 25
0
/**
 * 从get post cookie中取出指定键的数据,并转换成整型
 * $method可以|分隔,将从左至右顺序返回存在数据
 * @param string $key
 * @param bool $unsigned 是否
 * @param string $method
 */
function getGPCInt($key, $unsigned = false, $method = 'get|post')
{
    $data = intval(getGPC($key, $method));
    return $unsigned ? abs($data) : $data;
}