コード例 #1
7
function ote_accent($str)
{
    $str = str_replace("'", " ", $str);
    $str = utf8_decode($str);
    $ch = strtr($str, '����������������������������������������������������', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
    return utf8_encode($ch);
}
コード例 #2
2
 public function url($reference)
 {
     $timestamp = gmdate('D, d M Y H:i:s T');
     $security = base64_encode(hash_hmac('sha256', utf8_encode("{$reference}\n{$timestamp}"), $this->client->api_secret, true));
     $data = array('key' => $this->client->api_key, 'timestamp' => $timestamp, 'reference' => $reference, 'security' => $security);
     return $this->client->api_endpoint . '/widget?' . http_build_query($data);
 }
コード例 #3
2
 /**
  * Do CURL request with authorization
  */
 private function do_request($resource, $method, $input)
 {
     $called_url = $this->base_url . "/" . $resource;
     $ch = curl_init($called_url);
     $c_date_time = date("r");
     $md5_content = "";
     if ($input != "") {
         $md5_content = md5($input);
     }
     $content_type = "application/json";
     $sign_string = $method . "\n" . $md5_content . "\n" . $content_type . "\n" . $c_date_time . "\n" . $called_url;
     $time_header = 'X-mailin-date:' . $c_date_time;
     $auth_header = 'Authorization:' . $this->access_key . ":" . base64_encode(hash_hmac('sha1', utf8_encode($sign_string), $this->secret_key));
     $content_header = "Content-Type:application/json";
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         // Windows only over-ride
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, array($time_header, $auth_header, $content_header));
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
     $data = curl_exec($ch);
     if (curl_errno($ch)) {
         echo 'Curl error: ' . curl_error($ch) . '\\n';
     }
     curl_close($ch);
     return json_decode($data, true);
 }
コード例 #4
1
ファイル: Csv.php プロジェクト: Bobarisoa/noucoz-release
 /**
  * Parse a csv file
  * 
  * @return array
  */
 public function parseCSV()
 {
     $finder = new Finder();
     $rows = array();
     $convert_utf8 = function ($s) {
         if (!mb_check_encoding($s, 'UTF-8')) {
             $s = utf8_encode($s);
         }
         return $s;
     };
     $finder->files()->in($this->path)->name($this->fileName);
     foreach ($finder as $file) {
         $csv = $file;
     }
     if (($handle = fopen($csv->getRealPath(), "r")) !== false) {
         $i = 0;
         while (($data = fgetcsv($handle, null, ";")) !== false) {
             $i++;
             if ($this->ignoreFirstLine && $i == 1) {
                 continue;
             }
             $rows[] = array_map($convert_utf8, $data);
         }
         fclose($handle);
     }
     return $rows;
 }
コード例 #5
1
ファイル: webservice_model.php プロジェクト: jhderojasUVa/ipa
	function consulta_google($idpiso) {
		// Devuelve la latitud y longuitud de un piso
		// Esto hay que innerjoinearlo
		$sql = "SELECT calle, numero, cp, idlocalizacion FROM pisos WHERE id_piso=".$idpiso;
		$resultado = $this -> db -> query($sql);
		foreach ($resultado -> result() as $row) {
			// Sacamos las cosas
			$direccion = utf8_encode($row -> calle)."+".utf8_encode($row -> numero).",".utf8_encode($row->cp);
			$sql2 = "SELECT localizacion FROM localizaciones WHERE idlocalizacion = ".$row ->idlocalizacion;
			$resultado_1 = $this -> db -> query($sql2);
			foreach ($resultado_1 -> result() as $row2) {
				$direccion = $direccion."+".utf8_encode($row2->localizacion);
			}
		}
		// Ahora le consultamos al google a ver
		$url = "http://maps.google.com/maps/geo?f=q&source=s_q&hl=es&geocode=&q=".urlencode($direccion)."&output=csv";
		$ch = curl_init($url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
		$raw = curl_exec($ch);
		curl_close($ch);
		$datos = explode(",", $raw);
		
		// Destrozamos los datos y lo insertamos en la BD
		if ($datos[0] == "200") {
			// No peto
			$latitud = $datos[2];
			$longitud = $datos[3];
			
			$sql = "UPDATE pisos SET lt='".$latitud."', ln='".$longitud."' WHERE id_piso=".$idpiso;
			$this -> db -> query($sql);
		} else {
			// Peto
			echo "ERROR para $id: $domicilio,$ciudad con datos $datos\n";
		}
	}
コード例 #6
0
 /**
  * send function sends the command to the oxD server.
  *
  * Args:
  * command (dict) - Dict representation of the JSON command string
  **/
 public function request()
 {
     $this->setParams();
     $jsondata = json_encode($this->getData(), JSON_UNESCAPED_SLASHES);
     $lenght = strlen($jsondata);
     if ($lenght <= 0) {
         return array('status' => false, 'message' => 'Sorry .Problem with oxd.');
     } else {
         $lenght = $lenght <= 999 ? "0" . $lenght : $lenght;
     }
     $this->response_json = $this->oxd_socket_request(utf8_encode($lenght . $jsondata));
     if ($this->response_json != 'Can not connect to oxd server') {
         $this->response_json = str_replace(substr($this->response_json, 0, 4), "", $this->response_json);
         if ($this->response_json) {
             $object = json_decode($this->response_json);
             if ($object->status == 'error') {
                 return array('status' => false, 'message' => $object->data->error . ' : ' . $object->data->error_description);
             } elseif ($object->status == 'ok') {
                 $this->response_object = json_decode($this->response_json);
                 return array('status' => true);
             }
         }
     } else {
         return array('status' => false, 'message' => 'Can not connect to oxd server. Please look file oxd-config.json  configuration in your oxd server.');
     }
 }
コード例 #7
0
ファイル: JsonUtil.php プロジェクト: joseilsonjunior/nutrif
 /**
  * Converter objetos em array.
  * 
  * @param type $var
  * @return type
  */
 public static function objectToArray($var)
 {
     $result = array();
     $references = array();
     // loop over elements/properties
     foreach ($var as $key => $value) {
         // recursively convert objects
         if (is_object($value) || is_array($value)) {
             // but prevent cycles
             if (!in_array($value, $references)) {
                 // Verificar se o valor é nulo. Não adiciona tuplas
                 // vazias ao json
                 if (!is_null($value) && !empty($value)) {
                     $result[$key] = JsonUtil::objectToArray($value);
                     $references[] = $value;
                 }
             }
         } else {
             // Verificar se o valor é nulo. Não adiciona tuplas
             // vazias ao json
             if (!is_null($value) && !empty($value)) {
                 // simple values are untouched
                 $result[$key] = utf8_encode($value);
             }
         }
     }
     return $result;
 }
コード例 #8
0
ファイル: Charts.php プロジェクト: honj51/taobaocrm
function save_xml_file($filename, $xml_file)
{
    global $app_strings;
    $handle = fopen($filename, 'w');
    //fwrite($handle,iconv("GBK","UTF-8",$xml_file));
    if (!$handle) {
        return;
    }
    // Write $somecontent to our opened file.)
    if ($app_strings['LBL_CHARSET'] == "GBK") {
        if (function_exists('iconv')) {
            $xml_file = iconv_ec("GB2312", "UTF-8", $xml_file);
        } else {
            $chs = new Chinese("GBK", "UTF8", trim($xml_file));
            $xml_file = $chs->ConvertIT();
        }
        if (fwrite($handle, $xml_file) === FALSE) {
            return false;
        }
    } else {
        if ($app_strings['LBL_CHARSET'] != "UTF-8") {
            //$xml_file = iconv("ISO-8859-1","UTF-8",$xml_file);
            if (fwrite($handle, utf8_encode($xml_file)) === FALSE) {
                return false;
            }
        } else {
            if (fwrite($handle, $xml_file) === FALSE) {
                return false;
            }
        }
    }
    fclose($handle);
    return true;
}
コード例 #9
0
ファイル: Properties.php プロジェクト: neruruguay/neru
function ListField($field)
{
    if ($field !== null && $field !== '' && $field !== 'undefined') {
        $fieldtrue = explode('|', $field);
        return utf8_encode($fieldtrue[1]);
    }
}
コード例 #10
0
 /**
  * Converts ISO-8859-1 strings to UTF-8 if necessary.
  *
  * @param string $string text which is to check
  * @return string with utf-8 encoding
  */
 public function isoConvert($string)
 {
     if (!preg_match('/\\S/u', $string)) {
         $string = utf8_encode($string);
     }
     return $string;
 }
コード例 #11
0
ファイル: microxml.php プロジェクト: philum/cms
function server()
{
    list($dr, $nod) = split_right('/', $_GET['table'], 1);
    $main = msql_read($dr, $nod, '');
    //p($main);
    if ($main) {
        $dscrp = flux_xml($main);
    }
    $host = $_SERVER['HTTP_HOST'];
    //$dscrp=str_replace('users/','http://'.$host.'/users/',$dscrp);
    //$dscrp=str_replace('img/','http://'.$host.'/img/',$dscrp);
    $xml = '<' . '?xml version="1.0" encoding="utf-8" ?' . '>' . "\n";
    //iso-8859-1//
    $xml .= '<rss version="2.0">' . "\n";
    $xml .= '<channel>' . "\n";
    $xml .= '<title>http://' . $host . '/msql/' . $_GET['table'] . '</title>' . "\n";
    $xml .= '<link>http://' . $host . '/</link>' . "\n";
    $xml .= '<description>' . count($main) . ' entries</description>' . "\n";
    $xml .= $dscrp;
    $xml .= '</channel>' . "\n";
    $xml .= '</rss>' . "\n";
    //$xml.='</xml>'."\n";
    if ($_GET['bz2']) {
        return bzcompress($xml);
    }
    if ($_GET["b64"]) {
        return base64_encode($xml);
    }
    return utf8_encode($xml);
}
コード例 #12
0
ファイル: TextType.php プロジェクト: improvein/MssqlBundle
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if ($value !== null) {
         $value = utf8_encode($value);
     }
     return parent::convertToPHPValue($value, $platform);
 }
コード例 #13
0
 public function set_user_config($username, $password, $fields)
 {
     $req = array();
     $req['auth']['rw'] = 1;
     // request read-write mode
     $req['user']['username'] = utf8_encode($username);
     $req['user']['password'] = utf8_encode($password);
     // modify values in place
     foreach ($fields as &$value) {
         $value = utf8_encode($value);
     }
     $req['mailbox']['update'][$username] = $fields;
     $arr = $this->get_url($this->build_url($req));
     $res = $this->decrypt($arr[0]);
     if (empty($res)) {
         return array(FALSE, 'Decode error');
     }
     if ($this->debug) {
         $debug_str = '';
         $debug_str .= print_r($req, TRUE);
         $debug_str .= print_r($arr, TRUE);
         $debug_str .= print_r($res, TRUE);
         write_log('vboxadm', $debug_str);
     }
     if ($res['action'] == 'ok') {
         return array(TRUE, $res['mailbox']['update'][$username]['msgs']);
     } else {
         return array(FALSE, $res['error']['str']);
     }
 }
コード例 #14
0
    public function mensagensRecebidas($destinatario)
    {
        $mensagemController = new MensagemController();
        $usuarioController = new UsuarioController();
        $mensagem = $mensagemController->listaRecebidos($destinatario);
        if (count($mensagem) > 0) {
            foreach ($mensagem as $value) {
                if ($value->getMsg_lida() === 'n') {
                    $naolida = 'msg_nao_lida';
                } else {
                    $naolida = '';
                }
                $usuario = $usuarioController->select($value->getMsg_remetente());
                echo '<div id="msg_valores_' . $value->getMsg_id() . '" class="recebido ' . $naolida . ' col1 row msg_valores_' . $value->getMsg_id() . '" style="cursor: pointer">
					  <p class="msg_check col-md-1"><span class="check-box" id="' . $value->getMsg_id() . '"></span></p>
					  <div  onclick="RecebidasDetalheFuncao(' . utf8_encode($value->getMsg_id()) . ')">
						<p class="msg_nome col-md-2">' . utf8_encode($usuario->getUsr_nome()) . '</p>
						<p class="msg_assunto col-md-7">' . utf8_encode($value->getMsg_assunto()) . '</p>
						<p class="msg_data col-md-2">' . date('d/m/Y', strtotime($value->getMsg_data())) . '</p>
					</div>
				</div>';
            }
        } else {
            echo '<div class="alert alert-warning" role="alert"><strong>Nenhuma mensagem em sua Caixa de Entrada.</strong></div>';
        }
    }
コード例 #15
0
 /**
  * Construct calendar response
  *
  * @param Calendar $calendar Calendar
  * @param int      $status   Response status
  * @param array    $headers  Response headers
  */
 public function __construct(Calendar $calendar, $status = 200, $headers = array())
 {
     $this->calendar = $calendar;
     $content = utf8_encode($calendar->createCalendar());
     $headers = array_merge($this->getDefaultHeaders(), $headers);
     parent::__construct($content, $status, $headers);
 }
コード例 #16
0
ファイル: rbt_helper.php プロジェクト: robotys/sacl
function encrypt($pure_string, $encryption_key)
{
    $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
    $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
    $encrypted_string = mcrypt_encrypt(MCRYPT_BLOWFISH, $encryption_key, utf8_encode($pure_string), MCRYPT_MODE_ECB, $iv);
    return base64_encode($encrypted_string);
}
コード例 #17
0
ファイル: ModuleProcessor.php プロジェクト: jbzdak/wikidot
 public function process($content)
 {
     if ($this->level == 0) {
         $this->_moduleChain = array();
     }
     $this->level++;
     // search content for some pattern and call the process...
     $d = utf8_encode("þ");
     $out = preg_replace_callback("/" . $d . "module \"([a-zA-Z0-9\\/_]+?)\"([^" . $d . "]+?)?" . $d . "/", array(&$this, 'renderModule1'), $content);
     // insert css files if necessary
     if ($this->cssInline && count($this->cssInclude) > 0) {
         $cstring = "";
         foreach ($this->cssInclude as $cssin) {
             $cstring .= "@import url({$cssin});\n";
         }
         // now find a place and insert $cstring!!!
         $regexp = "/(<style(?:.*?)id=\"internal-style\">)(.*?)(<\\/style>)/s";
         $replace = "\\1 \n {$cstring} \n \\2 \\3";
         $out = preg_replace($regexp, $replace, $out, 1);
     }
     // TODO: check if top-level?
     if ($this->modulesToProcessPage != null) {
         $runData = $this->runData;
         foreach ($this->modulesToProcessPage as $module) {
             $out = $module->processPage($out, $runData);
         }
     }
     return $out;
 }
コード例 #18
0
ファイル: StringUtil.php プロジェクト: samj1912/repo
 /**
  * This method tries its best to convert the input string to UTF-8.
  *
  * Currently only ISO-5991-1 input and UTF-8 input is supported, but this
  * may be expanded upon if we receive other examples.
  *
  * @param string $str
  * @return string
  */
 public static function convertToUTF8($str)
 {
     $encoding = mb_detect_encoding($str, array('UTF-8', 'ISO-8859-1', 'WINDOWS-1252'), true);
     switch ($encoding) {
         case 'ISO-8859-1':
             $newStr = utf8_encode($str);
             break;
             /* Unreachable code. Not sure yet how we can improve this
                 * situation.
                case 'WINDOWS-1252' :
                    $newStr = iconv('cp1252', 'UTF-8', $str);
                    break;
                 */
         /* Unreachable code. Not sure yet how we can improve this
             * situation.
            case 'WINDOWS-1252' :
                $newStr = iconv('cp1252', 'UTF-8', $str);
                break;
             */
         default:
             $newStr = $str;
     }
     // Removing any control characters
     return preg_replace('%(?:[\\x00-\\x08\\x0B-\\x0C\\x0E-\\x1F\\x7F])%', '', $newStr);
 }
コード例 #19
0
ファイル: I18nXml.php プロジェクト: suga/Megiddo
 public static function create($isoLang = 'pt_BR')
 {
     $xmlDoc = new DOMDocument('1.0', 'utf-8');
     $xmlDoc->formatOutput = true;
     $culture = $xmlDoc->createElement($isoLang);
     $culture = $xmlDoc->appendChild($culture);
     $criteria = new Criteria();
     $criteria->add(TagI18n::TABLE . '.' . TagI18n::ISOLANG, $isoLang);
     $objTagI18n = new TagI18nPeer();
     $arrayObjTagI18n = $objTagI18n->doSelect($criteria);
     if (!is_object($arrayObjTagI18n) && count($arrayObjTagI18n == 0)) {
         $log = new Log();
         $log->setLog(__FILE__, 'There are no tags with that language ' . $isoLang, true);
         throw new Exception('There are no tags with that language ' . $isoLang);
     }
     foreach ($arrayObjTagI18n as $objTagI18nPeer) {
         $item = $xmlDoc->createElement('item');
         $item->setAttribute('idTagI18n', $objTagI18nPeer->getIdTagI18n());
         $item = $culture->appendChild($item);
         $title = $xmlDoc->createElement('tag', utf8_encode($objTagI18nPeer->getTag()));
         $title = $item->appendChild($title);
         $link = $xmlDoc->createElement('i18n', utf8_encode($objTagI18nPeer->getTranslate()));
         $link = $item->appendChild($link);
     }
     //header("Content-type:application/xml; charset=utf-8");
     $file = PATH . PATH_I18N . $isoLang . '.xml';
     try {
         file_put_contents($file, $xmlDoc->saveXML());
     } catch (Exception $e) {
         $log = new Log();
         $log->setLog(__FILE__, 'Unable to write the XML file I18n ' . $e->getMessage(), true);
     }
     return true;
 }
コード例 #20
0
ファイル: fdp.php プロジェクト: bilel99/oge
 function _chargePays()
 {
     // On place le redirect sur la home
     $_SESSION['request_url'] = $this->url;
     // On masque les Head, header et footer originaux plus le debug
     $this->autoFireHeader = false;
     $this->autoFireHead = false;
     $this->autoFireFooter = false;
     $this->autoFireDebug = false;
     $this->autoFireView = false;
     // Chargement des datas
     $this->pays = $this->loadData('pays');
     // On purge les pays en cours
     $this->pays->purgePays();
     // Initialisation de la 1ère ligne du csv
     $row = 1;
     // Ouverture du fichier en lecture seule
     $fp = fopen($this->path . 'protected/pays.csv', 'r');
     $i = 1;
     // Traitement du csv
     while ($data = fgetcsv($fp, 1000, ";")) {
         // Enregistrement des donnees
         $this->pays->id_langue = trim(strtolower($data[2]));
         $this->pays->fr = trim(utf8_encode(ucfirst(strtolower($data[0]))));
         $this->pays->en = trim(utf8_encode(ucfirst(strtolower($data[1]))));
         $this->pays->zone = 0;
         $this->pays->create();
         // Affichage des messages
         echo $this->pays->id_langue . '&nbsp;|&nbsp;' . $this->pays->fr . '&nbsp;|&nbsp;' . $this->pays->en . '&nbsp;|&nbsp;' . $this->pays->zone . '<br />';
         $row++;
         $i++;
     }
 }
コード例 #21
0
ファイル: encoding.php プロジェクト: ForAEdesWeb/AEW4
 function change($data, $input, $output)
 {
     $input = strtoupper(trim($input));
     $output = strtoupper(trim($output));
     if ($input == $output) {
         return $data;
     }
     if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
         $data = str_replace(array('€', '„', '“'), array('EUR', '"', '"'), $data);
     }
     if (function_exists('iconv')) {
         set_error_handler('acymailing_error_handler_encoding');
         $encodedData = iconv($input, $output . "//IGNORE", $data);
         restore_error_handler();
         if (!empty($encodedData) && !acymailing_error_handler_encoding('result')) {
             return $encodedData;
         }
     }
     if (function_exists('mb_convert_encoding')) {
         return mb_convert_encoding($data, $output, $input);
     }
     if ($input == 'UTF-8' && $output == 'ISO-8859-1') {
         return utf8_decode($data);
     }
     if ($input == 'ISO-8859-1' && $output == 'UTF-8') {
         return utf8_encode($data);
     }
     return $data;
 }
コード例 #22
0
 public function getcomboAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $CalidadBO = new CalidadBO();
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLogin();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         //var_dump($json); exit;
         $texto_primer_elemento = $json['texto_primer_elemento'];
         $calidad_id = null;
         $opciones = $CalidadBO->getComboCalidad($calidad_id, $texto_primer_elemento);
         $response = new \stdClass();
         $response->opciones = $opciones;
         $response->respuesta_code = 'OK';
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
コード例 #23
0
ファイル: chat.php プロジェクト: enderochoa/tortuga
 function index()
 {
     $this->rapyd->load("phpfreechat");
     if (isset($this->session->userdata['logged_in']) and $this->session->userdata['logged_in']) {
         $this->session->set_userdata('last_activity', time());
         if ($this->datasis->essuper('usuario')) {
             $params["isadmin"] = true;
         }
         $params["nick"] = utf8_encode($this->session->userdata('usuario'));
         $params["language"] = "es_ES";
         $params["title"] = $this->datasis->traevalor("TITULO1");
         $params["serverid"] = md5('ProteoERP');
         // calculate a unique id for this chat
         $params["frozen_nick"] = false;
         $params["server_script_url"] = site_url('/chat');
         $params["data_public_url"] = site_url('phpfreechat/data/public');
         $params["quit_on_closedwindow"] = true;
         $params["display_pfc_logo"] = false;
         $chat = new phpfreechat($params);
         $data['head'] = $chat->printJavascript(true) . $chat->printStyle(true);
         $data['content'] = $chat->printChat(true);
         $data['title'] = " Prueba de chat ";
         $this->load->view('view_freechat', $data);
     } else {
         echo "window.close()";
     }
 }
コード例 #24
0
 public static function utf8($value)
 {
     if (is_string($value) && mb_detect_encoding($value, "UTF-8", TRUE) != "UTF-8") {
         return utf8_encode($value);
     }
     return $value;
 }
コード例 #25
0
function construir_array_de_inserts($adata = null, $tabla = null, $insert = "INSERT INTO ")
{
    if ($adata != null && $tabla != null) {
        $contar = 0;
        $datos_array = array();
        $data = "";
        foreach ($adata as $key => $value) {
            $c = count($value);
            $data .= "(";
            foreach ($value as $key_ => $value_) {
                $value_ = str_replace("'", '´', $value_);
                $value_ = trim($value_);
                $data .= "'" . utf8_encode($value_) . "',";
            }
            $data = trim($data, ",");
            $data = $data . "),";
            $contar++;
            if ($contar == 100) {
                $contar = 0;
                // $data=htmlspecialchars($data)      ;
                $datos_array[] = $data = rtrim($insert . $tabla . " VALUES " . $data, ",");
                $data = "";
            } else {
            }
        }
        //$data=htmlspecialchars($data)   ;
        $datos_array[] = $data = rtrim($insert . $tabla . " VALUES " . $data, ",");
        return $datos_array;
    } else {
        return false;
    }
}
コード例 #26
0
 function actualizarTabla($archivo_name, $marcado, $etiquetado, $usuario, $comentario)
 {
     mysql_query("SET NAMES 'utf8'");
     $archivo_name = utf8_encode(urldecode($archivo_name));
     if ($marcado && $etiquetado) {
         $data = array('archivo_name' => $archivo_name, 'ult_marc' => date("Y-m-d H:i"), 'ult_etiq' => date("Y-m-d H:i"), 'usuario_marc' => $usuario, 'usuario_etiq' => $usuario);
         $data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Etiquetado + Marcado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
     }
     if ($etiquetado && !$marcado) {
         $data = array('archivo_name' => $archivo_name, 'ult_etiq' => date("Y-m-d"), 'usuario_etiq' => $usuario);
         $data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Etiquetado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
     }
     if (!$etiquetado && $marcado) {
         $data = array('archivo_name' => $archivo_name, 'ult_marc' => date("Y-m-d"), 'usuario_marc' => $usuario);
         $data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Marcado", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
     }
     if (!$etiquetado && !$marcado) {
         $data = array('archivo_name' => $archivo_name);
         $data0 = array('nombre_archivo' => $archivo_name, 'accion' => "Lectura", 'fecha' => date("Y-m-d H:i"), 'usuario_bitacora' => $usuario, 'comentario' => $comentario);
     }
     $this->db->select('*')->from('tabla')->where('archivo_name', $archivo_name);
     $query = $this->db->get();
     if ($query->num_rows > 0) {
         //update
         $this->db->where('archivo_name', $archivo_name);
         $this->db->update('tabla', $data);
         $this->db->insert('bitacora', $data0);
     }
     //insert
     $this->db->insert('tabla', $data);
     $this->db->insert('bitacora', $data0);
     return TRUE;
 }
コード例 #27
0
 public function onPreInit($param)
 {
     parent::onPreInit($param);
     $docname = "tempXML";
     $ext = "xml";
     $header = "application/xml";
     $doc = new TXmlDocument('1.0', 'ISO-8859-1');
     $doc->TagName = 'menu';
     $doc->setAttribute('id', "0");
     $QVFile = new TXmlElement('item');
     $QVFile->setAttribute('id', "new_Element");
     $QVFile->setAttribute('img', "plus5.gif");
     $QVFile->setAttribute('text', "new element");
     $ActivityElements = ActivityTypeRecord::finder()->findAll();
     foreach ($ActivityElements as $Activitytype) {
         $ST = new TXmlElement('item');
         $ST->setAttribute('id', $Activitytype->idta_activity_type);
         $ST->setAttribute('img', 's' . $Activitytype->idta_activity_type . ".gif");
         $ST->setAttribute('text', utf8_encode($Activitytype->act_type_name));
         //hier muss die logik fuer die basiswerte aus den dimensionen hin...
         //hier hole ich mir die Dimensionsgruppen
         $QVFile->Elements[] = $ST;
     }
     $doc->Elements[] = $QVFile;
     //        $CMdelete=new TXmlElement('item');
     //        $CMdelete->setAttribute('id',"delete_Element");
     //        $CMdelete->setAttribute('img',"minus.gif");
     //        $CMdelete->setAttribute('text',"delete element");
     //
     //        $doc->Elements[]=$CMdelete;
     $this->getResponse()->appendHeader("Content-Type:" . $header);
     $this->getResponse()->appendHeader("Content-Disposition:inline;filename=" . $docName . '.' . $ext);
     $doc->saveToFile('php://output');
     exit;
 }
コード例 #28
0
ファイル: sms.php プロジェクト: THAYLLER/api_sms
 public function sms()
 {
     $funcionalidades = new funcionalidades();
     $conn = new conn();
     $conn->insert(array('dtCad' => $this->data, 'campanha' => utf8_encode($this->nome), 'palavra_chave' => $this->palavras_chaves, 'descricao' => $this->descricao, 'validadeIni' => $funcionalidades->ChecaVariavel($this->valiadeDe, "data"), 'validadeFim' => $funcionalidades->ChecaVariavel($this->validadeAte, "data"), 'patrocinador' => $this->patrocinador, 'qtdCupons' => $this->qtd, 'contato' => $this->contato, 'mensagem' => $funcionalidades->removeAcentos($this->msg), 'dt_limiteCupom' => $funcionalidades->ChecaVariavel($this->dt_limiteCupom, "data"), 'mensagem_encerrado' => $funcionalidades->removeAcentos($this->mensagem_encerrado), 'status' => 1), "", "campanha_sms");
     exit("<script>alert('Campanha cadastrada com sucesso!');document.location.href='painel-index.php';</script>");
 }
コード例 #29
-1
ファイル: AuthListener.php プロジェクト: caffeinated/github
 public function onBefore(BeforeEvent $event, $name)
 {
     if (is_null($this->method)) {
         return;
     }
     $request = $event->getRequest();
     switch ($this->method) {
         case Client::AUTH_HTTP_PASSWORD:
             $request->setHeader('Authorization', sprintf('Basic %s', base64_encode($this->tokenOrLogin . ':' . $this->password)));
             break;
         case Client::AUTH_HTTP_TOKEN:
             $request->setHeader('Authorization', sprintf('token %s', $this->tokenOrLogin));
             break;
         case Client::AUTH_URL_CLIENT_ID:
             $url = $request->getUrl();
             $parameters = ['client_id' => $this->tokenOrLogin, 'client_secret' => $this->password];
             $url .= false === strpos($url, '?') ? '?' : '&';
             $url .= utf8_encode(http_build_query($parameters, '', '&'));
             $request->setUrl($url);
             break;
         case Client::AUTH_URL_TOKEN:
             $url = $request->getUrl();
             $url .= false === strpos($url, '?') ? '?' : '&';
             $url .= utf8_encode(http_build_query(['access_token' => $this->tokenOrLogin], '', '&'));
             $request->getUrl($url);
             break;
         default:
             throw new RuntimeException(sprintf('%s is not yet implemented.', $this->method));
             break;
     }
 }
コード例 #30
-1
ファイル: SidebarController.php プロジェクト: AriiPortal/Arii
 public function todoAction()
 {
     $dhtmlx = $this->container->get('arii_core.dhtmlx');
     $data = $dhtmlx->Connector('data');
     $qry = 'SELECT so.MOD_TIME, so.SPOOLER_ID, so.JOB_CHAIN, so.ID, so.STATE, so.STATE_TEXT, so.TITLE, HOSTNAME, TCP_PORT
         from SCHEDULER_ORDERS so
         left join SCHEDULER_INSTANCES
         on SPOOLER_ID=scheduler
         where STATE_TEXT like "PROMPT: %"';
     $res = $data->sql->query($qry);
     $Todo = array();
     $nb = 0;
     while ($line = $data->sql->get_next($res)) {
         $New['type'] = 'prompt';
         $New['title'] = utf8_encode(substr($line['STATE_TEXT'], 8));
         $Msg = array();
         if ($line['TITLE'] != '') {
             array_push($Msg, $line['TITLE']);
         }
         array_push($Msg, '[' . $line['ID'] . ' -> ' . $line['JOB_CHAIN'] . '(' . $line['STATE'] . ')]');
         $New['message'] = implode('<br/>', $Msg);
         $Actions['Accept'] = 'javascript:PromptAccept("' . $line['HOSTNAME'] . '","' . $line['TCP_PORT'] . '","' . $line['ID'] . '","' . $line['JOB_CHAIN'] . '","' . $line['STATE'] . '" );';
         $Actions['Cancel'] = 'javascript:PromptCancel("' . $line['HOSTNAME'] . '","' . $line['TCP_PORT'] . '","' . $line['ID'] . '","' . $line['JOB_CHAIN'] . '","' . $line['STATE'] . '" );';
         $New['actions'] = $Actions;
         array_push($Todo, $New);
         $nb++;
     }
     if ($nb == 0) {
         return new Response('');
     }
     return $this->render('AriiJIDBundle:Sidebar:todo.html.twig', array('Todo' => $Todo));
 }