Changeset 4416
- Timestamp:
- Wed Feb 1 18:30:49 2006
- Files:
-
- branches/D12/campsite/implementation/management/priv/do_login.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/lib_campsite.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/frontpage/list.php (added)
- branches/D12/campsite/implementation/management/priv/frontpage/preview.php (added)
- branches/D12/campsite/implementation/management/priv/frontpage/frameset.html (added)
- branches/D12/campsite/implementation/management/priv/frontpage/main.php (added)
- branches/D12/campsite/implementation/management/priv/frontpage/filter.php (added)
- branches/D12/campsite/implementation/management/priv/modifications/include/edit_article.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/modifications/classes/Base.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/modifications/classes/Phorum.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/modifications/classes/Documenta.php (modified) (diff)
- branches/D12/campsite/implementation/management/priv/menu.php (modified) (diff)
- branches/D12/campsite/implementation/management/phorum/templates/eugenol/header.tpl (modified) (diff)
- branches/D12/campsite/implementation/management/admin.php (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
branches/D12/campsite/implementation/management/priv/do_login.php
r4388 r4416 23 23 Phorum::login($_REQUEST["UserName"], $_REQUEST["UserPassword"]); 24 24 25 header("Location: /$ADMIN/index.php"); 25 #header("Location: /$ADMIN/index.php"); 26 header("Location: /$ADMIN/frontpage/frameset.html"); 26 27 exit; 27 28 } -
branches/D12/campsite/implementation/management/priv/lib_campsite.php
r4388 r4416 281 281 } 282 282 283 ?>283 /** 284 * Convert string using htmlspecialchars and print out 285 * @param string $string 286 * @return void 287 */ 288 function phtml($string) 289 { 290 print(htmlspecialchars($string)); 291 } 292 ?> -
branches/D12/campsite/implementation/management/priv/modifications/include/edit_article.php
r4336 r4416 46 46 </td> 47 47 <td align="right"> 48 <?php echo htmlspecialchars($dbColumn->getPrintName());?>:48 <?php phtml($dbColumn->getPrintName());?>: 48 48 </td> 49 49 50 50 <TD> 51 51 52 <div id="<?php echo htmlspecialchars($dbColumn->getName()); ?>_div"> 53 <SELECT NAME="<?php echo htmlspecialchars($dbColumn->getName()); ?>"> 52 <div id="<?php phtml($dbColumn->getName()); ?>_div"> 53 <SELECT NAME="<?php phtml($dbColumn->getName()); ?>"> 54 54 <?php 55 if ($dbColumn->getName() === 'F_magazine') {55 if ($dbColumn->getName() === $Documenta->conf['magazineArticleField']) { 55 55 foreach ($Documenta->getMagazines() as $magazine) { 56 ?><option value="<?php p(htmlspecialchars($magazine['Name'])); ?>"<?php56 ?><option value="<?php phtml($magazine['Name']); ?>"<?php 56 56 if ($articleData->getProperty($dbColumn->getName())) { 57 57 if ($articleData->getProperty($dbColumn->getName()) === $magazine['Name']) p(' selected'); … … 62 62 if ($User->getProperty('Employer') === $magazine['Name']) p(' selected'); 63 63 } 64 ?>><?php p(htmlspecialchars($magazine['Name'])); ?></option><?php64 p('>'.htmlspecialchars($magazine['Name'])); ?></option><?php 64 64 } 65 } elseif ($dbColumn->getName() === $Documenta->conf['submissionArticleField']) { 66 foreach ($Documenta->conf['submissionTypes'] as $submission) { 67 ?><option value="<?php p($submission); ?>"<?php 68 if ($articleData->getProperty($dbColumn->getName()) === $submission) p(' selected'); 69 p('>'.getGS($submission)); ?></option><?php 70 } 65 71 } else { 66 72 foreach ($Documenta->getMetadataValues($dbColumn->getName(), $Documenta->getCSlanguageId($_COOKIE['TOL_Language'], true)) as $v) { 75 81 </div> 76 82 <?php 77 if ($dbColumn->getName() !== 'F_magazine') {83 if ($dbColumn->getName() !== $Documenta->conf['magazineArticleField'] && $dbColumn->getName() !== $Documenta->conf['submissionArticleField'] ) { 77 83 ?> 78 <a href="javascript: switchInputType('<?php echo htmlspecialchars($dbColumn->getName()); ?>')" id="<?php echo htmlspecialchars($dbColumn->getName()); ?>_switch"><?php putGS('Add new entry'); ?></a>84 <a href="javascript: switchInputType('<?php phtml($dbColumn->getName()); ?>')" id="<?php phtml($dbColumn->getName()); ?>_switch"><?php putGS('Add new entry'); ?></a> 78 84 <?php 79 85 } -
branches/D12/campsite/implementation/management/priv/modifications/classes/Base.php
r4331 r4416 18 18 { 19 19 var $conf = array( 20 'campsiteDB' => 'campsite', 21 'ext_DB' => 'campsite_ext', 22 'magazineField' => "Employer", // for homepage 23 'magazineinfoLimit' => 3, // how many entry in magazine-infobox on homepage 24 'article_mdata_tbl' => 'article_metadata', 25 'atom_source_tbl' => 'atom_sources', 26 'atom_item_tbl' => 'atom_items', 20 'campsiteDB' => 'campsite', 21 'ext_DB' => 'campsite_ext', 22 'magazineUserField' => 'Employer', 23 'magazineArticleField' => 'F_magazine', 24 'submissionArticleField' => 'F_submission', 25 'submissionTypes' => array('Contribution', 'Related material'), 26 'magazineinfoLimit' => 3, // how many entry in magazine-infobox on homepage 27 'article_mdata_tbl' => 'article_metadata', 28 'atom_source_tbl' => 'atom_sources', 29 'atom_item_tbl' => 'atom_items', 27 30 ); 28 31 … … 55 58 $this->_selectCampsiteDB(); 56 59 57 if (PEAR::isError($res)) return FALSE; 60 if (PEAR::isError($res)) { 61 echo mysql_error(); 62 return FALSE; 63 } 58 64 59 65 return $res; … … 65 71 $this->_selectCampsiteDB(); 66 72 67 if (PEAR::isError($res)) return FALSE; 73 if (PEAR::isError($res)) { 74 echo mysql_error(); 75 return FALSE; 76 } 68 77 69 78 return $res; … … 75 84 $this->_selectCampsiteDB(); 76 85 77 if (PEAR::isError($res)) return FALSE; 86 if (PEAR::isError($res)) { 87 echo mysql_error(); 88 return FALSE; 89 } 78 90 79 91 return $res; … … 94 106 global $Campsite; 95 107 96 $query = "SELECT DISTINCT({$this->conf['magazine Field']}) AS {$this->conf['magazineField']} FROM Users ORDER BY {$this->conf['magazineField']}";108 $query = "SELECT DISTINCT({$this->conf['magazineUserField']}) FROM Users ORDER BY {$this->conf['magazineUserField']}"; 96 108 $res = $Campsite['db']->Execute($query); 97 109 if (is_object($res)) { 98 110 while ($e = $res->fetchRow()){ 99 $employers[] = array('Name' => $e[$this->conf['magazineField']], 111 $employers[] = array('Name' => $e[$this->conf['magazineUserField']], 99 111 'Country' => 'xyz' 100 112 ); … … 110 122 global $Campsite; 111 123 112 $query = "SELECT Id, Name, UName, EMail FROM Users WHERE {$this->conf['magazineField']}='$magazine'"; 124 $query = "SELECT Id, Name, UName, EMail FROM Users WHERE {$this->conf['magazineUserField']}='$magazine'"; 112 124 $res = $Campsite['db']->Execute($query); 113 125 if (is_object($res)) { … … 217 229 return $res['Id']; 218 230 } 231 232 function getCSlanguageStr($id, $code=false) 233 { 234 $id = mysql_escape_string($id); 235 236 if ($code === true) { 237 $query = "SELECT Code as Str FROM Languages WHERE Id='$id'"; 238 } else { 239 $query = "SELECT Name as Str FROM Languages WHERE Id='$id'"; 240 } 241 $res = $this->getRow($query, $this->csdb); 242 243 return $res['Str']; 244 } 219 245 220 246 function getCSlanguages() 224 250 return $this->getAll($query, $this->csdb); 225 251 } 252 253 function getArticleStatusName($char) 254 { 255 if ($char === "Y") { 256 return('Published'); 257 } elseif ($char === 'S') { 258 return('Submitted'); 259 } elseif ($char === "N") { 260 return('New'); 261 } 262 } 263 264 function _mysql_escape($array) 265 { 266 foreach ($array as $key => $val) { 267 if (is_array($val)) { 268 $array[$key] = Base::_mysql_escape($val); 269 } else { 270 $array[$key] = mysql_escape_string($val); 271 } 272 } 273 return $array; 274 } 275 276 226 277 } 227 278 -
branches/D12/campsite/implementation/management/priv/modifications/classes/Phorum.php
r4335 r4416 108 108 109 109 110 function _getMagazinePostings($magazine, $limit=TRUE)110 function getMagazinePostings($magazine, $limit=TRUE) 110 110 { 111 111 global $PHORUM; 137 137 return $postings; 138 138 } 139 140 function getArticlePostings(&$article) 141 { 142 global $PHORUM, $Documenta; 143 include_once $_SERVER['DOCUMENT_ROOT']."/phorum/include/db/mysql.php"; 144 include_once $_SERVER['DOCUMENT_ROOT']."/phorum/include/users.php"; 145 include_once $_SERVER['DOCUMENT_ROOT']."/phorum/include/constants.php"; 146 $postings = array(); 147 148 $msgid = $Documenta->List->calcThreadMsgid($article); 149 $post = phorum_db_get_message($msgid, 'msgid'); 150 151 $query = "SELECT message_id, forum_id, thread, parent_id, author, subject 152 FROM {$this->tblprefix}_messages 153 WHERE forum_id={$post['forum_id']} and parent_id={$post['message_id']} 154 ORDER BY datestamp DESC 155 LIMIT 0, 3"; 156 157 $thread = $this->getAll($query, $this->db); 158 159 return $thread; 160 161 } 139 162 140 163 function getForums() -
branches/D12/campsite/implementation/management/priv/modifications/classes/Documenta.php
r4331 r4416 19 19 { 20 20 static $instance; 21 if (!is_object($instance)) { 21 if (!is_object($instance)) { 21 21 $instance = &new Documenta(); 22 22 } … … 36 36 global $User; 37 37 38 $own = $User->m_data[$this->conf['magazineField']]; 38 $own = $User->m_data[$this->conf['magazineUserField']]; 38 38 39 39 foreach ($this->getmagazines() as $magazine) { … … 42 42 $owns[] = array('articles' => $this->_getMagazineArticles($magazine), 43 43 'articles_count' => count($this->_getMagazineArticles($magazine, FALSE)), 44 'postings' => $this->Phorum->_getMagazinePostings($magazine), 45 'postings_count' => count($this->Phorum->_getMagazinePostings($magazine, FALSE)), 44 'postings' => $this->Phorum->getMagazinePostings($magazine), 45 'postings_count' => count($this->Phorum->getMagazinePostings($magazine, FALSE)), 46 46 'magazine' => $magazine 47 47 ); … … 49 49 $others[] = array('articles' => $this->_getMagazineArticles($magazine), 50 50 'articles_count' => count($this->_getMagazineArticles($magazine, FALSE)), 51 'postings' => $this->Phorum->_getMagazinePostings($magazine), 52 'postings_count' => count($this->Phorum->_getMagazinePostings($magazine, FALSE)), 51 'postings' => $this->Phorum->getMagazinePostings($magazine), 52 'postings_count' => count($this->Phorum->getMagazinePostings($magazine, FALSE)), 53 53 'magazine' => $magazine 54 54 ); … … 61 61 function _getMagazineArticles($magazine, $limit=TRUE) 62 62 { 63 include_once($_SERVER['DOCUMENT_ROOT']. "/classes/Article.php"); 64 63 65 global $Campsite; 64 66 $articles = array(); 123 125 return $newgid; 124 126 } 127 128 function getFilteredArticles($filter, $ordering, $limit=10, $page=0) 129 { 130 include_once($_SERVER['DOCUMENT_ROOT']. "/classes/Article.php"); 131 132 global $Campsite; 133 $articles = array(); 134 135 $this->_mysql_escape(&$filter); 136 137 if ($filter['filter_language_code']) { 138 $where .= " AND Articles.IdLanguage='".$this->getCSlanguageId($filter['filter_language_code'], true)."'"; 139 } 140 141 142 // metadata is little bit complicated because have to lookup in all extend article tables 143 foreach ($this->_getArticleXTables() as $table) { 144 $join .= " LEFT JOIN $table ON $table.NrArticle=a.Number AND $table.IdLanguage=a.IdLanguage"; 145 $magazineClause .= " OR $table.{$this->conf['magazineArticleField']}='{$filter['filter_magazine']}'"; 146 $submissionClause .= " OR $table.{$this->conf['submissionArticleField']}='{$filter['filter_submission']}'"; 147 } 148 if ($filter['filter_magazine']) { 149 $where .= " AND (0 $magazineClause)"; 150 } 151 if ($filter['filter_submission']) { 152 $where .= " AND (0 $submissionClause)";; 153 } 154 155 if ($filter['filter_article_type']) { 156 $where .= " AND a.Type='{$filter['filter_article_type']}'"; 157 } 158 159 if ($filter['filter_issue_number']) { 160 $where .= " AND a.NrIssue='{$filter['filter_issue_number']}'"; 161 } 162 163 if ($filter['filter_publish_status']) { 164 $where .= " AND a.Published='{$filter['filter_publish_status']}'"; 165 } 166 167 168 if ($ordering['order_by']) { 169 if ($ordering['order_by'] === 'F_magazine') { 170 // magazine is little bit complicated because have to lookup in all extend article tables 171 foreach ($this->_getArticleXTables() as $table) { 172 $order .= " , $table.{$ordering['order_by']} {$ordering['order_dir']}"; 173 } 174 $order = "ORDER BY 1 $order"; 175 } else { 176 $order = " ORDER BY {$ordering['order_by']} {$ordering['order_dir']}"; 177 } 178 } 179 180 $query = "SELECT a.IdPublication, a.NrIssue, a.NrSection, a.Number, a.IdLanguage 181 FROM Articles AS a, Users AS u 182 $join 183 WHERE a.IdUser=u.Id $where 184 $order 185 LIMIT ".$page*$limit.", $limit"; 186 #echo $query; 187 $res = $Campsite['db']->Execute($query); 188 189 if (is_object($res)) { 190 while ($row = $res->fetchRow()) { 191 $articles[] = &new Article($row['IdLanguage'], $row['Number']); 192 } 193 } 194 return $articles; 195 } 196 197 function array2Link($array) 198 { 199 foreach ($array as $key => $val) { 200 if ($val) { 201 $link .= urlencode($key).'='.urlencode($val).'&'; 202 } 203 } 204 return substr($link, 0 , -1); 205 } 206 207 function getOrderLink($which, $order_by, $order_dir) 208 { 209 if ($order_by === $which && $order_dir === 'asc') { 210 $link = "order_by=$which&order_dir=desc"; 211 } else { 212 $link = "order_by=$which&order_dir=asc"; 213 } 214 215 return $link; 216 } 217 218 function array2Input($array) 219 { 220 foreach ($array as $key => $val) { 221 $fields .= '<input type="hidden" name="'.htmlspecialchars($key).'" value="'.htmlspecialchars($val)."\">\n"; 222 } 223 224 return $fields; 225 } 226 227 function _getArticleXTables() 228 { 229 global $Campsite; 230 static $xtables; 231 232 if (!is_array($xtables)) { 233 $query = "SHOW TABLES"; 234 $res = $Campsite['db']->Execute($query); 235 236 while ($row = $res->fetchRow()) { 237 $table = current($row); 238 if (substr($table, 0, 1) === 'X') { 239 $xtables[] = $table; 240 } 241 } 242 } 243 244 return $xtables; 245 246 } 125 247 } 126 248 ?> -
branches/D12/campsite/implementation/management/priv/menu.php
r4388 r4416 333 333 <TR> 334 334 <td align="right" style="font-size: 8pt; padding-right: 5px; padding-top: 0px;" colspan="4"><?php putGS("Signed in: $1", "<b>".$User->getRealName()."</b>"); ?></td> 335 <td style="padding-left: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/logout.png" width="22" height="22" border="0" alt="<?php putGS('Logout'); ?>"></a></td> 336 <td style="font-weight: bold; padding-left: 2px; padding-right: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" style="color: black; text-decoration: none;"><?php putGS('Logout'); ?></a></td> 335 <td style="padding-left: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" target="_parent"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/logout.png" width="22" height="22" border="0" alt="<?php putGS('Logout'); ?>"></a></td> 336 <td style="font-weight: bold; padding-left: 2px; padding-right: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" target="_parent" style="color: black; text-decoration: none;"><?php putGS('Logout'); ?></a></td> 337 337 </tr> 338 338 </table> -
branches/D12/campsite/implementation/management/phorum/templates/eugenol/header.tpl
r4334 r4416 78 78 <TR> 79 79 <td align="right" style="font-size: 8pt; padding-right: 5px; padding-top: 0px;" colspan="4"><?php putGS("Signed in: $1", "<b>".$PHORUM['DATA']['USERINFO']['real_name']."</b>"); ?></td> 80 <td style="padding-left: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/logout.png" width="22" height="22" border="0" alt="<?php putGS('Logout'); ?>"></a></td> 81 <td style="font-weight: bold; padding-left: 2px; padding-right: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" style="color: black; text-decoration: none;"><?php putGS('Logout'); ?></a></td> 80 <td style="padding-left: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" target="_parent"><img src="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/logout.png" width="22" height="22" border="0" alt="<?php putGS('Logout'); ?>"></a></td> 81 <td style="font-weight: bold; padding-left: 2px; padding-right: 10px;"><A HREF="/<?php p($ADMIN); ?>/logout.php" target="_parent" style="color: black; text-decoration: none;"><?php putGS('Logout'); ?></a></td> 82 82 </tr> 83 83 </table> -
branches/D12/campsite/implementation/management/admin.php
r4333 r4416 24 24 '/import/test.php', 25 25 '/import/retrive.php', 26 '/modifications/include/menu-phorum.php'); 26 '/modifications/include/menu-phorum.php', 27 '/frontpage/frameset.html', 28 '/frontpage/preview.php', 29 '/frontpage/main.php', 30 ); 27 31 28 32 $request_uri = $_SERVER['REQUEST_URI'];