function simple($s) { $s = strtolower($s); $s = str_replace("'", "_", $s); $pos = strpos($s, '('); if ($pos !== FALSE) { $s = substr($s, 0, $pos); $s = trim($s); } $s = str_replace(" ", "_", $s); $s = replace_accents($s); return enc($s); }
function connexions_list() { if (posix_getuid() != 0) { $user = new usersMenus(); if ($user->AsSystemAdministrator == false) { $tpl = new templates(); echo replace_accents(html_entity_decode($tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}"))); die; exit; } } $q = new mysql(); if (isset($_GET["delete"])) { $sql = "DELETE FROM vpnclient WHERE ID='{$_GET["delete"]}'"; $results = $q->QUERY_SQL($sql, "artica_backup"); } $sql = "SELECT * FROM vpnclient ORDER BY ID DESC"; $results = $q->QUERY_SQL($sql, "artica_backup"); while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $js = "EditConnextion({$ligne["ID"]})"; $html = "<table style='width:100%'>"; $html = $html . "\n\t\t<tr " . CellRollOver($js) . ">\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td width=99%><strong style='font-size:12px'>{$ligne["connexion_name"]}</strong></td>\n\t\t\t<td width=99%><strong style='font-size:12px'>{$ligne["servername"]}</strong></td>\n\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", "{delete}", "DelConnexion({$ligne["ID"]})") . "</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html); }
function js() { $page = CurrentPageName(); $tpl = new templates(); $t2 = time(); $t = $_GET["t"]; $rulefrom = $_GET["from"]; if (is_numeric($rulefrom)) { $q = new mysql_squid_builder(); $sql = "SELECT groupname FROM webfilter_rules WHERE ID={$rulefrom}"; $results = $q->QUERY_SQL($sql); $ligne = mysql_fetch_array($results); $tmpname = $ligne["groupname"] . " (copy)"; $tmpname = addslashes($tmpname); $tmpname = replace_accents($tmpname); } if (isset($_GET["default-rule"])) { $rulefrom = "default"; $tmpname = $tpl->javascript_parse_text("{default} (copy)"); $tmpname = replace_accents($tmpname); } header("content-type: application/x-javascript"); $ask = $tpl->javascript_parse_text("{duplicate_the_ruleid_give_name}"); $html = "\n\t\tvar x_Duplicaterule{$t2}= function (obj) {\n\t\t\tvar res=obj.responseText;\n\t\t\tif (res.length>0){alert(res);}\n\t\t\t\$('#flexRT{$t}').flexReload();\n\t\t}\n\t\n\t\n\t\tfunction Duplicaterule{$t2}(){\n\t\t\tvar rulename=prompt('{$ask} {$rulefrom}','{$tmpname}');\n\t\t\tif(!rulename){return;}\n\t\t\t var XHR = new XHRConnection();\n\t\t XHR.appendData('duplicate-from', '{$rulefrom}');\n\t\t var pp=encodeURIComponent(rulename);\n\t\t XHR.appendData('duplicate-name', pp);\n\t\t XHR.sendAndLoad('{$page}', 'POST',x_Duplicaterule{$t2}); \n\t\t\n\t\t}\n\t\t\n\t\n\tDuplicaterule{$t2}();"; echo $html; }
function install_app() { $sock = new sockets(); $sock->getfile("CheckDaemon"); $sock->getfile("install_app:{$_GET["product"]}"); $sock->DeleteCache(); $tpl = new templates(); $echo = "{{$_GET["product"]}}\n{installation_lauched}"; $echo = $tpl->javascript_parse_text($echo); echo replace_accents($echo); }
function getDownloadImage($type, $file, $sottoCat, $nome_brand, $nome_colore, $id) { $file_path = ""; // estensione foto $ext = pathinfo($file, PATHINFO_EXTENSION); if (strtolower($ext) == "jpg") { // recupero il numero della foto $punto = strrpos($file, "."); $file_new = substr($file, 0, $punto); // il numero dell'immagine $numero_img = substr($file_new, strlen($file_new) - 1, 1); $nome_file = replace_accents(url_slug(strtolower($sottoCat))) . "_" . replace_accents(url_slug(strtolower($nome_brand))) . "_" . replace_accents(url_slug(strtolower($nome_colore))) . "_" . replace_accents(url_slug(strtolower($id))) . "-" . $numero_img . "." . $ext; $import_location = "../../var/images"; $file_source = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_imageurl', Mage::app()->getStore()) . $file; $file_target = $import_location . "/" . $nome_file; $file_source = str_replace(" ", "%20", $file_source); if ($file != '' and !file_exists($file_target)) { $rh = fopen($file_source, 'rb'); $wh = fopen($file_target, 'wb'); if ($rh === false || $wh === false) { // error reading or opening file $file_path = ""; } else { while (!feof($rh)) { if (fwrite($wh, fread($rh, 1024)) === FALSE) { $file_path = $file_target; } } } fclose($rh); fclose($wh); } if (file_exists($file_target)) { if ($type == 'category') { $file_path = $file; } else { $file_path = $file_target; } } if (filesize($file_path) > 0) { $img = new Imagick(); $img->clear(); $img->readImage($file_path); $img->setOption('jpeg:extent', '180kb'); $img->writeImage($file_path); } } return $file_path; }
function perform() { $dev = $_POST["dev"]; $label = $_POST["label"]; $label = substr($label, 0, 16); $label = trim($label); $label = replace_accents($label); $sock = new sockets(); $fs_type = $_POST["fs_type"]; //--format-b-part $dev = urlencode($dev); $label = urlencode($label); echo "system.internal.disks.BuildBigPartition.progress.php?dev={$dev}&label={$label}&fs_type={$fs_type}"; return; $datas = base64_decode($sock->getFrameWork("cmd.php?fdisk-build-big-partitions=yes&dev={$dev}&label={$label}&fs_type={$fs_type}&MyCURLTIMEOUT=240")); }
function buildconfig() { $vpn = new openvpn(); $connection_name = trim(strtolower($_POST["connection_name"])); if ($connection_name == null) { $connection_name = time(); } $connection_name = str_replace(" ", "-", $connection_name); $connection_name = replace_accents($connection_name); $connection_name = str_replace("/", "-", $connection_name); $connection_name = str_replace('\\', "-", $connection_name); $tools = new htmltools_inc(); $connection_name = $tools->StripSpecialsChars($connection_name); $vpn->ComputerOS = $_POST["ComputerOS"]; $html_logs[] = "<div><code style='font-size:10px;color:black;'>Operating system : {$config->ComputerOS}</div>"; $html_logs[] = "<div><code style='font-size:10px;color:black;'>Connection name. : {$connection_name}</div>"; $config = $vpn->BuildClientconf($connection_name); $tbconfig = explode("\n", $config); $html_logs[] = htmlentities("VPN config -> " . strlen($config) . " bytes length (" . count($tbconfig) . " lines)"); $uid = $_SESSION["uid"]; writelogs("VPN config -> " . strlen($config) . " bytes length (" . count($tbconfig) . " lines)", __FUNCTION__, __FILE__, __LINE__); $sock = new sockets(); if (!$sock->SaveConfigFile($config, "{$connection_name}.ovpn")) { $html_logs[] = htmlentities("Framework error while saving -> {$connection_name}.ovpn;" . strlen($config) . " bytes length (" . count($tbconfig) . " lines)"); } writelogs("sockets() OK", __FUNCTION__, __FILE__, __LINE__); //$datas=$sock->getfile('OpenVPNGenerate:'.$uid); $datas = $sock->getFrameWork("openvpn.php?build-vpn-user={$connection_name}&basepath=" . dirname(__FILE__)); $tbl = explode("\n", $datas); $tbl = array_reverse($tbl); while (list($num, $line) = each($tbl)) { if (trim($line) == null) { continue; } $html_logs[] = "<div><code style='font-size:10px;color:black;'>" . htmlentities($line) . "</code></div>"; } if (is_file('ressources/logs/' . $connection_name . '.zip')) { $download = "\n\t\t<center>\n\t\t<div style='width:320px;border:2px solid #CCCCCC;padding:5px;margin:10px'>\n\t\t\t<div style='font-size:14px'>{click_here}</div>\n\t\t\t<a href='ressources/logs/" . $connection_name . ".zip'>\n\t\t\t\t<img src='img/download-64.png' title=\"{DOWNLOAD_CONFIG_FILES}\" style='padding:8Px;border:1px solid #055447;margin:3px'></a>\n\t\t\t\t<br>\n\t\t\t\t<a href='ressources/logs/" . $connection_name . ".zip' style='font-size:16px;text-decoration:underline'>{$connection_name}.zip</a>\n\t\t</div>\t\t\n\t\t\t\t\n\t\t</center>\n\t\t"; } $html = "\n\t\n\t{$download}\n\t<div style='font-size:16px'>{events}</div>\n\t<div style='width:100%;height:200px;overflow:auto'>" . implode("\n", $html_logs) . "</div>"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function AddNewSchedule_save() { $users = new usersMenus(); $q = new mysql_meta(); $tpl = new templates(); $task = new system_tasks(); $task_type = $task->tasks_array; $info = $tpl->javascript_parse_text($task_type[$_POST["TaskType"]]); $defaultdesc = replace_accents($info); if ($_POST["TimeDescription"] == null) { $_POST["TimeDescription"] = $defaultdesc . " : {$_POST["TimeText"]}"; } $_POST["TimeDescription"] = mysql_escape_string2($_POST["TimeDescription"]); $sql = "INSERT IGNORE INTO system_schedules (TimeDescription,TimeText,TaskType,enabled,uuid) \n\tVALUES('{$_POST["TimeDescription"]}','{$_POST["TimeText"]}','{$_POST["TaskType"]}',1,'{$_POST["uuid"]}')"; if ($_POST["ID"] > 0) { $sql = "UPDATE system_schedules SET \n\t\t\tTimeDescription='{$_POST["TimeDescription"]}',\n\t\t\tTimeText='{$_POST["TimeText"]}',\n\t\t\tTaskType='{$_POST["TaskType"]}' WHERE ID={$_POST["ID"]}\n\t\t\t"; } if (!$q->TABLE_EXISTS("system_schedules")) { $q->BuildTables(); } $q->QUERY_SQL($sql); if (!$q->ok) { echo $q->mysql_error; return; } $sock = new sockets(); $sock->getFrameWork("artica.php?build-meta-schedules=yes&uuid={$_POST["uuid"]}"); }
<?php include_once 'ressources/class.templates.inc'; include_once 'ressources/class.ldap.inc'; include_once 'ressources/class.users.menus.inc'; include_once 'ressources/class.artica.inc'; include_once 'ressources/class.ini.inc'; include_once 'ressources/class.os.system.inc'; include_once 'ressources/class.computers.inc'; include_once 'ressources/class.ocs.inc'; $user = new usersMenus(); if ($user->AsSystemAdministrator == false or $user->AsSambaAdministrator == false) { $tpl = new templates(); $text = $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}'); $text = replace_accents(html_entity_decode($text)); echo "alert('{$text}');"; exit; } if (isset($_GET["popup"])) { popup(); exit; } if (isset($_GET["ocsweb-status"])) { echo status(); exit; } if (isset($_GET["popup-status"])) { popup_status(); exit; } if (isset($_GET["ocs-resolve"])) {
function template_add_perform() { $template_name = replace_accents($_GET["add-template-perf"]); $tpl = new templates(); if ($template_name == null) { echo $tpl->javascript_parse_text("{template_name} NULL"); exit; } $ou = base64_decode($_GET["ou"]); $sql = "INSERT INTO emailing_templates (ou,template_name,zdate)\n\tVALUES('{$ou}','{$template_name}',NOW());"; $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; } }
function mysql_settings($notitle=false){ $user=new usersMenus(); if(!$user->AsArticaAdministrator){ if(!$user->AsSystemAdministrator){ $tpl=new templates(); $text=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS} !AsSystemAdministrator'); $text=replace_accents(html_entity_decode($text)); echo "alert('$text');"; exit; }} $artica=new artica_general(); $page=CurrentPageName(); if(preg_match('#(.+?):(.*)#',$artica->MysqlAdminAccount,$re)){ $rootm=$re[1]; $pwd=$re[2]; } $servername=$artica->MysqlServerName; $html=" <table style='width:100%'> <tr> <td align='right' nowrap class=legend>{mysqlserver}:</strong></td> <td align='left'>" . Field_text('mysqlserver',$servername,'width:90px;padding:3px;font-size:13px',null,null,'')."</td> </tr> <tr> <td align='right' nowrap class=legend>{mysqlroot}:</strong></td> <td align='left'>" . Field_text('mysqlroot',$rootm,'width:90px;padding:3px;font-size:13px',null,null,'{mysqlroot_text}')."</td> </tr> <tr> <td align='right' nowrap class=legend>{mysqlpass}:</strong></td> <td align='left'>" . Field_password("mysqlpass",$pwd,"width:90px;padding:3px;font-size:13px")."</td> </tr> <tr> <td colspan=2 align='right'> <hr>". button("{apply}","Loadjs('$page?script=mysql_save_account')")." </td> </tr> </table> "; $tpl=new templates(); return $tpl->_ENGINE_parse_body($html,"artica.settings.php"); }
function getAttributes($resource, $readConnection, $writeConnection, $username, $password, $service_url) { $service_urlPost = $service_url . "/user/token"; $curlPost = curl_init($service_urlPost); $headersPost = array('Content-Type:application/json;charset=utf-8', 'Content-Length: 0', 'Authorization: Basic ' . base64_encode($username . ":" . $password)); curl_setopt($curlPost, CURLOPT_POST, true); // indico che la richiesta è di tipo POST curl_setopt($curlPost, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curlPost, CURLOPT_SSL_VERIFYPEER, false); // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest curl_setopt($curlPost, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlPost, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curlPost, CURLOPT_HTTPHEADER, $headersPost); $curl_responsePost = curl_exec($curlPost); if ($curl_responsePost === false) { $infoPost = curl_getinfo($curlPost); curl_close($curlPost); return false; } else { curl_close($curlPost); $decodedPost = json_decode($curl_responsePost); if (is_object($decodedPost)) { $arrayPost = get_object_vars($decodedPost); } $aToken = $arrayPost["access_token"]; $headersGet = array('Authorization: Bearer ' . $aToken); // recupero solo l'header della richiesta $service_urlGet = $service_url . "/attributes?&limit=100"; $curlGet = curl_init($service_urlGet); curl_setopt($curlGet, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // accetto ogni autenticazione. Il sitema utilizzerà la migliore curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false); // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, true); // salvo l'output della richiesta in una variabile curl_setopt($curlGet, CURLOPT_HEADER, true); curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curlGet, CURLOPT_NOBODY, true); curl_setopt($curlGet, CURLOPT_HTTPHEADER, $headersGet); // setto l'header della richiesta $header = curl_exec($curlGet); if ($header === false) { $infoGet = curl_getinfo($curlGet); curl_close($curlGet); return false; } else { // costrusico un array dell'header e recupero il totale delle pagine $myarray = array(); $data = explode("\n", $header); $myarray['status'] = $data[0]; array_shift($data); foreach ($data as $part) { $middle = explode(":", $part); if (isset($middle[1])) { $myarray[trim($middle[0])] = trim($middle[1]); } } $pagine = $myarray["X-Count-Pages"]; // effettuo una chiamata al web service per ogni pagina for ($p = 1; $p <= $pagine; $p++) { $service_urlPost = $service_url . "/user/token"; $curlPost = curl_init($service_urlPost); $headersPost = array('Content-Type:application/json;charset=utf-8', 'Content-Length: 0', 'Authorization: Basic ' . base64_encode($username . ":" . $password)); curl_setopt($curlPost, CURLOPT_POST, true); // indico che la richiesta è di tipo POST curl_setopt($curlPost, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curlPost, CURLOPT_SSL_VERIFYPEER, false); // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest curl_setopt($curlPost, CURLOPT_RETURNTRANSFER, true); curl_setopt($curlPost, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curlPost, CURLOPT_HTTPHEADER, $headersPost); $curl_responsePost = curl_exec($curlPost); if ($curl_responsePost === false) { $infoPost = curl_getinfo($curlPost); curl_close($curlPost); return false; } else { curl_close($curlPost); $decodedPost = json_decode($curl_responsePost); if (is_object($decodedPost)) { $arrayPost = get_object_vars($decodedPost); } $aToken = $arrayPost["access_token"]; $headersGet = array('Authorization: Bearer ' . $aToken); $service_urlGet = $service_url . "/attributes?limit=100&page=" . $p; $curlGet = curl_init($service_urlGet); curl_setopt($curlGet, CURLOPT_HTTPAUTH, CURLAUTH_ANY); // accetto ogni autenticazione. Il sitema utilizzerà la migliore curl_setopt($curlGet, CURLOPT_SSL_VERIFYPEER, false); // disabilito la verifica del certificato SSL; è necessario perchè altrimenti non esegue la chiamata rest curl_setopt($curlGet, CURLOPT_RETURNTRANSFER, true); // salvo l'output della richiesta in una variabile curl_setopt($curlGet, CURLOPT_HTTPHEADER, $headersGet); // setto l'header della richiesta curl_setopt($curlGet, CURLOPT_SSL_VERIFYHOST, false); $curl_responseGet = curl_exec($curlGet); if ($curl_responseGet === false) { $infoGet = curl_getinfo($curlGet); curl_close($curlGet); return false; } else { curl_close($curlGet); // parse del contenuto $decodedGet = json_decode($curl_responseGet); $countP = 0; $array_sku = array(""); if (is_object($decodedGet)) { $decodedGet = get_object_vars($decodedGet); } $l = 1; foreach ($decodedGet as $key => $value) { $l = $l + 1; $id_attributo = $key; $valoreProdotti = $value; $description = null; $valoriAttributi = null; foreach ($valoreProdotti as $key => $value) { // recupero campi prodotto if ($key == "description") { $nome_attributo = $value; if (is_object($nome_attributo)) { $nome_attributo = get_object_vars($nome_attributo); } } if ($key == "values") { $subattributes = $value; if (is_object($subattributes)) { $subattributes = get_object_vars($subattributes); } } } // controllo esistenza dell'attributo in magento $stringQuery = "select id_magento from " . $resource->getTableName('wsca_attributes') . " where id_ws='" . $id_attributo . "'"; $id_attributoMage = $readConnection->fetchOne($stringQuery); if ($id_attributoMage == null) { $model = Mage::getModel('eav/entity_setup', 'core_setup'); if (count($subattributes) == 0) { $input = "text"; $dbInput = "testo"; } else { $input = "multiselect"; $dbInput = "select"; } $data = array('global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE, 'group' => 'General', 'type' => 'varchar', 'backend' => '', 'frontend' => '', 'label' => ucfirst(strtolower(replace_accents($nome_attributo))), 'input' => $input, 'unique' => false, 'required' => false, 'is_configurable' => false, 'searchable' => false, 'visible_in_advanced_search' => false, 'comparable' => false, 'filterable' => false, 'filterable_in_search' => false, 'used_for_promo_rules' => false, 'visible_on_front' => false, 'used_in_product_listing' => false, 'used_for_sort_by' => false, 'user_defined' => true); $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30); $model->addAttribute('catalog_product', $nome_attributoMage, $data); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $optionTable = $setup->getTable('eav/attribute'); $id_attributoMage = getLastInsertId($optionTable, 'attribute_id'); $query = "insert into " . $resource->getTableName('wsca_attributes') . " (id_magento,id_ws,tipo) values('" . $id_attributoMage . "','" . $id_attributo . "','" . $dbInput . "')"; $writeConnection->query($query); } else { $nome_attributoMage = substr("ca_" . $id_attributo, 0, 30); } // se l'attributo è il supercolore utilizzo anche l'attributo colore if ($nome_attributo == "Supercolore") { } else { foreach ($subattributes as $key => $value) { $id_valoreattributo = $key; $nome_valoreattributo = $value; // controllo esistenza opzione in magento per l'attributo in questione $stringQuery = "select id_magento from " . $resource->getTableName('wsca_subattributes') . " where id_ws='" . $id_valoreattributo . "' and id_attributes='" . $id_attributo . "'"; $id_valoreattributoMage = $readConnection->fetchOne($stringQuery); if ($id_valoreattributoMage == null) { if ($nome_valoreattributo == "" || $nome_valoreattributo == null) { } else { $attribute_model = Mage::getModel('eav/entity_attribute'); $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table'); $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage); $attribute = $attribute_model->load($attribute_code); $attribute->setData('option', array('value' => array('option' => array(ucfirst(strtolower($nome_valoreattributo)), ucfirst(strtolower($nome_valoreattributo)))))); $attribute->save(); $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $optionTable = $setup->getTable('eav/attribute_option'); $id_valoreattributoMage = getLastInsertId($optionTable, 'option_id'); $query = "insert into " . $resource->getTableName('wsca_subattributes') . " (id_magento,id_ws, id_attributes) values('" . $id_valoreattributoMage . "','" . $id_valoreattributo . "','" . $id_attributo . "')"; $writeConnection->query($query); } } else { $attr = Mage::getModel('catalog/product')->getResource()->getAttribute($nome_attributoMage); if ($attr->usesSource()) { $nomeValoreAttributoMage = $attr->getSource()->getOptionText($id_valoreattributoMage); if (strtolower($nomeValoreAttributoMage) != strtolower($nome_valoreattributo)) { $attribute_model = Mage::getModel('eav/entity_attribute'); $attribute_options_model = Mage::getModel('eav/entity_attribute_source_table'); $attribute_code = $attribute_model->getIdByCode('catalog_product', $nome_attributoMage); $attribute = $attribute_model->load($attribute_code); // modifica della stagione su magento (nome dell'opzione) $data = array(); $values = array($id_valoreattributoMage => array(0 => ucfirst(strtolower($nome_valoreattributo)), 1 => ucfirst(strtolower($nome_valoreattributo)))); $data['option']['value'] = $values; $attribute->addData($data); $attribute->save(); } } } } } } } } } } } return true; }
$remove[] = $i + 1; } } for ($i = 0; $i < count($remove); $i++) { array_splice($info, $remove[$i] - $i, 1); } // Reconta o numero de senhas do vetor $info $numresults = count($info) - 1; } //print_r($info); if (isset($submit)) { if ($submit == "Salvar") { // Se a senha validacao de senha for igual if ($novasenha == $novasenha2) { // Verifica se a variavel existe $descricao = replace_accents($descricao); if (!empty($descricao)) { $entry["description"][0] = $descricao; } if (!empty($grupo)) { $entry["description"][1] = $grupo; } if (!empty($novasenha)) { $entry["userpassword"][0] = "{crypt}" . crypt($novasenha); } if (!empty($novasenha)) { $entry["userpassword"][1] = encripta($novasenha, $key, $iv); } $uptdn = "uid=" . $info[$valor]["uid"][0] . ",ou=" . $info[$valor]["host"][0] . ",ou=people," . $dn; if (ldap_modify($conexao, $uptdn, $entry)) { // Envia email para informar alteracao
function buildconfig() { $vpn = new openvpn(); $connection_name = trim(strtolower($_POST["connection_name"])); if ($connection_name == null) { $connection_name = time(); } $connection_name = str_replace(" ", "-", $connection_name); $connection_name = replace_accents($connection_name); $connection_name = str_replace("/", "-", $connection_name); $connection_name = str_replace('\\', "-", $connection_name); $tools = new htmltools_inc(); $connection_name = $tools->StripSpecialsChars($connection_name); $connection_name = mysql_escape_string2($connection_name); $q = new mysql(); $q->QUERY_SQL("INSERT IGNORE INTO `openvpn_clients` (uid,ComputerOS) VALUES ('{$connection_name}','{$_POST["ComputerOS"]}')", "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } }
function group_new() { $q = new mysql(); if (!$q->TABLE_EXISTS("haproxy_backends_groups", "artica_backup")) { $q->BuildTables(); } $rulename = url_decode_special_tool($_POST["group-new"]); $servicename = trim($_POST["servicename"]); $rulename = str_replace(" ", "", $rulename); $rulename = str_replace("-", "_", $rulename); $rulename = str_replace("'", "", $rulename); $rulename = replace_accents($rulename); $rulename = mysql_escape_string2($rulename); $default = 0; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT count(*) as tcount FROM haproxy_backends_groups WHERE servicename='{$servicename}' AND `default`=1", "artica_backup")); if (intval($ligne["tcount"]) == 0) { $default = 1; } $q->QUERY_SQL("INSERT INTO haproxy_backends_groups (groupname,servicename,`default`) VALUES ('{$rulename}','{$servicename}','{$default}')", "artica_backup"); if (!$q->ok) { echo $q->mysql_error; } }
function slug_gen($url) { // everything to lower and no spaces begin or end $url = replace_accents($url); $url = strtolower(trim($url)); //replace accent characters, depends your language is needed //$url=replace_accents($url); // decode html maybe needed if there's html I normally don't use this //$url = html_entity_decode($url,ENT_QUOTES,'UTF8'); // adding - for spaces and union characters $find = array(' ', '&', '\r\n', '\n', '+',','); $url = str_replace ($find, '-', $url); //delete and replace rest of special chars $find = array('/[^a-z0-9\-]/', '/[\-]+/', '/<[^>]*>/'); $repl = array('', '-', ''); $url = preg_replace ($find, $repl, $url); //return the friendly url return $url; }
public function free_categorizeSave($PostedDatas = null, $category, $ForceCat = 0, $ForceExt = 0) { include_once dirname(__FILE__) . "/class.html2text.inc"; $sock = new sockets(); if (!isset($GLOBALS["uuid"])) { $sock = new sockets(); $GLOBALS["uuid"] = base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes")); } $uuid = $GLOBALS["uuid"]; $f = array(); $ExtractAllUris = $this->ExtractAllUris($PostedDatas); if (count($ExtractAllUris) > 0) { while (list($num, $ligne) = each($ExtractAllUris)) { $f[] = $num; } $PostedDatas = null; } $h2t = new html2text($PostedDatas); $h2t->get_text(); while (list($num, $ligne) = each($h2t->_link_array)) { if (trim($ligne) == null) { continue; } $ligne = strtolower($ligne); $ligne = str_replace("(whois)", "", $ligne); $ligne = str_replace("||", "", $ligne); $ligne = str_replace("^", "", $ligne); $ligne = trim($ligne); if (preg_match("#^([0-9\\.]+):[0-9]+#", $ligne, $re)) { $websitesToscan[] = $re[1]; continue; } if (strpos(" {$ligne}", "http") == 0) { $ligne = "http://{$ligne}"; } $hostname = parse_url($ligne, PHP_URL_HOST); if (preg_match("#^www\\.(.+)#", $hostname, $re)) { $hostname = $re[1]; } if (preg_match("#^\\.(.+)#", $hostname, $re)) { $hostname = $re[1]; } if (preg_match("#^\\*\\.(.+)#", $hostname, $re)) { $hostname = $re[1]; } writelogs("{$ligne} = {$hostname}", __FUNCTION__, __FILE__, __LINE__); $websitesToscan[] = $ligne; } $PostedDatas = str_replace("<", "\n<", $PostedDatas); $PostedDatas = str_replace(' rel="nofollow"', "", $PostedDatas); $PostedDatas = str_replace("\r", "\n", $PostedDatas); $PostedDatas = str_replace("https:", "http:", $PostedDatas); if ($PostedDatas != null) { $f = explode("\n", $PostedDatas); } if (!is_numeric($ForceExt)) { $ForceExt = 0; } if (!is_numeric($ForceCat)) { $ForceCat = 0; } $ipClass = new IP(); while (list($num, $www) = each($f)) { $www = trim($www); if ($www == null) { continue; } if (preg_match("#--------------#", $www)) { continue; } if (preg_match("#No extension#", $www)) { continue; } if (preg_match("#no website#i", $www)) { continue; } if (preg_match("#^analyze\\s+[0-9]+\\s+#", $www)) { continue; } if (preg_match("#(false|true):\\s+(.+?)\\s+already#i", $www, $re)) { $www = $re[2]; } writelogs("Scanning {$www}", __FUNCTION__, __FILE__, __LINE__); if (preg_match("#^(.+?)\"\\s+#", $www, $re)) { $www = $re[1]; } if (preg_match("#^([0-9\\.]+):[0-9]+#", $www, $re)) { $www = $re[1]; } $www = str_replace("(whois)", "", $www); $www = str_replace("\r", "", $www); $www = str_replace("||", "", $www); $www = str_replace("^", "", $www); $www = trim(strtolower($www)); if ($ipClass->isValid($www)) { $www = ip2long($www) . ".addr"; $websitesToscan[] = $www; continue; } if ($www == null) { continue; } $www = stripslashes($www); if (preg_match("#href=\"(.+?)\">#", $www, $re)) { $www = $re[1]; } if (preg_match('#<a rel=.+?href="(.+?)"#', $www, $re)) { $www = $re[1]; } if (preg_match("#<a href.*?http://(.+?)([\\/\"'>])#i", $www, $re)) { $www = $re[1]; } if (preg_match("#<span>www\\.(.+?)\\.([a-z]+)</span>#i", $www, $re)) { $www = $re[1] . "." . $re[2]; } $www = str_replace("http://", "", $www); if (preg_match("#\\/\\/.+?@(.+)#", $www, $re)) { $websitesToscan[] = $re[1]; } if (preg_match("#http.*?:\\/\\/(.+?)[\\/\\s]+#", $www, $re)) { $websitesToscan[] = $re[1]; continue; } if (preg_match("#^www\\.(.+)#", $www, $re)) { $www = $re[1]; } $www = str_replace("<a href=", "", $www); $www = str_replace("<img src=", "", $www); $www = str_replace("title=", "", $www); if (preg_match("#^(.*?)\\/#", $www, $re)) { $www = $re[1]; } if (preg_match("#\\.php\$#", $www, $re)) { echo "{$www} php script...\n"; continue; } $www = str_replace("/", "", $www); $www = trim($www); if ($ForceExt == 0) { if (!preg_match("#\\.([a-z0-9]+)\$#", $www, $re)) { echo "`{$www}` No extension !!?? \n"; continue; } if (strlen($re[1]) < 2) { if (!is_numeric($re[1])) { echo "{$www} bad extension `.{$re[1]}` [{$ForceExt}]\n"; continue; } } } $www = str_replace('"', "", $www); writelogs("Success pass {$www}", __FUNCTION__, __FILE__, __LINE__); $websitesToscan[] = $www; } while (list($num, $www) = each($websitesToscan)) { $cleaned[$www] = $www; } $websitesToscan = array(); while (list($num, $www) = each($cleaned)) { $websitesToscan[] = $www; } while (list($num, $www) = each($websitesToscan)) { writelogs("Scanning {$www}", __FUNCTION__, __FILE__, __LINE__); $www = strtolower($www); $www = replace_accents($www); if ($www == "www") { continue; } if ($www == "ssl") { continue; } $www = str_replace("http://", "", $www); $www = str_replace("https://", "", $www); $www = str_replace("ftp://", "", $www); $www = str_replace("ftps://", "", $www); if (preg_match("#.+?@(.+)#", $www, $ri)) { $www = $ri[1]; } if (preg_match("#^www\\.(.+?)\$#i", $www, $ri)) { $www = $ri[1]; } if ($ForceCat == 0) { if ($this->already_Cats($www)) { continue; } } if (strpos($www, '"') > 0) { $www = substr($www, 0, strpos($www, '"')); } if (strpos($www, "'") > 0) { $www = substr($www, 0, strpos($www, "'")); } if (strpos($www, ">") > 0) { $www = substr($www, 0, strpos($www, ">")); } if (strpos($www, "?") > 0) { $www = substr($www, 0, strpos($www, "?")); } if (strpos($www, "\\") > 0) { $www = substr($www, 0, strpos($www, "\\")); } if (strpos($www, "/") > 0) { $www = substr($www, 0, strpos($www, "/") - 1); } if (preg_match("#^\\.(.+)#", $www, $re)) { $www = $re[1]; } if (preg_match("#^\\*\\.(.+)#", $www, $re)) { $www = $re[1]; } if (preg_match("#\\.html\$#i", $www, $re)) { continue; } if (preg_match("#\\.htm\$#i", $www, $re)) { continue; } if (preg_match("#\\.gif\$#i", $www, $re)) { continue; } if (preg_match("#\\.png\$#i", $www, $re)) { continue; } if (preg_match("#\\.jpeg\$#i", $www, $re)) { continue; } if (preg_match("#\\.jpg\$#i", $www, $re)) { continue; } if (preg_match("#\\.php\$#i", $www, $re)) { continue; } if (preg_match("#\\.js\$#i", $www, $re)) { continue; } if ($ForceExt == 0) { if (!preg_match("#\\.[a-z0-9]+\$#", $www, $re)) { echo "{$www} bad extension `{$www}` \n"; continue; } } if (strpos(" ", trim($www)) > 0) { continue; } $sites[$www] = $www; } $this->CheckTable_dansguardian(); if (count($sites) == 0) { echo "NO websites\n"; return; } echo "\n----------------\nanalyze " . count($sites) . " websites into {$category}\n"; while (list($num, $www) = each($sites)) { $www = trim($www); if ($www == null) { continue; } if (preg_match("#^www\\.(.+?)\$#", $www, $re)) { $www = $re[1]; } writelogs("Analyze {$www}", __FUNCTION__, __FILE__, __LINE__); $md5 = md5($category . $www); if ($ForceCat == 0) { $cats = $this->GET_CATEGORIES($www, true, true, true); if ($cats != null) { echo "FALSE: {$www} already categorized ({$cats})\n"; continue; } } $category_table = "category_" . $this->category_transform_name($category); $this->CreateCategoryTable($_POST["category"]); $this->QUERY_SQL("INSERT IGNORE INTO {$category_table} (zmd5,zDate,category,pattern,uuid) VALUES('{$md5}',NOW(),'{$category}','{$www}','{$uuid}')"); if (!$this->ok) { echo "categorize {$www} failed {$this->mysql_error} line " . __LINE__ . " in file " . __FILE__ . "\n"; continue; } $this->categorize_logs($category, "{add}", $www); echo "TRUE: {$www} Added\n"; $this->QUERY_SQL("INSERT IGNORE INTO categorize (zmd5,zDate,category,pattern,uuid) VALUES('{$md5}',NOW(),'{$category}','{$www}','{$uuid}')"); if (!$this->ok) { echo $this->mysql_error . "\n"; } } $sock = new sockets(); $sock->getFrameWork("cmd.php?export-community-categories=yes"); }
function TEMPLATE_ADD_SAVE() { $users = new usersMenus(); if (!$users->CORP_LICENSE) { $tpl = new templates(); echo $tpl->javascript_parse_text("{MOD_TEMPLATE_ERROR_LICENSE}"); return; } if ($_POST["template_uri"] != null) { if (!preg_match("#^http#", $_POST["template_uri"])) { $_POST["template_uri"] = "http://" . $_POST["template_uri"]; } } if ($_POST["status_code"] != null) { if ($_POST["status_code"] > 0) { $_POST["template_uri"] = "{$_POST["status_code"]}:{$_POST["template_uri"]}"; } } if ($_POST["freewebs_compliance"] == 1) { $_POST["template_uri"] = $_POST["template_uri"] . "%FREEWEBS%"; } $tpl_name = $_POST["template_name"]; $tpl_name = replace_accents($tpl_name); $tpl_name = str_replace(" ", "_", $tpl_name); $tpl_name = str_replace("-", "_", $tpl_name); $tpl_name = str_replace("/", "_", $tpl_name); $tpl_name = str_replace("\\", "_", $tpl_name); $tpl_name = str_replace(".", "_", $tpl_name); $tpl_name = str_replace(";", "_", $tpl_name); $tpl_name = str_replace(",", "_", $tpl_name); $tpl_name = str_replace("?", "_", $tpl_name); $tpl_name = str_replace("\$", "_", $tpl_name); $tpl_name = str_replace("%", "_", $tpl_name); $tpl_name = str_replace("{", "_", $tpl_name); $tpl_name = str_replace("}", "_", $tpl_name); $tpl_name = str_replace("[", "_", $tpl_name); $tpl_name = str_replace("]", "_", $tpl_name); $tpl_name = str_replace("(", "_", $tpl_name); $tpl_name = str_replace(")", "_", $tpl_name); $tpl_name = str_replace("\"", "_", $tpl_name); $tpl_name = str_replace("'", "_", $tpl_name); $tpl_name = str_replace("&", "_", $tpl_name); $tpl_name = strtoupper($tpl_name); $tpl_name = addslashes($tpl_name); $md5 = md5(serialize($_POST)); $_POST["template_name"] = $tpl_name; $_POST["template_body"] = "<table class=\"w100 h100\"><tr><td class=\"c m\"><table style=\"margin:0 auto;border:solid 1px #560000\"><tr><td class=\"l\" style=\"padding:1px\"><div style=\"width:346px;background:#E33630\"><div style=\"padding:3px\"><div style=\"background:#BF0A0A;padding:8px;border:solid 1px #FFF;color:#FFF\"><div style=\"background:#BF0A0A;padding:8px;border:solid 1px #FFF;color:#FFF\"><h1>ERROR: The requested URL could not be retrieved</h1></div><div class=\"c\" style=\"font:bold 13px arial;text-transform:uppercase;color:#FFF;padding:8px 0\">Proxy Error</div><div style=\"background:#F7F7F7;padding:20px 28px 36px\"> <div id=\"titles\"> <h1>ERROR</h1> <h2>The requested URL could not be retrieved</h2> </div> <hr> <div id=\"content\"> <p>The following error was encountered while trying to retrieve the URL: <a href=\"%U\">%U</a></p> <blockquote id=\"error\"> <p><b>Access Denied.</b></p> </blockquote> <p>Access control configuration prevents your request from being allowed at this time. Please contact your service provider if you feel this is incorrect.</p> <p>Your cache administrator is <a href=\"mailto:%w%W\">%w</a>.</p> <br> </div> <hr> <div id=\"footer\"> <p>Generated %T by %h (%s)</p> <!-- %c --> </div> </div></div></div></td></tr></table></td></tr></table>"; while (list($num, $line) = each($_POST)) { $_POST[$num] = addslashes($line); } $sql = "INSERT IGNORE INTO squidtpls (zmd5,template_name,template_title,lang,template_body,template_link,template_uri,emptytpl) \n\tVALUES ('{$md5}','{$_POST["template_name"]}','{$_POST["template_title"]}','{$_POST["lang"]}',\n\t'{$_POST["template_body"]}','{$_POST["template_link"]}','{$_POST["template_uri"]}','{$_POST["emptytpl"]}')"; if (strlen($_POST["templateid"]) > 5) { $sql = "UPDATE squidtpls SET \n\t\t\t\ttemplate_name='{$_POST["template_name"]}',\n\t\t\t\ttemplate_title='{$_POST["template_title"]}',\n\t\t\t\tlang='{$_POST["lang"]}',\n\t\t\t\temptytpl='{$_POST["emptytpl"]}',\n\t\t\t\ttemplate_link='{$_POST["template_link"]}',\n\t\t\t\ttemplate_uri='{$_POST["template_uri"]}'\n\t\t\t\tWHERE zmd5='{$_POST["templateid"]}'"; } writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $q = new mysql_squid_builder(); if (!$q->FIELD_EXISTS("squidtpls", "emptytpl")) { $q->QUERY_SQL("ALTER TABLE `squidtpls` ADD `emptytpl` smallint(1) NOT NULL"); } $q->CheckTables(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__); return; } $sock = new sockets(); $sock->getFrameWork("squid.php?build-templates=yes&zmd5={$md5}"); }
function provider_save() { $q = new mysql_shorewall(); $table = "fw_providers"; $q->CheckTables(); $editF = false; $ID = $_POST["provider-save"]; unset($_POST["provider-save"]); $_POST["NAME"] = trim($_POST["NAME"]); $_POST["NAME"] = str_replace(" ", "", $_POST["NAME"]); $_POST["NAME"] = strtoupper(replace_accents($_POST["NAME"])); $_POST["NAME"] = substr($_POST["NAME"], 0, 16); while (list($key, $value) = each($_POST)) { $value = url_decode_special_tool($value); $fields[] = "`{$key}`"; $values[] = "'" . mysql_escape_string2($value) . "'"; $edit[] = "`{$key}`='" . mysql_escape_string2($value) . "'"; } $sql_edit = "UPDATE `{$table}` SET " . @implode(",", $edit) . " WHERE ID='{$ID}'"; $sql = "INSERT IGNORE INTO `{$table}` (" . @implode(",", $fields) . ") VALUES (" . @implode(",", $values) . ")"; if ($ID > 0) { $sql = $sql_edit; } $q->QUERY_SQL($sql); if (!$q->ok) { echo "Mysql error: `{$q->mysql_error}`"; return; } $tpl = new templates(); $tpl->javascript_parse_text("{success}"); }
function Tree_ou_Add_user() { $user = $_GET["Tree_ou_Add_user"]; $user = replace_accents($user); $ldap = new clladp(); $ou = $_GET["ou"]; $uid = str_replace(' ', '.', $user); if (stripos($user, '@') > 0) { $mail = $user; $tbl = explode('@', $user); $domainName = $tbl[1]; $user = $tbl[0]; $uid = str_replace(' ', '.', $user); if (preg_match('#([a-z0-9]+)([\\.\\-_])([a-z0-9_\\-\\.]+)#', $user, $reg)) { $firstname = $reg[1]; $lastname = $reg[3]; } elseif (preg_match('#(.+)\\s+(.+)#', $user, $reg)) { $firstname = $reg[1]; $lastname = $reg[2]; } elseif (preg_match('#(.+)#', $user, $reg)) { $lastname = $reg[1]; $firstname = $lastname; } } else { if (preg_match('#([a-z0-9_\\-]+)\\s+([a-z0-9_\\-]+)#', $user, $reg)) { $lastname = $reg[2]; $firstname = $reg[1]; $domainName = 'none'; } else { $lastname = $user; $firstname = $user; $domainName = 'none'; } } $dn = "cn={$user},ou=users,ou={$ou},dc=organizations,{$ldap->suffix}"; $update_array["cn"][] = $user; $update_array["uid"][] = $uid; $update_array["sn"][] = $lastname; $update_array["domainName"][] = $domainName; $update_array["homeDirectory"][] = "/home/{$firstname}.{$lastname}"; $update_array["accountGroup"][] = "0"; $update_array["accountActive"][] = 'TRUE'; $update_array["mailDir"] = 'cyrus'; $update_array["objectClass"][] = "userAccount"; $update_array["objectClass"][] = "top"; $ldap->ldap_add($dn, $update_array); if ($ldap->ldap_last_error != null) { echo nl2br($ldap->ldap_last_error); exit; } $update_array = null; $update_array["givenName"][] = $firstname; $update_array["mail"][] = $mail; $update_array["DisplayName"][] = "{$firstname} " . $lastname; $update_array["MailBoxActive"][] = "FALSE"; $update_array["objectclass"][] = "ArticaSettings"; $ldap->Ldap_add_mod($dn, $update_array); $pages = new HtmlPages(); echo $pages->PageOu("ou={$ou},dc=organizations,{$ldap->suffix}"); }
function mysql_settings($notitle = false) { $page = CurrentPageName(); $user = new usersMenus(); if (!$user->AsArticaAdministrator) { if (!$user->AsSystemAdministrator) { $tpl = new templates(); $text = $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS} !AsSystemAdministrator'); $text = replace_accents(html_entity_decode($text)); echo "alert('{$text}');"; exit; } } $mysql = new mysql(); $rootm = $mysql->mysql_admin; $pwd = $mysql->mysql_password; $servername = $mysql->mysql_server; $sock = new sockets(); $UseSamePHPMysqlCredentials = $sock->GET_INFO("UseSamePHPMysqlCredentials"); if (!is_numeric($UseSamePHPMysqlCredentials)) { $UseSamePHPMysqlCredentials = 1; } $t = time(); $html = "\n\t<div id='animate-{$t}'></div>\n\t<table style='width:99%' class=form>\n\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:16px'>{mysqlserver}:</strong></td>\n\t\t\t<td align='left'>" . Field_text('mysqlserver', $servername, 'width:85%;padding:3px;font-size:16px', null, null, '') . "</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:16px'>{mysqlroot}:</strong></td>\n\t\t\t<td align='left'>" . Field_text('mysqlroot', $rootm, 'width:85%;padding:3px;font-size:16px', null, null, '{mysqlroot_text}') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend style='font-size:16px'>{mysqlpass}:</strong></td>\n\t\t\t<td align='left'>" . Field_password("mysqlpass", $pwd, 'width:85%;padding:3px;font-size:16px') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'>\n\t\t\t\t\t\n\t\t\t\t<hr>" . button("{apply}", "Loadjs('{$page}?script=mysql_save_account&animate=animate-{$t}')", 18) . "\n\t\t\t</td>\n\t\t</tr>\t\n\t</table>\n\t\n\t<div class=explain style='font-size:14px'>{mysqldefault_php_text}</div>\n<table style='width:99%' class=form>\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{UseSamePHPMysqlCredentials}:</strong></td>\n\t\t\t<td align='left'>" . Field_checkbox('UseSamePHPMysqlCredentials', 1, $UseSamePHPMysqlCredentials, "MysqlDefaultCredCheck()") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{mysqlserver}:</strong></td>\n\t\t\t<td align='left'>" . Field_text('PHPDefaultMysqlserver', $PHPDefaultMysqlserver, 'width:110px;padding:3px;font-size:14px', null, null, '') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{listen_port}:</strong></td>\n\t\t\t<td align='left'>" . Field_text('PHPDefaultMysqlserverPort', $PHPDefaultMysqlserverPort, 'width:110px;padding:3px;font-size:14px', null, null, '') . "</td>\n\t\t</tr>\t\t\t\t\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{mysqlroot}:</strong></td>\n\t\t\t<td align='left'>" . Field_text('PHPDefaultMysqlRoot', $PHPDefaultMysqlRoot, 'width:110px;padding:3px;font-size:14px', null, null) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td align='right' nowrap class=legend>{mysqlpass}:</strong></td>\n\t\t\t<td align='left'>" . Field_password("PHPDefaultMysqlPass", $PHPDefaultMysqlPass, "width:110px;padding:3px;font-size:14px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'>\n\t\t\t\t<hr>" . button("{apply}", "SavePhpCredentials()") . "\n\t\t\t</td>\n\t\t</tr>\t\n\t</table>\n\t\n\t<script>\n\tfunction MysqlDefaultCredCheck(){\n\t\tdocument.getElementById('PHPDefaultMysqlserver').disabled=false;\n\t\tdocument.getElementById('PHPDefaultMysqlserverPort').disabled=false;\n\t\tdocument.getElementById('PHPDefaultMysqlRoot').disabled=false;\n\t\tdocument.getElementById('PHPDefaultMysqlPass').disabled=false;\n\t\n\t\n\t\tif(document.getElementById('UseSamePHPMysqlCredentials').checked){\n\t\t\tdocument.getElementById('PHPDefaultMysqlserver').disabled=true;\n\t\t\tdocument.getElementById('PHPDefaultMysqlserverPort').disabled=true;\n\t\t\tdocument.getElementById('PHPDefaultMysqlRoot').disabled=true;\n\t\t\tdocument.getElementById('PHPDefaultMysqlPass').disabled=true;\t\t\n\t\t\n\t\t}\n\t}\n\t\nvar x_SavePhpCredentials=function(obj){\n\t\tLoadjs('{$page}?mysql-settings-popup=yes');\n\n }\t \n\t\t\n\tfunction SavePhpCredentials(){\n\t\t\t\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('UseSamePHPMysqlCredentials').checked){XHR.appendData('UseSamePHPMysqlCredentials',1);}else{XHR.appendData('UseSamePHPMysqlCredentials',0);}\n \t\tXHR.appendData('PHPDefaultMysqlserver',document.getElementById('PHPDefaultMysqlserver').value);\n \t\tXHR.appendData('PHPDefaultMysqlserverPort',document.getElementById('PHPDefaultMysqlserverPort').value);\n \t\tXHR.appendData('PHPDefaultMysqlRoot',document.getElementById('PHPDefaultMysqlRoot').value);\n \t\tXHR.appendData('PHPDefaultMysqlPass',document.getElementById('PHPDefaultMysqlPass').value);\n \t\tXHR.sendAndLoad('{$page}','POST',x_SavePhpCredentials);\n\t\t\n\t\t\n\t}\t\n\n\t\n\t\n\tMysqlDefaultCredCheck();\n\t</script>\n\t\n\t"; $tpl = new templates(); return $tpl->_ENGINE_parse_body($html, "artica.settings.php"); }
function SieveSaveRuleName() { $refer = $_GET["SaveRuleNameRefer"]; $rulename = $_GET["SieveSaveRuleName"]; $ruleid = $_GET["ruleid"]; $userid = $_GET["userid"]; $sieve = new clSieve($userid); if ($ruleid == null) { $ruleid = $sieve->GetRuleId($refer); } $rulename = replace_accents($rulename); $sieve->_params[$ruleid]["RuleName"] = $rulename; $sieve->SaveToLdap(); }
function free_catgorized_save(){ $sock=new sockets(); $uuid=base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes")); if(!preg_match_all("#http.*?:\/\/(.+?)[\/\s]+#",$_POST["textToParseCats"]."\n",$re)){echo "No webistes\n";} while (list ($num, $www) = each ($re[1]) ){ $www=strtolower($www); $www=replace_accents($www); if(preg_match("#^www\.(.+?)$#i",$www,$ri)){$www=$ri[1];} $sites[$www]=$www; } $q=new mysql(); $q->CheckTable_dansguardian(); if(count($sites)==0){echo "NO websites\n";return;} $category=$_POST["category"]; echo "analyze ".count($sites)." websites into $category\n"; while (list ($num, $www) = each ($sites) ){ $md5=md5($www.$category); $sql="SELECT zmd5 FROM dansguardian_community_categories WHERE pattern='$www' AND category='$category'"; $ligne=@mysql_fetch_array($q->QUERY_SQL($sql,"artica_backup")); $sql_add="INSERT INTO dansguardian_community_categories (zmd5,zDate,category,pattern,uuid) VALUES('$md5',NOW(),'$category','$www','$uuid')"; if($ligne["zmd5"]<>null){continue;} echo "Added $www\n"; $q->QUERY_SQL($sql_add,"artica_backup"); if(!$q->ok){echo $q->mysql_error;return;} $cats=GetCategory($www); $sql="UPDATE dansguardian_sitesinfos SET category='$cats', dbpath='$cats' WHERE website='$www'"; writelogs("$sql",__FUNCTION__,__FILE__,__LINE__); $q->QUERY_SQL($sql,"artica_backup"); if(!$q->ok){echo $q->mysql_error."\n";echo $sql;} $sql="UPDATE squid_events_sites SET category='$cats' WHERE website='$www'"; writelogs("$sql",__FUNCTION__,__FILE__,__LINE__); $q->QUERY_SQL($sql,"artica_events"); if(!$q->ok){echo $q->mysql_error."\n";echo $sql;} } $sock=new sockets(); $sock->getFrameWork("cmd.php?export-community-categories=yes"); }
/** * Build the data and actions to process when the "Submit" button is pressed on the order-confirmation screen. * This sends the data to the payment gateway for processing. * (These are hidden fields on the checkout confirmation page) * * @return string */ function process_button() { global $db, $order, $currencies, $currency; $options = array(); $optionsCore = array(); $optionsPhone = array(); $optionsShip = array(); $optionsLineItems = array(); $optionsAggregate = array(); $optionsTrans = array(); $buttonArray = array(); // save the session stuff permanently in case paypal loses the session $_SESSION['ppipn_key_to_remove'] = session_id(); $db->Execute("delete from " . TABLE_PAYPAL_SESSION . " where session_id = '" . zen_db_input($_SESSION['ppipn_key_to_remove']) . "'"); $sql = "insert into " . TABLE_PAYPAL_SESSION . " (session_id, saved_session, expiry) values (\n '" . zen_db_input($_SESSION['ppipn_key_to_remove']) . "',\n '" . base64_encode(serialize($_SESSION)) . "',\n '" . (time() + 1 * 60 * 60 * 24 * 2) . "')"; $db->Execute($sql); $my_currency = select_pp_currency(); $this->transaction_currency = $my_currency; $this->totalsum = $order->info['total'] = zen_round($order->info['total'], 2); $this->transaction_amount = zen_round($this->totalsum * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)); $telephone = preg_replace('/\\D/', '', $order->customer['telephone']); if ($telephone != '') { $optionsPhone['H_PhoneNumber'] = $telephone; if (in_array($order->customer['country']['iso_code_2'], array('US', 'CA'))) { $optionsPhone['night_phone_a'] = substr($telephone, 0, 3); $optionsPhone['night_phone_b'] = substr($telephone, 3, 3); $optionsPhone['night_phone_c'] = substr($telephone, 6, 4); $optionsPhone['day_phone_a'] = substr($telephone, 0, 3); $optionsPhone['day_phone_b'] = substr($telephone, 3, 3); $optionsPhone['day_phone_c'] = substr($telephone, 6, 4); } else { $optionsPhone['night_phone_b'] = $telephone; $optionsPhone['day_phone_b'] = $telephone; } } $optionsCore = array('lc' => $this->getLanguageCode(), 'charset' => CHARSET, 'page_style' => MODULE_PAYMENT_PAYPAL_PAGE_STYLE, 'custom' => zen_session_name() . '=' . zen_session_id(), 'business' => MODULE_PAYMENT_PAYPAL_BUSINESS_ID, 'return' => zen_href_link(FILENAME_CHECKOUT_PROCESS, 'referer=paypal', 'SSL'), 'cancel_return' => zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'), 'shopping_url' => zen_href_link(FILENAME_SHOPPING_CART, '', 'SSL'), 'notify_url' => zen_href_link('ipn_main_handler.php', '', 'SSL', false, false, true), 'redirect_cmd' => '_xclick', 'rm' => 2, 'bn' => 'CNZcart_Cart_EC', 'mrb' => 'R-4DM17246PS436904F', 'pal' => 'GR5QUVVL9AFGN'); $optionsCust = array('first_name' => replace_accents($order->customer['firstname']), 'last_name' => replace_accents($order->customer['lastname']), 'address1' => replace_accents($order->customer['street_address']), 'city' => replace_accents($order->customer['city']), 'state' => zen_get_zone_code($order->customer['country']['id'], $order->customer['zone_id'], $order->customer['state']), 'zip' => $order->customer['postcode'], 'country' => $order->customer['country']['iso_code_2'], 'email' => $order->customer['email_address']); // address line 2 is optional if ($order->customer['suburb'] != '') { $optionsCust['address2'] = $order->customer['suburb']; } // different format for Japanese address layout: if ($order->customer['country']['iso_code_2'] == 'JP') { $optionsCust['zip'] = substr($order->customer['postcode'], 0, 3) . '-' . substr($order->customer['postcode'], 3); } if (MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED == 2) { $optionsCust = array('first_name' => replace_accents($order->delivery['firstname'] != '' ? $order->delivery['firstname'] : $order->billing['firstname']), 'last_name' => replace_accents($order->delivery['lastname'] != '' ? $order->delivery['lastname'] : $order->billing['lastname']), 'address1' => replace_accents($order->delivery['street_address'] != '' ? $order->delivery['street_address'] : $order->billing['street_address']), 'city' => replace_accents($order->delivery['city'] != '' ? $order->delivery['city'] : $order->billing['city']), 'state' => $order->delivery['country']['id'] != '' ? zen_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']) : zen_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']), 'zip' => $order->delivery['postcode'] != '' ? $order->delivery['postcode'] : $order->billing['postcode'], 'country' => $order->delivery['country']['title'] != '' ? $order->delivery['country']['title'] : $order->billing['country']['title'], 'country_code' => $order->delivery['country']['iso_code_2'] != '' ? $order->delivery['country']['iso_code_2'] : $order->billing['country']['iso_code_2'], 'email' => $order->customer['email_address']); if ($order->delivery['suburb'] != '') { $optionsCust['address2'] = $order->delivery['suburb']; } if ($order->delivery['country']['iso_code_2'] == 'JP') { $optionsCust['zip'] = substr($order->delivery['postcode'], 0, 3) . '-' . substr($order->delivery['postcode'], 3); } } $optionsShip['no_shipping'] = MODULE_PAYMENT_PAYPAL_ADDRESS_REQUIRED; if (MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE == '1') { $optionsShip['address_override'] = MODULE_PAYMENT_PAYPAL_ADDRESS_OVERRIDE; } // prepare cart contents details where possible if (MODULE_PAYMENT_PAYPAL_DETAILED_CART == 'Yes') { $optionsLineItems = ipn_getLineItemDetails($my_currency); } if (sizeof($optionsLineItems) > 0) { $optionsLineItems['cmd'] = '_cart'; // $optionsLineItems['num_cart_items'] = sizeof($order->products); if (isset($optionsLineItems['shipping'])) { $optionsLineItems['shipping_1'] = $optionsLineItems['shipping']; unset($optionsLineItems['shipping']); } unset($optionsLineItems['subtotal']); // if line-item details couldn't be kept due to calculation mismatches or discounts etc, default to aggregate mode if (!isset($optionsLineItems['item_name_1']) || $optionsLineItems['creditsExist'] == TRUE) { $optionsLineItems = array(); } // if ($optionsLineItems['amount'] != $this->transaction_amount) $optionsLineItems = array(); // debug: // ipn_debug_email('Line Item Details (if blank, this means there was a data mismatch or credits applied, and thus bypassed): ' . "\n" . print_r($optionsLineItems, true)); unset($optionsLineItems['creditsExist']); } $optionsAggregate = array('cmd' => '_ext-enter', 'item_name' => MODULE_PAYMENT_PAYPAL_PURCHASE_DESCRIPTION_TITLE, 'item_number' => MODULE_PAYMENT_PAYPAL_PURCHASE_DESCRIPTION_ITEMNUM, 'amount' => number_format($this->transaction_amount, $currencies->get_decimal_places($my_currency)), 'shipping' => '0.00'); if (MODULE_PAYMENT_PAYPAL_TAX_OVERRIDE == 'true') { $optionsAggregate['tax'] = '0.00'; } if (MODULE_PAYMENT_PAYPAL_TAX_OVERRIDE == 'true') { $optionsAggregate['tax_cart'] = '0.00'; } $optionsTrans = array('upload' => (int) (sizeof($order->products) > 0), 'currency_code' => $my_currency); // if line-item info is invalid, use aggregate: if (sizeof($optionsLineItems) > 0) { $optionsAggregate = $optionsLineItems; } if (defined('MODULE_PAYMENT_PAYPAL_LOGO_IMAGE')) { $optionsCore['cpp_logo_image'] = urlencode(MODULE_PAYMENT_LOGO_IMAGE); } if (defined('MODULE_PAYMENT_PAYPAL_CART_BORDER_COLOR')) { $optionsCore['cpp_cart_border_color'] = MODULE_PAYMENT_PAYPAL_CART_BORDER_COLOR; } // prepare submission $options = array_merge($optionsCore, $optionsCust, $optionsPhone, $optionsShip, $optionsTrans, $optionsAggregate); // ipn_debug_email('Keys for submission: ' . print_r($options, true)); // build the button fields foreach ($options as $name => $value) { // remove quotation marks $value = str_replace('"', '', $value); // check for invalid chars if (preg_match('/[^a-zA-Z_0-9]/', $name)) { ipn_debug_email('datacheck - ABORTING - preg_match found invalid submission key: ' . $name . ' (' . $value . ')'); break; } // do we need special handling for & and = symbols? // if (strpos($value, '&') !== false || strpos($value, '=') !== false) $value = urlencode($value); $buttonArray[] = zen_draw_hidden_field($name, $value); } $process_button_string = "\n" . implode("\n", $buttonArray) . "\n"; $_SESSION['paypal_transaction_info'] = array($this->transaction_amount, $this->transaction_currency); return $process_button_string; }
function BuildRows($appli, $SockStatus, $internetkey, $noupgrade = false) { $ini = new Bs_IniHandler(); if ($GLOBALS["INDEXFF"] == null) { $GLOBALS["INDEXFF"] = @file_get_contents(dirname(__FILE__) . '/ressources/index.ini'); } $ini->loadString($GLOBALS["INDEXFF"]); $tpl = new templates(); $button_text = $tpl->_parse_body('{install_upgrade}'); if (strlen($button_text) > 27) { $button_text = substr($button_text, 0, 24) . "..."; } $bgcolor = "style='background-color:#DFFDD6'"; $version = ParseAppli($SockStatus, $appli); $uninstall = ParseUninstall($SockStatus, $appli); if ($version == "0" or strlen($version) == 0) { $version = "{not_installed}"; $bgcolor = null; $uninstall = null; } if (file_exists(dirname(__FILE__) . "/ressources/install/{$appli}.dbg")) { $dbg_exists = imgtootltip('22-logs.png', "{events}", "InstallLogs('{$appli}')"); $styledbg = "background-color:yellow;border:1px solid black"; } else { $dbg_exists = "<img src='img/fw_bold.gif'>"; } $appli_text = $tpl->_ENGINE_parse_body("{{$appli}}"); $appli_text = replace_accents($appli_text); if (strlen($appli_text) > 30) { $appli_text = texttooltip(substr($appli_text, 0, 27) . "...", $appli_text, null, null, 1); } $button_install = button($button_text, "ApplicationSetup('{$appli}')"); if ($GLOBALS["ArticaMetaDisableSetupCenter"] == 1) { $button_install = null; $uninstall = null; } // UNINSTALL if ($uninstall != null) { $version = "<table><tr><td style='font-size:13px' valign='middle'>{$version}</td>\n\t\t\t<td valign='middle'>" . imgtootltip("ed_delete.gif", "{uninstall} {{$appli}}", "SetupCenterRemove('{$uninstall}','{$appli}')") . "</td></tr></table>"; } if ($ini->_params["NEXT"]["{$internetkey}"] == null) { writelogs("Unable to stat NEXT/{$internetkey} \"{$ini->_params["NEXT"]["{$internetkey}"]}\"", __FUNCTION__, __FILE__, __LINE__); $ini->_params["NEXT"]["{$internetkey}"] = "<div style='color:#d32d2d'>{error_network}</div>"; $button_install = null; } if ($internetkey == "openldap") { $sock = new sockets(); if ($sock->GET_INFO("AllowUpgradeLdap") != 1) { $button_install = null; } } if ($noupgrade) { $button_install = null; } return "\n\t<tr {$bgcolor}>\n\t\t<td width=2% style=\"{$styledbg}\">{$dbg_exists}</td>\n\t\t<td style='font-size:13px' nowrap>{$appli_text}</td>\n\t\t<td style='font-size:13px'>{$version}</td>\n\t\t<td style='font-size:13px'>{$ini->_params["NEXT"]["{$internetkey}"]}</td>\n\t\t<td style='font-size:11px'>{$button_install}</td>\n\t\t<td style='font-size:13px'><div style='width:100px;height:22px;border:1px solid #CCCCCC' id='STATUS_{$appli}'>" . install_status($appli) . "</div></td>\n\t</tr>\n\t"; }
function BuildBigPartition(){ $dev=$_GET["BuildBigPartition"]; $label=$_GET["label"]; $label=substr($label,0,16); $label=trim($label); $label=replace_accents($label); $sock=new sockets(); //--format-b-part $datas=base64_decode($sock->getFrameWork("cmd.php?fdisk-build-big-partitions=yes&dev=$dev&label=$label")); file_put_contents("ressources/logs/BuildUniquePartition_".md5($dev),$datas); }
$i = 0; $_j = array(); $_dflt = array(); $lg = ''; # cas d'un partage if ($_POST["ou"] == "group") { $c = count($_POST['icons']); foreach ($_POST['icons'] as $k => $val) { $_j[$k] = $val; } $_j['owner'] = $login; $_j['groups'] = $_POST['groups']; /**/ foreach ($_POST['groups'] as $k => $group) { #$_t= htmlentities(trim($_j['txt'])); $_t = htmlentities(preg_replace("# #", "_", replace_accents($_j['txt']))); if ($login == $group) { $resDir = "/home/" . $login . "/Documents/Ressources"; } else { if (acces_btn_admin($login) == "Y") { $resDir = "../data/" . $group; } else { return; } } if (!is_dir($resDir)) { mkdir($resDir, 0770); } $fp = fopen($resDir . "/ICON_" . $login . '_' . stripAccents($_t) . ".json", "w"); $json_fp = json_encode($_j); $fwrite = fwrite($fp, $json_fp);
function LDAP_SAVE() { $tpl = new templates(); $sock = new sockets(); if (isset($_GET["set_cachesize"])) { if ($_GET["set_cachesize"] > 3999) { echo $tpl->_ENGINE_parse_body('{error_max_value_is}: 3999M'); exit; } if ($_GET["cachesize"] < 1000) { echo $tpl->_ENGINE_parse_body(replace_accents(html_entity_decode('{error_min_value_is}: 1000 {entries}'))); exit; } $_GET["set_cachesize"] = $_GET["set_cachesize"] * 1000 * 1024; $sock->SET_INFO("LdapDBSetCachesize", $_GET["set_cachesize"]); } if (isset($_GET["cachesize"])) { $sock->SET_INFO("LdapDBCachesize", $_GET["cachesize"]); } if (isset($_GET["LdapAllowAnonymous"])) { $sock->SET_INFO("LdapAllowAnonymous", $_GET["LdapAllowAnonymous"]); } if (isset($_GET["EnableRemoteAddressBook"])) { $sock->SET_INFO("EnableRemoteAddressBook", $_GET["EnableRemoteAddressBook"]); } if (isset($_GET["LdapListenIPAddr"])) { $sock->SET_INFO("LdapListenIPAddr", $_GET["LdapListenIPAddr"]); } if (isset($_GET["OpenLDAPLogLevel"])) { $sock->SET_INFO("OpenLDAPLogLevel", $_GET["OpenLDAPLogLevel"]); } $sock->getFrameWork("cmd.php?ldap-restart=yes"); }
function getDownloadImage($type, $file, $sottoCat, $nome_brand, $nome_colore, $id) { /*$path = str_replace("index.php","",$_SERVER["SCRIPT_FILENAME"]); $import_location = $path.'media/catalog/'; if (!file_exists($import_location)){ mkdir($import_location, 0755); } $import_location = $path.'media/catalog/'.$type.'/'; if (!file_exists($import_location)){ mkdir($import_location, 0755); }*/ // estensione foto $ext = pathinfo($file, PATHINFO_EXTENSION); // recupero il numero della foto $punto = strrpos($file, "."); $file_new = substr($file, 0, $punto); // il numero dell'immagine $numero_img = substr($file_new, strlen($file_new) - 1, 1); $nome_file = replace_accents(url_slug(strtolower($sottoCat))) . "_" . replace_accents(url_slug(strtolower($nome_brand))) . "_" . replace_accents(url_slug(strtolower($nome_colore))) . "_" . replace_accents(url_slug(strtolower($id))) . "-" . $numero_img . "." . $ext; $import_location = "../../var/images"; $file_source = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_imageurl', Mage::app()->getStore()) . $file; $file_target = $import_location . "/" . $nome_file; $file_source = str_replace(" ", "%20", $file_source); $file_path = ""; if ($file != '' and !file_exists($file_target)) { $rh = fopen($file_source, 'rb'); $wh = fopen($file_target, 'wb'); if ($rh === false || $wh === false) { // error reading or opening file $file_path = ""; } else { while (!feof($rh)) { if (fwrite($wh, fread($rh, 1024)) === FALSE) { $file_path = $file_target; } } } fclose($rh); fclose($wh); } if (file_exists($file_target)) { if ($type == 'category') { $file_path = $file; } else { $file_path = $file_target; } } return $file_path; }
function BuildBigPartition() { $dev = $_GET["BuildBigPartition"]; $label = $_GET["label"]; $label = substr($label, 0, 16); $label = trim($label); $label = replace_accents($label); $sock = new sockets(); //--format-b-part $dev = urlencode($dev); $label = urlencode($label); $datas = base64_decode($sock->getFrameWork("cmd.php?fdisk-build-big-partitions=yes&dev={$dev}&label={$label}&MyCURLTIMEOUT=240")); }