Changeset 608
- Timestamp:
- 05/01/05 20:16:26 (8 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 9 modified
-
ChangeLog (modified) (1 diff)
-
wifidog/classes/Content.php (modified) (2 diffs)
-
wifidog/classes/Content/File.php (modified) (1 diff)
-
wifidog/classes/Content/Picture.php (modified) (4 diffs)
-
wifidog/classes/MainUI.php (modified) (1 diff)
-
wifidog/classes/Node.php (modified) (2 diffs)
-
wifidog/classes/User.php (modified) (10 diffs)
-
wifidog/content/index.php (modified) (1 diff)
-
wifidog/include/schema_validate.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/ChangeLog
r607 r608 1 2005-04-30 Francois Proulx <francois.proulx@gmail.com> 2 * Fixed bug that could potentially let non owners add content in /content through content groups 3 * Admin menu won't show node selector if the user is not owner of at least one hotspot 4 * Added Width, height support for Picture 5 1 6 2005-04-30 Francois Proulx <francois.proulx@gmail.com> 2 7 * Did my best for content styling ... ( it's 5h00 am ) -
trunk/wifidog-auth/wifidog/classes/Content.php
r601 r608 481 481 { 482 482 $html .= "<div class='user_ui_projet_info'>\n"; 483 $html .= _("Project information:");483 $html .= "<b>"._("Project information:")."</b>"; 484 484 $project_info = self :: getObject($this->content_row['project_info']); 485 485 // If the content logging is disabled, all the children will inherit this property temporarly … … 493 493 { 494 494 $html .= "<div class='user_ui_sponsor_info'>\n"; 495 $html .= _("Project sponsor:");495 $html .= "<b>"._("Project sponsor:")."</b>"; 496 496 $sponsor_info = self :: getObject($this->content_row['sponsor_info']); 497 497 // If the content logging is disabled, all the children will inherit this property temporarly -
trunk/wifidog-auth/wifidog/classes/Content/File.php
r593 r608 295 295 if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) 296 296 { 297 parent :: processAdminUI();298 299 // If no file was uploaded, update filename and mime type300 if (!empty ($_REQUEST["file_mode".$this->getId()]))301 {302 $this->setFilename($_REQUEST["file_file_name".$this->getId()]);303 $this->setMimeType($_REQUEST["file_mime_type".$this->getId()]); 304 305 $file_mode = $_REQUEST["file_mode".$this->getId()]; 306 if ($file_mode == "by_upload") 307 { 308 $this->setBinaryDataFromPostVar("file_file_upload".$this->getId());309 $this->setURL(null);310 // Reset the remote file size ( not used )311 $this->setRemoteFileSize(0);312 }313 else314 {315 if ($file_mode == "remote")316 {317 $this->setURL($_REQUEST["file_url".$this->getId()]);318 $this->setBinaryData(null);319 // When switching from local to remote, this field does not exist yet320 if (!empty ($_REQUEST["file_old_remote_size".$this->getId()]))321 {322 if ($_REQUEST["file_remote_size".$this->getId()] != $_REQUEST["file_old_remote_size".$this->getId()])323 $this->setRemoteFileSize($_REQUEST["file_remote_size".$this->getId()]);324 }325 else326 $this->setRemoteFileSize(0);327 }328 }329 }297 parent :: processAdminUI(); 298 299 // If no file was uploaded, update filename and mime type 300 if (!empty ($_REQUEST["file_mode".$this->getId()])) 301 { 302 $this->setFilename($_REQUEST["file_file_name".$this->getId()]); 303 304 $file_mode = $_REQUEST["file_mode".$this->getId()]; 305 if ($file_mode == "by_upload") 306 { 307 $this->setMimeType($_REQUEST["file_mime_type".$this->getId()]); 308 $this->setBinaryDataFromPostVar("file_file_upload".$this->getId()); 309 $this->setURL(null); 310 // Reset the remote file size ( not used ) 311 $this->setRemoteFileSize(0); 312 } 313 else 314 { 315 if ($file_mode == "remote") 316 { 317 $this->setURL($_REQUEST["file_url".$this->getId()]); 318 $this->setBinaryData(null); 319 // When switching from local to remote, this field does not exist yet 320 if (!empty ($_REQUEST["file_old_remote_size".$this->getId()])) 321 { 322 if ($_REQUEST["file_remote_size".$this->getId()] != $_REQUEST["file_old_remote_size".$this->getId()]) 323 $this->setRemoteFileSize($_REQUEST["file_remote_size".$this->getId()]); 324 } 325 else 326 $this->setRemoteFileSize(0); 327 } 328 } 329 } 330 330 } 331 331 } -
trunk/wifidog-auth/wifidog/classes/Content/Picture.php
r578 r608 39 39 { 40 40 parent :: __construct($content_id); 41 global $db; 42 43 $content_id = $db->EscapeString($content_id); 44 $sql = "SELECT * FROM pictures WHERE pictures_id='$content_id'"; 45 $db->ExecSqlUniqueRes($sql, $row, false); 46 if ($row == null) 47 { 48 /*Since the parent Content exists, the necessary data in content_group had not yet been created */ 49 $sql = "INSERT INTO pictures (pictures_id) VALUES ('$content_id')"; 50 $db->ExecSqlUpdate($sql, false); 51 52 $sql = "SELECT * FROM pictures WHERE pictures_id='$content_id'"; 53 $db->ExecSqlUniqueRes($sql, $row, false); 54 if ($row == null) 55 { 56 throw new Exception(_("The content with the following id could not be found in the database: ").$content_id); 57 } 58 59 } 60 $this->mBd = & $db; 61 $this->pictures_row = $row; 62 } 63 64 function getWidth() 65 { 66 return $this->pictures_row['width']; 67 } 68 69 function setWidth($width) 70 { 71 if(empty($width) || is_numeric($width)) 72 { 73 empty($width) ? $width = "NULL" : $width = $this->mBd->EscapeString($width) ; 74 $this->mBd->ExecSqlUpdate("UPDATE pictures SET width =".$width." WHERE pictures_id='".$this->getId()."'", false); 75 $this->refresh(); 76 } 77 } 78 79 function getHeight() 80 { 81 return $this->pictures_row['height']; 82 } 83 84 function setHeight($height) 85 { 86 if(empty($height) || is_numeric($height)) 87 { 88 empty($height) ? $height = "NULL" : $height = $this->mBd->EscapeString($height) ; 89 $this->mBd->ExecSqlUpdate("UPDATE pictures SET height =".$height." WHERE pictures_id='".$this->getId()."'", false); 90 $this->refresh(); 91 } 41 92 } 42 93 … … 47 98 $html .= "<div class='admin_class'>Picture (".get_class($this)." instance)</div>\n"; 48 99 100 $html .= "<div class='admin_section_container'>\n"; 101 $html .= "<div class='admin_section_data'>\n"; 102 $html .= "<div class='admin_section_title'>"._("Width (leave empty if you want to keep original width)")." : </div>\n"; 103 $html .= "<input type='text' name='pictures_{$this->getId()}_width' value='{$this->getWidth()}'>"; 104 $html .= "</div>\n"; 105 $html .= "</div>\n"; 106 107 $html .= "<div class='admin_section_container'>\n"; 108 $html .= "<div class='admin_section_data'>\n"; 109 $html .= "<div class='admin_section_title'>"._("Height (leave empty if you want to keep original height)")." : </div>\n"; 110 $html .= "<input type='text' name='pictures_{$this->getId()}_height' value='{$this->getHeight()}'>"; 111 $html .= "</div>\n"; 112 $html .= "</div>\n"; 113 49 114 // Show File admin UI + display the picture 50 115 $html .= "<div class='admin_section_container'>\n"; 51 116 $html .= "<div class='admin_section_data'>\n"; 52 117 $html .= "<div class='admin_section_title'>"._("Picture preview")." : </div>\n"; 53 $html .= "<img src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; 118 119 $width = $this->getWidth(); 120 $height = $this->getHeight(); 121 122 if(empty($width)) 123 $width = ""; 124 else 125 $width = "width='$width'"; 126 127 if(empty($height)) 128 $height = ""; 129 else 130 $height = "height='$height'"; 131 132 $html .= "<img src='".htmlentities($this->getFileUrl())."' $width $height alt='".$this->getFileName()."''>"; 54 133 $html .= "</div>\n"; 55 134 $html .= "</div>\n"; … … 57 136 $html .= $subclass_admin_interface; 58 137 return parent :: getAdminUI($html); 138 } 139 140 function processAdminUI() 141 { 142 if ($this->isOwner(User :: getCurrentUser()) || User :: getCurrentUser()->isSuperAdmin()) 143 { 144 parent :: processAdminUI(); 145 146 $this->setWidth(intval($_REQUEST["pictures_{$this->getId()}_width"])); 147 $this->setHeight(intval($_REQUEST["pictures_{$this->getId()}_height"])); 148 } 59 149 } 60 150 … … 67 157 $html .= "<div class='user_ui_container'>\n"; 68 158 $html .= "<div class='user_ui_object_class'>Picture (".get_class($this)." instance)</div>\n"; 69 $html .= "<img class='user_ui_picture' src='".htmlentities($this->getFileUrl())."' alt='".$this->getFileName()."''>"; 159 160 $width = $this->getWidth(); 161 $height = $this->getHeight(); 162 163 if(empty($width)) 164 $width = ""; 165 else 166 $width = "width='$width'"; 167 168 if(empty($height)) 169 $height = ""; 170 else 171 $height = "height='$height'"; 172 173 $html .= "<img src='".htmlentities($this->getFileUrl())."' $width $height alt='".$this->getFileName()."''>"; 70 174 $html .= "</div>\n"; 71 175 return $html; -
trunk/wifidog-auth/wifidog/classes/MainUI.php
r600 r608 68 68 } 69 69 70 / * Node admin */71 $html .= "<div class='admin_section_container'>\n";72 $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="get">';73 $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n";74 75 $html .= "<div class='admin_section_data'>\n";76 $html .= "<input type='hidden' name='action' value='edit'>\n";77 $html .= "<input type='hidden' name='object_class' value='Node'><br>\n";78 79 if ($current_user->isSuperAdmin())80 {81 $sql_additional_where = ''; 82 }83 else84 {85 $sql_additional_where = "AND node_id IN (SELECT node_id from node_owners WHERE user_id='".$current_user->getId()."')";86 }87 $html .= "<div id='NodeSelector'>\n";88 $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where);89 $html .= "</div>\n";90 $html .= "</div>\n";91 $html .= "<div class='admin_section_tools'>\n";92 93 $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n";94 $html .= "</div>\n";95 $html .= '</form>';96 $html .= "</div>\n";70 // If the user is super admin OR owner of at least one hotspot show the menu 71 if($current_user->isSuperAdmin() || $current_user->isOwner()) 72 { 73 /* Node admin */ 74 $html .= "<div class='admin_section_container'>\n"; 75 $html .= '<form action="'.GENERIC_OBJECT_ADMIN_ABS_HREF.'" method="get">'; 76 $html .= "<div class='admin_section_title'>"._("Node administration:")." </div>\n"; 77 78 $html .= "<div class='admin_section_data'>\n"; 79 $html .= "<input type='hidden' name='action' value='edit'>\n"; 80 $html .= "<input type='hidden' name='object_class' value='Node'><br>\n"; 81 82 if ($current_user->isSuperAdmin()) 83 $sql_additional_where = ''; 84 else 85 $sql_additional_where = "AND node_id IN (SELECT node_id from node_owners WHERE user_id='".$current_user->getId()."')"; 86 $html .= "<div id='NodeSelector'>\n"; 87 $html .= Node :: getSelectNodeUI('object_id', $sql_additional_where); 88 $html .= "</div>\n"; 89 $html .= "</div>\n"; 90 $html .= "<div class='admin_section_tools'>\n"; 91 92 $html .= "<input type=submit name='edit_submit' value='"._("Edit")."'>\n"; 93 $html .= "</div>\n"; 94 $html .= '</form>'; 95 $html .= "</div>\n"; 96 } 97 97 98 98 /* Network admin */ -
trunk/wifidog-auth/wifidog/classes/Node.php
r601 r608 454 454 global $db; 455 455 $retval = array (); 456 $sql = "SELECT * FROM content_group JOIN content ON (content.content_id = content_group.content_group_id) WHERE is_persistent = true AND is_artistic_content = true AND is_locative_content = true";456 $sql = "SELECT * FROM content_group JOIN content ON (content.content_id = content_group.content_group_id) JOIN node_has_content ON (node_has_content.content_id = content_group.content_group_id AND node_has_content.node_id = '{$this->getId()}') WHERE is_persistent = true AND is_artistic_content = true AND is_locative_content = true"; 457 457 $db->ExecSql($sql, $content_rows, false); 458 458 if ($content_rows != null) … … 464 464 if($content_group->getDisplayNumElements() >= 1) 465 465 { 466 // Disable logging and allow content to expand ( if possible ) 467 $content_group->setExpandStatus(true); 468 $content_group->setLoggingStatus(false); 469 $retval[] = $content_group; 466 if($content_group->isDisplayableAt($this)) 467 { 468 // Disable logging and allow content to expand ( if possible ) 469 $content_group->setExpandStatus(true); 470 $content_group->setLoggingStatus(false); 471 $retval[] = $content_group; 472 } 470 473 } 471 474 } -
trunk/wifidog-auth/wifidog/classes/User.php
r600 r608 1 1 <?php 2 2 3 3 4 /********************************************************************\ … … 251 252 } 252 253 253 /** Get a user display suitable for a user list. Will include link to the user profile. */254 /** Get a user display suitable for a user list. Will include link to the user profile. */ 254 255 function getUserListUI() 255 256 { 256 $html = '';257 $html .= $this->getUserName();258 return $html;257 $html = ''; 258 $html .= $this->getUserName(); 259 return $html; 259 260 } 260 261 … … 344 345 } 345 346 346 public function isSuperAdmin() { 347 global $db; 348 //$this->session->dump(); 349 350 $db->ExecSqlUniqueRes("SELECT * FROM users NATURAL JOIN administrators WHERE (users.user_id='$this->id')", $user_info, false); 351 if (!empty($user_info)) { 352 return true; 353 } else { 354 return false; 355 } 356 357 } 347 public function isSuperAdmin() 348 { 349 global $db; 350 //$this->session->dump(); 351 352 $db->ExecSqlUniqueRes("SELECT * FROM users NATURAL JOIN administrators WHERE (users.user_id='$this->id')", $user_info, false); 353 if (!empty ($user_info)) 354 { 355 return true; 356 } 357 else 358 { 359 return false; 360 } 361 362 } 363 364 /** 365 * Tells if the current user is owner of at least one hotspot. 366 */ 367 public function isOwner() 368 { 369 global $db; 370 $db->ExecSqlUniqueRes("SELECT * FROM node_owners WHERE user_id='{$this->getId()}'", $row, false); 371 if ($row != null) 372 return true; 373 return false; 374 375 } 376 358 377 function getValidationToken() 359 378 { … … 413 432 return $connections; 414 433 } 415 416 function getAccountOrigin()417 {418 return $this->mRow['account_origin'];419 }434 435 function getAccountOrigin() 436 { 437 return $this->mRow['account_origin']; 438 } 420 439 421 440 /** Return all the users … … 432 451 return $objects; 433 452 } 434 435 /**436 * Logout the current user437 * Destroying session and cleaning tokens438 */439 function logout()440 {441 global $session;442 $session->destroy();443 //TODO: Completed this part with Network::getObject()444 /*445 try {446 $connections = $this->getConnections();447 foreach($connections as $connection)448 if($connection['token_status'] == TOKEN_UNUSED || $connection['token_status'] == TOKEN_INUSE)449 Network::getCurrentNetwork()->getAuthenticator()->logout(array('conn_id' => $connection['conn_id']), $errmsg);450 } catch(Exception $e)451 {452 //TODO: Error management ( MainUI )453 }*/454 }453 454 /** 455 * Logout the current user 456 * Destroying session and cleaning tokens 457 */ 458 function logout() 459 { 460 global $session; 461 $session->destroy(); 462 //TODO: Completed this part with Network::getObject() 463 /* 464 try { 465 $connections = $this->getConnections(); 466 foreach($connections as $connection) 467 if($connection['token_status'] == TOKEN_UNUSED || $connection['token_status'] == TOKEN_INUSE) 468 Network::getCurrentNetwork()->getAuthenticator()->logout(array('conn_id' => $connection['conn_id']), $errmsg); 469 } catch(Exception $e) 470 { 471 //TODO: Error management ( MainUI ) 472 }*/ 473 } 455 474 456 475 function sendLostUsername() … … 462 481 $subject = HOTSPOT_NETWORK_NAME._(" lost username request"); 463 482 $body = _("Hello,\nYou have requested that the authentication server send you your username:\nUsername: ").$username._("\n\nHave a nice day,\nThe Team"); 464 465 //TODO: Find a way to use correctly mb_encode_mimeheader466 $subject = mb_convert_encoding($subject, "ISO-8859-1","AUTO");467 483 484 //TODO: Find a way to use correctly mb_encode_mimeheader 485 $subject = mb_convert_encoding($subject, "ISO-8859-1", "AUTO"); 486 468 487 mail($this->getEmail(), $subject, $body, $headers); 469 488 } … … 489 508 $url = "http://".$_SERVER["SERVER_NAME"]."/validate.php?user_id=".$this->getId()."&token=".$this->getValidationToken(); 490 509 $body = _("Hello,\nPlease follow the link below to validate your account.\n").$url._("\n\nThank you,\nThe Team."); 491 492 //TODO: Find a way to use correctly mb_encode_mimeheader493 $subject = mb_convert_encoding($subject, "ISO-8859-1","AUTO");494 510 511 //TODO: Find a way to use correctly mb_encode_mimeheader 512 $subject = mb_convert_encoding($subject, "ISO-8859-1", "AUTO"); 513 495 514 mail($this->getEmail(), $subject, $body, $headers); 496 515 } … … 508 527 $headers = 'MIME-Version: 1.0'."\r\n"; 509 528 $headers .= 'Content-type: text/plain; charset=UTF-8'."\r\n"; 510 $headers .= "From: ".VALIDATION_EMAIL_FROM_ADDRESS;529 $headers .= "From: ".VALIDATION_EMAIL_FROM_ADDRESS; 511 530 $subject = HOTSPOT_NETWORK_NAME._(" new password request"); 512 531 $body = _("Hello,\nYou have requested that the authentication server send you a new password:\nUsername: ").$username._("\nPassword: ").$new_password._("\n\nHave a nice day,\nThe Team"); 513 514 //TODO: Find a way to use correctly mb_encode_mimeheader515 $subject = mb_convert_encoding($subject, "ISO-8859-1","AUTO");516 532 533 //TODO: Find a way to use correctly mb_encode_mimeheader 534 $subject = mb_convert_encoding($subject, "ISO-8859-1", "AUTO"); 535 517 536 mail($this->getEmail(), $subject, $body, $headers); 518 537 } … … 580 599 return $html; 581 600 } 582 601 583 602 /** Get the selected user, IF one was selected and is valid 584 603 * @param $user_prefix A identifier provided by the programmer to recognise it's generated form … … 591 610 $name = "select_user_{$user_prefix}_username"; 592 611 $username = $_REQUEST[$name]; 593 return self ::getUserByUsernameAndOrigin($username, $network->GetId());594 } 595 596 /** Add content to this user ( subscription ) */597 public function addContent(Content $content)598 {599 global $db;600 $content_id = $db->EscapeString($content->getId());601 $sql = "INSERT INTO user_has_content (user_id, content_id) VALUES ('$this->id','$content_id')";602 $db->ExecSqlUpdate($sql, false);603 return true;604 }605 606 /** Remove content from this node */607 public function removeContent(Content $content)608 {609 global $db;610 $content_id = $db->EscapeString($content->getId());611 $sql = "DELETE FROM user_has_content WHERE user_id='$this->id' AND content_id='$content_id'";612 $db->ExecSqlUpdate($sql, false);613 return true;614 }615 616 /**Get an array of all Content linked to this node617 * @return an array of Content or an empty arrray */618 function getAllContent()619 {620 global $db;621 $retval = array ();622 $sql = "SELECT * FROM user_has_content WHERE user_id='$this->id' ORDER BY subscribe_timestamp";623 $db->ExecSql($sql, $content_rows, false);624 if ($content_rows != null)625 {626 foreach ($content_rows as $content_row)627 {628 $retval[] = Content :: getObject($content_row['content_id']);629 }630 }631 return $retval;632 }633 612 return self :: getUserByUsernameAndOrigin($username, $network->GetId()); 613 } 614 615 /** Add content to this user ( subscription ) */ 616 public function addContent(Content $content) 617 { 618 global $db; 619 $content_id = $db->EscapeString($content->getId()); 620 $sql = "INSERT INTO user_has_content (user_id, content_id) VALUES ('$this->id','$content_id')"; 621 $db->ExecSqlUpdate($sql, false); 622 return true; 623 } 624 625 /** Remove content from this node */ 626 public function removeContent(Content $content) 627 { 628 global $db; 629 $content_id = $db->EscapeString($content->getId()); 630 $sql = "DELETE FROM user_has_content WHERE user_id='$this->id' AND content_id='$content_id'"; 631 $db->ExecSqlUpdate($sql, false); 632 return true; 633 } 634 635 /**Get an array of all Content linked to this node 636 * @return an array of Content or an empty arrray */ 637 function getAllContent() 638 { 639 global $db; 640 $retval = array (); 641 $sql = "SELECT * FROM user_has_content WHERE user_id='$this->id' ORDER BY subscribe_timestamp"; 642 $db->ExecSql($sql, $content_rows, false); 643 if ($content_rows != null) 644 { 645 foreach ($content_rows as $content_row) 646 { 647 $retval[] = Content :: getObject($content_row['content_id']); 648 } 649 } 650 return $retval; 651 } 652 634 653 } // End class 635 654 ?> -
trunk/wifidog-auth/wifidog/content/index.php
r600 r608 110 110 111 111 /* Node section */ 112 $html .= "<div class='portal_node_section'>\n";113 $html .= "<img class='portal_section_logo' src='{$hotspot_logo_url}' alt=''>\n";114 $html .= "<span class='portal_section_title'>"._("Content from:")."</span>";115 116 $node_homepage = $node->getHomePageURL();117 if(!empty($node_homepage))118 {119 $html .= "<a href='$node_homepage'>";120 }121 $html .= $node->getName();122 if(!empty($node_homepage))123 {124 $html .= "</a>\n";125 }126 127 112 // Get all locative artistic content for this node 128 113 $contents = $node->getAllLocativeArtisticContent(); 129 $html .= "<ul>\n"; 130 foreach ($contents as $content) 114 if($contents) 131 115 { 132 $html .= "<li>\n"; 133 $html .= $content->getUserUI(); 134 $html .= "</li>\n"; 116 $html .= "<table width='100%'><tr><td>"; 117 $html .= "<div class='portal_node_section'>\n"; 118 $html .= "<img class='portal_section_logo' src='{$hotspot_logo_url}' alt=''>\n"; 119 $html .= "<span class='portal_section_title'>"._("Content from:")." "; 120 121 $node_homepage = $node->getHomePageURL(); 122 if(!empty($node_homepage)) 123 { 124 $html .= "<a href='$node_homepage'>"; 125 } 126 $html .= $node->getName(); 127 if(!empty($node_homepage)) 128 { 129 $html .= "</a>\n"; 130 } 131 $html .= "</span>"; 132 $html .= "</td></tr></table>"; 133 134 foreach ($contents as $content) 135 { 136 $html .= "<div class='portal_content'>\n"; 137 $html .= $content->getUserUI(); 138 $html .= "</div>"; 139 } 140 $html .= "</div>\n"; 135 141 } 136 $html .= "</ul>\n";137 138 $html .= "</div>\n";139 142 140 143 $ui->setMainContent($html); -
trunk/wifidog-auth/wifidog/include/schema_validate.php
r585 r608 29 29 require_once BASEPATH.'classes/AbstractDb.php'; 30 30 require_once BASEPATH.'classes/Session.php'; 31 define('REQUIRED_SCHEMA_VERSION', 1 3);31 define('REQUIRED_SCHEMA_VERSION', 14); 32 32 33 33 /** Check that the database schema is up to date. If it isn't, offer to update it. */ … … 401 401 $sql .= "ALTER TABLE content_group ALTER COLUMN allow_repeat SET DEFAULT 'YES';\n"; 402 402 $sql .= "ALTER TABLE content_group ALTER COLUMN allow_repeat SET NOT NULL;\n"; 403 } 403 } 404 405 $new_schema_version = 14; 406 if($schema_version < $new_schema_version) 407 { 408 echo "<h2>Preparing SQL statements to update schema to version $new_schema_version</h2>\n"; 409 $sql .= "\n\nUPDATE schema_info SET value='$new_schema_version' WHERE tag='schema_version';\n"; 410 $sql .= "CREATE TABLE pictures " . 411 "( " . 412 "pictures_id text NOT NULL PRIMARY KEY REFERENCES files ON DELETE CASCADE ON UPDATE CASCADE, " . 413 "width int4, ". 414 "height int4". 415 ");\n"; 416 } 404 417 405 418
