当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_get_singlevalue函数代码示例

本文整理汇总了PHP中sql_get_singlevalue函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_get_singlevalue函数的具体用法?PHP sql_get_singlevalue怎么用?PHP sql_get_singlevalue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sql_get_singlevalue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stats_generate

 function stats_generate()
 {
     log_write("debug", "phone_home", "Executing stats_generate()");
     /*
     	Application Details
     */
     $this->stats["app_name"] = $GLOBALS["config"]["app_name"];
     $this->stats["app_version"] = $GLOBALS["config"]["app_version"];
     /*
     	Server Details
     */
     $this->stats["server_app"] = $_SERVER["SERVER_SOFTWARE"];
     $this->stats["server_php"] = phpversion();
     /*
     	Configuration Information
     */
     // account information
     $this->stats["subscription_support"] = sql_get_singlevalue("SELECT value FROM config WHERE name='SUBSCRIPTION_SUPPORT' LIMIT 1");
     $this->stats["subscription_id"] = sql_get_singlevalue("SELECT value FROM config WHERE name='SUBSCRIPTION_ID' LIMIT 1");
     // check account ID
     if (!$this->stats["subscription_id"]) {
         // if no subscription id exists, then this must be running the open source version
         // we should create an ID so we can track requests from this server, we do this by
         // aggregating the server name and the instance name (if any) however we then hash
         // for privacy reasons.
         $this->stats["subscription_id"] = md5($_SERVER["SERVER_NAME"] . $_SESSION["user"]["instance"]["id"]);
         $sql_obj = new sql_query();
         $sql_obj->string = "UPDATE config SET value='" . $this->stats["subscription_id"] . "' WHERE name='SUBSCRIPTION_ID' LIMIT 1";
         $sql_obj->execute();
         log_write("debug", "phone_home", "Generated new subscription ID of " . $this->stats["subscription_id"] . "");
     }
     return 1;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:33,代码来源:inc_phone_home.php

示例2: get_tax_details

 function get_tax_details($id)
 {
     log_debug("taxes_manage_soap", "Executing get_tax_details({$id})");
     if (user_permissions_get("accounts_taxes_view")) {
         $obj_tax = new tax();
         // sanitise input
         $obj_tax->id = @security_script_input_predefined("int", $id);
         if (!$obj_tax->id || $obj_tax->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // verify that the ID is valid
         if (!$obj_tax->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // load data from DB for this tax
         if (!$obj_tax->load_data()) {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
         // to save SOAP users from having to do another lookup to find out what the chart name is,
         // we fetch the details here
         if ($obj_tax->data["chartid"]) {
             $obj_tax->data["chartid_label"] = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $obj_tax->data["chartid"] . "'");
         }
         // return data
         $return = array($obj_tax->data["name_tax"], $obj_tax->data["taxrate"], $obj_tax->data["chartid"], $obj_tax->data["chartid_label"], $obj_tax->data["taxnumber"], $obj_tax->data["description"]);
         return $return;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:30,代码来源:taxes_manage.php

示例3: page_output

 function page_output()
 {
     // fetch variables
     $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]);
     // create customer object
     $this->obj_customer = new customer();
     $this->obj_customer->id = $this->id;
     // define the navigation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Customer's Details", "page=customers/view.php&id=" . $this->id . "", TRUE);
     if (sql_get_singlevalue("SELECT value FROM config WHERE name='MODULE_CUSTOMER_PORTAL' LIMIT 1") == "enabled") {
         $this->obj_menu_nav->add_item("Portal Options", "page=customers/portal.php&id=" . $this->id . "");
     }
     $this->obj_menu_nav->add_item("Customer's Journal", "page=customers/journal.php&id=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Attributes", "page=customers/attributes.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Orders", "page=customers/orders.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Invoices", "page=customers/invoices.php&id=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Credit", "page=customers/credit.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Services", "page=customers/services.php&id=" . $this->id . "");
     if ($this->obj_customer->verify_reseller() == 1) {
         $this->obj_menu_nav->add_item("Reseller's Customers", "page=customers/reseller.php&id_customer=" . $this->obj_customer->id . "");
     }
     if (user_permissions_get("customers_write")) {
         $this->obj_menu_nav->add_item("Delete Customer", "page=customers/delete.php&id=" . $this->id . "");
     }
     // required pages
     $this->requires["javascript"][] = "include/customers/javascript/addedit_customers.js";
     $this->requires["javascript"][] = "include/customers/javascript/addedit_customer_contacts.js";
     $this->requires["css"][] = "include/customers/css/addedit_customer.css";
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:30,代码来源:view.php

示例4: page_output

 function page_output()
 {
     // fetch variables
     $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]);
     $this->journalid = @security_script_input('/^[0-9]*$/', $_GET["journalid"]);
     $this->action = @security_script_input('/^[a-z]*$/', $_GET["action"]);
     $this->type = @security_script_input('/^[a-z]*$/', $_GET["type"]);
     // create customer object
     $this->obj_customer = new customer();
     $this->obj_customer->id = $this->id;
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Customer's Details", "page=customers/view.php&id=" . $this->id . "");
     if (sql_get_singlevalue("SELECT value FROM config WHERE name='MODULE_CUSTOMER_PORTAL' LIMIT 1") == "enabled") {
         $this->obj_menu_nav->add_item("Portal Options", "page=customers/portal.php&id=" . $this->id . "");
     }
     $this->obj_menu_nav->add_item("Customer's Journal", "page=customers/journal.php&id=" . $this->id . "", TRUE);
     $this->obj_menu_nav->add_item("Customer's Attributes", "page=customers/attributes.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Orders", "page=customers/orders.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Invoices", "page=customers/invoices.php&id=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Credit", "page=customers/credit.php&id_customer=" . $this->id . "");
     $this->obj_menu_nav->add_item("Customer's Services", "page=customers/services.php&id=" . $this->id . "");
     if ($this->obj_customer->verify_reseller() == 1) {
         $this->obj_menu_nav->add_item("Reseller's Customers", "page=customers/reseller.php&id_customer=" . $this->obj_customer->id . "");
     }
     $this->obj_menu_nav->add_item("Delete Customer", "page=customers/delete.php&id=" . $this->id . "");
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:27,代码来源:journal-edit.php

示例5: render_html

 function render_html()
 {
     print "<h3>PROGRAM MANUALS</h3>";
     print "<p>This page lists all the program manual available for download.</p>";
     // standard user guide
     print "<br><br>";
     print "<h3>USER GUIDE</h3>";
     print "<p>If you are looking for information about using and configuring the Amberdms Billing System, download the user guide using the button below</p>";
     print "<a class=\"button\" target=\"new\" href=\"help/manual/amberdms_billing_system_userguide.pdf\">Download User Guide</a><br>";
     print "<br>";
     // administration guides
     // (these options differ depending on where you are running the application)
     $subscription_support = sql_get_singlevalue("SELECT value FROM config WHERE name='SUBSCRIPTION_SUPPORT' LIMIT 1");
     switch ($subscription_support) {
         case "hosted":
         case "hosted_phone":
             print "<br><br>";
             print "<h3>SYSADMIN MANUALS</h3>";
             print "<p>You are running the hosted version of the Amberdms Billing System, so no installation or upgrades are required. However, if you are interested in deploying the Amberdms Billing System open source releases elsewhere, you can download the installation manuals from our website.</p>";
             print "<a target=\"new\" class=\"button\" href=\"http://www.amberdms.com/?cms=opensource_billing\">Installation Instructions</a><br>";
             print "<br>";
             break;
         case "none":
         case "opensource":
         default:
             print "<br><br>";
             print "<h3>SYSADMIN MANUALS</h3>";
             print "<p>The following manuals are intended for system administrators installing or upgrading this program.</p>";
             print "<a class=\"button\" target=\"new\" href=\"help/manual/amberdms_billing_system_install_supported.pdf\">Installation on Supported Platforms</a><br><br>";
             print "<a class=\"button\" target=\"new\" href=\"help/manual/amberdms_billing_system_install_manual.pdf\">Manual Installation for Unsupported Platforms</a><br>";
             print "<br>";
             break;
     }
     // developer manual
     print "<br><br>";
     print "<h3>DEVELOPER MANUALS</h3>";
     print "<p>The following manual are intended for developers who want to write their own programs capable of talking to the Amberdms Billing\n\t\t\tSystem via the SOAP API, people interested in the code internals of the Amberdms Billing System or engineers wanting to intergrate\n\t\t\ttheir monitoring scripts with the service usage functions.</p>";
     print "<a class=\"button\" target=\"new\" href=\"help/manual/amberdms_billing_system_SOAP_API.pdf\">SOAP API Developer Documentation</a><br>";
     print "<br>";
     print "<a class=\"button\" target=\"new\" href=\"help/manual/amberdms_billing_system_service_usage_collectors.pdf\">Service Usage Collectors/Integration Documentation</a><br>";
     print "<br>";
     // mailing lists
     print "<br><br>";
     print "<h3>MAILING LISTS</h3>";
     print "<p>The following mailing lists may also be useful for finding out additional information, upcomming product features or dicussing\n\t\t\tdevelopment details with the Amberdms programmers.</p>";
     print "<table cellpadding=\"5\">";
     print "<tr>";
     print "<td><b>General User Discussion List</b></td>";
     print "<td><a class=\"button\" href=\"http://lists.amberdms.com/mailman/listinfo/amberdms-bs\">Sign Up</a></td>";
     print "<td><a class=\"button\" href=\"http://lists.amberdms.com/pipermail/amberdms-bs/\">Archives</a></td>";
     print "</tr>";
     print "<tr>";
     print "<td><b>Developers Mailing List</b></td>";
     print "<td><a class=\"button\" href=\"http://lists.amberdms.com/mailman/listinfo/amberdms-bs-devel\">Sign Up</a></td>";
     print "<td><a class=\"button\" href=\"http://lists.amberdms.com/pipermail/amberdms-bs-devel/\">Archives</a></td>";
     print "</tr>";
     print "</table>";
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:58,代码来源:help.php

示例6: quotes_calc_duedate

function quotes_calc_duedate($date)
{
    log_debug("inc_quotes_details", "Executing quotes_calc_duedate({$date})");
    // get the terms
    $terms = sql_get_singlevalue("SELECT value FROM config WHERE name='ACCOUNTS_TERMS_DAYS'");
    // break up the date, and reconfigure
    $date_array = explode("-", $date);
    $timestamp = mktime(0, 0, 0, $date_array[1], $date_array[2] + $terms, $date_array[0]);
    // generate the date
    return date("Y-m-d", $timestamp);
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:11,代码来源:inc_quotes.php

示例7: check_requirements

 function check_requirements()
 {
     // verify that customer exists
     if (!$this->obj_customer->verify_id()) {
         log_write("error", "page_output", "The requested customer (" . $this->obj_customer->id . ") does not exist - possibly the customer has been deleted.");
         return 0;
     }
     // ensure that the portal module is enabled
     if (sql_get_singlevalue("SELECT value FROM config WHERE name='MODULE_CUSTOMER_PORTAL' LIMIT 1") != "enabled") {
         log_write("error", "page_output", "MODULE_CUSTOMER_PORTAL is disabled, enable it if you wish to adjust customer portal configuration options.");
         return 0;
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:14,代码来源:portal.php

示例8: page_output

 function page_output()
 {
     // fetch key service details
     $this->id = @security_script_input('/^[0-9]*$/', $_GET["id"]);
     $this->service_type = sql_get_singlevalue("SELECT service_types.name as value FROM services LEFT JOIN service_types ON service_types.id = services.typeid WHERE services.id='" . $this->id . "' LIMIT 1");
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Service Details", "page=services/view.php&id=" . $this->id . "");
     $this->obj_menu_nav->add_item("Service Plan", "page=services/plan.php&id=" . $this->id . "");
     if ($this->service_type == "bundle") {
         $this->obj_menu_nav->add_item("Bundle Components", "page=services/bundles.php&id=" . $this->id . "", TRUE);
     }
     $this->obj_menu_nav->add_item("Service Journal", "page=services/journal.php&id=" . $this->id . "");
     if (user_permissions_get("services_write")) {
         $this->obj_menu_nav->add_item("Delete Service", "page=services/delete.php&id=" . $this->id . "");
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:17,代码来源:bundles.php

示例9: page_output

 function page_output()
 {
     $this->obj_serviceform = new services_form_delete();
     $this->obj_serviceform->serviceid = @security_script_input('/^[0-9]*$/', $_GET["id"]);
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Service Details", "page=services/view.php&id=" . $this->obj_serviceform->serviceid . "");
     $this->obj_menu_nav->add_item("Service Plan", "page=services/plan.php&id=" . $this->obj_serviceform->serviceid . "");
     if (sql_get_singlevalue("SELECT service_types.name as value FROM services LEFT JOIN service_types ON service_types.id = services.typeid WHERE services.id='" . $this->obj_serviceform->serviceid . "' LIMIT 1") == "bundle") {
         $this->obj_menu_nav->add_item("Bundle Components", "page=services/bundles.php&id=" . $this->obj_serviceform->serviceid . "");
     }
     if (in_array(sql_get_singlevalue("SELECT service_types.name as value FROM services LEFT JOIN service_types ON service_types.id = services.typeid WHERE services.id='" . $this->obj_serviceform->serviceid . "' LIMIT 1"), array("phone_single", "phone_tollfree", "phone_trunk"))) {
         $this->obj_menu_nav->add_item("Call Rate Override", "page=services/cdr-override.php&id=" . $this->obj_serviceform->serviceid . "");
     }
     $this->obj_menu_nav->add_item("Service Journal", "page=services/journal.php&id=" . $this->obj_serviceform->serviceid . "");
     $this->obj_menu_nav->add_item("Delete Service", "page=services/delete.php&id=" . $this->obj_serviceform->serviceid . "", TRUE);
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:17,代码来源:delete.php

示例10: execute

 function execute()
 {
     //check mail module and add data to array
     $name = "Mail";
     $location = "Mail.php";
     $status = @(include 'Mail.php');
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check mail mime module and add data to array
     $name = "Mail Mime";
     $location = "Mail/mime.php";
     $status = @(include 'Mail/mime.php');
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check mysql dump module and add data to array
     $name = "MySQL Dump";
     $location = sql_get_singlevalue("SELECT value FROM config WHERE name = 'APP_MYSQL_DUMP' LIMIT 1");
     $status = file_exists($location);
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check html to pdf module and add data to array
     $name = "WK HTML to PDF";
     $location = sql_get_singlevalue("SELECT value FROM config WHERE name = 'APP_WKHTMLTOPDF' LIMIT 1");
     $status = file_exists($location);
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check pdf latex module and add data to array
     $name = "PDF LaTeX";
     $location = sql_get_singlevalue("SELECT value FROM config WHERE name = 'APP_PDFLATEX' LIMIT 1");
     $status = file_exists($location);
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check if temp directory has write permissions and add data to array
     $name = "Temp Directory - Write";
     $location = sql_get_singlevalue("SELECT value FROM config WHERE name = 'PATH_TMPDIR' LIMIT 1");
     $status = is_writable($location);
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
     //check if temp directory has read permissions and add data to array
     $name = "Temp Directory - Read";
     $status = is_readable($location);
     $this->table_array[$name]["location"] = $location;
     $this->table_array[$name]["status"] = $status;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:44,代码来源:config_dependencies.php

示例11: page_output

 function page_output()
 {
     $this->obj_rate_table = new cdr_rate_table_rates();
     // fetch variables
     $this->obj_rate_table->id = @security_script_input('/^[0-9]*$/', $_GET["id"]);
     $this->obj_rate_table->id_rate = @security_script_input('/^[0-9]*$/', $_GET["id_rate"]);
     if (!$this->obj_rate_table->id_rate) {
         // check for prefix
         $prefix = @security_script_input('/^[0-9]*$/', $_GET["prefix"]);
         if (!empty($prefix)) {
             $this->obj_rate_table->id_rate = sql_get_singlevalue("SELECT id as value FROM cdr_rate_tables_values WHERE id_rate_table='" . $this->obj_rate_table->id . "' AND rate_prefix='" . $prefix . "' LIMIT 1");
         }
     }
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Rate Table Details", "page=services/cdr-rates-view.php&id=" . $this->obj_rate_table->id . "");
     $this->obj_menu_nav->add_item("Rate Table Items", "page=services/cdr-rates-items.php&id=" . $this->obj_rate_table->id . "", TRUE);
     $this->obj_menu_nav->add_item("Delete Rate Table", "page=services/cdr-rates-delete.php&id=" . $this->obj_rate_table->id . "");
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:19,代码来源:cdr-rates-items-edit.php

示例12: page_output

 function page_output()
 {
     // get selected employee
     $this->employeeid = @security_script_input('/^[0-9]*$/', $_GET["employeeid"]);
     if ($this->employeeid) {
         // save to session vars
         $_SESSION["form"]["timereg"]["employeeid"] = $this->employeeid;
     } else {
         // load from session vars
         if (isset($_SESSION["form"]["timereg"]["employeeid"])) {
             $this->employeeid = $_SESSION["form"]["timereg"]["employeeid"];
         }
     }
     // get selected date
     $this->date = @security_script_input('/^\\S*$/', $_GET["date"]);
     if (!$this->date) {
         // try alternative input syntax
         $this->date = @security_script_input_predefined("date", $_GET["date_yyyy"] . "-" . $_GET["date_mm"] . "-" . $_GET["date_dd"]);
         if ($this->date == "error") {
             $this->date = NULL;
         }
     }
     if ($this->date) {
         // save to session vars
         $_SESSION["timereg"]["date"] = $this->date;
     } else {
         if ($_SESSION["timereg"]["date"]) {
             // load from session vars
             $this->date = $_SESSION["timereg"]["date"];
         } else {
             // use today's date
             $this->date = date("Y-m-d");
         }
     }
     $this->date_split = explode("-", $this->date);
     // define the navigiation menu
     $this->obj_menu_nav = new menu_nav();
     $this->obj_menu_nav->add_item("Weekview", "page=timekeeping/timereg.php&year=" . time_calculate_yearnum($this->date) . "&weekofyear=" . time_calculate_weeknum($this->date) . "");
     $this->obj_menu_nav->add_item("Day View", "page=timekeeping/timereg-day.php&date=" . $this->date . "", TRUE);
     // get future booking config option
     $this->config_timesheet_booktofuture = sql_get_singlevalue("SELECT value FROM config WHERE name='TIMESHEET_BOOKTOFUTURE'");
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:42,代码来源:timereg-day.php

示例13: get_product_details

 function get_product_details($id)
 {
     log_debug("products_manage_soap", "Executing get_product_details({$id})");
     if (user_permissions_get("products_view")) {
         $obj_product = new product();
         // sanitise input
         $obj_product->id = @security_script_input_predefined("int", $id);
         if (!$obj_product->id || $obj_product->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // verify that the ID is valid
         if (!$obj_product->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // load data from DB for this product
         if (!$obj_product->load_data()) {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
         // to save SOAP clients from having to do another lookup to find the vendor name,
         // we fetch it now.
         if ($obj_product->data["vendorid"]) {
             $obj_product->data["vendorid_label"] = sql_get_singlevalue("SELECT name_vendor as value FROM vendors WHERE id='" . $obj_product->data["vendorid"] . "'");
         }
         // to save SOAP clients from having to do another lookup to find the account_sales and account_purchase
         // account names, we look them up now
         if ($obj_product->data["account_sales"]) {
             $obj_product->data["account_sales_label"] = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $obj_product->data["account_sales"] . "'");
         }
         if ($obj_product->data["account_purchase"]) {
             $obj_product->data["account_purchase_label"] = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $obj_product->data["account_purchase"] . "'");
         }
         // return data
         $return = array($obj_product->data["code_product"], $obj_product->data["name_product"], $obj_product->data["units"], $obj_product->data["details"], $obj_product->data["price_cost"], $obj_product->data["price_sale"], $obj_product->data["date_start"], $obj_product->data["date_end"], $obj_product->data["date_current"], $obj_product->data["quantity_instock"], $obj_product->data["quantity_vendor"], $obj_product->data["vendorid"], $obj_product->data["vendorid_label"], $obj_product->data["code_product_vendor"], $obj_product->data["account_sales"], $obj_product->data["account_sales_label"], $obj_product->data["account_purchase"], $obj_product->data["account_purchase_label"], $obj_product->data["discount"]);
         return $return;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:38,代码来源:products_manage.php

示例14: page_output

 function page_output()
 {
     // get selected employee
     $this->employeeid = @security_script_input('/^[0-9]*$/', $_GET["employeeid"]);
     if ($this->employeeid) {
         // save to session vars
         $_SESSION["form"]["timereg"]["employeeid"] = $this->employeeid;
     } else {
         // load from session vars
         if (isset($_SESSION["form"]["timereg"]["employeeid"]) && $_SESSION["form"]["timereg"]["employeeid"] != NULL) {
             $this->employeeid = $_SESSION["form"]["timereg"]["employeeid"];
         }
     }
     // get the chosen year + week
     $this->date_selected_year = @security_script_input('/^[0-9]*$/', $_GET["year"]);
     $this->date_selected_weekofyear = @security_script_input('/^[0-9]*$/', $_GET["weekofyear"]);
     if (!$this->date_selected_year) {
         if (!empty($_SESSION["timereg"]["year"])) {
             $this->date_selected_year = $_SESSION["timereg"]["year"];
         } else {
             $this->date_selected_year = date("Y");
         }
     }
     if (!$this->date_selected_weekofyear) {
         if (!empty($_SESSION["timereg"]["weekofyear"])) {
             $this->date_selected_weekofyear = $_SESSION["timereg"]["weekofyear"];
         } else {
             $this->date_selected_weekofyear = time_calculate_weeknum();
         }
     }
     // save to session vars
     $_SESSION["timereg"]["year"] = $this->date_selected_year;
     $_SESSION["timereg"]["weekofyear"] = $this->date_selected_weekofyear;
     // get future booking config option
     $this->config_timesheet_booktofuture = sql_get_singlevalue("SELECT value FROM config WHERE name='TIMESHEET_BOOKTOFUTURE'");
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:36,代码来源:timereg.php

示例15: generate_pdf

 function generate_pdf()
 {
     log_debug("template_engine_htmltopdf", "Executing generate_pdf()");
     //unset($_SESSION);
     /*
     	Generate temporary file for template
     */
     // generate unique tmp filename
     $tmp_filename = file_generate_name("/tmp/amberdms_billing_system");
     // write out template data
     if (!($handle = fopen("{$tmp_filename}.html", "w"))) {
         log_write("error", "template_engine_htmltopdf", "Failed to create temporary file ({$tmp_filename}.html) with template data");
         return 0;
     }
     $directory_prefix = $tmp_filename . "_";
     //$directory_prefix = "https://devel-web-tom.local.amberdms.com/development/amberdms/oss-amberdms-bs/trunk/templates/ar_invoice/ar_invoice_htmltopdf_telcostyle/";
     foreach ((array) $this->processed as $key => $processed_row) {
         $this->processed[$key] = str_replace("(tmp_filename)", $directory_prefix, $processed_row);
     }
     //print(implode("",$this->processed));
     //log_debug_render();
     //exit();
     foreach ($this->processed as $line) {
         if (fwrite($handle, $line) === FALSE) {
             log_write("error", "template_engine_htmltopdf", "Error occured whilst writing file ({$tmp_filename}.tex)");
             return 0;
         }
     }
     fclose($handle);
     /*
     	Create Directory for HTML data files & copy them over
     */
     $tmp_data_directory = $tmp_filename . "_html_data";
     mkdir($tmp_filename . "_html_data", 0700);
     $data_directory_items = glob($this->template_directory . "/html_data/*");
     foreach ((array) $data_directory_items as $data_dir_file) {
         $filename = basename($data_dir_file);
         $new_file_path = $tmp_data_directory . "/" . $filename;
         copy($data_dir_file, $new_file_path);
     }
     /*
     	Process with wkhtmltopdf
     
     	Note: In future, this may be extended to support alternative HTML to PDF rendering engines
     */
     // get the current directory so that we can change back after switching to the tmp directory
     $run_directory = getcwd();
     $app_wkhtmltopdf = sql_get_singlevalue("SELECT value FROM config WHERE name='APP_WKHTMLTOPDF' LIMIT 1");
     if (!is_executable($app_wkhtmltopdf)) {
         log_write("error", "process", "You have selected a template that requires the wkhtmltopdf engine, however {$app_wkhtmltopdf} does not exist or is not executable by your webserver process");
         return 0;
     }
     chdir("/tmp");
     // TODO: fix this to be a configurable value
     exec("{$app_wkhtmltopdf} -B 5mm -L 5mm -R 5mm -T 5mm {$tmp_filename}.html {$tmp_filename}.pdf 2>&1", $output);
     foreach ($output as $line) {
         log_debug("template_engine_htmltopdf", "wkhtmltopdf: {$line}");
     }
     if (in_array("wkhtmltopdf: cannot connect to X server", $output)) {
         log_debug("template_engine_htmltopdf", "Known fault on older systems, unable to run wkhtmltopdf without X server instance");
         /*
         	On older distribution versions of wkhtmltopdf, the shipped version of wkhtmltopdf/QT doesn't
         	work without a running X server.
         
         	This was fixed by patching both QT and wkhtmltopdf in later releases, however most distributions
         	don't appear to go to the extend of shipping this patched QT version. On RHEL platforms (as of RHEL 4/5/6), there is
         	no wkhtmltopdf, so we just ship a good package, on Ubuntu (as of 10.04 lts) where is the more limited package
         	we execute a wrapper script which runs a short lived Xorg session in a virtual framebuffer.
         
         	It's not perfect, in testing the PDFs are rendering nicely, apart from the page size being incorrect, regardless what paramaters
         	are passed to it - hence, we give the user a notification warning, so they know why the invoices are weird and how to fix it.
         
         	If we have numerious problems with a popular platform, then it will be worth Amberdms building packages for that platform, but
         	it's not a small effort.
         
         	TODO: Maybe we should have an external/natives/ static binary directory for some key essentials for common architectures?
         */
         $install_directory = dirname(__FILE__);
         $legacy_wrapper_cmd = "{$install_directory}/../../external/legacy/wkhtmltopdf_x11wrap.sh {$tmp_filename}.html {$tmp_filename}.pdf 2>&1";
         log_debug("template_engine_htmltopdf", "Executing {$legacy_wrapper_cmd}");
         $output = array();
         exec($legacy_wrapper_cmd, $output);
         foreach ($output as $line) {
             log_debug("template_engine_htmltopdf", "wkhtmltopdf (legacy wrapper): {$line}");
         }
         log_write("notification", "template_engine_htmltopdf", "Warning: Your server has a older/limited version of wkhtmltopdf installed, this can cause some performance and page-size rendering issues. If these cause you major issues, consider obtaining the static binary version and adjusting the configured executable path. A static version can be found on the wkhtmltopdf developer's website at http://code.google.com/p/wkhtmltopdf/downloads/list ");
     }
     /*
     	check that a PDF was generated
     */
     if (file_exists("{$tmp_filename}.pdf")) {
         log_debug("template_engine_htmltopdf", "Temporary PDF {$tmp_filename}.pdf generated");
         // import file data into memory
         $this->output = file_get_contents("{$tmp_filename}.pdf");
         // remove temporary files from disk
         @unlink("{$tmp_filename}");
         @unlink("{$tmp_filename}.aux");
         @unlink("{$tmp_filename}.log");
         @unlink("{$tmp_filename}.html");
         @unlink("{$tmp_filename}.pdf");
//.........这里部分代码省略.........
开发者ID:claybbs,项目名称:namedmanager,代码行数:101,代码来源:inc_template_engines.php


注:本文中的sql_get_singlevalue函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。