Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezsourcesite.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezsourcesite.php 6484 2001-08-17 13:36:01Z jhe $
5 //
6 // Definition of eZSourceSite class
7 //
8 // Created on: <19-Nov-2000 11:26:48 bf>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
39 // include_once( "classes/ezdb.php" );
40 // include_once( "classes/ezdatetime.php" );
41 // include_once( "ezuser/classes/ezuser.php" );
42
43 class eZSourceSite
44 {
51 function __construct( $id="" )
52 {
53 // default value
54 $this->IsPublished = "0";
55
56 if ( $id != "" )
57 {
58 $this->ID = $id;
59 $this->get( $this->ID );
60 }
61 }
62
66 function store()
67 {
68 $db =& eZDB::globalDatabase();
69 $db->begin();
70
71 $name = $db->escapeString( $this->Name );
72 $login = $db->escapeString( $this->Login );
73 $password = $db->escapeString( $this->Password );
74 $url = $db->escapeString( $this->URL );
75
76 $ret = false;
77 if ( !isset( $this->ID ) )
78 {
79 $db->lock( "eZNewsFeed_SourceSite" );
80 $nextID = $db->nextID( "eZNewsFeed_SourceSite", "ID" );
81 $ret[] = $db->query( "INSERT INTO eZNewsFeed_SourceSite
82 ( ID,
83 Name,
84 URL,
85 Login,
86 Password,
87 CategoryID,
88 IsActive,
89 Decoder,
90 AutoPublish )
91 VALUES
92 ( '$nextID',
93 '$name',
94 '$url',
95 '$login',
96 '$password',
97 '$this->CategoryID',
98 '$this->IsActive',
99 '$this->Decoder',
100 '$this->AutoPublish' )" );
101
102 $this->ID = $nextID;
103 }
104 else
105 {
106 $ret[] = $db->query( "UPDATE eZNewsFeed_SourceSite SET
107 Name='$name',
108 URL='$url',
109 Login='$login',
110 Password='$password',
111 CategoryID='$this->CategoryID',
112 Decoder='$this->Decoder',
113 IsActive='$this->IsActive',
114 AutoPublish='$this->AutoPublish'
115 WHERE ID='$this->ID'
116 " );
117 }
118 eZDB::finish( $ret, $db );
119 return in_array( false, $ret );
120 }
121
125 function get( $id="" )
126 {
127 $db =& eZDB::globalDatabase();
128 $ret = false;
129
130 if ( $id != "" )
131 {
132 $db->array_query( $news_array, "SELECT * FROM eZNewsFeed_SourceSite WHERE ID='$id'" );
133 if ( count( $news_array ) > 1 )
134 {
135 die( "Error: News's with the same ID was found in the database. This shouldent happen." );
136 }
137 else if( count( $news_array ) == 1 )
138 {
139 $this->ID =& $news_array[0][$db->fieldName("ID")];
140 $this->Name =& $news_array[0][$db->fieldName("Name")];
141 $this->URL =& $news_array[0][$db->fieldName("URL")];
142 $this->Login =& $news_array[0][$db->fieldName("Login")];
143 $this->Password =& $news_array[0][$db->fieldName("Password")];
144 $this->CategoryID =& $news_array[0][$db->fieldName("CategoryID")];
145 $this->Decoder =& $news_array[0][$db->fieldName("Decoder")];
146 $this->IsActive =& $news_array[0][$db->fieldName("IsActive")];
147 $this->AutoPublish =& $news_array[0][$db->fieldName("AutoPublish")];
148
149 $ret = true;
150 }
151 }
152 return $ret;
153 }
154
158 function delete( $id = -1 )
159 {
160 $db =& eZDB::globalDatabase();
161 if( $id == -1 )
162 $id = $this->ID;
163
164 $db->begin();
165
166 $ret[] = $db->query( "DELETE FROM eZNewsFeed_SourceSite WHERE ID='$id'" );
167
168 eZDB::finish( $ret, $db );
169
170 return in_array( false, $ret );
171 }
172
176 function getAll()
177 {
178 $db =& eZDB::globalDatabase();
179
180 $return_array = array();
181 $source_site_array = array();
182
183 $db->array_query( $source_site_array, "SELECT ID FROM eZNewsFeed_SourceSite ORDER BY Name" );
184
185 for ( $i=0; $i<count($source_site_array); $i++ )
186 {
187 $return_array[$i] = new eZSourceSite( $source_site_array[$i][$db->fieldName("ID")], 0 );
188 }
189
190 return $return_array;
191
192 }
193
197 function id()
198 {
199 return $this->ID;
200 }
201
205 function &name()
206 {
207 return htmlspecialchars( $this->Name );
208 }
209
213 function &url()
214 {
215 return $this->URL;
216 }
217
221 function &login()
222 {
223 return $this->Login;
224 }
225
229 function &password()
230 {
231 return $this->Password;
232 }
233
237 function &decoder()
238 {
239 return $this->Decoder;
240 }
241
245 function &category()
246 {
247 $ret = new eZNewsCategory( $this->CategoryID );
248
249 return $ret;
250 }
251
255 function &isActive()
256 {
257 $ret = false;
258 if ( $this->IsActive == "1" )
259 $ret = true;
260
261 return $ret;
262 }
263
267 function setName( $value )
268 {
269 $this->Name = $value;
270 }
271
275 function setURL( $value )
276 {
277 $this->URL = $value;
278 }
279
283 function setLogin( $value )
284 {
285 $this->Login = $value;
286 }
287
291 function setPassword( $value )
292 {
293 $this->Password = $value;
294 }
295
299 function setCategory( $category )
300 {
301 if ( is_a( $category, "eZNewsCategory" ) )
302 {
303 $this->CategoryID = $category->id();
304 }
305 }
306
310 function setDecoder( $value )
311 {
312 $this->Decoder = $value;
313 }
314
318 function setIsActive( $value )
319 {
320 if ( $value == true )
321 {
322 $this->IsActive = 1;
323 }
324 else
325 {
326 $this->IsActive = 0;
327 }
328 }
329
333 function setAutoPublish( $value )
334 {
335 if ( $value == true )
336 {
337 $this->AutoPublish = 1;
338 }
339 else
340 {
341 $this->AutoPublish = 0;
342 }
343 }
344
349 function autoPublish()
350 {
351 if ( $this->AutoPublish == 1 )
352 $ret = true;
353 else
354 $ret = false;
355
356 return $ret;
357 }
358
359
360 var $ID;
361 var $Name;
362 var $URL;
363 var $Login;
364 var $Password;
365 var $CategoryID;
366 var $Decoder;
367 var $IsActive;
368
370 var $AutoPublish;
371 var $IsPublished;
372 }
373
374 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$i
$i
Definition: admin/adlist.php:91
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZNewsCategory
Definition: eznewscategory.php:42
eZSourceSite
Definition: ezsourcesite.php:44
eZSourceSite\url
& url()
Definition: ezsourcesite.php:213
eZSourceSite\password
& password()
Definition: ezsourcesite.php:229
eZSourceSite\$Name
$Name
Definition: ezsourcesite.php:361
eZSourceSite\isActive
& isActive()
Definition: ezsourcesite.php:255
eZSourceSite\$Password
$Password
Definition: ezsourcesite.php:364
eZSourceSite\$IsActive
$IsActive
Definition: ezsourcesite.php:367
eZSourceSite\setAutoPublish
setAutoPublish( $value)
Definition: ezsourcesite.php:333
eZSourceSite\decoder
& decoder()
Definition: ezsourcesite.php:237
eZSourceSite\setLogin
setLogin( $value)
Definition: ezsourcesite.php:283
eZSourceSite\name
& name()
Definition: ezsourcesite.php:205
eZSourceSite\setIsActive
setIsActive( $value)
Definition: ezsourcesite.php:318
eZSourceSite\store
store()
Definition: ezsourcesite.php:66
eZSourceSite\setPassword
setPassword( $value)
Definition: ezsourcesite.php:291
eZSourceSite\$CategoryID
$CategoryID
Definition: ezsourcesite.php:365
eZSourceSite\autoPublish
autoPublish()
Definition: ezsourcesite.php:349
eZSourceSite\setDecoder
setDecoder( $value)
Definition: ezsourcesite.php:310
eZSourceSite\$Decoder
$Decoder
Definition: ezsourcesite.php:366
eZSourceSite\$URL
$URL
Definition: ezsourcesite.php:362
eZSourceSite\login
& login()
Definition: ezsourcesite.php:221
eZSourceSite\$Login
$Login
Definition: ezsourcesite.php:363
eZSourceSite\$IsPublished
$IsPublished
Definition: ezsourcesite.php:371
eZSourceSite\setURL
setURL( $value)
Definition: ezsourcesite.php:275
eZSourceSite\__construct
__construct( $id="")
Definition: ezsourcesite.php:51
eZSourceSite\category
& category()
Definition: ezsourcesite.php:245
eZSourceSite\id
id()
Definition: ezsourcesite.php:197
eZSourceSite\getAll
getAll()
Definition: ezsourcesite.php:176
eZSourceSite\$ID
$ID
Definition: ezsourcesite.php:360
eZSourceSite\$AutoPublish
$AutoPublish
bool represented as an int. For automatically publishing of articles.
Definition: ezsourcesite.php:370
eZSourceSite\setName
setName( $value)
Definition: ezsourcesite.php:267
eZSourceSite\setCategory
setCategory( $category)
Definition: ezsourcesite.php:299
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$db
$db
Definition: ezarticle/user/authorlist.php:53
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$url
$url
Definition: messagereviewlist.php:153
Password
</td ></tr >< tr >< td style="color:<?= isset( $error['password1'] ) ?> Password
Definition: step1.php:146
Name
if($user) if(isset( $next) && $next)<?=isset($all_fields_error) &&$all_fields_error ?><?=isset($password_error) &&$password_error ?></p ><? endif;?>< form method="post">< table border="0" cellspacing="2" cellpadding="2" class="boxtext" style="font-size=13;">< tr >< td style="color:<?= isset( $error['first_name'] ) ?> First Name
Definition: step1.php:127
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.