=register globalss,pagenumber放到textbox中怎么用

C#使用iTextSharp从PDF文档获取内容的方法
作者:红薯
字体:[ ] 类型:转载 时间:
这篇文章主要介绍了C#使用iTextSharp从PDF文档获取内容的方法,涉及C#基于iTextSharp操作pdf文件的相关技巧,需要的朋友可以参考下
本文实例讲述了C#使用iTextSharp从PDF文档获取内容的方法。分享给大家供大家参考。具体实现方法如下:
using System.Collections.G
using System.D
using System.D
using System.L
using System.T
using System.Windows.F
using iTextSharp.text.
using iTextSharp.text.pdf.
namespace WindowsFormsApplication1
public partial class Form1 : Form
public Form1()
InitializeComponent();
ExtractTextFromPDFPage("c:\sample.pdf", 1);
public void ExtractTextFromPDFPage(string pdfFile, int pageNumber)
PdfReader reader = new PdfReader(pdfFile);
string text = PdfTextExtractor.GetTextFromPage(reader, pageNumber);
try { reader.Close(); }
richTextBox1.Text =
希望本文所述对大家的C#程序设计有所帮助。
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具org.apache.pdfbox.util: PDFTextStripper.java
» org.apache.pdfbox.util »
[ | source]
19 & import ;
20 & import ;
22 & import ;
23 & import ;
24 & import ;
25 & import ;
26 & import ;
27 & import ;
28 & import ;
29 & import ;
32 & import ;
33 & import ;
34 & import ;
35 & import ;
36 & import ;
37 & import ;
38 & import ;
39 & import ;
40 & import ;
* This class will take a pdf document and strip out all of the text and ignore the
* formatting and such.
P it is up to clients of this class to verify that
* a specific user has the correct permissions to extract text from the
* PDF document.
* The basic flow of this process is that we get a document and use a series of
» org.apache.pdfbox.util »
[ | source]application
application.ini
controllers
index.phtml
addarticle.phtml
addl.phtml
addtags.phtml
addtype.phtml
article.phtml
atype.phtml
config.phtml
deam.phtml
edi1t.phtml
edit.phtml
editadmin.phtml
index.phtml
links.phtml
list.phtml
master.phtml
pageStyle.phtml
tags.phtml
welcome.phtml
download.phtml
index.phtml
success.phtml
index.phtml
index.phtml
error.phtml
captcha.phtml
captcha1.phtml
index.phtml
login.phtml
logout.phtml
uname.phtml
index.phtml
success.phtml
footer.phtml
header.phtml
index.phtml
right.phtml
index.phtml
index.phtml
page.phtml
index.html
67aa4e6d2bf9bb2e71c7.png
1c4adcedbfb4c.png
b565b0f0aa3c2.png
3382ebe92d5a1d54295d40.png
a260b49c907.png
38c9aa74d5ae4ff000c30.png
392bf1cd3a2ec5eb73db5fa.png
518b1b3ddbceff6617155dabeccbff0a.png
6ada11d0175be70dcb6d1eee3c61f415.png
8d35fea09de0c325a7efae.png
93ac54e3c85d7d160a36ab.png
993b311de0a78f29b4505.png
9feba30e1ad826fa788b.png
bdcc1b5c76.png
ca043dfd60fdacf27fb8a2e8a9a96913.png
cf4c34deca18f608e2c4b665.png
fdccf82a0ba7f2bc37bc94.png
Application
ZendServer
CodeGenerator
Controller
AutoComplete
HelperBroker
Dispatcher
DiffieHellman
BigInteger
Pubsubhubbub
Subscriber
Collection
CreativeCommons
DublinCore
Syndication
WellFormedWeb
DublinCore
WellFormedWeb
DublinCore
Spreadsheets
EncryptedData
Controller
Collection
AttributeType
ObjectClass
Autoloader
PluginLoader
aa_ER_SAAHO.xml
az_Cyrl.xml
az_Cyrl_AZ.xml
az_Latn.xml
az_Latn_AZ.xml
byn_ER.xml
cch_NG.xml
characters.xml
el_POLYTON.xml
en_Dsrt.xml
en_Dsrt_US.xml
en_Shaw.xml
en_US_POSIX.xml
fil_PH.xml
fur_IT.xml
gaa_GH.xml
gez_ER.xml
gez_ET.xml
gsw_CH.xml
haw_US.xml
ha_Arab.xml
ha_Arab_NG.xml
ha_Arab_SD.xml
ha_Latn.xml
ha_Latn_GH.xml
ha_Latn_NE.xml
ha_Latn_NG.xml
hy_AM_REVISED.xml
kaj_NG.xml
kam_KE.xml
kcg_NG.xml
kfo_CI.xml
kk_Cyrl.xml
kk_Cyrl_KZ.xml
kok_IN.xml
kpe_GN.xml
kpe_LR.xml
ku_Arab.xml
ku_Arab_IQ.xml
ku_Arab_IR.xml
ku_Arab_SY.xml
ku_Latn.xml
ku_Latn_TR.xml
likelySubtags.xml
metazoneInfo.xml
mn_Cyrl.xml
mn_Cyrl_MN.xml
mn_Mong.xml
mn_Mong_CN.xml
nds_DE.xml
nso_ZA.xml
numberingSystems.xml
pa_Arab.xml
pa_Arab_PK.xml
pa_Guru.xml
pa_Guru_IN.xml
postalCodeData.xml
sid_ET.xml
sr_Cyrl.xml
sr_Cyrl_BA.xml
sr_Cyrl_CS.xml
sr_Cyrl_ME.xml
sr_Cyrl_RS.xml
sr_Cyrl_YU.xml
sr_Latn.xml
sr_Latn_BA.xml
sr_Latn_CS.xml
sr_Latn_ME.xml
sr_Latn_RS.xml
sr_Latn_YU.xml
supplementalData.xml
syr_SY.xml
telephoneCodeData.xml
tg_Cyrl.xml
tg_Cyrl_TJ.xml
tig_ER.xml
trv_TW.xml
ug_Arab.xml
ug_Arab_CN.xml
uz_Arab.xml
uz_Arab_AF.xml
uz_Cyrl.xml
uz_Cyrl_UZ.xml
uz_Latn.xml
uz_Latn_UZ.xml
wal_ET.xml
wo_Latn.xml
wo_Latn_SN.xml
zh_Hans.xml
zh_Hans_CN.xml
zh_Hans_HK.xml
zh_Hans_MO.xml
zh_Hans_SG.xml
zh_Hant.xml
zh_Hant_HK.xml
zh_Hant_MO.xml
zh_Hant_TW.xml
Navigation
ScrollingStyle
Annotation
ByteEncoding
Destination
ElementFactory
FileParser
FileParserDataSource
Compression
ProgressBar
postgresql.sql
queue_sqlite.sql
Reflection
TokenFilter
SegmentWriter
TermsStream
Highlighter
Preprocessing
QueryEntry
Similarity
Serializer
Reflection
DeveloperGarden
BaseUserService
ConferenceCall
IpLocation
LocalSearch
BaseUserService
ConferenceCall
IpLocation
LocalSearch
SmsValidation
VoiceButler
BaseUserService
ConferenceCall
IpLocation
LocalSearch
SecurityTokenServer
SmsValidation
VoiceButler
SecurityTokenServer
ccsPort.wsdl
ccsPort.xsd
IPLocation.wsdl
IPLocation.xsd
localsearch.wsdl
localsearch.xsd
ODGBaseUserService.wsdl
ODGBaseUserService.xsd
SmsService.wsdl
SmsValidationUserService.wsdl
TokenService.wsdl
VoiceButlerService.wsdl
VoiceButlerService.xsd
SlideShare
StrikeIron
Technorati
WindowsAzure
Credentials
RetryPolicy
SaveHandler
AutoDiscover
Constraint
zend-framework.flf
ResponseDecorator
Interactive
ContentDecorator
IncludePathLoader
Filesystem
FileParser
Navigation
Placeholder
2dfc5c9ddec763.png
75a93af2caa6c99aebae3.png
9d92da09bace1e.png
db276aa09c9ed17d3a2d1b02181b8acd.png
closelabel.gif
favicon.ico
loading.gif
onCorrect.gif
onError.gif
onFocus.gif
onLoad.gif
onShow.gif
onSuccess.gif
shadow.gif
dwsync.xml
kindeditor
advtable.html
file_manager
file-16.gif
file-64.gif
folder-16.gif
folder-64.gif
file_manager.css
file_manager.html
align_left.gif
align_right.gif
align_top.gif
refresh.gif
image.html
about.html
flash.html
media.html
plainpaste.html
wordpaste.html
editor.css
loading.gif
default.gif
default.css
license.txt
dwsync.xml
clipboard.swf
icon.hover.gif
menuBg.gif
menuItem.gif
menuTitle.gif
menuTitle.hover.gif
titleBg.gif
titleBg2.gif
title_01.gif
title_03.gif
title_05.gif
title_07.gif
title_08.gif
title_10.gif
dwsync.xml
calendar-green.gif
calendar.gif
highLight.png
dwsync.xml
black.skin.css
common.css
datepick.css
facebox.css
faceplant.css
layout.css
msyhbd.ttf
SyntaxHighlighter.css
tidymode.css
validator.css
validatorAuto.css
validatorTidyMode.css
Uncompressed
1z4TZBGnFkXzisqw11wX_13.png
21_98809.png
44_43731.png
19_85202.jpg
2hhDcDlQtA3PnSuBuPDm_17.gif
5Kgqy7Q1jdNfYBhvk6V6_10.jpg
7Itdu24pCYPGZ5a4bmaQ_31.png
c4BNJwSnY5lDGOFSsr0D_17.png
fPQes93fNgdUbp7lLNpD_18.gif
H7uFGCahKpvqgxWvkfx4_37.gif
ipwF42T6ELLLYbrLE7Uo_17.png
K9dEHS2jZ6qT8cNsahhD_18.png
rdk415F9u58enwZ3j4hm_17.gif
WnY5U6avqc9N0E9sOzon_37.zip
XL2Wu99MOE1PNPx15FbN_55.png
devcom_54dev.zip
readme.txt
class AdminController extends Zend_Controller_Action{
public function init(){
$admin = new Zend_Session_Namespace('adminSession');
if(empty($admin-&code)){
$this-&_redirect('/login');
public function indexAction(){
/*$Ne = new Model_DbTable_News();
$page = $this-&_getParam('page');
$size = 3;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$array = $Ne-&getAll();
$paginator = Zend_Paginator::factory($array);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator
public function masterAction(){
#绠$悊鍛樺垪琛?
$Mt = new Model_DbTable_Admin();
$page = $this-&_getParam('page');
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$all = $Mt-&getAll();
$paginator = Zend_Paginator::factory($all);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
public function editadminAction(){
#缂栬緫绠$悊鍛?
$Mt = new Model_DbTable_Admin();
if($this-&getRequest()-&isPost()){
$id = $this-&getRequest()-&getPost('id');
$name = $this-&getRequest()-&getPost('name');
$pwd = md5($this-&getRequest()-&getPost('pwd'));
if(!empty($id)){
$Mt-&change($id,$pwd);
$Mt-&add($name,$pwd);
$this-&_redirect('admin/master');
$id = $this-&_getParam('id');
if(isset($id)){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$this-&view-&m = $Mt-&getId($id);
public function delmtAction(){
#鍒犻櫎涓EUR涓??鐞嗗憳
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Mt = new Model_DbTable_Admin();
$Mt-&del($id);
$this-&_redirect('admin/master');
public function deladminAction(){
#鍒犻櫎澶氫釜绠$悊鍛?
$id = $this-&getRequest()-&getPost('id');
$Mt = new Model_DbTable_Admin();
$Mt-&delm($id);
$this-&_redirect('admin/master');
public function articleAction(){
#鏂囩珷鍒楄〃
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$page = $this-&_getParam('page');
$size = 10;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$Ar = new Model_DbTable_Article();
$type = $Ar-&getAll($id);
$paginator = Zend_Paginator::factory($type);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
#鐢熸垚鏂囦欢鍚?
private function randCharsAction($picName,$len=20)
$pos = strrpos($picName,'.');
$ext = substr($picName,$pos);
$chars = array( &a&,&b&,&c&,&d&,&e&,&f&,&g&,&h&,&i&,&j&,&k&,
&l&,&m&,&n&,&o&,&p&,&q&,&r&,&s&,&t&,&u&,&v&,
&w&,&x&,&y&,&z&,&A&,&B&,&C&,&D&,&E&,&F&,&G&,
&H&,&I&,&J&,&K&,&L&,&M&,&N&,&O&,&P&,&Q&,&R&,
&S&,&T&,&U&,&V&,&W&,&X&,&Y&,&Z&,&0&,&1&,&2&,
&3&,&4&,&5&,&6&,&7&,&8&,&9& );
$charsLen = count($chars) - 1;
shuffle($chars);
// 灏嗘暟缁勬墦涔?
$output = '';
for ($i=0; $i&$ $i++)
$output .= $chars[mt_rand(0, $charsLen)];
$output .= '_'.date(&YmdHsi&);
return $output.$
public function addarticleAction(){
#娣诲姞鏂囩珷
$At = new Model_DbTable_Atype();
$Ta = new Model_DbTable_Tags();
if($this-&getRequest()-&isPost()){
$title = $this-&getRequest()-&getPost('title');
$tag = implode(',',$this-&getRequest()-&getPost('tag'));
$tags = $this-&getRequest()-&getPost('tag');
$type = $this-&getRequest()-&getPost('type');
$content = StripSlashes($this-&getRequest()-&getPost('content'));
$code = StripSlashes($this-&getRequest()-&getPost('code'));
$uppic = new Zend_File_Transfer_Adapter_Http();
$fileinfo = $uppic-&getFileInfo();
$uppic-&addValidator('Extension',false,'jpg,jpeg,png,gif,bmp,zip,rar')
-&addValidator('Size',false,)
-&addValidator('Count',false,array('min'=&1,'max'=&100));
if(count($fileinfo) &= 2){
#澶氭枃浠朵笂浼?
$pathArr = array();
foreach($fileinfo as $key =& $up){
$upn = '';
$upn = $this-&randCharsAction($up['name']);
$target = BOOT_PATH.'/public/uploads/'.$
move_uploaded_file($up['tmp_name'],$target);
$pathArr[$key] = '/public/uploads/'.$
}elseif(!empty($fileinfo)){
#涓EUR涓?枃浠朵笂浼?
foreach($fileinfo as $up){
$upn = '';
$upn = $this-&randCharsAction($up['name']);
$target = BOOT_PATH.'/public/uploads/'.$
$uppic-&addFilter('Rename',array('source'=&$up['tmp_name'],'target'=&$target,'overwrite'=&true));
if(!$uppic-&receive()){
var_dump($uppic-&getMessages());
$pathArr = '/public/uploads/'.$
#var_dump($pathArr);
if(is_array($pathArr)){
$pic = $pathArr['pic'];
$annex = $pathArr['annex'];
$ext = substr($pathArr,strrpos($pathArr,'.')+1);
$pict = array('jpg','jpeg','png','gif','bmp');
$annext = array('zip','rar');
if(in_array($ext,$pict)){
$pic = $pathA
}elseif(in_array($ext,$annext)){
$annex = $pathA
$Ar = new Model_DbTable_Article();
$aid = $Ar-&add($title,$content,$tag,$pic,$annex,$type,$code);
#var_dump($tags);
$Tr = new Model_DbTable_Trelated();
if(count($tags) & 1){
foreach($tags as $t){
$Tr-&add($t,$aid);
}elseif(count($tags) == 1){
$Tr-&add($tags[0],$aid);
$this-&_redirect('admin/article/id/'.$type);
$this-&view-&t = $Ta-&getAll();
$this-&view-&type = $At-&getAll();
public function eaAction(){
#缂栬緫鏂囩珷
$Ar = new Model_DbTable_Article();
$At = new Model_DbTable_Atype();
$Ta = new Model_DbTable_Tags();
$Tr = new Model_DbTable_Trelated();
if($this-&getRequest()-&isPost()){
$id = $this-&getRequest()-&getPost('id');
$title = $this-&getRequest()-&getPost('title');
$tag = implode(',',$this-&getRequest()-&getPost('tag'));
$tags = $this-&getRequest()-&getPost('tag');
$type = $this-&getRequest()-&getPost('type');
$content = StripSlashes($this-&getRequest()-&getPost('content'));
$code = StripSlashes($this-&getRequest()-&getPost('code'));
if(!empty($_FILES)){
$up = new Zend_File_Transfer_Adapter_Http();
$fileinfo = $up-&getFileInfo();
$up-&addValidator('Extension',false,'jpg,jpeg,png,gif,bmp,zip,rar')
-&addValidator('Size',false,)
-&addValidator('Count',false,array('min'=&count($fileinfo),'max'=&100));
if(count($fileinfo) &= 2){
$pathArr = array();
foreach($fileinfo as $k =& $u){
$n = $this-&randCharsAction($u['name']);
$target = BOOT_PATH.'/public/uploads/'.$n;
move_uploaded_file($u['tmp_name'],$target);
$pathArr[$key] = '/public/uploads/'.$n;
}elseif(!empty($fileinfo)){
foreach($fileinfo as $u){
$n = $this-&randCharsAction($u['name']);
$target = BOOT_PATH.'/public/uploads/'.$n;
$up-&addFilter('Rename',array('source'=&$u['tmp_name'],'target'=&$target,'overwrite'=&true));
if(!$up-&receive()){
var_dump($up-&getMessages());
$pathArr = '/public/uploads/'.$n;
var_dump($pathArr);
#var_dump($pathArr);
if(is_array($pathArr)){
$pic = $pathArr['pic'];
$annex = $pathArr['annex'];
$ext = substr($pathArr,strrpos($pathArr,'.')+1);
$pict = array('jpg','jpeg','png','gif','bmp');
$annext = array('zip','rar');
if(in_array($ext,$pict)){
$pic = $pathA
}elseif(in_array($ext,$annext)){
$annex = $pathA
#鍒犻櫎鍘熸潵鏍囩?
$arr = $Tr-&getByaid($id);
if(count($arr) & 1){
for($i=0;$i&count($arr);$i++){
$Tr-&del($arr[$i]['id']);
$Tr-&del($arr[0]['id']);
#閲嶆柊鎻掑叆鏍囩?
if(count($tags) & 1){
foreach($tags as $t){
$Tr-&add($t,$id);
}elseif(count($tags) == 1){
$Tr-&add($tags[0],$id);
$Ar-&updatea($id,$title,$content,$tag,$pic,$annex,$type,$code);
$this-&_redirect('admin/article/id/'.$type);
#var_dump($_REQUEST);
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$this-&view-&ar = $Ar-&getId($id);
$this-&view-&type = $At-&getAll();
$this-&view-&t = $Ta-&getAll();
public function deaAction(){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Ar = new Model_DbTable_Article();
$Co = new Model_DbTable_Comment();
$Tr = new Model_DbTable_Trelated();
$t = $Ar-&getId($id);
$Ar-&del($id);
$Co-&delaid($id);
$Tr-&delaid($id);
$this-&_redirect('admin/article/id/'.$t['type']);
public function deamAction(){
$id = $this-&getRequest()-&getPost('id');
$Ar = new Model_DbTable_Article();
$t = $Ar-&getId($id[0]);
$Ar-&delmore($id);
$this-&_redirect('admin/article/id/'.$t['type']);
public function atypeAction(){
#鍒嗙被鍒楄〃
$page = $this-&_getParam('page');
$size = 10;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$At = new Model_DbTable_Atype();
$all = $At-&getAll();
$paginator = Zend_Paginator::factory($all);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
public function addtypeAction(){
#鏂板?鍒嗙被
$At = new Model_DbTable_Atype();
if($this-&getRequest()-&isPost()){
$name = $this-&getRequest()-&getPost('name');
$fid = $this-&getRequest()-&getPost('fid');
if($At-&add($name,$fid)){
$this-&_redirect('/admin/addtype/');
echo 'Error';
$this-&view-&type = $At-&getAll();
public function dtAction(){
#鍒犻櫎涓EUR涓?
$id = is_numeric($this-&_getParam('id')) ? (int)$this-&_getParam('id') : exit();
$At = new Model_DbTable_Atype();
$At-&del($id);
$this-&_redirect('/admin/atype');
public function dtmAction(){
$aa = $this-&getRequest()-&getPost('id');
$At = new Model_DbTable_Atype();
$At-&delmore($aa);
$this-&_redirect('/admin/atype');
public function etAction(){
$At = new Model_DbTable_Atype();
$id = is_numeric($this-&_getParam('id')) ? (int)$this-&_getParam('id') : exit();
if($this-&getRequest()-&isPost()){
$name = $this-&getRequest()-&getPost('name');
$fid = $this-&getRequest()-&getPost('fid');
$At-&updatea($id,$name,$fid);
$this-&_redirect('/admin/atype');
$this-&view-&type = $At-&getAll();
$this-&view-&et = $At-&getId($id);
public function msgAction(){
#鐣欒█鍒楄〃
$page = $this-&_getParam('page');
$size = 20;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$Ms = new Model_DbTable_Comment();
$Ar = new Model_DbTable_Article();
$all = $Ms-&getAll();
for($i=0;$i&count($all);$i++){
$title = $Ar-&getId($all[$i]['aid']);
$all[$i]['title'] = $title['title'];
$paginator = Zend_Paginator::factory($all);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
public function emAction(){
#鍥炲?鐣欒█
$Co = new Model_DbTable_Comment();
if($this-&getRequest()-&isPost()){
$reply = $this-&getRequest()-&getPost('reply');
$id = $this-&getRequest()-&getPost('id');
$Co-&reply($id,$reply);
$this-&_redirect('/admin/em/id/'.$id);
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Ar = new Model_DbTable_Article();
$msg = $Co-&getId($id);
$msg['title'] = $Ar-&getId($msg['aid']);
$this-&view-&msg = $
public function changeAction(){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Co = new Model_DbTable_Comment();
$auth = $this-&_getParam('auth');
$Co-&changea($id,$auth);
$this-&_redirect('/admin/msg');
public function demAction(){
#璇勮?鍒犻櫎涓EUR涓?
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Co = new Model_DbTable_Comment();
$Co-&del($id);
$this-&_redirect('/admin/msg');
public function demmAction(){
$arr = $this-&_getParam('id');
$Co = new Model_DbTable_Comment();
$Co-&delm($arr);
$this-&_redirect('/admin/msg');
public function linksAction(){
#鍙嬫儏閾炬帴鍒楄〃
$page = $this-&_getParam('page');
$size = 20;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('page');
$page = 1;
$Lk = new Model_DbTable_Links();
$all = $Lk-&getAll();
$paginator = Zend_Paginator::factory($all);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
public function addlAction(){
#閾炬帴淇℃伅缂栬緫
$Lk = new Model_DbTable_Links();
if($this-&getRequest()-&isPost()){
$f = new Zend_Filter_StripTags();
$id = $f-&filter($this-&getRequest()-&getPost('id'));
$sitename = $f-&filter($this-&getRequest()-&getPost('sitename'));
$url = $f-&filter($this-&getRequest()-&getPost('url'));
$desc = $f-&filter($this-&getRequest()-&getPost('desc'));
if(empty($id)){
$Lk-&addlinks($url,$sitename,$desc);
$Lk-&up($id,$url,$sitename,$desc);
$this-&_redirect('/admin/links');
$id = $this-&_getParam('id');
if(!empty($id)){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$this-&view-&l = $Lk-&getId($id);
public function lauAction(){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$a = $this-&_getParam('a');
$Lk = new Model_DbTable_Links();
$Lk-&auth($id,$a);
$this-&_redirect('/admin/links');
public function dellAction(){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Lk = new Model_DbTable_Links();
$Lk-&dell($id);
$this-&_redirect('/admin/links');
public function delmAction(){
$id = $this-&_getParam('id');
$Lk = new Model_DbTable_Links();
$Lk-&delm($id);
$this-&_redirect('/admin/links');
protected function main() {
$info = array(
'鎿嶄綔绯荤粺'=&PHP_OS,
'杩愯?鐜??'=&$_SERVER[&SERVER_SOFTWARE&],
'PHP杩愯?鏂瑰紡'=&php_sapi_name(),
'涓婁紶闄勪欢闄愬埗'=&ini_get('upload_max_filesize'),
'鎵ц?鏃堕棿闄愬埗'=&ini_get('max_execution_time').'绉?,
'鏈嶅姟鍣ㄦ椂闂?=&date(&Y骞磏鏈坖鏃?H:i:s&),
'鍖椾含鏃堕棿'=&gmdate(&Y骞磏鏈坖鏃?H:i:s&,time()+8*3600),
'鏈嶅姟鍣ㄥ煙鍚?IP'=&$_SERVER['SERVER_NAME'].' [ '.gethostbyname($_SERVER['SERVER_NAME']).' ]',
'鍓╀綑绌洪棿'=&round((@disk_free_space(&.&)/()),2).'M',
'register_globals'=&get_cfg_var(&register_globals&)==&1& ? &ON& : &OFF&,
'magic_quotes_gpc'=&(1===get_magic_quotes_gpc())?'YES':'NO',
'magic_quotes_runtime'=&(1===get_magic_quotes_runtime())?'YES':'NO',
public function configAction(){
#缃戠珯璁剧疆
$We = new Model_DbTable_Webconfig();
if($this-&getRequest()-&isPost()){
$id = $this-&getRequest()-&getPost('id');
$title = $this-&getRequest()-&getPost('title');
$keywords = $this-&getRequest()-&getPost('keywords');
$description = $this-&getRequest()-&getPost('description');
$about = StripSlashes($this-&getRequest()-&getPost('about'));
$footer = StripSlashes($this-&getRequest()-&getPost('footer'));
$other = $this-&getRequest()-&getPost('other');
$We-&edit($id,$title,$keywords,$description,$about,$footer,$other);
$this-&_redirect('/admin/config');
$this-&view-&c = $We-&getc(1);
public function welcomeAction(){
#绯荤粺淇℃伅
$this-&view-&info = $this-&main();
public function tagsAction(){
#鏍囩?鍒楄〃
$page = $this-&_getParam('page');
$size = 20;
if(isset($page) && is_numeric($page)){
$page = $this-&_getParam('id');
$page = 1;
$Ta = new Model_DbTable_Tags();
$all = $Ta-&getAll();
$paginator = Zend_Paginator::factory($all);
$paginator-&setCurrentPageNumber($page)-&setItemCountPerPage($size);
Zend_Paginator::setDefaultScrollingStyle('Sliding');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('page.phtml');
$paginator-&setView($view);
$this-&view-&paginator = $
public function addtagsAction(){
#鏍囩?缂栬緫
$Ta = new Model_DbTable_Tags();
if($this-&getRequest()-&isPost()){
$id = $this-&getRequest()-&getPost('id');
$name = $this-&getRequest()-&getPost('name');
if(!empty($id)){
$Ta-&up($id,$name);
$Ta-&add($name);
$this-&_redirect('/admin/tags');
$id = $this-&_getParam('id');
if(!empty($id)){
$this-&view-&t = $Ta-&getId($id);
public function deltagsAction(){
$id = is_numeric($this-&_getParam('id')) ? (int) $this-&_getParam('id') : exit();
$Ta = new Model_DbTable_Tags();
$Ta-&del($id);
$this-&_redirect('/admin/tags');
public function deltmAction(){
$id = $this-&_getParam('id');
$Ta = new Model_DbTable_Tags();
$Ta-&delm($id);
$this-&_redirect('/admin/tags');
public function addAction(){
$form = new Form_News();
$form-&submit-&setLabel('Add News');
$this-&view-&form = $
if($this-&getRequest()-&isPost()){
$formData = $this-&getRequest()-&getPost();
if($form-&isValid($formData)){
$title = $form-&getValue('title');
$content = $form-&getValue('content');
$up = new Zend_File_Transfer_Adapter_Http();
$up-&addValidator('Extension',false,'jpg,png,gif')
-&addValidator('Size',false,)
-&addValidator('Count',false,1);
$filename = $up-&getFileName();
$ext = substr($filename,strpos($filename,'.')+1);
$newname = BOOT_PATH.'/public/uploads/'.time().'.'.$
$up-&addFilter('Rename',$newname);
if(!$up-&receive()){
$message = $up-&getMessages();
var_dump($messages);
$pic = '/uploads/'.time().'.'.$
$ntype = $form-&getValue('ntype');
$Ne = new Model_DbTable_News();
$Ne-&addNews($title,$content,$ntype,$pic,time());
echo '娣诲姞鎴愬姛';
$this-&_redirect('/admin');
$form-&populate($formData);
public function edit1Action(){
$form = new Form_News();
$form-&submit-&setLabel('Edit News');
$this-&view-&form = $
if($this-&getRequest()-&isPost()){
$Ne = new Model_DbTable_News();
$formData = $this-&getRequest()-&getPost();
if($form-&isValid($formData)){
$id = (int)$form-&getValue('id');
$title = $form-&getValue('title');
$content = $form-&getValue('content');
$ntype = $form-&getValue('ntype');
if($_FILES['pic']['name'] != '')
$up = new Zend_File_Transfer_Adapter_Http();
$up-&addValidator('Extension',false,'jpg,png,gif')
-&addValidator('Size',false,1024*2)
-&addValidator('Count',false,1);
$filename = $up-&getFileName();
$ext = substr($filename,strpos($filename,'.')+1);
$move = BOOT_PATH.'/public/uploads/'.time().'.'.$
$up-&addFilter('Rename',$move);
if(!$up-&receive()){
//$message = $up-&getError();
//var_dump($message);
echo 'Error By Upload File';
//$this-&_redirect();
$pic = '/uploads/'.time().'.'.$
$pp = $Ne-&getNews($id);
$pic = $pp['pic'];
$Ne-&updateNews($id,$title,$content,$ntype,$pic,time());
echo '淇?敼鎴愬姛';
$this-&_redirect('/admin');
$form-&populate($formData);
$id = $this-&_getParam('id',0);
if($id & 0){
$Ne = new Model_DbTable_News();
$form-&populate($Ne-&getNews($id));
public function delAction(){
$id = $this-&_getParam('id',0);
if($id & 0){
$Ne = new Model_DbTable_News();
$Ne-&delNews($id);
$this-&_redirect('/admin');
Copyright(C)
OKBASE.NET All Rights Reserved 好库网 版权所有

我要回帖

更多关于 python globals 的文章

 

随机推荐