Exemplo n.º 1
0
 function generateOptions(&$xml)
 {
     $template = (string) $this->_xml;
     $cssfile = NextendFilesystem::translateToMediaPath(str_replace(DIRECTORY_SEPARATOR, '/', dirname($this->_form->_xmlfile)) . '/style.');
     $css = NextendCss::getInstance();
     if (NextendFilesystem::fileexists($cssfile . 'less')) {
         $css->enableLess();
         $cssfile .= 'less';
         $css->addCssFile(array($cssfile, $cssfile, array('id' => 'body')));
     } else {
         $cssfile .= 'css';
         $css->addCssFile($cssfile);
     }
     $prefix = NextendXmlGetAttribute($this->_xml, 'prefix');
     $this->_values = array();
     $html = '';
     foreach ($xml->option as $option) {
         $v = NextendXmlGetAttribute($option, 'value');
         $this->_values[] = $v;
         if ($v != -1) {
             $info = pathinfo($v);
             $class = $prefix . basename($v, '.' . $info['extension']);
             $html .= '
             <div class="nextend-radio-option nextend-imagelist-option' . $this->isSelected($v) . '">
                 ' . str_Replace('{image}', NextendUri::pathToUri($v), str_Replace('{class}', $class, $template)) . '
             </div>';
         } else {
             $html .= '<div class="nextend-radio-option' . $this->isSelected($v) . '">' . (string) $option . '</div>';
         }
     }
     return $html;
 }
Exemplo n.º 2
0
 /**
  * Parse the given file for apprentices and mentors.
  *
  * @param string $file Path to the File to parse.
  *
  * @return array
  */
 public function parse($file)
 {
     $return = array('mentors' => array(), 'apprentices' => array());
     $content = file_Get_contents($file);
     $content = str_Replace('<local-time', '<span tag="local-time"', $content);
     $content = str_Replace('</local-time', '</span', $content);
     $content = str_Replace('<time', '<span tag="time"', $content);
     $content = str_Replace('</time', '</span', $content);
     $this->dom = new \DomDocument('1.0', 'UTF-8');
     $this->dom->strictErrorChecking = false;
     libxml_use_internal_errors(true);
     $this->dom->loadHTML('<?xml encoding="UTF-8" ?>' . $content);
     libxml_use_internal_errors(false);
     $xpathMentors = new \DOMXPath($this->dom);
     $mentors = $xpathMentors->query('//a[@id="user-content-mentors-currently-accepting-an-apprentice"]/../following-sibling::ul[1]/li');
     foreach ($mentors as $mentor) {
         $user = $this->parseUser($mentor);
         if (!$user) {
             continue;
         }
         $user['type'] = 'mentor';
         $return['mentors'][] = $user;
     }
     $xpathApprentices = new \DOMXPath($this->dom);
     $apprentices = $xpathApprentices->query('//a[@id="user-content-apprentices-currently-accepting-mentors"]/../following-sibling::ul[1]/li');
     foreach ($apprentices as $apprentice) {
         $user = $this->parseUser($apprentice);
         if (!$user) {
             continue;
         }
         $user['type'] = 'apprentice';
         $return['apprentices'][] = $user;
     }
     return $return;
 }
Exemplo n.º 3
0
 function send_im($user, $recipient, $message, $opt, &$errors)
 {
     global $config, $lang_set;
     $sip_msg = "MESSAGE\n" . addslashes($recipient) . "\n" . ".\n" . "From: " . $user->get_uri() . "\n" . "To: <" . addslashes($recipient) . ">\n" . "p-version: " . $config->psignature . "\n" . "Contact: <" . $config->web_contact . ">\n" . "Content-Type: text/plain; charset=" . $lang_set['charset'] . "\n.\n" . str_Replace("\n.\n", "\n. \n", $message) . "\n.\n\n";
     if ($config->use_rpc) {
         if (!$this->connect_to_xml_rpc(null, $errors)) {
             return false;
         }
         $params = array(new XML_RPC_Value($sip_msg, 'string'));
         $msg = new XML_RPC_Message('t_uac_dlg', $params);
         $res = $this->rpc->send($msg);
         if ($this->rpc_is_error($res)) {
             log_errors($res, $errors);
             return false;
         }
     } else {
         /* construct FIFO command */
         $fifo_cmd = ":t_uac_dlg:" . $config->reply_fifo_filename . "\n" . $sip_msg;
         if (false === write2fifo($fifo_cmd, $errors, $status)) {
             return false;
         }
         /* we accept any status code beginning with 2 as ok */
         if (substr($status, 0, 1) != "2") {
             $errors[] = $status;
             return false;
         }
     }
     return true;
 }
Exemplo n.º 4
0
 public function beforeSave($event, $entity, $options)
 {
     if ($entity->get('Archive')['tmp_name'] != '') {
         switch ($entity->get('Archive')['type']) {
             case "application/x-rar":
                 break;
             case "application/zip":
             case "application/octet-stream":
             case "application/x-zip-compressed":
             case "application/x-zip":
                 $zip = new \ZipArchive();
                 $zip->open($entity->get('Archive')['tmp_name']);
                 for ($i = 0; $i < $zip->numFiles; $i++) {
                     $filepath = pathinfo($zip->getNameIndex($i));
                     if ($filepath['basename'] == $entity->get('dmname')) {
                         $fd = fopen(WWW_ROOT . 'tmp/mods/' . $zip->getNameIndex($i), 'r');
                         if ($fd) {
                             rewind($fd);
                             while (($line = fgets($fd)) !== false) {
                                 if (strpos($line, '#disableoldnations') !== false) {
                                     $entity->set('disableoldnations', 1);
                                 }
                                 $arr = explode(' ', $line);
                                 switch ($arr[0]) {
                                     case '--':
                                         break;
                                     case '#version':
                                         $entity->set('version', trim(substr($line, strlen('#version '))));
                                         break;
                                     case '#description':
                                         $entity->set('description', trim(str_replace('"', '', substr($line, strlen('#description ')))));
                                         break;
                                     case '#modname':
                                         $entity->set('name', trim(str_replace('"', '', substr($line, strlen('#modname ')))));
                                         break;
                                     case '#icon':
                                         $entity->set('icon', trim(str_Replace('"', '', substr($line, strlen('#icon ')))));
                                         break;
                                 }
                             }
                             fclose($fd);
                         }
                         $zip->close();
                         return true;
                     }
                 }
                 break;
         }
         return true;
     }
 }
Exemplo n.º 5
0
function epl_load_core_templates($template)
{
    global $epl_settings;
    $template_path = epl_get_content_path();
    if (isset($epl_settings['epl_feeling_lucky']) && $epl_settings['epl_feeling_lucky'] == 'on') {
        return $template;
    }
    $post_tpl = '';
    if (is_epl_post_single()) {
        $common_tpl = apply_filters('epl_common_single_template', 'single-listing.php');
        $post_tpl = 'single-' . str_Replace('_', '-', get_post_type()) . '.php';
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $post_tpl;
        $find[] = $common_tpl;
        $find[] = epl_template_path() . $common_tpl;
    } elseif (is_epl_post_archive()) {
        $common_tpl = apply_filters('epl_common_archive_template', 'archive-listing.php');
        $post_tpl = 'archive-' . str_Replace('_', '-', get_post_type()) . '.php';
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $post_tpl;
        $find[] = $common_tpl;
        $find[] = epl_template_path() . $common_tpl;
    } elseif (is_tax('location') || is_tax('tax_feature')) {
        $term = get_queried_object();
        $common_tpl = apply_filters('epl_common_taxonomy_template', 'archive-listing.php');
        $post_tpl = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '-' . $term->slug . '.php';
        $find[] = 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = epl_template_path() . 'taxonomy-' . $term->taxonomy . '.php';
        $find[] = $common_tpl;
        $find[] = $post_tpl;
        $find[] = epl_template_path() . $common_tpl;
    }
    if ($post_tpl) {
        $template = locate_template(array_unique($find));
        if (!$template) {
            $template = $template_path . $common_tpl;
        }
    }
    return $template;
}
function addFile($name, $force = false, $handleRequire = false, $patches = array())
{
    global $buffer, $filesDone;
    $unixname = str_replace(DS, '/', $name);
    //already done/skip?
    if (in_array($unixname, $filesDone) && $force == false) {
        return;
    }
    if ('vendors/' != substr($name, 0, 8)) {
        //malformed filename?
        if (basename($name) != strtolower(basename($name))) {
            die("uppercase filename violation: '{$name}'\n");
        }
    }
    $txt = trim(file_get_contents($name));
    if ($txt === false) {
        die("cannot open '{$name}'\n");
    }
    echo "** {$name}\n";
    // remove preamble / closing tag
    if (substr($txt, 0, 5) == '<?php') {
        $txt = substr($txt, 5);
    }
    if (substr($txt, 0, 2) == '<?') {
        $txt = substr($txt, 2);
    }
    if (substr($txt, -2, 2) == '?>') {
        $txt = substr($txt, 0, strlen($txt) - 2);
    }
    if ($handleRequire) {
        $txt = str_Replace("require", "//require", $txt);
    }
    foreach ($patches as $s => $d) {
        $txt = str_replace($s, $d, $txt);
    }
    $buffer .= "\n\n//============ {$name} =======================================================\n\n{$txt}\n\n";
    $filesDone[] = $name;
}
 /**
  * parse a dictionary-file to create an ini-file from it.
  *
  * @param string $locale Parse the file for the given locale
  *
  * @throws \Org\Heigl\Hyphenator\Exception\PathNotFoundException
  * @return string
  */
 public static function parseFile($locale)
 {
     $path = self::$_fileLocation . DIRECTORY_SEPARATOR;
     $file = $path . 'hyph_' . $locale . '.dic';
     if (!file_Exists($file)) {
         throw new \Org\Heigl\Hyphenator\Exception\PathNotFoundException('The given Path does not exist');
     }
     $items = file($file);
     $source = trim($items[0]);
     if (0 === strpos($source, 'ISO8859')) {
         $source = str_Replace('ISO8859', 'ISO-8859', $source);
     }
     unset($items[0]);
     $fh = fopen($path . $locale . '.ini', 'w+');
     foreach ($items as $item) {
         // Remove comment-lines starting with '#' or '%'.
         if (in_array(mb_substr($item, 0, 1), array('#', '%'))) {
             continue;
         }
         // Ignore empty lines.
         if ('' == trim($item)) {
             continue;
         }
         // Remove all Upper-case items as they are OOo-specific
         if ($item === mb_strtoupper($item)) {
             continue;
         }
         // Ignore lines containing an '=' sign as these are specific
         // instructions for non-standard-hyphenations. These will be
         // implemented later.
         if (false !== mb_strpos($item, '=')) {
             continue;
         }
         $item = mb_convert_Encoding($item, 'UTF-8', $source);
         $result = Pattern::factory($item);
         $string = '@:' . $result->getText() . ' = "' . $result->getPattern() . '"' . "\n";
         fwrite($fh, $string);
     }
     fclose($fh);
     return $path . $locale . '.ini';
 }
Exemplo n.º 8
0
function write_channel_config($table, $webdbs)
{
    global $db, $pre;
    if (is_array($webdbs)) {
        foreach ($webdbs as $key => $value) {
            if (is_array($value)) {
                $webdbs[$key] = $value = implode(",", $value);
            }
            $SQL2 .= "'{$key}',";
            $SQL .= "('{$key}', '{$value}', ''),";
        }
        $SQL = $SQL . ";";
        $SQL = str_Replace("'),;", "')", $SQL);
        $db->query(" DELETE FROM {$table} WHERE c_key IN ({$SQL2}'') ");
        $db->query(" INSERT INTO `{$table}` VALUES  {$SQL} ");
    }
}
Exemplo n.º 9
0
        $show = "暂无...";
    }
    //真静态
    if ($webdb[NewsMakeHtml] == 1 || $gethtmlurl) {
        $show = make_html($show, $pagetype = 'N');
    } elseif ($webdb[NewsMakeHtml] == 2) {
        $show = fake_html($show);
    }
    if ($webdb[RewriteUrl] == 1) {
        //全站伪静态
        rewrite_url($show);
    }
    $show = "<ul>{$show}</ul>";
    $show = str_Replace("'", '"', $show);
    $show = str_Replace("\r", '', $show);
    $show = str_Replace("\n", '', $show);
    $show = "document.write('{$show}');";
    echo $show;
} else {
    die("document.write('指定的类型不存在');");
}
function get_fid($fid)
{
    global $db, $pre;
    $fid = intval($fid);
    $F[] = " fid={$fid} ";
    $query = $db->query("SELECT fid FROM {$pre}spsort WHERE fup='{$fid}'");
    while ($rs = $db->fetch_array($query)) {
        $F[] = " fid={$rs['fid']} ";
    }
    return $F;
Exemplo n.º 10
0
    $module_id .= " </select>";
    require dirname(__FILE__) . "/" . "head.php";
    require dirname(__FILE__) . "/" . "template/fu_sort/menu.htm";
    require dirname(__FILE__) . "/" . "template/fu_sort/batch_edit.htm";
    require dirname(__FILE__) . "/" . "foot.php";
} elseif ($action == 'batch_edit' && $Apower[fu_sort_power]) {
    if (!$ifchang && !$db_index_showtitle && !$db_sonTitleRow && !$db_sonTitleLeng && !$db_cachetime) {
        showmsg("请选择要修改哪个属性");
    }
    $postdb[allowpost] = @implode(",", $postdb[allowpost]);
    $postdb[allowviewtitle] = @implode(",", $postdb[allowviewtitle]);
    $postdb[allowviewcontent] = @implode(",", $postdb[allowviewcontent]);
    $postdb[allowdownload] = @implode(",", $postdb[allowdownload]);
    $postdb[template] = @serialize($postdb[tpl]);
    /*缺少对版主有效用户名的检测*/
    $postdb[admin] = str_Replace(",", ",", $postdb[admin]);
    foreach ($fiddb as $fid => $name) {
        unset($SQL);
        $postdb[fid] = $fid;
        //检查父栏目是否有问题
        $ifchang[fup] && check_fup("{$pre}fu_sort", $postdb[fid], $postdb[fup]);
        $ifchang[fup] && ($rs_fid = $db->get_one("SELECT * FROM {$pre}fu_sort WHERE fid='{$postdb['fid']}'"));
        if ($ifchang[fup] && $rs_fid[fup] != $postdb[fup]) {
            $rs_fup = $db->get_one("SELECT class FROM {$pre}fu_sort WHERE fup='{$postdb['fup']}' ");
            $newclass = $rs_fup['class'] + 1;
            $db->query("UPDATE {$pre}fu_sort SET sons=sons+1 WHERE fup='{$postdb['fup']}' ");
            $db->query("UPDATE {$pre}fu_sort SET sons=sons-1 WHERE fup='{$rs_fid['fup']}' ");
            $SQL = ",class={$newclass}";
        }
        if ($ifchang[admin] && $postdb[admin]) {
            $detail = explode(",", $postdb[admin]);
Exemplo n.º 11
0
 function getApplicantData($stattype = "applicants", $distinguishNordic = TRUE, $distinguishBaltic = TRUE, $countPolandAsBaltic = FALSE)
 {
     $applicant = array();
     // ------------------------
     // Read CSV file to array $this->applicantDataSource[line]
     // ------------------------
     if (!$this->setApplicantDataSource()) {
         return array();
     }
     //TODO: nicer error handling
     // ------------------------
     // Convert raw data to array
     //   $applicant[][lastname,firstname,citizenship,residentship,ms,phd,
     //                 cit_continent,res_continent,ms_continent,phd_continent,
     //                 nordic,baltic,campaign_id]
     // ------------------------
     $idx = 0;
     foreach ($this->applicantDataSource as $line) {
         if (preg_match("/^.*--- (.*)/", trim($line), $res)) {
             $idx++;
         } elseif (!isset($GLOBALS["beenthere"]) || !$GLOBALS["beenthere"] || isset($GLOBALS["reset"]) || isset($GLOBALS["eventindex"][$idx])) {
             $arr = preg_split("/\\s?,\\s?/", str_Replace("??", "", $line));
             if (count($arr) > 1) {
                 $applicant[] = array("lastname" => mb_convert_case($arr[4], MB_CASE_TITLE, "UTF-8"), "firstname" => mb_convert_case($arr[5], MB_CASE_TITLE, "UTF-8"), "cit" => $arr[0], "res" => $arr[1], "ms" => $arr[2], "phd" => $arr[3], "cit_continent" => functions::fromCountryCodeTo("continentcode", $arr[0], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "res_continent" => functions::fromCountryCodeTo("continentcode", $arr[1], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "ms_continent" => functions::fromCountryCodeTo("continentcode", $arr[2], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "phd_continent" => functions::fromCountryCodeTo("continentcode", $arr[3], $distinguishNordic, $distinguishBaltic, $countPolandAsBaltic), "nordic" => functions::isInRegion("nordic", array($arr[0], $arr[1], $arr[2], $arr[3]), $countPolandAsBaltic), "baltic" => functions::isInRegion("baltic", array($arr[0], $arr[1], $arr[2], $arr[3]), $countPolandAsBaltic), "id" => $idx, "timestamp" => 0, "timestamp" => 0);
             }
         }
     }
     return $applicant;
 }
Exemplo n.º 12
0
function pri(&$x)
{
    $x = print_r($x, 1);
    $x = Preg_replace(array("~Array\n[ ]{2,}\\(\n[ ]{2,}~", "~Array\n\\(~", "~    \\[~"), array("A:\n  ", '', '['), $x);
    #return $x;
    $x = str_ireplace(array(' =&gt;', ' =>'), ':', $x);
    $x = trim($x, ")\n");
    return htmlentities(trim(str_Replace(array(" => Array\n        (", "        )\n\n", "        "), array(">", "", '  '), $x), ' )'));
    #
}
Exemplo n.º 13
0
     $domain = trim($_POST['new_subdomain']);
     $domain = str_Replace("https://", "", $domain);
     $domain = str_Replace("http://", "", $domain);
     $domain = substr($domain, strpos($domain, '.') + 1);
     $pattern = "/(.*?)\\." . $domain . "/";
     $core_config['script']['multiple_webspace_pattern'] = $pattern;
     writeToConfig('$core_config[\'script\'][\'multiple_webspace_pattern\']', $pattern);
     writeToConfig('$core_config[\'script\'][\'single_webspace\']', '');
     $core_domain = $domain;
     $core_domain = $http . "://" . $core_domain;
     writeToConfig('$core_config[\'script\'][\'core_domain\']', $core_domain);
     writeToConfig('$core_config[\'registration\'][\'allow_registration\']', 1);
 } else {
     $_POST['new_domain'] = trim($_POST['new_domain']);
     $_POST['new_domain'] = str_Replace("https://", "", $_POST['new_domain']);
     $_POST['new_domain'] = str_Replace("http://", "", $_POST['new_domain']);
     writeToConfig('$core_config[\'script\'][\'multiple_webspace_pattern\']', '');
     writeToConfig('$core_config[\'script\'][\'single_webspace\']', $openid_name);
     $core_domain = $http . "://" . $_POST['new_domain'];
     $core_config['script']['core_domain'] = $core_domain;
     writeToConfig('$core_config[\'script\'][\'core_domain\']', $core_domain);
     writeToConfig('$core_config[\'registration\'][\'allow_registration\']', 0);
 }
 // create database --------------
 $core_config['db']['host'] = $_POST['database_host'];
 $core_config['db']['user'] = $_POST['database_user'];
 $core_config['db']['pass'] = $_POST['database_password'];
 $core_config['db']['db'] = $_POST['database_db'];
 $connection = @mysql_connect($core_config['db']['host'], $core_config['db']['user'], $core_config['db']['pass']);
 if (!is_resource($connection)) {
     $GLOBALS['script_error_log'][] = _("The database connection could not be created. Please check your database settings.");
Exemplo n.º 14
0
function chrToHTML($Str)
{
    $Str = str_Replace(CHR(10), "<br />", $Str);
    $Str = str_Replace(CHR(32), " ", $Str);
    $Str = str_Replace(CHR(9), " ", $Str);
    $Str = str_Replace(CHR(34), "&quot;", $Str);
    $Str = str_Replace(CHR(39), "&#39;", $Str);
    $Str = str_Replace(CHR(13), "", $Str);
    $Str = str_Replace(CHR(10) & CHR(10), "<p>", $Str);
    return $Str;
}
Exemplo n.º 15
0
function FilterHtml($str)
{
    $str = str_Replace("'", "&acute;", $str);
    //'Str = Replace(Str,",","&#44")
    return $str;
}
Exemplo n.º 16
0
function uploadFile($dir, $file, $ext = "", $resize = false, $force = false, $fileName = "", $createDir = true, $action = '', $toLower = true, $createThumb = false)
{
    $extValid = true;
    $error = false;
    $errorLine = '';
    $thumbName = '';
    $thumbDir = '';
    //die('aaa'.$force);
    //die($file['name']);
    //if(!is_dir($dir) && !$force) {die('aaa');}
    //print_r($file);
    //die();
    //echo '[dir: '. $dir .']';
    if (!is_dir($dir)) {
        if ($createDir) {
            mkdir($dir);
        } else {
            $error = true;
            $errorLine = 'Diretorio nao encontrado!';
        }
    } else {
        if ($file['name'] == '' && !$force) {
            return array(true, '');
        }
    }
    /*if(!is_dir($dir) && $createDir) {
    			mkdir($dir);
    		} else if(!is_dir($dir) && !$createDir){
    			$error = true;
    			$errorLine = 'Diretorio nao encontrado!';
    		}*/
    /*print_r($file);
    		$is_uploaded = is_uploaded_file($file['tmp_name']);
    		$success = move_uploaded_file($file['tmp_name'], $dir);
    		
    		echo $is_uploaded;
    		
    		if($success) {
    			return 'upload';
    		} else {
    			return 'bosta';
    		}*/
    //if($file['size'] <= 5000000) {
    if ($toLower) {
        $file_explode = explode(".", $file['name']);
        $file_explode_end = end($file_explode);
        /*
        echo '<br><br>+++|';
        print_r($file_explode);
        echo '|+++';
        
        echo '<br><br>+++|';
        print_r($file_explode_end);
        echo '|+++';
        */
        $fileExt = strtolower($file_explode_end);
        // echo '<br><br>+++|';
        // print_r($fileExt);
        // echo '|+++';
    } else {
        $fileExt = end(explode(".", $file['name']));
    }
    if ($ext) {
        $extValid = in_array($fileExt, $ext);
    }
    /*
    		  echo '<br><br>+++|';
    print_r($ext);
    echo '|+++';
    die();
    */
    if ($file['name'] && $extValid) {
        $fileTemp = $file['tmp_name'];
        //echo $fileTemp .'|||';
        if ($fileName) {
            $filename = $fileName;
        } else {
            if ($toLower) {
                $filename = strtolower($file['name']);
            } else {
                $filename = $file['name'];
            }
        }
        if (file_exists($dir . $filename)) {
            //echo 'AQUIiiii';
            $fileNameExt = explode('.', $filename);
            $fileExtension = end(explode('.', $filename));
            $newFileName = '';
            for ($x = 0; $x < count($fileNameExt) - 1; $x++) {
                $newFileName .= $fileNameExt[$x] . '.';
            }
            $newFileName = subStr($newFileName, 0, -1);
            $filename = $newFileName . '_' . date('dmyHis') . '.' . $fileExtension;
        }
        $filename = str_Replace(' ', '_', $filename);
        //echo $fileTemp;
        if (!is_uploaded_file($fileTemp)) {
            $error = true;
            $errorLine .= "001 Erro ao efetuar upload do arquivo: " . $file["name"] . "\n";
        } else {
            if (!move_uploaded_file($fileTemp, $dir . $filename)) {
                $error = false;
                $errorLine .= "002 Erro ao efetuar upload do arquivo: {$file[name]}";
            } else {
                if ($createThumb) {
                    $thumbDir = $dir . 'thumbs/';
                    $thumbName = 'th_' . $filename;
                    if (!is_dir($thumbDir)) {
                        mkdir($thumbDir);
                    }
                    if (!copy($dir . $filename, $thumbDir . $thumbName)) {
                        $error = false;
                        $errorLine .= "003 Erro ao criar Thumb: {$filename}";
                    } else {
                        //print_r($createThumb);
                        //resizeImage($thumbDir, $thumbName, $createThumb['width'], $createThumb['height'], true);
                        resizeImage($thumbDir, $thumbName, $createThumb[0], $createThumb[1], true);
                    }
                }
            }
        }
    } else {
        if ($force) {
            $error = true;
            $errorLine = "Arquivo para upload nao identificado.";
        }
    }
    //} else {
    //   $error = false;
    //   $errorLine = "Arquivo excede o tamanho máximo de 10MB";
    //}
    if ($ext && !$extValid && $file['name'] != '') {
        $errorLine = 'Extensao de arquivo nao permitida.';
    }
    if ($errorLine) {
        $return = array(false, $errorLine);
    } else {
        $return = array(true, $dir . $filename, $thumbDir . $thumbName);
    }
    //print_r($filename);
    //echo '____]';
    //echo 'error: '. $error;
    //echo '<br>resize: '. $resize;
    if (!$error && isset($resize)) {
        //echo '<br>VEIO AQUI';
        //print_r($resize);
        //$resizeImage = resizeImage($dir, $filename, $resize['w'], $resize['h'], $resize['force']);
        $resizeImage = resizeImage($dir, $filename, $resize[0], $resize[1], false);
        if ($resizeImage != 1) {
            echo $resizeImage;
        }
    }
    return $return;
}
Exemplo n.º 17
0
<?php

$cookieDomain = str_Replace('www.', '', $_SERVER['SERVER_NAME']);
ini_set("session.cookie_domain", $cookieDomain);
if (defined('ZF2')) {
    if (isset($loader)) {
        $loader->add('Zend', ZF2);
        $loader->add('COM', LIB);
    } else {
        include ZF2 . '/Zend/Loader/AutoloaderFactory.php';
        Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array('COM' => LIB . '/COM', 'Pingpp' => LIB . '/COM/Service/pingpp-php/lib'))));
    }
}
if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
    throw new RuntimeException('Unable to load ZF2');
}
Exemplo n.º 18
0
     $weather->set_icao($icao);
     if (!$weather->get_metar()) {
         continue;
     }
     //there is no avaiable metar data
     $text = new $text_type($weather);
     $message = $text->print_pretty();
     //delete html tags from phpweather otuput
     $message = ereg_Replace("<[^>]*>", "", $message);
     //replace special chars in phpweather otuput
     $message = str_Replace("&nbsp;", " ", $message);
     $message = str_Replace("&deg;", "°", $message);
     $send_na = false;
     //successfully get data for user, not to need send n/a message
     /* construct FIFO command */
     $fifo_cmd = ":t_uac_from:" . $config->reply_fifo_filename . "\n" . "MESSAGE\n" . $config->metar_from_sip_uri . "\n" . "sip:" . $row->username . "@" . $config->default_domain . "\n" . "p-version: " . $config->psignature . "\n" . "Contact: " . $config->web_contact . "\n" . "Content-Type: text/plain; charset=UTF-8\n\n" . str_Replace("\n.\n", "\n. \n", $message) . "\n.\n\n";
     write2fifo($fifo_cmd, $errors, $status);
     if ($errors) {
         foreach ($errors as $err) {
             echo $err . "\n";
         }
         unset($errors);
         continue;
     }
     /* we accept any status code beginning with 2 as ok */
     if (substr($status, 0, 1) != "2") {
         echo $status . "\n";
         continue;
     }
 }
 if ($send_na) {
Exemplo n.º 19
0
 function SortSon($table = '', $fid = '0', $showsons = 1)
 {
     global $db;
     $query = $db->query("select fid,name,sons,class from {$table} where fup='{$fid}' order by list");
     while (@extract($db->fetch_array($query))) {
         $topico = $this->BlankIcon($class);
         $name = str_Replace('"', "", $name);
         //$show.="{$topico}<a href='javascript:guide_link($fid);'>$name</a><br>";
         $show .= "{$topico}<a href='list.php?fid={$fid}'>{$name}</a><br>";
         if ($showsons) {
             $show .= $this->SortSon($table, $fid, $showsons);
         }
     }
     return $show;
 }
Exemplo n.º 20
0
 static function parseBBCode($text, $parsing = true, $emoticons = true)
 {
     $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);
     $text = " " . $text;
     if (!(strpos($text, "[") && strpos($text, "]"))) {
         // Remove padding, return.
         $text = substr($text, 1);
         return $text;
     }
     $matches = array();
     //	PARSING ALL
     if ($parsing) {
         $randomSuffix = rand();
         $matches = array("#\\[class=(.*?)\\](.*?)\\[/class\\]#si" => "<span class=\"\$1\">\$2</span>", "#\\[b\\](.*?)\\[/b\\]#si" => "<b>\$1</b>", "#\\[u\\](.*?)\\[/u\\]#si" => "<u>\$1</u>", "#\\[i\\](.*?)\\[/i\\]#si" => "<i>\$1</i>", "#\\[strike\\](.*?)\\[/strike\\]#si" => "<span class=\"lineThrough\">\$1</span>", "#\\[list\\](.*?)\\[/list\\]#si" => "<ul>\$1</ul>", "#\\[list=(.*?)\\](.*?)\\[/list\\]#si" => "<ul class=\"\$1\">\$2</ul>", "#\\[\\*\\]#si" => "<li>", "#\\[hr\\]#si" => "<hr>", "#\\[bgcolor=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/bgcolor\\]#si" => "<font style=\"background-color:\$1\">\$2</font>", "#\\[t_left\\](.*?)\\[/t_left\\]#si" => "<div align=\"left\">\$1</div>", "#\\[t_center\\](.*?)\\[/t_center\\]#si" => "<div align=\"center\">\$1</div>", "#\\[t_right\\](.*?)\\[/t_right\\]#si" => "<div align=\"right\">\$1</div>", "#\\[t_justify\\](.*?)\\[/t_justify\\]#si" => "<div align=\"justify\">\$1</div>", "#\\[img\\](.*?)\\[/img\\]#si" => "<img src=\"\$1\" alt=\"\" title=\"\" border=\"0\">", "#\\[img=(.*?)\\](.*?)\\[/img\\]#si" => "<img src=\"\$2\" align=\"\$1\" alt=\"\" title=\"\" border=\"0\">", "#\\[flash=(.*?)x(.*?)\\](.*?)\\[/flash\\]#si" => "<div id=\"flash" . $randomSuffix . "\" align=\"center\">&nbsp;</div><script language=\"Javascript\" type=\"text/javascript\">loaderSWF('\$3','flash" . $randomSuffix . "',\$1,\$2);</script>\n", "#\\[doc=(.*?)\\](.*?)\\[/doc\\]#si" => "<a href=\"\$1\" target=\"_blank\" class=\"bbCodeLink\">\$2</a>", "#\\[doc=(.*?)~(.*?)\\](.*?)\\[/doc\\]#si" => "<img src=\"" . _BBCODEICONSPATH . "/\$1\" alt=\"\" border=0 align=\"absmiddle\"> <a href=\"\$2\" target=\"_blank\" class=\"bbCodeLink\">\$3</a>", "#\\[url=([a-z]+?://){1}([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "<a href=\"\$1\$2\" target=\"_blank\" class=\"bbCodeLink\">\$4</a>", "#\\[url=([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "<a href=\"\$1\" target=\"_blank\" class=\"bbCodeLink\">\$3</a>", "#\\[email=(.*?)\\](.*?)\\[/email\\]#si" => "<a href=\"mailto:\$1\" class=\"bbCodeLink\">\$2</a>", "#\\[gmaps=([0-9]{1,3})x([0-9]{1,3})\\]([a-z]+?://){1}([a-z0-9\\-\\.,'\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)maps.google]+)\\[/gmaps\\]#si" => "<iframe width=\"\$1\" height=\"\$2\"\r\n\t\t\t\t\t\t\tframeborder=\"0\" scrolling=\"no\"\r\n\t\t\t\t\t\t\tmarginheight=\"0\" marginwidth=\"0\"\r\n\t\t\t\t\t\t\tsrc=\"\$3\$4\">\r\n\t\t\t\t\t\t</iframe>\n", "#\\[font=(.*?)\\](.*?)\\[/font\\]#si" => "<font face=\"\$1\">\$2</font>", "#\\[size=(.*?)x(.*?)\\](.*?)\\[/size\\]#si" => "<font size=\"\$1\"><span class=\"bbCode\$1\">\$3</span></font>", "#\\[color=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/color\\]#si" => "<font color=\"\$1\">\$2</font>");
         //	EMOTICONS
         if ($emoticons) {
             $model = new App_Model_Db_Table_Bbcode();
             $res = $model->fetchAll();
             $num = count($res);
             $info = smilesArray($res);
             $zz = 0;
             if ($num > 0) {
                 for ($zz = 0; $zz < $num; $zz++) {
                     $theSmile = $info[$zz]['code'];
                     $theImage = $info[$zz]['image'];
                     /*	Modified by Fabrizio Parrella	*/
                     $theSmile = str_replace('"', '\\"', $theSmile);
                     $theSmile = preg_quote($theSmile);
                     $theSmile = str_replace("/", "\\/", $theSmile);
                     $orig[] = '/\\[' . $theSmile . '\\]/si';
                     $repl[] = ' <img src="' . _EMOTICONSPATH . '/' . $theImage . '" alt="" border="0" align="absmiddle" /> ';
                 }
                 $text = @preg_replace($orig, $repl, $text);
             }
         }
         ##	End emoticons
     } else {
         $matches = array("#\\[class=(.*?)\\](.*?)\\[/class\\]#si" => "", "#\\[b\\](.*?)\\[/b\\]#si" => "", "#\\[u\\](.*?)\\[/u\\]#si" => "", "#\\[i\\](.*?)\\[/i\\]#si" => "", "#\\[strike\\](.*?)\\[/strike\\]#si" => "", "#\\[list\\](.*?)\\[/list\\]#si" => "", "#\\[list=(.*?)\\](.*?)\\[/list\\]#si" => "", "#\\[\\*\\]#si" => "", "#\\[hr\\]#si" => "", "#\\[bgcolor=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/bgcolor\\]#si" => "", "#\\[t_left\\](.*?)\\[/t_left\\]#si" => "", "#\\[t_center\\](.*?)\\[/t_center\\]#si" => "", "#\\[t_right\\](.*?)\\[/t_right\\]#si" => "", "#\\[t_justify\\](.*?)\\[/t_justify\\]#si" => "", "#\\[img\\](.*?)\\[/img\\]#si" => "", "#\\[img=(.*?)\\](.*?)\\[/img\\]#si" => "", "#\\[flash=(.*?)x(.*?)\\](.*?)\\[/flash\\]#si" => "", "#\\[doc=(.*?)\\](.*?)\\[/doc\\]#si" => "", "#\\[doc=(.*?)~(.*?)\\](.*?)\\[/doc\\]#si" => "", "#\\[url=([a-z]+?://){1}([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "", "#\\[url=([a-z0-9\\-\\.,\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)]+) t=(_blank|_parent)\\](.*?)\\[/url\\]#si" => "", "#\\[email=(.*?)\\](.*?)\\[/email\\]#si" => "", "#\\[gmaps=([0-9]{1,3})x([0-9]{1,3})\\]([a-z]+?://){1}([a-z0-9\\-\\.,'\\?!%\\*_\\#:;~\\&\$@\\/=\\+\\(\\)maps.google]+)\\[/gmaps\\]#si" => "", "#\\[font=(.*?)\\](.*?)\\[/font\\]#si" => "", "#\\[size=(.*?)x(.*?)\\](.*?)\\[/size\\]#si" => "", "#\\[color=(\\#[0-9A-F]{6}|[a-z]+)\\](.*?)\\[/color\\]#si" => "");
         if ($emoticons) {
             //				$qry	= "	SELECT * FROM ".TBL_EMOTICONS." ";
             //				$res	= $this->DBObject->SQL_Query($qry,$this->DBConnection);	//	==> your own mysql_query
             //				$num	= $this->DBObject->SQL_NumRows($res);					//	==> your own mysql_num_rows
             $model = new App_Model_Db_Table_Bbcode();
             $res = $model->fetchAll();
             $num = count($res);
             $info = smilesArray($res);
             $zz = 0;
             if ($num > 0) {
                 for ($zz = 0; $zz < $num; $zz++) {
                     $theSmile = $info[$zz]['code'];
                     $theImage = $info[$zz]['image'];
                     /*	Modified by Fabrizio Parrella	*/
                     $theSmile = str_replace('"', '\\"', $theSmile);
                     $theSmile = preg_quote($theSmile);
                     $theSmile = str_replace("/", "\\/", $theSmile);
                     $orig[] = '/\\[' . $theSmile . '\\]/si';
                     $repl[] = $theSmile;
                 }
                 $text = @preg_replace($orig, $repl, $text);
             }
         }
         ##	End emoticons
     }
     ##	End normal parsing
     //	REPLACE ALL
     $text = @preg_replace(array_keys($matches), array_values($matches), $text);
     $text = str_Replace("\n", "<br>", $text);
     return $text;
 }
Exemplo n.º 21
0
<?php

$CONFIG = MSCore::modules()->getModuleConfig($module['module_name']);
$filename = str_Replace(PRFX, '', isset($CONFIG['table']['items']['db_name']) ? $CONFIG['table']['items']['db_name'] : $module['module_name']);
$table = PRFX . $filename;
MSCore::db()->execute('DROP TABLE `' . $table . '`', false);
Exemplo n.º 22
0
function write_config_cache($webdbs)
{
    global $db, $_pre;
    if (is_array($webdbs)) {
        foreach ($webdbs as $key => $value) {
            if (is_array($value)) {
                $webdbs[$key] = $value = implode(",", $value);
            }
            $SQL2 .= "'{$key}',";
            $SQL .= "('{$key}', '{$value}', ''),";
        }
        $SQL = $SQL . ";";
        $SQL = str_Replace("'),;", "')", $SQL);
        $db->query(" DELETE FROM `{$_pre}config` WHERE c_key IN ({$SQL2}'') ");
        $db->query(" INSERT INTO `{$_pre}config` VALUES  {$SQL} ");
    }
    $writefile = "<?php\r\n";
    $query = $db->query("SELECT * FROM {$_pre}config");
    while ($rs = $db->fetch_array($query)) {
        $rs[c_value] = addslashes($rs[c_value]);
        $writefile .= "\$webdb['{$rs['c_key']}']='{$rs['c_value']}';\r\n";
    }
    write_file(Mpath . "data/config.php", $writefile);
}
Exemplo n.º 23
0
 function limpaTags($limpar)
 {
     if (is_array($limpar)) {
         $str = '';
         for ($x = 0; $x < count($limpar); $x++) {
             $str .= $limpar[$x] != '' ? $limpar[$x] . ' ' : '';
         }
         $str = strip_Tags(str_Replace(" ", ", ", subStr($str, 0, -1)));
     }
     return $str;
 }
Exemplo n.º 24
0
 $data[$specie]->valid = 0;
 $data[$specie]->invalid = 0;
 $data[$specie]->validated = 0;
 $data[$specie]->not_validated = 0;
 $data[$specie]->sig_ok = 0;
 $data[$specie]->sig_nok = 0;
 $data[$specie]->no_sig = 0;
 $data[$specie]->used = 0;
 $data[$specie]->unused = 0;
 $data[$specie]->precision_ok = 0;
 $data[$specie]->precision_nok = 0;
 $row = [];
 $d = $data[$specie];
 //Record per occurrence
 foreach ($occurrences as $doc) {
     $doc->specieID = strtoupper($family_spp[$index]) . "_" . str_Replace(" ", "_", str_replace("-", "_", $specie));
     $occ = [];
     if (isset($doc->georeferenceVerificationStatus)) {
         if ($doc->georeferenceVerificationStatus == "1" || $doc->georeferenceVerificationStatus == "ok") {
             $doc->georeferenceVerificationStatus = "ok";
             $d->sig_ok++;
             $f = 'coordinateUncertaintyInMeters';
             if (!isset($doc->{$f}) || is_null($doc->{$f}) || in_array($doc->{$f}, $precisions_allowed)) {
                 $d->precision_ok++;
             } else {
                 $d->precision_nok++;
             }
         } else {
             $d->sig_nok++;
             $doc->valid = 'false';
         }
Exemplo n.º 25
0
    $code2 = AddSlashes($code2);
    $code2 = str_replace("\r", '\\r', $code2);
    $code2 = str_replace("\n", '\\n', $code2);
    echo "<SCRIPT LANGUAGE=\"JavaScript\">\n\t<!--\n\tparent.puthtmlcode('{$type}','{$code}','{$code2}');\n\t//-->\n\t</SCRIPT>";
    exit;
}
if ($inc == "NewTag") {
    unset($inc);
    $job = "list";
    check_NewTag();
}
if ($inc) {
    if ($action) {
        save_label();
    }
    $inc = str_Replace("/", "", $inc);
    if (ereg("^(log|down|photo|mv|shop|music|flash)\$", $inc)) {
        include dirname(__FILE__) . "/label/c.php";
    } elseif (ereg("^Info_", $inc)) {
        //Info_fenlei_
        $detail = explode("Info_", $inc);
        $_pre = "{$pre}{$detail['1']}";
        $ModuleDB[$detail[1]]['admindir'] || ($ModuleDB[$detail[1]]['admindir'] = 'admin');
        $label_file = ROOT_PATH . $ModuleDB[$detail[1]]['dirname'] . '/' . $ModuleDB[$detail[1]][admindir] . '/label.inc.php';
        if (is_file($label_file)) {
            include $label_file;
        } else {
            include dirname(__FILE__) . "/label/info.php";
        }
    } else {
        if (!@(include dirname(__FILE__) . "/label/{$inc}.php")) {
Exemplo n.º 26
0
 public function updateApplicantsFromLocalFile()
 {
     $updatedRecords = 0;
     $applicantDataSource = "";
     $applicant = $position = array();
     $idFromJamTitle = $this->getAdhocPositionid();
     // ------------------------------------------------------------------------
     // -- Obtain data from file
     // ------------------------------------------------------------------------
     // ------------------------
     // Read CSV file to array $applicantDataSource[line]
     // ------------------------
     $file = INCLEVEL . PATH_DATA . "/statistics_applicants/count.csv";
     if (!is_file($file) && !is_link($file)) {
         return false;
     }
     //TODO: nicer error handling
     $applicantDataSource = file($file, FILE_IGNORE_NEW_LINES);
     if (empty($applicantDataSource)) {
         return false;
     }
     //TODO: nicer error handling
     // ------------------------
     // Convert raw data to array
     //   $applicant[][lastname,firstname,citizenship,residentship,ms,phd,
     //                 cit_continent,res_continent,ms_continent,phd_continent,
     //                 nordic,baltic,campaign_id]
     // ------------------------
     $idx = 900;
     foreach ($applicantDataSource as $line) {
         if (preg_match("/^.*--- (.*)/", trim($line), $res)) {
             $jamTitle = trim(strtolower(preg_replace("#[[\\]\\s]*#", "", $res[1])));
             if (!empty($jamTitle) && isset($idFromJamTitle[$jamTitle])) {
                 $position_id = $idFromJamTitle[$jamTitle];
             } else {
                 $position_id = ++$idx;
             }
         } else {
             $arr = preg_split("/\\s?,\\s?/", str_Replace("??", "", $line));
             if (count($arr) > 1) {
                 $applicant[] = array("position_id" => $position_id, "lastname" => mb_convert_case($arr[4], MB_CASE_TITLE, "UTF-8"), "firstname" => mb_convert_case($arr[5], MB_CASE_TITLE, "UTF-8"), "cit" => $arr[0], "res" => $arr[1], "ms" => $arr[2], "phd" => $arr[3]);
             }
         }
     }
     // ------------------------------------------------------------------------
     // -- Insert data into database
     // ------------------------------------------------------------------------
     foreach ($applicant as $record) {
         if (!empty($record["position_id"])) {
             foreach (array("firstname", "lastname", "cit", "res", "ms", "phd") as $tblfield) {
                 if (!isset($record[$tblfield])) {
                     $record[$tblfield] = "";
                 }
                 $record[$tblfield] = trim($record[$tblfield]);
             }
             $sql = "INSERT INTO `" . $this->dbprefix . "applicant` " . "  (`position_id`," . "  `firstname`," . "  `lastname`," . "  `cit`," . "  `res`," . "  `ms`," . "  `phd`) " . "VALUES " . "  ('" . addslashes(strip_tags($record["position_id"])) . "'," . "   '" . addslashes(strip_tags($record["firstname"])) . "'," . "   '" . addslashes(strip_tags($record["lastname"])) . "'," . "   '" . addslashes(strip_tags($record["cit"])) . "'," . "   '" . addslashes(strip_tags($record["res"])) . "'," . "   '" . addslashes(strip_tags($record["ms"])) . "'," . "   '" . addslashes(strip_tags($record["phd"])) . "'" . "  ) ";
             if ((bool) $this->query($sql, IS_TESTSERVER)) {
                 // includes a call to connect
                 $updatedRecords++;
             } else {
                 $updatedRecords = false;
             }
         }
     }
     // -----------------------
     return $updatedRecords;
 }