Compare commits

...

10 Commits

Author SHA1 Message Date
7008ec0310 New changes in BBNepal 2024-10-17 17:06:13 +05:45
4ac5a5e491 bbnepal new changes 2024-10-08 15:47:07 +05:45
ad3e5eb1ec account categories removed 2024-10-07 16:35:08 +05:45
318998d272 changes for bbnepal data 2024-10-07 13:59:13 +05:45
967642f2be changes for bbnepal 2024-10-07 11:41:27 +05:45
e3c8a3b5fe correction of error for purchase and sales 2024-10-04 16:31:02 +05:45
ec6bfaf7ff export excel second 2024-09-30 17:25:58 +05:45
4683fe67a7 export excel 2024-09-30 16:09:29 +05:45
60f4c75eb0 changes for print 2024-09-29 17:46:26 +05:45
684e01bf48 changes for filter and print 2024-09-29 16:59:27 +05:45
1366 changed files with 40091 additions and 75428 deletions

4
.env
View File

@ -3,7 +3,7 @@ APP_URL=http://localhost/bbnepal/School-With-Accounts/account/
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3309
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3
DB_DATABASE=bbnepal_accounting
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3,myurlsco_bbnepal_acc #given
DB_DATABASE=bbnepal_accounting # given
DB_USERNAME=root
DB_PASSWORD=

View File

@ -10,8 +10,8 @@ class Ledger extends CI_Controller
}
public function _remap($alias = "", $params = array())
{
$data['dataValue'] = $this->session;
// echo "<pre>"; print_r($_GET['accategory_id']);die();
$data['pageTitle'] = "Account Head";
switch ($alias) {
@ -19,9 +19,13 @@ class Ledger extends CI_Controller
$data['pageTitle'] = "Ledger";
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
foreach ($AccountGroups as $AccountGroup) {
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
// $AccountGroup->AccountCategories = $this->db->where("status", 1)->where("acgroup_id", $AccountGroup->acgroup_id)->get("tbl_accategories")->result();
$AccountGroup->AccountCategories = $this->db->where("status", 1)->where("accategory_id ", ($_GET['accategory_id'] ?? ""))->get("tbl_accategories")->result();
}
$data['AccountGroups'] = $AccountGroups;
// echo "<pre>"; print_r($data['AccountGroups']);die();
loadView("accounts/ledger/navigate", $data);
break;
case 'getledgersummary':
@ -39,13 +43,27 @@ class Ledger extends CI_Controller
$this->load->view("accounts/ledgersummary", $data);
break;
case 'partyledger':
$data['pageTitle'] = "View Party Ledger";
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
// $_GET['show_ledger'];
if (!isset($_GET['from_date'])) {
$data['from_date'] = null;
}
if (!isset($_GET['to_date'])) {
$data['to_date'] = null;
}
if (isset($_GET)) {
$data = $_GET;
}
$data['pageTitle'] = "View Party Ledger";
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
if (isset($_GET['show_ledger'])) {
$fromDate_Nepali = $_GET['from_date'];
$toDate_Nepali = $_GET['to_date'];
$fromDate_Nepali=$data['from_date'];
$toDate_Nepali =$data['to_date'];
$data['fromDate'] = NepaliToEnglishDate($fromDate_Nepali);
$data['toDate'] = NepaliToEnglishDate($toDate_Nepali);
$data['fromDate_Nepali'] = $fromDate_Nepali;
@ -77,14 +95,39 @@ class Ledger extends CI_Controller
loadView("accounts/daybook", $data);
break;
case 'bank_book':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Bank Book";
loadView("accounts/ledger_bankbook", $data);
break;
case 'cash_book':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Book";
loadView("accounts/ledger_cashbook", $data);
break;

View File

@ -52,6 +52,25 @@ class Reports extends CI_Controller
$data['account_id'] = $account_id;
$this->load->view("accounts/ledgersummary", $data);
break;
case 'ledgerCashBook':
// $data = $this->uri->segment(3);
// $data['pageTitle'] = "Ledger";
// $Transactions = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_voucherdetails")->result();
// $Account = $this->db->where("status", 1)->where("account_id", $account_id)->get("tbl_accounts")->row();
// foreach ($Transactions as $T) {
// // $T->AccountCategory=$this->db->where("status",1)->where("accategory_id",$AccountGroup->acgroup_id)->get("tbl_accategories")->result();
// $T->Voucher = $this->db->where("status", 1)->where("voucher_id", $T->voucher_id)->get("tbl_vouchers")->row();
// }
// $data['Transactions'] = $Transactions;
// $data['Account'] = $Account;
// $data['account_id'] = $account_id;
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$this->load->view("accounts/ledger/ledger_cash_book_details",$data);
break;
case 'trialbalance_old':
$data['pageTitle'] = "Trial Balance";
$AccountGroups = $this->db->where("status", 1)->get("tbl_acgroups")->result();
@ -65,8 +84,20 @@ class Reports extends CI_Controller
loadView("accounts/trialbalance", $data);
break;
case 'trialbalance':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// echo "<pre>"; print_r($data); die();
$data['pageTitle'] = "Trial Balance";
loadView("accounts/trialbalance_new", $data);
break;
@ -132,8 +163,17 @@ class Reports extends CI_Controller
loadView("accounts/pl", $data);
break;
case 'pl':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Profit & Loss Statement";
loadView("accounts/pl_new", $data);
break;
@ -147,8 +187,20 @@ class Reports extends CI_Controller
loadView("accounts/balancesheet", $data);
break;
case 'balance_sheet':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Balance Sheet";
loadView("accounts/balancesheet_new", $data);
break;
@ -157,8 +209,20 @@ class Reports extends CI_Controller
loadView("accounts/balance_sheet_vertical", $data);
break;
case 'cash_flow':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow";
loadView("accounts/cash_flow", $data);
break;
@ -171,8 +235,22 @@ class Reports extends CI_Controller
loadView("accounts/incomes_expenses", $data);
break;
case 'receipt_and_payment':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
// $data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
// $data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Cash Flow";
loadView("accounts/receipt_and_payment", $data);
break;
@ -209,8 +287,6 @@ class Reports extends CI_Controller
case 'getledgersummary':
$account_id = $this->uri->segment(5);
$this->myaccounts->showLedger($account_id);
break;
case 'default':
//show_404();

View File

@ -50,6 +50,7 @@ class Purchases extends CI_Controller
'items_id' => $item,
'qty' => $_POST['quantity'][$a],
'rate' => $_POST['rate'][$a],
'vat' => $_POST['vat'][$a],
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'remarks' => '',
@ -76,8 +77,8 @@ class Purchases extends CI_Controller
'remarks' => filter_var($_POST['remarks']),
'status' => 1,
);
pre($_POST);
die;
// pre($_POST);
// die;
//$this->db->insert('tbl_purchases', $TableData);
redirect("inventory/purchases/list");
}
@ -93,7 +94,21 @@ class Purchases extends CI_Controller
redirect("inventory/purchases/list");
break;
case 'purchase_register':
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords();
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Sales & Register";
$data['PurchaseRecords'] = $this->MPurchases->getPurchaseRecords($data['fiscalStart'],$data['fiscalEnd']);
loadView("inventory/purchases/register", $data);
break;

View File

@ -12,14 +12,17 @@ class Reports extends CI_Controller
}
public function _remap($alias = "", $params = array())
{
// dd($this->session);
$data['dataValue'] = $this->session;
$data['pageTitle'] = "Sales";
$datas['fiscalStart'] =NepaliDate($this->session->FiscalYear->fiscalyear_from);
$datas['fiscalEnd'] =NepaliDate($this->session->FiscalYear->fiscalyear_to);
switch ($alias) {
case 'purchase_vs_sales':
$data['StockRecords']=$this->MStocks->getStockRecords();
$data['PurchaseDetails'] = $this->MPurchases->getItemPurchases();
$data['SalesDetails'] = $this->MSales->getItemSales();
$data['StockItems'] = $this->MStocks->getStockSummary();
$data['StockItems'] = $this->MStocks->getStockSummary($datas);
loadview("inventory/reports/purchase_vs_sales", $data);
break;
default:

View File

@ -44,12 +44,13 @@ class Sales extends CI_Controller
// print_r($_POST);die;
foreach ($_POST['item_id'] as $item) {
if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0) :
if ($item != 0 || $_POST['qty'][$i] != 0 || $_POST['rate'][$i] != 0 || $_POST['vat'][$i] != 0) :
$TableData = array(
'sales_id' => $sales_id,
'items_id' => $item,
'qty' => $_POST['qty'][$i],
'rate' => $_POST['rate'][$i],
'vat' => $_POST['vat'][$i],
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'status' => 1,
@ -67,7 +68,21 @@ class Sales extends CI_Controller
redirect("inventory/sales/list");
break;
case 'sales_register':
$data['SalesRecords'] = $this->MSales->getSalesRecords();
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['pageTitle'] = "Sales & Register";
$data['SalesRecords'] = $this->MSales->getSalesRecords($data['fiscalStart'],$data['fiscalEnd']);
loadView("inventory/sales/register", $data);
break;
case 'details':
@ -114,7 +129,6 @@ class Sales extends CI_Controller
$data['SalesRecords'] = $this->MSales->getSalesRecords();
loadView("inventory/sales/list", $data);
}
}

View File

@ -6,10 +6,18 @@ class Stocks extends CI_Controller
{
parent::__construct();
$this->load->model('MStocks');
checkLogin();
$this->load->helper('form');
// checkLogin();
}
public function _remap($alias = "", $params = array())
{
// echo "<pre>"; var_dump($alias = "", $params = array()); die();
// echo "<pre>"; var_dump($alias,$this->input->post('fromDate'),$this->input->post('stocklocations_id'),$this->input->post('toDate')); die();
// var_dump(($_POST['stocklocations_id']));die();
$data['dataValue'] = $this->session;
$data['pageTitle'] = "Inventory Stock";
switch ($alias) {
@ -57,10 +65,28 @@ class Stocks extends CI_Controller
loadView("inventory/stocks/add", $data);
break;
case 'summary':
$data['fiscalStart'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliDate($this->session->userdata['FiscalYear']->fiscalyear_to);
$data['StockRecords'] = $this->MStocks->getStockSummary();
// pre($data['StockRecords']);
if (!isset($_POST['stocklocations_id'])) {
$data['stocklocations_id'] = null;
}
if (!isset($_POST['fromDate'])) {
$data['fromDate'] = null;
}
if (!isset($_POST['toDate'])) {
$data['toDate'] = null;
}
if (isset($_POST)) {
$data = $_POST;
}
$data['pageTitle'] = "Inventory Stock";
$data['fiscalStart'] = NepaliToEnglishDate($data['fromDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_from);
$data['fiscalEnd'] = NepaliToEnglishDate($data['toDate'] ?? $this->session->userdata['FiscalYear']->fiscalyear_to);
$data['StockRecords'] = $this->MStocks->getStockSummary($data);
loadView("inventory/stocks/summary", $data);
break;
case 'delete':
@ -70,8 +96,24 @@ class Stocks extends CI_Controller
redirect("inventory/stocks/list");
break;
default:
// var_dump("hello");
// die();
// echo '<pre>';
// var_dump($_POST['fromDate'], $_POST['toDate']);
// die();
$data['StockRecords'] = $this->MStocks->getStockRecords();
loadView("inventory/stocks/list", $data);
}
}
// public function summary()
// {
// var_dump("hello");
// die();
// echo '<pre>';
// var_dump($_POST['stocklocations_id'], $_POST['fromDate'], $_POST['toDate']);
// die();
// $data['StockRecords'] = $this->MStocks->getStockSummary($_POST['stocklocations_id'] = 0, $_POST['fromDate'], $_POST['toDate']);
// // echo "<pre>", var_dump($data['StockRecords']); die();
// loadView("inventory/stocks/summary", $data);
// }
}

View File

@ -80,7 +80,7 @@ function linkVoucher($voucher_id)
$ci = &get_instance();
$Voucher = $ci->db->where("voucher_id", $voucher_id)->get("tbl_vouchers")->row();
$Name = $ci->db->where("vouchertype_id", $Voucher->voucher_type)->get("tbl_vouchertypes")->row()->voucher_type . " Voucher # " . $Voucher->voucher_no;
echo "<a class='link' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
echo "<a class='open-modal' target='_blank' href='" . site_url("accounts/vouchers/show_voucher/" . $voucher_id) . "'>$Name</a>";
} else {
echo "";
}

View File

@ -98,6 +98,68 @@ class bibaccounts
return $result;
}
// new function
function getAccountGroupsWithBalancesNew($acgroup_id = null, $fiscalStart = null, $fiscalEnd = null)
{
$CI = &get_instance();
$result = [];
$whereClause = "";
if ($acgroup_id !== null) {
$whereClause = "WHERE acgroup_id = '$acgroup_id' AND status=1 AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' ";
}
$t = "SELECT * FROM `tbl_acgroups` $whereClause";
$accountGroups = $CI->db->query($t)->result();
foreach ($accountGroups as $group) {
$t = "SELECT * FROM tbl_accounts
WHERE (accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')
OR accategory_id IN (SELECT parent_category_id FROM tbl_accategories WHERE accategory_id IN (SELECT accategory_id FROM tbl_accategories WHERE acgroup_id = '{$group->acgroup_id}')))
AND status <> -1";
$accounts = $CI->db->query($t)->result();
$group->dr_total = 0;
$group->cr_total = 0;
$group->regular_balance_dr = 0;
$group->regular_balance_cr = 0;
$group->opening_balance_dr = 0;
$group->opening_balance_cr = 0;
foreach ($accounts as $account) {
$accountBalances = $this->getAccountBalances($account->account_id);
// pre($accountBalances);die;
$group->opening_balance_dr += $accountBalances['opening_balance_dr'];
$group->opening_balance_cr += $accountBalances['opening_balance_cr'];
$group->dr_total += $accountBalances['dr_total'];
$group->cr_total += $accountBalances['cr_total'];
$group->regular_balance_dr += $accountBalances['regular_balance_dr'];
$group->regular_balance_cr += $accountBalances['regular_balance_cr'];
$account->balances = $accountBalances;
}
if (
$group->dr_total > 0 &&
$group->cr_total > 0 &&
$group->regular_balance_dr > 0 &&
$group->regular_balance_cr > 0 &&
$group->opening_balance_dr > 0 &&
$group->opening_balance_cr > 0
) $group->isZero = 1;
else $group->isZero = 0;
$group->opening_balance = ($group->posting_side == "DR") ? $group->opening_balance_dr - $group->opening_balance_cr : $group->opening_balance_cr - $group->opening_balance_dr;
$group->closing_balance = ($group->posting_side == "DR") ? $group->dr_total - $group->cr_total : $group->cr_total - $group->dr_total;
$group->regular_balance = ($group->posting_side == "DR") ? $group->regular_balance_dr - $group->regular_balance_cr : $group->regular_balance_cr - $group->regular_balance_dr;
$group->accounts = $accounts;
$result[] = $group;
}
// pre($result);die;
return $result;
}
// new function ends
function getAccountCategoriesWithBalances($acgroup_id = null, $accategory_id = null)
{
@ -578,7 +640,51 @@ class bibaccounts
'regular_balance_cr' => $regularBalanceCr,
);
}
function getAccountBalancesNew($account_id, $fiscal_year_id = "", $branch_id = "",$fiscalStart = null, $fiscalEnd = null)
{
$fiscal_year_id = ($fiscal_year_id == "") ? $this->FY : $fiscal_year_id;
$branch_id = ($branch_id == "") ? $this->Branch : $branch_id;
$CI = &get_instance();
$query = $CI->db->query("SELECT SUM(dr) AS dr_total, SUM(cr) AS cr_total FROM tbl_voucherdetails WHERE account_id='$account_id' AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id' AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' ");
$result = $query->row();
echo "<pre>";print_r($result);die();
$drTotal = $result->dr_total;
$crTotal = $result->cr_total;
$posting_side = $CI->db->query("SELECT posting_side FROM tbl_acgroups WHERE acgroup_id=(SELECT acgroup_id FROM tbl_accategories WHERE accategory_id=(SELECT accategory_id FROM tbl_accounts WHERE account_id='$account_id'))")->row()->posting_side;
$drBalance = 0;
$crBalance = 0;
if ($posting_side == "DR") {
$drBalance = $drTotal - $crTotal;
} else {
$crBalance = $crTotal - $drTotal;
}
$openingBalanceQuery = $CI->db->query("SELECT SUM(dr) AS opening_balance_dr, SUM(cr) AS opening_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id=0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
$openingBalanceResult = $openingBalanceQuery->row();
$openingBalanceDr = $openingBalanceResult->opening_balance_dr;
$openingBalanceCr = $openingBalanceResult->opening_balance_cr;
$regularBalanceQuery = $CI->db->query("SELECT SUM(dr) AS regular_balance_dr, SUM(cr) AS regular_balance_cr FROM tbl_voucherdetails WHERE account_id='$account_id' AND voucher_id<>0 AND status=1 AND fiscalyear_id='$fiscal_year_id' AND branch_id='$branch_id'");
$regularBalanceResult = $regularBalanceQuery->row();
$regularBalanceDr = $regularBalanceResult->regular_balance_dr;
$regularBalanceCr = $regularBalanceResult->regular_balance_cr;
return array(
'dr_total' => $drTotal,
'cr_total' => $crTotal,
'dr_balance' => $drBalance,
'cr_balance' => $crBalance,
'opening_balance_dr' => $openingBalanceDr,
'opening_balance_cr' => $openingBalanceCr,
'regular_balance_dr' => $regularBalanceDr,
'regular_balance_cr' => $regularBalanceCr,
);
}
//////
@ -586,7 +692,7 @@ class bibaccounts
{
if (!isset($ReportOptions['AmountColWidth'])) $ReportOptions['AmountColWidth'] = 180;
?>
<table class="table table-sm table-accounts">
<table id='myTable'class="table table-sm table-accounts">
<?php if ($displayHeadings) { ?>
<thead>
<tr>
@ -608,7 +714,8 @@ class bibaccounts
<?php } ?>
<tbody>
<?php foreach ($accountCategories as $accountCategory) : ?>
<?php //print_r($accountCategory);die; ?>
<?php //print_r($accountCategory);die;
?>
<?php if ($ReportOptions['showZeroBalances'] && $accountCategory->isZero == true) continue; ?>
<tr class="<?php echo ($accountCategory->isParent) ? ' parent-row' : ''; ?>" data-toggle="collapse" data-target="#accategory_<?php echo $accountCategory->accategory_id; ?>">
<td class="group-name">
@ -817,14 +924,14 @@ class bibaccounts
/*
* Retrieves the account groups and accounts with balances that has cash/bank in debit side
*/
function getIncomeAndExpenditure()
function getIncomeAndExpenditure($fiscalStart,$fiscalEnd)
{
$CI = &get_instance();
#2 >> Bank Accounts
#3 >> Cash Accounts
$Incomes = array();
$Expenses = array();
$t = "select * from tbl_voucherdetails where voucher_id in (select voucher_id from tbl_voucherdetails where voucher_id<>0 and account_id in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)) and account_id not in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)";
$t = "select * from tbl_voucherdetails where voucher_id in (select voucher_id from tbl_voucherdetails where voucher_id<>0 and account_id in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)) AND created_on >= '$fiscalStart' AND created_on >= '$fiscalEnd' and account_id not in (select account_id from tbl_accounts where accategory_id=2 or accategory_id=3)";
$accounts = $CI->db->query($t)->result();
foreach ($accounts as $account) {
$account->details = $CI->db->query("select * from tbl_accounts where account_id=" . $account->account_id)->row();
@ -959,9 +1066,9 @@ class bibaccounts
return $sides;
}
function prepareIncomeExpenses()
function prepareIncomeExpenses($fiscalStart,$fiscalEnd)
{
$cashFlow = $this->getIncomeAndExpenditure();
$cashFlow = $this->getIncomeAndExpenditure($fiscalStart,$fiscalEnd);
$a = 0;
foreach ($cashFlow as $side) :
$Groups = array();

View File

@ -801,8 +801,4 @@ class bibaccounts
<?php
}
//////
}

View File

@ -129,7 +129,8 @@ class myaccounts
{
$CI = &get_instance();
$Account = $CI->db->query("select * from tbl_accounts where account_id='$account_id'")->row();
$Account->Balance = $this->getBalance($account_id);
// $Account->Balance = $this->getBalance($account_id);
// echo"<pre>";print_r($Account); die();
return $Account;
}
function getBalance($account_id)
@ -179,7 +180,6 @@ class myaccounts
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
}
//$q=$CI->db->get_compiled_select();
//print($q);
?>
<div class="row mb-3">
<?php if ($accategory_id == "") : ?>
@ -630,6 +630,7 @@ class myaccounts
window.location = '<?php echo site_url("accounts/accountheads/delete/"); ?>' + id;
}
}
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/accountheads/getdetails/"); ?>" + id,
@ -681,14 +682,19 @@ class myaccounts
?>
<div class="card-primary card-outline ">
<div class="card-header">
<h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?> <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a></h5>
<h5 class="m-0">Leger for Account : <?php echo $Account->account_name; ?>
<!-- <a href="<?php echo site_url("accounts/ledger/print/" . $Account->account_id . "/?" . $_SERVER['QUERY_STRING']); ?>" class="btn btn-success btn-sm float-right">Print</a> -->
<button type="submit" id="downloadCsv1" class="btn btn-warning btn-sm ">
Export csv
</button>
</h5>
</div>
<div class="card-body p-0 mb-20" id="printableDiv">
<h3 class="text-center"><?php echo $ci->session->userdata("CompanyName"); ?></h3>
<h5 class="text-center">Ledger Details for <?php echo $Account->account_name; ?> </h5>
<?php $TableData = $Transactions; ?>
<?php $TotalCols = 7; ?>
<table class="table table-bordered table-head-fixed text-nowrap table-striped ">
<table id='myTable1' class="table table-bordered table-head-fixed text-nowrap table-striped ">
<thead>
<tr>
<th class="col-1"><?php myLang("Date"); ?></th>
@ -762,6 +768,74 @@ class myaccounts
</tr>
</tfoot>
</table>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">Modal Title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" id="modal-body">
<!-- Content loaded via AJAX will go here -->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
$(document).ready(function() {
$('.open-modal').click(function(e) {
e.preventDefault(); // Prevent the default link behavior
const url = $(this).attr('href'); // Get the URL from the link
$('#modal-body').load(url, function() {
$('#myModal').modal('show'); // Show the modal after loading content
});
});
});
</script>
<script>
document.getElementById('downloadCsv1').addEventListener('click', function() {
const table = document.getElementById('myTable1');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<!-- <div class="container ">
<div class="row mt-100 ">
<div class="col-2"><span class="underline-text"><?php echo $ci->session->userdata("loggedUser"); ?></span></div>
@ -800,7 +874,8 @@ class myaccounts
$CI = &get_instance();
$CI->load->library("numbertoword");
$ledgerData = $this->getLedgerData($account_id, $fromDate, $toDate);
$file = APPPATH . "/../pdf/e_ledger1.pdf";
$file = APPPATH . "/../pdf/
.pdf";
$pdf = new FPDM($file);
$i = 0;
$crTotal = 0;
@ -1018,9 +1093,11 @@ class myaccounts
<!-- <td><?php echo $TableRow->voucher_state; ?></td> -->
<td class="col-1 text-center">
<a onClick="javascript:showDetails(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-success btn-xs" title="View Details"><i class="fa fa-eye"></i></a>
<!-- <a onClick="javascript:showDetails(<?php //echo $TableRow->voucher_id; ?>);" class="btn btn-info btn-xs" title="View Details"><i class="fas fa-edit"></i></a> -->
<!-- <a onClick="javascript:showDetails(<?php //echo $TableRow->voucher_id;
?>);" class="btn btn-info btn-xs" title="View Details"><i class="fas fa-edit"></i></a> -->
<a onClick="javascript:showPDF(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-primary btn-xs" title="View PDF"><i class="fa fa-file-pdf"></i></a>
<?php //print_r($ci->session->userdata());die; ?>
<?php //print_r($ci->session->userdata());die;
?>
<?php if ($ci->session->userdata('LoggedUser') != 'admin'): ?>
<a onClick="javascript:deleteVoucher(<?php echo $TableRow->voucher_id; ?>);" class="btn btn-danger btn-xs" title="Delete Voucher"><i class="fa fa-trash"></i></a>
<?php endif; ?>
@ -1073,6 +1150,7 @@ class myaccounts
}
});
}
function showDetails(id) {
$.ajax({
url: "<?php echo site_url("accounts/vouchers/voucherdetails/"); ?>" + id,
@ -1083,6 +1161,7 @@ class myaccounts
}
});
}
function reversalEntry() {
var id = $("#reversalBtn").data("id");
if (confirm("Are you sure you want to post reversal for this voucher?")) {
@ -1108,6 +1187,7 @@ class myaccounts
row.child(Transactions).show();
});
});
function getVoucherDetails(id) {
$.data;
$.ajax({
@ -1119,6 +1199,7 @@ class myaccounts
});
return ($.data);
}
function deleteVoucher(id) {
// Show confirmation dialog
if (confirm("Are you sure you want to delete this voucher?")) {

View File

@ -39,9 +39,9 @@ class MPurchases extends CI_Model
}
return $PurchaseRecords;
}
public function getPurchaseRecords()
public function getPurchaseRecords($fromDate, $toDate)
{
$PurchaseRecords = $this->db->where("status", 1)->get("tbl_purchases")->result();
$PurchaseRecords = $this->db->where("status", 1)->where("created_on between '$fromDate' AND '$toDate'")->get("tbl_purchases")->result();
foreach ($PurchaseRecords as $PurchaseRecord) {
$PurchaseRecord->Details = $this->getPurchaseDetails($PurchaseRecord->purchase_id);
$PurchaseRecord->TotalPurchase = $this->getTotalPurchaseAmount($PurchaseRecord->purchase_id);

View File

@ -39,9 +39,9 @@ class MSales extends CI_Model
}
return $SalesRecords;
}
public function getSalesRecords()
public function getSalesRecords($fromDate, $toDate)
{
$SalesRecords = $this->db->where("status", 1)->get("tbl_sales")->result();
$SalesRecords = $this->db->where("status", 1)->where("created_on between '$fromDate' AND '$toDate'")->get("tbl_sales")->result();
foreach ($SalesRecords as $SalesRecord) {
$SalesRecord->Details = $this->getSalesDetails($SalesRecord->sales_id);
$SalesRecord->totalsales = $this->getTotalSalesAmount($SalesRecord->sales_id);

View File

@ -151,8 +151,9 @@ class MStocks extends CI_Model
$Item->Closing = $this->getClosingStock($item_id);
return $Item;
}
public function getStockSummary($stocklocation_id = 0)
public function getStockSummary($data)
{
$stocklocation_id = $data['stocklocation_id'] ?? null;
$this->db->where("status", 1);
if ($stocklocation_id != 0) {
$this->db->where("stocklocations_id", $stocklocation_id);
@ -160,9 +161,19 @@ class MStocks extends CI_Model
$StockRecords = $this->db->select("distinct(items_id) as items_id")->get("tbl_stocks")->result();
foreach ($StockRecords as $StockRecord) {
$StockRecord->Summary = $this->getStockItemSummary($StockRecord->items_id);
// $StockRecord->StockLocation = $this->db->where("stocklocation_id", $StockRecord->stocklocations_id)->get("tbl_stocklocations")->row();
$StockRecord->Item = $this->db->where("item_id", $StockRecord->items_id)->get("tbl_items")->row();
$this->db->where("stocklocation_id ", $StockRecord->Summary->stocklocations_id);
$query1 = $this->db->get("tbl_stocklocations");
$result2 = $query1->result();
$StockRecord->StockLocation = $result2;
//tbl_items
$this->db->where('created_on >=', date('Y-m-d', (strtotime($data['fiscalStart']))));
$this->db->where('created_on <=', date('Y-m-d', (strtotime($data['fiscalEnd']))));
$this->db->where('item_id', $StockRecord->items_id);
$query3 = $this->db->get('tbl_items');
$result3 = $query3->result();
$StockRecord->Item = $result3;
}
return $StockRecords;
}
public function getStockRecords($stocklocation_id = 0)
@ -215,6 +226,5 @@ class MStocks extends CI_Model
$Item = $this->db->where("item_id", $id)->get("tbl_items")->row();
$Unit = $this->db->where("unit_id", $Item->units_id)->get("tbl_units")->row();
return $Unit;
}
}

View File

@ -24,7 +24,7 @@ function buildCategoryTree($categories, $parent_id = 0, $showZero = true)
}
function displayCategoryTree($tree)
{
echo '<table class="table table-bordered">';
echo '<table id="myTable" class="table table-bordered">';
echo '<thead>';
echo '<tr>';
echo '<th>Sn</th>';
@ -128,6 +128,41 @@ echo $html;
});
}
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
</div>
<!-- /.content -->

View File

@ -103,6 +103,7 @@ $BIBAccounts = new BIBAccounts();
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
@ -115,7 +116,7 @@ $BIBAccounts = new BIBAccounts();
<div class="card-header">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action=<?php echo base_url('accounts/reports/balance_sheet'); ?> id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
@ -160,8 +161,11 @@ $BIBAccounts = new BIBAccounts();
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
</div>
@ -203,11 +207,11 @@ $BIBAccounts = new BIBAccounts();
'showPeriod' => false,
);
?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
<?php $Side1Total = 0; ?>
<div class="col-6 p-0 m-0 gy-0">
<div class="table-responsive">
<table class="table mb-0 pb-0">
<table id='myTable' class="table mb-0 pb-0">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
@ -216,7 +220,7 @@ $BIBAccounts = new BIBAccounts();
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(2); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(2, $fiscalStart, $fiscalEnd); ?>
<?php $Side1Total = 0; ?>
<?php
// Initialize variables for column totals
@ -245,7 +249,7 @@ $BIBAccounts = new BIBAccounts();
$Side1Total += $group->closing_balance;
?>
<?php endforeach; ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(5); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(5, $fiscalStart, $fiscalEnd); ?>
<?php
// Initialize variables for column totals
@ -291,7 +295,7 @@ $BIBAccounts = new BIBAccounts();
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(1); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(1, $fiscalStart, $fiscalEnd); ?>
<?php
// Initialize variables for column totals
@ -334,8 +338,8 @@ $BIBAccounts = new BIBAccounts();
</div>
<?php
// pre($BIBAccounts->getAccountGroupsWithBalances(4));
$TotalIncomes = $BIBAccounts->getAccountGroupsWithBalances(3)[0]->closing_balance;
$TotalExpenses = $BIBAccounts->getAccountGroupsWithBalances(4)[0]->closing_balance;
$TotalIncomes = ($BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
$TotalExpenses = ($BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd)[0]->closing_balance) ?? 0;
$PL = $TotalIncomes - $TotalExpenses;
$Side1Total += $PL;
?>
@ -512,5 +516,42 @@ $BIBAccounts = new BIBAccounts();
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}

View File

@ -110,13 +110,21 @@ $PL = $IncomesTotal - $ExpensesTotal;
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.card-body.p-0 .table tbody>tr>td:last-of-type, .card-body.p-0 .table tbody>tr>th:last-of-type, .card-body.p-0 .table tfoot>tr>td:last-of-type, .card-body.p-0 .table tfoot>tr>th:last-of-type, .card-body.p-0 .table thead>tr>td:last-of-type, .card-body.p-0 .table thead>tr>th:last-of-type {
.card-body.p-0 .table tbody>tr>td:last-of-type,
.card-body.p-0 .table tbody>tr>th:last-of-type,
.card-body.p-0 .table tfoot>tr>td:last-of-type,
.card-body.p-0 .table tfoot>tr>th:last-of-type,
.card-body.p-0 .table thead>tr>td:last-of-type,
.card-body.p-0 .table thead>tr>th:last-of-type {
padding-right: 0 !important;
}
.text-bold {
font-weight: 900;
}
@ -129,7 +137,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<h3 class="card-title mt-1">Cash Flow<?php //echo $pageTitle;
?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action=<?php echo base_url('accounts/reports/cash_flow'); ?> id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
@ -178,8 +186,12 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
@ -264,12 +276,14 @@ $PL = $IncomesTotal - $ExpensesTotal;
<h4 class="card-title">Cash Flow</h4>
</div> -->
<div class="card-body table-responsive p-0">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd);
// echo "<pre>";print_r($IncomesExpenses); die();
?>
<table class="table table-bordered p-0 ">
<table id='myTable' class="table table-bordered p-0 ">
<thead>
<tr>
<th class="" width="30%"><?php myLang("Cash inflow"); ?></th>
@ -461,4 +475,40 @@ $PL = $IncomesTotal - $ExpensesTotal;
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php } ?>

View File

@ -61,8 +61,11 @@
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
@ -107,3 +110,39 @@
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('voucherList1');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -0,0 +1,70 @@
<div class="card-body">
<div class="row">
<div class="col">
<div id="dataTable_wrapper">
<?php //$this->myaccounts->getAllAccountsTable(3);
?>
<?php
$accategory_id = 3;
$CI = &get_instance();
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
$CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
$CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result();
foreach ($Accounts as $Account) {
$Account->Group = $CI->db->query("select * from tbl_acgroups where acgroup_id=(select acgroup_id from tbl_accategories where accategory_id = $Account->accategory_id)")->row();
$Account->Category = $CI->db->query("select * from tbl_accategories where accategory_id = $Account->accategory_id")->row();
}
?>
<div class="row mb-3">
<!-- <div id="dataTable_commands" class="col text-right"></div> -->
</div>
<?php
$html = "";
$html .= "<table id='myTable' class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>";
$html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>";
$sn = 0;
$BalanceTotal = 0;
foreach ($Accounts as $Account) : $sn++;
$balance = getBalance($Account->account_id);
$BalanceTotal += $balance;
// pre($Account);
$html .= "<tr><td class='col-1 text-center'>" . $sn . "</td><td><a href='#' onClick='showLedger(" . $Account->account_id . ")'>" . $Account->account_name . "</a></td><td class='col-2'>" . $Account->Category->accategory_name . "</td><td class='col-1'>" . (($balance >= 0) ? myCurrency($balance) : "") . "</td><td class='col-1'>" . (($balance < 0) ? myCurrency(abs($balance)) : "") . "</td><td class='col-1'>" . (myCurrency($balance)) . "</td><td class=' text-center'><a title='Show Ledger' class='btn btn-info btn-xs ' onClick='showLedger(" . $Account->account_id . ")'><i class='fa fa-eye'></i></a></td></tr>";
endforeach;
$html .= "</tbody><tfoot>";
$html .= "<tr><th colspan=3 class='text-right'>Total</th><th class='text-right'>" . (($BalanceTotal > 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . (($BalanceTotal < 0) ? myCurrency(abs($BalanceTotal)) : "") . "</th><th class='text-right'>" . myCurrency($BalanceTotal) . "</th><th></th></tr>";
$html .= "</tfoot></table>\n";
$html .= " <div class=\"modal fade\" id=\"ledgerdetails_box\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"ledgerdetails_box\" aria-hidden=\"true\">
<div class=\"modal-dialog modal-xl\" role=\"document\">
<div class=\"modal-content\">
<div class=\"modal-header\">
<h5 class=\"modal-title\" id=\"exampleModalLabel\">Ledger Details</h5>
<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">
<span aria-hidden=\"true\">&times;</span>
</button>
</div>
<div class=\"modal-body\" id=\"details_container\">
Ledger Details Goes Here
</div>
<!--<div class=\"modal-footer\">
<button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Close</button>
<button type=\"button\" class=\"btn btn-success\" data-dismiss=\"modal\">Print</button>
</div>-->
</div>
</div>
</div>";
$html .= '<script>function showLedger(id) {$.ajax({url: \'';
$html .= site_url("accounts/reports/ajax/getledgersummary/");
$html .= '\' + id,success: function(data) {$(\'#ledgerdetails_box #details_container\').html(data);$(\'#ledgerdetails_box\').modal(\'show\');}});}</script>';
echo $html;
?>
</div>
</div>
</div>
</div>

View File

@ -16,6 +16,7 @@
<div class="col"><?php createButton("show_ledger", "Show Ledger", "show_ledger", "Submit", "btn btn-primary"); ?></div>
</div>
</form>
<button id="openModal" class="btn btn-primary">Open Modal</button>
</div>
</div>
<div class="card">
@ -46,6 +47,9 @@
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" data-dismiss="modal">Print</button>
<!-- <button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button> -->
</div>
</div>
</div>
@ -56,3 +60,39 @@
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -7,7 +7,7 @@
<div class="card-header disabled color-palette">
<h3 class="card-title mt-1"><?php echo $pageTitle; ?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action="<?php echo base_url('accounts/ledger/bank_book'); ?>" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
@ -56,9 +56,11 @@
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -90,7 +92,7 @@
$accategory_id = 3;
$CI = &get_instance();
$CI->db->where("status", 1)->where("accategory_id = 2");
$CI->db->where("status", 1)->where("accategory_id = 2")->where('created_on >=', date('Y-m-d', (strtotime($fiscalStart))))->where('created_on <=', date('Y-m-d', (strtotime($fiscalEnd))));
$CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result();
@ -106,7 +108,7 @@
<?php
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<table id='myTable'class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>";
$html .= "<tr><th class='text-center col-1'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1 '>Action</th></tr>";
$html .= "</thead><tbody>";
@ -231,6 +233,43 @@
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

View File

@ -56,9 +56,16 @@
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <button id="exportButton">Export to Excel</button> -->
<!-- <button class="btn btn-warning btn-sm " id="downloadBtn">Download CSV</button> -->
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -67,7 +74,7 @@
</div> -->
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<script>
function resetForm() {
@ -91,7 +98,7 @@
$CI = &get_instance();
// $CI->db->where("status", 1)->where("(accategory_id = 2 OR accategory_id = 3)");
$CI->db->where("status", 1)->where("accategory_id = 3");
$CI->db->where("status", 1)->where("accategory_id = 3")->where("created_on >= '$fiscalStart'")->where("created_on >= '$fiscalEnd'");
$CI->db->order_by("account_name ASC");
$Accounts = $CI->db->get("tbl_accounts")->result();
@ -107,7 +114,7 @@
<?php
$html = "";
$html .= "<table class='table table-bordered table-striped longdataTable'>";
$html .= "<table id='myTable' class='table table-bordered table-striped longdataTable'>";
$html .= "<thead>";
$html .= "<tr><th class='text-center' width='25'>Sn</th><th class='text-center'>Account</th><th class='text-center'>Account Group</th><th class='text-center'>Dr</th><th class='text-center'>Cr</th><th class='text-center'>Balance</th><th class='text-center col-1'>Action</th></tr>";
$html .= "</thead><tbody>";
@ -232,6 +239,44 @@
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

View File

@ -22,6 +22,8 @@
</div>
</div>
</div>
<?php function footerFunctions()
{
?>

View File

@ -17,7 +17,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<h5 class="m-0"><?php echo $pageTitle; ?> </h5>
</div>
<div class="card-body">
<table class="table table-bordered table-hover">
<table id='myTable'class="table table-bordered table-hover">
<thead>
<tr>
<th colspan="4">Profit & Loss Statement</th>
@ -95,7 +95,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
{
$total = 0;
?>
<table class="table table-bordered table-hover">
<table id='myTable' class="table table-bordered table-hover">
<thead>
<tr>
<th>Account</th>
@ -121,6 +121,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
</tr>
</tfoot> -->
</table>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}

View File

@ -108,10 +108,12 @@ $BIBAccounts = new BIBAccounts();
min-height: 1px;
padding: 0;
}
table {
border: 1px solid #ddd;
border-collapse: collapse;
}
.text-bold {
font-weight: 900;
}
@ -124,7 +126,7 @@ $BIBAccounts = new BIBAccounts();
<h2 class="card-title mt-1"><?php echo $pageTitle; ?> <?php //myLang("Report");
?></h2>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
@ -173,8 +175,14 @@ $BIBAccounts = new BIBAccounts();
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<!-- <button type="submit" onclick="exportTableToCSV('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
@ -195,6 +203,7 @@ $BIBAccounts = new BIBAccounts();
document.getElementById("FilterForm").submit();
}
</script>
</div>
</div>
</div>
@ -220,7 +229,7 @@ $BIBAccounts = new BIBAccounts();
?>
<div class="col-6 p-0">
<div class="table-responsive">
<table class="table ">
<table id='myTable' class="table">
<thead>
<tr>
<th class="group-name pl-1">Particulars</th>
@ -228,7 +237,7 @@ $BIBAccounts = new BIBAccounts();
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(3); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(3, $fiscalStart, $fiscalEnd); ?>
<?php
// Initialize variables for column totals
$incomes_totalOpeningDr = 0;
@ -263,18 +272,19 @@ $BIBAccounts = new BIBAccounts();
</tbody>
<tfoot>
<?php $PL = $incomes_totalClosingCr - $incomes_totalClosingDr; ?>
<tr>
<th class="p-1">Total Incomes</th>
<th class="cr closing-cr text-bold">
<td class="p-1">Total Incomes</th>
<td class="cr closing-cr text-bold">
<?php if ($PL > 0) : ?>
<?php echo myCurrency($incomes_totalClosingCr); ?>
<?php else : ?>
<?php echo myCurrency($incomes_totalClosingCr + abs($PL)); ?>
<?php endif; ?>
</th>
</tr>
</tfoot>
</table>
@ -290,7 +300,7 @@ $BIBAccounts = new BIBAccounts();
</tr>
</thead>
<tbody>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(4); ?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalancesNew(4, $fiscalStart, $fiscalEnd); ?>
<?php
// Initialize variables for column totals
$totalOpeningDr = 0;
@ -434,6 +444,42 @@ function footerfunctions()
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

View File

@ -104,7 +104,7 @@ $PL = $IncomesTotal - $ExpensesTotal;
<h3 class="card-title mt-1">Receipts And Payments <?php //echo $pageTitle;
?> </h3>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action=<?php echo base_url('accounts/reports/receipt_and_payment'); ?> id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
@ -153,8 +153,11 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
@ -183,31 +186,38 @@ $PL = $IncomesTotal - $ExpensesTotal;
<div class="row align-items-end">
<div class="col-2">
<div class="form-group">
<label for="fromDate"><?php //myLang("Starting Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
<label for="fromDate"><?php //myLang("Starting Period");
?></label>
<input type="text" class="form-control nepaliDatePicker" name="fromDate" value="<?php //echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from);
?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
</div>
<div class="col-2">
<div class="form-group">
<label for="toDate"><?php //myLang("Ending Period"); ?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
<label for="toDate"><?php //myLang("Ending Period");
?></label>
<input type="text" class="form-control nepaliDatePicker" name="toDate" value="<?php //echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to);
?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showOB"><?php //myLang("Opening"); ?></label>
<label for="showOB"><?php //myLang("Opening");
?></label>
<input type="checkbox" class="form-control " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showClosing"><?php //myLang("Closing"); ?></label>
<label for="showClosing"><?php //myLang("Closing");
?></label>
<input type="checkbox" class="form-control " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
<div class="col-1 text-center">
<div class="form-group">
<label for="showPeriod"><?php //myLang("Period"); ?></label>
<label for="showPeriod"><?php //myLang("Period");
?></label>
<input type="checkbox" class="form-control " name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
</div>
</div>
@ -234,8 +244,8 @@ $PL = $IncomesTotal - $ExpensesTotal;
</div>
<div class="card">
<div class="card card-primary card-outline">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses() ?>
<table class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
<?php $IncomesExpenses = $BIBAccounts->prepareIncomeExpenses($fiscalStart, $fiscalEnd) ?>
<table id='myTable' class="table table-head-fixed table-bordered g-0" id="TrialBalanceTable">
<thead>
<tr>
<th class="" width="30%"><?php myLang("Receipts"); ?></th>
@ -422,4 +432,41 @@ $PL = $IncomesTotal - $ExpensesTotal;
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php } ?>

View File

@ -1,6 +1,7 @@
<?php
$this->load->library("BIBAccounts");
$BIBAccounts = new BIBAccounts();
?>
<!-- Include jQuery -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
@ -35,8 +36,7 @@ $BIBAccounts = new BIBAccounts();
}
.table t
.bg-darker {
.table t .bg-darker {
background-color: #ddd;
}
@ -74,6 +74,7 @@ $BIBAccounts = new BIBAccounts();
.underline {
text-decoration: underline;
}
.text-right {
padding-right: 5px;
}
@ -94,6 +95,7 @@ $BIBAccounts = new BIBAccounts();
box-shadow: inset 0 0 0 transparent;
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}
.bg-gray tr th {
vertical-align: middle;
}
@ -107,7 +109,7 @@ $BIBAccounts = new BIBAccounts();
?></h2>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<form method="post" action=<?php echo site_url('/Accounts/Reports/trialbalance'); ?> id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
@ -157,8 +159,11 @@ $BIBAccounts = new BIBAccounts();
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm" data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
@ -208,7 +213,7 @@ $BIBAccounts = new BIBAccounts();
$showZeroBalances = false;
?>
<?php $AccountGroups = $BIBAccounts->getAccountGroupsWithBalances(); ?>
<table class="table table-bordered vertical-borders" id="TrialBalanceTable">
<table id='myTable' class="table table-bordered vertical-borders" id="TrialBalanceTable">
<thead class="bg-gray">
<tr>
<th rowspan="2 class="">Particulars</th>
@ -390,6 +395,43 @@ function footerfunctions()
maxDate: $('#toDate').data('end'),
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

View File

@ -39,6 +39,80 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>plugins/bstreeview/css/bstreeview.min.css">
<link rel="stylesheet" href="<?php echo base_url(); ?>dist/css/bbnepalcustom.css">
<!-- CSV File create -->
<script>
// document.getElementById('downloadBtn').addEventListener('click', function() {
// const table = document.getElementById('myTable');
// const csvData = [];
// const rowCount = table.rows.length;
// const output = [];
// for (let i = 0; i < rowCount; i++) {
// const row = table.rows[i];
// const rowArray = [];
// let skipCell = 0;
// for (let j = 0; j < row.cells.length; j++) {
// const cell = row.cells[j];
// if (skipCell > 0) {
// skipCell--;
// continue; // Skip this cell due to rowspan
// }
// const cellContent = cell.textContent.trim();
// const colspan = cell.colSpan || 1;
// const rowspan = cell.rowSpan || 1;
// // Fill the rowArray for the colspan
// for (let k = 0; k < colspan; k++) {
// if (k === colspan - 1) {
// rowArray.push(cellContent); // Last cell of colspan gets content
// } else {
// rowArray.push(''); // Fill empty for additional colspan cells
// }
// }
// // Set skipCell to account for rowspan
// skipCell = rowspan - 1;
// // Ensure that the row length matches the maximum number of columns
// while (rowArray.length < output.length) {
// rowArray.push(''); // Fill empty cells
// }
// // Fill the output structure
// output[i] = rowArray;
// }
// }
// // Join rows for CSV format
// output.forEach(row => {
// const filledRow = row.map(cell => cell === undefined ? '' : cell);
// csvData.push(filledRow.join(','));
// });
// const csvContent = csvData.join('\n');
// const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
// const url = URL.createObjectURL(blob);
// const link = document.createElement('a');
// link.setAttribute('href', url);
// link.setAttribute('download', 'table_with_colspan_rowspan.csv');
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// });
</script>
<!-- csv printing ends -->
<!-- Override Defaults By Prajwal -->
<style>
body {
@ -301,12 +375,12 @@
}
}
.narration_display
{
.narration_display {
font-style: italic;
}
.text-bold .currency
{
.text-bold .currency {
font-weight: 600 !important;
}
</style>

View File

@ -1,7 +1,7 @@
<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light ">
<nav class="main-header navbar navbar-expand navbar-white navbar-light hidden-navbar ">
<!-- Left navbar links -->

View File

@ -14,7 +14,7 @@ $subparam2 = $this->uri->segment(4);
<!-- Sidebar user panel (optional) -->
<div class="user-panel mt-3 pb-3 mb-3 d-flex">
<div class="image"> <img src="<?php echo base_url(); ?>dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image"> </div>
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")->fiscalyear_year); ?>)</a></div>
<div class="info"> <a href="#" class="d-block"><?php echo $this->session->userdata("CompanyName"); ?> (<?php echo ($this->session->userdata("FiscalYear")?->fiscalyear_year); ?>)</a></div>
</div> <!-- SidebarSearch Form -->
<div class="form-inline pb-2">
<div class="input-group" data-widget="sidebar-search">
@ -50,14 +50,14 @@ $subparam2 = $this->uri->segment(4);
<!-- <li class="nav-item"><a href="<?php echo site_url("master/acgroups"); ?>" class="nav-link <?php echo ($param == "acgroups") ? "active" : ""; ?>">
<p>Account Types</p>
</a></li> -->
<li class="nav-item"><a href="<?php echo site_url("master/accategories/parent");
<!-- <li class="nav-item"><a href="<?php echo site_url("master/accategories/parent");
?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "parent") ||
($param == "accategories" && $subparam == "edit_parent") ||
($param == "accategories" && $subparam == "add_parent")
) ? "active" : "";
?>">
<p>Account Categories</p>
</a></li>
</a></li> -->
<li class="nav-item"><a href="<?php echo site_url("master/accategories/childs"); ?>" class="nav-link <?php echo (($param == "accategories" && $subparam == "childs") ||
($param == "accategories" && $subparam == "add_child") ||
($param == "accategories" && $subparam == "edit_child")

View File

@ -137,11 +137,14 @@
<td class="text-center"><?php echo $a; ?></td>
<td><?php echo $TableRow->title; ?></td>
<td><?php echo $TableRow->item_code; ?></td>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id); ?></td>
<td><?php echo number_format((int)getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->units_id),2); ?></td>
<td><?php echo getFieldfromValue("tbl_itemcategories", "title", "itemcategory_id", $TableRow->itemcategories_id); ?></td>
<td class="text-right"><?php echo $TableRow->Stock->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Stock->rate; ?></td>
<td class="text-right"><?php echo $TableRow->Stock->amount; ?></td>
<td class="text-right"><?php echo number_format((int)$TableRow->Stock->qty,2); ?></td>
<td class="text-right"><?php echo number_format((int)$TableRow->Stock->rate,2); ?></td>
<td class="text-right"><?php echo number_format((int)$TableRow->Stock->amount,2); ?></td>
<td class="text-center">
<?php showEditButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/edit/$id"); ?>
<?php showDeleteButton($id); ?>

View File

@ -143,6 +143,7 @@
<th class="text-right">Qty</th>
<th class="text-right">Units</th>
<th class="text-right">Rate</th>
<th class="text-right" width=13%>VAT<span class="text-danger">*</span></th>
<th class="text-right">Amount</th>
<th></th>
</tr>
@ -154,6 +155,8 @@
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
<td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
<td width=15%><input type="text" class="form-control" name="rate[]"></td>
<td><input type="number" name="vat[]" class="form-control vat" required></td>
<td width=15%><input type="text" class="form-control" name="total[]"></td>
<td width="5%">
<button type="button" class="btn btn-primary btn-xs addPurchaseDetail" id="addPurchaseDetail">
@ -174,9 +177,9 @@
<br>
<br>
<label for="vatToggle">VAT</label>
<input type="checkbox" id="vatToggle" checked>
<input type="hidden" id="vatToggleValue" name="vatToggleValue" value="1">
<label for="vatToggle" class="d-none">VAT</label>
<input class="d-none" type="checkbox" id="vatToggle" checked>
<input type="hidden" class="d-none" id="vatToggleValue" name="vatToggleValue" value="1">
</td>
<td class="text-right "><b>Total Amount</b></td>
<td class="text-right">
@ -198,11 +201,13 @@
</tr>
<tr>
<td class="text-right "><b>13% VAT</b></td>
<td class="text-right">
<td class="text-right d-none "><b>13% VAT</b></td>
<td class="text-right d-none">
<input type="text" class="form-control" name="tax" id="tax" />
</td>
<td></td>
<td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
</td>
</tr>
<tr>
<td class="text-right "><b>Grand Total Amount</b></td>
@ -404,7 +409,7 @@
calculateTotals();
});
// Calculate totals on change of rate or quantity
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate']", function() {
$(document).on("change", ".purchase-detail input[name^='quantity'], .purchase-detail input[name^='rate'],.purchase-detail input[name^='vat']", function() {
calculateRowTotal($(this).closest(".purchase-detail"));
calculateTotals();
});
@ -419,6 +424,9 @@
calculateTotals('amount');
});
});
function updateSerialNumbers(){
$('.purchase-detail').each(function(index){
$(this).find('.bbsn').text(index + 1);
@ -429,7 +437,15 @@
function calculateRowTotal(row) {
var quantity = parseFloat(row.find("input[name^='quantity']").val()) || 0;
var rate = parseFloat(row.find("input[name^='rate']").val()) || 0;
var total = quantity * rate;
var vat = parseFloat(row.find('input[name^="vat"]').val()) || 0;
//
var lineTotal = quantity * rate;
var vat_amt =(vat/100)*lineTotal;
var total =lineTotal + vat_amt ;
//
// var total = quantity * rate;
row.find("input[name^='total']").val(total.toFixed(2));
}
// Calculate totals
@ -453,18 +469,19 @@
// var discountamount = subtotal * (discountpercent/100);
var taxable = subtotal - discountamount;
var tax = 0;
if ($('#vatToggle').is(':checked')) {
tax = taxable * 0.13; // Include 13% VAT if checkbox is checked
}
var grandTotal = taxable + tax;
// if ($('#vatToggle').is(':checked')) {
// tax = taxable * 0.13; // Include 13% VAT if checkbox is checked
// }
// var grandTotal = taxable + tax;
var grandTotal = taxable;
$("#subtotal").val(subtotal.toFixed(2));
// $("#discount").val(discountamount.toFixed(2));
$("#taxable").val(taxable.toFixed(2));
$("#tax").val(tax.toFixed(2));
$("#grand_total").val(grandTotal.toFixed(2));
}
});
};
</script>
<?php function footerFunctions()

View File

@ -27,11 +27,12 @@
endforeach; ?><tr>
<td><?php echo $TableRow->purchase_ref; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
<td><b><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name ?? "")); ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
<span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_vat"><?php echo myLang("vat") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div>
<?php $l = 0;
@ -39,8 +40,9 @@
<div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
<span class="col item_rate"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_vat"><?php echo myCurrency($r->vat, true); ?></span>
<span class="col item_amount"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div>
<?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;">

View File

@ -5,11 +5,79 @@
<div class="col">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5>
<!-- <h5 class="m-0"><?php echo $pageTitle; ?> <?php showCreateButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/add", "Create New " . $pageTitle); ?></h5> -->
</div>
<form class="ml-4" method="post" action="<?php echo base_url('accounts/reports/pl'); ?>" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="dropdown-divider"></div>
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox">
<label class="form-check-label">Select
All</label>
</div> -->
<div class="form-check">
<!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label" for="showClosing">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div>
</div>
<div class="btn-group">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<!-- <button type="submit" onclick="exportTableToCSV('accounts_data.csv')" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
<div class="dropdown-divider"></div>
<a href="#" class="dropdown-item">View calendar</a>
</div> -->
</div>
<button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button>
</form>
<div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_purchases where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable">
<table class="table table-bordered table-striped dataTable" id="myTable">
<thead>
<tr>
<th width="3%" class="text-center"><?php myLang('S.N'); ?></th>
@ -22,12 +90,13 @@
</thead>
<tbody>
<?php $a = 0;
$n = 0;
foreach ($PurchaseRecords as $TableRow) : $a++;
$id = $TableRow->purchase_id; ?>
<tr>
<td><?php echo $TableRow->purchase_ref; ?></td>
<td><?php echo ++$n; ?></td>
<td><?php echo $TableRow->purchase_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></td>
<td><?php echo ($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""; ?></td>
<td><?php echo myCurrency($TableRow->TotalPurchase); ?></td>
<td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$id"); ?>
<?php showDeleteButton($id); ?>
@ -50,3 +119,40 @@
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -23,7 +23,7 @@
<div class="col">
<p><strong>Bill Number:</strong> <?php echo $Purchase->purchase_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Purchase->purchase_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name; ?></p>
<p><strong>Vendor:</strong> <?php echo (($this->myaccounts->getAccountDetails($Purchase->accounts_id)->account_name ?? "")); ?></p>
</div>
</div>
@ -40,6 +40,9 @@
<div class="col">
<p class="text-right"><strong>Price</strong></p>
</div>
<div class="col">
<p class="text-right"><strong>VAT</strong></p>
</div>
<div class="col">
<p class="text-right"><strong>Total</strong></p>
</div>
@ -58,7 +61,10 @@
<p><?php $rate=$PurchaseDetail->rate; echo myCurrency($rate); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
<p><?php $vat=$PurchaseDetail->vat; echo myCurrency($vat); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty*((100-$vat)/100); $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div>
</div>
</div>

View File

@ -45,7 +45,9 @@
<?php $PTotal = 0;
$a = 0;
foreach ($PurchaseDetails as $Purchase) : $a++; ?>
<?php// var_dump($Purchase->Item->title);die(); ?>
<tr>
<td><?php echo $a; ?></td>
<td><?php echo $Purchase->Item->title; ?></td>
<td class="text-right"><?php echo $Purchase->total_qty; ?></td>
@ -185,7 +187,8 @@
foreach ($StockItems as $Stock) : $a++; ?>
<tr>
<td class="text-center"><?php echo $a; ?></td>
<td><?php echo $Stock->Item->title; ?></td>
<?php //echo "<pre>";print_r($Stock->Summary->Item->title); die() ;?>
<td><?php echo $Stock->Summary->Item->title; ?></td>
<td><?php echo $Stock->Summary->Unit->title; ?></td>
<td class="text-right"><?php echo $oqty = $Stock->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo myCurrency($orate = $Stock->Summary->Opening->rate); ?></td>

View File

@ -49,6 +49,7 @@
<th width=50%>Items <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Qty <span class="text-danger">*</span></th>
<th class="text-center" width=5%>Units</th>
<th class="text-center" width=13%>VAT<span class="text-danger">*</span></th>
<th class="text-center" width=13%>Rate <span class="text-danger">*</span></th>
<th class="text-right" width=20%>Amount</th>
<th width=5%></th>
@ -65,7 +66,9 @@
</select></td>
<td> <input type="text" class="form-control input-group-sm" name="qty[]" required></td>
<td><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
<td><input type="number" name="vat[]" class="form-control vat" required></td>
<td><input type="text" class="form-control" name="rate[]" required></td>
<span class="total-price"></span>
<td><input type="text" class="form-control" name="ltotal[]" required></td>
<td>
<button type="button" class="btn btn-primary btn-xs add-row">
@ -98,10 +101,13 @@
<td></td>
</tr>
<tr>
<td class="text-right "><b>13% VAT</b></td>
<td class="text-right">
<td class="text-right d-none"><b><input type="checkbox" name="vat_checkbox" id="vat_checkbox"
>13% VAT</b></td>
<td class="text-right d-none">
<input type="text" class="form-control" id="tax">
<td></td>
<input type="hidden" name="vat_checkbox_value" id="vat_checkbox_value" value="0">
</tr>
<tr>
<td class="text-right "><b>Grand Total Amount</b></td>
@ -147,7 +153,7 @@
}
});
$(document).on('input', '.sales-detail-duplicator input[name^="qty"], .sales-detail-duplicator input[name^="rate"]', function() {
$(document).on('input', '.sales-detail-duplicator input[name^="qty"],.sales-detail-duplicator input[name^="vat"], .sales-detail-duplicator input[name^="rate"]', function() {
calculateLineTotal($(this).closest('tr'));
calculateTotals();
});
@ -161,7 +167,10 @@
calculateLineTotal($(this).closest("tr"));
calculateTotals('amount');
});
$(document).on("change", "input[name=vat_checkbox]", function() {
calculateLineTotal($(this).closest("tr"));
calculateTotals('vat');
});
function updateSerialNumbers() {
$('.purchase-detail').each(function(index) {
$(this).find('.bbsn').text(index + 1);
@ -172,9 +181,13 @@
function calculateLineTotal(row) {
var quantity = parseFloat(row.find('input[name^="qty"]').val());
var rate = parseFloat(row.find('input[name^="rate"]').val());
if (!isNaN(quantity) && !isNaN(rate)) {
var vat = parseFloat(row.find('input[name^="vat"]').val());
if (!isNaN(quantity) && !isNaN(rate) && !isNaN(vat)) {
var lineTotal = quantity * rate;
row.find("input[name^='ltotal[]']").val(lineTotal.toFixed(2));
var vat_amt =(vat/100)*lineTotal;
var ltotal =lineTotal + vat_amt ;
console.log(lineTotal,vat_amt,ltotal);
row.find("input[name^='ltotal[]']").val(ltotal.toFixed(2));
}
@ -239,25 +252,39 @@
});
var discountamount = 0;
var discountpercent = 0;
var tax_percentage =0;
if (type == 'amount') {
discountamount = parseFloat($("input[name='discount']").val());
discountpercent = (discountamount * 100) / subtotal;
$("#discountpercentage").val(discountpercent.toFixed(2));
} else if(type == 'vat'){
checkBox = $("input[name='vat_checkbox_value']").val();
if(checkBox == "0"){
// if(checkBox){
tax_percentage= 0.13;
$("input[name='vat_checkbox_value']").val('13');
}else{
tax_percentage =0;
$("input[name='vat_checkbox_value']").val('0');
}
// }
}
else {
discountpercent = parseFloat($("input[name='discountpercentage']").val());
discountamount = subtotal * (discountpercent / 100);
$("#discount").val(discountamount.toFixed(2));
}
var taxable = subtotal - discountamount;
var tax = taxable * 0.13;
var grandTotal = taxable + tax;
var tax = taxable * tax_percentage;
// var grandTotal = taxable + tax;
var grandTotal = taxable;
$('#subtotal').val(subtotal.toFixed(2));
$("#taxable").val(taxable.toFixed(2));
$('#tax').val(tax.toFixed(2));
$('#grandtotal').val(grandTotal.toFixed(2));
}
</script>
<?php function footerFunctions()

View File

@ -24,11 +24,12 @@
<tr>
<td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td><?php echo $TableRow->sales_date; ?></td>
<td><b><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?></b>
<td><b><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""); ?></b>
<div class="row ml-2 mr-2" style="border-bottom: 1px solid;">
<span class="col item_name"><?php echo myLang("Particulars") ?></span>
<span class="col item_qty"><?php echo myLang("Qty") ?></span>
<span class="col item_rate"><?php echo myLang("Rate") ?></span>
<span class="col item_vat"><?php echo myLang("VAT") ?></span>
<span class="col item_amount"><?php echo myLang("Amount") ?></span>
</div>
<?php $l = 0;
@ -36,8 +37,9 @@
<div class="row ml-2 mr-2">
<span class="col item_name"><?php echo $r->Item->title; ?></span>
<span class="col item_qty"><?php echo $r->qty; ?></span>
<span class="col item_rate text-right"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_amount text-right"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
<span class="col item_rate"><?php echo myCurrency($r->rate, true); ?></span>
<span class="col item_vat"><?php echo myCurrency($r->vat, true); ?></span>
<span class="col item_amount"><?php echo myCurrency($r->qty * $r->rate, true); ?></span>
</div>
<?php endforeach; ?>
<div class="row ml-2 mr-2" style="border-top: 1px dotted;">

View File

@ -6,13 +6,68 @@
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="m-0 card-title"><?php echo $pageTitle; ?> </h5><a href="<?php echo site_url($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/create"); ?>" class="btn btn-sm btn-primary float-right">Create New <?php echo $pageTitle; ?></a>
<!-- Filter Start -->
<form method="post" action="" id="FilterForm">
<!-- button with a dropdown -->
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
</button>
<div class="dropdown-menu" role="menu">
<div class="form-group p-2 pb-0">
<div class="col">
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
<input type="text" class="form-control " name="toDate" value="<?php echo (isset($_POST['toDate'])) ? $_POST['toDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_to); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="toDate" aria-describedby="helpId_toDate" placeholder="Ending Period">
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-check">
<!-- <input type="hidden" name="showOB" value="not"> -->
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
<input type="checkbox" class="form-check-input " name="showClosing" id="showClosing" aria-describedby="helpId_showClosing" placeholder="Show Closing Balance" <?php echo (isset($_POST['showClosing'])) ? "CHECKED" : ""; ?>>
<label class="form-check-label" for="showClosing">Closing</label>
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox" checked> -->
<input type="checkbox" class="form-check-input" name="showPeriod" id="showPeriod" aria-describedby="helpId_showPeriod" placeholder="Show Periodic Balance" <?php echo (isset($_POST['showPeriod'])) ? "CHECKED" : "CHECKED"; ?>>
<label class="form-check-label" for="showPeriod">Period</label>
</div>
</div>
<div class="dropdown-divider"></div>
<div class="form-group p-2 pb-0 text-right">
<button type="button" class="btn btn-info btn-sm " style="width:60px;height:30px;" onclick="resetForm()">Reset</button>
<button type="submit" class="btn btn-primary mr-2 btn-sm" style="width:60px;height:30px;">Search </button>
</div>
</div>
</div>
<div class="btn-group">
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
</div>
<!-- <button class="btn btn-secondary toggle-collapse btn-sm" id="toggleShowAll">Toggle Collapse</button> -->
</form>
<!-- Filter Ends -->
</div>
<div class="card-body">
<?php $TableData = $this->db->query("select * from tbl_sales where status=1")->result(); ?>
<table class="table table-bordered table-striped dataTable">
<table class="table table-bordered table-striped dataTable" id='myTable'>
<thead>
<tr>
<th class=" col-1 text-center"><?php myLang('ID'); ?></th>
<th class=" col-1 text-center"><?php myLang('Sales Voucher #'); ?></th>
<th class=" col-1 text-center"><?php myLang('Item'); ?></th>
<th class="col-1"><?php myLang('Date'); ?></th>
<th><?php myLang('Transaction'); ?></th>
<th class="table-col col-1 text-center"><?php myLang('Amount'); ?></th>
@ -20,11 +75,14 @@
</tr>
</thead>
<tbody>
<?php foreach ($SalesRecords as $TableRow) : ?>
<?php $n = 0; ?>
<?php foreach ($SalesRecords as $key => $TableRow) : ?>
<tr>
<td class="text-center"><?php echo ++$n; ?></td>
<td class="text-center"><?php echo $TableRow->sales_id; ?></td>
<td class="text-center"><?php echo ($TableRow->Details[$key]->Item->title) ?? ""; ?></td>
<td><?php echo $TableRow->sales_date; ?></td>
<td><?php echo $this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name; ?>
<td><?php echo (($this->myaccounts->getAccountDetails($TableRow->accounts_id)->account_name) ?? ""); ?>
</td>
<td><?php echo myCurrency($TableRow->totalsales); ?></td>
<td class="text-center"><?php showDetailsButton($this->uri->segment(1) . "/" . $this->uri->segment(2) . "/details/$TableRow->sales_id"); ?>
@ -48,3 +106,40 @@
</div>
</div>
</div>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->

View File

@ -23,7 +23,7 @@
<div class="col">
<p><strong>Bill Number:</strong> <?php echo $Sales->sales_id; ?></p>
<p><strong>Date:</strong> <?php echo dbDate($Sales->sales_date); ?></p>
<p><strong>Vendor:</strong> <?php echo $this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name; ?></p>
<p><strong>Vendor:</strong> <?php echo (($this->myaccounts->getAccountDetails($Sales->accounts_id)->account_name ?? "")); ?></p>
</div>
</div>
@ -40,6 +40,9 @@
<div class="col text-right">
<p><strong>Price</strong></p>
</div>
<div class="col text-right">
<p><strong>VAT</strong></p>
</div>
<div class="col text-right">
<p><strong>Total</strong></p>
</div>
@ -57,6 +60,9 @@
<div class="col">
<p><?php $rate=$SalesDetail->rate; echo myCurrency($rate); ?></p>
</div>
<div class="col">
<p><?php $vat=($SalesDetail->vat); echo myCurrency($vat); ?></p>
</div>
<div class="col">
<p><?php $ltotal=$rate*$qty; $total+=$ltotal; echo myCurrency($ltotal); ?></p>
</div>
@ -80,9 +86,11 @@
<?php //print_r($Purchase->vatToggle);die; ?>
<!-- <?php //if($Sales->vatToggle != 1): ?> -->
<p><strong>Taxable amount:</strong> <?php echo myCurrency($taxable,true); ?></p>
<p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p>
<!-- <p><strong>Tax (13%):</strong> <?php echo myCurrency($tax=($taxable*13)/100,true); ?></p> -->
<!-- <?php //endif; ?> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p>
<!-- <p><strong>Total:</strong> <?php echo myCurrency(($taxable+$tax),true); ?></p> -->
<p><strong>Total:</strong> <?php echo myCurrency(($taxable),true); ?></p>
</div>
</div>

View File

@ -94,8 +94,13 @@
?></a> -->
</h5>
<div class="card-tools">
<form method="post" action="" id="FilterForm">
<!-- test -->
<!-- test ends -->
<form method="post" action=<?php echo site_url('/Inventory/Stocks/summary'); ?> id="FilterForm">
<!-- button with a dropdown -->
<input type="hidden" name="stocklocations_id" value="1" />
<div class="btn-group">
<button type="button" class="btn btn-success btn-sm dropdown-toggle" data-toggle="dropdown" data-offset="-52">
Filters
@ -106,6 +111,8 @@
<div class="form-group">
<label for="fromDate"><?php myLang("Starting Period"); ?></label>
<input type="text" class="form-control " name="fromDate" value="<?php echo (isset($_POST['fromDate'])) ? $_POST['fromDate'] : NepaliDate($this->session->FiscalYear->fiscalyear_from); ?>" data-start="<?php echo $fiscalStart; ?>" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period">
<!-- <input type="text" class="form-control " name="fromDate" value="" data-end="<?php echo $fiscalEnd; ?>" id="fromDate" aria-describedby="helpId_fromDate" placeholder="Starting Period"> -->
</div>
<div class="form-group">
<label for="toDate"><?php myLang("Ending Period"); ?></label>
@ -123,6 +130,7 @@
<input type="checkbox" class="form-check-input " name="showOB" id="showOB" aria-describedby="helpId_showOB" placeholder="Show Opening Balance" <?php echo (isset($_POST['showOB'])) ? "CHECKED" : ""; ?>>
<!-- <input class="form-check-input" type="checkbox"> -->
<label class="form-check-label" for="showOB">Opening</label>
StockRecords
</div>
<div class="form-check">
<!-- <input class="form-check-input" type="checkbox"> -->
@ -143,9 +151,14 @@
</div>
</div>
<div class="btn-group">
<button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
<!-- <button type="submit" class="btn btn-warning btn-sm " data-toggle="dropdown" data-offset="-52">
Export
</button> -->
<button type="submit" id="downloadCsv" class="btn btn-warning btn-sm ">
Export csv
</button>
<!-- <button class="btn btn-warning btn-sm " onclick="exportTableToCSV('accounts_data.csv')">Export to CSV</button> -->
<!-- <div class="dropdown-menu" role="menu">
<a href="#" class="dropdown-item">Export</a>
<a href="#" class="dropdown-item">Pdf</a>
@ -169,7 +182,7 @@
</div>
<div class="card-body">
<table class="table table-bordered table-striped dataTable">
<table id='myTable' class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th rowspan="2" width="40" style="vertical-align: middle;"><?php myLang('S.No.'); ?></th>
@ -201,10 +214,12 @@
$STotal = 0;
$CTotal = 0;
foreach ($StockRecords as $index => $TableRow) : ?>
<?php if ((count($TableRow->Item)) > 0):; ?>
<tr>
<td class="text-center"><?php echo $index + 1; ?></td>
<td><?php echo ($TableRow->Item) ? $TableRow->Item->title : "N/A"; ?></td>
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Item->units_id); ?></td>
<td><?php echo ($TableRow->Summary->Item->title) ? $TableRow->Summary->Item->title : "N/A"; ?></td>
<!-- $StockRecord->Summary->Unit->unit_id -->
<td><?php echo getFieldfromValue("tbl_units", "title", "unit_id", $TableRow->Summary->Unit->unit_id); ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Opening->qty; ?></td>
<td class="text-right"><?php echo $TableRow->Summary->Opening->rate; ?></td>
<td><?php echo myCurrency($lTotal = $TableRow->Summary->Opening->amount);
@ -222,6 +237,7 @@
<td><?php echo myCurrency($cTotal = $TableRow->Summary->Closing->amount);
$CTotal += $cTotal; ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<tbody>
<tfoot>
@ -320,9 +336,45 @@
closeOnDateSelect: true,
minDate: $('#toDate').data('start'),
maxDate: $('#toDate').data('end'),
}
);
});
</script>
<!-- pdf document -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.0/xlsx.full.min.js"></script>
<script>
document.getElementById('downloadCsv').addEventListener('click', function() {
const table = document.getElementById('myTable');
const rows = Array.from(table.rows);
const data = [];
rows.forEach((row) => {
const cells = Array.from(row.cells);
const rowData = [];
cells.forEach((cell) => {
// Handle colspan
const colspan = cell.colSpan || 1;
for (let i = 0; i < (colspan - 1); i++) {
rowData.push(''); // Fill empty cells for merged columns
}
for (let i = 0; i < 1; i++) {
rowData.push(cell.innerText.trim());
}
// Fill empty cells for colspan
});
data.push(rowData);
});
// Create a worksheet
const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// Export to Excel
XLSX.writeFile(workbook, 'table.xlsx');
});
</script>
<!-- pdf document ends-->
<?php
}
?>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -25,6 +25,7 @@ SET time_zone = "+00:00";
--
-- Table structure for table `tbl_accategories`
--
CREATE TABLE `tbl_accategories` (

View File

@ -74,6 +74,12 @@ $route['student/admission_payment'] = 'Student/admission-payment';
$route['student/get_installdetails'] = 'Student/get-installdetails';
$route['student/paypalipn_admission'] = 'Student/paypalipn-admission';
//inventory
$route['inventory/stocks/summary'] = 'Inventory/Stocks/summary';
//inventory ends
$route['admin'] = 'Admin/index';
$route['admin-logout'] = 'Admin/admin_logout';

View File

@ -75,6 +75,7 @@
$('[data-toggle="tooltip"]').tooltip()
})
</script>
</body>
</html>

634
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ APP_URL=http://localhost/bbnepal/BBnepal-Accounts
DB_CONNECTION=mysql
DB_HOST=127.0.0.1:3309
DB_PORT=3309
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3
DATABASE_OPTIONS=bbnepal_accounting,myurlsco_accounts1,myurlsco_accounts2,myurlsco_accounts3 #given
DB_DATABASE=bbnepal_accounting
DB_USERNAME=root
DB_PASSWORD=

17
vendor/autoload.php vendored
View File

@ -3,8 +3,21 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
exit(1);
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';

View File

@ -42,35 +42,37 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
/** @var ?string */
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
@ -78,8 +80,7 @@ class ClassLoader
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
* @var array<string, string>
*/
private $classMap = array();
@ -87,29 +88,29 @@ class ClassLoader
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var ?string */
/** @var string|null */
private $apcuPrefix;
/**
* @var self[]
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return string[]
* @return array<string, list<string>>
*/
public function getPrefixes()
{
@ -121,8 +122,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
@ -130,8 +130,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirs()
{
@ -139,8 +138,7 @@ class ClassLoader
}
/**
* @return array[]
* @psalm-return array<string, string>
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
@ -148,8 +146,7 @@ class ClassLoader
}
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
@ -157,8 +154,7 @@ class ClassLoader
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
@ -176,23 +172,24 @@ class ClassLoader
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 root directories
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
$paths
);
}
@ -201,19 +198,19 @@ class ClassLoader
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
$paths
);
}
}
@ -223,7 +220,7 @@ class ClassLoader
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
@ -232,17 +229,18 @@ class ClassLoader
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@ -252,18 +250,18 @@ class ClassLoader
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
$paths
);
}
}
@ -273,7 +271,7 @@ class ClassLoader
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param string[]|string $paths The PSR-0 base directories
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
@ -291,7 +289,7 @@ class ClassLoader
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param string[]|string $paths The PSR-4 base directories
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
@ -425,7 +423,8 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
@ -476,9 +475,9 @@ class ClassLoader
}
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return self[]
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
@ -555,6 +554,14 @@ class ClassLoader
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
@ -564,9 +571,9 @@ class ClassLoader
*
* @param string $file
* @return void
* @private
*/
function includeFile($file)
{
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

View File

@ -98,7 +98,7 @@ class InstalledVersions
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
@ -119,7 +119,7 @@ class InstalledVersions
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
@ -328,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
@ -340,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}

View File

@ -471,6 +471,5 @@ return array(
'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => $vendorDir . '/sebastian/recursion-context/src/InvalidArgumentException.php',
'SebastianBergmann\\ResourceOperations\\ResourceOperations' => $vendorDir . '/sebastian/resource-operations/src/ResourceOperations.php',
'SebastianBergmann\\Version' => $vendorDir . '/sebastian/version/src/Version.php',
'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
'Text_Template' => $vendorDir . '/phpunit/php-text-template/src/Template.php',
);

View File

@ -7,11 +7,8 @@ $baseDir = dirname($vendorDir);
return array(
'7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'3109cb1a231dcd04bee1f9f620d46975' => $vendorDir . '/paragonie/sodium_compat/autoload.php',

View File

@ -7,5 +7,4 @@ $baseDir = dirname($vendorDir);
return array(
'org\\bovigo\\vfs' => array($vendorDir . '/mikey179/vfsstream/src/main/php'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
);

View File

@ -9,23 +9,23 @@ return array(
'phpDocumentor\\Reflection\\' => array($vendorDir . '/phpdocumentor/reflection-common/src', $vendorDir . '/phpdocumentor/reflection-docblock/src', $vendorDir . '/phpdocumentor/type-resolver/src'),
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
'Webmozart\\Assert\\' => array($vendorDir . '/webmozart/assert/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Pusher\\' => array($vendorDir . '/pusher/pusher-php-server/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Prophecy\\' => array($vendorDir . '/phpspec/prophecy/src/Prophecy'),
'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'),
'PHPStan\\PhpDocParser\\' => array($vendorDir . '/phpstan/phpdoc-parser/src'),
'Nilambar\\NepaliDate\\' => array($vendorDir . '/ernilambar/nepali-date/src'),
'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'),
'Doctrine\\Instantiator\\' => array($vendorDir . '/doctrine/instantiator/src/Doctrine/Instantiator'),
'Doctrine\\Deprecations\\' => array($vendorDir . '/doctrine/deprecations/lib/Doctrine/Deprecations'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),
);

View File

@ -31,25 +31,18 @@ class ComposerAutoloaderInitade43c0983b611153cb43d6dce42fdb7
$loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInitade43c0983b611153cb43d6dce42fdb7::$files;
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireade43c0983b611153cb43d6dce42fdb7($fileIdentifier, $file);
}
return $loader;
}
}
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequireade43c0983b611153cb43d6dce42fdb7($fileIdentifier, $file)
{
$filesToLoad = \Composer\Autoload\ComposerStaticInitade43c0983b611153cb43d6dce42fdb7::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}

View File

@ -8,11 +8,8 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'3109cb1a231dcd04bee1f9f620d46975' => __DIR__ . '/..' . '/paragonie/sodium_compat/autoload.php',
@ -33,7 +30,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
),
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Ctype\\' => 23,
'Symfony\\Component\\Yaml\\' => 23,
),
@ -46,6 +42,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'Psr\\Http\\Client\\' => 16,
'Prophecy\\' => 9,
'PhpOffice\\PhpSpreadsheet\\' => 25,
'PHPStan\\PhpDocParser\\' => 21,
),
'N' =>
array (
@ -53,7 +50,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
),
'M' =>
array (
'MyCLabs\\Enum\\' => 13,
'Matrix\\' => 7,
),
'G' =>
@ -65,6 +61,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'D' =>
array (
'Doctrine\\Instantiator\\' => 22,
'Doctrine\\Deprecations\\' => 22,
'DeepCopy\\' => 9,
),
'C' =>
@ -88,10 +85,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array (
0 => __DIR__ . '/..' . '/webmozart/assert/src',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Ctype\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
@ -110,7 +103,7 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
),
'Psr\\Log\\' =>
array (
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
0 => __DIR__ . '/..' . '/psr/log/src',
),
'Psr\\Http\\Message\\' =>
array (
@ -129,14 +122,14 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array (
0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet',
),
'PHPStan\\PhpDocParser\\' =>
array (
0 => __DIR__ . '/..' . '/phpstan/phpdoc-parser/src',
),
'Nilambar\\NepaliDate\\' =>
array (
0 => __DIR__ . '/..' . '/ernilambar/nepali-date/src',
),
'MyCLabs\\Enum\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
),
'Matrix\\' =>
array (
0 => __DIR__ . '/..' . '/markbaker/matrix/classes/src',
@ -157,6 +150,10 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
array (
0 => __DIR__ . '/..' . '/doctrine/instantiator/src/Doctrine/Instantiator',
),
'Doctrine\\Deprecations\\' =>
array (
0 => __DIR__ . '/..' . '/doctrine/deprecations/lib/Doctrine/Deprecations',
),
'DeepCopy\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy',
@ -175,13 +172,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
0 => __DIR__ . '/..' . '/mikey179/vfsstream/src/main/php',
),
),
'H' =>
array (
'HTMLPurifier' =>
array (
0 => __DIR__ . '/..' . '/ezyang/htmlpurifier/library',
),
),
);
public static $classMap = array (
@ -650,7 +640,6 @@ class ComposerStaticInitade43c0983b611153cb43d6dce42fdb7
'SebastianBergmann\\RecursionContext\\InvalidArgumentException' => __DIR__ . '/..' . '/sebastian/recursion-context/src/InvalidArgumentException.php',
'SebastianBergmann\\ResourceOperations\\ResourceOperations' => __DIR__ . '/..' . '/sebastian/resource-operations/src/ResourceOperations.php',
'SebastianBergmann\\Version' => __DIR__ . '/..' . '/sebastian/version/src/Version.php',
'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
'Text_Template' => __DIR__ . '/..' . '/phpunit/php-text-template/src/Template.php',
);

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'codeigniter/framework',
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '497f567cba71733b286514954ef72c9fe5d46c51',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -11,14 +11,23 @@
),
'versions' => array(
'codeigniter/framework' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '497f567cba71733b286514954ef72c9fe5d46c51',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'doctrine/deprecations' => array(
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'reference' => 'dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab',
'type' => 'library',
'install_path' => __DIR__ . '/../doctrine/deprecations',
'aliases' => array(),
'dev_requirement' => true,
),
'doctrine/instantiator' => array(
'pretty_version' => '1.5.0',
'version' => '1.5.0.0',
@ -29,54 +38,45 @@
'dev_requirement' => true,
),
'ernilambar/nepali-date' => array(
'pretty_version' => '1.0.5',
'version' => '1.0.5.0',
'reference' => '8ac91a49267e3821bf03f052d3cb6b7876af4a12',
'pretty_version' => '1.0.7',
'version' => '1.0.7.0',
'reference' => '886dcb25b10760b4f9c35083d0a1d3ef6fb98584',
'type' => 'library',
'install_path' => __DIR__ . '/../ernilambar/nepali-date',
'aliases' => array(),
'dev_requirement' => false,
),
'ezyang/htmlpurifier' => array(
'pretty_version' => 'v4.16.0',
'version' => '4.16.0.0',
'reference' => '523407fb06eb9e5f3d59889b3978d5bfe94299c8',
'type' => 'library',
'install_path' => __DIR__ . '/../ezyang/htmlpurifier',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/guzzle' => array(
'pretty_version' => '7.5.0',
'version' => '7.5.0.0',
'reference' => 'b50a2a1251152e43f6a37f0fa053e730a67d25ba',
'pretty_version' => '7.9.2',
'version' => '7.9.2.0',
'reference' => 'd281ed313b989f213357e3be1a179f02196ac99b',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/guzzle',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/promises' => array(
'pretty_version' => '1.5.2',
'version' => '1.5.2.0',
'reference' => 'b94b2807d85443f9719887892882d0329d1e2598',
'pretty_version' => '2.0.3',
'version' => '2.0.3.0',
'reference' => '6ea8dd08867a2a42619d65c3deb2c0fcbf81c8f8',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/promises',
'aliases' => array(),
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '2.4.3',
'version' => '2.4.3.0',
'reference' => '67c26b443f348a51926030c83481b85718457d3d',
'pretty_version' => '2.7.0',
'version' => '2.7.0.0',
'reference' => 'a70f5c95fb43bc83f07c9c948baa0dc1829bf201',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'dev_requirement' => false,
),
'maennchen/zipstream-php' => array(
'pretty_version' => '2.2.6',
'version' => '2.2.6.0',
'reference' => '30ad6f93cf3efe4192bc7a4c9cad11ff8f4f237f',
'pretty_version' => '3.1.0',
'version' => '3.1.0.0',
'reference' => 'b8174494eda667f7d13876b4a7bfef0f62a7c0d1',
'type' => 'library',
'install_path' => __DIR__ . '/../maennchen/zipstream-php',
'aliases' => array(),
@ -110,23 +110,14 @@
'dev_requirement' => true,
),
'myclabs/deep-copy' => array(
'pretty_version' => '1.11.0',
'version' => '1.11.0.0',
'reference' => '14daed4296fae74d9e3201d2c4925d1acb7aa614',
'pretty_version' => '1.12.0',
'version' => '1.12.0.0',
'reference' => '3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/deep-copy',
'aliases' => array(),
'dev_requirement' => true,
),
'myclabs/php-enum' => array(
'pretty_version' => '1.8.4',
'version' => '1.8.4.0',
'reference' => 'a867478eae49c9f59ece437ae7f9506bfaa27483',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/php-enum',
'aliases' => array(),
'dev_requirement' => false,
),
'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
@ -137,9 +128,9 @@
'dev_requirement' => false,
),
'paragonie/sodium_compat' => array(
'pretty_version' => 'v1.19.0',
'version' => '1.19.0.0',
'reference' => 'cb15e403ecbe6a6cc515f855c310eb6b1872a933',
'pretty_version' => 'v1.21.1',
'version' => '1.21.1.0',
'reference' => 'bb312875dcdd20680419564fe42ba1d9564b9e37',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/sodium_compat',
'aliases' => array(),
@ -155,27 +146,27 @@
'dev_requirement' => true,
),
'phpdocumentor/reflection-docblock' => array(
'pretty_version' => '5.3.0',
'version' => '5.3.0.0',
'reference' => '622548b623e81ca6d78b721c5e029f4ce664f170',
'pretty_version' => '5.4.1',
'version' => '5.4.1.0',
'reference' => '9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/reflection-docblock',
'aliases' => array(),
'dev_requirement' => true,
),
'phpdocumentor/type-resolver' => array(
'pretty_version' => '1.6.2',
'version' => '1.6.2.0',
'reference' => '48f445a408c131e38cab1c235aa6d2bb7a0bb20d',
'pretty_version' => '1.8.2',
'version' => '1.8.2.0',
'reference' => '153ae662783729388a584b4361f2545e4d841e3c',
'type' => 'library',
'install_path' => __DIR__ . '/../phpdocumentor/type-resolver',
'aliases' => array(),
'dev_requirement' => true,
),
'phpoffice/phpspreadsheet' => array(
'pretty_version' => '1.26.0',
'version' => '1.26.0.0',
'reference' => '5b6ceea9705b068f993e268e4debc566c2637063',
'pretty_version' => '2.2.2',
'version' => '2.2.2.0',
'reference' => 'ffbcee68069b073bff07a71eb321dcd9f2763513',
'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet',
'aliases' => array(),
@ -190,6 +181,15 @@
'aliases' => array(),
'dev_requirement' => true,
),
'phpstan/phpdoc-parser' => array(
'pretty_version' => '1.31.0',
'version' => '1.31.0.0',
'reference' => '249f15fb843bf240cf058372dad29e100cee6c17',
'type' => 'library',
'install_path' => __DIR__ . '/../phpstan/phpdoc-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-code-coverage' => array(
'pretty_version' => '4.0.8',
'version' => '4.0.8.0',
@ -254,9 +254,9 @@
'dev_requirement' => true,
),
'psr/http-client' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
@ -269,9 +269,9 @@
),
),
'psr/http-factory' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
@ -284,9 +284,9 @@
),
),
'psr/http-message' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'pretty_version' => '2.0',
'version' => '2.0.0.0',
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
@ -299,27 +299,27 @@
),
),
'psr/log' => array(
'pretty_version' => '1.1.4',
'version' => '1.1.4.0',
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => 'f16e1d5863e37f8d8c2a01719f5b34baa2b714d3',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/simple-cache' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/simple-cache',
'aliases' => array(),
'dev_requirement' => false,
),
'pusher/pusher-php-server' => array(
'pretty_version' => '7.2.2',
'version' => '7.2.2.0',
'reference' => '4ace4873873b06c25cecb2dd6d9fdcbf2f20b640',
'pretty_version' => '7.2.4',
'version' => '7.2.4.0',
'reference' => 'de2f72296808f9cafa6a4462b15a768ff130cddb',
'type' => 'library',
'install_path' => __DIR__ . '/../pusher/pusher-php-server',
'aliases' => array(),
@ -335,9 +335,9 @@
'dev_requirement' => false,
),
'sebastian/code-unit-reverse-lookup' => array(
'pretty_version' => '1.0.2',
'version' => '1.0.2.0',
'reference' => '1de8cd5c010cb153fcd68b8d0f64606f523f7619',
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'reference' => '92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
'aliases' => array(),
@ -425,32 +425,23 @@
'dev_requirement' => true,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v2.5.2',
'version' => '2.5.2.0',
'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '5bbc823adecdae860bb64756d639ecfec17b050a',
'pretty_version' => 'v1.31.0',
'version' => '1.31.0.0',
'reference' => 'a3cc8b044a6ea513310cbd48ef7333b384945638',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.27.0',
'version' => '1.27.0.0',
'reference' => '8ad114f6b39e2c98a8b0e3bd907732c207c2b534',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/yaml' => array(
'pretty_version' => 'v4.4.45',
'version' => '4.4.45.0',

19
vendor/doctrine/deprecations/LICENSE vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2020-2021 Doctrine Project
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

157
vendor/doctrine/deprecations/README.md vendored Normal file
View File

@ -0,0 +1,157 @@
# Doctrine Deprecations
A small (side-effect free by default) layer on top of
`trigger_error(E_USER_DEPRECATED)` or PSR-3 logging.
- no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under
- options to avoid having to rely on error handlers global state by using PSR-3 logging
- deduplicate deprecation messages to avoid excessive triggering and reduce overhead
We recommend to collect Deprecations using a PSR logger instead of relying on
the global error handler.
## Usage from consumer perspective:
Enable Doctrine deprecations to be sent to a PSR3 logger:
```php
\Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger);
```
Enable Doctrine deprecations to be sent as `@trigger_error($message, E_USER_DEPRECATED)`
messages by setting the `DOCTRINE_DEPRECATIONS` environment variable to `trigger`.
Alternatively, call:
```php
\Doctrine\Deprecations\Deprecation::enableWithTriggerError();
```
If you only want to enable deprecation tracking, without logging or calling `trigger_error`
then set the `DOCTRINE_DEPRECATIONS` environment variable to `track`.
Alternatively, call:
```php
\Doctrine\Deprecations\Deprecation::enableTrackingDeprecations();
```
Tracking is enabled with all three modes and provides access to all triggered
deprecations and their individual count:
```php
$deprecations = \Doctrine\Deprecations\Deprecation::getTriggeredDeprecations();
foreach ($deprecations as $identifier => $count) {
echo $identifier . " was triggered " . $count . " times\n";
}
```
### Suppressing Specific Deprecations
Disable triggering about specific deprecations:
```php
\Doctrine\Deprecations\Deprecation::ignoreDeprecations("https://link/to/deprecations-description-identifier");
```
Disable all deprecations from a package
```php
\Doctrine\Deprecations\Deprecation::ignorePackage("doctrine/orm");
```
### Other Operations
When used within PHPUnit or other tools that could collect multiple instances of the same deprecations
the deduplication can be disabled:
```php
\Doctrine\Deprecations\Deprecation::withoutDeduplication();
```
Disable deprecation tracking again:
```php
\Doctrine\Deprecations\Deprecation::disable();
```
## Usage from a library/producer perspective:
When you want to unconditionally trigger a deprecation even when called
from the library itself then the `trigger` method is the way to go:
```php
\Doctrine\Deprecations\Deprecation::trigger(
"doctrine/orm",
"https://link/to/deprecations-description",
"message"
);
```
If variable arguments are provided at the end, they are used with `sprintf` on
the message.
```php
\Doctrine\Deprecations\Deprecation::trigger(
"doctrine/orm",
"https://github.com/doctrine/orm/issue/1234",
"message %s %d",
"foo",
1234
);
```
When you want to trigger a deprecation only when it is called by a function
outside of the current package, but not trigger when the package itself is the cause,
then use:
```php
\Doctrine\Deprecations\Deprecation::triggerIfCalledFromOutside(
"doctrine/orm",
"https://link/to/deprecations-description",
"message"
);
```
Based on the issue link each deprecation message is only triggered once per
request.
A limited stacktrace is included in the deprecation message to find the
offending location.
Note: A producer/library should never call `Deprecation::enableWith` methods
and leave the decision how to handle deprecations to application and
frameworks.
## Usage in PHPUnit tests
There is a `VerifyDeprecations` trait that you can use to make assertions on
the occurrence of deprecations within a test.
```php
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
class MyTest extends TestCase
{
use VerifyDeprecations;
public function testSomethingDeprecation()
{
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
triggerTheCodeWithDeprecation();
}
public function testSomethingDeprecationFixed()
{
$this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/orm/issue/1234');
triggerTheCodeWithoutDeprecation();
}
}
```
## What is a deprecation identifier?
An identifier for deprecations is just a link to any resource, most often a
Github Issue or Pull Request explaining the deprecation and potentially its
alternative.

View File

@ -0,0 +1,38 @@
{
"name": "doctrine/deprecations",
"description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.",
"license": "MIT",
"type": "library",
"homepage": "https://www.doctrine-project.org/",
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpstan/phpstan": "1.4.10 || 1.10.15",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "0.18.4",
"psr/log": "^1 || ^2 || ^3",
"vimeo/psalm": "4.30.0 || 5.12.0"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
},
"autoload": {
"psr-4": {
"Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations"
}
},
"autoload-dev": {
"psr-4": {
"DeprecationTests\\": "test_fixtures/src",
"Doctrine\\Foo\\": "test_fixtures/vendor/doctrine/foo"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

View File

@ -0,0 +1,313 @@
<?php
declare(strict_types=1);
namespace Doctrine\Deprecations;
use Psr\Log\LoggerInterface;
use function array_key_exists;
use function array_reduce;
use function assert;
use function debug_backtrace;
use function sprintf;
use function str_replace;
use function strpos;
use function strrpos;
use function substr;
use function trigger_error;
use const DEBUG_BACKTRACE_IGNORE_ARGS;
use const DIRECTORY_SEPARATOR;
use const E_USER_DEPRECATED;
/**
* Manages Deprecation logging in different ways.
*
* By default triggered exceptions are not logged.
*
* To enable different deprecation logging mechanisms you can call the
* following methods:
*
* - Minimal collection of deprecations via getTriggeredDeprecations()
* \Doctrine\Deprecations\Deprecation::enableTrackingDeprecations();
*
* - Uses @trigger_error with E_USER_DEPRECATED
* \Doctrine\Deprecations\Deprecation::enableWithTriggerError();
*
* - Sends deprecation messages via a PSR-3 logger
* \Doctrine\Deprecations\Deprecation::enableWithPsrLogger($logger);
*
* Packages that trigger deprecations should use the `trigger()` or
* `triggerIfCalledFromOutside()` methods.
*/
class Deprecation
{
private const TYPE_NONE = 0;
private const TYPE_TRACK_DEPRECATIONS = 1;
private const TYPE_TRIGGER_ERROR = 2;
private const TYPE_PSR_LOGGER = 4;
/** @var int-mask-of<self::TYPE_*>|null */
private static $type;
/** @var LoggerInterface|null */
private static $logger;
/** @var array<string,bool> */
private static $ignoredPackages = [];
/** @var array<string,int> */
private static $triggeredDeprecations = [];
/** @var array<string,bool> */
private static $ignoredLinks = [];
/** @var bool */
private static $deduplication = true;
/**
* Trigger a deprecation for the given package and identfier.
*
* The link should point to a Github issue or Wiki entry detailing the
* deprecation. It is additionally used to de-duplicate the trigger of the
* same deprecation during a request.
*
* @param float|int|string $args
*/
public static function trigger(string $package, string $link, string $message, ...$args): void
{
$type = self::$type ?? self::getTypeFromEnv();
if ($type === self::TYPE_NONE) {
return;
}
if (isset(self::$ignoredLinks[$link])) {
return;
}
if (array_key_exists($link, self::$triggeredDeprecations)) {
self::$triggeredDeprecations[$link]++;
} else {
self::$triggeredDeprecations[$link] = 1;
}
if (self::$deduplication === true && self::$triggeredDeprecations[$link] > 1) {
return;
}
if (isset(self::$ignoredPackages[$package])) {
return;
}
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$message = sprintf($message, ...$args);
self::delegateTriggerToBackend($message, $backtrace, $link, $package);
}
/**
* Trigger a deprecation for the given package and identifier when called from outside.
*
* "Outside" means we assume that $package is currently installed as a
* dependency and the caller is not a file in that package. When $package
* is installed as a root package then deprecations triggered from the
* tests folder are also considered "outside".
*
* This deprecation method assumes that you are using Composer to install
* the dependency and are using the default /vendor/ folder and not a
* Composer plugin to change the install location. The assumption is also
* that $package is the exact composer packge name.
*
* Compared to {@link trigger()} this method causes some overhead when
* deprecation tracking is enabled even during deduplication, because it
* needs to call {@link debug_backtrace()}
*
* @param float|int|string $args
*/
public static function triggerIfCalledFromOutside(string $package, string $link, string $message, ...$args): void
{
$type = self::$type ?? self::getTypeFromEnv();
if ($type === self::TYPE_NONE) {
return;
}
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
// first check that the caller is not from a tests folder, in which case we always let deprecations pass
if (isset($backtrace[1]['file'], $backtrace[0]['file']) && strpos($backtrace[1]['file'], DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR) === false) {
$path = DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $package) . DIRECTORY_SEPARATOR;
if (strpos($backtrace[0]['file'], $path) === false) {
return;
}
if (strpos($backtrace[1]['file'], $path) !== false) {
return;
}
}
if (isset(self::$ignoredLinks[$link])) {
return;
}
if (array_key_exists($link, self::$triggeredDeprecations)) {
self::$triggeredDeprecations[$link]++;
} else {
self::$triggeredDeprecations[$link] = 1;
}
if (self::$deduplication === true && self::$triggeredDeprecations[$link] > 1) {
return;
}
if (isset(self::$ignoredPackages[$package])) {
return;
}
$message = sprintf($message, ...$args);
self::delegateTriggerToBackend($message, $backtrace, $link, $package);
}
/**
* @param list<array{function: string, line?: int, file?: string, class?: class-string, type?: string, args?: mixed[], object?: object}> $backtrace
*/
private static function delegateTriggerToBackend(string $message, array $backtrace, string $link, string $package): void
{
$type = self::$type ?? self::getTypeFromEnv();
if (($type & self::TYPE_PSR_LOGGER) > 0) {
$context = [
'file' => $backtrace[0]['file'] ?? null,
'line' => $backtrace[0]['line'] ?? null,
'package' => $package,
'link' => $link,
];
assert(self::$logger !== null);
self::$logger->notice($message, $context);
}
if (! (($type & self::TYPE_TRIGGER_ERROR) > 0)) {
return;
}
$message .= sprintf(
' (%s:%d called by %s:%d, %s, package %s)',
self::basename($backtrace[0]['file'] ?? 'native code'),
$backtrace[0]['line'] ?? 0,
self::basename($backtrace[1]['file'] ?? 'native code'),
$backtrace[1]['line'] ?? 0,
$link,
$package
);
@trigger_error($message, E_USER_DEPRECATED);
}
/**
* A non-local-aware version of PHPs basename function.
*/
private static function basename(string $filename): string
{
$pos = strrpos($filename, DIRECTORY_SEPARATOR);
if ($pos === false) {
return $filename;
}
return substr($filename, $pos + 1);
}
public static function enableTrackingDeprecations(): void
{
self::$type = self::$type ?? 0;
self::$type |= self::TYPE_TRACK_DEPRECATIONS;
}
public static function enableWithTriggerError(): void
{
self::$type = self::$type ?? 0;
self::$type |= self::TYPE_TRIGGER_ERROR;
}
public static function enableWithPsrLogger(LoggerInterface $logger): void
{
self::$type = self::$type ?? 0;
self::$type |= self::TYPE_PSR_LOGGER;
self::$logger = $logger;
}
public static function withoutDeduplication(): void
{
self::$deduplication = false;
}
public static function disable(): void
{
self::$type = self::TYPE_NONE;
self::$logger = null;
self::$deduplication = true;
self::$ignoredLinks = [];
foreach (self::$triggeredDeprecations as $link => $count) {
self::$triggeredDeprecations[$link] = 0;
}
}
public static function ignorePackage(string $packageName): void
{
self::$ignoredPackages[$packageName] = true;
}
public static function ignoreDeprecations(string ...$links): void
{
foreach ($links as $link) {
self::$ignoredLinks[$link] = true;
}
}
public static function getUniqueTriggeredDeprecationsCount(): int
{
return array_reduce(self::$triggeredDeprecations, static function (int $carry, int $count) {
return $carry + $count;
}, 0);
}
/**
* Returns each triggered deprecation link identifier and the amount of occurrences.
*
* @return array<string,int>
*/
public static function getTriggeredDeprecations(): array
{
return self::$triggeredDeprecations;
}
/**
* @return int-mask-of<self::TYPE_*>
*/
private static function getTypeFromEnv(): int
{
switch ($_SERVER['DOCTRINE_DEPRECATIONS'] ?? $_ENV['DOCTRINE_DEPRECATIONS'] ?? null) {
case 'trigger':
self::$type = self::TYPE_TRIGGER_ERROR;
break;
case 'track':
self::$type = self::TYPE_TRACK_DEPRECATIONS;
break;
default:
self::$type = self::TYPE_NONE;
break;
}
return self::$type;
}
}

View File

@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace Doctrine\Deprecations\PHPUnit;
use Doctrine\Deprecations\Deprecation;
use function sprintf;
trait VerifyDeprecations
{
/** @var array<string,int> */
private $doctrineDeprecationsExpectations = [];
/** @var array<string,int> */
private $doctrineNoDeprecationsExpectations = [];
public function expectDeprecationWithIdentifier(string $identifier): void
{
$this->doctrineDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
}
public function expectNoDeprecationWithIdentifier(string $identifier): void
{
$this->doctrineNoDeprecationsExpectations[$identifier] = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
}
/**
* @before
*/
public function enableDeprecationTracking(): void
{
Deprecation::enableTrackingDeprecations();
}
/**
* @after
*/
public function verifyDeprecationsAreTriggered(): void
{
foreach ($this->doctrineDeprecationsExpectations as $identifier => $expectation) {
$actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
$this->assertTrue(
$actualCount > $expectation,
sprintf(
"Expected deprecation with identifier '%s' was not triggered by code executed in test.",
$identifier
)
);
}
foreach ($this->doctrineNoDeprecationsExpectations as $identifier => $expectation) {
$actualCount = Deprecation::getTriggeredDeprecations()[$identifier] ?? 0;
$this->assertTrue(
$actualCount === $expectation,
sprintf(
"Expected deprecation with identifier '%s' was triggered by code executed in test, but expected not to.",
$identifier
)
);
}
}
}

View File

@ -1,7 +1,11 @@
{
"name": "ernilambar/nepali-date",
"description": "Nepali Date",
"keywords" : [ "date" ],
"keywords": [
"nepali",
"bikram-sambat",
"date"
],
"homepage": "https://github.com/ernilambar/nepali-date",
"license": "MIT",
"authors": [
@ -15,17 +19,6 @@
"support": {
"issues": "https://github.com/ernilambar/nepali-date/issues"
},
"scripts": {
"test": "phpunit",
"config-cs": [
"Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
"\"vendor/bin/phpcs\" --config-set default_standard PSR2"
],
"post-install-cmd": "@config-cs",
"post-update-cmd": "@config-cs",
"lint": "\"vendor/bin/phpcs\" . ",
"lint-fix": "\"vendor/bin/phpcbf\" . "
},
"autoload": {
"psr-4": {
"Nilambar\\NepaliDate\\": "src/"
@ -39,9 +32,29 @@
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3.5",
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2"
"config": {
"sort-packages": true
},
"scripts": {
"format": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcbf --standard=phpcs.xml.dist"
],
"format:tests": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcbf --standard=phpcs.tests.xml.dist"
],
"lint": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcs --standard=phpcs.xml.dist"
],
"lint:tests": [
"composer --working-dir=build-cs update --no-interaction",
"build-cs/vendor/bin/phpcs --standard=phpcs.tests.xml.dist"
],
"test": [
"composer --working-dir=build-phpunit update --no-interaction",
"build-phpunit/vendor/bin/phpunit --verbose"
]
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<ruleset name="project-default">
<description>A custom set of code standard rules to check for tests.</description>
<!-- Only check the PHP files. -->
<arg name="extensions" value="php"/>
<!-- Check all files in this directory and the directories below it. -->
<file>tests/</file>
<exclude-pattern>*/phpunit.xml*</exclude-pattern>
<!-- Third-party code -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- For CI, don't fail on warnings -->
<config name="ignore_warnings_on_exit" value="1"/>
<config name="testVersion" value="7.4-"/>
<!-- Enforce PSR12 standards -->
<rule ref="PSR12" />
</ruleset>

View File

@ -1,4 +1,5 @@
<?php
/**
* Calendar class
*
@ -103,7 +104,7 @@ class NepaliCalendar
78 => array( 2078, 31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30 ),
79 => array( 2079, 31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30 ),
80 => array( 2080, 31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30 ),
81 => array( 2081, 31, 31, 32, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
81 => array( 2081, 31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31 ),
82 => array( 2082, 30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 30, 30 ),
83 => array( 2083, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30 ),
84 => array( 2084, 31, 31, 32, 31, 31, 30, 30, 30, 29, 30, 30, 30 ),
@ -411,4 +412,4 @@ class NepaliCalendar
return $output;
}
}
};
}

View File

@ -1,4 +1,5 @@
<?php
/**
* Nepali Date class
*
@ -17,7 +18,6 @@ namespace Nilambar\NepaliDate;
*/
class NepaliDate
{
/**
* NepaliCalendar object.
*
@ -158,9 +158,11 @@ class NepaliDate
);
if (is_array($temp_date) && ! empty($temp_date)) {
if (intval($y) === intval($temp_date['year'])
if (
intval($y) === intval($temp_date['year'])
&& intval($m) === intval($temp_date['month'])
&& intval($d) === intval($temp_date['day'])) {
&& intval($d) === intval($temp_date['day'])
) {
$output = $temp_date;
}
}
@ -176,9 +178,11 @@ class NepaliDate
);
if (is_array($temp_date) && ! empty($temp_date)) {
if (intval($y) === intval($temp_date['year'])
if (
intval($y) === intval($temp_date['year'])
&& intval($m) === intval($temp_date['month'])
&& intval($d) === intval($temp_date['day'])) {
&& intval($d) === intval($temp_date['day'])
) {
$output = $temp_date;
}
}
@ -344,38 +348,38 @@ class NepaliDate
$output = array(
'1' => array(
'en' => 'Baishakh',
'np' => 'बैसाख',
'np' => 'वैशाख',
),
'2' => array(
'en' => 'Jeth',
'en' => 'Jestha',
'np' => 'जेठ',
),
'3' => array(
'en' => 'Ashar',
'en' => 'Ashadh',
'np' => 'असार',
),
'4' => array(
'en' => 'Shrawan',
'np' => 'श्रावन',
'np' => 'साउन',
),
'5' => array(
'en' => 'Bhadra',
'np' => 'भाद्र',
'np' => 'भदौ',
),
'6' => array(
'en' => 'Ashoj',
'en' => 'Ashwin',
'np' => 'असोज',
),
'7' => array(
'en' => 'Kartik',
'np' => 'का्तिक',
'np' => 'का्तिक',
),
'8' => array(
'en' => 'Mangshir',
'en' => 'Mangsir',
'np' => 'मंसिर',
),
'9' => array(
'en' => 'Poush',
'en' => 'Paush',
'np' => 'पुष',
),
'10' => array(
@ -384,11 +388,11 @@ class NepaliDate
),
'11' => array(
'en' => 'Falgun',
'np' => 'फाल्गुण',
'np' => 'फागुन',
),
'12' => array(
'en' => 'Chaitra',
'np' => 'चैत्र',
'np' => 'चैत',
),
);

View File

@ -1,6 +0,0 @@
# [4.16.0](https://github.com/ezyang/htmlpurifier/compare/v4.15.0...v4.16.0) (2022-09-18)
### Features
* add semantic release ([#307](https://github.com/ezyang/htmlpurifier/issues/307)) ([db31243](https://github.com/ezyang/htmlpurifier/commit/db312435cb9d8d73395f75f9642a43ba6de5e903)), closes [#322](https://github.com/ezyang/htmlpurifier/issues/322) [#323](https://github.com/ezyang/htmlpurifier/issues/323) [#326](https://github.com/ezyang/htmlpurifier/issues/326) [#327](https://github.com/ezyang/htmlpurifier/issues/327) [#328](https://github.com/ezyang/htmlpurifier/issues/328) [#329](https://github.com/ezyang/htmlpurifier/issues/329) [#330](https://github.com/ezyang/htmlpurifier/issues/330) [#331](https://github.com/ezyang/htmlpurifier/issues/331) [#332](https://github.com/ezyang/htmlpurifier/issues/332) [#333](https://github.com/ezyang/htmlpurifier/issues/333) [#337](https://github.com/ezyang/htmlpurifier/issues/337) [#335](https://github.com/ezyang/htmlpurifier/issues/335) [ezyang/htmlpurifier#334](https://github.com/ezyang/htmlpurifier/issues/334) [#336](https://github.com/ezyang/htmlpurifier/issues/336) [#338](https://github.com/ezyang/htmlpurifier/issues/338)

View File

@ -1,9 +0,0 @@
CREDITS
Almost everything written by Edward Z. Yang (Ambush Commander). Lots of thanks
to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
more details), Feyd especially (namely IPv6 and optimization). Thanks to RSnake
for letting me package his fantastic XSS cheatsheet for a smoketest.
vim: et sw=4 sts=4

View File

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
vim: et sw=4 sts=4

View File

@ -1,29 +0,0 @@
HTML Purifier [![Build Status](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ezyang/htmlpurifier/actions/workflows/ci.yml)
=============
HTML Purifier is an HTML filtering solution that uses a unique combination
of robust whitelists and aggressive parsing to ensure that not only are
XSS attacks thwarted, but the resulting HTML is standards compliant.
HTML Purifier is oriented towards richly formatted documents from
untrusted sources that require CSS and a full tag-set. This library can
be configured to accept a more restrictive set of tags, but it won't be
as efficient as more bare-bones parsers. It will, however, do the job
right, which may be more important.
Places to go:
* See INSTALL for a quick installation guide
* See docs/ for developer-oriented documentation, code examples and
an in-depth installation guide.
* See WYSIWYG for information on editors like TinyMCE and FCKeditor
HTML Purifier can be found on the web at: [http://htmlpurifier.org/](http://htmlpurifier.org/)
## Installation
Package available on [Composer](https://packagist.org/packages/ezyang/htmlpurifier).
If you're using Composer to manage dependencies, you can use
$ composer require ezyang/htmlpurifier

View File

@ -1 +0,0 @@
4.15.0

View File

@ -1,44 +0,0 @@
{
"name": "ezyang/htmlpurifier",
"description": "Standards compliant HTML filter written in PHP",
"type": "library",
"keywords": ["html"],
"homepage": "http://htmlpurifier.org/",
"license": "LGPL-2.1-or-later",
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"autoload": {
"psr-0": { "HTMLPurifier": "library/" },
"files": ["library/HTMLPurifier.composer.php"],
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-tidy": "Used for pretty-printing HTML"
},
"config": {
"sort-packages": true
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ezyang/simpletest.git"
}
]
}

View File

@ -1,11 +0,0 @@
<?php
/**
* This is a stub include that automatically configures the include path.
*/
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
require_once 'HTMLPurifier/Bootstrap.php';
require_once 'HTMLPurifier.autoload.php';
// vim: et sw=4 sts=4

View File

@ -1,14 +0,0 @@
<?php
/**
* @file
* Legacy autoloader for systems lacking spl_autoload_register
*
*/
spl_autoload_register(function($class)
{
return HTMLPurifier_Bootstrap::autoload($class);
});
// vim: et sw=4 sts=4

View File

@ -1,25 +0,0 @@
<?php
/**
* @file
* Convenience file that registers autoload handler for HTML Purifier.
* It also does some sanity checks.
*/
if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
// We need unregister for our pre-registering functionality
HTMLPurifier_Bootstrap::registerAutoload();
if (function_exists('__autoload')) {
// Be polite and ensure that userland autoload gets retained
spl_autoload_register('__autoload');
}
} elseif (!function_exists('__autoload')) {
require dirname(__FILE__) . '/HTMLPurifier.autoload-legacy.php';
}
// phpcs:ignore PHPCompatibility.IniDirectives.RemovedIniDirectives.zend_ze1_compatibility_modeRemoved
if (ini_get('zend.ze1_compatibility_mode')) {
trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);
}
// vim: et sw=4 sts=4

View File

@ -1,4 +0,0 @@
<?php
if (!defined('HTMLPURIFIER_PREFIX')) {
define('HTMLPURIFIER_PREFIX', dirname(__FILE__));
}

View File

@ -1,25 +0,0 @@
<?php
/**
* @file
* Defines a function wrapper for HTML Purifier for quick use.
* @note ''HTMLPurifier()'' is NOT the same as ''new HTMLPurifier()''
*/
/**
* Purify HTML.
* @param string $html String HTML to purify
* @param mixed $config Configuration to use, can be any value accepted by
* HTMLPurifier_Config::create()
* @return string
*/
function HTMLPurifier($html, $config = null)
{
static $purifier = false;
if (!$purifier) {
$purifier = new HTMLPurifier();
}
return $purifier->purify($html, $config);
}
// vim: et sw=4 sts=4

View File

@ -1,235 +0,0 @@
<?php
/**
* @file
* This file was auto-generated by generate-includes.php and includes all of
* the core files required by HTML Purifier. Use this if performance is a
* primary concern and you are using an opcode cache. PLEASE DO NOT EDIT THIS
* FILE, changes will be overwritten the next time the script is run.
*
* @version 4.15.0
*
* @warning
* You must *not* include any other HTML Purifier files before this file,
* because 'require' not 'require_once' is used.
*
* @warning
* This file requires that the include path contains the HTML Purifier
* library directory; this is not auto-set.
*/
require 'HTMLPurifier.php';
require 'HTMLPurifier/Arborize.php';
require 'HTMLPurifier/AttrCollections.php';
require 'HTMLPurifier/AttrDef.php';
require 'HTMLPurifier/AttrTransform.php';
require 'HTMLPurifier/AttrTypes.php';
require 'HTMLPurifier/AttrValidator.php';
require 'HTMLPurifier/Bootstrap.php';
require 'HTMLPurifier/Definition.php';
require 'HTMLPurifier/CSSDefinition.php';
require 'HTMLPurifier/ChildDef.php';
require 'HTMLPurifier/Config.php';
require 'HTMLPurifier/ConfigSchema.php';
require 'HTMLPurifier/ContentSets.php';
require 'HTMLPurifier/Context.php';
require 'HTMLPurifier/DefinitionCache.php';
require 'HTMLPurifier/DefinitionCacheFactory.php';
require 'HTMLPurifier/Doctype.php';
require 'HTMLPurifier/DoctypeRegistry.php';
require 'HTMLPurifier/ElementDef.php';
require 'HTMLPurifier/Encoder.php';
require 'HTMLPurifier/EntityLookup.php';
require 'HTMLPurifier/EntityParser.php';
require 'HTMLPurifier/ErrorCollector.php';
require 'HTMLPurifier/ErrorStruct.php';
require 'HTMLPurifier/Exception.php';
require 'HTMLPurifier/Filter.php';
require 'HTMLPurifier/Generator.php';
require 'HTMLPurifier/HTMLDefinition.php';
require 'HTMLPurifier/HTMLModule.php';
require 'HTMLPurifier/HTMLModuleManager.php';
require 'HTMLPurifier/IDAccumulator.php';
require 'HTMLPurifier/Injector.php';
require 'HTMLPurifier/Language.php';
require 'HTMLPurifier/LanguageFactory.php';
require 'HTMLPurifier/Length.php';
require 'HTMLPurifier/Lexer.php';
require 'HTMLPurifier/Node.php';
require 'HTMLPurifier/PercentEncoder.php';
require 'HTMLPurifier/PropertyList.php';
require 'HTMLPurifier/PropertyListIterator.php';
require 'HTMLPurifier/Queue.php';
require 'HTMLPurifier/Strategy.php';
require 'HTMLPurifier/StringHash.php';
require 'HTMLPurifier/StringHashParser.php';
require 'HTMLPurifier/TagTransform.php';
require 'HTMLPurifier/Token.php';
require 'HTMLPurifier/TokenFactory.php';
require 'HTMLPurifier/URI.php';
require 'HTMLPurifier/URIDefinition.php';
require 'HTMLPurifier/URIFilter.php';
require 'HTMLPurifier/URIParser.php';
require 'HTMLPurifier/URIScheme.php';
require 'HTMLPurifier/URISchemeRegistry.php';
require 'HTMLPurifier/UnitConverter.php';
require 'HTMLPurifier/VarParser.php';
require 'HTMLPurifier/VarParserException.php';
require 'HTMLPurifier/Zipper.php';
require 'HTMLPurifier/AttrDef/CSS.php';
require 'HTMLPurifier/AttrDef/Clone.php';
require 'HTMLPurifier/AttrDef/Enum.php';
require 'HTMLPurifier/AttrDef/Integer.php';
require 'HTMLPurifier/AttrDef/Lang.php';
require 'HTMLPurifier/AttrDef/Switch.php';
require 'HTMLPurifier/AttrDef/Text.php';
require 'HTMLPurifier/AttrDef/URI.php';
require 'HTMLPurifier/AttrDef/CSS/Number.php';
require 'HTMLPurifier/AttrDef/CSS/AlphaValue.php';
require 'HTMLPurifier/AttrDef/CSS/Background.php';
require 'HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
require 'HTMLPurifier/AttrDef/CSS/Border.php';
require 'HTMLPurifier/AttrDef/CSS/Color.php';
require 'HTMLPurifier/AttrDef/CSS/Composite.php';
require 'HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
require 'HTMLPurifier/AttrDef/CSS/Filter.php';
require 'HTMLPurifier/AttrDef/CSS/Font.php';
require 'HTMLPurifier/AttrDef/CSS/FontFamily.php';
require 'HTMLPurifier/AttrDef/CSS/Ident.php';
require 'HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
require 'HTMLPurifier/AttrDef/CSS/Length.php';
require 'HTMLPurifier/AttrDef/CSS/ListStyle.php';
require 'HTMLPurifier/AttrDef/CSS/Multiple.php';
require 'HTMLPurifier/AttrDef/CSS/Percentage.php';
require 'HTMLPurifier/AttrDef/CSS/TextDecoration.php';
require 'HTMLPurifier/AttrDef/CSS/URI.php';
require 'HTMLPurifier/AttrDef/HTML/Bool.php';
require 'HTMLPurifier/AttrDef/HTML/Nmtokens.php';
require 'HTMLPurifier/AttrDef/HTML/Class.php';
require 'HTMLPurifier/AttrDef/HTML/Color.php';
require 'HTMLPurifier/AttrDef/HTML/ContentEditable.php';
require 'HTMLPurifier/AttrDef/HTML/FrameTarget.php';
require 'HTMLPurifier/AttrDef/HTML/ID.php';
require 'HTMLPurifier/AttrDef/HTML/Pixels.php';
require 'HTMLPurifier/AttrDef/HTML/Length.php';
require 'HTMLPurifier/AttrDef/HTML/LinkTypes.php';
require 'HTMLPurifier/AttrDef/HTML/MultiLength.php';
require 'HTMLPurifier/AttrDef/URI/Email.php';
require 'HTMLPurifier/AttrDef/URI/Host.php';
require 'HTMLPurifier/AttrDef/URI/IPv4.php';
require 'HTMLPurifier/AttrDef/URI/IPv6.php';
require 'HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
require 'HTMLPurifier/AttrTransform/Background.php';
require 'HTMLPurifier/AttrTransform/BdoDir.php';
require 'HTMLPurifier/AttrTransform/BgColor.php';
require 'HTMLPurifier/AttrTransform/BoolToCSS.php';
require 'HTMLPurifier/AttrTransform/Border.php';
require 'HTMLPurifier/AttrTransform/EnumToCSS.php';
require 'HTMLPurifier/AttrTransform/ImgRequired.php';
require 'HTMLPurifier/AttrTransform/ImgSpace.php';
require 'HTMLPurifier/AttrTransform/Input.php';
require 'HTMLPurifier/AttrTransform/Lang.php';
require 'HTMLPurifier/AttrTransform/Length.php';
require 'HTMLPurifier/AttrTransform/Name.php';
require 'HTMLPurifier/AttrTransform/NameSync.php';
require 'HTMLPurifier/AttrTransform/Nofollow.php';
require 'HTMLPurifier/AttrTransform/SafeEmbed.php';
require 'HTMLPurifier/AttrTransform/SafeObject.php';
require 'HTMLPurifier/AttrTransform/SafeParam.php';
require 'HTMLPurifier/AttrTransform/ScriptRequired.php';
require 'HTMLPurifier/AttrTransform/TargetBlank.php';
require 'HTMLPurifier/AttrTransform/TargetNoopener.php';
require 'HTMLPurifier/AttrTransform/TargetNoreferrer.php';
require 'HTMLPurifier/AttrTransform/Textarea.php';
require 'HTMLPurifier/ChildDef/Chameleon.php';
require 'HTMLPurifier/ChildDef/Custom.php';
require 'HTMLPurifier/ChildDef/Empty.php';
require 'HTMLPurifier/ChildDef/List.php';
require 'HTMLPurifier/ChildDef/Required.php';
require 'HTMLPurifier/ChildDef/Optional.php';
require 'HTMLPurifier/ChildDef/StrictBlockquote.php';
require 'HTMLPurifier/ChildDef/Table.php';
require 'HTMLPurifier/DefinitionCache/Decorator.php';
require 'HTMLPurifier/DefinitionCache/Null.php';
require 'HTMLPurifier/DefinitionCache/Serializer.php';
require 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
require 'HTMLPurifier/DefinitionCache/Decorator/Memory.php';
require 'HTMLPurifier/HTMLModule/Bdo.php';
require 'HTMLPurifier/HTMLModule/CommonAttributes.php';
require 'HTMLPurifier/HTMLModule/Edit.php';
require 'HTMLPurifier/HTMLModule/Forms.php';
require 'HTMLPurifier/HTMLModule/Hypertext.php';
require 'HTMLPurifier/HTMLModule/Iframe.php';
require 'HTMLPurifier/HTMLModule/Image.php';
require 'HTMLPurifier/HTMLModule/Legacy.php';
require 'HTMLPurifier/HTMLModule/List.php';
require 'HTMLPurifier/HTMLModule/Name.php';
require 'HTMLPurifier/HTMLModule/Nofollow.php';
require 'HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
require 'HTMLPurifier/HTMLModule/Object.php';
require 'HTMLPurifier/HTMLModule/Presentation.php';
require 'HTMLPurifier/HTMLModule/Proprietary.php';
require 'HTMLPurifier/HTMLModule/Ruby.php';
require 'HTMLPurifier/HTMLModule/SafeEmbed.php';
require 'HTMLPurifier/HTMLModule/SafeObject.php';
require 'HTMLPurifier/HTMLModule/SafeScripting.php';
require 'HTMLPurifier/HTMLModule/Scripting.php';
require 'HTMLPurifier/HTMLModule/StyleAttribute.php';
require 'HTMLPurifier/HTMLModule/Tables.php';
require 'HTMLPurifier/HTMLModule/Target.php';
require 'HTMLPurifier/HTMLModule/TargetBlank.php';
require 'HTMLPurifier/HTMLModule/TargetNoopener.php';
require 'HTMLPurifier/HTMLModule/TargetNoreferrer.php';
require 'HTMLPurifier/HTMLModule/Text.php';
require 'HTMLPurifier/HTMLModule/Tidy.php';
require 'HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
require 'HTMLPurifier/HTMLModule/Tidy/Name.php';
require 'HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
require 'HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
require 'HTMLPurifier/HTMLModule/Tidy/Strict.php';
require 'HTMLPurifier/HTMLModule/Tidy/Transitional.php';
require 'HTMLPurifier/HTMLModule/Tidy/XHTML.php';
require 'HTMLPurifier/Injector/AutoParagraph.php';
require 'HTMLPurifier/Injector/DisplayLinkURI.php';
require 'HTMLPurifier/Injector/Linkify.php';
require 'HTMLPurifier/Injector/PurifierLinkify.php';
require 'HTMLPurifier/Injector/RemoveEmpty.php';
require 'HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
require 'HTMLPurifier/Injector/SafeObject.php';
require 'HTMLPurifier/Lexer/DOMLex.php';
require 'HTMLPurifier/Lexer/DirectLex.php';
require 'HTMLPurifier/Node/Comment.php';
require 'HTMLPurifier/Node/Element.php';
require 'HTMLPurifier/Node/Text.php';
require 'HTMLPurifier/Strategy/Composite.php';
require 'HTMLPurifier/Strategy/Core.php';
require 'HTMLPurifier/Strategy/FixNesting.php';
require 'HTMLPurifier/Strategy/MakeWellFormed.php';
require 'HTMLPurifier/Strategy/RemoveForeignElements.php';
require 'HTMLPurifier/Strategy/ValidateAttributes.php';
require 'HTMLPurifier/TagTransform/Font.php';
require 'HTMLPurifier/TagTransform/Simple.php';
require 'HTMLPurifier/Token/Comment.php';
require 'HTMLPurifier/Token/Tag.php';
require 'HTMLPurifier/Token/Empty.php';
require 'HTMLPurifier/Token/End.php';
require 'HTMLPurifier/Token/Start.php';
require 'HTMLPurifier/Token/Text.php';
require 'HTMLPurifier/URIFilter/DisableExternal.php';
require 'HTMLPurifier/URIFilter/DisableExternalResources.php';
require 'HTMLPurifier/URIFilter/DisableResources.php';
require 'HTMLPurifier/URIFilter/HostBlacklist.php';
require 'HTMLPurifier/URIFilter/MakeAbsolute.php';
require 'HTMLPurifier/URIFilter/Munge.php';
require 'HTMLPurifier/URIFilter/SafeIframe.php';
require 'HTMLPurifier/URIScheme/data.php';
require 'HTMLPurifier/URIScheme/file.php';
require 'HTMLPurifier/URIScheme/ftp.php';
require 'HTMLPurifier/URIScheme/http.php';
require 'HTMLPurifier/URIScheme/https.php';
require 'HTMLPurifier/URIScheme/mailto.php';
require 'HTMLPurifier/URIScheme/news.php';
require 'HTMLPurifier/URIScheme/nntp.php';
require 'HTMLPurifier/URIScheme/tel.php';
require 'HTMLPurifier/VarParser/Flexible.php';
require 'HTMLPurifier/VarParser/Native.php';

View File

@ -1,30 +0,0 @@
<?php
/**
* @file
* Emulation layer for code that used kses(), substituting in HTML Purifier.
*/
require_once dirname(__FILE__) . '/HTMLPurifier.auto.php';
function kses($string, $allowed_html, $allowed_protocols = null)
{
$config = HTMLPurifier_Config::createDefault();
$allowed_elements = array();
$allowed_attributes = array();
foreach ($allowed_html as $element => $attributes) {
$allowed_elements[$element] = true;
foreach ($attributes as $attribute => $x) {
$allowed_attributes["$element.$attribute"] = true;
}
}
$config->set('HTML.AllowedElements', $allowed_elements);
$config->set('HTML.AllowedAttributes', $allowed_attributes);
if ($allowed_protocols !== null) {
$config->set('URI.AllowedSchemes', $allowed_protocols);
}
$purifier = new HTMLPurifier($config);
return $purifier->purify($string);
}
// vim: et sw=4 sts=4

View File

@ -1,11 +0,0 @@
<?php
/**
* @file
* Convenience stub file that adds HTML Purifier's library file to the path
* without any other side-effects.
*/
set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path() );
// vim: et sw=4 sts=4

View File

@ -1,297 +0,0 @@
<?php
/*! @mainpage
*
* HTML Purifier is an HTML filter that will take an arbitrary snippet of
* HTML and rigorously test, validate and filter it into a version that
* is safe for output onto webpages. It achieves this by:
*
* -# Lexing (parsing into tokens) the document,
* -# Executing various strategies on the tokens:
* -# Removing all elements not in the whitelist,
* -# Making the tokens well-formed,
* -# Fixing the nesting of the nodes, and
* -# Validating attributes of the nodes; and
* -# Generating HTML from the purified tokens.
*
* However, most users will only need to interface with the HTMLPurifier
* and HTMLPurifier_Config.
*/
/*
HTML Purifier 4.15.0 - Standards Compliant HTML Filtering
Copyright (C) 2006-2008 Edward Z. Yang
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Facade that coordinates HTML Purifier's subsystems in order to purify HTML.
*
* @note There are several points in which configuration can be specified
* for HTML Purifier. The precedence of these (from lowest to
* highest) is as follows:
* -# Instance: new HTMLPurifier($config)
* -# Invocation: purify($html, $config)
* These configurations are entirely independent of each other and
* are *not* merged (this behavior may change in the future).
*
* @todo We need an easier way to inject strategies using the configuration
* object.
*/
class HTMLPurifier
{
/**
* Version of HTML Purifier.
* @type string
*/
public $version = '4.15.0';
/**
* Constant with version of HTML Purifier.
*/
const VERSION = '4.15.0';
/**
* Global configuration object.
* @type HTMLPurifier_Config
*/
public $config;
/**
* Array of extra filter objects to run on HTML,
* for backwards compatibility.
* @type HTMLPurifier_Filter[]
*/
private $filters = array();
/**
* Single instance of HTML Purifier.
* @type HTMLPurifier
*/
private static $instance;
/**
* @type HTMLPurifier_Strategy_Core
*/
protected $strategy;
/**
* @type HTMLPurifier_Generator
*/
protected $generator;
/**
* Resultant context of last run purification.
* Is an array of contexts if the last called method was purifyArray().
* @type HTMLPurifier_Context
*/
public $context;
/**
* Initializes the purifier.
*
* @param HTMLPurifier_Config|mixed $config Optional HTMLPurifier_Config object
* for all instances of the purifier, if omitted, a default
* configuration is supplied (which can be overridden on a
* per-use basis).
* The parameter can also be any type that
* HTMLPurifier_Config::create() supports.
*/
public function __construct($config = null)
{
$this->config = HTMLPurifier_Config::create($config);
$this->strategy = new HTMLPurifier_Strategy_Core();
}
/**
* Adds a filter to process the output. First come first serve
*
* @param HTMLPurifier_Filter $filter HTMLPurifier_Filter object
*/
public function addFilter($filter)
{
trigger_error(
'HTMLPurifier->addFilter() is deprecated, use configuration directives' .
' in the Filter namespace or Filter.Custom',
E_USER_WARNING
);
$this->filters[] = $filter;
}
/**
* Filters an HTML snippet/document to be XSS-free and standards-compliant.
*
* @param string $html String of HTML to purify
* @param HTMLPurifier_Config $config Config object for this operation,
* if omitted, defaults to the config object specified during this
* object's construction. The parameter can also be any type
* that HTMLPurifier_Config::create() supports.
*
* @return string Purified HTML
*/
public function purify($html, $config = null)
{
// :TODO: make the config merge in, instead of replace
$config = $config ? HTMLPurifier_Config::create($config) : $this->config;
// implementation is partially environment dependant, partially
// configuration dependant
$lexer = HTMLPurifier_Lexer::create($config);
$context = new HTMLPurifier_Context();
// setup HTML generator
$this->generator = new HTMLPurifier_Generator($config, $context);
$context->register('Generator', $this->generator);
// set up global context variables
if ($config->get('Core.CollectErrors')) {
// may get moved out if other facilities use it
$language_factory = HTMLPurifier_LanguageFactory::instance();
$language = $language_factory->create($config, $context);
$context->register('Locale', $language);
$error_collector = new HTMLPurifier_ErrorCollector($context);
$context->register('ErrorCollector', $error_collector);
}
// setup id_accumulator context, necessary due to the fact that
// AttrValidator can be called from many places
$id_accumulator = HTMLPurifier_IDAccumulator::build($config, $context);
$context->register('IDAccumulator', $id_accumulator);
$html = HTMLPurifier_Encoder::convertToUTF8($html, $config, $context);
// setup filters
$filter_flags = $config->getBatch('Filter');
$custom_filters = $filter_flags['Custom'];
unset($filter_flags['Custom']);
$filters = array();
foreach ($filter_flags as $filter => $flag) {
if (!$flag) {
continue;
}
if (strpos($filter, '.') !== false) {
continue;
}
$class = "HTMLPurifier_Filter_$filter";
$filters[] = new $class;
}
foreach ($custom_filters as $filter) {
// maybe "HTMLPurifier_Filter_$filter", but be consistent with AutoFormat
$filters[] = $filter;
}
$filters = array_merge($filters, $this->filters);
// maybe prepare(), but later
for ($i = 0, $filter_size = count($filters); $i < $filter_size; $i++) {
$html = $filters[$i]->preFilter($html, $config, $context);
}
// purified HTML
$html =
$this->generator->generateFromTokens(
// list of tokens
$this->strategy->execute(
// list of un-purified tokens
$lexer->tokenizeHTML(
// un-purified HTML
$html,
$config,
$context
),
$config,
$context
)
);
for ($i = $filter_size - 1; $i >= 0; $i--) {
$html = $filters[$i]->postFilter($html, $config, $context);
}
$html = HTMLPurifier_Encoder::convertFromUTF8($html, $config, $context);
$this->context =& $context;
return $html;
}
/**
* Filters an array of HTML snippets
*
* @param string[] $array_of_html Array of html snippets
* @param HTMLPurifier_Config $config Optional config object for this operation.
* See HTMLPurifier::purify() for more details.
*
* @return string[] Array of purified HTML
*/
public function purifyArray($array_of_html, $config = null)
{
$context_array = array();
$array = array();
foreach($array_of_html as $key=>$value){
if (is_array($value)) {
$array[$key] = $this->purifyArray($value, $config);
} else {
$array[$key] = $this->purify($value, $config);
}
$context_array[$key] = $this->context;
}
$this->context = $context_array;
return $array;
}
/**
* Singleton for enforcing just one HTML Purifier in your system
*
* @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
* HTMLPurifier instance to overload singleton with,
* or HTMLPurifier_Config instance to configure the
* generated version with.
*
* @return HTMLPurifier
*/
public static function instance($prototype = null)
{
if (!self::$instance || $prototype) {
if ($prototype instanceof HTMLPurifier) {
self::$instance = $prototype;
} elseif ($prototype) {
self::$instance = new HTMLPurifier($prototype);
} else {
self::$instance = new HTMLPurifier();
}
}
return self::$instance;
}
/**
* Singleton for enforcing just one HTML Purifier in your system
*
* @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
* HTMLPurifier instance to overload singleton with,
* or HTMLPurifier_Config instance to configure the
* generated version with.
*
* @return HTMLPurifier
* @note Backwards compatibility, see instance()
*/
public static function getInstance($prototype = null)
{
return HTMLPurifier::instance($prototype);
}
}
// vim: et sw=4 sts=4

View File

@ -1,229 +0,0 @@
<?php
/**
* @file
* This file was auto-generated by generate-includes.php and includes all of
* the core files required by HTML Purifier. This is a convenience stub that
* includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
* EDIT THIS FILE, changes will be overwritten the next time the script is run.
*
* Changes to include_path are not necessary.
*/
$__dir = dirname(__FILE__);
require_once $__dir . '/HTMLPurifier.php';
require_once $__dir . '/HTMLPurifier/Arborize.php';
require_once $__dir . '/HTMLPurifier/AttrCollections.php';
require_once $__dir . '/HTMLPurifier/AttrDef.php';
require_once $__dir . '/HTMLPurifier/AttrTransform.php';
require_once $__dir . '/HTMLPurifier/AttrTypes.php';
require_once $__dir . '/HTMLPurifier/AttrValidator.php';
require_once $__dir . '/HTMLPurifier/Bootstrap.php';
require_once $__dir . '/HTMLPurifier/Definition.php';
require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
require_once $__dir . '/HTMLPurifier/ChildDef.php';
require_once $__dir . '/HTMLPurifier/Config.php';
require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
require_once $__dir . '/HTMLPurifier/ContentSets.php';
require_once $__dir . '/HTMLPurifier/Context.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
require_once $__dir . '/HTMLPurifier/Doctype.php';
require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
require_once $__dir . '/HTMLPurifier/ElementDef.php';
require_once $__dir . '/HTMLPurifier/Encoder.php';
require_once $__dir . '/HTMLPurifier/EntityLookup.php';
require_once $__dir . '/HTMLPurifier/EntityParser.php';
require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
require_once $__dir . '/HTMLPurifier/Exception.php';
require_once $__dir . '/HTMLPurifier/Filter.php';
require_once $__dir . '/HTMLPurifier/Generator.php';
require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
require_once $__dir . '/HTMLPurifier/HTMLModule.php';
require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
require_once $__dir . '/HTMLPurifier/Injector.php';
require_once $__dir . '/HTMLPurifier/Language.php';
require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
require_once $__dir . '/HTMLPurifier/Length.php';
require_once $__dir . '/HTMLPurifier/Lexer.php';
require_once $__dir . '/HTMLPurifier/Node.php';
require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
require_once $__dir . '/HTMLPurifier/PropertyList.php';
require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
require_once $__dir . '/HTMLPurifier/Queue.php';
require_once $__dir . '/HTMLPurifier/Strategy.php';
require_once $__dir . '/HTMLPurifier/StringHash.php';
require_once $__dir . '/HTMLPurifier/StringHashParser.php';
require_once $__dir . '/HTMLPurifier/TagTransform.php';
require_once $__dir . '/HTMLPurifier/Token.php';
require_once $__dir . '/HTMLPurifier/TokenFactory.php';
require_once $__dir . '/HTMLPurifier/URI.php';
require_once $__dir . '/HTMLPurifier/URIDefinition.php';
require_once $__dir . '/HTMLPurifier/URIFilter.php';
require_once $__dir . '/HTMLPurifier/URIParser.php';
require_once $__dir . '/HTMLPurifier/URIScheme.php';
require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
require_once $__dir . '/HTMLPurifier/UnitConverter.php';
require_once $__dir . '/HTMLPurifier/VarParser.php';
require_once $__dir . '/HTMLPurifier/VarParserException.php';
require_once $__dir . '/HTMLPurifier/Zipper.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Clone.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Ident.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ContentEditable.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Nofollow.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetBlank.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoopener.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetNoreferrer.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
require_once $__dir . '/HTMLPurifier/ChildDef/List.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Iframe.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Nofollow.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeScripting.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetBlank.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoopener.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetNoreferrer.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
require_once $__dir . '/HTMLPurifier/Node/Comment.php';
require_once $__dir . '/HTMLPurifier/Node/Element.php';
require_once $__dir . '/HTMLPurifier/Node/Text.php';
require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
require_once $__dir . '/HTMLPurifier/Token/Comment.php';
require_once $__dir . '/HTMLPurifier/Token/Tag.php';
require_once $__dir . '/HTMLPurifier/Token/Empty.php';
require_once $__dir . '/HTMLPurifier/Token/End.php';
require_once $__dir . '/HTMLPurifier/Token/Start.php';
require_once $__dir . '/HTMLPurifier/Token/Text.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
require_once $__dir . '/HTMLPurifier/URIFilter/SafeIframe.php';
require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
require_once $__dir . '/HTMLPurifier/URIScheme/tel.php';
require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
require_once $__dir . '/HTMLPurifier/VarParser/Native.php';

View File

@ -1,71 +0,0 @@
<?php
/**
* Converts a stream of HTMLPurifier_Token into an HTMLPurifier_Node,
* and back again.
*
* @note This transformation is not an equivalence. We mutate the input
* token stream to make it so; see all [MUT] markers in code.
*/
class HTMLPurifier_Arborize
{
public static function arborize($tokens, $config, $context) {
$definition = $config->getHTMLDefinition();
$parent = new HTMLPurifier_Token_Start($definition->info_parent);
$stack = array($parent->toNode());
foreach ($tokens as $token) {
$token->skip = null; // [MUT]
$token->carryover = null; // [MUT]
if ($token instanceof HTMLPurifier_Token_End) {
$token->start = null; // [MUT]
$r = array_pop($stack);
//assert($r->name === $token->name);
//assert(empty($token->attr));
$r->endCol = $token->col;
$r->endLine = $token->line;
$r->endArmor = $token->armor;
continue;
}
$node = $token->toNode();
$stack[count($stack)-1]->children[] = $node;
if ($token instanceof HTMLPurifier_Token_Start) {
$stack[] = $node;
}
}
//assert(count($stack) == 1);
return $stack[0];
}
public static function flatten($node, $config, $context) {
$level = 0;
$nodes = array($level => new HTMLPurifier_Queue(array($node)));
$closingTokens = array();
$tokens = array();
do {
while (!$nodes[$level]->isEmpty()) {
$node = $nodes[$level]->shift(); // FIFO
list($start, $end) = $node->toTokenPair();
if ($level > 0) {
$tokens[] = $start;
}
if ($end !== NULL) {
$closingTokens[$level][] = $end;
}
if ($node instanceof HTMLPurifier_Node_Element) {
$level++;
$nodes[$level] = new HTMLPurifier_Queue();
foreach ($node->children as $childNode) {
$nodes[$level]->push($childNode);
}
}
}
$level--;
if ($level && isset($closingTokens[$level])) {
while ($token = array_pop($closingTokens[$level])) {
$tokens[] = $token;
}
}
} while ($level > 0);
return $tokens;
}
}

View File

@ -1,148 +0,0 @@
<?php
/**
* Defines common attribute collections that modules reference
*/
class HTMLPurifier_AttrCollections
{
/**
* Associative array of attribute collections, indexed by name.
* @type array
*/
public $info = array();
/**
* Performs all expansions on internal data for use by other inclusions
* It also collects all attribute collection extensions from
* modules
* @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
* @param HTMLPurifier_HTMLModule[] $modules Hash array of HTMLPurifier_HTMLModule members
*/
public function __construct($attr_types, $modules)
{
$this->doConstruct($attr_types, $modules);
}
public function doConstruct($attr_types, $modules)
{
// load extensions from the modules
foreach ($modules as $module) {
foreach ($module->attr_collections as $coll_i => $coll) {
if (!isset($this->info[$coll_i])) {
$this->info[$coll_i] = array();
}
foreach ($coll as $attr_i => $attr) {
if ($attr_i === 0 && isset($this->info[$coll_i][$attr_i])) {
// merge in includes
$this->info[$coll_i][$attr_i] = array_merge(
$this->info[$coll_i][$attr_i],
$attr
);
continue;
}
$this->info[$coll_i][$attr_i] = $attr;
}
}
}
// perform internal expansions and inclusions
foreach ($this->info as $name => $attr) {
// merge attribute collections that include others
$this->performInclusions($this->info[$name]);
// replace string identifiers with actual attribute objects
$this->expandIdentifiers($this->info[$name], $attr_types);
}
}
/**
* Takes a reference to an attribute associative array and performs
* all inclusions specified by the zero index.
* @param array &$attr Reference to attribute array
*/
public function performInclusions(&$attr)
{
if (!isset($attr[0])) {
return;
}
$merge = $attr[0];
$seen = array(); // recursion guard
// loop through all the inclusions
for ($i = 0; isset($merge[$i]); $i++) {
if (isset($seen[$merge[$i]])) {
continue;
}
$seen[$merge[$i]] = true;
// foreach attribute of the inclusion, copy it over
if (!isset($this->info[$merge[$i]])) {
continue;
}
foreach ($this->info[$merge[$i]] as $key => $value) {
if (isset($attr[$key])) {
continue;
} // also catches more inclusions
$attr[$key] = $value;
}
if (isset($this->info[$merge[$i]][0])) {
// recursion
$merge = array_merge($merge, $this->info[$merge[$i]][0]);
}
}
unset($attr[0]);
}
/**
* Expands all string identifiers in an attribute array by replacing
* them with the appropriate values inside HTMLPurifier_AttrTypes
* @param array &$attr Reference to attribute array
* @param HTMLPurifier_AttrTypes $attr_types HTMLPurifier_AttrTypes instance
*/
public function expandIdentifiers(&$attr, $attr_types)
{
// because foreach will process new elements we add, make sure we
// skip duplicates
$processed = array();
foreach ($attr as $def_i => $def) {
// skip inclusions
if ($def_i === 0) {
continue;
}
if (isset($processed[$def_i])) {
continue;
}
// determine whether or not attribute is required
if ($required = (strpos($def_i, '*') !== false)) {
// rename the definition
unset($attr[$def_i]);
$def_i = trim($def_i, '*');
$attr[$def_i] = $def;
}
$processed[$def_i] = true;
// if we've already got a literal object, move on
if (is_object($def)) {
// preserve previous required
$attr[$def_i]->required = ($required || $attr[$def_i]->required);
continue;
}
if ($def === false) {
unset($attr[$def_i]);
continue;
}
if ($t = $attr_types->get($def)) {
$attr[$def_i] = $t;
$attr[$def_i]->required = $required;
} else {
unset($attr[$def_i]);
}
}
}
}
// vim: et sw=4 sts=4

View File

@ -1,144 +0,0 @@
<?php
/**
* Base class for all validating attribute definitions.
*
* This family of classes forms the core for not only HTML attribute validation,
* but also any sort of string that needs to be validated or cleaned (which
* means CSS properties and composite definitions are defined here too).
* Besides defining (through code) what precisely makes the string valid,
* subclasses are also responsible for cleaning the code if possible.
*/
abstract class HTMLPurifier_AttrDef
{
/**
* Tells us whether or not an HTML attribute is minimized.
* Has no meaning in other contexts.
* @type bool
*/
public $minimized = false;
/**
* Tells us whether or not an HTML attribute is required.
* Has no meaning in other contexts
* @type bool
*/
public $required = false;
/**
* Validates and cleans passed string according to a definition.
*
* @param string $string String to be validated and cleaned.
* @param HTMLPurifier_Config $config Mandatory HTMLPurifier_Config object.
* @param HTMLPurifier_Context $context Mandatory HTMLPurifier_Context object.
*/
abstract public function validate($string, $config, $context);
/**
* Convenience method that parses a string as if it were CDATA.
*
* This method process a string in the manner specified at
* <http://www.w3.org/TR/html4/types.html#h-6.2> by removing
* leading and trailing whitespace, ignoring line feeds, and replacing
* carriage returns and tabs with spaces. While most useful for HTML
* attributes specified as CDATA, it can also be applied to most CSS
* values.
*
* @note This method is not entirely standards compliant, as trim() removes
* more types of whitespace than specified in the spec. In practice,
* this is rarely a problem, as those extra characters usually have
* already been removed by HTMLPurifier_Encoder.
*
* @warning This processing is inconsistent with XML's whitespace handling
* as specified by section 3.3.3 and referenced XHTML 1.0 section
* 4.7. However, note that we are NOT necessarily
* parsing XML, thus, this behavior may still be correct. We
* assume that newlines have been normalized.
*/
public function parseCDATA($string)
{
$string = trim($string);
$string = str_replace(array("\n", "\t", "\r"), ' ', $string);
return $string;
}
/**
* Factory method for creating this class from a string.
* @param string $string String construction info
* @return HTMLPurifier_AttrDef Created AttrDef object corresponding to $string
*/
public function make($string)
{
// default implementation, return a flyweight of this object.
// If $string has an effect on the returned object (i.e. you
// need to overload this method), it is best
// to clone or instantiate new copies. (Instantiation is safer.)
return $this;
}
/**
* Removes spaces from rgb(0, 0, 0) so that shorthand CSS properties work
* properly. THIS IS A HACK!
* @param string $string a CSS colour definition
* @return string
*/
protected function mungeRgb($string)
{
$p = '\s*(\d+(\.\d+)?([%]?))\s*';
if (preg_match('/(rgba|hsla)\(/', $string)) {
return preg_replace('/(rgba|hsla)\('.$p.','.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8,\11)', $string);
}
return preg_replace('/(rgb|hsl)\('.$p.','.$p.','.$p.'\)/', '\1(\2,\5,\8)', $string);
}
/**
* Parses a possibly escaped CSS string and returns the "pure"
* version of it.
*/
protected function expandCSSEscape($string)
{
// flexibly parse it
$ret = '';
for ($i = 0, $c = strlen($string); $i < $c; $i++) {
if ($string[$i] === '\\') {
$i++;
if ($i >= $c) {
$ret .= '\\';
break;
}
if (ctype_xdigit($string[$i])) {
$code = $string[$i];
for ($a = 1, $i++; $i < $c && $a < 6; $i++, $a++) {
if (!ctype_xdigit($string[$i])) {
break;
}
$code .= $string[$i];
}
// We have to be extremely careful when adding
// new characters, to make sure we're not breaking
// the encoding.
$char = HTMLPurifier_Encoder::unichr(hexdec($code));
if (HTMLPurifier_Encoder::cleanUTF8($char) === '') {
continue;
}
$ret .= $char;
if ($i < $c && trim($string[$i]) !== '') {
$i--;
}
continue;
}
if ($string[$i] === "\n") {
continue;
}
}
$ret .= $string[$i];
}
return $ret;
}
}
// vim: et sw=4 sts=4

View File

@ -1,136 +0,0 @@
<?php
/**
* Validates the HTML attribute style, otherwise known as CSS.
* @note We don't implement the whole CSS specification, so it might be
* difficult to reuse this component in the context of validating
* actual stylesheet declarations.
* @note If we were really serious about validating the CSS, we would
* tokenize the styles and then parse the tokens. Obviously, we
* are not doing that. Doing that could seriously harm performance,
* but would make these components a lot more viable for a CSS
* filtering solution.
*/
class HTMLPurifier_AttrDef_CSS extends HTMLPurifier_AttrDef
{
/**
* @param string $css
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($css, $config, $context)
{
$css = $this->parseCDATA($css);
$definition = $config->getCSSDefinition();
$allow_duplicates = $config->get("CSS.AllowDuplicates");
// According to the CSS2.1 spec, the places where a
// non-delimiting semicolon can appear are in strings
// escape sequences. So here is some dumb hack to
// handle quotes.
$len = strlen($css);
$accum = "";
$declarations = array();
$quoted = false;
for ($i = 0; $i < $len; $i++) {
$c = strcspn($css, ";'\"", $i);
$accum .= substr($css, $i, $c);
$i += $c;
if ($i == $len) break;
$d = $css[$i];
if ($quoted) {
$accum .= $d;
if ($d == $quoted) {
$quoted = false;
}
} else {
if ($d == ";") {
$declarations[] = $accum;
$accum = "";
} else {
$accum .= $d;
$quoted = $d;
}
}
}
if ($accum != "") $declarations[] = $accum;
$propvalues = array();
$new_declarations = '';
/**
* Name of the current CSS property being validated.
*/
$property = false;
$context->register('CurrentCSSProperty', $property);
foreach ($declarations as $declaration) {
if (!$declaration) {
continue;
}
if (!strpos($declaration, ':')) {
continue;
}
list($property, $value) = explode(':', $declaration, 2);
$property = trim($property);
$value = trim($value);
$ok = false;
do {
if (isset($definition->info[$property])) {
$ok = true;
break;
}
if (ctype_lower($property)) {
break;
}
$property = strtolower($property);
if (isset($definition->info[$property])) {
$ok = true;
break;
}
} while (0);
if (!$ok) {
continue;
}
// inefficient call, since the validator will do this again
if (strtolower(trim($value)) !== 'inherit') {
// inherit works for everything (but only on the base property)
$result = $definition->info[$property]->validate(
$value,
$config,
$context
);
} else {
$result = 'inherit';
}
if ($result === false) {
continue;
}
if ($allow_duplicates) {
$new_declarations .= "$property:$result;";
} else {
$propvalues[$property] = $result;
}
}
$context->destroy('CurrentCSSProperty');
// procedure does not write the new CSS simultaneously, so it's
// slightly inefficient, but it's the only way of getting rid of
// duplicates. Perhaps config to optimize it, but not now.
foreach ($propvalues as $prop => $value) {
$new_declarations .= "$prop:$value;";
}
return $new_declarations ? $new_declarations : false;
}
}
// vim: et sw=4 sts=4

View File

@ -1,34 +0,0 @@
<?php
class HTMLPurifier_AttrDef_CSS_AlphaValue extends HTMLPurifier_AttrDef_CSS_Number
{
public function __construct()
{
parent::__construct(false); // opacity is non-negative, but we will clamp it
}
/**
* @param string $number
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return string
*/
public function validate($number, $config, $context)
{
$result = parent::validate($number, $config, $context);
if ($result === false) {
return $result;
}
$float = (float)$result;
if ($float < 0.0) {
$result = '0';
}
if ($float > 1.0) {
$result = '1';
}
return $result;
}
}
// vim: et sw=4 sts=4

View File

@ -1,113 +0,0 @@
<?php
/**
* Validates shorthand CSS property background.
* @warning Does not support url tokens that have internal spaces.
*/
class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
{
/**
* Local copy of component validators.
* @type HTMLPurifier_AttrDef[]
* @note See HTMLPurifier_AttrDef_Font::$info for a similar impl.
*/
protected $info;
/**
* @param HTMLPurifier_Config $config
*/
public function __construct($config)
{
$def = $config->getCSSDefinition();
$this->info['background-color'] = $def->info['background-color'];
$this->info['background-image'] = $def->info['background-image'];
$this->info['background-repeat'] = $def->info['background-repeat'];
$this->info['background-attachment'] = $def->info['background-attachment'];
$this->info['background-position'] = $def->info['background-position'];
$this->info['background-size'] = $def->info['background-size'];
}
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
// regular pre-processing
$string = $this->parseCDATA($string);
if ($string === '') {
return false;
}
// munge rgb() decl if necessary
$string = $this->mungeRgb($string);
// assumes URI doesn't have spaces in it
$bits = explode(' ', $string); // bits to process
$caught = array();
$caught['color'] = false;
$caught['image'] = false;
$caught['repeat'] = false;
$caught['attachment'] = false;
$caught['position'] = false;
$caught['size'] = false;
$i = 0; // number of catches
foreach ($bits as $bit) {
if ($bit === '') {
continue;
}
foreach ($caught as $key => $status) {
if ($key != 'position') {
if ($status !== false) {
continue;
}
$r = $this->info['background-' . $key]->validate($bit, $config, $context);
} else {
$r = $bit;
}
if ($r === false) {
continue;
}
if ($key == 'position') {
if ($caught[$key] === false) {
$caught[$key] = '';
}
$caught[$key] .= $r . ' ';
} else {
$caught[$key] = $r;
}
$i++;
break;
}
}
if (!$i) {
return false;
}
if ($caught['position'] !== false) {
$caught['position'] = $this->info['background-position']->
validate($caught['position'], $config, $context);
}
$ret = array();
foreach ($caught as $value) {
if ($value === false) {
continue;
}
$ret[] = $value;
}
if (empty($ret)) {
return false;
}
return implode(' ', $ret);
}
}
// vim: et sw=4 sts=4

View File

@ -1,157 +0,0 @@
<?php
/* W3C says:
[ // adjective and number must be in correct order, even if
// you could switch them without introducing ambiguity.
// some browsers support that syntax
[
<percentage> | <length> | left | center | right
]
[
<percentage> | <length> | top | center | bottom
]?
] |
[ // this signifies that the vertical and horizontal adjectives
// can be arbitrarily ordered, however, there can only be two,
// one of each, or none at all
[
left | center | right
] ||
[
top | center | bottom
]
]
top, left = 0%
center, (none) = 50%
bottom, right = 100%
*/
/* QuirksMode says:
keyword + length/percentage must be ordered correctly, as per W3C
Internet Explorer and Opera, however, support arbitrary ordering. We
should fix it up.
Minor issue though, not strictly necessary.
*/
// control freaks may appreciate the ability to convert these to
// percentages or something, but it's not necessary
/**
* Validates the value of background-position.
*/
class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
{
/**
* @type HTMLPurifier_AttrDef_CSS_Length
*/
protected $length;
/**
* @type HTMLPurifier_AttrDef_CSS_Percentage
*/
protected $percentage;
public function __construct()
{
$this->length = new HTMLPurifier_AttrDef_CSS_Length();
$this->percentage = new HTMLPurifier_AttrDef_CSS_Percentage();
}
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
$string = $this->parseCDATA($string);
$bits = explode(' ', $string);
$keywords = array();
$keywords['h'] = false; // left, right
$keywords['v'] = false; // top, bottom
$keywords['ch'] = false; // center (first word)
$keywords['cv'] = false; // center (second word)
$measures = array();
$i = 0;
$lookup = array(
'top' => 'v',
'bottom' => 'v',
'left' => 'h',
'right' => 'h',
'center' => 'c'
);
foreach ($bits as $bit) {
if ($bit === '') {
continue;
}
// test for keyword
$lbit = ctype_lower($bit) ? $bit : strtolower($bit);
if (isset($lookup[$lbit])) {
$status = $lookup[$lbit];
if ($status == 'c') {
if ($i == 0) {
$status = 'ch';
} else {
$status = 'cv';
}
}
$keywords[$status] = $lbit;
$i++;
}
// test for length
$r = $this->length->validate($bit, $config, $context);
if ($r !== false) {
$measures[] = $r;
$i++;
}
// test for percentage
$r = $this->percentage->validate($bit, $config, $context);
if ($r !== false) {
$measures[] = $r;
$i++;
}
}
if (!$i) {
return false;
} // no valid values were caught
$ret = array();
// first keyword
if ($keywords['h']) {
$ret[] = $keywords['h'];
} elseif ($keywords['ch']) {
$ret[] = $keywords['ch'];
$keywords['cv'] = false; // prevent re-use: center = center center
} elseif (count($measures)) {
$ret[] = array_shift($measures);
}
if ($keywords['v']) {
$ret[] = $keywords['v'];
} elseif ($keywords['cv']) {
$ret[] = $keywords['cv'];
} elseif (count($measures)) {
$ret[] = array_shift($measures);
}
if (empty($ret)) {
return false;
}
return implode(' ', $ret);
}
}
// vim: et sw=4 sts=4

View File

@ -1,56 +0,0 @@
<?php
/**
* Validates the border property as defined by CSS.
*/
class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
{
/**
* Local copy of properties this property is shorthand for.
* @type HTMLPurifier_AttrDef[]
*/
protected $info = array();
/**
* @param HTMLPurifier_Config $config
*/
public function __construct($config)
{
$def = $config->getCSSDefinition();
$this->info['border-width'] = $def->info['border-width'];
$this->info['border-style'] = $def->info['border-style'];
$this->info['border-top-color'] = $def->info['border-top-color'];
}
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
$string = $this->parseCDATA($string);
$string = $this->mungeRgb($string);
$bits = explode(' ', $string);
$done = array(); // segments we've finished
$ret = ''; // return value
foreach ($bits as $bit) {
foreach ($this->info as $propname => $validator) {
if (isset($done[$propname])) {
continue;
}
$r = $validator->validate($bit, $config, $context);
if ($r !== false) {
$ret .= $r . ' ';
$done[$propname] = true;
break;
}
}
}
return rtrim($ret);
}
}
// vim: et sw=4 sts=4

View File

@ -1,161 +0,0 @@
<?php
/**
* Validates Color as defined by CSS.
*/
class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
{
/**
* @type HTMLPurifier_AttrDef_CSS_AlphaValue
*/
protected $alpha;
public function __construct()
{
$this->alpha = new HTMLPurifier_AttrDef_CSS_AlphaValue();
}
/**
* @param string $color
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($color, $config, $context)
{
static $colors = null;
if ($colors === null) {
$colors = $config->get('Core.ColorKeywords');
}
$color = trim($color);
if ($color === '') {
return false;
}
$lower = strtolower($color);
if (isset($colors[$lower])) {
return $colors[$lower];
}
if (preg_match('#(rgb|rgba|hsl|hsla)\(#', $color, $matches) === 1) {
$length = strlen($color);
if (strpos($color, ')') !== $length - 1) {
return false;
}
// get used function : rgb, rgba, hsl or hsla
$function = $matches[1];
$parameters_size = 3;
$alpha_channel = false;
if (substr($function, -1) === 'a') {
$parameters_size = 4;
$alpha_channel = true;
}
/*
* Allowed types for values :
* parameter_position => [type => max_value]
*/
$allowed_types = array(
1 => array('percentage' => 100, 'integer' => 255),
2 => array('percentage' => 100, 'integer' => 255),
3 => array('percentage' => 100, 'integer' => 255),
);
$allow_different_types = false;
if (strpos($function, 'hsl') !== false) {
$allowed_types = array(
1 => array('integer' => 360),
2 => array('percentage' => 100),
3 => array('percentage' => 100),
);
$allow_different_types = true;
}
$values = trim(str_replace($function, '', $color), ' ()');
$parts = explode(',', $values);
if (count($parts) !== $parameters_size) {
return false;
}
$type = false;
$new_parts = array();
$i = 0;
foreach ($parts as $part) {
$i++;
$part = trim($part);
if ($part === '') {
return false;
}
// different check for alpha channel
if ($alpha_channel === true && $i === count($parts)) {
$result = $this->alpha->validate($part, $config, $context);
if ($result === false) {
return false;
}
$new_parts[] = (string)$result;
continue;
}
if (substr($part, -1) === '%') {
$current_type = 'percentage';
} else {
$current_type = 'integer';
}
if (!array_key_exists($current_type, $allowed_types[$i])) {
return false;
}
if (!$type) {
$type = $current_type;
}
if ($allow_different_types === false && $type != $current_type) {
return false;
}
$max_value = $allowed_types[$i][$current_type];
if ($current_type == 'integer') {
// Return value between range 0 -> $max_value
$new_parts[] = (int)max(min($part, $max_value), 0);
} elseif ($current_type == 'percentage') {
$new_parts[] = (float)max(min(rtrim($part, '%'), $max_value), 0) . '%';
}
}
$new_values = implode(',', $new_parts);
$color = $function . '(' . $new_values . ')';
} else {
// hexadecimal handling
if ($color[0] === '#') {
$hex = substr($color, 1);
} else {
$hex = $color;
$color = '#' . $color;
}
$length = strlen($hex);
if ($length !== 3 && $length !== 6) {
return false;
}
if (!ctype_xdigit($hex)) {
return false;
}
}
return $color;
}
}
// vim: et sw=4 sts=4

View File

@ -1,48 +0,0 @@
<?php
/**
* Allows multiple validators to attempt to validate attribute.
*
* Composite is just what it sounds like: a composite of many validators.
* This means that multiple HTMLPurifier_AttrDef objects will have a whack
* at the string. If one of them passes, that's what is returned. This is
* especially useful for CSS values, which often are a choice between
* an enumerated set of predefined values or a flexible data type.
*/
class HTMLPurifier_AttrDef_CSS_Composite extends HTMLPurifier_AttrDef
{
/**
* List of objects that may process strings.
* @type HTMLPurifier_AttrDef[]
* @todo Make protected
*/
public $defs;
/**
* @param HTMLPurifier_AttrDef[] $defs List of HTMLPurifier_AttrDef objects
*/
public function __construct($defs)
{
$this->defs = $defs;
}
/**
* @param string $string
* @param HTMLPurifier_Config $config
* @param HTMLPurifier_Context $context
* @return bool|string
*/
public function validate($string, $config, $context)
{
foreach ($this->defs as $i => $def) {
$result = $this->defs[$i]->validate($string, $config, $context);
if ($result !== false) {
return $result;
}
}
return false;
}
}
// vim: et sw=4 sts=4

Some files were not shown because too many files have changed in this diff Show More