function buildContent($lang) { // array of file names to use // NOTE: the textboxes will be created and ordered in the same order of the array $file_list = array("narrator_box", "style_box", "script_box", "about_box"); // array with the strings to return $res = array("style" => "", "script" => ""); // loop through the file list and create the textboxes HTML $file_count = 0; foreach ($file_list as $file) { // grab the file's content $file_content = getFileContent($file, $lang); // skip if this file has no content if (empty($file_content)) { continue; } // run this file's content through the CSS text color coding function $content_aux = addStyleTags(preg_replace("/(\n|\r\n)/", "\r", $file_content)); // store the styles $res["style"] .= $content_aux["style"]; // run this file's content through the CSS text color coding function $content_aux = addScriptTags($content_aux["color_coded"]); // store the scripts $res["script"] .= $content_aux["script"]; // store this file's content with color coding // making sure to remove any "goto" tags and any "\r" after it (to avoid having empty lines int he final result) $res[$file] = preg_replace("/<goto[^>]*>\r?/i", "", $content_aux["color_coded"]); // create this file's text box (the final html for this file) $res[$file] = "<div id='" . $file . "' class='content flex_item' style='order:" . $file_count++ . ";'>\n\t\t\t<div class='header header_expanded'>\n\t\t\t\t<div class='header_text'>" . strtoupper($file) . "</div>\n\t\t\t\t<div class='header_button hb_expanded'></div>\n\t\t\t</div>\n\t\t\t<div class='text text_expanded'>" . $res[$file] . "</div>\n\t\t</div>"; } return $res; }
public function read() { if (!is_file($this->fileName)) { return false; } else { return getFileContent($this->fileName); } }
function matchFilter($filter, $content) { if (isset($filter->gt)) { foreach ($filter->gt as $key => $val) { if (!isset($content->{$key}) || $content->{$key} <= $val) { return false; } } } if (isset($filter->lt)) { foreach ($filter->lt as $key => $val) { if (!isset($content->{$key}) || $content->{$key} >= $val) { return false; } } } if (isset($filter->equal)) { foreach ($filter->equal as $key => $val) { if (!isset($content->{$key}) || $content->{$key} != $val) { return false; } } } if (isset($filter->inArray)) { foreach ($filter->inArray as $key => $val) { if (!isset($content->{$key}) || !in_array($val, $content->{$key})) { return false; } } } if (isset($filter->vague)) { foreach ($filter->vague as $val) { if (is_array($content->tag) && in_array($val, $content->tag)) { return true; } if (strpos($content->title, $val) !== false) { return true; } $text = getFileContent($srkEnv->penPath . $content->penId . '/content.md'); if (strpos($text, $val) !== false) { return true; } } return false; } return true; }
public function load($pathName) { $this->fileName = $pathName . '/like.json'; if (is_file($this->fileName)) { $this->data = json_decode(getFileContent($this->fileName)); if ($this->data !== null) { if (is_object($this->data->list)) { $this->data->list = (array) $this->data->list; } $this->status = 'normal'; } } else { $this->data = (object) self::$defaultData; $this->status = 'normal'; } return $this->status !== 'normal'; }
function commentLoadContent($penId, $commentId) { global $srkEnv; $contentFileName = $srkEnv->penPath . '/' . $penId . '/comment/' . $commentId . '/content.html'; return getFileContent($contentFileName); }
<?php include dirname(__FILE__) . "/../commonLib.php"; $filePath = $_GET["file_path"]; // $filePath = "/disk2/qatest/svn_code/qa/WebFramework/htdocs/m_testAssist/m_productCodeComment/code/bf3c7cfd35b54b58eb4fa83eca5a5f35/499969/build.xml"; // $filePath = "/disk2/qatest/svn_code/qa/WebFramework/htdocs/m_testAssist/m_productCodeComment/code/bf3c7cfd35b54b58eb4fa83eca5a5f35/499969/src/java/outfox/ead/stat/mongo/model/Order.java"; $retArray = getFileContent($filePath, "red"); $type = $retArray["type"]; $lines = $retArray["lines"]; $content = ""; if ($type == "image" || $type == "error") { $content = $lines[0]; } elseif ($type == "text") { $line_cnt = count($lines); $temp_arr = array(); $line_idx_classname = "idx_span"; $line_classname = "cont_span"; $line_idx = 1; foreach ($lines as $arr) { list($line, $funcName) = $arr; if ($line_cnt < 10) { $line = sprintf("<span class='{$line_idx_classname}'>%s</span><span class='{$line_classname}'>%s</span>", $line_idx, $line); } elseif ($line_cnt < 100) { $line = sprintf("<span class='{$line_idx_classname}'>%2s</span><span class='{$line_classname}'>%s</span>", $line_idx, $line); } elseif ($line_cnt < 1000) { $line = sprintf("<span class='{$line_idx_classname}'>%2s</span><span class='{$line_classname}'>%s</span>", $line_idx, $line); } elseif ($line_cnt < 10000) { $line = sprintf("<span class='{$line_idx_classname}'>%2s</span><span class='{$line_classname}'>%s</span>", $line_idx, $line); } $line_idx++; array_push($temp_arr, "<div name='func_{$funcName}' class='file_line'>" . $line . "</div>");
<link href="theme/<?php echo CONFIG_THEME_NAME; ?> /css/ajaxtexteditor.css" type="text/css" rel="stylesheet"/> <link href="theme/<?php echo CONFIG_THEME_NAME; ?> /css/jqModal.css" type="text/css" rel="stylesheet"/> <title>Ajax Text Editor</title> </head> <body> <div id="pageBody"> <textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?> </textarea> </div> <div id="windowProcessing" class="jqmWindow" style="display:none"> <form name="frmProcessing" id="frmProcessing" method="post" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path'))); ?> "> <input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?> "/> <input type="hidden" name="name" id="name" value="<?php echo basename($path);
<?php include dirname(__FILE__) . "/../util/util.php"; echo json_encode(getFileContent($_GET["file_path"]));
function makecontact_execute($action, $slot) { global $_POST; global $_GET; global $_CONFIG; require_once "config/db.php"; global $conn; global $_local_error; $_local_error = ""; global $_local_reloadform; $_local_reloadform = ""; global $render_current_slot; global $current_slots; //mark slot on execution stack $render_current_slot++; $current_slots[$render_current_slot] = $slot; if (getUserConfig("pageprotection") == "yes") { if (isset($_POST['fprotection']) && $_POST['fprotection'] != "") { if (isset($_GET['ajax']) && $_GET['ajax'] == 1) { if (intval(session_getvalue("protection_page")) != intval($_POST['fprotection'])) { $_local_error = getLT("protectionerror"); } } else { if (intval(session_getvalue("protection_page")) != intval($_POST['fprotection']) + 1) { $_local_error = getLT("protectionerror"); } } } } //set default filter $control_filter = ""; $control_name = "makecontact"; $control_table = "projectissues"; $control_id = "id"; //check for rights if (getUserConfig('dinsec_makecontact_cando', $action) == 'no') { $_local_error = getLT('nopermissions'); } if (getUserConfig('dinsec_makecontact_canpost', $action) == 'no') { $_local_error = getLT('nopermissions'); } if (session_getvalue("blockaccess_makecontact") == "yes") { $_local_error = getLT('nopermissions'); } if (session_getvalue("blockaccess_projectissues") == "yes") { $_local_error = getLT('nopermissions'); } if ($_local_error == "") { switch ($action) { case 'add': if (isset($_POST['cancel_button']) && $_POST['cancel_button'] == getLT('cancel')) { $_local_error = 'usercanceled'; setSlotView($slot, "add"); break; } if ($_local_error == '') { if (!isset($_POST['iname']) || $_POST['iname'] == '' || strip_tags($_POST['iname']) == '') { $_local_error .= getLT('iname') . ' ' . getLT('shouldbefilled'); } } if ($_local_error == '') { if (!isset($_POST['iemail']) || $_POST['iemail'] == '' || strip_tags($_POST['iemail']) == '') { $_local_error .= getLT('iemail') . ' ' . getLT('shouldbefilled'); } } if ($_local_error == '') { if (!isset($_POST['icontactname']) || $_POST['icontactname'] == '' || strip_tags($_POST['icontactname']) == '') { $_local_error .= getLT('icontactname') . ' ' . getLT('shouldbefilled'); } } if ($_local_error == '') { if (!isset($_POST['useraddress'])) { $_local_error .= getLT('javascript?'); } else { $ab_def = strtok($_POST['useraddress'], "-"); $ab_test = $ab_def . '-' . number_format(floatVal($ab_def . '.12') * 0.34, 4, '.', ''); if ($ab_test !== $_POST['useraddress']) { $_local_error .= getLT('antiboterror?'); } } } if ($_local_error == "") { $conn->addnew($control_table); $conn->setvalue('iname', correctPostValue($_POST['iname'])); $conn->setvalue('iemail', correctPostValue($_POST['iemail'])); $conn->setvalue('icontactname', correctPostValue($_POST['icontactname'])); $html = correctPostValue($_POST['idesc']); $html = str_ireplace("<script", "[script", $html); $html = str_ireplace("<link", "[link", $html); $html = str_ireplace("<style", "[style", $html); $conn->setvalue('idesc', $html); $conn->setvalue('projectid', $_CONFIG['projectid']); $conn->setvalue('idate', date("Y-m-d H:i:s")); $id = $conn->update(); if ($id != "") { session_addvalue($slot . '_info', getLT('wblank')); session_setvalue($slot . "_viewid", $id); setSlotView($slot, "add"); } else { $_local_error = getLT('unableadd'); break; } } case 'sendemail': if (isset($_POST['cancel_button']) && $_POST['cancel_button'] == getLT('cancel')) { $_local_error = 'usercanceled'; break; } if ($_local_error == "") { ob_start(); require_once "config/htmlreport.php"; require_once "config/templates.php"; require_once "config/mail.php"; global $_templates; require_once "config/utils.php"; $_control_replace_sql = "parseAndReplaceAll"; $pdf = new HtmlReport(""); $emailbody = ob_get_contents(); ob_end_clean(); $emailbody = html_entity_decode($emailbody); $emailsubject = getLT('emailcontact'); global $mails_sql_conn; $mails_sql_conn = create_db_connection(); $mails_sql_conn->openselect($_control_replace_sql("select pemails as email from projects where id=0[config.projectid]")); $noemail = false; if ($mails_sql_conn->eof()) { $noemail = true; } while (!$mails_sql_conn->eof()) { $mailman = createMailObject(); $mailman->IsHTML(true); $emailto = $mails_sql_conn->getvalue("email"); $emailreply = ""; $emailbcc = ""; $emailcc = ""; $emailfrom = ""; $emailbody = getFileContent(getFilePathFor('html', 'makecontact')); require_once "config/utils.php"; $emailbody = parseAndReplaceAll($emailbody); $emailreply = correctPostValue($_POST["iemail"]); $mailman->Body = $emailbody; $mailman->Subject = $emailsubject; $mailman->ClearAddresses(); $mailman->AddAddress($emailto); if ($emailbcc != "") { $mailman->AddBCC($emailbcc); } if ($emailcc != "") { $mailman->AddCC($emailcc); } if ($emailfrom != "") { $mailman->FromName = ""; $mailman->From = $emailfrom; } if ($emailreply != '') { $mailman->AddReplyTo($emailreply); } $mailman->send(); $mails_sql_conn->movenext(); } $mails_sql_conn->close(); if ($noemail) { session_addvalue($slot . '_error', getLT('noemailfound')); } else { session_addvalue($slot . '_info', getLT('yourmessageissent')); } } break; default: //$_local_error="slot:".$slot." unknown post action: ".$action; setSlotView($slot, ""); break; } } if (isset($_POST['cancel_button']) && $_POST['cancel_button'] == getLT('cancel')) { //if($_local_error!="") session_addvalue($slot.'_error',getLT($_local_error)); $_local_error = ''; } else { if ($_local_reloadform != "" || $_local_error != "" || $action == "justreloadform") { //save post for later use foreach ($_POST as $key => $val) { if (is_array($val)) { session_setvalue('savedpost_makecontact_' . $key, correctPostValue(implode(",", str_replace(',', ' ', $_POST[$key])))); } else { session_setvalue('savedpost_makecontact_' . $key, correctPostValue($val)); } } if ($_local_error != "") { session_addvalue($slot . '_error', $_local_error); } } } $render_current_slot--; return $_local_error; }
} ); </script> <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/editor.css" type="text/css" rel="stylesheet" /> <link href="theme/<?php echo CONFIG_THEME_NAME; ?>/css/jqModal.css" type="text/css" rel="stylesheet" /> <title>Ajax Text Editor</title> </head> <body> <div id="pageBody"> <textarea name="content" id="content" style="height:500px; width: 97%;"><?php echo getFileContent($path); ?></textarea> </div> <div id="windowProcessing" class="jqmWindow" style="display:none"> <form name="frmProcessing" id="frmProcessing" method="POST" action="<?php echo appendQueryString(CONFIG_URL_SAVE_TEXT, makeQueryString(array('path')));?>"> <input type="hidden" name="folder" id="folder" value="<?php echo dirname($path); ?>" /> <input type="hidden" name="name" id="name" value="<?php echo basename($path); ?>" /> <input type="hidden" name="save_as_request" id="save_as_request" value="0" /> <div style="display:none"><textarea name="text" id="text"></textarea></div> </form> <a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a> <p><img src="theme/<?php echo CONFIG_THEME_NAME; ?>/images/loading.gif" /></p> </div> <div id="windowSaveAs" class="jqmWindow" style="display:none"> <a href="#" class="jqmClose" id="windowSaveClose"><?php echo IMG_BTN_CANCEL; ?></a> <form id="formSaveAs" name="formSaveAs" action="" method="post"> <table class="tableForm" cellpadding="0" cellspacing="0">
function combineFile($filePath) { global $loadedFileList, $treeContentList, $treeIndex, $contentList, $t; $fileContent = getFileContent($filePath); $loadedFileList[$filePath] = $filePath; $treeContentList[] = str_repeat(' | ', $treeIndex) . ' +---- ' . $filePath; $treeIndex++; foreach ($fileContent as $key => $value) { $matchFile = findImport($value, $t); if ($matchFile != '') { if (@$loadedFileList[$matchFile] == null) { combineFile($matchFile); $contentList[] = "\n"; } } else { $contentList[] = $value; } } $treeIndex--; }
return; } if ($check[2] !== IMAGETYPE_GIF && $check[2] !== IMAGETYPE_JPEG && $check[2] !== IMAGETYPE_PNG) { echo '<script language="javascript"> alert("Image Type is not a gif/jpeg/png !!"); window.location="' . SERVER . '/profile"; </script>'; return; } $filename = pathinfo($_FILES['profilepic']['name'], PATHINFO_FILENAME); $fileext = pathinfo($_FILES['profilepic']['name'], PATHINFO_EXTENSION); $image = uniqid('') . md5($filename) . '.' . $fileext; $file_path = $target_dir . $image; $fileTmpLoc = $_FILES['profilepic']['tmp_name']; $fileContents = hash_file('md5', $fileTmpLoc); $oldContent = getFileContent($sid); if ($fileContents == $oldContent) { echo '<script language="javascript"> alert("You are trying to upload the same file!"); window.location="' . SERVER . '/profile"; </script>'; return; } if ($check[2] == IMAGETYPE_JPEG) { $src = imagecreatefromjpeg($fileTmpLoc); } elseif ($check[2] == IMAGETYPE_PNG) { $src = imagecreatefrompng($fileTmpLoc); } else { $src = imagecreatefromgif($fileTmpLoc); } list($width, $height) = getimagesize($fileTmpLoc);
<?php error_reporting(0); // require the php file with all the custom functions require dirname(dirname(dirname(__FILE__))) . "/code/functions.php"; // grab the file name if (isset($_GET["fn"])) { $file_name = $_GET["fn"]; } else { // no file name was passed, so echo an empty stringe echo ""; exit; } // grab the language if (isset($_GET["lang"])) { $lang = $_GET["lang"]; } else { // default to english $lang = "EN"; } // grab the file's content and echo it echo getFileContent($file_name, $lang);
/** * Is this file a shame ? Yep, totaly. * * @author Adrien Brault <*****@*****.**> */ // See http://www.apple.com/itunes/affiliates/resources/documentation/genre-mapping.html $genresUrl = 'http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/genres'; $result = json_decode(file_get_contents($genresUrl), true); $flatGenres = array(); foreach ($result as $genre) { $flatGenres = array_merge($flatGenres, getFlatGenres($genre)); } $className = 'Genres'; $namespace = 'AdrienBrault\\ItunesClient'; $filePath = __DIR__ . '/../src/AdrienBrault/ItunesClient/Genres.php'; file_put_contents($filePath, getFileContent(filterResult($result), $flatGenres, $namespace, $className)); function getFlatGenres(array $genre, $namePrefix = '') { $name = normalizeText($namePrefix . $genre['name']); $genres = array($name => (int) $genre['id']); if (isset($genre['subgenres'])) { foreach ($genre['subgenres'] as $subGenre) { $genres = array_merge($genres, getFlatGenres($subGenre, $name . '_')); } } return $genres; } function normalizeText($text) { $text = strtoupper($text); $text = preg_replace('/[^A-Z_ ]/', '', $text);
private function sendEmailSituacionAfiliatoria($msgError) { global $conn; $emailTo = $this->datosUsuario["EMAILAVISOART"]; $subject = "Empresa con situación afiliatoria complicada"; $body = getFileContent($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_cotizacion/plantillas/email_situacion_afiliatoria.html"); $params = array(":id" => $this->datosUsuario["CANAL"]); $sql = "SELECT ca_codigo || ' - ' || ca_descripcion FROM aca_canal WHERE ca_id = :id"; $body = str_replace("@canal@", ValorSql($sql, "", $params, 0), $body); $params = array(":id" => $this->datosUsuario["ENTIDAD"]); $sql = "SELECT en_codbanco || ' - ' || en_nombre FROM xen_entidad WHERE en_id = :id"; $body = str_replace("@entidad@", ValorSql($sql, "", $params, 0), $body); if ($_SESSION["sucursal"] != "") { $params = array(":id" => $this->datosUsuario["SUCURSAL"]); $sql = "SELECT su_codsucursal || ' - ' || su_descripcion FROM asu_sucursal WHERE su_id = :id"; $body = str_replace("@sucursal@", ValorSql($sql, "", $params, 0), $body); } else $body = str_replace("@sucursal@", "", $body); $params = array(":id" => $this->datosSolicitud["artAnterior"]); $sql = "SELECT ar_nombre FROM aar_art WHERE ar_id = :id"; $body = str_replace("@artactual@", ValorSql($sql, "", $params, 0), $body); $vendedor = ""; if ($this->datosSolicitud["codigoVendedor"] != NULL) { $params = array(":vendedor" => IIF(($this->datosSolicitud["codigoVendedor"] == ""), "0", $this->datosSolicitud["codigoVendedor"])); $sql = "SELECT ve_vendedor || ' - ' || ve_nombre FROM xve_vendedor WHERE ve_vendedor = :vendedor"; $vendedor = ValorSql($sql, "", $params, 0); } elseif ($this->datosUsuario["VENDEDOR"] == "") { $params = array(":identidad" => $this->datosUsuario["ENTIDAD"]); $sql = "SELECT ve_vendedor || ' - ' || ve_nombre FROM xev_entidadvendedor, xve_vendedor WHERE ve_id = ev_idvendedor AND ev_fechabaja IS NULL AND ve_fechabaja IS NULL AND ve_vendedor = '0' AND ev_identidad = :identidad"; $vendedor = ValorSql($sql, "", $params, 0); } $body = str_replace("@codigovendedor@", $vendedor, $body); $params = array(":codigo" => $this->datosSolicitud["statusBcra"]); $sql = "SELECT tb_descripcion FROM ctb_tablas WHERE tb_clave = 'STBCR' AND tb_codigo = :codigo"; $body = str_replace("@statusbcra@", ValorSql($sql, "", $params, 0), $body); $params = array(":codigo" => $this->datosSolicitud["statusSrt"]); $sql = "SELECT tb_descripcion FROM ctb_tablas WHERE tb_clave = 'STSRT' AND tb_codigo = :codigo"; $body = str_replace("@statussrt@", ValorSql($sql, "", $params, 0), $body); $body = str_replace("@cantidadestablecimientos@", $this->datosSolicitud["cantidadEstablecimientos"], $body); $body = str_replace("@ciiu1@", $this->getCodigoActividad($this->datosSolicitud["ciiu1"]), $body); $body = str_replace("@contacto@", $this->datosSolicitud["contacto"], $body); $body = str_replace("@cuit@", $this->datosSolicitud["cuit"], $body); $body = str_replace("@edadpromedio@", $this->datosSolicitud["edadPromedio"], $body); $body = str_replace("@email@", $this->datosSolicitud["email"], $body); $body = str_replace("@emailComercializador@", $this->datosUsuario["EMAIL"], $body); $body = str_replace("@error@", $msgError, $body); $body = str_replace("@masasalarial1@", $this->datosSolicitud["masaSalarial1"], $body); $body = str_replace("@periodo@", $this->datosSolicitud["periodo"], $body); $body = str_replace("@razonsocial@", $this->datosSolicitud["razonSocial"], $body); $body = str_replace("@resultadomensualtrabajador@", $this->getResultadoMensualPorTrabajador(), $body); $body = str_replace("@sector@", $this->datosSolicitud["sector"], $body); $body = str_replace("@sumafija@", $this->datosSolicitud["calculoSumaFija"], $body); $body = str_replace("@telefono@", $this->datosSolicitud["telefono"], $body); $body = str_replace("@trabajadores1@", $this->datosSolicitud["totalTrabajadores1"], $body); $body = str_replace("@usuario@", $this->datosUsuario["USUARIO"], $body); $body = str_replace("@variable@", $this->datosSolicitud["calculoVariable"], $body); // Agrego los datos del CIIU 2.. $str = ""; if ($this->datosSolicitud["ciiu2"] != "") { $str.= "Cod. CIIU (2): ".$this->getCodigoActividad($this->datosSolicitud["ciiu2"])."<br />"; $str.= "Cant. Trabajadores (2): ".$this->datosSolicitud["totalTrabajadores2"]."<br />"; $str.= "Masa Salarial (2): ".$this->datosSolicitud["masaSalarial2"]."<br />"; } $body = str_replace("@ciiu2@", $str, $body); // Agrego los datos del CIIU 3.. $str = ""; if ($this->datosSolicitud["ciiu3"] != "") { $str.= "Cod. CIIU (3): ".$this->getCodigoActividad($this->datosSolicitud["ciiu3"])."<br />"; $str.= "Cant. Trabajadores (3): ".$this->datosSolicitud["totalTrabajadores3"]."<br />"; $str.= "Masa Salarial (3): ".$this->datosSolicitud["masaSalarial3"]."<br />"; } $body = str_replace("@ciiu3@", $str, $body); // Agrego los datos de la competencia.. $str = ""; switch ($this->datosSolicitud["datosCompetencia"]) { case "": $str = "Sin Dato<br />"; break; case "A": $str = "Solo pago total mensual: ".$this->datosSolicitud["soloPagoTotalMensual"]."<br />"; break; case "N": $str = "Formulario 931 Costo Fijo: ".$this->datosSolicitud["alicuotaCompetenciaSumaFija"]."<br />"; $str.= "Formulario 931 Costo Variable: ".$this->datosSolicitud["alicuotaCompetenciaVariable"]."<br />"; break; case "S": $str = "Alícuota Competencia Costo Fijo: ".$this->datosSolicitud["formulario931CostoFijo"]."<br />"; $str.= "Alícuota Competencia Costo Variable: ".$this->datosSolicitud["formulario931CostoVariable"]."<br />"; break; } $body = str_replace("@datoscompetencia@", $str, $body); // Agrego los datos de los establecimientos.. $i = 1; $str = ""; foreach ($this->datosSolicitud["establecimientos"] as $value) { $params = array(":id" => $value["idActividad"]); $sql = "SELECT ta_detalle FROM afi.ata_tipoactividad WHERE ta_id = :id"; $actividad = ValorSql($sql, "", $params, 0); $params = array(":id" => $value["idCiiu"]); $sql = "SELECT ac_codigo || ' - ' || ac_descripcion FROM cac_actividad WHERE ac_id = :id"; $ciiu = ValorSql($sql, "", $params, 0); $params = array(":id" => $value["idLocalidad"]); $sql = "SELECT cp_localidad FROM art.ccp_codigopostal WHERE cp_id = :id"; $localidad = ValorSql($sql, "", $params, 0); $params = array(":id" => $value["idProvincia"]); $sql = "SELECT zg_descripcion FROM afi.azg_zonasgeograficas WHERE zg_id = :id"; $provincia = ValorSql($sql, "", $params, 0); $str.= $i."= ".$provincia.", " .$localidad.", ".$actividad.", ".$ciiu.", ".$value["cantidadTrabajadores"]."<br />"; $i++; } $body = str_replace("@establecimientos@", $str, $body); SendEmail($body, "Web", $subject, array($emailTo), array(), array(), "H"); }
public function register($id, $data) { global $srkEnv; $this->id = $id; if ($data['passwd'] != $data['repeatPasswd']) { return (object) array('res' => 'Passwords do not match', 'field' => 'passwd'); } foreach (UserData::$matchExp as $key => $exp) { if (preg_match($exp, $data[$key]) == 0) { $errText = 'Invalid ' . $key . '(regular exp: ' . $exp . ')'; return (object) array('res' => $errText, 'field' => $key); } else { $this->data->{$key} = $data[$key]; } } if (is_dir($srkEnv->userPath . '/' . $id)) { return (object) array('res' => 'User exists', 'field' => 'userId'); } if (is_file(self::getEmailFileName($data['email']))) { return (object) array('res' => 'Email exists', 'field' => 'email'); } $invitecodeFileName = $srkEnv->userPath . '/invite_' . $data['invitecode'] . '.json'; if (!is_file($invitecodeFileName)) { return (object) array('res' => 'Invalid invite code', 'field' => 'invitecode'); } $inviteCode = json_decode(getFileContent($invitecodeFileName)); if ($inviteCode->used !== false) { return (object) array('res' => 'Illegal invite code', 'field' => 'invitecode'); } $this->data->registerTime = time(); $this->data->source = 'local'; $this->status = 'registered'; return (object) array('res' => false); }
} elseif ($srkEnv->reqURLLength == 4) { $penId = $srkEnv->reqURL[4]; if (!is_dir($srkEnv->penPath . '/' . $penId)) { srkSend(array('error' => 'No such pen')); } elseif ($srkEnv->reqURL[3] == 'content') { $content = getFileContent($srkEnv->penPath . '/' . $penId . '/content.md'); if ($content === -1) { $content = 'No pen content'; } srkSend(array('content' => $content)); } elseif ($srkEnv->reqURL[3] == 'preview') { $config = penConfigLoad($penId); if ($config->catalog == 'code') { $content = 'Code'; } else { $content = getFileContent($srkEnv->penPath . '/' . $penId . '/content.md'); } if ($content === -1) { $content = 'No pen preview'; } else { $pos = strpos($content, "\n"); if (!$pos) { $pos = strpos($content, "\r\n"); } if ($pos != false) { $content = substr($content, 0, $pos); $content .= "<br/>..."; } } srkSend(array('content' => $content, 'penId' => $penId)); } elseif ($srkEnv->reqURL[3] == 'config') {
$penId = ''; do { $penId = randId(6); } while (is_dir($srkEnv->penPath . '/' . $penId)); srkSend((object) array('id' => $penId)); } } elseif ($srkEnv->reqURL[2] == 'invite') { if (!in_array('invite', $user->getField("accessList"))) { srkSend((object) array('error' => 'Access denied')); } elseif ($srkEnv->reqURLLength == 3 && $srkEnv->reqURL[3] == 'query') { $res = array(); $fileList = getDirCatalog($srkEnv->userPath); foreach ($fileList as $item) { if (substr($item, 0, 7) == 'invite_') { $inviteCode = substr($item, 7, -5); $inviteObj = json_decode(getFileContent($srkEnv->userPath . '/' . $item)); $inviteObj->value = $inviteCode; array_push($res, $inviteObj); } } srkSend((object) array('list' => $res)); } elseif ($srkEnv->reqURLLength == 4 && $srkEnv->reqURL[3] == 'generate') { $count = (int) $srkEnv->reqURL[4]; $defInfo = (object) array('used' => false); if ($count > 0 && $count < 16) { for ($i = 0; $i < $count; ++$i) { $code = ''; do { $code = randId(16); } while (is_file($srkEnv->userPath . '/invite_' . $code . '.json')); $codeFileName = $srkEnv->userPath . '/invite_' . $code . '.json';
* Contributors: * Gallouin Arthur */ include '../vendor/autoload.php'; /** * * getFileContent function * function used to download the blob of a file, converted into a PDF file * @param String $path contains the path of th file holding the blob */ function getFileContent($path = '/default-domain/workspaces/jkjkj/teezeareate.1304515647395') { $eurl = explode("/", $path); $temp = str_replace(" ", "", end($eurl)); $client = new \Nuxeo\Automation\Client\NuxeoPhpAutomationClient('http://localhost:8080/nuxeo/site/automation'); $session = $client->getSession('Administrator', 'Administrator'); $answer = $session->newRequest("Blob.Get")->set('input', 'doc:' . $path)->sendRequest(); if (!isset($answer) or $answer == false) { echo '$answer is not set'; } else { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $temp . '.pdf'); readfile('tempstream'); } } if (!isset($_POST['data']) or empty($_POST['data'])) { echo 'error'; } else { getFileContent($_POST['data']); }
$q = $connect->query("select count(*) from shortcircuit_each_info"); $q = $q->fetch_assoc(); $q = intval($q['count(*)']) + 1; $hash = md5($q + 2500 . 'apple'); $connect->query("insert into shortcircuit_each_info(hash,info,update_data) values ('{$hash}','{}','{}')"); print json_encode(array('id' => $hash)); die; } else { if ($_GET['type'] == 'update_each_info') { $hash = getHashStorage(); if ($hash == "-1") { die("-1"); } var_dump(json_decode($_GET['data'], true)); if ($data = json_decode($_GET['data'], true)) { getFileContent('./data/structure.json'); $clustering = $content; $data['_color'] = array(); $i = 0; foreach ($data as $key => $value) { $i++; foreach ($clustering['setup'] as $eachCluster) { if ($eachCluster['name'] == $key) { if ($eachCluster['type'] == 'choice') { for ($j = 0; $j < count($eachCluster['choice']); $j++) { if ($eachCluster['choice'][$j]['value'] == $value) { $data["_color"][md5($key)] = getColor($j + $i * 2); break; } } }
<?php function getFileContent($fileName) { $content = file_get_contents($fileName); $content = json_decode($content, true); return $content; } if (!isset($_GET['adminToken']) || $_GET['adminToken'] != 'cf1a44') { header("Location: ../index.php"); die; } $clustering = getFileContent('../data/structure.json'); $admin = getFileContent('../data/admin_inject.json'); $current = getFileContent('../data/current.json'); if ($_GET['name'] == 'controller') { $current['state'] = $_GET['state']; if ($_GET['state'] == 'admin') { for ($i = 0; $i < count($admin); $i++) { if ($admin[$i]['name'] == $_GET['type']) { $current['data'] = $admin[$i]['data']; break; } } } else { if ($_GET['state'] == 'clustering') { $current['data'] = md5($_GET['type']); } else { $current['data'] = array(); unset($current['data']); }
function render($sourceDir, $targetDir, $template, $dir, $baseUrl, $relativeUrl = '/', $breadcrumbs = array(), $breadcrumbSeparator) { $info = array(); $error = array(); $htmldoctreeInfo = '<p>Generated with <a href="http://www.nterms.com/tools/htmldoctree">HTMLDocTree</a></p>'; $info[] = "Entering directory: <em>" . $sourceDir . '</em><br/>'; $source = opendir($sourceDir); $target = opendir($targetDir); // generate the breadcrumb $meta = array(); if (is_file($sourceDir . DS . 'index.html')) { $content = getFileContent($sourceDir . DS . 'index.html'); $meta = getMetadata($content); } $title = isset($meta['title']) ? $meta['title'] : basename($dir); $dirUrl = $baseUrl . $relativeUrl; $breadcrumbs[] = ' <span class="breadcrumb-node link"><a href="' . $dirUrl . '" title="' . $title . '" >' . $title . '</a></span>'; if ($source) { if ($target) { while ($item = readdir($source)) { if ($item == '.' || $item == '..') { continue; } $srcPath = $sourceDir . DS . $item; $destPath = $targetDir . DS . $item; $info[] = "Processing node: <em>" . $srcPath . '</em><br/>'; if (is_dir($srcPath)) { if (!is_dir($destPath)) { //unlink($path); $info[] = "Creating directory: <em>" . $destPath . '</em><br/>'; if (!mkdir($destPath)) { $error[] = "Creating directory failed: <em>" . $destPath . '</em><br/>'; return; } } render($srcPath, $destPath, $template, $dir . DS . $item, $baseUrl, $relativeUrl . '/' . $item, $breadcrumbs, $breadcrumbSeparator); } if (is_file($srcPath)) { if (strpos($srcPath, ".html") > 0) { $itemId = str_replace(".html", '', $item); $pageId = $dir . '/' . $itemId; $pageUrl = $baseUrl . $dir . '/' . $item; $replacementPatterns = array('/<!-- *{content} *-->/i', '/<!-- *{breadcrumb} *-->/i', '/<!-- *{title} *-->/i', '/<!-- *{description} *-->/i', '/<!-- *{disqus_identifier} *-->/i', '/<!-- *{disqus_url} *-->/i', '/<!-- *{htmldoctree} *-->/i'); $replacementStrings = array('content', 'beadcrumb', 'title', 'description', $pageId, $pageUrl, $htmldoctreeInfo); $info[] = "Creating file: <em>" . $destPath . '</em>'; $dest = fopen($destPath, 'w'); if (!$dest) { $error[] = "Creating file failed: <em>" . $destPath . '</em>'; } $content = getFileContent($srcPath); // get metadata if available $meta = getMetadata($content); $html = setMetadata($meta, $html); $replacementStrings[0] = $content; //$html = str_replace("<!-- {content} -->", $content, $template); //$html = str_replace("<!-- {disqus_identifier} -->", $pageId, $html); //$html = str_replace("<!-- {disqus_url} -->", $pageUrl, $html); //$html = str_replace("<!-- {htmldoctree} -->", $htmldoctreeInfo, $html); // page title and description $title = isset($meta['title']) ? $meta['title'] : str_replace('-', ' ', ucfirst($itemId)); $description = isset($meta['description']) ? $meta['description'] : ''; $replacementStrings[2] = $title; $replacementStrings[3] = $description; // breadcrumbs $itemUrl = $baseUrl . $relativeUrl . '/' . $item; $itemBreadcrumbs = $breadcrumbs; $itemBreadcrumbs[] = '<span class="breadcrumb-node last">' . $title . '</span>'; $breadcrumb = implode(' <span class="breadcrumb-node separator"> ' . $breadcrumbSeparator . ' </span> ', $itemBreadcrumbs); $replacementStrings[1] = $breadcrumb; //$breadcrumb .= ' > ' . $title; //'<a href="' . $itemUrl . '" title="' . $title . '" >' . $title . '</a>'; $html = preg_replace($replacementPatterns, $replacementStrings, $template, 1); //$breadcrumbs = array(); fwrite($dest, $html); fclose($dest); } else { $info[] = "Copying file: <em>" . $srcPath . '</em>'; if (!copy($srcPath, $destPath)) { $error[] = "Copying file failed: <em>" . $srcPath . '</em>'; } } } } } else { $error[] = "Processing failed on directory: <em>" . $targetDir . '</em><br/>'; } } else { $error[] = "Processing failed on directory: <em>" . $sourceDir . '</em><br/>'; } return array('info' => $info, 'error' => $error); }
function importFiles(&$modx, &$results, $allowedfiles, $parent, $filepath, $files, $context = 'web') { if (!is_array($files)) { return; } if ($parent > 0) { if ($parentResource = $modx->getObject('modResource', $parent)) { $context = $parentResource->get('context_key'); $parentResource->set('isfolder', true); $parentResource->save(); } else { $results .= "Could not get parent ({$parent}) resource to set isfolder attribute after import."; return; } } foreach ($files as $id => $value) { if (is_array($value)) { /* create folder */ $resource = $modx->newObject('modDocument'); $resource->set('context_key', $context); $resource->set('content_type', 1); $resource->set('pagetitle', $id); $resource->set('parent', $parent); $resource->set('isfolder', true); $alias = getResourceAlias($modx, $resource, $results, $id, $parent, $context); $resource->set('alias', $alias); $resource->set('published', false); $resource->set('template', $modx->getOption('default_template')); $resource->set('menuindex', $modx->getCount('modResource', array('parent' => $parent))); $resource->set('searchable', $modx->getOption('search_default')); $resource->set('cacheable', $modx->getOption('cache_default')); $results .= sprintf($modx->lexicon('import_site_importing_document'), $alias); if (!$resource->save()) { $results .= "Could not import resource from {$filepath}/{$id}: <br />" . nl2br(print_r($modx->errorInfo(), true)); } else { $results .= $modx->lexicon('import_site_success') . "<br />"; importFiles($modx, $results, $allowedfiles, $resource->get('id'), $filepath . "/{$id}/", $value, $context); } } else { /* create resource */ $filename = $value; $fparts = explode(".", $value); $value = $fparts[0]; $ext = count($fparts) > 1 ? $fparts[count($fparts) - 1] : ""; $results .= sprintf($modx->lexicon('import_site_importing_document'), $filename); if (!in_array($ext, $allowedfiles)) { $results .= $modx->lexicon('import_site_skip') . "<br />"; } else { $file = getFileContent($modx, $results, "{$filepath}/{$filename}"); if (preg_match("/<title>(.*)<\\/title>/i", $file, $matches)) { $pagetitle = $matches[1]; } else { $pagetitle = $value; } if (!$pagetitle) { $pagetitle = $value; } if (preg_match("/<body[^>]*>(.*)[^<]+<\\/body>/is", $file, $matches)) { $content = $matches[1]; } else { $content = $file; } $resource = $modx->newObject('modDocument'); $resource->set('context_key', $context); $resource->set('content_type', 1); $resource->set('pagetitle', $pagetitle); $resource->set('parent', $parent); $resource->set('isfolder', false); $alias = getResourceAlias($modx, $resource, $results, $value, $parent, $context); $resource->set('alias', $alias); $resource->set('published', false); $resource->set('template', $modx->getOption('default_template')); $resource->set('menuindex', $modx->getCount('modResource', array('parent' => $parent))); $resource->set('searchable', $modx->getOption('search_default')); $resource->set('cacheable', $modx->getOption('cache_default')); $resource->set('content', $content); if (!$resource->save()) { $results .= $modx->lexicon('import_site_failed') . "Could not import resource from {$filepath}/{$filename}: <br />" . nl2br(print_r($modx->errorInfo(), true)); } else { $results .= $modx->lexicon('import_site_success') . "<br />"; } } } } }
function importFiles($parent, $filepath, $files) { global $modx; global $_lang, $allowedfiles; global $dbase, $table_prefix; global $default_template, $search_default, $cache_default, $publish_default; $createdon = time(); $createdby = $modx->getLoginUserID(); if (!is_array($files)) { return; } foreach ($files as $id => $value) { if (is_array($value)) { // create folder $alias = !isset($modx->documentListing[$id]) ? $id : $id . '-' . substr(uniqid(''), -3); $modx->documentListing[$alias] = true; printf("<p>" . $_lang['import_site_importing_document'] . "</p>", $id); $sql = "INSERT INTO {$dbase}.`" . $table_prefix . "site_content`\n (type, contentType, pagetitle, alias, published, parent, isfolder, content, template, menuindex, searchable, cacheable, createdby, createdon) VALUES\n ('document', 'text/html', '" . $modx->db->escape($id) . "', '" . $modx->stripAlias($alias) . "', " . $publish_default . ", '{$parent}', 1, '', '" . $default_template . "', 0, " . $search_default . ", " . $cache_default . ", {$createdby}, {$createdon});"; $rs = mysql_query($sql); if ($rs) { $new_parent = mysql_insert_id(); } else { echo "<p>" . $_lang["import_site_failed_db_error"] . mysql_error() . "</p>"; exit; } echo "<p class=\"success\">" . $_lang["import_site_success"] . "</p>"; importFiles($new_parent, $filepath . "/{$id}/", $value); } else { // create dcoument $filename = $value; $fparts = explode(".", $value); $value = $fparts[0]; $ext = count($fparts) > 1 ? $fparts[count($fparts) - 1] : ""; printf("<p>" . $_lang['import_site_importing_document'] . "</p>", $filename); $alias = !isset($modx->documentListing[$value]) ? $value : $value . '-' . substr(uniqid(''), -3); $modx->documentListing[$alias] = true; if (!in_array($ext, $allowedfiles)) { echo "<p class=\"success\">" . $_lang["import_site_skip"] . "</p>"; } else { $file = getFileContent("{$filepath}/{$filename}"); if (preg_match("/<title>(.*)<\\/title>/i", $file, $matches)) { $pagetitle = $matches[1]; } else { $pagetitle = $value; } if (!$pagetitle) { $pagetitle = $value; } if (preg_match("/<body[^>]*>(.*)[^<]+<\\/body>/is", $file, $matches)) { $content = $matches[1]; } else { $content = $file; } $sql = "INSERT INTO {$dbase}.`" . $table_prefix . "site_content`\n (type, contentType, pagetitle, alias, published, parent, isfolder, content, template, menuindex, searchable, cacheable, createdby, createdon) VALUES\n ('document', 'text/html', '" . $modx->db->escape($pagetitle) . "', '" . $modx->stripAlias($alias) . "', " . $publish_default . ", '{$parent}', 0, '" . $modx->db->escape($content) . "', '" . $default_template . "', 0, " . $search_default . ", " . $cache_default . ", {$createdby}, {$createdon});"; $rs = mysql_query($sql); if (!$rs) { echo "<p><span class=\"fail\">" . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . mysql_error() . "</p>"; exit; } echo "<p class=\"success\">" . $_lang["import_site_success"] . "</p>"; } } } }
public function getSeriesLinkByChar($url) { $contentUrl = getFileContent($url); $htmlAll = str_get_html($contentUrl); $ret = array(); $containerObj = $htmlAll->find('div#view-large', 0); if ($containerObj) { $seriesLinkObjs = $containerObj->find('div.thumbnail-body-item'); if ($seriesLinkObjs) { foreach ($seriesLinkObjs as $seriesLinkObj) { $link = $seriesLinkObj->find('a', 0)->href; $ret[] = $link; //echo "\n$link\n"; } } } return $ret; }
function enviarEmailSituacionAfiliatoria($msgError) { global $conn; $emailTo = $_SESSION["emailAvisoArt"]; $subject = "Empresa con situación afiliatoria complicada"; $body = getFileContent($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_cotizacion/plantillas/email_situacion_afiliatoria.html"); $params = array(":id" => $_SESSION["canal"]); $sql = "SELECT ca_codigo || ' - ' || ca_descripcion FROM aca_canal WHERE ca_id = :id"; $body = str_replace("@canal@", ValorSql($sql, "", $params, 0), $body); $params = array(":id" => $_SESSION["entidad"]); $sql = "SELECT en_codbanco || ' - ' || en_nombre FROM xen_entidad WHERE en_id = :id"; $body = str_replace("@entidad@", ValorSql($sql, "", $params, 0), $body); if ($_SESSION["sucursal"] != "") { $params = array(":id" => $_SESSION["sucursal"]); $sql = "SELECT su_codsucursal || ' - ' || su_descripcion FROM asu_sucursal WHERE su_id = :id"; $body = str_replace("@sucursal@", ValorSql($sql, "", $params, 0), $body); } else $body = str_replace("@sucursal@", "", $body); $params = array(":id" => $_POST["artTmp"]); $sql = "SELECT ar_nombre FROM aar_art WHERE ar_id = :id"; $body = str_replace("@artactual@", ValorSql($sql, "", $params, 0), $body); $vendedor = ""; if (isset($_POST["codigoVendedor"])) { $params = array(":vendedor" => IIF(($_POST["codigoVendedor"] == ""), "0", $_POST["codigoVendedor"])); $sql = "SELECT ve_vendedor || ' - ' || ve_nombre FROM xve_vendedor WHERE ve_vendedor = :vendedor"; $vendedor = ValorSql($sql, "", $params, 0); } elseif ($_SESSION["vendedor"] == "") { $params = array(":identidad" => $_SESSION["entidad"]); $sql = "SELECT ve_vendedor || ' - ' || ve_nombre FROM xev_entidadvendedor, xve_vendedor WHERE ve_id = ev_idvendedor AND ev_fechabaja IS NULL AND ve_fechabaja IS NULL AND ve_vendedor = '0' AND ev_identidad = :identidad"; $vendedor = ValorSql($sql, "", $params, 0); } $body = str_replace("@codigovendedor@", $vendedor, $body); $params = array(":codigo" => $_POST["statusBcra"]); $sql = "SELECT tb_descripcion FROM ctb_tablas WHERE tb_clave = 'STBCR' AND tb_codigo = :codigo"; $body = str_replace("@statusbcra@", ValorSql($sql, "", $params, 0), $body); $params = array(":codigo" => $_POST["statusSrtTmp"]); $sql = "SELECT tb_descripcion FROM ctb_tablas WHERE tb_clave = 'STSRT' AND tb_codigo = :codigo"; $body = str_replace("@statussrt@", ValorSql($sql, "", $params, 0), $body); $body = str_replace("@cantidadestablecimientos@", $_POST["cantidadEstablecimientos"], $body); $body = str_replace("@ciiu1@", $_POST["ciiu1"], $body); $body = str_replace("@contacto@", $_POST["contacto"], $body); $body = str_replace("@cuit@", $_POST["cuit"], $body); $body = str_replace("@edadpromedio@", $_POST["edadPromedio"], $body); $body = str_replace("@email@", $_POST["email"], $body); $body = str_replace("@emailComercializador@", $_SESSION["email"], $body); $body = str_replace("@error@", $msgError, $body); $body = str_replace("@masasalarial1@", $_POST["masaSalarial1"], $body); $body = str_replace("@periodo@", $_POST["periodo"], $body); $body = str_replace("@razonsocial@", $_POST["razonSocial"], $body); $body = str_replace("@resultadomensualtrabajador@", $_POST["resultadoMensualPorTrabajador"], $body); $body = str_replace("@sector@", $_POST["sector"], $body); $body = str_replace("@sumafija@", $_POST["calculoSumaFija"], $body); $body = str_replace("@telefono@", $_POST["telefono"], $body); $body = str_replace("@trabajadores1@", $_POST["totalTrabajadores1"], $body); $body = str_replace("@usuario@", $_SESSION["usuario"], $body); $body = str_replace("@variable@", $_POST["calculoVariable"], $body); // Agrego los datos del CIIU 2.. $str = ""; if ($_POST["ciiu2"] != "") { $str.= "Cod. CIIU (2): ".$_POST["ciiu2"]."<br />"; $str.= "Cant. Trabajadores (2): ".$_POST["totalTrabajadores2"]."<br />"; $str.= "Masa Salarial (2): ".$_POST["masaSalarial2"]."<br />"; } $body = str_replace("@ciiu2@", $str, $body); // Agrego los datos del CIIU 3.. $str = ""; if ($_POST["ciiu3"] != "") { $str.= "Cod. CIIU (3): ".$_POST["ciiu3"]."<br />"; $str.= "Cant. Trabajadores (3): ".$_POST["totalTrabajadores3"]."<br />"; $str.= "Masa Salarial (3): ".$_POST["masaSalarial3"]."<br />"; } $body = str_replace("@ciiu3@", $str, $body); // Agrego los datos de la competencia.. $str = ""; switch ($_POST["rDatosCompetencia"]) { case "": $str = "Sin Dato<br />"; break; case "A": $str = "Solo pago total mensual: ".$_POST["soloPagoTotalMensual"]."<br />"; break; case "N": $str = "Formulario 931 Costo Fijo: ".$_POST["alicuotaCompetenciaSumaFija"]."<br />"; $str.= "Formulario 931 Costo Variable: ".$_POST["alicuotaCompetenciaVariable"]."<br />"; break; case "S": $str = "Alícuota Competencia Costo Fijo: ".$_POST["formulario931CostoFijo"]."<br />"; $str.= "Alícuota Competencia Costo Variable: ".$_POST["formulario931CostoVariable"]."<br />"; break; } $body = str_replace("@datoscompetencia@", $str, $body); // Agrego los datos de los establecimientos.. $str = ""; $params = array(":usualta" => $_SESSION["usuario"]); $sql = "SELECT '= ' || zg_descripcion || ', ' || cp_localidadcap || ', ' || ta_detalle || ', ' || ac_codigo || ', ' || TO_CHAR(eu_trabajadores) establecimiento FROM afi.aeu_establecimientos, afi.azg_zonasgeograficas, art.ccp_codigopostal, afi.ata_tipoactividad, cac_actividad WHERE eu_idzonageografica = zg_id(+) AND eu_idlocalidad = cp_id(+) AND eu_idtipoactividad = ta_id(+) AND eu_idactividad = ac_id(+) AND eu_idsolicitud = -1 AND eu_usualta = :usualta AND eu_usuarioweb = 'T' AND eu_fechabaja IS NULL"; $stmt = DBExecSql($conn, $sql, $params, OCI_DEFAULT); $i = 1; while ($row = DBGetQuery($stmt)) { $str.= $i.$row["ESTABLECIMIENTO"]."<br />"; $i++; } $body = str_replace("@establecimientos@", $str, $body); SendEmail($body, "Web", $subject, array($emailTo), array(), array(), "H"); }
function importFiles($parent, $filedir, $files, $mode) { global $modx; global $_lang, $allowedfiles; global $search_default, $cache_default, $publish_default; $createdon = time(); $createdby = $modx->getLoginUserID(); if (!is_array($files)) { return; } if ($_POST['object'] == 'all') { $modx->config['default_template'] = '0'; $richtext = '0'; } else { $richtext = '1'; } foreach ($files as $id => $value) { if (is_array($value)) { // create folder $alias = $id; printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias); foreach (array('index.html', 'index.htm') as $filename) { $filepath = $filedir . $alias . '/' . $filename; if (file_exists($filepath)) { $file = getFileContent($filepath); list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); $date = filemtime($filepath); $field = array(); $field['type'] = 'document'; $field['contentType'] = 'text/html'; $field['pagetitle'] = $pagetitle; $field['longtitle'] = $pagetitle; $field['description'] = $description; $field['alias'] = $modx->stripAlias($alias); $field['published'] = $publish_default; $field['parent'] = $parent; $field['content'] = $modx->db->escape($content); $field['richtext'] = $richtext; $field['template'] = $modx->config['default_template']; $field['searchable'] = $search_default; $field['cacheable'] = $cache_default; $field['createdby'] = $createdby; $field['createdon'] = $date; $field['editedon'] = $date; $field['isfolder'] = 1; $field['menuindex'] = 1; $newid = $modx->db->insert($field, '[+prefix+]site_content'); if ($newid) { echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; importFiles($newid, $filedir . $alias . '/', $value, 'sub'); } else { echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); exit; } break; } } } else { // create document if ($mode == 'sub' && $value == 'index.html') { continue; } $filename = $value; $fparts = explode('.', $value); $alias = $fparts[0]; $ext = count($fparts) > 1 ? $fparts[count($fparts) - 1] : ""; printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename); if (!in_array($ext, $allowedfiles)) { echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n"; } else { $filepath = $filedir . $filename; $file = getFileContent($filepath); list($pagetitle, $content, $description) = treatContent($file, $filename, $alias); $date = filemtime($filepath); $field = array(); $field['type'] = 'document'; $field['contentType'] = 'text/html'; $field['pagetitle'] = $pagetitle; $field['longtitle'] = $pagetitle; $field['description'] = $description; $field['alias'] = $modx->stripAlias($alias); $field['published'] = $publish_default; $field['parent'] = $parent; $field['content'] = $modx->db->escape($content); $field['richtext'] = $richtext; $field['template'] = $modx->config['default_template']; $field['searchable'] = $search_default; $field['cacheable'] = $cache_default; $field['createdby'] = $createdby; $field['createdon'] = $date; $field['editedon'] = $date; $field['isfolder'] = 0; $field['menuindex'] = $alias == 'index' ? 0 : 2; $newid = $modx->db->insert($field, '[+prefix+]site_content'); if ($newid) { echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n"; } else { echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError(); exit; } $is_site_start = false; if ($filename == 'index.html') { $is_site_start = true; } if ($is_site_start == true && $_POST['reset'] == 'on') { $modx->db->update("setting_value={$newid}", '[+prefix+]system_settings', "setting_name='site_start'"); $modx->db->update('menuindex=0', '[+prefix+]site_content', "id='{$newid}'"); } } } } }
<?php if (!defined('srkVersion')) { exit(403); } if ($srkEnv->reqURLLength == 3) { require_once $srkEnv->appPath . '/modules/render.php'; if ($srkEnv->reqURL[2] == 'query') { require_once $srkEnv->appPath . '/modules/file.php'; $resId = $srkEnv->reqURL[3]; if (is_dir($srkEnv->resPath . '/' . $resId)) { $conf = json_decode(getFileContent($srkEnv->resPath . '/' . $resId . '/config.json')); $contentFileName = $srkEnv->resPath . '/' . $resId . '/content'; if ($conf !== -1 && is_file($contentFileName)) { if (isset($conf->contentType)) { header("Content-Type: " . $conf->contentType); } else { header("Content-Type: application/octet-stream"); } if ($conf->noOnline) { if ($conf->fileName) { header('Content-Disposition: attachment; filename=' . basename($conf->fileName)); } else { header('Content-Disposition: attachment; filename=unknownFileName'); } } srkStream($contentFileName); } else { srkRender('error', array('error' => array('status' => -2, 'stack' => 'Resource error'))); } } else {