function _receiveJob()
 {
     $result = '';
     $dir_jobs_queued = $this->_options['DirJobsQueued'];
     if (!$dir_jobs_queued) {
         throw new UnexpectedValueException('Configuration option DirJobsQueued required');
     }
     $path = end_with_slash($dir_jobs_queued);
     $job_id = '';
     if (file_exists($path) && is_dir($path)) {
         if ($dh = opendir($path)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, 0, 1) != '.') {
                     $xml = file_get($path . $file);
                     $this->_jobID = substr($file, 0, strpos($file, '.'));
                     $xml = @simplexml_load_string($xml);
                     if (!$xml) {
                         throw new RuntimeException('Could not parse job XML');
                     }
                     $this->_jobXML = $xml;
                     break;
                     // just do one
                 }
             }
             closedir($dh);
         }
     }
 }
Exemple #2
0
 /**
  * 为图片添加水印
  * @static public
  * @param string $source 原文件名
  * @param string $water  水印图片
  * @param string $$savename  添加水印后的图片名
  * @param string $alpha  水印的透明度
  * @return void
  */
 public static function water($source, $water, $savename = null, $alpha = 80, $get_source = true)
 {
     //[cluster]
     if ($get_source) {
         $source_tmp_name = tempnam(sys_get_temp_dir(), 'tp_');
         file_put_contents($source_tmp_name, file_get($source));
         $origin_savename = is_null($savename) ? $source : $savename;
         $source = $source_tmp_name;
     }
     //检查文件是否存在
     if (!file_exists($source) || !file_exists($water)) {
         return false;
     }
     //图片信息
     $sInfo = self::getImageInfo($source);
     $wInfo = self::getImageInfo($water);
     //如果图片小于水印图片,不生成图片
     if ($sInfo["width"] < $wInfo["width"] || $sInfo['height'] < $wInfo['height']) {
         return false;
     }
     //建立图像
     $sCreateFun = "imagecreatefrom" . $sInfo['type'];
     $sImage = $sCreateFun($source);
     $wCreateFun = "imagecreatefrom" . $wInfo['type'];
     $wImage = $wCreateFun($water);
     //设定图像的混色模式
     imagealphablending($wImage, true);
     //图像位置,默认为右下角右对齐
     $posY = $sInfo["height"] - $wInfo["height"];
     $posX = $sInfo["width"] - $wInfo["width"];
     //生成混合图像
     imagecopymerge($sImage, $wImage, $posX, $posY, 0, 0, $wInfo['width'], $wInfo['height'], $alpha);
     //输出图像
     $ImageFun = 'Image' . $sInfo['type'];
     //如果没有给出保存文件名,默认为原图像名
     if (!$savename) {
         $savename = $source;
         @unlink($source);
     } elseif ($get_source) {
         //[cluster] 临时保存文件
         $savename = tempnam(sys_get_temp_dir(), 'tp_');
         @unlink($source);
     }
     //保存图像
     $ImageFun($sImage, $savename);
     imagedestroy($sImage);
     //[cluster] 上传文件
     if ($get_source) {
         file_upload($savename, $origin_savename);
         @unlink($savename);
     }
 }
Exemple #3
0
function parse_dict($table)
{
    $names = array();
    if (is_file(DT_ROOT . '/file/setting/' . $table . '.csv')) {
        $tmp = file_get(DT_ROOT . '/file/setting/' . $table . '.csv');
        $arr = explode("\n", $tmp);
        foreach ($arr as $v) {
            $t = explode(',', $v);
            $names[$t[0]] = $t[1];
        }
    }
    return $names;
}
Exemple #4
0
 public function setUp()
 {
     $this->isProject = getenv('IS_PROJECT');
     parent::setUp();
     // setup manifest
     $codexArr = json_decode(file_get($this->fixturesPath('codex.json')), true);
     $codexArr = Util::recursiveArrayStringReplace($codexArr, ['{vendor_dir}' => $this->basePath('vendor')]);
     file_put(storage_path('codex.json'), json_encode($codexArr));
     // setup misc
     file_touch(storage_path('codex.log'));
     $this->registerServiceProvider();
     $a = 'a';
 }
 function get($key)
 {
     is_md5($key) or $key = md5($this->pre . $key);
     $php = DT_CACHE . '/php/' . substr($key, 0, 2) . '/' . $key . '.php';
     if (is_file($php)) {
         $str = file_get($php);
         $ttl = substr($str, 13, 10);
         if ($ttl < $this->time) {
             return '';
         }
         return substr($str, 23, 1) == '@' ? substr($str, 24) : unserialize(substr($str, 23));
     } else {
         return '';
     }
 }
function private_signature($key_path, $data)
{
    $result = FALSE;
    if (function_exists('openssl_get_privatekey') && function_exists('openssl_sign') && function_exists('openssl_free_key')) {
        $key = file_get($key_path);
        if ($key) {
            $pkeyid = openssl_get_privatekey($key);
            if ($pkeyid) {
                if (openssl_sign($data, $result, $pkeyid)) {
                    $result = base64_encode($result);
                }
                openssl_free_key($pkeyid);
            }
        }
    }
    return $result;
}
 function _get($type, $job_id)
 {
     $dir_cache = $this->getOption('DirCache');
     if (!$dir_cache) {
         throw new UnexpectedValueException('Configuration option DirCache required');
     }
     $path = end_with_slash($dir_cache) . $job_id . '/media.xml';
     $raw_xml = file_get($path);
     $result = '';
     //$progress = -1;
     $status = 'Progress or PercentDone tags not found in response';
     $progress = 10;
     // now if there is any problem we set the percent back to one and retry later
     if (!$raw_xml) {
         $status = 'Queued';
     } else {
         $raw_xml = '<moviemasher>' . $raw_xml . '</moviemasher>';
         $xml = $this->_parseResponse($raw_xml);
         if (!empty($xml->Progress) && is_object($xml->Progress)) {
             $data = $xml->Progress[sizeof($xml->Progress) - 1];
             if (!empty($data->PercentDone)) {
                 $progress = (string) $data->PercentDone;
                 if (!empty($data->Status)) {
                     $status = (string) $data->Status;
                 } else {
                     $progress = 10;
                     $status = 'Status tag empty';
                 }
             } else {
                 $status = 'PercentDone tag empty';
             }
         } else {
             $status = 'Progress tag empty';
         }
     }
     if (strpos($status, 'empty') !== FALSE) {
         $this->log($status . ' in response: ' . $raw_xml);
     }
     $result = array('percent' => $progress, 'status' => $status);
     return $result;
 }
Exemple #8
0
 foreach (glob(DT_ROOT . '/*.*') as $f) {
     $files[] = $f;
 }
 foreach ($filedir as $d) {
     $files = array_merge($files, get_file(DT_ROOT . '/' . $d, $fileext));
 }
 $lists = $mirror = array();
 if (is_file(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')) {
     $content = substr(trim(file_get(DT_ROOT . '/file/md5/' . DT_VERSION . '.php')), 13);
     foreach (explode("\n", $content) as $v) {
         list($m, $f) = explode(' ', trim($v));
         $mirror[$m] = $f;
     }
 }
 foreach ($files as $f) {
     $content = file_get($f);
     if (preg_match_all('/(' . $code . ')/i', $content, $m)) {
         $r = $c = array();
         foreach ($m[1] as $v) {
             in_array($v, $c) or $c[] = $v;
         }
         $r['num'] = count($c);
         if ($r['num'] < $codenum && strpos($content, 'Zend') === false) {
             continue;
         }
         $r['file'] = str_replace(DT_ROOT . '/', '', $f);
         if ($mirror && in_array($r['file'], $mirror)) {
             if (md5_file($f) == array_search($r['file'], $mirror)) {
                 continue;
             }
         }
<html>
<head>
    <title>Land wählen</title>

    <script language="JavaScript" type="text/javascript" src="../global.js"></script>
    <script language="JavaScript" type="text/javascript" src="selcountry.js"></script>
    <script language="JavaScript" type="text/javascript">
        // @ by I.Runge 2004

        function selectCountry(name) {
//opener.xform.feld.value="name";
            opener.subnetgo(name);
            self.close();
        }

    </script>

</head>
<body style="font-family:arial;">

<?php 
define("IN_HTN", 1);
include "../gres.php";
echo str_replace("%path%", "../images/maps", file_get("../data/pubtxt/selcountry_body.txt"));
?>

</body>
</html>
function action_submitcode()
{
    global $sessionid, $admin, $maxcodesize;
    if ($admin["mode"] != "Passive" && $admin["mode"] != "Active" && $_SESSION["status"] != "Admin") {
        $_SESSION["message"][] = "Code Submission Error : You are not allowed to submit solutions right now!";
        return;
    }
    if (!isset($_POST["code_pid"]) || empty($_POST["code_pid"]) || !isset($_POST["code_lang"]) || empty($_POST["code_lang"]) || !isset($_POST["code_name"]) || empty($_POST["code_name"])) {
        $_SESSION["message"][] = "Code Submission Error : Insufficient Data";
        return;
    }
    $data = mysql_query("SELECT status,languages,pgroup FROM problems WHERE pid='{$_POST['code_pid']}'");
    if (!is_resource($data) || mysql_num_rows($data) == 0) {
        $_SESSION["message"][] = "Code Submission Error : The specified problem does not exist.";
        return;
    }
    $data = mysql_fetch_array($data);
    if ($_SESSION["status"] != "Admin" && $data["status"] != "Active") {
        $_SESSION["message"][] = "Code Submission Error : The problem specified is not currently active.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && eregi("^#[0-9]+ CQM\\-[0-9]+\$", $data["prgoup"]) && $admin["mode"] == "Passive") {
        $_SESSION["message"][] = "Code Submission Error : You can no longer submit solutions to this problem.";
        return;
    }
    if ($_SESSION["status"] != "Admin" && !in_array($_POST["code_lang"], explode(",", $data["languages"]))) {
        $_SESSION["message"][] = "Code Submission Error : The programming language specified is not allowed for this problem.";
        return;
    }
    // Lower Priority - Text
    if (strlen($_POST["code_text"]) > $maxcodesize) {
        $_SESSION["message"][] = "Code Submission Error : Submitted code exceeds size limits.";
        return;
    }
    $sourcecode = addslashes($_POST["code_text"]);
    // Higher Priority - File
    $ext = file_upload("code_file", "sys/temp/" . $sessionid . "_code", "text/plain,text/x-c,text/x-c++src,application/octet-stream,application/x-javascript,application/x-ruby", 100 * 1024);
    if ($ext != -1) {
        $sourcecode = addslashes(file_get("sys/temp/" . $sessionid . "_code.{$ext}"));
        unlink("sys/temp/" . $sessionid . "_code.{$ext}");
        $_POST["code_name"] = eregi_replace(".(b|c|cpp|java|pl|php|py|rb|txt)\$", "", basename($_FILES['code_file']['name']));
    }
    //echo "INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('$_POST[code_pid]','$_SESSION[tid]','$_POST[code_lang]','$_POST[code_name]','$sourcecode','private',".time().")";
    if (!empty($sourcecode)) {
        mysql_query("INSERT INTO runs (pid,tid,language,name,code,access,submittime) VALUES ('{$_POST['code_pid']}','{$_SESSION['tid']}','{$_POST['code_lang']}','{$_POST['code_name']}','{$sourcecode}','private'," . time() . ")");
        $rid = mysql_insert_id();
        $_SESSION["message"][] = "Code Submission Successful.\nIf the code you submitted is not being evaluated immediately, please contact \"SourceCode\" on DC.";
        $_SESSION["redirect"] = "?display=code&rid={$rid}";
    } else {
        $_SESSION["message"][] = "Code Submission Error : Cannot submit empty code.";
    }
    return mysql_insert_id();
}
Exemple #11
0
    if ($backdays > 5) {
        ?>
 (<span class="f_red"><?php 
        echo $backdays;
        ?>
</span>天以前)<?php 
    }
    ?>
</a></td>
</tr>
</table>
<div class="tt">使用协议</div>
<table cellpadding="2" cellspacing="1" class="tb">
<tr>
<td style="padding:10px;"><textarea style="width:100%;height:100px;" onmouseover="this.style.height='600px';" onmouseout="this.style.height='100px';"><?php 
    echo file_get(DT_ROOT . '/license.txt');
    ?>
</textarea></td>
</tr>
</table>
<script type="text/javascript" src="<?php 
    echo $notice_url;
    ?>
"></script>
<script type="text/javascript">
var destoon_release = <?php 
    echo DT_RELEASE;
    ?>
;
var destoon_version = <?php 
    echo DT_VERSION;
 if ($sql_dir) {
     $load_files = dir_read($sql_dir, null, array('.sql'), 'date_desc');
 }
 $load_assoc = array();
 if ($sql_dir) {
     foreach ($load_files as $file) {
         $file_path = $file;
         $file = basename($file);
         $load_assoc[$file] = '(' . substr(file_date($file_path), 0, 10) . ')' . ' ' . $file;
     }
 }
 if ($sql_dir && 'load' == $post['perform']) {
     $file = $sql_dir . '/' . $post['load_from'];
     if (array_key_exists($post['load_from'], $load_assoc) && file_exists($file)) {
         $msg .= sprintf('<div>Sql loaded: %s (%s)</div>', basename($file), timestamp(file_date($file)));
         $post['sql'] = file_get($file);
         $post['save_as'] = basename($file);
         $post['save_as'] = str_replace('.sql', '', $post['save_as']);
     } else {
         error('<div>File not found: %s</div>', $file);
     }
 }
 // after load - md5 may change
 $md5 = md5($post['sql']);
 if ($sql_dir && 'load' == $post['perform'] && !error()) {
     $md5_tmp = sprintf($sql_dir . '/zzz_%s.dat', $md5);
     file_put($md5_tmp, $post['sql']);
 }
 $is_sel = false;
 $queries = preg_split("#;(\\s*--[ \t\\S]*)?(\r\n|\n|\r)#U", $post['sql']);
 foreach ($queries as $k => $query) {
Exemple #13
0
function split_sell($part)
{
    global $db, $CFG, $MODULE;
    $sql = file_get(DT_ROOT . '/file/setting/split_sell.sql');
    $sql or dalert('请检查文件file/setting/split_sell.sql是否存在');
    $sql = str_replace('destoon_sell', $db->pre . 'sell_' . $part, $sql);
    if ($db->version() > '4.1' && $CFG['db_charset']) {
        $sql .= " ENGINE=MyISAM DEFAULT CHARSET=" . $CFG['db_charset'];
    } else {
        $sql .= " TYPE=MyISAM";
    }
    $sql .= " COMMENT='" . $MODULE[5]['name'] . "分表_" . $part . "';";
    $db->query($sql);
}
Exemple #14
0
 if (isset($import)) {
     if (isset($filename) && $filename && file_ext($filename) == 'sql') {
         $dfile = $D . $filename;
         if (!is_file($dfile)) {
             msg('文件不存在,请检查');
         }
         $sql = file_get($dfile);
         sql_execute($sql);
         msg($filename . ' 导入成功', '?file=' . $file . '&action=import');
     } else {
         $fileid = isset($fileid) ? $fileid : 1;
         $tid = isset($tid) ? intval($tid) : 0;
         $filename = is_dir($D . $filepre) ? $filepre . '/' . $fileid : $filepre . $fileid;
         $filename = $D . $filename . '.sql';
         if (is_file($filename)) {
             $sql = file_get($filename);
             if (substr($sql, 0, 11) == '# Destoon V') {
                 $v = substr($sql, 11, 3);
                 if (DT_VERSION != $v) {
                     msg('由于数据结构存在差异,备份数据不可以跨版本导入<br/>备份版本:V' . $v . '<br/>当前系统:V' . DT_VERSION);
                 }
             }
             sql_execute($sql);
             $prog = $tid ? progress(1, $fileid, $tid) : '';
             msg('分卷 <strong>#' . $fileid++ . '</strong> 导入成功 程序将自动继续...' . $prog, '?file=' . $file . '&action=' . $action . '&filepre=' . $filepre . '&fileid=' . $fileid . '&tid=' . $tid . '&import=1');
         } else {
             msg('数据库恢复成功', '?file=' . $file . '&action=import');
         }
     }
 } else {
     $dbak = $dbaks = $dsql = $dsqls = $sql = $sqls = array();
Exemple #15
0
function drawSimpleTop($title = false)
{
    //leave title empty for emails
    $return = url_header_utf8() . draw_doctype() . '
		<head>' . draw_meta_utf8() . draw_favicon(DIRECTORY_WRITE . '/favicon.png') . draw_css(file_get('/css/simple.css'));
    if ($title) {
        $return .= draw_container('title', $title);
        $return .= draw_javascript_src();
        $return .= draw_javascript_src('/javascript.js');
    }
    $return .= '</head>
		<body class="s">';
    return $return;
}
Exemple #16
0
function tag($parameter, $expires = 0)
{
    global $DT, $CFG, $MODULE, $DT_TIME, $db;
    if ($expires > 0) {
        $tag_expires = $expires;
    } else {
        if ($expires == -2) {
            $tag_expires = $CFG['db_expires'];
        } else {
            if ($expires == -1) {
                $tag_expires = 0;
            } else {
                $tag_expires = $CFG['tag_expires'];
            }
        }
    }
    $tag_cache = false;
    $db_cache = $expires == -2 || defined('TOHTML') ? 'CACHE' : '';
    if ($tag_expires && $db_cache != 'CACHE' && strpos($parameter, '&page=') === false) {
        $tag_cache = true;
        $TCF = DT_CACHE . '/tag/' . md5($parameter) . '.htm';
        if (is_file($TCF) && $DT_TIME - filemtime($TCF) < $tag_expires) {
            echo substr(file_get($TCF), 17);
            return;
        }
    }
    $parameter = str_replace(array('&amp;', '%'), array('', '##'), $parameter);
    $parameter = strip_sql($parameter);
    parse_str($parameter, $par);
    if (!is_array($par)) {
        return '';
    }
    $par = dstripslashes($par);
    extract($par, EXTR_SKIP);
    isset($prefix) or $prefix = $db->pre;
    isset($moduleid) or $moduleid = 1;
    if (!isset($MODULE[$moduleid])) {
        return '';
    }
    isset($fields) or $fields = '*';
    isset($catid) or $catid = 0;
    isset($child) or $child = 1;
    isset($areaid) or $areaid = 0;
    isset($areachild) or $areachild = 1;
    isset($dir) && check_name($dir) or $dir = 'tag';
    isset($template) && check_name($template) or $template = 'list';
    isset($condition) or $condition = '1';
    isset($group) or $group = '';
    isset($page) or $page = 1;
    isset($offset) or $offset = 0;
    isset($pagesize) or $pagesize = 10;
    isset($order) or $order = '';
    isset($showpage) or $showpage = 0;
    isset($showcat) or $showcat = 0;
    isset($datetype) or $datetype = 0;
    isset($target) or $target = '';
    isset($class) or $class = '';
    isset($length) or $length = 0;
    isset($introduce) or $introduce = 0;
    isset($debug) or $debug = 0;
    isset($lazy) or $lazy = 0;
    isset($cols) && $cols or $cols = 1;
    if ($catid) {
        if ($moduleid > 4) {
            if (is_numeric($catid)) {
                $CAT = $db->get_one("SELECT child,arrchildid,moduleid FROM {$db->pre}category WHERE catid={$catid}");
                $condition .= $child && $CAT['child'] && $CAT['moduleid'] == $moduleid ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid={$catid}";
            } else {
                if ($child) {
                    $catids = '';
                    $result = $db->query("SELECT arrchildid FROM {$db->pre}category WHERE catid IN ({$catid})");
                    while ($r = $db->fetch_array($result)) {
                        $catids .= ',' . $r['arrchildid'];
                    }
                    if ($catids) {
                        $catid = substr($catids, 1);
                    }
                }
                $condition .= " AND catid IN ({$catid})";
            }
        } else {
            if ($moduleid == 4) {
                $condition .= " AND catids LIKE '%,{$catid},%'";
            }
        }
    }
    if ($areaid) {
        if (is_numeric($areaid)) {
            $ARE = $db->get_one("SELECT child,arrchildid FROM {$db->pre}area WHERE areaid={$areaid}");
            $condition .= $areachild && $ARE['child'] ? " AND areaid IN (" . $ARE['arrchildid'] . ")" : " AND areaid={$areaid}";
        } else {
            if ($areachild) {
                $areaids = '';
                $result = $db->query("SELECT arrchildid FROM {$db->pre}area WHERE areaid IN ({$areaid})");
                while ($r = $db->fetch_array($result)) {
                    $areaids .= ',' . $r['arrchildid'];
                }
                if ($areaids) {
                    $areaid = substr($areaids, 1);
                }
            }
            $condition .= " AND areaid IN ({$areaid})";
        }
    }
    $table = isset($table) ? $prefix . $table : get_table($moduleid);
    $offset or $offset = ($page - 1) * $pagesize;
    $percent = dround(100 / $cols) . '%';
    $num = 0;
    $order = $order ? ' ORDER BY ' . $order : '';
    $condition = stripslashes($condition);
    $condition = str_replace('##', '%', $condition);
    if ($showpage) {
        $num = $db->count($table, $condition, $tag_expires ? $tag_expires : $CFG['db_expires']);
        $pages = $catid ? listpages(get_cat($catid), $num, $page, $pagesize) : pages($num, $page, $pagesize);
    } else {
        if ($group) {
            $condition .= ' GROUP BY ' . $group;
        }
    }
    if ($page < 2 && strpos($parameter, '&page=') !== false) {
        $db_cache = 'CACHE';
        $tag_expires = $CFG['tag_expires'];
    }
    if ($template == 'null') {
        $db_cache = 'CACHE';
    }
    $query = "SELECT " . $fields . " FROM " . $table . " WHERE " . $condition . $order . " LIMIT " . $offset . "," . $pagesize;
    if ($debug) {
        echo $parameter . '<br/>' . $query . '<br/>';
    }
    $tags = $catids = $CATS = array();
    $result = $db->query($query, $db_cache, $tag_expires);
    while ($r = $db->fetch_array($result)) {
        if ($moduleid == 4 && isset($r['company'])) {
            $r['alt'] = $r['companyname'] = $r['company'];
            if ($length) {
                $r['company'] = dsubstr($r['company'], $length);
            }
        }
        if (isset($r['title'])) {
            $r['title'] = str_replace('"', '&quot;', trim($r['title']));
            $r['alt'] = $r['title'];
            if ($length) {
                $r['title'] = dsubstr($r['title'], $length);
            }
            if (isset($r['style']) && $r['style']) {
                $r['title'] = set_style($r['title'], $r['style']);
            }
        }
        if ($lazy && isset($r['thumb']) && $r['thumb']) {
            $r['thumb'] = DT_SKIN . 'image/lazy.gif" class="lazy" original="' . $r['thumb'];
        }
        if (isset($r['introduce']) && $introduce) {
            $r['introduce'] = dsubstr($r['introduce'], $introduce);
        }
        if (isset($r['linkurl']) && $r['linkurl'] && $moduleid > 4 && strpos($r['linkurl'], '://') === false) {
            $r['linkurl'] = $MODULE[$moduleid]['linkurl'] . $r['linkurl'];
        }
        if ($showcat && $moduleid > 4 && isset($r['catid'])) {
            $catids[$r['catid']] = $r['catid'];
        }
        $tags[] = $r;
    }
    $db->free_result($result);
    if ($showcat && $moduleid > 4 && $catids) {
        $result = $db->query("SELECT catid,catname,linkurl FROM {$db->pre}category WHERE catid IN (" . implode(',', $catids) . ")");
        while ($r = $db->fetch_array($result)) {
            $CATS[$r['catid']] = $r;
        }
        if ($CATS) {
            foreach ($tags as $k => $v) {
                $tags[$k]['catname'] = $v['catid'] ? $CATS[$v['catid']]['catname'] : '';
                $tags[$k]['caturl'] = $v['catid'] ? $MODULE[$moduleid]['linkurl'] . $CATS[$v['catid']]['linkurl'] : '';
            }
        }
    }
    if ($template == 'null') {
        return $tags;
    }
    if ($tag_cache) {
        ob_start();
        include template($template, $dir);
        $contents = ob_get_contents();
        ob_clean();
        file_put($TCF, '<!--' . ($DT_TIME + $tag_expires) . '-->' . $contents);
        echo $contents;
    } else {
        include template($template, $dir);
    }
}
Exemple #17
0
function load($file)
{
    $ext = file_ext($file);
    if ($ext == 'css') {
        echo '<link rel="stylesheet" type="text/css" href="' . DT_SKIN . $file . '" />';
    } else {
        if ($ext == 'js') {
            echo '<script type="text/javascript" src="' . DT_STATIC . 'file/script/' . $file . '"></script>';
        } else {
            if ($ext == 'htm') {
                $file = str_replace('ad_m', 'ad_t6_m', $file);
                if (is_file(DT_CACHE . '/htm/' . $file)) {
                    $content = file_get(DT_CACHE . '/htm/' . $file);
                    if (substr($content, 0, 4) == '<!--') {
                        $content = substr($content, 17);
                    }
                    echo $content;
                } else {
                    echo '';
                }
            } else {
                if ($ext == 'lang') {
                    $file = str_replace('.lang', '.inc.php', $file);
                    return DT_ROOT . '/lang/' . DT_LANG . '/' . $file;
                } else {
                    if ($ext == 'inc' || $ext == 'func' || $ext == 'class') {
                        return DT_ROOT . '/include/' . $file . '.php';
                    }
                }
            }
        }
    }
}
function action_updateproblem()
{
    global $sessionid, $invalidchars, $maxfilesize;
    if (!isset($_POST["update_pid"]) || empty($_POST["update_pid"])) {
        $_SESSION["message"][] = "Problem Updation Error : Insufficient Data";
        return;
    }
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && eregi($invalidchars, $value)) {
            $_SESSION["message"][] = "Problem Updation Error : Value of {$key} contains invalid characters.";
            return;
        }
    }
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && $key != "update_languages" && strlen($value) > 30 && $key != "update_languages") {
            $_SESSION["message"][] = "Problem Updation Error : Value of {$key} too long.";
            return;
        }
    }
    $pid = $_POST["update_pid"];
    foreach ($_POST as $key => $value) {
        if (eregi("^update_", $key) && !eregi("^update_file_", $key) && $key != "update_pid" && $key != "update_delete") {
            mysql_query("UPDATE problems SET " . eregi_replace("^update_", "", $key) . "='" . addslashes(eregi_replace("\"", "\\'", $value)) . "' WHERE pid={$pid}");
        }
    }
    foreach (array("statement", "input", "output") as $item) {
        $ext = file_upload("update_file_{$item}", "sys/temp/" . $sessionid . "_{$item}", "text/plain", $maxfilesize);
        if ($ext == -1) {
            continue;
        }
        mysql_query("UPDATE problems SET {$item}='" . addslashes(eregi_replace("\r", "", file_get("sys/temp/" . $sessionid . "_{$item}.{$ext}"))) . "' WHERE pid={$pid}");
        unlink("sys/temp/" . $sessionid . "_{$item}.{$ext}");
    }
    $ext = file_upload("update_file_image", "sys/temp/image", "image/jpeg,image/gif,image/png", $maxfilesize);
    if ($ext != -1) {
        $f = fopen("sys/temp/image.{$ext}", "rb");
        $img = base64_encode(fread($f, filesize("sys/temp/image.{$ext}")));
        fclose($f);
        mysql_query("UPDATE problems SET image='{$img}', imgext='{$ext}' WHERE pid={$pid}");
    }
    if (0) {
        if (isset($_POST["update_status"]) && $_POST["update_status"] == "Delete") {
            mysql_query("DELETE FROM problems WHERE pid={$pid}");
        }
    }
    $_SESSION["message"][] = "Problem Updation Successful";
    return;
}
Exemple #19
0
    $user = $do->get_one();
    extract($user);
    $logintime = timetodate($logintime, 5);
    $regtime = timetodate($regtime, 5);
    $userurl = userurl($_username, '', $domain);
    $sys = array();
    $i = 0;
    $result = $db->query("SELECT itemid,title,addtime,groupids FROM {$DT_PRE}message WHERE groupids<>'' ORDER BY itemid DESC", 'CACHE');
    while ($r = $db->fetch_array($result)) {
        $groupids = explode(',', $r['groupids']);
        if (!in_array($_groupid, $groupids)) {
            continue;
        }
        if ($i > 2) {
            continue;
        }
        $i++;
        $sys[] = $r;
    }
    $note = DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/note.php';
    $note = file_get($note);
    if ($note) {
        $note = substr($note, 13);
    } else {
        $note = $MOD['usernote'];
    }
    $trade = $db->count("{$DT_PRE}mall_order", "seller='{$_username}' AND status=0");
    $expired = $totime && $totime < $DT_TIME ? true : false;
    $havedays = $expired ? 0 : ceil(($totime - $DT_TIME) / 86400);
    include template('index', $module);
}
Exemple #20
0
     $data['template'] = $template;
     $data['maillist'] = $maillist;
     $data['fields'] = $fields;
     cache_write($_username . '_sendmail.php', $data);
 }
 $_content = $content;
 $pernum = intval($pernum);
 if (!$pernum) {
     $pernum = 5;
 }
 $pertime = intval($pertime);
 if (!$pertime) {
     $pertime = 5;
 }
 $DT['mail_name'] = $name;
 $emails = file_get(DT_ROOT . '/file/email/' . $maillist);
 $emails = explode("\n", $emails);
 for ($i = 1; $i <= $pernum; $i++) {
     $email = trim($emails[$id++]);
     if (is_email($email)) {
         $content = $_content;
         if ($template) {
             $user = _userinfo($fields, $email);
             eval("\$title = \"{$title}\";");
             $content = ob_template($template, 'mail');
         }
         send_mail($email, $title, $content, $sender);
     }
 }
 if ($id < count($emails)) {
     msg('已发送 ' . $id . ' 封邮件,系统将自动继续,请稍候...', '?moduleid=' . $moduleid . '&file=' . $file . '&sendtype=3&id=' . $id . '&pernum=' . $pernum . '&pertime=' . $pertime . '&send=1', $pertime);
Exemple #21
0
if ($pid > 0) {
    $result = $db->query("SELECT * FROM {$DT_PRE}ad WHERE pid={$pid} AND status=3 AND totime>{$DT_TIME} ORDER BY listorder ASC,addtime ASC LIMIT 10", 'CACHE');
    while ($r = $db->fetch_array($result)) {
        $r['image_src'] = linkurl($r['image_src']);
        $r['url'] = $r['stat'] ? DT_PATH . 'api/redirect.php?aid=' . $r['aid'] : linkurl($r['url']);
        $ads[] = $r;
    }
}
$MOD_MY = array();
$data = '';
$local = get_cookie('mobile_setting');
if ($local) {
    $data = $local;
} else {
    if ($_userid) {
        $data = file_get(DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/mobile.php');
        if ($data) {
            set_cookie('mobile_setting', $data, $DT_TIME + 30 * 86400);
        }
    }
}
if ($data) {
    $MOB_MOD = array();
    foreach ($MOB_MODULE as $m) {
        $MOB_MOD[$m['moduleid']] = $m;
    }
    foreach (explode(',', $data) as $id) {
        if (isset($MOB_MOD[$id])) {
            $MOD_MY[] = $MOB_MOD[$id];
        }
    }
if (!$err && !load_utils('auth', 'data')) {
    $err = 'Problem loading utility scripts';
}
if (!$err) {
    // pull in configuration so we can log other errors
    $config = config_get();
    $err = config_error($config);
}
// autheticate the user (will exit if not possible)
if (!$err && !auth_ok()) {
    auth_challenge($config);
}
if (!$err) {
    // pull in other configuration and check for required input
    $id = empty($_REQUEST['id']) ? '' : $_REQUEST['id'];
    $php_input = file_get('php://input');
    $log_requests = $config['log_request'];
    $log_responses = $config['log_response'];
    if ($log_requests) {
        log_file($_SERVER['QUERY_STRING'] . "\n" . $php_input, $config);
    }
    if (!($id && $php_input)) {
        $err = 'Mash id and data required';
    }
}
if (!$err) {
    // check to make sure JSON data is parsable
    if (!($request = @json_decode($php_input, TRUE))) {
        $err = 'Could not parse JSON payload';
    }
}
Exemple #23
0
             }
             if ($htm) {
                 dalert('', '', 'parent.Upsuccess("' . $htm . '");');
             } else {
                 dalert('系统未在压缩包内找到HTM文件');
             }
         } else {
             dalert('解压缩失败,请检查目录权限');
         }
     } else {
         dalert($upload->errmsg);
     }
     break;
 case 'read':
     if ($word && in_array(file_ext($word), array('htm', 'html'))) {
         $data = file_get(DT_ROOT . '/file/temp/' . $word);
         if ($data) {
             if ($charset) {
                 $data = convert($data, $charset, DT_CHARSET);
             }
             if (preg_match("/<body[^>]*>([\\s\\S]+)<\\/body>/i", $data, $m)) {
                 $data = trim($m[1]);
             }
             $data = str_replace('<![if !vml]>', '', $data);
             $data = str_replace('<![endif]>', '', $data);
             $data = str_replace('<o:p>', '', $data);
             $data = str_replace('</o:p>', '', $data);
             $data = preg_replace("/ v:shapes=\"[^\"]*\">/i", ">", $data);
             if ($wd_class) {
                 $data = preg_replace("/[\\s]?class=[\\'|\"]?[^>]*[\\'|\"]?/i", '', $data);
             }
Exemple #24
0
function update_hits($moduleid, $table)
{
    global $db, $DT_TIME;
    $hits = trim(file_get(DT_CACHE . '/hits-' . $moduleid . '.php'));
    file_put(DT_CACHE . '/hits-' . $moduleid . '.php', ' ');
    file_put(DT_CACHE . '/hits-' . $moduleid . '.dat', $DT_TIME);
    if ($hits) {
        $tmp = array_count_values(explode(' ', $hits));
        $arr = array();
        foreach ($tmp as $k => $v) {
            $arr[$v] .= $k ? ',' . $k : '';
        }
        $id = $moduleid == 4 ? 'userid' : 'itemid';
        foreach ($arr as $k => $v) {
            $db->query("UPDATE LOW_PRIORITY {$table} SET `hits`=`hits`+" . $k . " WHERE `{$id}` IN (0" . $v . ")", 'UNBUFFERED');
        }
    }
}
Exemple #25
0
 function mk_str()
 {
     $str = '';
     if ($this->cn) {
         $step = DT_CHARSET == 'UTF-8' ? 3 : 2;
         $text = substr(file_get(DT_ROOT . '/file/config/cncaptcha.inc.php'), 13);
         $max = strlen($text) - 1 - $step;
         while (1) {
             $i = mt_rand(0, $max);
             if ($i % $step == 0) {
                 $str .= substr($text, $i, $step);
                 break;
             }
         }
         while (1) {
             $i = mt_rand(0, $max);
             if ($i % $step == 0) {
                 $str .= substr($text, $i, $step);
                 break;
             }
         }
     } else {
         $max = strlen($this->chars) - 1;
         while (1) {
             if (strlen($str) == $this->length) {
                 break;
             }
             $r = mt_rand(0, $max);
             if (strpos(strtolower($str), strtolower($this->chars[$r])) === false) {
                 $str .= $this->chars[$r];
             }
         }
     }
     return $str;
 }
Exemple #26
0
     $id = $s = $f = 0;
     $content or msg('请填写短信内容');
     $mobilelist or msg('请选择号码列表');
     $data = array();
     $data['mobilelist'] = $mobilelist;
     $data['content'] = $content;
     $data['sign'] = $sign;
     cache_write($_username . '_sendsms.php', $data);
 }
 $_content = $content;
 $DT['sms_sign'] = $sign;
 $pernum = intval($pernum);
 if (!$pernum) {
     $pernum = 10;
 }
 $mobiles = file_get(DT_ROOT . '/file/mobile/' . $mobilelist);
 $mobiles = explode("\n", $mobiles);
 for ($i = 1; $i <= $pernum; $i++) {
     $mobile = trim($mobiles[$id++]);
     if (is_mobile($mobile)) {
         $user = _userinfo($mobile);
         $content = $_content;
         if ($user) {
             eval("\$content = \"{$content}\";");
         }
         $content = strip_sms($content);
         $sms_code = send_sms($mobile, $content);
         if (strpos($sms_code, $DT['sms_ok']) !== false) {
             $s++;
         } else {
             $f++;
Exemple #27
0
                 }
                 $area['areaname'] = $areaname;
                 $do->add($area);
             }
         }
         $do->repair();
         dmsg('添加成功', $this_forward);
     } else {
         include tpl('area_add');
     }
     break;
 case 'import':
     $file = DT_ROOT . '/file/setting/area.sql';
     is_file($file) or msg('数据文件不存在,请上传程序包内 file/setting/area.sql 文件至 file/setting 目录');
     require DT_ROOT . '/include/sql.func.php';
     sql_execute(file_get($file));
     cache_area();
     dmsg('导入成功', $this_forward);
     break;
 case 'cache':
     $do->repair();
     dmsg('更新成功', $this_forward);
     break;
 case 'delete':
     if ($areaid) {
         $areaids = $areaid;
     }
     $areaids or msg();
     $do->delete($areaids);
     dmsg('删除成功', $this_forward);
     break;
Exemple #28
0
<?php

/*
	[Destoon B2B System] Copyright (c) 2008-2015 www.destoon.com
	This is NOT a freeware, use is subject to license.txt
*/
defined('DT_ADMIN') or exit('Access Denied');
$install = file_get(DT_CACHE . '/install.lock');
$url = decrypt('9c86mN4yUrDymsHosfI6kag1VdsjAXdpuY7C5UD3GsPI1P68R7SnbeT3X4qgVLxH0VyC3IcilPVjRchf8M3Zjl0', 'DESTOON') . '?action=' . $action . '&product=b2b&version=' . DT_VERSION . '&release=' . DT_RELEASE . '&lang=' . DT_LANG . '&charset=' . DT_CHARSET . '&install=' . $install . '&os=' . PHP_OS . '&soft=' . urlencode($_SERVER['SERVER_SOFTWARE']) . '&php=' . urlencode(phpversion()) . '&mysql=' . urlencode(mysql_get_server_info()) . '&url=' . urlencode($DT_URL) . '&site=' . urlencode($DT['sitename']) . '&auth=' . strtoupper(md5($DT_URL . $install . $_SERVER['SERVER_SOFTWARE']));
if (isset($mfa)) {
    $url .= '&mfa=' . $mfa;
}
dheader($url);
Exemple #29
0
function file_pass($filename)
{
    //is this strictly necessary?  what's this for?
    global $_josh;
    $content = file_get($filename);
    //die($filename);
    $nameparts = explode($_josh["folder"], $filename);
    $filenameparts = explode(".", $nameparts[count($nameparts) - 1]);
    $extension = array_pop($filenameparts);
    $filename = implode(".", $filenameparts);
    return file_download($content, $filename, $extension);
}
Exemple #30
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
if (!$_userid) {
    exit;
}
isset($MODULE[$mid]) or exit;
if ($job == 'get') {
    $file = DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/editor.data.' . $mid . '.php';
    $content = file_get($file);
    if ($content) {
        echo substr($content, 13);
    } else {
        echo '';
    }
} else {
    if (!$content) {
        exit;
    }
    $content = stripslashes($content);
    $content = convert($content, 'UTF-8', DT_CHARSET);
    $content = '<?php exit;?>' . timetodate($DT_TIME) . $content;
    file_put(DT_ROOT . '/file/user/' . dalloc($_userid) . '/' . $_userid . '/editor.data.' . $mid . '.php', $content);
}