function __autoload($classname) { // generate classes on the fly using the $classname and tablename // Classname need to be of the form tablename_class, such as student_class etc // If the table does not exist in the DB, the include directory is checked for extra classes // get table name from $classname $lastunderscorepos = strrpos($classname, "_"); $tablename = substr($classname, 0, $lastunderscorepos); //logmessage("Searching for table " . $tablename); // first check whether a table exists with the name of the class global $ORIONDB_DB; $table_exists = $ORIONDB_DB->table_exists($tablename); if ($table_exists) { // setup the class $codetoeval = "class " . $classname . " extends OrionDB_Object {"; $codetoeval .= "function __construct(){ parent::__construct('" . $tablename . "'); } }"; eval($codetoeval); //logmessage("Generated class " . $classname); } else { // check for external PHP files to include // before requiring the file, check whether it exists $filename = "includes/" . $classname . ".php"; if (file_exists($filename)) { require_once $filename; //logmessage("Loaded external PHP file " . $filename); } else { // make a log note logmessage('Autoload did not succeed in finding a decent source to create a class with. Classname:' . $classname); //return false;// do nothing for else, unless this breaks things } } }
<script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> function ReturnProgress() { document.getElementById('status').innerHTML = 'Please stand by, rebooting ...'; document.getElementById('progress').innerHTML = '<img src="images/ProgressIndicator.GIF" width="100" height="15" alt="">'; } function GoToHome() { window.location = '/login.php'; } </script> <?php include 'functions.php'; logmessage("Loading page Maintenance-Reboot.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
flush(); } else { logmessage("Certificate generation failed, because one of the fields is not filled in."); echo '<script>ReturnStatus_openvpn_newuser("All fields are required!");</script>'; } } else { echo "error error!!!"; echo '<script>ReturnStatusNewCertificate("' . $txtusernameerr . $txtfirstnameerr . $txtlastnameerr . $txtcountryerr . $txtcityerr . $txtprovinceerr . $txtorganisationerr . $txtemailerr . '");</script>'; } } ?> <!-- ********************************************************************************************************************** --> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['btn_ca_reset'])) { flush(); logmessage("Removing easy-rsa folder /etc/openvpn/easy-rsa"); shell_exec("sudo rm -rfv /etc/openvpn/easy-rsa 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Removing any generated openvpn client packages /var/www/temp/OpenVPN_ClientPackages/*"); shell_exec("sudo rm -fv /var/www/temp/OpenVPN_ClientPackages/* 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Removing Temp files."); shell_exec("sudo rm -fv /tmp/* 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Purging openvpn user database."); shell_exec("sudo echo 'truncate openvpnusers' | mysql --host=localhost --user=root --password=raspberry --database login 2>&1 | sudo tee -a /var/log/raspberrywap.log"); } ?> <!-- InstanceEndEditable --> </body> <!-- InstanceEnd --></html>
break; } //var_dump($hostapdconfig); write_hostapd_conf($hostapdconfig, "/etc/hostapd/hostapd.conf"); switch ($configurationsettings['wifi']) { case "enabled": logmessage("Enabling Wireless Radio ..."); logmessage("Scheduling hostapd to start at boot."); shell_exec("sudo update-rc.d hostapd defaults 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Starting hostapd."); shell_exec("sudo service hostapd restart 2>&1 | sudo tee --append /var/log/raspberrywap.log"); echo "<script>ReturnReadyOperation();</script>"; break; case "disabled": logmessage("Disabling Wireless Radio ..."); logmessage("Unscheduling hostapd to start at boot."); shell_exec("sudo update-rc.d -f hostapd remove 2>&1 | sudo tee --append /var/log/raspberrywap.log"); logmessage("Stopping hostapd."); shell_exec("sudo service hostapd stop 2>&1 | sudo tee --append /var/log/raspberrywap.log"); echo "<script>ReturnReadyOperation();</script>"; break; } } else { echo "<script>ReturnFailureStatus('" . $ssiderror . "'+'" . $visibilityerr . "'+'" . $operationmodeerr . "'+'" . $channelerr . "'+'" . $channelwidtherr . "'+'" . $securitymodeerr . "'+'" . $wepkeyerr . "'+'" . $wpakeyerr . ");</script>"; } } ?> <!-- InstanceEndEditable --> </body> <!-- InstanceEnd --></html>
<!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Logs').addClass('active'); $('#LogsUl').show(); }); </script> <?php include 'functions.php'; logmessage("Loading page Logs-Dmesg.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
$prenom = ""; if (isset($_POST['prenom'])) { $prenom = $_POST['prenom']; } $user_data = array("id_user" => $_POST['id_user'], "login" => $login, "first_name" => $prenom, "last_name" => $_POST['nom'], "password" => $_POST['password'], "email" => $emails, "role" => array("client"), "disabled" => "off", "admin" => "off"); if ($User->exists($id_user)) { $User->saveData($user_data); } else { $id_user = $User->createUser($user_data); } } $q = sprintf("UPDATE webfinance_clients SET " . "nom='%s',\n addr1='%s',\n addr2='%s',\n addr3='%s',\n cp='%s',\n\t ville='%s',\n rcs='%s',\n vat='%s',\n capital='%s',\n pays='%s',\n tel='%s',\n fax='%s',\n web='%s',\n\t email='%s',\n\t vat_number='%s',\n siren='%s',\n id_company_type='%d',\n id_user=%d,\n password='******',\n rib_titulaire='%s',\n id_mantis='%d',\n id_toggl='%d',\n supportHoursIncludedInContract='%s',\n language='%s',\n id_business_entity=%d,\n contract_signer = '%s',\n id_contract_signer_role = %d,\n invoice_delivery = '%s'\n WHERE id_client=%d", mysql_real_escape_string($nom), mysql_real_escape_string($addr1), mysql_real_escape_string($addr2), mysql_real_escape_string($addr3), mysql_real_escape_string($cp), mysql_real_escape_string($ville), mysql_real_escape_string($rcs), mysql_real_escape_string($vat), mysql_real_escape_string($capital), mysql_real_escape_string($pays), mysql_real_escape_string(removeSpace($tel)), mysql_real_escape_string(removeSpace($fax)), mysql_real_escape_string($web), mysql_real_escape_string($emails), mysql_real_escape_string($vat_number), mysql_real_escape_string($siren), mysql_real_escape_string($id_company_type), mysql_real_escape_string($_POST['id_user']), mysql_real_escape_string($password), mysql_real_escape_string($rib_titulaire), mysql_real_escape_string($id_mantis), mysql_real_escape_string($id_toggl), mysql_real_escape_string($supportHoursIncludedInContract), mysql_real_escape_string($clt_language), mysql_real_escape_string($id_business_entity), mysql_real_escape_string($contract_signer), mysql_real_escape_string($id_contract_signer_role), mysql_real_escape_string($invoice_delivery), mysql_real_escape_string($id_client)); mysql_query($q) or die(mysql_error()); // Check if we have to rename clients if ($_POST['nom'] != $Client->nom) { // Rename Mantis project $mantis_project = array('name' => $nom, 'view_state' => array('id' => 50)); $mantis = new WebfinanceMantis(); $mantis->updateProject($id_mantis, $mantis_project); // Rename Toggl client $toggl = new WebfinanceToggl(); $toggl->renameClient($id_client, $nom); } if (isset($_SESSION['message'])) { $_SESSION['message'] .= "<br/>" . _('Update customer'); } else { $_SESSION['message'] = _('Update customer'); } logmessage(_('Update customer') . " client:{$id_client} ({$nom})", $id_client); header("Location: /prospection/fiche_prospect.php?id={$id_client}&onglet=" . $focused_onglet); exit;
Webfinance 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Webfinance; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "../../inc/main.php"; $User = new User(); if (!$User->isAuthorized("manager")) { $_SESSION['came_from'] = $_SERVER['REQUEST_URI']; header("Location: /login.php"); exit; } if (empty($_POST['id']) or empty($_POST['id_client'])) { die('Missing argument'); } # SQL escape $_POST['id'] = mysql_real_escape_string($_POST['id']); $_POST['id_client'] = mysql_real_escape_string($_POST['id_client']); mysql_query('BEGIN') or die(mysql_error()); # Disable current default bank account mysql_query("UPDATE bank_account\nSET `default` = b'0'\nWHERE id_client = {$_POST['id_client']}") or die(mysql_error()); # Enable new default bank account mysql_query("UPDATE bank_account\nSET `default` = b'1'\nWHERE id = {$_POST['id']}") or die(mysql_error()); mysql_query('COMMIT') or die(mysql_error()); logmessage("Set IBAN #{$_POST['id']} as default for client:{$_POST['id_client']}", $_POST['id_client']); header("Location: /prospection/fiche_prospect.php?id={$_POST['id_client']}&onglet=other"); exit;
<!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Advanced').addClass('active'); $('#AdvancedUl').show(); }); </script> <?php include 'functions.php'; logmessage("Loading page Advanced-Wireless.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
if ($workingObject) { foreach ($JSONObject as $key => $value) { //logmessage("Processing PUT object array item $key"); if (substr($value->id, 0, 2) == "@@") { logmessage("invalid id: {$value->id}. Putting before SC has time to proper process the just created record?"); die; } $workingObject->update($value); $output[] = clone $workingObject; } echo json_encode($output); } else { logmessage('No proper working model for update'); } } else { logmessage('No proper JSON data!'); } break; case 'DELETE': //delete so no post body, only an id $tmpId = intval($request[1]); $workingObject = eval("return new " . $requestedResource . "_class;"); $workingObject->init($tmpId); $workingObject->delete(); break; default: // no action?? do nothing :) break; } } }
//attach the invoice file $file_name = ucfirst($invoice->type_doc) . "_" . $invoice->num_facture . "_" . preg_replace("/[ ]/", "_", $invoice->nom_client) . ".pdf"; $path = "/tmp/" . $file_name; if (file_exists($path)) { $mail->AddAttachment($path, $file_name, 'base64', 'application/pdf'); if (!$mail->Send()) { $_SESSION['message'] = _('Invoice was not sent'); $_SESSION['error'] = 1; echo _("Invoice was not sent"); echo "Mailer Error: " . $mail->ErrorInfo; } else { /* $_SESSION['message'] = _('Invoice sent'); */ //mettre à jour l'état de la facture, update sql mysql_query("UPDATE webfinance_invoices SET is_envoye=1 WHERE id_facture={$id} ") or wf_mysqldie(); /* $_SESSION['message'] .= "<br/>"._('Invoice updated'); */ logmessage(_("Send invoice") . " #{$invoice->num_facture} fa:{$id} client:{$invoice->id_client}", $invoice->id_client, $id); } //delete the file generated unlink($path); } else { $_SESSION['message'] = _('Invoice file doesn\'t exist!'); $_SESSION['message'] .= "<br/>" . _('Invoice was not sent'); $_SESSION['error'] = 1; echo _("The attachment doesn't exist!"); } header("Location: edit_facture.php?id_facture={$id}"); die; } else { echo _("Please add mail address!"); exit; }
<html lang="en"><!-- InstanceBegin template="/Templates/RWR-Template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- InstanceBeginEditable name="doctitle" --> <title>Raspberry Wifi Router</title> <!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <?php include 'functions.php'; logmessage("Loading page home.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
flush(); logmessage("Stopping hostapd service."); shell_exec("sudo service hostapd stop 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Killing Captive Portal service."); shell_exec("sudo killall chilli 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Starting dnsmasq service."); shell_exec("sudo service dnsmasq start 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Scheduling dnsmasq service to start at boot."); shell_exec("sudo update-rc.d chilli defaults 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Starting hostapd service."); shell_exec("sudo service hostapd start 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Configuring interface wlan0."); shell_exec("sudo ifup wlan0 2>&1 | sudo tee -a /var/log/raspberrywap.log"); logmessage("Updating rc.local to add IP address on wlan interface on boot."); shell_exec("sudo sed -i 's/# ip addr add 192.168.1.1\\/24 dev wlan0/ip addr add 192.168.1.1\\/24 dev wlan0/g' /etc/rc.local"); logmessage("Unscheduling Captive Portal service to start at boot."); shell_exec("sudo update-rc.d chilli remove 2>&1 | sudo tee -a /var/log/raspberrywap.log"); break; } } echo "<script>ReturnReady_form_enableportal();</script>"; } ?> <!-- ********************************************************************************************************************** --> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['button_deleteusers'])) { if (!empty($deleteuser)) { echo "<script>ReturnReady_form_deleteusers();</script>"; } else { echo '<script>ReturnStatus_form_deleteusers("No user selected, so nothing deleted.");</script>'; }
function deleterecord($tablename, $id) { if ($tablename == "" || !$id) { return false; } $tablename = $this->cleansql($tablename); $tablename = $this->get_tablename_in_proper_case($tablename); $query = "DELETE FROM " . $tablename . " WHERE id = " . $id; $errormessage = "Error deleting the record with id " . $currentid . " in the table " . $tablename; logmessage("DELETE action in object " . $tablename . " with query: " . $query); mysql_query($query) or fataldberror($errormessage . ": " . mysql_error(), $query); }
<script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Logs').addClass('active'); $('#LogsUl').show(); }); function Reload() { window.location = '/Logs-Syslog.php'; } </script> <?php include 'functions.php'; logmessage("Loading page Logs-Syslog.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
$invoice = new Facture(); if ($_POST['docs'] == 1) { $docs = true; } if (!$invoice->sendByEmail($id_invoice, $mails, $from, $fromname, $subject, $body, false, $docs)) { $_SESSION['message'] = _('Invoice was not sent'); $_SESSION['error'] = 1; echo _("Invoice was not sent"); die; } /* $_SESSION['message'] = _('Invoice sent'); */ //mettre à jour l'état de la facture, update sql mysql_query("UPDATE webfinance_invoices " . "SET is_envoye=1 " . "WHERE id_facture={$id_invoice}") or wf_mysqldie(); /* $_SESSION['message'] .= "<br/>"._('Invoice updated'); */ $facture = $invoice->getInfos($id_invoice); logmessage(_("Send invoice") . " #{$facture->num_facture} fa:{$id_invoice} " . "client:{$facture->id_client}"); header("Location: edit_facture.php?id_facture={$id_invoice}"); die; } $title = _("Send Invoice"); must_login(); $roles = 'manager,admin'; require "../top.php"; require "nav.php"; ?> <script type="text/javascript" language="javascript" src="/js/ask_confirmation.js"></script> <?php extract($_GET);
shell_exec("sudo sed -i 's/client.crt/remote " . $openvpnservername . " 1194/g' /tmp/" . $txtusername . ".ovpn 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo sed -i 's/remote my-server-1 1194/remote " . $openvpnservername . " 1194/g' /tmp/" . $txtusername . ".ovpn 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo sed -i 's/cert remote/cert " . $txtusername . ".crt/g' /tmp/" . $txtusername . ".ovpn 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo sed -i 's/key client.key/key " . $txtusername . ".key/g' /tmp/" . $txtusername . ".ovpn 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo zip -j /var/www" . $txtpackageurl . " /tmp/" . $txtusername . ".ovpn /etc/openvpn/easy-rsa/keys/ca.crt /etc/openvpn/easy-rsa/keys/" . $txtusername . ".crt /etc/openvpn/easy-rsa/keys/" . $txtusername . ".key 2>&1 | sudo tee -a /var/log/raspberrywap.log"); } else { logmessage("Certificate generation failed, because one of the fields is not filled in."); echo '<script>ReturnStatus_openvpn_newuser("All fields are required!");</script>'; } } else { echo "error error!!!"; echo '<script>ReturnStatusNewCertificate("' . $txtusernameerr . $txtfirstnameerr . $txtlastnameerr . $txtcountryerr . $txtcityerr . $txtprovinceerr . $txtorganisationerr . $txtemailerr . '");</script>'; } } ?> <!-- ********************************************************************************************************************** --> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['btn_ca_reset'])) { logmessage("Removing previous easy-rsa folder, if any."); shell_exec("sudo rm -rf /etc/openvpn/easy-rsa 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo rm -f /var/www/temp/OpenVPN_ClientPackages/* 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo rm -f /tmp/* 2>&1 | sudo tee -a /var/log/raspberrywap.log"); shell_exec("sudo echo 'truncate openvpnusers' | mysql --host=localhost --user=root --password=raspberry --database login 2>&1 | sudo tee -a /var/log/raspberrywap.log"); } ?> <!-- InstanceEndEditable --> </body> <!-- InstanceEnd --></html>
function sendReportByEmail($year, $month, $webfinance_id) { global $smarty; $client = new Client($webfinance_id); $prefs = new WebfinancePreferences(); $phpmailer = new PHPMailer(); $phpmailer->CharSet = 'UTF-8'; $phpmailer->From = $prefs->prefs['societe']->email; $phpmailer->FromName = $prefs->prefs['societe']->raison_sociale; $phpmailer->WordWrap = 80; $phpmailer->Subject = strftime("Rapport d'infogérance ISVTEC/{$client->nom} du mois de %B %Y", mktime(0, 0, 0, $month, 1, $year)); $pdf_file = $this->createReport($year, $month, $webfinance_id); foreach ($client->emails as $email) { // Define template variables $smarty->assign('email', $email); $smarty->assign('client_nom', $client->nom); $smarty->assign('panel_url', 'https://panel.isvtec.com/'); $smarty->assign('phone_number', '+33 (0)1 84 16 16 17'); $smarty->assign('mantis_url', 'https://support.isvtec.com/'); $smarty->assign('date_year', strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year))); // Send email $phpmailer->ClearAllRecipients(); $phpmailer->AddAddress($email); $phpmailer->AddAttachment($pdf_file, basename($pdf_file), 'base64', 'application/pdf'); $phpmailer->Body = $smarty->fetch('mantis/mail_report.tpl'); $phpmailer->Send(); } unlink($pdf_file) or die("Unable to unlink {$pdf_file}"); // Log invoice as sent logmessage(_("Sent report") . " {$year}-{$month} to " . implode(' ', $client->emails) . ' ' . "client:{$webfinance_id}", $webfinance_id); return true; }
<html lang="en"><!-- InstanceBegin template="/Templates/RWR-Template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- InstanceBeginEditable name="doctitle" --> <title>Raspberry Wifi Router</title> <!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <?php include 'functions.php'; logmessage("Loading page Maintenance-BackupConfig.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
function update(stdClass $data) { // function to update an existing record in the database // the id property needs to be present in the $data object global $ORIONDB_DB; // do nothing if an id property doesn't exist on $data if (property_exists($data, 'id')) { $filtereddata = $this->filterfieldnames($data, true); $ORIONDB_DB->updaterecord($this->_tablename, $data, $this); $this->init($data->id); } else { logmessage("No id given for update!"); return false; } }
function OrionDB_Session_start($validuser = false) { // set the stuff in the config file global $ORIONDBCFG_session_expire_time, $ORIONDBCFG_session_name; global $ORIONDBCFG_cookie_host_name, $ORIONDBCFG_cookie_only_secure; global $ORIONDBCFG_baseURI, $ORIONDBCFG_auth_module_active; global $ORIONDBCFG_auth_module_only_valid_user_session; // checking whether the config settings are usable if ($ORIONDBCFG_session_expire_time) { $expire_time = 60 * intval($ORIONDBCFG_session_expire_time); // get the time in seconds } if ($ORIONDBCFG_session_name) { $session_name = $ORIONDBCFG_session_name; } if ($ORIONDBCFG_cookie_host_name) { $hostname = $ORIONDBCFG_cookie_host_name; } else { // get it from the $_SERVER array if (array_key_exists('HTTP_HOST', $_SERVER)) { $hostname = $_SERVER['HTTP_HOST']; } else { $hostname = ""; } } //print_r($_SERVER); // prepare the session to start //void session_set_cookie_params (int $lifetime [, string $path [, string $domain [, bool $secure [, bool $httponly ]]]] ) if ($ORIONDBCFG_auth_module_active && $ORIONDBCFG_auth_module_only_valid_user_session) { if (!$validuser) { // check whether a session key of OrionDB already is present if (!OrionDB_Check_cookie()) { // if it does not exist, don't start the session return false; } } } //start the session session_name($session_name); session_set_cookie_params($expire_time, $ORIONDBCFG_baseURI, $hostname, $ORIONDBCFG_cookie_only_secure); // as this previous line only sets the first time when a session is created, let's add Brian Moons temporary solution // but only after the session is started session_start(); $test = setcookie($session_name, session_id(), time() + $expire_time, $ORIONDBCFG_baseURI, $hostname, $ORIONDBCFG_cookie_only_secure, false); logmessage("Result from setcookie: " . $test); //logmessage("session id is:" . session_id()); return true; }
logmessage("Reconfiguring interface br0 (ifdown-ifup)"); shell_exec("sudo ifdown br0 && sudo ifup br0"); } // or when in router mode if (strcmp($configurationsettings['operationmode'], "Router") == 0) { logmessage("Reconfiguring interface eth0 (ifdown-ifup)"); shell_exec("sudo ifdown eth0 && sudo ifup eth0"); } } echo "<script>ReturnReadyStatic();</script>"; } else { // if form errors are present, show them in the status cell on the form if (empty($ipaddress) || empty($subnetmask)) { echo "<script>ReturnFailureStatic('IP Address and Subnet Mask are required values!'"; } logmessage("Reconfiguring interface eth0 (ifdown-ifup)" . $ipaddresserr . "'+'" . $subnetmaskerr . "'+'" . $defaultgatewayerr . "'+'" . $primarydnserr . "'+'" . $secondarydnserr . "'+'" . $mtuerr . "'+'" . $macaddresserr); echo "<script>ReturnFailureStatic('" . $ipaddresserr . "'+'" . $subnetmaskerr . "'+'" . $defaultgatewayerr . "'+'" . $primarydnserr . "'+'" . $secondarydnserr . "'+'" . $mtuerr . "'+'" . $macaddresserr . "');</script>"; } } ?> <!-- ********************************************************************************************************************** --> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['buttonpppoe'])) { if (!empty($ipaddresserr) || !empty($usernameerr) || !empty($passworderr) || !empty($repeatpassworderr) || !empty($servicenameerr) || !empty($idledisconnecterr) || !empty($primarydnserr) || !empty($secondarydnserr) || !empty($mtuerr) || !empty($macerr)) { echo "<script>ReturnFailureDynamic('" . $ipaddresserr . "'+'" . $usernameerr . "'+'" . $passworderr . "'+'" . $repeatpassworderr . "'+'" . $servicenameerr . "'+'" . $idledisconnecterr . "'+'" . $primarydnserr . "'+'" . $secondarydnserr . "'+'" . $mtuerr . "'+'" . $macerr . "');</script>"; } } ?> <!-- ********************************************************************************************************************** --> <!-- InstanceEndEditable -->
<html lang="en"><!-- InstanceBegin template="/Templates/RWR-Template.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- InstanceBeginEditable name="doctitle" --> <title>Raspberry Wifi Router</title> <!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <?php include 'functions.php'; logmessage("Loading page Maintenance-RestoreConfig.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
<script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Logs').addClass('active'); $('#LogsUl').show(); }); function Reload() { window.location = '/Logs-Syslog.php'; } </script> <?php include 'functions.php'; logmessage("Loading page Logs-Messages.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
function setPass($id_user, $new_pass) { mysql_query("UPDATE webfinance_users SET password=md5('{$new_pass}') WHERE id_user={$id_user}") or die(mysql_error()); logmessage("Changed password for user:{$id_user}"); $_SESSION['message'] = _('Password changed'); return true; }
(at your option) any later version. Webfinance 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Webfinance; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "../../inc/main.php"; $User = new User(); if (!$User->isAuthorized("manager")) { $_SESSION['came_from'] = $_SERVER['REQUEST_URI']; header("Location: /login.php"); exit; } if (empty($_POST['bank_name']) or empty($_POST['iban']) or empty($_POST['bic']) or empty($_POST['id_client'])) { die('Missing argument'); } # SQL escape $_POST['bank_name'] = mysql_real_escape_string($_POST['bank_name']); $_POST['iban'] = mysql_real_escape_string($_POST['iban']); $_POST['bic'] = mysql_real_escape_string($_POST['bic']); $_POST['id_client'] = mysql_real_escape_string($_POST['id_client']); mysql_query("INSERT INTO bank_account SET\n id_client = {$_POST['id_client']},\n bank_name = '{$_POST['bank_name']}',\n iban = '{$_POST['iban']}',\n bic = '{$_POST['bic']}'") or die(mysql_error()); $iban_id = mysql_insert_id(); logmessage("Add new IBAN #{$iban_id} for client:{$_POST['id_client']}", $_POST['id_client']); header("Location: /prospection/fiche_prospect.php?id={$_POST['id_client']}&onglet=other"); exit;
exit; } // Create new client if (isset($_GET['action']) && $_GET['action'] == '_new') { $client_name = 'Nouvelle Entreprise_' . time(); mysql_query("INSERT INTO webfinance_clients (nom,date_created) VALUES('{$client_name}', now())") or die(mysql_error()); $_GET['id'] = mysql_insert_id(); // Create Mantis project $mantis_project = array('name' => $client_name, 'view_state' => array('id' => 50)); $mantis = new WebfinanceMantis(); $mantis->createProject($_GET['id'], $mantis_project); // Create Toggl client $toggl = new WebfinanceToggl(); $toggl->createClient($_GET['id'], $client_name); $_SESSION['message'] = _('New customer created'); logmessage(_('Create customer') . " client:" . $_GET['id'], $_GET['id']); } $Client = new Client($_GET['id']); $title = $Client->nom; array_push($extra_js, "/js/onglets.js"); if (!preg_match("/^[0-9]+\$/", $_GET['id'])) { header("Location: /prospection/"); die; } // Onglet affiché par défaut if (isset($_GET['onglet'])) { $shown_tab = $_GET['onglet']; } elseif (isset($User->prefs->default_onglet_fiche_contact)) { $shown_tab = $User->prefs->default_onglet_fiche_contact; } else { $shown_tab = 'contacts';
function ReturnReadyTimezone() { document.getElementById('ReturnStatusTimezone').innerHTML = '<img src="images/Ready.png" width="20" height="20" alt="">'; } function ReturnProgressTimesync() { document.getElementById('ReturnStatusTimesync').innerHTML = '<img src="images/ProgressIndicator.GIF" width="100" height="15" alt="">'; } function ReturnReadyTimesync() { document.getElementById('ReturnStatusTimesync').innerHTML = '<img src="images/Ready.png" width="20" height="20" alt="">'; } function ReturnFailure(error) { document.getElementById("ReturnStatusTimesync").innerHTML = "There was a problem saving your details: " + error; } </script> <?php include 'functions.php'; logmessage("Loading page Configuration-DateTime.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
<!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Advanced').addClass('active'); $('#AdvancedUl').show(); }); </script> <?php include 'functions.php'; logmessage("Loading page Advanced-WebFilter.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>
</div><!-- end .sidebar1 --> <!-- InstanceBeginEditable name="MenuExpander" --> <script> $('#Home').removeClass('active'); $('#Maintenance').addClass('active'); $('#MaintenanceUl').show(); </script> <!-- InstanceEndEditable --> <article class="content"> <!-- InstanceBeginEditable name="article" --> <!-- ********************************************************************************************************************** --> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { logmessage("Processing Password form data."); $savepasswordflag = ""; $password = $repeatpassword = ""; $passworderr = $repeatpassworderr = ""; if (!empty($_POST["password"])) { $password = test_input($_POST["password"]); if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $password)) { $passworderr = "dhcpuid field contains incorrect data, only a-zA-Z0-9_- allowed!<br />"; } } if (!empty($_POST["repeatpassword"])) { $repeatpassword = test_input($_POST["repeatpassword"]); if (!preg_match("/^[a-zA-Z0-9_-]*\$/", $repeatpassword)) { $repeatpassworderr = "dhcpuid field contains incorrect data, only a-zA-Z0-9_- allowed!<br />"; } }
<!-- InstanceEndEditable --> <link href="css/stylesheet.css" rel="stylesheet" type="text/css"> <link href="css/CssMenuStylesheet.css" rel="stylesheet" type="text/css"> <script src="Scripts/jquery-2.1.3.min.js" type="text/javascript"></script> <script src="Scripts/CssMenuScript.js" type="text/javascript"></script> <!-- InstanceBeginEditable name="head" --> <script> $(document).ready(function(){ $('#Home').removeClass('active'); $('#Advanced').addClass('active'); $('#AdvancedUl').show(); }); </script> <?php include 'functions.php'; logmessage("Loading page Advanced-NetworkFilter.php"); ?> <!-- InstanceEndEditable --> </head> <body> <div class="container"> <header> <div id="titlebar"> <span><img src="images/WiFi%20Logo.gif" width="180" height="120" alt=""/></span> <span id="title"><h1>Raspberry WiFi Router</h1></span> </div> </header>