Пример #1
0
     $gridfile = 'sr.php?gr=' . $gval['gridid'] . '&f=' . $_GET['gridsearch'] . '&x=' . time();
     $gval['hoverimage'] = $gval['animated'] = false;
 }
 ob_start();
 if ($gval['hoverimage'] || $gval['animated']) {
     print '<div id="ihover" style="position:relative;width:' . $gwidth . ';height:' . $gheight . '">';
 }
 print '<table width=' . $gwidth . ' height=' . $gheight . ' style="background:url(' . $designpath . 'loading.gif) no-repeat;background-position:center 10;">';
 print '<tr><td><map name="grid_' . $gval['gridid'] . '">';
 // Jobs: Zufallspixel anzeigen ---------------
 if (is_array($SHOW_JOB[$gval['gridid']])) {
     print '<div id="jobs" style="position:relative;width:' . $gwidth . ';height:' . $gheight . '">';
 }
 // -------------------------------------------
 if ($_GET['gridsearch']) {
     makemap(false, false, $gval['gridid'], true, DB_array("SELECT userid FROM " . $dbprefix . "user WHERE (url LIKE '%" . mysql_real_escape_string(stripslashes($_GET['gridsearch'])) . "%' OR title LIKE '%" . mysql_real_escape_string(stripslashes($_GET['gridsearch'])) . "%') AND submit IS NOT NULL AND gridid='" . $gval['gridid'] . "'", '+'), true);
 } else {
     @(include 'grids/area_' . $gval['gridid'] . '.htm');
 }
 print '</map>';
 if ($_GET['zoom']) {
     print '<div id="zoom" onmouseover="zoom_on(event,' . $gwidth . ',' . $gheight . ',\'' . $gridfile . '?x=' . @filemtime($gridfile) . '\');" onmousemove="zoom_move(event);" onmouseout="zoom_off();">';
     print '<img src="' . $gridfile . '?x=' . @filemtime($gridfile) . '" style="position:relative;z-index:0;padding:0;margin:0;border:0" width=' . $gwidth . ' height=' . $gheight . ' usemap="#grid_' . $gval['gridid'] . '" /></div>';
 } else {
     print '<img src="' . $gridfile . '?x=' . @filemtime($gridfile) . '" width=' . $gwidth . ' height=' . $gheight . ' usemap="#grid_' . $gval['gridid'] . '" ' . ($gval['buy_on_click'] && !$gval['dontbuy'] ? ' onClick="if(!tooo) location.href=\'getp.php?gr=' . $gval['gridid'] . $trackpage_ . '\'" style="cursor:hand"' : '') . '>';
 }
 // Jobs: Zufallspixel anzeigen ---------------
 if (is_array($SHOW_JOB[$gval['gridid']])) {
     print $SHOW_JOB[$gval['gridid']]['url'] . '<img src="' . $designpath . 'marked_pixel.gif" style="width:' . $gval['blocksize_x'] . ';height:' . $gval['blocksize_y'] . ';position:absolute;left:' . (fsubstr($SHOW_JOB[$gval['gridid']]['field'] - 1, -2) * $gval['blocksize_x'] + $x_plus) . 'px;top:' . ((int) (($SHOW_JOB[$gval['gridid']]['field'] - 1) / 100) * $gval['blocksize_y'] + $y_plus) . 'px;z-index:0"></a></div>';
 }
 // -------------------------------------------
Пример #2
0
function write_sets($_POST)
{
    global $catids, $CUBIT_MODULES;
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($smonth, "num", 1, 2, "Invalid Financial year starting month.");
    /*$v->isOk ($monthend,"num",1 ,2, "Invalid month end date");
    	$v->isOk ($int1,"float",1 ,5, "Invalid interest 1.");
    	$v->isOk ($int2,"float",1 ,5, "Invalid interest 2.");
    	$v->isOk ($int3,"float",1 ,5, "Invalid interest 3.");
    	$v->isOk ($brack1,"float",1 ,10, "Invalid bracket 1.");
    	$v->isOk ($brack2,"float",1 ,10, "Invalid bracket 2.");*/
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return $confirmCust;
    }
    pglib_transaction("BEGIN");
    makemap($smonth);
    core_connect();
    $sql = "SELECT accname FROM accounts WHERE accnum != '999' AND div = '" . USER_DIV . "'";
    $Rslt = db_exec($sql) or errDie("Unable to check database for existing accounts.");
    if (pg_numrows($Rslt) > 0) {
        $acc = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><li class='err'>ERROR : There are already accounts in Cubit</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Note : </th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Quick Setup can only be run on a new cubit installation.</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t</table>\n\t\t\t\t\t<p>\n\t\t\t\t\t<table " . TMPL_tblDflts . " width='15%'>\n\t\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t</table>";
        return $acc;
    }
    $sql = "\n\t\tINSERT INTO cubit.compinfo (\n\t\t\tcompname, slogan, logoimg, addr1, addr2, addr3, \n\t\t\taddr4, paddr1, paddr2, paddr3, tel, fax, \n\t\t\tvatnum, regnum, imgtype, img, div, paye, \n\t\t\tterms, postcode, img2, imgtype2, logoimg2, diplomatic_indemnity\n\t\t) VALUES (\n\t\t\t'{$_SESSION['comp']}', '', '', '', '', '', \n\t\t\t'', '', '', '', '', '',\n\t\t\t'', '', '', '', '" . USER_DIV . "', '', \n\t\t\t'', '', '', '', '', 'N'\n\t\t);";
    db_exec($sql) or errDie("Unable to update company information.");
    db_conn('cubit');
    $sql = "SELECT label FROM set WHERE label = 'ACCNEW_LNK' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to check database for existing account creation settings.");
    if (pg_num_rows($rslt) > 0) {
        $sql = "\n\t\t\tUPDATE set \n\t\t\tSET value = 'acc-new2.php', type = 'Account Creation' \n\t\t\tWHERE label = 'ACCNEW_LNK'";
    } else {
        $sql = "\n\t\t\tINSERT INTO set (\n\t\t\t\ttype, label, value, \n\t\t\t\tdescript, div\n\t\t\t) VALUES (\n\t\t\t\t'Account Creation', 'ACCNEW_LNK', 'acc-new2.php', \n\t\t\t\t'Use user selected account numbers', '" . USER_DIV . "'\n\t\t\t)";
    }
    db_exec($sql) or errDie("Unable to insert account creation settings to Cubit.");
    /* account categories */
    $catids = array("I" => 0, "E" => 0, "B" => 0);
    $sql = "\n\t\tINSERT INTO core.income (\n\t\t\tcatid, catname, div\n\t\t) VALUES (\n\t\t\t'I' || nextval('core.income_seq'), 'Income', '" . USER_DIV . "'\n\t\t)";
    $catRslt = db_exec($sql) or errDie("Unable to add income Category to Database.");
    $catids["I"] = "I" . pglib_getlastid("core.income_seq");
    $sql = "\n\t\tINSERT INTO core.expenditure (\n\t\t\tcatid, catname, div\n\t\t) VALUES (\n\t\t\t'E' || nextval('core.expenditure_seq'),'Expenditure', '" . USER_DIV . "'\n\t\t)";
    $catRslt = db_exec($sql) or errDie("Unable to add expense Category to Database.");
    $catids["E"] = "E" . pglib_getlastid("core.expenditure_seq");
    $sql = "\n\t\tINSERT INTO core.balance (\n\t\t\tcatid, catname, div\n\t\t) VALUES (\n\t\t\t'B' || nextval('core.balance_seq'),'Balance', '" . USER_DIV . "'\n\t\t)";
    $catRslt = db_exec($sql) or errDie("Unable to add balance Category to Database.");
    $catids["B"] = "B" . pglib_getlastid("core.balance_seq");
    /* START SETUP */
    $catid = $catids["I"];
    $sales_account = newacc("1000", "000", "Sales", "I", "f", "sales");
    $pos_sales_account = newacc("1100", "000", "Point of Sale - Sales", "I", "f", "sales");
    newacc("1150", "000", "Interest Received", "I", "f");
    newacc("1200", "000", "Sundry Income", "I", "f");
    newacc("1250", "000", "Exchange Rate Profit/Loss", "I", "f", "other_income");
    newacc("1300", "000", "Sale of Assets", "I", "f", "sales");
    linkacc("1300", "000", "salesacc", "saleofassets");
    linkacc("1150", "000", "salacc", "interestreceived");
    newacc("1660", "000", "Creditors Settlement Discount", "I", "f");
    newacc("1995", "000", "Previous Year Adjustment Income 1", "I", "f");
    newacc("1996", "000", "Previous Year Adjustment Income 2", "I", "f");
    newacc("1997", "000", "Previous Year Adjustment Income 3", "I", "f");
    newacc("1998", "000", "Previous Year Adjustment Income 4", "I", "f");
    newacc("1999", "000", "Previous Year Adjustment Income 5", "I", "f");
    $catid = $catids["E"];
    $cost_account = newacc("2150", "000", "Cost of Sales", "E", "f", "cost_of_sales");
    $pension_account = newacc("2510", "000", "Pension", "E", "f");
    newacc("2520", "000", "Retirement Annuity Fund", "E", "f");
    linkacc("2520", "000", "salacc", "retireexpense");
    newacc("2530", "000", "Provident Fund", "E", "f");
    linkacc("2530", "000", "salacc", "providentexpense");
    newacc("2540", "000", "Medical Aid", "E", "f");
    linkacc("2540", "000", "salacc", "medicalexpense");
    newacc("2160", "000", "Cost Variance", "E", "f", "cost_of_sales");
    linkacc("2160", "000", "pchsacc", "Cost Variance");
    newacc("2170", "000", "Variance", "E", "f", "cost_of_sales");
    linkacc("2170", "000", "salesacc", "sales_variance");
    newacc("2500", "000", "Salaries and Wages", "E", "f");
    linkacc("2500", "000", "salacc", "salaries");
    newacc("2550", "000", "Salaries - Commission", "E", "f");
    linkacc("2550", "000", "salacc", "Commission");
    newacc("2555", "000", "Salaries - Bonus", "E", "f");
    linkacc("2555", "000", "salacc", "Bonus");
    newacc("2560", "000", "UIF", "E", "f");
    linkacc("2560", "000", "salacc", "uifexp");
    newacc("2570", "000", "SDL", "E", "f");
    linkacc("2570", "000", "salacc", "sdlexp");
    newacc("2000", "000", "Accounting Fees", "E", "f");
    newacc("2050", "000", "Advertising and Promotions", "E", "f");
    newacc("2100", "000", "Bank Charges", "E", "f");
    newacc("2200", "000", "Depreciation", "E", "f");
    newacc("2250", "000", "Electricity and Water", "E", "f");
    newacc("2300", "000", "General Expenses", "E", "f");
    newacc("2350", "000", "Insurance", "E", "f");
    newacc("2400", "000", "Interest Paid", "E", "f");
    newacc("2450", "000", "Printing and Stationery", "E", "f");
    newacc("2650", "000", "Rent Paid", "E", "f");
    newacc("2600", "000", "Telephone and Fax", "E", "f");
    newacc("2700", "000", "POS Rounding", "E", "f", "cost_of_sales");
    linkacc("2700", "000", "salesacc", "rounding");
    newacc("2800", "000", "Normal Tax", "E", "f", "tax");
    linkacc("2510", "000", "salacc", "pensionexpense");
    newacc("2660", "000", "Creditors Settlement Discount", "E", "f");
    newacc("3660", "000", "Debtors Settlement Discount", "E", "f");
    newacc("4995", "000", "Previous Year Adjustment Expense 1", "E", "f");
    newacc("4996", "000", "Previous Year Adjustment Expense 2", "E", "f");
    newacc("4997", "000", "Previous Year Adjustment Expense 3", "E", "f");
    newacc("4998", "000", "Previous Year Adjustment Expense 4", "E", "f");
    newacc("4999", "000", "Previous Year Adjustment Expense 5", "E", "f");
    $catid = $catids["B"];
    newacc("5200", "000", "Retained Income / Accumulated Loss", "B", "f", "retained_income");
    newacc("5250", "000", "Share Capital / Members Contribution", "B", "f", "share_capital");
    newacc("5300", "000", "Shareholder / Director / Members Loan Account", "B", "f", "shareholders_loan");
    newacc("6000", "000", "Land & Buildings - Net Value", "B", "f", "fixed_asset");
    newacc("6000", "010", "Land & Buildings - Cost", "B", "f", "fixed_asset");
    newacc("6000", "020", "Land & Buildings - Accum Depreciation", "B", "f", "fixed_asset");
    newacc("6100", "020", "Motor Vehicle - Accum Depreciation", "B", "f", "fixed_asset");
    newacc("6100", "000", "Motor Vehicle - Net Value", "B", "f", "fixed_asset");
    newacc("6100", "010", "Motor Vehicle - Cost", "B", "f", "fixed_asset");
    newacc("6150", "000", "Computer Equipment - Net Value", "B", "f", "fixed_asset");
    newacc("6150", "010", "Computer Equipment - Cost", "B", "f", "fixed_asset");
    newacc("6150", "020", "Computer Equipment - Accum Depreciation", "B", "f", "fixed_asset");
    newacc("6160", "000", "Office Equipment - Net Value", "B", "f", "fixed_asset");
    newacc("6160", "010", "Office Equipment - Cost", "B", "f", "fixed_asset");
    newacc("6160", "020", "Office Equipment - Accum Depreciation", "B", "f", "fixed_asset");
    newacc("6170", "000", "Furniture & Fittings - Net Value", "B", "f", "fixed_asset");
    newacc("6170", "010", "Furniture & Fittings - Cost", "B", "f", "fixed_asset");
    newacc("6170", "020", "Furniture & Fittings - Accum Depreciation", "B", "f", "fixed_asset");
    $stock_control = newacc("6300", "000", "Inventory Suspense Account", "B", "f", "current_asset");
    $stock_account = newacc("6350", "000", "Inventory", "B", "f", "current_asset");
    $deptors_account = newacc("6400", "000", "Customer Control Account", "B", "f", "current_asset");
    $creditors_account = newacc("6500", "000", "Supplier Control Account", "B", "f", "current_liability");
    newacc("6600", "000", "Employees Control Account", "B", "f", "current_liability");
    newacc("2151", "000", "Stock Take Suspense Account", "E", "f", "cost_of_sales");
    linkacc("6600", "000", "salacc", "salaries control");
    linkacc("6600", "000", "salacc", "salaries control original");
    newacc("6700", "000", "Employee Loan Account", "B", "f", "current_asset");
    linkacc("6700", "000", "salacc", "loanacc");
    $bank_account = newacc("7000", "000", "Bank", "B", "f", "current_asset");
    newacc("7100", "000", "Petty Cash", "B", "f", "current_asset");
    linkacc("7100", "000", "bankacc", "Petty Cash");
    $pos_cash_account = newacc("7200", "000", "Cash on Hand", "B", "f", "current_asset");
    linkacc("7200", "000", "salacc", "cash");
    newacc("7300", "000", "POS Credit Card Control", "B", "f", "current_asset");
    linkacc("7300", "000", "salacc", "cc");
    newacc("8000", "000", "VAT Control Account", "B", "f", "current_liability");
    linkacc("8000", "000", "salesacc", "VAT");
    newacc("8010", "000", "VAT Input Account", "B", "f", "current_liability");
    linkacc("8010", "000", "salesacc", "VATIN");
    newacc("8020", "000", "VAT Output Account", "B", "f", "current_liability");
    linkacc("8020", "000", "salesacc", "VATOUT");
    newacc("8100", "000", "PAYE Payable", "B", "f", "current_liability");
    linkacc("8100", "000", "salacc", "PAYE");
    newacc("8200", "000", "UIF Payable", "B", "f", "current_liability");
    linkacc("8200", "000", "salacc", "UIF");
    linkacc("8200", "000", "salacc", "uifbal");
    newacc("8300", "000", "SDL Payable", "B", "f", "current_liability");
    linkacc("8300", "000", "salacc", "sdlbal");
    newacc("8400", "000", "Pension Payable", "B", "f", "current_liability");
    linkacc("8400", "000", "salacc", "pension");
    newacc("8500", "000", "Medical Aid Payable", "B", "f", "current_liability");
    linkacc("8500", "000", "salacc", "medical");
    newacc("8600", "000", "Retirement Annuity Fund Payable", "B", "f", "current_liability");
    linkacc("8600", "000", "salacc", "retire");
    newacc("8700", "000", "Provident Fund Payable", "B", "f", "current_liability");
    linkacc("8700", "000", "salacc", "provident");
    newacc("9000", "000", "Opening Balances / Suspense Account", "B", "f", "current_liability");
    newacc("9995", "000", "Previous Year Adjustment Balance 1", "B", "f", "fixed_asset");
    newacc("9996", "000", "Previous Year Adjustment Balance 2", "B", "f", "fixed_asset");
    newacc("9997", "000", "Previous Year Adjustment Balance 3", "B", "f", "fixed_asset");
    newacc("9998", "000", "Previous Year Adjustment Balance 4", "B", "f", "fixed_asset");
    newacc("9999", "000", "Previous Year Adjustment Balance 5", "B", "f", "fixed_asset");
    # Check if year has been opened
    $sql = "DELETE FROM core.year";
    $rslt = db_exec($sql);
    for ($i = 1; $i <= 10; $i++) {
        $sql = "INSERT INTO core.year VALUES('y" . ($selyear + $i - 1) . "', 'yr{$i}', 'n', '" . USER_DIV . "')";
        $rslt = db_exec($sql) or errDie("Could not set year name in Cubit", SELF);
    }
    $yrname = "y{$selyear}";
    $endmon = $smonth - 1;
    if (intval($endmon) == 0) {
        $endmon = 12;
    }
    $Sql = "TRUNCATE core.range";
    $Rs = db_exec($Sql) or errDie("Unable to empty year range", SELF);
    $firstmonth = $smonth;
    $activeyear = $yrname;
    $sql = "\n\t\tINSERT INTO core.range (\n\t\t\t\"start\", \"end\", div\n\t\t) VALUES (\n\t\t\t'{$smonth}', '{$endmon}', '" . USER_DIV . "'\n\t\t)";
    $Rslt = db_exec($sql) or errDie("Unable to insert year range", SELF);
    $sql = "SELECT * FROM core.year WHERE yrname='{$yrname}'";
    $yrs = db_exec($sql);
    $yr = pg_fetch_array($yrs);
    if ($yr['closed'] == 'y') {
        return "<center><li class='err'>ERROR : The Selected Financial year : <b>{$yrname}</b> has been closed.\n\t\t<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct submission'>";
    }
    $yrdb = $yr['yrdb'];
    $sql = "SELECT * FROM core.range";
    $Rslt = db_exec($sql);
    if (pg_numrows($Rslt) < 1) {
        $OUTPUT = "<center><li class='err'>ERROR : The Financial year Period range was not found on Database, Please make sure that everything is set during instalation.</li>";
        require "template.php";
    }
    $range = Pg_fetch_array($Rslt);
    // Months array
    $months = array("dummy", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    $sql = "INSERT INTO core.active (yrdb, yrname, prddb, prdname, div) VALUES ('{$yrdb}', '{$yrname}', '{$range['start']}', '" . $months[$range['start']] . "', '" . USER_DIV . "')";
    $rslt = db_exec($sql) or errDie("Could not Set Next Year Database and Name", SELF);
    db_conn("exten");
    $sql = "INSERT INTO departments (deptno, deptname, incacc, debtacc, credacc, pia, pca, div) VALUES ('1', 'Ledger 1', '{$sales_account}', '{$deptors_account}', '{$creditors_account}', '{$pos_sales_account}', '{$pos_cash_account}', '" . USER_DIV . "')";
    $deptRslt = db_exec($sql) or errDie("Unable to add deparment to system.", SELF);
    $sql = "INSERT INTO salespeople (salespno, salesp, div) VALUES ('1', 'General', '" . USER_DIV . "')";
    $salespRslt = db_exec($sql) or errDie("Unable to add warehouse to system.", SELF);
    $sql = "INSERT INTO  categories (category, div) VALUES ('General', '" . USER_DIV . "')";
    $catRslt = db_exec($sql) or errDie("Unable to add category to system.", SELF);
    $sql = "INSERT INTO  class (classname, div) VALUES ('General', '" . USER_DIV . "')";
    $catRslt = db_exec($sql) or errDie("Unable to add fringe benefit to system.", SELF);
    $sql = "INSERT INTO warehouses (whno, whname, stkacc, cosacc, conacc, div) VALUES ('1', 'Store 1', '{$stock_account}', '{$cost_account}', '{$stock_control}', '" . USER_DIV . "')";
    $whouseRslt = db_exec($sql) or errDie("Unable to add warehouse to system.", SELF);
    $whid = pglib_lastid("warehouses", "whid");
    $sql = "INSERT INTO  pricelist (listname, div) VALUES ('Standard', '" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to price list to system.", SELF);
    $sql = "INSERT INTO cubit.stockcat (catcod, cat, descript, div) VALUES('1', 'General', 'General Stock Category', '" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert stock category to Cubit.", SELF);
    $sql = "INSERT INTO cubit.stockclass (classcode, classname, div) VALUES ('1', 'General', '" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to add class to system.", SELF);
    $sql = "SELECT label FROM cubit.set WHERE label = 'DEF_WH' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_num_rows($rslt) > 0) {
        $sql = "UPDATE cubit.set SET value = '{$whid}', type = 'Default Warehouse' WHERE label = 'DEF_WH' AND div = '" . USER_DIV . "'";
    } else {
        $sql = "INSERT INTO cubit.set (type, label, value, descript, div) VALUES('Default Warehouse', 'DEF_WH', '{$whid}', '1 &nbsp;&nbsp;&nbsp; Store1', '" . USER_DIV . "')";
    }
    db_exec($sql) or errDie("Unable to insert settings to Cubit.");
    $sql = "SELECT label FROM cubit.set WHERE label = 'SELAMT_VAT' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to check database for existing settings.");
    if (pg_num_rows($rslt) > 0) {
        $sql = "UPDATE cubit.set SET value = 'inc', descript = 'Vat Inclusive' WHERE label = 'SELAMT_VAT' AND div = '" . USER_DIV . "'";
    } else {
        $sql = "INSERT INTO cubit.set (type, label, value, descript, div) VALUES('Vat type on stock selling price', 'SELAMT_VAT', 'inc', 'Vat Inclusive', '" . USER_DIV . "')";
    }
    db_exec($sql) or errDie("Unable to insert settings to Cubit.");
    $sql = "INSERT INTO cubit.currency (symbol,curcode,descrip,rate,def) VALUES ('R','ZAR', 'Rand',0.00,'')";
    db_exec($sql) or errDie("Unable to insert currency.");
    $sql = "\n\t\tINSERT INTO cubit.bankacct (\n\t\t\tacctype, bankname, branchname, branchcode, accname, \n\t\t\taccnum, details, div, btype, \n\t\t\tfcid, currency\n\t\t) VALUES (\n\t\t\t'Cheque', 'Bank', 'Branch', '000000', 'Account Name', \n\t\t\t'000000000000', 'Default bank Account', '" . USER_DIV . "', 'loc', \n\t\t\t(SELECT fcid FROM cubit.currency WHERE curcode='ZAR' LIMIT 1), 'Rand'\n\t\t)";
    db_exec($sql) or errDie("Unable to add bank account to database.");
    $accid = pglib_lastid("cubit.bankacct", "bankid");
    $sql = "INSERT INTO cubit.set (type, label, value, descript, div)\n\t\t\tVALUES('Banking Details Account', 'BANK_DET', '3', 'Bank Account: Account Name - Bank', '" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to set default bank account.");
    $hook = "INSERT INTO core.bankacc (accid, accnum, div) VALUES('{$accid}', '{$bank_account}', '" . USER_DIV . "')";
    $Rlst = db_exec($hook) or errDie("Unable to add link for for new bank account", SELF);
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Add Client','../customers-new.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Client','../customers-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('New Invoice','../cust-credit-stockinv.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Find Invoice','../invoice-search.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Stock','../stock-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Add Supplier','../supp-new.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Suppliers','../supp-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('New Purchase','../purchase-new.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Purchases','../purchase-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Add Quote','../quote-new.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Invoices','../invoice-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('View Quotes','../quote-view.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Debtors Age Analysis','../reporting/debt-age-analysis.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Creditors Age Analysis','../reporting/cred-age-analysis.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.links (name,script) VALUES ('Bank Reconciliation','../reporting/bank-recon.php')";
    db_exec($sql) or errDie("Unable to insert link.");
    $sql = "INSERT INTO crm.teams (name,div) VALUES ('Sales','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.teams (name,div) VALUES ('Support','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.teams (name,div) VALUES ('Accounts','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.teams (name,div) VALUES ('Company Relations','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.teams (name,div) VALUES ('Purchasing - Supplier Relations','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Product Enquiries','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Place an Order','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Complain','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Account querries','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Delivery or Installation Tracking','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Comment on good service or Remarks','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Ask about employment','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('General','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Potential Supplier','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.tcats (name,div) VALUES ('Product Support','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into teams");
    $sql = "INSERT INTO crm.actions (action) VALUES ('Called - Need to call again.')";
    db_exec($sql) or errDie("Unable to insert action.");
    $sql = "INSERT INTO crm.actions (action) VALUES ('Called - Could not get in touch')";
    db_exec($sql) or errDie("Unable to insert action.");
    $sql = "INSERT INTO crm.actions (action) VALUES ('Requested more information')";
    db_exec($sql) or errDie("Unable to insert action.");
    $sql = "INSERT INTO crm.actions (action) VALUES ('Sent Fax')";
    db_exec($sql) or errDie("Unable to insert action.");
    $pactivemonth = $activemonth;
    $pactivemonth--;
    if ($pactivemonth == 0) {
        $pactivemonth = 12;
    }
    $i = 0;
    $current = $firstmonth;
    $current--;
    if ($current == 0) {
        $current = 12;
    }
    /* disabled, it wurks differently now */
    while ($current != $pactivemonth && 0) {
        $i++;
        if ($i > 20) {
            break;
        }
        $current++;
        if ($current == 13) {
            $current = 1;
        }
        close_month('yr1', $current);
    }
    for ($i = 1; $i <= 12; ++$i) {
        close_month('yr1', $i);
    }
    $sql = "SELECT accid FROM core.accounts WHERE accname='Bank Charges'";
    $rslt = db_exec($sql);
    $ad = pg_fetch_array($rslt);
    $bc = $ad['accid'];
    $sql = "SELECT accid FROM core.accounts WHERE accname='Interest Paid'";
    $rslt = db_exec($sql);
    $ad = pg_fetch_array($rslt);
    $i = $ad['accid'];
    $sql = "SELECT accid FROM core.accounts WHERE accname='Interest Received'";
    $rslt = db_exec($sql);
    $ad = pg_fetch_array($rslt);
    $ii = $ad['accid'];
    $sql = "INSERT INTO exten.spricelist (listname,div) VALUES ('Standard','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert into supplier price list.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('CASH DEPOSIT FEE','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('FEE CHEQUE CASHED','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('FEE-SPECIAL PRESENTATION','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('SERVICE FEE','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('OVERDRAFT LEDGER FEE','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('INTEREST','i','-','c','{$i}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('INTEREST','i','+','c','{$ii}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('TRANSACTION CHARGE ','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('ADMIN CHARGE','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('GARAGE CRD CHARGES','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('STAMP DUTY','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('BANKING CHARGES','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.statement_refs (ref,dets,pn,action,account,by) VALUES ('01 CASH DEP','i','-','c','{$bc}','Default');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "CREATE INDEX stkid_stock_key ON cubit.stock USING btree(stkid);";
    db_exec($sql) or errDie("Unable to index.");
    $sql = "CREATE INDEX accid_accounts_key ON core.accounts USING btree(accid);";
    db_exec($sql) or errDie("Unable to index.");
    $sql = "CREATE INDEX accid_trial_bal_key ON core.trial_bal USING btree(accid);";
    db_exec($sql) or errDie("Unable to index.");
    $sql = "INSERT INTO cubit.vatcodes (code,description,del,zero,vat_amount) VALUES ('01','Normal','Yes','No','14');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.vatcodes (code,description,del,zero,vat_amount) VALUES ('02','Capital Goods','No','No','14');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.vatcodes (code,description,del,zero,vat_amount) VALUES ('03','Capital Goods','No','Yes','0');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.vatcodes (code,description,del,zero,vat_amount) VALUES ('04','Zero VAT','No','Yes','0');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.vatcodes (code,description,del,zero,vat_amount) VALUES ('05','VAT Exempt','No','Yes','0');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Disciplinary Verbal Warning','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Disciplinary Written Warning','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Dismissal','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Corrective Counselling','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Performance Counselling','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Grievance','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Disputes Mediation','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Disputes Conciliation','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.report_types (type,div) VALUES ('Disputes Arbitration','" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.login_retries (tries, minutes) VALUES ('0', '0');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.supp_groups (id, groupname) VALUES ('0', '[None]');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.template_settings (template, filename, div) VALUES ('statements', 'pdf/pdf-statement.php', '" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.template_settings (template, filename, div) VALUES ('invoices', 'invoice-print.php', '" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.template_settings (template, filename, div) VALUES ('reprints', 'new', '" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.workshop_settings (setting, value, div) VALUES ('workshop_conditions', 'As per display notice.', '" . USER_DIV . "');";
    db_exec($sql) or errDie("Unable to insert data.");
    $sql = "INSERT INTO cubit.set(type, label, value, descript, div) VALUES('Block main accounts', 'BLOCK', 'use', 'Block main accounts', '" . USER_DIV . "')";
    db_exec($sql) or errDie("Error setting up default setting.");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('0','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('7','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('14','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('30','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('60','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('90','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.ct (days,div) VALUES ('120','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('0','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('7','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('14','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('30','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('60','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('90','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    $sql = "INSERT INTO exten.od (days,div) VALUES ('120','" . USER_DIV . "')";
    db_exec($sql) or errDie("Unable to insert default terms");
    if (is_readable("setup-ratios.php")) {
        include "setup-ratios.php";
    }
    if (!isset($inst_mode) or strlen($inst_mode) < 1) {
        $inst_mode = "hq";
    }
    #record the install type ...
    $sql = "\n\t\tINSERT INTO cubit.settings (\n\t\t\tconstant, label, value, type, datatype, \n\t\t\tminlen, maxlen, div, readonly\n\t\t) VALUES (\n\t\t\t'INST_MODE', 'Cubit Install Mode', '{$inst_mode}', 'company', 'allstring', \n\t\t\t'1', '250', '0', 'f'\n\t\t);";
    db_exec($sql) or errDie("Unable to insert install mode.");
    /* run the addon setups */
    foreach ($CUBIT_MODULES as $modulename) {
        if (is_readable("{$modulename}/setup-addon.php")) {
            include "{$modulename}/setup-addon.php";
        }
    }
    db_conn('core');
    block();
    pglib_transaction("COMMIT");
    $sets = "\n\t\t\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Setup Complete</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td>Cubit is ready to be used.</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<p>\n\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
    return $sets;
}
Пример #3
0
     if ((int) $jobs['job_fieldhighlight'] == 0) {
         $jobs['job_fieldhighlight'] = '';
     }
     if ((int) $jobs['job_every_seconds'] == 0) {
         $jobs['job_every_seconds'] = '';
     }
     if ((int) $jobs['job_show'] == 0) {
         $jobs['job_show'] = '';
     }
 }
 if ((int) $_GET['refresh']) {
     grid_text_templates((int) $_GET['refresh']);
     if ($tmppageid = DB_query("SELECT page_id FROM " . $dbprefix . "grids WHERE gridid='" . (int) $_GET['refresh'] . "'", 'page_id')) {
         page_text_template($tmppageid);
     }
     if (makemap(false, '../', (int) $_GET['refresh'])) {
         $Nachricht .= ShowNachricht($newpoint1 . sprintf($_SP[89], $_GET['refresh']), false);
     } else {
         $Nachricht .= ShowNachricht($newpoint . sprintf($_SP[234], $_GET['refresh']));
     }
 }
 if (!empty($_GET['tpreview']) && !eregi("[^-a-z._ 0-9]", html_entity_decode(stripslashes($_GET['tpreview'])))) {
     $imagepreview = '../incs/grid_templates/' . html_entity_decode(stripslashes($_GET['tpreview']));
 } elseif (isset($_GET['tpreview']) && (int) $_GET['type']) {
     $imagepreview = '../incs/grid_banner/' . (int) $_GET['type'] . '.png';
 } elseif (isset($_GET['type'])) {
     $imagepreview = '../incs/grid_templates/_standard.png';
 }
 if ($_GET['gpreview']) {
     $imagepreview = '../grids/grid_' . html_entity_decode(stripslashes($_GET['gpreview']));
 }
Пример #4
0
function makemap(&$map, &$seen, $device = 0, $x = 500, $y = 500, $parent = 0)
{
    global $DB, $nodelist, $devicelinks, $mini;
    if ($mini) {
        $in = array(0, 3, -3, 6, -6, 9, -9, 12, -12, 15, -15, 18, -18, 21, -21);
    } else {
        $in = array(0, 5, -5, 10, -10, 20, -20, 25, -25, 30, -30, 35, -35, 40, -40);
    }
    // net size: count($in)^2 - 1
    foreach ($in as $ii => $i) {
        foreach ($in as $ij => $j) {
            if (($i != 0 || $j != 0) && $ij <= $ii) {
                $fields["x{$j}{$i}"] = array('x' => $j, 'y' => $i);
                $fields["x{$i}{$j}"] = array('x' => $i, 'y' => $j);
            }
        }
    }
    if ($device == 0) {
        if ($device = $DB->GetOne('SELECT id FROM netdevices ORDER BY name LIMIT 1')) {
            makemap($map, $seen, $device, $x, $y);
        }
    } else {
        // remember that current device was processed
        $seen[$device] = array('x' => $x, 'y' => $y);
        // place device in space ...
        $map[$x][$y] = $device;
        // ... and connected nodes (if they wasn't processed before)
        if (isset($nodelist[$device])) {
            $nodefields = getnodearray(count($nodelist[$device]));
            $i = 0;
            foreach ($nodefields as $field) {
                if (!isset($map[$x + $field['x']][$y + $field['y']])) {
                    $ntx = $x + $field['x'];
                    $nty = $y + $field['y'];
                    $map[$ntx][$nty] = 'n' . $nodelist[$device][$i]['id'] . '.' . $device . '.' . $nodelist[$device][$i]['linktype'];
                    $i++;
                }
            }
            unset($nodefields);
            unset($nodelist[$device]);
        }
        // now do recursion for connected devices
        if (isset($devicelinks[$device])) {
            foreach ($devicelinks[$device] as $deviceid) {
                if (!isset($seen[$deviceid])) {
                    if (isset($nodelist[$deviceid])) {
                        $nodefields = getnodearray(count($nodelist[$deviceid]));
                    }
                    foreach ($fields as $devfield) {
                        $tx = $x + $devfield['x'];
                        $ty = $y + $devfield['y'];
                        if (!isset($map[$tx][$ty])) {
                            // we don't want to overlap connection lines
                            if (overlaps($seen, $deviceid, $x, $y, $tx, $ty)) {
                                continue;
                            }
                            // try to place all connected nodes on map
                            // if there's no place, go to next field
                            if (isset($nodelist[$deviceid])) {
                                $map2 = $map;
                                $cnt = 0;
                                foreach ($nodefields as $field) {
                                    if (!isset($map2[$tx + $field['x']][$ty + $field['y']])) {
                                        $ntx = $tx + $field['x'];
                                        $nty = $ty + $field['y'];
                                        $map2[$ntx][$nty] = 'n' . $nodelist[$deviceid][$cnt]['id'] . '.' . $deviceid . '.' . $nodelist[$deviceid][$cnt]['linktype'];
                                        $cnt++;
                                    }
                                }
                                // not found place for all nodes, let's try next field
                                if ($cnt < count($nodelist[$deviceid])) {
                                    continue;
                                }
                                $map = $map2;
                                unset($nodelist[$deviceid]);
                                unset($nodefields);
                                unset($map2);
                            }
                            makemap($map, $seen, $deviceid, $tx, $ty, $device);
                            break;
                        }
                    }
                }
            }
        }
    }
}
Пример #5
0
     fclose($handle);
     unset($_SESSION['origimg']);
 }
 if ($handle = fopen('grids/u' . $uid . '.png', 'wb')) {
     fwrite($handle, base64_decode($_SESSION['p']));
 }
 fclose($handle);
 $tmp['%[URL]%'] = $http[(int) $_POST['host']] . $_POST['url'];
 $tmp['%[PAYLINK]%'] = $CONFIG['scriptpath'] . '/pay.php?u=' . $uid;
 $tmp['%[KLINK]%'] = $CONFIG['scriptpath'] . '/index.php?i=' . $uid . '&k=' . $uniqid;
 $tmp['%[ALINK]%'] = $CONFIG['scriptpath'] . '/index.php?a=' . $uniqid;
 $tmp['%[DELETE_DAYS]%'] = $CONFIG['delete_days'];
 $tmp['%[USERID]%'] = $uid;
 $mailtemplate = $BETRAG > 0 ? 'mail_payment.txt' : 'mail_activate.txt';
 sendmail($_POST['email'], template($LANGDIR . $mailtemplate, $tmp), '', '"' . $CONFIG['domainname'] . '" <' . $CONFIG['email_webmaster'] . '>');
 makemap(false, false, (int) $_POST['gr']);
 if ($GRID[(int) $_POST['gr']]['adminmail'] && $BETRAG > 0) {
     $tmp['%[TITLE]%'] = stripslashes($_POST['title']);
     $tmp['%[EMAIL]%'] = stripslashes($_POST['email']);
     $tmp['%[BLOCKS]%'] = count(explode(',', $_SESSION['f']));
     $tmp['%[LANGUAGE]%'] = $lang;
     $tmp['%[GRID]%'] = $GRID[(int) $_POST['gr']]['name'];
     $tmp['%[STATUS]%'] = $_SP[70];
     sendmail($CONFIG['email_webmaster'], template($CONFIG['admindir'] . '/lang/mail_admin_pixelinfo_' . $CONFIG['admin_language'] . '.txt', $tmp), '', '"' . $CONFIG['domainname'] . '" <' . $CONFIG['email_webmaster'] . '>');
 }
 unset($_SESSION['f']);
 unset($_SESSION['fc']);
 unset($_SESSION['p']);
 unset($_SESSION['origimg']);
 unset($_SESSION['bildext']);
 if ($BETRAG > 0) {
Пример #6
0
}
//------------------------------------------------------------------------------------------------------------------
// Aktivierung
if ($_GET['a']) {
    include_once "header.php";
    if ($activateinfo = DB_query("SELECT * FROM " . $dbprefix . "user t0 LEFT JOIN " . $dbprefix . "grids t1 ON(t0.gridid=t1.gridid) WHERE uniqueid='" . mysql_real_escape_string($_GET['a']) . "'", '*')) {
        if ($activateinfo['expire_days']) {
            $enddate = ",enddate=CURDATE()+INTERVAL " . (int) $activateinfo['expire_days'] . " DAY";
        }
        // Vorkontrolle
        if ($activateinfo['precontrol']) {
            print template($LANGDIR . 'submitted.htm');
            $sendinfomail = true;
        } elseif (DB_query("UPDATE " . $dbprefix . "user SET submit=NOW() {$enddate} WHERE uniqueid='" . mysql_real_escape_string($_GET['a']) . "'", '#')) {
            print template($LANGDIR . 'submitted.htm');
            makemap(false, false, $activateinfo['gridid']);
            $sendinfomail = true;
        } elseif (!DB_query("SELECT userid FROM " . $dbprefix . "user WHERE uniqueid='" . mysql_real_escape_string($_GET['a']) . "'", 'userid')) {
            print template($LANGDIR . 'submiterror.htm');
        }
    } else {
        include_once 'grids.php';
    }
    include_once "footer.php";
    // Zugangsdaten an User verschicken falls erlaubt
    if ($activateinfo['editpixel'] && $activateinfo['logincode']) {
        $tmp['%[USERID]%'] = $activateinfo['userid'];
        $tmp['%[LOGINCODE]%'] = $activateinfo['logincode'];
        sendmail($activateinfo['email'], template($LANGDIR . 'mail_sendpass.txt', $tmp), '', '"' . $CONFIG['domainname'] . '" <' . $CONFIG['email_webmaster'] . '>');
    }
    // Mail verschicken an Admin falls gewünscht
Пример #7
0
        }
    }
    // Jetzt die Pixeleinträge löschen
    DB_query("DELETE FROM " . $dbprefix . "user WHERE submit IS NULL AND DATE_ADD(regdat, INTERVAL " . (int) $CONFIG['delete_days'] . " DAY) < NOW() AND enddate IS NULL", '#');
    while (list(, $delvar) = each($deleted_gridids)) {
        makemap(false, false, $delvar);
    }
}
// Abgelaufene Pixel löschen
@set_time_limit(60);
if ($ABG_GRIDS = DB_array("SELECT expire_days,gridid FROM " . $dbprefix . "grids WHERE active=1 AND expire_days>0", '*')) {
    while (list(, $abg_gr) = each($ABG_GRIDS)) {
        if ($abg_pixel = DB_array("SELECT * FROM " . $dbprefix . "user WHERE ((DATE_ADD(submit, INTERVAL " . $abg_gr['expire_days'] . " DAY) < NOW() AND enddate IS NULL) OR enddate<CURDATE()) AND gridid='" . $abg_gr['gridid'] . "'", '*')) {
            // Löschen
            DB_query("DELETE FROM " . $dbprefix . "user WHERE ((DATE_ADD(submit, INTERVAL " . $abg_gr['expire_days'] . " DAY) < NOW() AND enddate IS NULL) OR enddate<CURDATE()) AND gridid='" . $abg_gr['gridid'] . "'", '#');
            makemap(false, false, $abg_gr['gridid']);
            while (list(, $abg_val) = each($abg_pixel)) {
                // Bilder löschen
                @unlink("grids/u" . $abg_val['userid'] . '.png');
                @unlink("grids/u" . $abg_val['userid'] . '_orig' . $abg_val['bildext']);
                // Sprache checken
                if ($abg_val['lang'] != $CONFIG['standard_language']) {
                    if (!$active_languages) {
                        $active_languages = DB_array("SELECT code FROM " . $dbprefix . "languages WHERE active=1", '+');
                    }
                    $abg_val['lang'] = in_array($abg_val['lang'], $active_languages) ? $abg_val['lang'] : $CONFIG['standard_language'];
                }
                $abg_tmp['%[URL]%'] = $abg_val['url'];
                $abg_tmp['%[VISITORS]%'] = $abg_val['hits'];
                $abg_tmp['%[EXPIRE_DAYS]%'] = $abg_gr['expire_days'] ? $abg_gr['expire_days'] : '';
                $abg_tmp['%[EXPIRE_MONTHS]%'] = $abg_gr['expire_days'] ? (int) ($abg_gr['expire_days'] / 30) : '';
Пример #8
0
function makeotherday()
{
    makegoogle();
    makebaidu();
    makerss();
    makeindex();
    makemap();
    echo "一键生成当天数据完毕!";
}
Пример #9
0
                     } elseif ($handle = fopen('grids/u' . (int) $logindata['userid'] . '_orig' . $_SESSION['bildext'], 'wb')) {
                         fwrite($handle, base64_decode($_SESSION['origimg']));
                         fclose($handle);
                     }
                 }
                 // Pixelbild direkt abspeichern
                 if ($temp_pic) {
                     if ($handle = fopen('grids/u' . (int) $logindata['userid'] . '.png', 'wb')) {
                         fwrite($handle, base64_decode($temp_pic));
                     }
                     fclose($handle);
                 }
                 $logindata['bildext'] = $_SESSION['bildext'];
                 unset($temp_pic, $_SESSION['origimg'], $_SESSION['bildext']);
             }
             makemap(false, false, $logindata['gridid']);
             if ($NEWPASS) {
                 $_SESSION['logincode'] = md5(stripslashes($_POST['pass1']));
             }
         } else {
             // Fehler beim Speichern
         }
     }
 } else {
 }
 $host = parse_url($logindata['url']);
 $logindata['host'] = $host['scheme'];
 $logindata['url'] = $host['host'];
 $TMP['%[ERRORINFO]%'] = $Nachricht ? '<br><br>' . $Nachricht : '';
 $TMP['%[USERID]%'] = $logindata['userid'];
 $TMP['%[EDITFORM]%'] = '<form method="POST" enctype="multipart/form-data" name="editpixel">';
Пример #10
0
/******************************************************************************************
*   Million Pixel Script (R)
*   (C) 2005-2006 by texmedia.de, all rights reserved.
*   "Million Pixel Script" and "Pixel Script" is a registered Trademark of texmedia.
*
*   This script code is protected by international Copyright Law.
*   Any violations of copyright will be dealt with seriously,
*   and offenders will be prosecuted to the fullest extent of the law.
*
*   This program is not for free, you have to buy a copy-license for your domain.
*   This copyright notice and the header above have to remain intact.
*   You do not have the permission to sell the code or parts of this code or chanced
*   parts of this code for this program.
*   This program is distributed "as is" and without warranty of any
*   kind, either express or implied.
*
*   Please check
*   http://www.texmedia.de
*   for Bugfixes, Updates and Support.
******************************************************************************************/
@ini_set('include_path', ".");
error_reporting(0);
$VERSIONS[basename(__FILE__)] = "3.0";
$showpicprocess = true;
include_once 'incs/functions.php';
if ($_GET['f']) {
    $find = "(url LIKE '%" . mysql_real_escape_string(stripslashes($_GET['f'])) . "%' OR title LIKE '%" . mysql_real_escape_string(stripslashes($_GET['f'])) . "%') AND ";
}
$data = DB_array("SELECT userid FROM " . $dbprefix . "user WHERE {$find} submit IS NOT NULL AND gridid='" . (int) $_GET['gr'] . "'", '+');
print makemap(false, false, (int) $_GET['gr'], true, $data);
Пример #11
0
*   This program is distributed "as is" and without warranty of any
*   kind, either express or implied.
*
*   Please check
*   http://www.texmedia.de
*   for Bugfixes, Updates and Support.
******************************************************************************************/
$VERSIONS[basename(__FILE__)] = "3.01 PRO";
if (eregi(basename(__FILE__), $HTTP_SERVER_VARS[REQUEST_URI])) {
    die("You can't access this file directly! Please go to the startpage!");
}
if ($_POST['kill'] && $_POST['i'] && $_POST['k']) {
    if ($killed_data = DB_Query("SELECT email,hits,gridid FROM " . $dbprefix . "user WHERE userid='" . (int) $_POST['i'] . "' AND uniqueid='" . mysql_real_escape_string(strip_tags($_POST['k'])) . "'", '*')) {
        // Eintrag löschen
        if (DB_query("DELETE FROM " . $dbprefix . "user WHERE userid='" . (int) $_POST['i'] . "' AND uniqueid='" . mysql_real_escape_string(strip_tags($_POST['k'])) . "' LIMIT 1", '#')) {
            makemap(false, '', $killed_data['gridid']);
            $deleted = true;
        }
    }
}
if ($deleted) {
    $TMP['%[LINKPIXEL]%'] = 'getp.php?gr=' . $killed_data['gridid'];
    print template($LANGDIR . 'killed.htm', $TMP);
} else {
    $TMP['%[VISITORS]%'] = (int) $killed_data['hits'];
    $TMP['%[KILLFORM]%'] = '
        <form method="post" action="">
        <input type="hidden" name="k" value="' . htmlspecialchars(strip_tags($_REQUEST['k'])) . '">
        <input type="hidden" name="i" value="' . (int) $_REQUEST['i'] . '">
        <input type="hidden" name="kill" value="1">