示例#1
0
 function addLink($object, $media = 'screen')
 {
     if ($GLOBALS["cacheJS"]["cont"]["{$object}"]++) {
         return;
     }
     if (is_file($object)) {
         core_dbg(get_class($this), 'addLink', $object);
         print "<link type='text/css' rel='stylesheet' media='{$media}' href='{$object}'>\n";
     }
     //else core_warning("Can not load '".posix_getcwd()."/$object'",$this);
 }
示例#2
0
 function modalTEXT($mID, $text)
 {
     core_dbg(get_class($this) . ".modalTEXT(id={$mID}, html...)", 0, 0, $this->debug);
     //if ($this->debug) print x('pre',htmlEscape($text));
     $id = $this->id();
     $js = "var m{$id}=new AscModal('" . core_compactor($text) . "','n'); " . "\$('{$id}').addEvent('click',function(e{$id}){if(e{$id}) e{$id}=new Event(e{$id}).stop(); m{$id}.show();});";
     if (True) {
         $this->js->addCode($js);
         return x("a href='#' id='{$id}'", $mID);
     } else {
         $this->js->addCode("function f{$id}(){ {$js}; };");
         return x("a href='javascript:f{$id}();' id='{$id}'", $mID);
     }
 }
示例#3
0
function core_utf8_encode($str)
{
    global $core_dejavu;
    if ($str === mb_convert_encoding(mb_convert_encoding($str, "UTF-32", "UTF-8"), "UTF-8", "UTF-32")) {
        return $str;
    } else {
        $encoded = utf8_encode($str);
        if (False && $str != $encoded) {
            if (!$core_dejavu[$str]++ && $core_dejavu["counter"]++ < 2) {
                core_dbg('core_utf8_encode', $str, $encoded);
            }
        }
        return $encoded;
    }
}
示例#4
0
 function dbg($f, $value)
 {
     if ($this->debug) {
         list($name, $id, $key) = $this->fromStack();
         if ($id == "anyID") {
             $id = "";
         }
         if ($key == "anyKEY") {
             $key = "";
         }
         if ($key) {
             $id .= "," . $key;
         }
         if ($id) {
             $id = "(" . $id . ")";
         }
         if (is_object($value)) {
             $value = $value->name();
         }
         core_dbg(redText($this->ID . "-" . strtoupper($f), $this->c), redText($name . $id, $this->c), redText($value, $this->c), $this->debug);
     }
 }
示例#5
0
 function dbg($txt, $t2 = "", $t3 = "", $t4 = "")
 {
     if ($this->debug) {
         core_dbg(get_class($this), $txt, trim($t2 . " " . $t3 . " " . $t4), 1);
     }
 }
示例#6
0
 function dbg($id, $txt = '')
 {
     if ($this->debug) {
         core_dbg('DB=' . $this->Database, $id, $txt, $this->debug);
     }
     if ($this->debug) {
         system("printf '%s %-15s %-9s %-15s %-15s %s\n' '" . strftime("%Y-%m-%d %H:%M:%S") . "' '{$id}' '{$txt}' >> /log/www/db.debug");
     }
 }
示例#7
0
 function dbg($id, $txt = '')
 {
     core_dbg(get_class($this), $id, $txt, $forced = False);
 }
示例#8
0
     $pp_name = $_FILES["preprint"]["name"];
     $ext = nor_file_name_extension($pp_name);
     $extra_ext = "";
     $do_compress = false;
     if ($ext == ".gz" || $ext == ".bz2") {
         $is_compressed = true;
         $ext = nor_file_name_extension(nor_file_name_sans_extension($pp_name)) . $ext;
     } else {
         $is_compressed = false;
         if ($ext == ".ps") {
             $do_compress = true;
             $extra_ext = ".gz";
         }
     }
     $dest_file = sprintf("%s%02d%s", $year, $report, $ext);
     core_dbg("UPLOAD dest_file='" . PP_DB . "{$dest_dir}/{$dest_file}'");
     if (copy($_FILES["preprint"]["tmp_name"], PP_DB . "{$dest_dir}/{$dest_file}")) {
         if ($do_compress) {
             if (system("gzip {$dest_file}")) {
                 nor_tech_warn("Could not gzip file.");
                 $extra_ext = "";
             }
         }
         $location = PP_DB_URL . "{$dest_dir}/{$dest_file}{$extra_ext}";
         #system("ls -lrt ".PP_DB."$dest_dir/$dest_file 2>&1");
     } else {
         bugPage("Cannot copy " . $_FILES["preprint"]["tmp_name"] . " -> " . PP_DB . "{$dest_dir}/{$dest_file}");
     }
     break;
 case UPLOAD_ERR_NO_FILE:
     break;