示例#1
0
 private function tmpdir()
 {
     if ($this->tmpdir_ === null && ($this->tmpdir_ = tempdir()) === false) {
         $this->warnings[] = "Could not create temporary directory.";
     }
     return $this->tmpdir_;
 }
示例#2
0
/**
*子栏目
**/
function ListMoreSp()
{
    global $db, $pre, $fid, $webdb, $fidDB;
    $order = 'list';
    $order && ($_order = " ORDER BY {$order} DESC ");
    $rows = 4;
    $leng = 30;
    $query = $db->query("SELECT * FROM {$pre}spsort WHERE fup={$fid} ORDER BY list DESC");
    while ($rs = $db->fetch_array($query)) {
        $SQL = "WHERE fid={$rs['fid']} {$_order} LIMIT {$rows}";
        $which = '*';
        $rs[article] = list_special($SQL, $which, $leng);
        //如果本栏目不能获取到专题,将获取其所有子栏目的专题
        if (!$rs[article]) {
            $array_fid = Get_SonFid("{$pre}spsort", $rs[fid]);
            if ($array_fid) {
                $SQL = "WHERE fid IN (" . implode(',', $array_fid) . ") {$_order} LIMIT {$rows}";
                $rs[article] = list_special($SQL, $which, $leng);
            }
        }
        $rs[logo] && ($rs[logo] = tempdir($rs[logo]));
        $listdb[] = $rs;
    }
    return $listdb;
}
 /**
  * Constructor of the executable runner.
  *
  * @param $workingDir Working directory (current directory) to be used when
  * running the program.
  */
 public function __construct($submission, $workingDir = NULL)
 {
     // parent::__construct();
     if ($workingDir == NULL) {
         $workingDir = tempdir($submission->getWorkDir(), ExecutableRunner::OUTPUT_PREFIX);
     }
     $this->setWorkingDir($workingDir);
 }
示例#4
0
function get_examples($id)
{
    global $pre, $db;
    $query = $db->query("SELECT * FROM {$pre}example WHERE fid='{$id}' AND ifhide=0 LIMIT 50");
    while ($rs = $db->fetch_array($query)) {
        $rs[logo] = tempdir($rs[logo]);
        $_listdb[] = $rs;
    }
    $num = 5 - count($_listdb) % 5;
    for ($i = 0; $i < $num; $i++) {
        $_listdb[] = array('display' => 'none');
    }
    $listdb = array_chunk($_listdb, 5);
    return $listdb;
}
示例#5
0
function list_title($type = 'new', $rows = 10)
{
    global $db, $pre, $_pre;
    if ($type == 'new') {
        $SQL = " ORDER BY A.id DESC LIMIT {$rows}";
    } elseif ($type == 'hot') {
        $SQL = " ORDER BY A.hits DESC LIMIT {$rows}";
    } elseif ($type == 'com') {
        $SQL = " WHERE A.levels=1 ORDER BY A.levelstime DESC LIMIT {$rows}";
    }
    $query = $db->query("SELECT A.*,B.* FROM {$_pre}content A LEFT JOIN {$_pre}content_1 B ON B.id=A.id {$SQL}");
    while ($rs = $db->fetch_array($query)) {
        $rs[picurl] && ($rs[picurl] = tempdir($rs[picurl]));
        $listdb[] = $rs;
    }
    return $listdb;
}
示例#6
0
        exit;
    }
}
// Calculate report starttime and endtime
$report_start = date('Y.m.d H:i', $starttime);
$report_end = date('Y.m.d H:i', $endtime);
# print <<< ENDHTML
#</br>
#Starttime : $starttime</br>
#Timeperiod: $timeperiod</br>
#STime     : $stime</br>
#Start     : $report_start</br>
#End       : $report_end</br>
#ENDHTML;
// Setup temporary file/directory names
$z_tmpimg_path = tempdir($z_tmp_path);
$tmp_pdf_data = tempnam($z_tmp_path, "zabbix_report");
// Set Timezone
date_default_timezone_set("{$timezone}");
// Print Header if debug is on
if ($debug) {
    header('Content-type: text/html; charset=utf-8');
    if (isset($hostid)) {
        echo "<b>HostID: </b>" . $hostid . "</br>\n";
    }
    if (isset($groupid)) {
        echo "<b>GroupID: </b>" . $groupid . "</br>\n";
    }
    if (isset($reporttype)) {
        echo "<b>Report Type: </b>" . $reporttype . "</br>\n";
    }
 $importtemplateoutput .= "<div class='messagebox ui-corner-all'>";
 if ($demoModeOnly === true) {
     $importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Demo mode: Uploading templates is disabled."), $basedestdir) . "<br/><br/>\n";
     $importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
     $importtemplateoutput .= "</div>\n";
     return;
 }
 require "classes/phpzip/phpzip.inc.php";
 //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name'];
 $zipfile = $_FILES['the_file']['tmp_name'];
 $z = new PHPZip();
 // Create temporary directory
 // If dangerous content is unzipped
 // then no one will know the path
 $extractdir = tempdir($tempdir);
 $basedestdir = $usertemplaterootdir;
 $newdir = str_replace('.', '', strip_ext(sanitize_paranoid_string($_FILES['the_file']['name'])));
 $destdir = $basedestdir . '/' . $newdir . '/';
 if (!is_writeable($basedestdir)) {
     $importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir) . "<br/><br/>\n";
     $importtemplateoutput .= "<br/><input type=\"submit\" onclick=\"window.open('{$scriptname}?action=templates', '_top')\" value=\"" . $clang->gT("Template Editor") . "\"/>\n";
     $importtemplateoutput .= "</div>\n";
     return;
 }
 if (!is_dir($destdir)) {
     mkdir($destdir);
 } else {
     $importtemplateoutput .= "<div class=\"warningheader\">" . $clang->gT("Error") . "</div><br />\n";
     $importtemplateoutput .= sprintf($clang->gT("Template '%s' does already exist."), $newdir) . "<br/><br/>\n";
示例#8
0
         //多生成一张1:1的图片,方便标签调用
         gdpic(ROOT_PATH . "{$webdb['updir']}/{$postdb['picurl']}", "{$Newpicpath}.jpg.jpg", $picWidth ? $picWidth : 300, $picWidth ? $picWidth : 300, $webdb[autoCutSmallPic] ? array('fix' => 1) : '');
         gdpic(ROOT_PATH . "{$webdb['updir']}/{$postdb['picurl']}", $Newpicpath, $picWidth ? $picWidth : 300, $picHeight ? $picHeight : 225, $webdb[autoCutSmallPic] ? array('fix' => 1) : '');
         if (file_exists($Newpicpath)) {
             $postdb[picurl] = $smallpic;
             //FTP上传文件到远程服务器
             if ($webdb[ArticleDownloadUseFtp]) {
                 ftp_upfile($Newpicpath, $postdb[picurl]);
             }
         }
     } else {
         if (file_exists(ROOT_PATH . "{$webdb['updir']}/{$post_picurl}.jpg")) {
             move_attachment($lfjuid, tempdir("{$post_picurl}.jpg"), $downloadDIR, 'small');
         }
         if (file_exists(ROOT_PATH . "{$webdb['updir']}/{$post_picurl}.jpg.jpg")) {
             move_attachment($lfjuid, tempdir("{$post_picurl}.jpg.jpg"), $downloadDIR, 'small');
         }
     }
 }
 //FTP上传文件到远程服务器
 if ($webdb[ArticleDownloadUseFtp] && $file_db) {
     foreach ($file_db as $key => $value) {
         if (is_file(ROOT_PATH . "{$webdb['updir']}/{$value}")) {
             ftp_upfile(ROOT_PATH . "{$webdb['updir']}/{$value}", $value);
         }
     }
 }
 //如果系统设置自动提取关键字的话,只有当用户没设置关键字,才自动提取.
 if ($job == 'postnew' && $webdb[autoGetKeyword] && !$postdb[keywords]) {
     $postdb[keywords] = keyword_ck($postdb[keywords], $postdb[title]);
 }
示例#9
0
//系统推荐主题
$myotherDB = $comDB = '';
$query = $db->query("SELECT * FROM {$pre}article ORDER BY levels DESC,levelstime DESC,aid DESC LIMIT 11");
while ($rs = $db->fetch_array($query)) {
    if (!$comDB) {
        //今日导读
        $comDB = $rs;
    } else {
        $myotherDB[] = $rs;
    }
}
//我的图片主题
$myphotoDB = '';
$query = $db->query("SELECT * FROM {$pre}article WHERE ispic=1 AND uid='{$uid}' ORDER BY aid DESC LIMIT 6");
while ($rs = $db->fetch_array($query)) {
    $rs[picurl] = tempdir($rs[picurl]);
    $myphotoDB[] = $rs;
}
//论坛贴子
$mybbsDB = '';
if (ereg("^pwbbs", $webdb[passport_type])) {
    $query = $db->query("SELECT * FROM {$TB_pre}threads WHERE authorid='{$uid}' ORDER BY tid DESC LIMIT 10");
    while ($rs = $db->fetch_array($query)) {
        $mybbsDB[] = $rs;
    }
}
//过滤不健康的字
$rsdb[truename] = replace_bad_word($rsdb[truename]);
$rsdb[introduce] = replace_bad_word($rsdb[introduce]);
$rsdb[address] = replace_bad_word($rsdb[address]);
require get_member_tpl('homepage');
示例#10
0
function get_label_mv($string)
{
    global $jobs;
    preg_match_all("/\\(mv,([\\d]+),([\\d]+),(false|true)\\)([^\\(]+)\\(\\/mv\\)/is", $string, $array);
    foreach ($array[4] as $key => $value) {
        $value = str_replace("\r", "", $value);
        $detail = explode("\n", $value);
        foreach ($detail as $key2 => $value2) {
            list($url, $name, $fen, $type) = explode("@@@", $value2);
            if (!$url || $fen) {
                continue;
            }
            $url = tempdir($url);
            $string = preg_replace("/\\(mv,([\\d]+),([\\d]+),(false|true)\\)([^\\(]+)\\(\\/mv\\)/is", "", $string);
            $playcode = player($url, $array[1][$key], $array[2][$key], $array[3][$key], $type);
            if ($jobs == 'show') {
                //视频会档住标签,所以要特别处理
                return "<div class='player' style='padding-top:20px;'>{$playcode}</div>{$string}";
            }
            return "<div class='player'>{$playcode}</div>{$string}";
        }
    }
}
示例#11
0
            $size++;
            unlink($name);
        }
    }
    return $size;
}
$directory = dirname(__FILE__) . "/tgz";
$iterator = new DirectoryIterator($directory);
$files = array();
foreach ($iterator as $fileinfo) {
    if ($fileinfo->isFile()) {
        $files[$fileinfo->getPathname()] = $fileinfo->getFilename();
    }
}
ksort($files);
foreach ($files as $path => $file) {
    $p = new PharData($path);
    $tmpdir = tempdir();
    $p->extractTo($tmpdir);
    var_dump($file);
    var_dump(getFileCount($tmpdir));
    $delIter = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tmpdir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST);
    foreach ($delIter as $info) {
        if ($info->isDir()) {
            rmdir($info->getPathname());
        } else {
            unlink($path);
        }
    }
    rmdir($tmpdir);
}
示例#12
0
<?php

require "global.php";
//导航条
@(include Mpath . "data/guide_fid.php");
$mid = 2;
/**
*获取信息正文的内容
**/
$rsdb = $db->get_one("SELECT A.*,B.*,M.icon FROM `{$_pre}person` A LEFT JOIN `{$_pre}content_{$mid}` B ON A.id=B.id LEFT JOIN {$pre}memberdata M ON A.uid=M.uid WHERE A.id='{$id}'");
if (!$rsdb) {
    showerr("内容不存在");
} elseif (!$web_admin && $rsdb[uid] != $lfjuid && $rsdb[cuid] != $lfjuid) {
    showerr("你无权查看");
}
$rsdb[picurl] = tempdir($rsdb[icon]);
$rsdb[C] = $db->get_one("SELECT * FROM {$_pre}content WHERE id='{$rsdb['cid']}'");
$field_db = $module_DB[$mid]['field'];
/**
*对信息内容字段的处理
**/
$Module_db->hidefield = true;
$Module_db->classidShowAll = true;
$Module_db->showfield($field_db, $rsdb, 'show');
$rsdb[posttime] = date("Y-m-d H:i:s", $rsdb[posttime]);
require getTpl("print_member");
示例#13
0
    $job_path .= '/' . $jobid;
}
// Setup directories (including ssh/host vars)
// do we force this plugin to run locally as chris?
$force_chris_local = in_array($plugin_name, explode(',', CHRIS_RUN_AS_CHRIS_LOCAL));
$host = CLUSTER_HOST;
if ($status == 100 || $force_chris_local) {
    $host = 'localhost';
}
$ssh = new Net_SSH2($host);
if (!$ssh->login($username, $password)) {
    die('Login Failed');
}
$ssh->exec('umask 0002 ; mkdir -p ' . $job_path);
// dprint($of, "job_path = $job_path\n");
$job_path_output = tempdir($ssh, $job_path);
// dprint($of, "job_path_output = $job_path_output\n");
// replace ${OUTPUT} pattern in the command and in the parameters
$command = str_replace("{OUTPUT}", $job_path, $command);
$command = str_replace("{FEED_ID}", $feed_id, $command);
$command = str_replace("{USER_ID}", $user_id, $command);
$parameters = str_replace("{OUTPUT}", $job_path, $parameters);
$parameters = str_replace("{FEED_ID}", $feed_id, $parameters);
$parameters = str_replace("{USER_ID}", $user_id, $parameters);
// add meta information to the feed
FeedC::addMetaS($feed_id, 'parameters', $parameters, 'simple');
// add owner
FeedC::addMetaS($feed_id, 'root_id', (string) $feed_id, 'extra');
// append the log files to the command
$command .= ' >> ' . $job_path_output . '/chris.std 2> ' . $job_path_output . '/chris.err';
// create the chris.env and chris.run file
    die("Invalid upload (1)");
}
if ($_FILES['filenameuploaded']['type'] != "application/x-zip-compressed" && $_FILES['filenameuploaded']['type'] != "application/zip") {
    die("Invalid upload (2)");
}
// Make sure the file name doesn't contain any funky characters - e.g. / or perhaps unicode which will confuse things.
// This regexp probably rules out brackets e.g Copy of Foo (1).zip which is quite common.
if (preg_match('![^-a-z0-9_\\.]!i', $_FILES['filenameuploaded']['name'])) {
    die("Supplied file name contains invalid characters, remove any non-alphanumerics and retry.");
}
_load_language_file("/website_code/php/import_template.inc");
// Clean uploaded file name. Remove non-(alphanumerics or - or . characters).
// as we use the user's provided file name later on in file paths etc.
$userProvidedFileName = $_FILES['filenameuploaded']['name'];
// Create a unique, random, temporary directory.
$temp_dir = tempdir();
$zip_file = $temp_dir . DIRECTORY_SEPARATOR . $userProvidedFileName;
// Copy the uploaded file into the tempdir, unzip it and then remove it.
if (@move_uploaded_file($_FILES['filenameuploaded']['tmp_name'], $zip_file)) {
    $zip = new dUnzip2($zip_file);
    $zip->debug = false;
    $zip->getList();
    $zip->unzipAll($temp_dir);
    $zip->close();
    unlink($zip_file);
} else {
    _debug("Upload of template failed - " . print_r($_FILES, true));
    die("Upload failed - couldn't process uploaded file. ({$new_file_name}) ");
}
// XXX: What should $_POST['folder'] look like? Presumably something like 'Nottingham'.
if (!empty($_POST['folder'])) {
示例#15
0
 function showfield($field_db, &$rsdb, $type = 'show')
 {
     foreach ($field_db as $key => $rs) {
         if ($type == 'list' && !$rs[listshow]) {
             //列表页的话,需要后台设置在列表页显示
             //continue;
         }
         //隐藏某些用户组没权限看的字段
         if ($this->hidefield && $rs[allowview]) {
             global $groupdb, $web_admin, $lfjuid;
             if (!$web_admin && $lfjuid != $rsdb[uid] && !in_array($groupdb['gid'], explode(",", $rs[allowview]))) {
                 $rsdb[$key] = "<font color=red>权限不够,无法查看!</font>";
                 continue;
             }
         }
         if ($rs[form_type] == 'textarea') {
             if ($type == 'show') {
                 //内容页完整显示
                 require_once ROOT_PATH . "inc/encode.php";
                 $rsdb[$key] = format_text($rsdb[$key]);
             } elseif ($type == 'list') {
                 //列表页部分显示
                 $rsdb[$key] = get_word($rsdb[$key], 100);
             }
         } elseif ($rs[form_type] == 'ieedit' || $rs[form_type] == 'ieeditsimp') {
             if ($type == 'show') {
                 //内容页完整显示
                 $rsdb[$key] = En_TruePath($rsdb[$key], 0, 1);
             } elseif ($type == 'list') {
                 //列表页部分显示
                 $rsdb[$key] = @preg_replace('/<([^>]*)>/is', "", $rsdb[$key]);
                 $rsdb[$key] = get_word($rsdb[$key], 100);
             }
         } elseif ($type == 'show' && ($rs[form_type] == 'upfile' || $rs[form_type] == 'onepic')) {
             $rsdb[$key] = tempdir($rsdb[$key]);
         } elseif ($type == 'show' && ($rs[form_type] == 'upmorepic' || $rs[form_type] == 'upmorefile')) {
             $detail = explode("\n", $rsdb[$key]);
             unset($rsdb[$key]);
             foreach ($detail as $_key => $value) {
                 list($_url, $_name) = explode("@@@", $value);
                 $rsdb[$key][url][] = tempdir($_url);
                 $rsdb[$key][title][] = $_name;
             }
         } elseif ($rs[form_type] == 'classdb') {
             $rsdb[$key] = $this->classdb_show($rsdb[$key]);
         } elseif ($rs[form_type] == 'select' || $rs[form_type] == 'radio') {
             if (strstr($rs[form_set], "|")) {
                 $rs[form_set] = str_replace("\r", "", $rs[form_set]);
                 $detail = explode("\n", $rs[form_set]);
                 foreach ($detail as $key2 => $value2) {
                     list($_key, $_value) = explode("|", $value2);
                     $_key == $rsdb[$key] && $_value && ($rsdb[$key] = $_value);
                 }
             }
         } elseif ($rs[form_type] == 'checkbox') {
             if (strstr($rs[form_set], "|")) {
                 $rs[form_set] = str_replace("\r", "", $rs[form_set]);
                 $detail = explode("\n", $rs[form_set]);
                 foreach ($detail as $key2 => $value2) {
                     list($_key, $_value) = explode("|", $value2);
                     if ($_value) {
                         //以下还需要进一步改进的
                         $rsdb[$key] = str_replace($_key, $_value, $rsdb[$key]);
                     }
                 }
             }
             $rsdb[$key] = str_replace("/", "、", $rsdb[$key]);
         }
         if ($rs[field_type] == 'int' && $rsdb[$key] == '0' && !$rs[form_units]) {
             $rsdb[$key] = '';
         } elseif ($rs[form_units] && $type == 'show') {
             $rsdb[$key] .= " {$rs['form_units']}";
         }
     }
 }
示例#16
0
}
if (!$listdb) {
    $listdb[] = array("subject" => "本专题暂无文章,请管理员在后台添加文章");
}
//统计点击次数
$db->query("UPDATE {$pre}special SET hits=hits+1,lastview='{$timestamp}' WHERE id='{$id}'");
//SEO
$titleDB[title] = filtrate(strip_tags("{$rsdb['title']} - {$fidDB['name']} - {$webdb['webname']}"));
$titleDB[keywords] = filtrate("{$rsdb['keywords']} {$webdb['metakeywords']}");
$rsdb[description] = get_word(preg_replace("/(<([^<]+)>|\t|&nbsp;|\n)/is", "", $rsdb[content]), 250);
$titleDB[description] = filtrate($rsdb[description]);
//附件真实地址还原
$rsdb[content] = En_TruePath($rsdb[content], 0);
$rsdb[content] = str_replace("\n", "<br>", $rsdb[content]);
$rsdb[posttime] = date("Y-m-d H:i:s", $rsdb[posttime]);
$rsdb[picurl] && ($rsdb[picurl] = tempdir($rsdb[picurl]));
require ROOT_PATH . "inc/head.php";
require html("showsp", $main_tpl);
require ROOT_PATH . "inc/foot.php";
$content = ob_get_contents();
ob_end_clean();
ob_start();
if ($webdb[www_url] == '/.') {
    $content = str_replace('/./', '/', $content);
}
echo $content;
//伪静态处理
if ($webdb[NewsMakeHtml] == 2) {
    $content = ob_get_contents();
    ob_end_clean();
    ob_start();
示例#17
0
        if ($key == 'content') {
            continue;
        }
        if ($rs[form_type] == 'textarea') {
            $rsdb[$key] = format_text($rsdb[$key]);
        } elseif ($rs[form_type] == 'ieedit') {
            $rsdb[$key] = En_TruePath($rsdb[$key], 0);
        } elseif ($rs[form_type] == 'upfile') {
            $rsdb[$key] = tempdir($rsdb[$key]);
        } elseif ($rs[form_type] == 'upmorefile') {
            $detail = explode("\n", $rsdb[$key]);
            unset($rsdb[$key]);
            foreach ($detail as $_key => $value) {
                list($_url, $_name) = explode("@@@", $value);
                $_rsdb[$key][name][] = $_name = $_name ? $_name : "DownLoad{$_key}";
                $_rsdb[$key][url][] = $_url = tempdir($_url);
                $rsdb[$key][show][] = "<A HREF='{$_url}' target=_blank>{$_name}</A>";
            }
            $rsdb[$key] = implode("<br>", $rsdb[$key][show]);
        } elseif ($rs[form_type] == 'radio' || $rs[form_type] == 'select' || $rs[form_type] == 'checkbox') {
            $rsdb[$key] = SRC_true_value($rs, $rsdb[$key]);
        }
    }
    $rsdb[posttime] = date("Y-m-d H:i:s", $rsdb[posttime]);
    require "head.php";
    require ROOT_PATH . "{$dirname}/data/form_tpl/admin_bencandy_{$mid}.htm";
    require "foot.php";
} elseif ($job == "yz") {
    $db->query("UPDATE `{$_pre}content` SET yz='{$yz}' WHERE id='{$id}'");
    jump("修改成功", "{$FROMURL}", '0');
} elseif ($job == "reply") {
示例#18
0
        }
    }
} elseif (!$web_admin && $lfjuid !== $rsdb[uid] && $rsdb[money] > 0) {
    if ($Aid != $rsdb[aid] || $TI != $ti) {
        if (get_money($lfjuid) < $rsdb[money]) {
            showerr("你的{$webdb[MoneyName]}不足{$rsdb[money]}{$webdb[MoneyDW]}", 1);
        } else {
            add_user($lfjuid, -$rsdb[money], '观看视频扣分');
            //1小时内不重复扣积分
            setcookie("down_{$rsdb['aid']}", mymd5("{$ti}\t{$rsdb['aid']}"), $timestamp + 3600);
        }
    }
}
//更新点击量
update_hits($mid, $midDB[keywords], $id, $rid, $rsdb[hits_time]);
$true_url = tempdir($url);
require_once html("player");
//下载与播放视频更新点击率
function update_hits($mid, $keyword, $aid, $rid, $time)
{
    global $lfjid, $db, $pre, $timestamp;
    if ($keyword == 'download' || $keyword == 'mv') {
        if (date("W", $time) != date("W", $timestamp)) {
            $SQL .= ",week_hits=1";
        } else {
            $SQL .= ",week_hits=week_hits+1";
        }
        if (date("md", $time) != date("md", $timestamp)) {
            $SQL .= ",day_hits=1";
        } else {
            $SQL .= ",day_hits=day_hits+1";
示例#19
0
function write_friendlink()
{
    global $db, $pre, $timestamp, $webdb;
    $query = $db->query("SELECT * FROM {$pre}friendlink WHERE ifhide=0 AND yz=1 AND (endtime=0 OR endtime>{$timestamp}) ORDER BY list DESC");
    while ($rs = $db->fetch_array($query)) {
        foreach ($rs as $key => $value) {
            $rs[$key] = AddSlashes($rs[$key]);
        }
        if ($rs[logo] && !$rs[iswordlink]) {
            $rs[logo] = tempdir($rs[logo]);
            $logodb[] = "'{$rs['id']}'=>array('name'=>'{$rs['name']}','url'=>'{$rs['url']}','logo'=>'{$rs['logo']}','descrip'=>'{$rs['descrip']}')";
        } else {
            $worddb[] = "'{$rs['id']}'=>array('name'=>'{$rs['name']}','url'=>'{$rs['url']}','descrip'=>'{$rs['descrip']}')";
        }
    }
    $write = "<?php\r\n\$friendlinkDB[1]=array(" . implode(",\r\n", $logodb) . ");\r\n\$friendlinkDB[0]=array(" . implode(",\r\n", $worddb) . ");";
    //以上是供首页调用显示.以下是供其它页面调用显示
    $query2 = $db->query("SELECT * FROM {$pre}friendlink_sort");
    while ($rs2 = $db->fetch_array($query2)) {
        unset($logodb, $worddb);
        $query = $db->query("SELECT * FROM {$pre}friendlink WHERE fid='{$rs2['fid']}' AND ifhide=0 AND yz=1 AND (endtime=0 OR endtime>{$timestamp}) ORDER BY list DESC");
        while ($rs = $db->fetch_array($query)) {
            foreach ($rs as $key => $value) {
                $rs[$key] = AddSlashes($rs[$key]);
            }
            if ($rs[logo] && !$rs[iswordlink]) {
                $rs[logo] = tempdir($rs[logo]);
                $logodb[] = "'{$rs['id']}'=>array('name'=>'{$rs['name']}','url'=>'{$rs['url']}','logo'=>'{$rs['logo']}','descrip'=>'{$rs['descrip']}')";
            } else {
                $worddb[] = "'{$rs['id']}'=>array('name'=>'{$rs['name']}','url'=>'{$rs['url']}','descrip'=>'{$rs['descrip']}')";
            }
        }
        $write .= "\r\n\r\n\$friendlink_DB[{$rs2[fid]}][1]=array(" . implode(",\r\n", $logodb) . ");\r\n\$friendlink_DB[{$rs2[fid]}][0]=array(" . implode(",\r\n", $worddb) . ");";
    }
    write_file(ROOT_PATH . "data/friendlink.php", $write);
}
示例#20
0
    if (is_writable($dir)) {
        do {
            $path = $dir . $prefix . mt_rand(0, 9999999);
        } while (!mkdir($path, $mode));
        return $path;
    } else {
        die(T_("Error: Cannot write to temporary directory"));
    }
}
$tempdir = realpath(dirname(__FILE__) . '/../include/limesurvey/tmp');
$operator_id = get_operator_id();
if ($operator_id) {
    $sql = "SELECT *,SUBSTRING_INDEX(extension, '/', -1) as ext\n\t\tFROM extension\n\t\tWHERE current_operator_id = {$operator_id}";
    $rs = $db->GetRow($sql);
    if (!empty($rs)) {
        $zipdir = tempdir($tempdir);
        $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
        if (preg_match('/linux/', $userAgent)) {
            //assume linux
            copy(realpath(dirname(__FILE__) . '/../voipclient'), "{$zipdir}/voipclient");
            $f1 = "{$zipdir}/voipclient";
            $f2 = "{$zipdir}/startvoip";
            file_put_contents($f2, "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME']);
        } else {
            //assume windows
            copy(realpath(dirname(__FILE__) . '/../voipclient.exe'), "{$zipdir}/voipclient.exe");
            $f1 = "{$zipdir}/voipclient.exe";
            $f2 = "{$zipdir}/startvoip.bat";
            file_put_contents($f2, "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME']);
        }
        require_once dirname(__FILE__) . "/../include/limesurvey/admin/classes/phpzip/phpzip.inc.php";
示例#21
0
require ROOT_PATH . "inc/label_module.php";
//文章自定义模型$fidDB[config]
if ($rsdb[mid]) {
    if ($rsdb[mid] != $fidDB[fmid]) {
        @extract($db->get_one("SELECT config AS m_config FROM {$pre}article_module WHERE id='{$rsdb['mid']}'"));
        $M_config = unserialize($m_config);
    } else {
        $M_config = $fidDB[M_config];
    }
    $_rsdb = $db->get_one("SELECT * FROM `{$pre}article_content_{$rsdb['mid']}` WHERE aid='{$id}' AND rid='{$rsdb['rid']}'");
    if ($_rsdb) {
        $rsdb = $rsdb + $_rsdb;
        show_module_content($M_config);
    }
}
$rsdb[picurl] = tempdir($rsdb[picurl]);
$webdb[AutoTitleNum] && $rsdb[pages] > 1 && ($rsdb[title] = Set_Title_PageNum($rsdb[title], $page));
if ($rsdb[keywords]) {
    unset($array);
    $detail = explode(" ", $rsdb[keywords]);
    foreach ($detail as $key => $value) {
        $_value = urlencode($value);
        $array[] = "<A HREF='{$webdb['www_url']}/do/search.php?type=keyword&keyword={$_value}' target=_blank>{$value}</A>";
    }
    $rsdb[keywords] = implode(" ", $array);
}
//过滤不良词语
$rsdb[content] = replace_bad_word($rsdb[content]);
$rsdb[title] = replace_bad_word($rsdb[title]);
$rsdb[subhead] = replace_bad_word($rsdb[subhead]);
//多模型扩展接口
示例#22
0
/**
*针对分类获取子栏目
**/
function ListOnlySort($rows)
{
    global $db, $_pre, $fid, $page, $Fid_db, $fidDB, $webdb;
    $_SonOrder = 'id';
    //排序
    if ($fidDB[config][sonListorder] == 1) {
        $_SonOrder = 'id';
        //理应是list
    } elseif ($fidDB[config][sonListorder] == 2) {
        $_SonOrder = 'hits';
    } elseif ($fidDB[config][sonListorder] == 3) {
        $_SonOrder = 'lastview';
    } elseif ($fidDB[config][sonListorder] == 4) {
        $_SonOrder = 'rand()';
    } else {
        $_SonOrder = 'id';
    }
    //显示几行
    if ($fidDB[config][sonTitleRow] > 0) {
        $_SonRow = $fidDB[config][sonTitleRow];
    } elseif ($webdb[InfoListSonRows] > 0) {
        $_SonRow = $webdb[InfoListSonRows];
    } else {
        $_SonRow = 10;
    }
    //每个标题显示几个字
    if ($fidDB[config][sonTitleLeng] > 0) {
        $_SonLeng = $fidDB[config][sonTitleLeng];
    } elseif ($webdb[InfoListSonLeng] > 0) {
        $_SonLeng = $webdb[InfoListSonLeng];
    } else {
        $_SonLeng = 50;
    }
    if (!$page) {
        $page = 1;
    }
    $min = ($page - 1) * $rows;
    $query = $db->query("SELECT * FROM {$_pre}sort WHERE fup={$fid} AND forbidshow=0 ORDER BY list DESC LIMIT {$min},{$rows}");
    while ($rs = $db->fetch_array($query)) {
        $rs[article] = $_SQL = $fiddb = '';
        if ($rs[type]) {
            foreach ($Fid_db[$rs[fid]] as $key => $value) {
                $fiddb[] = $key;
                foreach ($Fid_db[$key] as $key2 => $value2) {
                    $fiddb[] = $key2;
                }
            }
            if ($fiddb) {
                $fids = implode(",", $fiddb);
                $_SQL = "WHERE A.fid IN ({$fids}) AND A.yz=1 ORDER BY {$_SonOrder} DESC LIMIT {$_SonRow}";
            }
        } else {
            $_SQL = "WHERE A.fid={$rs['fid']} AND A.yz=1 ORDER BY {$_SonOrder} DESC LIMIT {$_SonRow}";
        }
        if ($_SQL) {
            $rs[article] = list_content($_SQL, $_SonLeng);
        }
        $rs[logo] && ($rs[logo] = tempdir($rs[logo]));
        $listdb[] = $rs;
    }
    return $listdb;
}
示例#23
0
$ch_pagetype = 3;
//2,为list页,3,为bencandy页
$ch_module = $webdb[module_id] ? $webdb[module_id] : 99;
//系统特定ID参数,每个系统不能雷同
$ch = 0;
//不属于任何专题
require ROOT_PATH . "inc/label_module.php";
if ($rsdb[uid]) {
    $userdb = $db->get_one("SELECT * FROM {$pre}memberdata WHERE uid='{$rsdb['uid']}'");
    $userdb[username] = $rsdb[username];
    $userdb[regdate] = date("y-m-d H:i", $userdb[regdate]);
    $userdb[lastvist] = date("y-m-d H:i", $userdb[lastvist]);
    $userdb[icon] = tempdir($userdb[icon]);
    include_once ROOT_PATH . "data/level.php";
    $userdb[level] = $ltitle[$userdb[groupid]];
} else {
    $userdb[username] = preg_replace("/([\\d]+)\\.([\\d]+)\\.([\\d]+)\\.([\\d]+)/is", "\\1.\\2.*.*", $rsdb[ip]);
    $userdb[level] = "游客";
}
unset($picdb);
if ($rsdb[picnum] > 1) {
    $query = $db->query("SELECT * FROM {$_pre}pic WHERE id='{$id}'");
    while ($rs = $db->fetch_array($query)) {
        $rs[imgurl] = tempdir($imgurl = $rs[imgurl]);
        $rs[picurl] = eregi("^http:", $imgurl) ? $rs[imgurl] : "{$rs['imgurl']}.gif";
        $picdb[] = $rs;
    }
}
require ROOT_PATH . "inc/head.php";
require getTpl("bencandy_{$fidDB['mid']}", $main_tpl);
require ROOT_PATH . "inc/foot.php";
示例#24
0
 private function initTemp()
 {
     $this->TEMP_DIR = tempdir();
 }
示例#25
0
<?php

require "global.php";
$mid = 2;
$field_db = $module_DB[$mid]['field'];
$Lrows = 10;
$showpage = getpage("{$_pre}join A", "WHERE A.cid={$cid}", "?cid={$cid}", $Lrows);
unset($listdb);
if ($page < 1) {
    $page = 1;
}
$min = ($page - 1) * $Lrows;
$query = $db->query("SELECT A.*,B.*,C.* FROM {$_pre}join A LEFT JOIN {$_pre}content_{$mid} C ON A.id=C.id LEFT JOIN {$pre}memberdata B ON A.uid=B.uid WHERE A.cid='{$cid}' ORDER BY A.posttime DESC LIMIT {$min},{$Lrows}");
while ($rs = $db->fetch_array($query)) {
    $Module_db->showfield($field_db, $rs, 'list');
    $rs[username] || ($rs[username] = $rs[ip]);
    $rs[picurl] = tempdir($rs[icon]);
    $rs[posttime] = date("Y-m-d H:i:s", $rs[posttime]);
    $listdb[] = $rs;
}
$rs = $db->get_one("SELECT * FROM `{$_pre}content` WHERE id='{$cid}'");
if (!$lfjuid || $rs[uid] != $lfjuid) {
    showerr("ÄãÎÞȨ²é¿´");
}
require ROOT_PATH . "inc/head.php";
require getTpl("list_{$mid}");
require ROOT_PATH . "inc/foot.php";
示例#26
0
    $showpage = getpage("`{$pre}friendlink` A", "{$SQL}", "?lfj={$lfj}&job={$job}&fid={$fid}", $rows);
    $query = $db->query("SELECT A.*,B.name AS fname FROM `{$pre}friendlink` A LEFT JOIN {$pre}friendlink_sort B ON A.fid=B.fid {$SQL} ORDER BY A.list DESC,A.yz ASC,A.id DESC LIMIT {$min},{$rows}");
    while ($rs = $db->fetch_array($query)) {
        $rs[ifshow] = $rs[ifhide] ? "<A HREF='?lfj={$lfj}&job=up&ifhide=0&id={$rs['id']}' style='color:red;'>首页隐藏</A>" : "<A HREF='?lfj={$lfj}&job=up&ifhide=1&id={$rs['id']}' style='color:blue;'>首页显示</A>";
        if (!$rs[yz]) {
            $rs[ifshow] = "隐藏";
        }
        if (!$rs[endtime]) {
            $rs[state] = '长久有效';
        } elseif ($rs[endtime] < $timestamp) {
            $rs[state] = '<font color=#FF0000>已过期</font>';
        } else {
            $rs[state] = '<font color=#0000FF>' . date("Y-m-d H:i", $rs[endtime]) . '</font>截止';
        }
        if ($rs[logo]) {
            $rs[logo] = tempdir($rs[logo]);
            $rs[logo] = "<img src='{$rs['logo']}' width=88 height=31 border=0>";
        }
        $rs[yz] = $rs[yz] ? "<a href='index.php?lfj={$lfj}&job=setyz&yz=0&id={$rs['id']}' style='color:red;'><img alt='已通过审核,点击取消审核' src='../member/images/check_yes.gif' border=0></a>" : "<a href='index.php?lfj={$lfj}&job=setyz&yz=1&id={$rs['id']}' style='color:blue;'><img alt='还没通过审核,点击通过审核' src='../member/images/check_no.gif' border=0></a>";
        $listdb[] = $rs;
    }
    require dirname(__FILE__) . "/" . "head.php";
    require dirname(__FILE__) . "/" . "template/friendlink/menu.htm";
    require dirname(__FILE__) . "/" . "template/friendlink/friendlink.htm";
    require dirname(__FILE__) . "/" . "foot.php";
} elseif ($action == "list" && $Apower[friendlink_mod]) {
    foreach ($listdb as $key => $value) {
        $db->query("UPDATE {$pre}friendlink SET `list`='{$value}' WHERE id='{$key}'");
    }
    write_friendlink();
    jump("修改成功", "{$FROMURL}", 1);
示例#27
0
**/
$rows = $webdb[Info_ShowCommentRows] ? $webdb[Info_ShowCommentRows] : 8;
if ($page < 1) {
    $page = 1;
}
$min = ($page - 1) * $rows;
/*评论字数再多也只限制显示1000个字*/
$leng = 10000;
$query = $db->query("SELECT A.*,B.icon FROM `{$_pre}comments` A LEFT JOIN {$pre}memberdata B ON A.uid=B.uid WHERE A.id={$id} {$SQL} ORDER BY A.cid DESC LIMIT {$min},{$rows}");
while ($rs = $db->fetch_array($query)) {
    if (!$rs[username]) {
        $detail = explode(".", $rs[ip]);
        $rs[username] = "{$detail['0']}.{$detail['1']}.{$detail['2']}.*";
    }
    if ($rs[icon]) {
        $rs[icon] = tempdir($rs[icon]);
    }
    $rs[posttime] = date("Y-m-d H:i:s", $rs[posttime]);
    $rs[full_content] = $rs[content];
    $rs[content] = kill_badword($rs[content]);
    $rs[username] = kill_badword($rs[username]);
    $rs[title] = preg_replace("/\\[quote\\](.*)\\[\\/quote\\]/", "", $rs[content]);
    $rs[title] = get_word($rs[title], 50);
    $rs[content] = get_word($rs[content], $leng);
    $rs[content] = preg_replace("/\\[quote\\](.*)\\[\\/quote\\]/", "<div class='quotecomment_div'>\\1</div>", $rs[content]);
    $rs[content] = str_replace("\n", "<br>", $rs[content]);
    if ($lfjuid) {
        if ($lfjuid === $rs[cuid] || $web_admin || $lfjuid === $rs[uid] || in_array($lfjid, explode(",", $rsdb[admin]))) {
            $rs[ifadmin] = 1;
        } else {
            $rs[ifadmin] = 0;
示例#28
0
文件: js.php 项目: GHubgenius/qbbj
        //真实地址还原
        $value = En_TruePath($value, 0);
    } elseif ($rs[type] == 'pic') {
        unset($width, $height);
        $picdb = unserialize($rs[code]);
        $picdb[imgurl] = tempdir("{$picdb['imgurl']}");
        $picdb[width] && ($width = " width='{$picdb['width']}'");
        $picdb[height] && ($height = " height='{$picdb['height']}'");
        if ($picdb['imglink']) {
            $value = "<a href='{$picdb['imglink']}' target=_blank><img src='{$picdb['imgurl']}' {$width} {$height} border='0' /></a>";
        } else {
            $value = "<img src='{$picdb['imgurl']}' {$width} {$height}  border='0' />";
        }
    } elseif ($rs[type] == 'swf') {
        $flashdb = unserialize($rs[code]);
        $flashdb[flashurl] = tempdir($flashdb[flashurl]);
        $flashdb[width] && ($width = " width='{$flashdb['width']}'");
        $flashdb[height] && ($height = " height='{$flashdb['height']}'");
        $value = "<object type='application/x-shockwave-flash' data='{$flashdb['flashurl']}' {$width} {$height} wmode='transparent'><param name='movie' value='{$flashdb['flashurl']}' /><param name='wmode' value='transparent' /></object>";
    } elseif ($rs[type] == 'rollpic') {
        $value = rollPic_flash(unserialize($rs[code]));
    } else {
        $value = stripslashes($rs[code]);
        //真实地址还原
        $value = En_TruePath($value, 0);
    }
}
$show = stripslashes($value);
if (!is_dir(dirname($FileName))) {
    makepath(dirname($FileName));
}
示例#29
0
function label_hf($tag, $_value)
{
    global $db, $pre, $webdb;
    $query = $db->query(" SELECT * FROM {$pre}label WHERE  chtype='99' ");
    while ($rs = $db->fetch_array($query)) {
        if ($rs[type] == 'code') {
            $rs[code] = En_TruePath($rs[code], 0);
            $value = stripslashes($rs[code]);
            //$value=str_replace("$webdb[www_url]/$webdb[updir]",'$webdb[www_url]/$webdb[updir]',$value);
        } elseif ($rs[type] == 'pic') {
            $picdb = unserialize($rs[code]);
            $picdb[imgurl] = tempdir("{$picdb['imgurl']}");
            $picdb[width] && ($width = " width='{$picdb['width']}'");
            $picdb[height] && ($height = " height='{$picdb['height']}'");
            if ($picdb['imglink']) {
                $value = "<a href='{$picdb['imglink']}' target=_blank><img src='{$picdb['imgurl']}' {$width} {$height} border='0' /></a>";
            } else {
                $value = "<img src='{$picdb['imgurl']}' {$width} {$height}  border='0' />";
            }
            //$value=str_replace("$webdb[www_url]/$webdb[updir]",'$webdb[www_url]/$webdb[updir]',$value);
        } elseif ($rs[type] == 'swf') {
            $flashdb = unserialize($rs[code]);
            $flashdb[flashurl] = tempdir($flashdb[flashurl]);
            $flashdb[width] && ($width = " width='{$flashdb['width']}'");
            $flashdb[height] && ($height = " height='{$flashdb['height']}'");
            $value = "<object type='application/x-shockwave-flash' data='{$flashdb['flashurl']}' {$width} {$height} wmode='transparent'><param name='movie' value='{$flashdb['flashurl']}' /><param name='wmode' value='transparent' /></object>";
            //$value=str_replace("$webdb[www_url]/$webdb[updir]",'$webdb[www_url]/$webdb[updir]',$value);
        } else {
            $value = stripslashes($rs[code]);
            //真实地址还原
            $value = En_TruePath($value, 0);
        }
        $label[$rs[tag]] = $value;
    }
    $label[$tag] = stripslashes($_value);
    $show = "<?php\r\n";
    foreach ($label as $key => $value) {
        if ($value == '') {
            continue;
        }
        $value = addslashes($value);
        $value = str_replace('$', '\\$', $value);
        //$value=str_replace("$webdb[www_url]/$webdb[updir]",'$webdb[www_url]/$webdb[updir]',$value);
        $value = En_TruePath($value, 1);
        $show .= "\n\t\t\$label[{$key}]=En_TruePath(stripslashes(\"{$value}\"),0);";
    }
    write_file(ROOT_PATH . "data/label_hf.php", $show);
}
示例#30
0
/**
*大分类的子栏目
**/
function ListMoreSort()
{
    global $db, $pre, $fid, $webdb, $fidDB, $Fid_db;
    //排序
    if ($fidDB[config][sonListorder] == 1) {
        $order = 'A.list';
    } elseif ($fidDB[config][sonListorder] == 2) {
        $order = 'A.hits';
    } elseif ($fidDB[config][sonListorder] == 3) {
        $order = 'A.lastview';
    } elseif ($fidDB[config][sonListorder] == 4) {
        $order = 'rand()';
    } else {
        $order = 'A.list';
    }
    $_order = " ORDER BY {$order} DESC ";
    //显示几行
    if ($fidDB[config][sonTitleRow] > 0) {
        $rows = $fidDB[config][sonTitleRow];
    } elseif ($webdb[ListSonRows] > 0) {
        $rows = $webdb[ListSonRows];
    } else {
        $rows = 10;
    }
    //每个标题显示几个字
    if ($fidDB[config][sonTitleLeng] > 0) {
        $leng = $fidDB[config][sonTitleLeng];
    } elseif ($webdb[ListSonLeng] > 0) {
        $leng = $webdb[ListSonLeng];
    } else {
        $leng = 30;
    }
    if (!$webdb[viewNoPassArticle]) {
        $SQL_yz = ' AND A.yz=1 ';
    }
    $query = $db->query("SELECT * FROM {$pre}sort WHERE fup={$fid} AND forbidshow!=1 ORDER BY list DESC LIMIT 50");
    while ($rs = $db->fetch_array($query)) {
        $erp = $Fid_db[iftable][$rs[fid]] ? $Fid_db[iftable][$rs[fid]] : '';
        $SQL = "A LEFT JOIN {$pre}reply{$erp} R ON A.aid=R.aid WHERE R.topic=1 AND A.fid={$rs['fid']} {$SQL_yz} {$_order} LIMIT {$rows}";
        $which = 'A.*,R.content';
        $rs[article] = list_article($SQL, $which, $leng, $erp);
        //如果本栏目不能获取到文章,将获取其所有子栏目的文章
        if (!$rs[article]) {
            $array_fid = Get_SonFid("{$pre}sort", $rs[fid]);
            if ($array_fid && count($array_fid) < 50) {
                //分表后,如果子栏目不是同一模型的话.将不能获取资料
                $SQL = "A LEFT JOIN {$pre}reply{$erp} R ON A.aid=R.aid WHERE R.topic=1 AND A.fid IN (" . implode(',', $array_fid) . ") {$SQL_yz} {$_order} LIMIT {$rows}";
                $rs[article] = list_article($SQL, $which, $leng, $erp);
            }
        }
        $rs[logo] && ($rs[logo] = tempdir($rs[logo]));
        $listdb[] = $rs;
    }
    return $listdb;
}