function init($module, $lang, $idURL, $categorie, $sscategorie, $type, $sort, $order, $page, $search) { $entry = Db::fetch_row(Query::selectById($idURL)); $getColumn = Query::selectAll(); $output = Archives::debut($module, $lang, $categorie, $sscategorie, $idURL); for ($i = 0; $i < Db::num_fields($getColumn); $i++) { $column = Db::fetch_field($getColumn); $column = $column->name; $details = $entry[$i]; $field = Utils::findField($column); @(!(include_once 'controller/fields/' . $field . '.class.php')); if (class_exists($field)) { if ($field == "date") { $details = Utils::datefr($details); } $getValue = new $field($lang, $details, $column, $type); $details = $getValue->details; if ($this->exclusion($sscategorie, $column)) { $output .= Archives::archive($details); } } } $output .= Archives::fin(); return $output; }
function sidebar() { $return .= "\n\t<h4>Music Library</h4>\n\t<dl>\n\t\t<dt>Tracks</dt>\n\t\t<dd>" . number_format(Tracks::get_total_tracks()) . "</dd>\n\t\t<dt>Artists</dt>\n\t\t<dd>" . number_format(Artists::count()) . "</dd>\n\t\t<dt>Albums</dt>\n\t\t<dd>" . number_format(Albums::count()) . "</dd>\n\t</dl>"; function bytes($a) { $unim = array("B", "KB", "MB", "GB", "TB", "PB"); $c = 0; while ($a >= 1024) { $c++; $a = $a / 1024; } return number_format($a, $c ? 2 : 0, ".", ",") . " " . $unim[$c]; } $return .= "\n\t<h4>Archive Storage</h4>\n\t<dl>"; foreach (Archives::get_all() as $archive) { $pc = (int) (100 - $archive->get_free_space() / $archive->get_total_space() * 100); if ($archive->get_free_space() > 536870912000.0) { $colour = "success"; } else { if ($archive->get_free_space() > 214748364800.0) { $colour = "warning"; } else { $colour = "danger"; } } $return .= "\n\t\t<dt>" . $archive->get_name() . "</dt>\n\t\t<dd><div class=\"progress\" style=\"margin: 3px 0px; \"><div class=\"progress-bar progress-bar-" . $colour . "\" style=\"width: " . $pc . "%;\"></div></div></dd>\n\t\t<dd>" . bytes($archive->get_free_space()) . " free of " . bytes($archive->get_total_space()) . "</dd>"; } $return .= "</dl>"; return $return; }
$arcids = explode('`',$qstr); $arc = ""; $j = 0; $okids = Array(); foreach($arcids as $arcid){ $arcid = ereg_replace('[^0-9]','',$arcid); $tables = GetChannelTable($dsql,$arcid,'arc'); if($tables['channelid']==$typeInfos['channeltype']) { $dsql->ExecuteNoneQuery("Update `{$tables['maintable']}` Set typeid='$targetTypeid' where ID='$arcid' "); $dsql->ExecuteNoneQuery("Update `{$tables['addtable']}` Set typeid='$targetTypeid' where aid='$arcid' "); $dsql->ExecuteNoneQuery("Update `#@__full_search` Set typeid='$targetTypeid' where aid='$arcid' "); $okids[] = $arcid; $j++; } } //更新HTML require_once(DEDEADMIN."/../include/inc_archives_view.php"); foreach($okids as $aid){ $arc = new Archives($aid); $arc->MakeHtml(); } $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `{$tables['maintable']}`; "); $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__full_search`; "); $dsql->Close(); if(is_object($arc)) $arc->Close(); ShowMsg("成功移动 $j 个文档!",$ENV_GOBACK_URL); exit(); } } ?>
} if ($cfg_remote_site == 'Y' && $isremote == "1") { if ($serviterm != "") { list($servurl, $servuser, $servpwd) = explode(',', $serviterm); $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE'); } else { $config = array(); } if (!$ftp->connect($config)) { exit('Error:None FTP Connection!'); } } while ($row = $dsql->GetObject('out')) { $tjnum++; $id = $row->id; $ac = new Archives($id); $rurl = $ac->MakeHtml($isremote); } $t2 = ExecTime(); $t2 = $t2 - $est1; $ttime = time() - $sstime; $ttime = number_format($ttime / 60, 2); //返回提示信息 $tjlen = $totalnum > 0 ? ceil($tjnum / $totalnum * 100) : 100; $dvlen = $tjlen * 2; $tjsta = "<div style='width:200;height:15;border:1px solid #898989;text-align:left'><div style='width:{$dvlen};height:15;background-color:#829D83'></div></div>"; if ($cfg_remote_site == 'Y' && $isremote == "1") { $tjsta .= "<br/><font color='red'>您已开启远程发布功能,生成速度会比较慢,请您耐心等待..</font>"; } $tjsta .= "<br/>本次用时:" . number_format($t2, 2) . ",总用时:{$ttime} 分钟,到达位置:" . ($startdd + $pagesize) . "<br/>完成创建文件总数的:{$tjlen} %,继续执行任务..."; //速度测试
public function get_archive() { return Archives::get($this->archive); }
/** * 创建指定ID的文档 * * @access public * @param string $aid 文档ID * @param string $ismakesign 生成标志 * @param int $isremote 是否远程 * @return string */ function MakeArt($aid, $mkindex = FALSE, $ismakesign = FALSE, $isremote = 0) { global $envs, $typeid; require_once DEDEINC . '/arc.archives.class.php'; if ($ismakesign) { $envs['makesign'] = 'yes'; } $arc = new Archives($aid); $reurl = $arc->MakeHtml($isremote); return $reurl; }
$AddSql = str_replace('@aid@', $aid, $AddSql); $MaiSql = ereg_replace('@([a-z0-9]{1,})@', '', $MaiSql); $AddSql = ereg_replace('@([a-z0-9]{1,})@', '', $AddSql); if (!$dsql->ExecuteNoneQuery($MaiSql)) { $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='{$aid}' "); } else { if (!$dsql->ExecuteNoneQuery($AddSql)) { $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='{$aid}' "); $dsql->ExecuteNoneQuery("Delete From `{$Maitable}` where id='{$aid}' "); } else { if ($make) { require_once DEDEINC . "/arc.archives.class.php"; $ac = new Archives($aid); $rurl = $ac->MakeHtml(); $ac->Close(); $ac = new Archives($aid - 1); $rurl = $ac->MakeHtml(); $ac->Close(); $dsql->ExecuteNoneQuery("Update `#@__co_note` set cotime='" . time() . "' where nid='{$nid}'; "); } //更新数据 $row = $dsql->GetOne("SELECT a.id,a.title,a.click,a.typeid,b.body,c.typename,c.zuozhe,c.bookclick,c.bookclickm,c.bookclickw,c.tuijian,c.tuijianm,c.tuijianw,c.booksize,c.lastclick,c.lasttuijian,c.startdate,c.reid,d.typename as retypename FROM `{$Maitable}` a left join `{$Addtable}` b on(a.id=b.aid) left join `#@__arctype` c on(a.typeid=c.id) left join `#@__arctype` d on(c.reid=d.id) WHERE a.id='{$aid}'"); if ($row) { $txt_filename = $row['zuozhe'] . "-" . $row['typename']; $typename = $row['typename']; $txt_comtens = ""; $startdatesql = ""; $txt_title = $row['title']; $treid = $row['reid']; $tretypename = $row['retypename']; $updatetime = time();
function MakeArt($aid,$checkLike=false) { include_once(dirname(__FILE__)."/../../include/inc_archives_view.php"); $arc = new Archives($aid); $reurl = $arc->MakeHtml(); return $reurl; }
$limitSql = " limit $startdd,$pagesize"; $nlimit = 1; }else{ $limitSql = " limit $startdd,{$nlimit}"; } $tjnum = $startdd; if($nlimit>0) { $dsql->SetQuery("Select aid as ID From `#@__full_search` $gwhere $limitSql"); $dsql->Execute(); while($row=$dsql->GetObject()) { $tjnum++; $ID = $row->ID; $ac = new Archives($ID); if(!$ac->IsError){ $rurl = $ac->MakeHtml(); }else{ echo "文档: $ID 错误!<br />\r\n"; $rurl = ''; } } } $t2 = ExecTime(); $t2 = ($t2 - $t1); //返回提示信息 if($totalnum>0) $tjlen = ceil( ($tjnum/$totalnum) * 100 ); else $tjlen=100;
/** * 创建指定ID的文档 * * @param int $aid * @param bool $ismakesign * @return string */ function MakeArt($aid, $ismakesign = FALSE) { global $cfg_makeindex, $cfg_basedir, $cfg_templets_dir, $cfg_df_style; include_once DEDEINC . '/arc.archives.class.php'; if ($ismakesign) { $envs['makesign'] = 'yes'; } $arc = new Archives($aid); $reurl = $arc->MakeHtml(); if (isset($typeid)) { $preRow = $arc->dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<{$aid} AND arcrank>-1 AND typeid='{$typeid}' order by id desc"); $nextRow = $arc->dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>{$aid} AND arcrank>-1 AND typeid='{$typeid}' order by id asc"); if (is_array($preRow)) { $arc = new Archives($preRow['id']); $arc->MakeHtml(); } if (is_array($nextRow)) { $arc = new Archives($nextRow['id']); $arc->MakeHtml(); } } return $reurl; }
/** * 将文章和评论内容同步到多说,用于以前的评论显示和垃圾评论过滤 */ public function export() { global $dsql; @set_time_limit(0); @ini_set('memory_limit', '256M'); @ini_set('display_errors', $this->getOption('debug')); $progress = $this->getOption('synchronized'); if (!$progress || is_numeric($progress)) { // 之前已经完成了导出流程 $progress = 'thread/0'; } list($type, $offset) = explode('/', $progress); try { switch ($type) { case 'thread': $limit = 10; $dsql->SetQuery("SELECT aid FROM `#@__feedback` where `aid` > {$offset} group by aid order by aid asc limit {$limit}"); $dsql->Execute(); $aidArray = array(); while ($row = $dsql->GetArray()) { $aidArray[] = $row['aid']; } if (count($aidArray) > 0) { $aids = implode(',', $aidArray); $dsql->SetQuery("SELECT * FROM `#@__archives` where `id` in ({$aids})"); $dsql->Execute(); $threads = array(); while ($row = $dsql->GetArray()) { $arc = new Archives($row['id']); $arc->Fields['arcurl'] = $arc->GetTrueUrl(null); $threads[] = $arc->Fields; } $count = $this->exportThreads($threads); $maxid = $aidArray[count($aidArray) - 1]; } else { $count = 0; } break; case 'post': $limit = 50; $dsql->SetQuery("SELECT cid FROM `duoshuo_commentmeta` group by cid"); $dsql->Execute(); $cidFromDuoshuo = array(); while ($row = $dsql->GetArray()) { $cidFromDuoshuo[] = $row['cid']; } $dsql->SetQuery("SELECT * FROM `#@__feedback` order by id asc limit {$offset},{$limit} "); $dsql->Execute(); $comments = array(); while ($row = $dsql->GetArray()) { $comments[] = $row; } $count = $this->exportPosts($comments, $cidFromDuoshuo); break; default: } if ($count == $limit) { switch ($type) { case 'thread': $progress = $type . '/' . $maxid; break; case 'post': $progress = $type . '/' . ($offset + $limit); break; } } elseif ($type == 'thread') { $progress = 'post/0'; } elseif ($type == 'post') { $progress = time(); } $this->updateOption('synchronized', $progress); $response = array('progress' => $progress, 'code' => 0); return $response; } catch (Duoshuo_Exception $e) { $this->updateOption('synchronized', $progress); $this->sendException($e); } }
public static function get_playin() { return Archives::get_by_name(Configs::get_system_param("playin_archive")); }
require_once DEDEINC . '/arc.archives.class.php'; $t1 = ExecTime(); if (empty($okview)) { $okview = ''; } if (isset($arcID)) { $aid = $arcID; } if (!isset($dopost)) { $dopost = ''; } $arcID = $aid = isset($aid) && is_numeric($aid) ? $aid : 0; if ($aid == 0) { die(" Request Error! "); } $arc = new Archives($aid); if ($arc->IsError) { ParamError(); } //检查阅读权限 $needMoney = $arc->Fields['money']; $needRank = $arc->Fields['arcrank']; require_once DEDEINC . '/memberlogin.class.php'; $cfg_ml = new MemberLogin(); if ($needRank < 0 && $arc->Fields['mid'] != $cfg_ml->M_ID) { ShowMsg('文章尚未审核,非作者本人无权查看!', 'javascript:;'); exit; } //设置了权限限制的文章 //arctitle msgtitle moremsg if ($needMoney > 0 || $needRank > 1) {
public function index() { //Get the Earliest Disbursement Date and the Earliest Archive Date. Do the neccesary! $earliest_disbursement_date = Disbursements::getEarliestDisbursement(); $earliest_archive_date = Archive_Logs::getEarliestArchive(); if ($earliest_archive_date == null) { $earliest_archive_date = date('m/d/Y'); } $split_disbursement_date = explode('/', $earliest_disbursement_date); $split_archive_date = explode('/', $earliest_archive_date); var_dump($split_disbursement_date); var_dump($split_archive_date); $total_months = $split_archive_date[0] - $split_disbursement_date[0] + ($split_archive_date[2] - $split_disbursement_date[2]) * 12; $dates_to_archive = array(); for ($archive_month = 0; $archive_month < $total_months; $archive_month++) { $expected_month = $archive_month + $split_disbursement_date[0]; $year = $split_disbursement_date[2]; //echo $expected_month." and ".$year; if ($expected_month > 12) { $year += ceil(($expected_month - 12) / 12); $expected_month -= 12; } $archive_date = $expected_month . "/15/" . $year; $dates_to_archive[$archive_month] = $archive_date; } var_dump($dates_to_archive); //foreach($dates_to_archive as $date_to_archive){ //Check if this date's archive has been done. If not do it now! $expected_archive_date = "6/15/2011"; $expected_archive_timestamp = strtotime($expected_archive_date); $archive_exists = Archive_Logs::archiveExists($expected_archive_date); if (!$archive_exists) { echo "Creating Archive!"; //Loop through all vaccines $vaccines = Vaccines::getAll(); $regions = Regions::getAllRegions(); $districts = Districts::getAllDistricts(); foreach ($vaccines as $vaccine) { //National Archive First $national_archive = new Archives(); $national_archive->National_Store = "0"; $national_archive->Stock_At_Hand = Disbursements::getNationalStockAtHand($vaccine->id, $expected_archive_timestamp); $national_archive->Date_Of_Archive = $expected_archive_date; $national_archive->Vaccine_Id = $vaccine->id; $national_archive->save(); //Do archives for all the regions foreach ($regions as $region) { $regional_archive = new Archives(); $regional_archive->Regional_Store_Id = $region->id; $regional_archive->Stock_At_Hand = Disbursements::getRegionalStockAtHand($region->id, $vaccine->id, $expected_archive_timestamp); $regional_archive->Date_Of_Archive = $expected_archive_date; $regional_archive->Vaccine_Id = $vaccine->id; $regional_archive->save(); } //Do archives for all the districts. :-( foreach ($districts as $district) { $district_archive = new Archives(); $district_archive->District_Store_Id = $district->id; $district_archive->Stock_At_Hand = Disbursements::getDistrictStockAtHand($district->id, $vaccine->id, $expected_archive_timestamp); $district_archive->Date_Of_Archive = $expected_archive_date; $district_archive->Vaccine_Id = $vaccine->id; $district_archive->save(); } } $archive_log = new Archive_Logs(); $archive_log->Archive_Date = $expected_archive_date; $archive_log->Timestamp = date('U'); $archive_log->Save(); } else { echo "This archive already exists!"; } //} }
//更新上一篇和下一篇 function makeprenext() { } ******************************/ if ($dopost == 'makeprenext') { require_once DEDEINC . '/arc.archives.class.php'; $aid = intval($aid); $preRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<{$aid} AND arcrank>-1 AND typeid='{$typeid}' ORDER BY id DESC"); $nextRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>{$aid} AND arcrank>-1 AND typeid='{$typeid}' ORDER BY id ASC"); if (is_array($preRow)) { $envs['aid'] = $preRow['id']; $arc = new Archives($preRow['id']); $arc->MakeHtml(); } if (is_array($nextRow)) { $envs['aid'] = $nextRow['id']; $arc = new Archives($nextRow['id']); $arc->MakeHtml(); } if (empty($nextdo)) { ShowMsg("<b>完成上下篇文档更新任务!完成所有更新任务!</b>", "close::tgtable"); exit; } else { $jumpurl = GetNextUrl(); ShowMsg("完成下篇文档更新任务! 继续执行其它任务...", $jumpurl, 0, 500); exit; } } /****************************** //更新主页的任务 function makeindex() { } ******************************/
function MakeArt($aid,$mkindex=true,$upcache=true) { global $cfg_makeindex,$cfg_basedir,$cfg_templets_dir,$cfg_df_style,$cfg_up_prenext,$typeid,$envs,$typeid; include_once(DEDEADMIN."/../include/inc_archives_view.php"); if(!$upcache) $envs['nocache'] = true; $arc = new Archives($aid); $reurl = $arc->MakeHtml(); if($mkindex) { //更新上下篇文章 if($cfg_up_prenext=='Y' && !empty($typeid)) { $preRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID<$aid And ID>".($aid-1000)." And arcrank>-1 And typeid='$typeid' order by ID desc"); $nextRow = $arc->dsql->GetOne("Select ID From `{$arc->MainTable}` where ID>$aid And ID<".($aid+1000)." And arcrank>-1 And typeid='$typeid' order by ID asc"); if(is_array($preRow)){ $arc = new Archives($preRow['ID']); $arc->MakeHtml(); } if(is_array($nextRow)){ $arc = new Archives($nextRow['ID']); $arc->MakeHtml(); } } //更新主页 if($cfg_makeindex=='Y') { $pv = new PartView(); $row = $pv->dsql->GetOne("Select * From #@__homepageset"); $templet = str_replace("{style}",$cfg_df_style,$row['templet']); $homeFile = dirname(__FILE__)."/../".$row['position']; $homeFile = str_replace("\\","/",$homeFile); $homeFile = str_replace("//","/",$homeFile); $fp = fopen($homeFile,"w") or die("主页文件:{$homeFile} 没有写权限!"); fclose($fp); $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); $pv->SaveToHtml($homeFile); } } return $reurl; }
<?php if (!Session::is_group_user("Importer")) { Output::http_error(403); } else { if (!isset($_REQUEST["filename"])) { die(json_encode(array("error" => "invalid input file"))); } $uploaded_file = utf8_decode(FILE_ROOT . "uploads/" . $_REQUEST["filename"]); if (!isset($_REQUEST["type"])) { $_REQUEST["type"] = "music"; } if (!isset($_REQUEST["title"]) || $_REQUEST["title"] === "") { die(json_encode(array("error" => "You must specify a title"))); } $current_archive = Archives::get_playin(); $path = is_dir($current_archive->get_localpath()) ? $current_archive->get_localpath() : (is_dir($current_archive->get_remotepath()) ? $current_archive->get_remotepath() : die(json_encode(array('error' => 'Playin archive inaccessible')))); if (!is_writable($path)) { die(json_encode(array("error" => "Audio archive is not writable"))); } $tempfile = tempnam(sys_get_temp_dir(), 'dps') . "." . pathinfo($uploaded_file, PATHINFO_EXTENSION); copy($uploaded_file, $tempfile); $md5 = md5_file($tempfile); $output = array(); # Execute SoX to convert our audio # Trim silence from beginning and end (1% volume threshold) # Convert to 44.1kHz 16-bit stereo for consistency # Normalise to -0.1dB # Save as flac in inbox exec("sox \"" . $tempfile . "\" -b 16 \"" . $path . "/inbox/" . $md5 . ".flac\" silence 1 0.1 -72d reverse silence 1 0.1 -72d reverse channels 2 rate 44100 gain -n -0.1 2>&1", $output); if (strpos(implode($output), "FAIL")) {