function textile($text, $lite = '')
 {
     if (get_magic_quotes_gpc() == 1) {
         $text = stripslashes($text);
     }
     $text = incomingEntities($text);
     $text = encodeEntities($text);
     $text = fixEntities($text);
     $text = cleanWhiteSpace($text);
     $text = getRefs($text);
     $text = noTextile($text);
     $text = image($text);
     $text = links($text);
     $text = span($text);
     $text = superscript($text);
     $text = footnoteRef($text);
     $text = code($text);
     $text = glyphs($text);
     $text = retrieve($text);
     if ($lite == '') {
         $text = lists($text);
         $text = table($text);
         $text = block($text);
     }
     /* clean up <notextile> */
     $text = preg_replace('/<\\/?notextile>/', "", $text);
     /* turn the temp char back to an ampersand entity */
     $text = str_replace("x%x%", "&amp;", $text);
     $text = str_replace("<br />", "<br />\n", $text);
     return trim($text);
 }
Пример #2
0
/**
 * Text processing functions
 * @author edited by Peng Wang <*****@*****.**>
 * @author Dean Allen <http://www.textpattern.com>
 * @version 1.1
 * @package Indexhibit
 **/
function textProcess($text = '', $override)
{
    if ($text !== '') {
        return $override == 1 ? block($text) : $text;
    } else {
        return;
    }
}
Пример #3
0
/**
 * Main function to create the parameters passed to the view.
 *
 * @return array
 */
function get_dashboard()
{
    global $privileges;
    require_once realpath(__DIR__ . '/../controller/api.php');
    $shifts = getAllUpcomingShifts();
    $viewData = array('number_upcoming_shifts' => block(array('description' => _("Angels needed in the next 3 hrs"), 'number' => countUpcomingNeededAngels($shifts, 3 * 60 * 60)), BLOCK_TYPE_COUNTER), 'number_upcoming_night_shifts' => block(array('description' => _("Angels needed for night shifts"), 'number' => getNumberUpcomingNightShifts()), BLOCK_TYPE_COUNTER), 'number_currently_working' => block(array('description' => _("Angels currently working"), 'number' => getCurrentlyWorkingAngels()), BLOCK_TYPE_COUNTER), 'number_hours_worked' => block(array('description' => _("Hours to be worked"), 'number' => countHoursToBeWorked($shifts)), BLOCK_TYPE_COUNTER), 'my_next_jobs' => in_array('user_shifts', $privileges) ? block(array('title' => _("My next jobs"), 'body' => getUsersNextJobs($shifts, 3 * 60 * 60)), BLOCK_TYPE_PANEL) : '', 'jobs_currently_running' => block(array('title' => _("Currently running"), 'body' => getListCurrentShifts($shifts)), BLOCK_TYPE_PANEL), 'jobs_now' => block(array('title' => _("Within the next hour"), 'body' => getListUpcomingShifts($shifts, 60 * 60)), BLOCK_TYPE_PANEL), 'jobs_soon' => block(array('title' => _("Within the next 3 hours"), 'body' => getListUpcomingShifts($shifts, 3 * 60 * 60)), BLOCK_TYPE_PANEL), 'news' => block(array('title' => _("News"), 'body' => getAllNewsList()), BLOCK_TYPE_PANEL), 'api_shifts_link' => api_link('shifts'));
    return dashboardView($viewData);
}
Пример #4
0
function crafting_common($cache_name, $texture, $params, $positions, $size_factor)
{
    global $im, $final_size_x, $final_size_y, $set_404, $cache_final_image, $final_image_modid, $final_image_type, $final_image_item, $final_image_size;
    list($final_size_x, $final_size_y) = getimagesize($texture);
    $final_size_x *= $size_factor;
    $final_size_y *= $size_factor;
    $im = image_from_cache("minecraft", "crafting", $cache_name, $size_factor * 16);
    if ($im === null) {
        $images = array();
        foreach ($params as $image) {
            $images[] = block(array($image));
        }
        $im = render_crafting($texture, $images, $positions);
        cache_image("minecraft", "crafting", $cache_name, $im, "base");
    }
    $set_404 = false;
    $cache_final_image = true;
    $final_image_modid = "minecraft";
    $final_image_type = "crafting";
    $final_image_item = $cache_name;
    $final_image_size = $size_factor * 16;
}
Пример #5
0
                    </tr>
                </table>

            </td>
        </tr>
    </table>
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr height="1px">
            <td width="100%" valign="top">
<?php 
$searchword = $_GET[searchword];
if ($searchword == "" || $searchword == "поиск...") {
    echo "Введите запрос для поиска";
} else {
    if ($where != "") {
        echo block($sqlQuery, "search_item", "", "", 20, "Поиск по запросу <b>\"" . $searchword . "\"</b> не дал результатов.");
    }
}
?>
            </td>
        </tr>
        <tr height="30px">
            <td width="100%">
            </td>
        </tr>
    </table>

    <table width="100%" cellspacing="0" cellpadding="0" border="0">
        <tr height="1px">
            <td width="100%" style="padding-top:10px;padding-bottom:30px;">
                <table width="100%" cellspacing="0" cellpadding="0" border="0">
Пример #6
0
<?php

//$data = pt_view();
include block("admin/block/template/blank");
Пример #7
0
<div class="t_list_9">
            	<h4>相关推荐</h4>
                <div class="t_list_19" id="ad_box_3">加载中...</div>
            </div>
        </div>
    	<div class="t_box_5">
            <div class="t_list_21">
            <h4>网站地图</h4>
            <dl>
<?php 
if (is_array($channels['menus'])) {
    foreach ($channels['menus'] as $key => $value) {
        if ($key == 'news' || $value['upnameid'] == 'news') {
            ?>
<!--资讯根分类 开始--><?php 
            block("category", "type/{$key}/isroot/1/limit/0,100/order/c.displayorder/cachetime/10800/cachename/category");
            ?>
<dt><a href="<?php 
            echo $value['url'];
            ?>
"><?php 
            echo $value['name'];
            ?>
</a></dt>
<dd>
<?php 
            if (is_array($_SBLOCK['category'])) {
                foreach ($_SBLOCK['category'] as $value) {
                    ?>
<a href="<?php 
                    echo $value['url'];
Пример #8
0
                                    </tbody>
                                </table>
                            </div>

                        </div>
                    </div>
                </div>
            </div>

        </div>

    </div>
    <!-- Footer-->
    <?php 
include block("user/block/footer");
?>
    <script src="/resources/public/js/region_select.js"></script>

    <div class="modal fade" id="model_address" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="color-line"></div>
                <div class="modal-header text-center">
                    <h4 class="modal-title">收货地址</h4>
                </div>
                <div class="modal-body">

                    <form method="get" onsubmit="return false;" class="form-horizontal">

                            <div class="row">
Пример #9
0
    echo geturl("uid/{$_GET['uid']}/op/bbs");
    ?>
">论坛</a>
<?php 
}
?>
</div>
<?php 
if ($_GET['op'] == 'uchblog' && uchome_exists() && !in_array('uchblog', $_SCONFIG['closechannels'])) {
    block("uchblog", "uid/{$_GET['uid']}/order/dateline DESC/perpage/20/cachetime/3600/showdetail/1/messagelen/200/messagedot/1/cachename/infobody");
} elseif ($_GET['op'] == 'uchphoto' && uchome_exists() && !in_array('uchphoto', $_SCONFIG['closechannels'])) {
    block("uchphoto", "uid/{$_GET['uid']}/order/updatetime DESC/perpage/6/subjectlen/30/messagedot/0/cachetime/3600/cachename/infobody");
} elseif ($_GET['op'] == 'bbs' && discuz_exists() && !in_array('bbs', $_SCONFIG['closechannels'])) {
    block("bbsthread", "authorid/{$_GET['uid']}/order/dateline DESC/perpage/20/cachetime/3600/showdetail/1/messagelen/200/messagedot/1/cachename/infobody");
} else {
    block("spacenews", "uid/{$_GET['uid']}/order/i.dateline DESC/perpage/20/cachetime/3600/showdetail/1/messagelen/200/messagedot/1/cachename/infobody");
}
?>

<?php 
if ($_GET['op'] == 'uchphoto') {
    ?>
<div class="global_module user_photolist">
<div class="clearfix">
<?php 
    if (is_array($_SBLOCK['infobody'])) {
        foreach ($_SBLOCK['infobody'] as $key => $value) {
            ?>
<dl>
<dt><div><a href="<?php 
            echo $value['url'];
Пример #10
0
include "sql.php";
session_start();
if ($_GET['action'] == "chatheartbeat") {
    chatHeartbeat();
}
if ($_GET['action'] == "sendchat") {
    sendChat();
}
if ($_GET['action'] == "closechat") {
    closeChat();
}
if ($_GET['action'] == "startchatsession") {
    startChatSession();
}
if ($_GET['action'] == "block") {
    block();
}
if ($_GET['action'] == "webcam") {
    webcam();
}
if (!isset($_SESSION['chatHistory'])) {
    $_SESSION['chatHistory'] = array();
}
if (!isset($_SESSION['openChatBoxes'])) {
    $_SESSION['openChatBoxes'] = array();
}
function webcam()
{
    $username = $_POST["username"];
    echo "{$username} has received a request";
    exit(0);
Пример #11
0
<td valign="top" class="catalog">

<?php 
echo block("rid=3 ORDER BY date DESC LIMIT 2", "news");
?>

<table class="allnews" width="250" border=0><tr><td align="right" style="padding-right:10px;padding-top:27px;"><a class="allnews" href="/">Все новости</a></td></tr>
<tr><td><img src="images/blank.gif" width="1" height="27" border="0"></td></tr>
<tr><td class="company">Производители</td></tr>
<tr><td><img src="images/blank.gif" width="1" height="24" border="0"></td></tr>
</table>
<table class="company" width="250" border=0>
<tr><td width=50%><a href="/"><img src="images/bosch.jpg" width="115" height="30" border="0"></a></td><td width=50%><a href="/"><img src="images/dewalt.jpg" width="115" height="30" border="0"></a></td></tr>
<tr><td width=50% class="companyname" align="center">Bosch</td><td width=50% class="companyname" align="center">Dewalt</td></tr>

<tr><td width=50%><a href="/"><img src="images/bosch.jpg" width="115" height="30" border="0"></a></td><td width=50%><a href="/"><img src="images/dewalt.jpg" width="115" height="30" border="0"></a></td></tr>
<tr><td width=50% class="companyname" align="center">Bosch</td><td width=50% class="companyname" align="center">Dewalt</td></tr>

<tr><td width=50%><a href="/"><img src="images/bosch.jpg" width="115" height="30" border="0"></a></td><td width=50%><a href="/"><img src="images/dewalt.jpg" width="115" height="30" border="0"></a></td></tr>
<tr><td width=50% class="companyname" align="center">Bosch</td><td width=50% class="companyname" align="center">Dewalt</td></tr>

<tr><td width=50%><a href="/"><img src="images/bosch.jpg" width="115" height="30" border="0"></a></td><td width=50%><a href="/"><img src="images/dewalt.jpg" width="115" height="30" border="0"></a></td></tr>
<tr><td width=50% class="companyname" align="center">Bosch</td><td width=50% class="companyname" align="center">Dewalt</td></tr>

<tr><td width=50%><a href="/"><img src="images/bosch.jpg" width="115" height="30" border="0"></a></td><td width=50%><a href="/"><img src="images/dewalt.jpg" width="115" height="30" border="0"></a></td></tr>
<tr><td width=50% class="companyname" align="center">Bosch</td><td width=50% class="companyname" align="center">Dewalt</td></tr>
</table>
<table width="250" border=0><tr><td align="right" style="padding-right:10px;padding-top:27px;padding-bottom:30px;"><a class="allnews" href="/">Все производители</a></td></tr>
<tr><td style="padding-bottom:15px;"><img src="images/hit_bg.jpg" width="250" height="25" border="0"></td></tr>
</table>
<table style="margin-right:10px;" border=0>
Пример #12
0
        echo $value['url'];
        ?>
"><?php 
        echo $value['subject'];
        ?>
</a></li>
            
<?php 
    }
}
?>
        </ul>
    	<ul>
        	<li class="first"><a href="/category-32.html">院校大全</a></li>
            <?php 
block("spacenews", "type/news/catid/32/order/i.dateline DESC/limit/0,5/cachetime/9000/subjectlen/30/cachename/newsShow");
?>
<!--news-->
            
<?php 
if (is_array($_SBLOCK['newsShow'])) {
    foreach ($_SBLOCK['newsShow'] as $value) {
        ?>
            <li><a href="<?php 
        echo $value['url'];
        ?>
"><?php 
        echo $value['subject'];
        ?>
</a></li>
            
Пример #13
0
        
<?php 
    }
}
?>
    </div>
    <div id="contentinner" class="clearfix">
    	<div class="t_box_1">
        	<div class="t_list_9">
            	<h4><a href="/action-<?php 
echo $channel;
?>
.html">其他相关</a></h4>
                <ul>
                   <?php 
block("spacenews", "catid/27/limit/0,20/cachetime/9000/cachename/other");
?>
                    
<?php 
if (is_array($_SBLOCK['other'])) {
    foreach ($_SBLOCK['other'] as $value) {
        ?>
                    <li><a href="<?php 
        echo $value['url'];
        ?>
"><?php 
        echo $value['subject'];
        ?>
</a></li>
                    
<?php 
Пример #14
0
<? extend('frix/admin/base') ?>

<? block('contents') ?>
	<div id="message">
		<p>Are you sure you want to delete <strong>"<?php 
echo $file_name;
?>
"</strong>?</p>
	</div>

	<form action="./?<?php 
echo $_SERVER['QUERY_STRING'];
?>
" method="post">
		<p class="buttons">
		<span class="button"><input type="submit" name="delete" value="Yes" /></span>
		<span class="button"><a href="./">No</a></span>
		</p>
	</form>
<? end_block() ?>
Пример #15
0
function write($_POST)
{
    extract($_POST);
    if (isset($back)) {
        unset($_POST["back"]);
        return slctCat($_POST);
    }
    require_lib("validate");
    $v = new validate();
    $v->isOk($type, "string", 1, 2, "Invalid category type.");
    $v->isOk($tab, "string", 1, 14, "Invalid category type.");
    $v->isOk($accname, "string", 1, 50, "Invalid account name.");
    $v->isOk($catid, "string", 1, 50, "Invalid category Id/name.");
    $v->isOk($topacc, "num", 4, 4, "Invalid account number.");
    $v->isOk($accnum, "num", 1, 3, "Invalid account number.");
    $v->isOk($toptype, "string", 1, 255, "Invalid category type.");
    if ($v->isError()) {
        $err = $v->genErrors();
        return $err;
    }
    core_connect();
    $sql = "SELECT * FROM accounts WHERE accname = '{$accname}' AND div = '" . USER_DIV . "'";
    $checkRslt = db_exec($sql) or errDie("Unable to retrieve Account details from database.");
    if (pg_numrows($checkRslt) > 0) {
        $confirm = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' class='err'>Account name already exist.</td>\n\t\t\t</tr>";
        return slctCaterr($type, $tab, $accname, $catid, $topacc, $accnum, $confirm);
        exit;
    }
    # Check Account Number
    core_connect();
    $sql = "SELECT * FROM accounts WHERE topacc = '{$topacc}' AND accnum = '{$accnum}' AND div = '" . USER_DIV . "'";
    $checkRslt = db_exec($sql) or errDie("Unable to retrieve Account details from database.");
    $check = pg_numrows($checkRslt);
    if (pg_numrows($checkRslt) > 0) {
        $confirm = "\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' class='err'>The Account number is already in use.</td>\n\t\t\t</tr>";
        return slctCaterr($type, $tab, $accname, $catid, $topacc, $accnum, $confirm);
        exit;
    }
    # Begin sql transaction
    pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF);
    // Get the db value of toptype
    $toptype_db = explode(":", $toptype);
    $toptype_db = $toptype_db[0];
    # write to DB
    $sql = "\n\t\tINSERT INTO accounts (\n\t\t\ttopacc, accnum, accname, acctype, catid, div, toptype\n\t\t) VALUES (\n\t\t\t'{$topacc}', '{$accnum}', '{$accname}','{$type}', '{$catid}', '" . USER_DIV . "', '{$toptype_db}'\n\t\t)";
    $catRslt = db_exec($sql) or errDie("Unable to add Account to Database.", SELF);
    # get last inserted id for new acc
    $accid = pglib_lastid("accounts", "accid");
    global $MONPRD;
    $month_names = array(0, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    # insert account into trial Balance
    insert_trialbal($accid, $topacc, $accnum, $accname, $type, 'f', USER_DIV);
    for ($i = 1; $i <= 12; $i++) {
        $periodname = getMonthName($i);
        $sql = "\n\t\t\tINSERT INTO " . YR_DB . ".{$periodname} (\n\t\t\t\taccid, topacc, accnum, accname, debit, credit, div\n\t\t\t) SELECT accid, topacc, accnum, accname, debit, credit, div FROM core.trial_bal WHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
        $sql = "\n\t\t\tINSERT INTO \"{$i}\".openbal (\n\t\t\t\taccid, accname, debit, credit, div\n\t\t\t) SELECT accid, accname, debit, credit, div FROM core.trial_bal WHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
        $sql = "\n\t\t\tINSERT INTO \"{$i}\".ledger (\n\t\t\t\tacc, contra, edate, eref, descript, credit, debit, div, caccname, ctopacc, caccnum, cbalance, dbalance\n\t\t\t) SELECT accid, accid, CURRENT_DATE, '0', 'Balance', '0', '0', div, accname, topacc, accnum, credit, debit \n\t\t\tFROM core.trial_bal \n\t\t\tWHERE month='{$i}' AND accid='{$accid}'";
        db_exec($sql) or die($sql);
    }
    pglib_transaction("COMMIT") or errDie("Unable to start a database transaction.", SELF);
    block();
    //			print "
    //			<script>
    //				window.opener.location.reload();
    //				window.close();
    //			</script>";
    if (isset($update_parent) and $update_parent == "yes") {
        #do something to reload the parent window ...
        print "\n\t\t\t<script>\n\t\t\t\twindow.opener.document.form.key.value='{$set_key}';\n\t\t\t\twindow.opener.document.form.submit ();\n\t\t\t\twindow.close();\n\t\t\t</script>";
    } else {
        #do normal return
        # status report
        $write = "\n\t\t\t<table " . TMPL_tblDflts . " width='50%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>New Account</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t<td>New Account, <b>({$topacc}/{$accnum}) - {$accname}</b> was successfully added to Cubit.</td>\n\t\t\t\t</tr>\n\t\t\t</table><br>" . mkQuickLinks(ql("../reporting/allcat.php", "List All Accounts (New Window)", true), ql("acc-view.php", "View Accounts"), ql("acc-new2.php", "Add Account"));
        return $write;
    }
}
Пример #16
0
				<td align="right" width="82px">
					<input id="searchword" name="searchword" class="searchbox" onfocus="SearchFocus()" onblur="SearchBlur()" type="text" value="<?php 
echo $_GET[searchword] ? $_GET[searchword] : "поиск...";
?>
">
				</td>
				<td align="right" width="28px"><input type="image" src="/images/search/btn.jpg" width="28px" height="22px"></td>

				</tr>
				</table>
			</nobr>
		</form>
		</td>-->
		</tr>
		</table>
		<table id="Table_Top" width="100%" border="0" cellpadding="0"  cellspacing="0">
		<tr valign="bottom" height="43px">
		<td align="left" width="240px" style="padding-left:10px;"><a style="position:relative;top:-19px;"><img src="/images/catalog.jpg" height="43px" width="207px" border="0"></a></td>
		<td width="100%"></td>
		<?php 
echo block("rid=1 AND id NOT IN (105, 175, 246, 5805, 5867, 5874, 5872, 5871, 5870) ORDER BY date DESC", "top_menu");
?>
		</tr>
		</table>

	</td>
	<td align="left" width="10px"><img src="/images/headerbgr.jpg" border="0" width="9px" height="80px" /></td>
	</tr>
	</table>
</td>
</tr>
Пример #17
0
	</td>
</tr>
<tr valign="top">
	<td width="100%" style="padding-top:20px;padding-bottom:20px;">
		<form action="<?php 
echo $_SERVER[REQUEST_URI];
?>
" method="post">
			<table id="Table_footer" width="100%" border="0" cellpadding="0"  cellspacing="0">
			
			<tr valign="top">
			<td width="150px" style="padding-left:30px;" align="left">
			<?php 
$mobPhone1 = block("id=9271", "anons");
$mobPhone2 = block("id=9270", "anons");
$mobPhone3 = block("id=9269", "anons");
?>
			<div><u><b>Контакты:</b></u><br><br>220118, РБ, г. Минск,
			Машиностроителей 29, пом 103</div><br>
			<?php 
echo $mobPhone1;
?>
<br/>
			<?php 
echo $mobPhone2;
?>
<br/>
			<?php 
echo $mobPhone3;
?>
<br/>
Пример #18
0
">Next</a></li>
<?php 
} else {
    ?>
      <li class="next disabled"><span>Next</span></li>
<?php 
}
?>
    </ul>

  </div>
</div>

<div class="visible-xs">
  <?php 
echo block('app_infopanel');
?>
</div>

<script type="text/javascript">

$('#tag-filter-toggle').on('click',function(){
  $down = $('i.fa-angle-double-down');
  $up = $('i.fa-angle-double-up');
  if($down){
    $down.removeClass('fa-angle-double-down').addClass('fa-angle-double-up');
  }
  if($up){
    $up.removeClass('fa-angle-double-up').addClass('fa-angle-double-down');
  }
  $('.pager>li>a').each(function(){
Пример #19
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;
}
Пример #20
0
?>

<?php 
if (!empty($ads['pagefootad'])) {
    ?>
<div class="ad_pagebody"><?php 
    echo $ads['pagefootad'];
    ?>
</div>
<?php 
}
?>

<?php 
if (!empty($_SCONFIG['showindex'])) {
    block("friendlink", "order/displayorder/limit/0,{$_SCONFIG['showindex']}/cachetime/11600/namelen/32/cachename/friendlink/tpl/data");
    ?>
<div id="links">
    <h3>友情链接</h3>
    <?php 
    $imglink = $txtlink = "";
    ?>
    
<?php 
    if (is_array($_SBLOCK['friendlink'])) {
        foreach ($_SBLOCK['friendlink'] as $value) {
            ?>
    
<?php 
            if ($value['logo']) {
                ?>
Пример #21
0
<table border=0 style="margin-left:29px;margin-top:3px;margin-right:20px;margin-bottom:10px;">
<tr>
<td>
<?php 
echo block("id=88", "text");
?>
</td>
</tr>
</table>
<table><tr><td><img src="images/bottomline1.jpg" width="59" height="12" border="0"></td><td width=100% class="bottomline"><img src="images/blank.gif" width="1" height="12" border="0"></td><td><img src="images/bottomline2.jpg" width="59" height="12" border="0"></td></tr></table>
<center>
<table border=0 style="margin-top:10px;">
<tr>
	<?php 
echo block("rid=1 ORDER BY date DESC", "bottom_menu_item");
?>
</tr>
</table>
<table style="margin-top:36px;"><tr><td width=50% align=right style="padding-right:20px;">Тел. +375 29 376 57 49<br>
Тел. +375 29 570 48 09<br>
Тел. +375 29 156-78-57</td><td width=50% style="padding-left:20px;">ICQ: 413042<br>
Email: info@kalibr.by<br>
Skype: lantarus</td></tr>
<tr><td colspan="2"><img src="images/blank.gif" width="1" height="90" border="0"></td></tr>

</table>

</body>
</html>
Пример #22
0
 public function render($block_name = null)
 {
     $this->on_render();
     if ($block_name) {
         $this->_block_name = $block_name;
     }
     return block($this->_block_name)->set('list', $this->as_array())->render();
 }
 */
get_header();
?>

<div class="container">
	<div class="row">
		<div class="col-sm-8 col-md-9 col-lg-8">
			<main role="main">

				<?php 
while (have_posts()) {
    the_post();
    ?>

					<?php 
    block('login-form');
    ?>

				<?php 
}
// end of the loop.
?>

			</main>
		</div>

		<?php 
get_sidebar();
?>
	</div>
</div>
</span></a></td>
<?php 
                }
            }
            ?>
</tr></tbody></table>
</div>
</div>
<?php 
            if ($gv['allowspread']) {
                ?>
<ul class="state_newstop clearfix">
<?php 
                if (is_array($clicks[$cgid])) {
                    foreach ($clicks[$cgid] as $v) {
                        block("model", "name/{$channel}/dateline/{$gv['spreadtime']}/order/i.click_{$v['clickid']} DESC/limit/0,1/cachetime/3600/subjectlen/40/subjectdot/0/cachename/click_{$v['clickid']}");
                        if (is_array($_SBLOCK['click_' . $v['clickid']])) {
                            foreach ($_SBLOCK['click_' . $v['clickid']] as $value) {
                                ?>
<li>[<?php 
                                echo $v['name'];
                                ?>
最多的] <a href="<?php 
                                echo $value['url'];
                                ?>
" title="<?php 
                                echo $value['subjectall'];
                                ?>
"><?php 
                                echo $value['subject'];
                                ?>
Пример #25
0
    if ($totcnt % MAXTABLESIZE == MAXTABLESIZE - 1) {
        break;
    }
    $cnt++;
    $totcnt++;
}
insert($w, block("<p>"));
$vars = "";
$printed = 0;
while ($row = $result->FetchRow()) {
    $totcnt++;
    $vars = DisplayBlock($w, $row, $totcnt, "&domain=" . urlencode($domain) . "&cust=" . $cust . "&expr={$expr}&descrip=" . urlencode($descrip), "domain");
    if (!empty($vars) and !$printed) {
        insert($ck, anchor($vars, ">>"));
        $printed = 1;
    }
}
insert($w, block("<p>"));
if ($cnt) {
    insert($w, anchor($_SERVER["PHP_SELF"] . "?cust={$cust}&dataid=0&action=export", my_("Export all changed DNS Zones"), $ipplanParanoid ? array("onclick" => "return confirm('" . my_("Are you sure to Export?") . "')") : FALSE));
} else {
    myError($w, $p, my_("Search found no DNS Zone entries"), FALSE);
}
insert($w, $f = form(array("method" => "post", "action" => "modifydnsform.php?cust={$cust}&action=add")));
insert($f, submit(array("value" => my_("Add a DNS Zone"))));
$result->Close();
// create the export view form
$expression = $export->translateExpr($expr);
$export->setInfo(array(array("customer_ID", "customer_description", "search_criterion", "search_expression"), array($cust, $ds->getCustomerDescrip($cust), $expression, $descrip)));
$export->createExportForm($w, $template);
printhtml($p);
Пример #26
0
						<a href="#">登录</a>
						<a href="#">注册</a>
					</div>
				</div>
			</nav>
		</div>
		<div class="head-foot"></div>
	</header>


	<?php 
include block("block/reset");
?>

	<?php 
include block("block/footer");
?>
<!--<div class="foot">
<div class="infooter clearfix">
	<h2>易衫网</h2>
	<dl>
		<dt>导航</dt>
		<dd>
			<a href="#">首页</a>
		</dd>
		<dd>
			<a href="#">开始设计</a>
		</dd>
		<dd>
			<a href="#">关于我们</a>
		</dd>
Пример #27
0
$w = myheading($p, $title, true);
// explicitly cast variables as security measure against SQL injection
list($cust, $areaindex) = myRegister("I:cust I:areaindex");
// display opening text
insert($w, heading(3, "{$title}."));
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
// start form
insert($w, $f1 = form(array("name" => "THISFORM", "method" => "post", "action" => $_SERVER["PHP_SELF"])));
$cust = myCustomerDropDown($ds, $f1, $cust, $grps) or myError($w, $p, my_("No customers"));
$areaindex = myAreaDropDown($ds, $f1, $cust, $areaindex);
insert($w, $f2 = form(array("name" => "ENTRY", "method" => "get", "action" => "modifybase.php")));
// save customer name for actual post of data
insert($f2, hidden(array("name" => "cust", "value" => "{$cust}")));
insert($f2, hidden(array("name" => "areaindex", "value" => "{$areaindex}")));
myRangeDropDown($ds, $f2, $cust, $areaindex);
insert($f2, block("<p>"));
insert($f2, $con = container("fieldset", array("class" => "fieldset")));
insert($con, $legend = container("legend", array("class" => "legend")));
insert($legend, text(my_("Search criteria")));
myFocus($p, "ENTRY", "ipaddr");
insert($con, textbr(my_("Subnet address (leave blank if range selected)")));
insert($con, span(my_("Partial subnet addresses can be used eg. 172.20"), array("class" => "textSmall")));
insert($con, input_text(array("name" => "ipaddr", "size" => "15", "maxlength" => "15")));
if (DBF_TYPE == "mysql" or DBF_TYPE == "maxsql" or DBF_TYPE == "postgres7") {
    insert($con, textbrbr(my_("Description (only display networks matching the regular expression)")));
} else {
    insert($con, textbrbr(my_("Description (only display networks containing)")));
}
insert($con, input_text(array("name" => "descrip", "size" => "80", "maxlength" => "80")));
insert($con, generic("br"));
insert($f2, submit(array("value" => my_("Submit"))));
Пример #28
0
<title>Metahub</title>
<link rel="stylesheet" href="<?php 
echo url('/css/main.css');
?>
" type="text/css">
<link rel="shortcut icon" href="<?php 
echo url('/images/favicon.ico');
?>
">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
<!--
-->
</style>
</head>
<body>
<?php 
echo block('menu');
?>
<div id="main">
<?php 
echo $contents;
?>
</div>

<?php 
echo block('footer');
?>
</body>
</html>
Пример #29
0
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>
    </div>
    <!-- /.main-content -->
    <?php 
include block("admin/block/footer");
?>
</div>
<!-- /.main-container -->
<?php 
include block("admin/block/scripts");
?>
<!-- page specific plugin scripts -->
<script src="/ace/assets/js/bootstrap-datepicker.min.js"></script>
<script src="/ace/assets/js/jquery.jqGrid.min.js"></script>
<script src="/ace/assets/js/grid.locale-en.js"></script>
<script type="text/javascript">

    var grid_selector = "#grid-table";
    var pager_selector = "#grid-pager";

    function search() {
        var $query = {
            order_no: $('#order_no').val(),
            pay_status: $('#pay_status').val(),
            ship_status: $('#ship_status').val(),
Пример #30
0
    if (++$counter % 2 === 0) {
        ?>
</div>
<div class="row">
<?php 
    }
}
?>
</div>

<div id="create-app-button" class="col-xs-12 visible-xs text-left">
  <a class="btn btn-default" href="<?php 
echo url('/app/new');
?>
"><i class="fa fa-plus"></i> New Application</a>
</div>

<div class="text-center">
  <?php 
echo block('paging', array('urlbase' => url('/')));
?>
</div>

<script type="text/javascript">

$('.app-list-item').on('click',function(event){
  $('a',this)[0].click();
});

</script>