final tweeks pre release
authorgreg gay <ggay@ocad.ca>
Tue, 28 Jun 2011 17:12:22 +0000 (17:12 -0000)
committergreg gay <ggay@ocad.ca>
Tue, 28 Jun 2011 17:12:22 +0000 (17:12 -0000)
mods/wordpress/index.php
mods/wordpress/index_mystart.php
mods/wordpress/module.sql
mods/wordpress/module_news.php
mods/wordpress/sublinks.php
mods/wordpress/wp_config.php

index f47aca2..ab72ba4 100644 (file)
@@ -4,12 +4,14 @@ require (AT_INCLUDE_PATH.'vitals.inc.php');
 $_custom_css = $_base_path . 'mods/wordpress/module.css'; // use a custom stylesheet\r
 \r
 require (AT_INCLUDE_PATH.'header.inc.php');\r
+$p = intval($_GET['p']);\r
+\r
 \r
 ?>\r
 \r
 <a href="<?php echo $_config['wp-url']; ?>wp-login.php" target="toolframe">\r
 <?php echo _AT('wordpress_login'); ?></a>\r
-<iframe name="toolframe"  src="<?php echo $_config['wp-url']; ?><?php if($p !=''){ echo '?p='.$p;} ?>" width="95%" height="450" style="border:none;">\r
+<iframe name="toolframe"  src="<?php echo $_config['wp-url']; ?><?php if($p !=''){ echo '?p='.$p;} ?>" width="95%" height="450" style="border:none;" id="randomid<?php srand(time()); ?>">\r
 <p><?php echo _AT('wordpress_no_iframe',$_config['wp-url']); ?>"><?php echo _AT('wordpress_login'); ?></a></p>\r
 </iframe>\r
 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>\r
index 071534e..d66deed 100644 (file)
@@ -4,7 +4,7 @@ define('AT_INCLUDE_PATH', '../../include/');
 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
 $_custom_css = $_base_path . 'mods/wordpress/module.css'; // use a custom stylesheet\r
 require (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
+$p = intval($_GET['p']);\r
 ?>\r
 \r
 <a href="<?php echo $_config['wp-url']; ?>wp-login.php" target="toolframe">\r
index d668004..c9e2eac 100644 (file)
@@ -15,6 +15,7 @@ INSERT INTO `language_text` VALUES ('en', '_module','wordpress_host_url','WordPr
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_db_name','WordPress Database Name',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_db_port','WordPress Database Port',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_db_user','WordPress Database User',NOW(),'');\r
+INSERT INTO `language_text` VALUES ('en', '_module','wordpress_update','WordPress Update',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_db_pwd','WordPress Database Password',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_db_prefix','WordPress Database Table Prefix',NOW(),'');\r
 INSERT INTO `language_text` VALUES ('en', '_module','wordpress_save','Save',NOW(),'');\r
index 81b3968..c6df538 100644 (file)
@@ -13,9 +13,8 @@ if($_GET['p'] != "all"){
 
        $news = array();
 
-       $sql = "SELECT ID, post_title, guid, post_modified FROM ".WP_DB_PREFIX."posts ORDER BY post_modified DESC ".$link_limit;
+       $sql = "SELECT ID, post_title, guid, post_content, post_modified FROM ".WP_DB_PREFIX."posts WHERE post_status = 'publish' ORDER BY post_modified DESC ".$link_limit;
        
-
 $result = mysql_query($sql, $db_wp);
 
        if($result){
@@ -23,7 +22,9 @@ $result = mysql_query($sql, $db_wp);
                //$page_ids = array();
                $post_title = array();
                while($row = mysql_fetch_assoc($result)){
-
+               if(strlen($row['post_content']) > 100){
+                       $row['post_content'] = substr($row['post_content'],0,100)."...";
+               }
                                if(!in_array($row['post_title'], $post_title)){
                                $post_title[] = $row['post_title'];
                                $news[] = array('time'=> $row['post_modified'], 
@@ -31,7 +32,7 @@ $result = mysql_query($sql, $db_wp);
                                        'thumb'=>'mods/wordpress/wordpress_icon_sm.png', 
                                        'link'=>'<a href="'.AT_BASE_HREF.url_rewrite('mods/wordpress/index_mystart.php?p='.$row['ID']).'"'.
                                        (strlen($row['post_title']) > SUBLINK_TEXT_LEN ? ' title="'.$row['post_title'].'"' : '') .'>'. 
-                                       validate_length($row['post_title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>');
+                                       validate_length($row['post_title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a> <br />'.$row['post_content']);
                                }
                }
        }
index 334a252..5a8e775 100644 (file)
@@ -11,32 +11,26 @@ require('wp_connect.php');
 
 global $db_wp;
 
-
-
 $link_limit = 3;               // Number of links to be displayed on "detail view" box
-$sql = "SELECT ID, post_title, guid FROM ".WP_DB_PREFIX."posts ORDER BY post_modified DESC LIMIT $link_limit";
-
-//$sql = "SELECT hello_world_id, value FROM ".TABLE_PREFIX."hello_world WHERE course_id=".$_SESSION[course_id].
-//       " ORDER BY value LIMIT $link_limit";
-if(!$result = mysql_query($sql, $db_wp)){
-       echo _AT('wordpress_no_db_info');
-       return 0;
-
+$sql = "SELECT ID, post_title, guid FROM ".WP_DB_PREFIX."posts WHERE post_status = 'publish' ORDER BY post_modified DESC LIMIT $link_limit";
+
+$result = mysql_query($sql, $db_wp);
+$wp_posts = array();
+$i = 1;
+while($row = mysql_fetch_assoc($result)){
+       $wp_posts[$i] = $row;
+       $i++;
 }
 
-if (mysql_num_rows($result) > 0) {
-       while ($row = mysql_fetch_assoc($result)) {
-               /****
-               * SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY are defined in include/lib/constance.lib.inc
-               * SUBLINK_TEXT_LEN determins the maxium length of the string to be displayed on "detail view" box.
-               *****/
-               $list[] = '<a href="'.AT_BASE_HREF.url_rewrite('mods/wordpress/index.php?p='. $row['ID']).'"'.
-                         (strlen($row['value']) > SUBLINK_TEXT_LEN ? ' title="'.$row['value'].'"' : '') .'>'. 
-                         validate_length($row['post_title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
+if($wp_posts != ''){
+       foreach($wp_posts as $key=>$value){
+       $list[] = '<a href="'.AT_BASE_HREF.url_rewrite('mods/wordpress/index.php?p='. $value['ID']).'"'.
+                                       (strlen($row['value']) > SUBLINK_TEXT_LEN ? ' title="'.$row['value'].'"' : '') .'>'. 
+                                       validate_length($value['post_title'], SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY) .'</a>';
        }
-       return $list;   
+       return $list;
 } else {
-       return 0;
+       return 0; 
 }
 
 ?>
\ No newline at end of file
index 5313d77..3e667c5 100644 (file)
@@ -10,4 +10,4 @@ define('WP_DB_PREFIX',        'wp_');            #default "wp_"
 define('WP_DB_HOST',   'localhost');      #default "localhost"
 define('WP_DB_PORT',   '3600');           #default "3600"
 
-?>
\ No newline at end of file
+?>