Changeset 652 for team

Show
Ignore:
Timestamp:
09/21/07 00:00:33 (14 months ago)
Author:
www-data
Message:

automerge commit

Location:
team/michiel/import_blogs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • team/michiel/import_blogs

    • Property svnmerge-integrated changed from /trunk:1-649 to /trunk:1-651
  • team/michiel/import_blogs/common/mvblog_admin.php

    r650 r652  
    10641064                        "public" => 1 
    10651065                ); 
     1066                /* we selected a month only */ 
    10661067                if ((array_key_exists("month", $options) && $options["month"] > 0) && (array_key_exists("year", $options) && $options["year"] > 0)) { 
    1067                         $timestamp_start = mktime(0,0,0,$options["month"],1,$options["year"]); 
    1068                         $timestamp_stop  = mktime(0,0,0,$options["month"]+1,1,$options["year"]); 
    1069                         $q1 = sprintf("WHERE %s BETWEEN %d AND %d", $this->db_quote("date"), $timestamp_start, $timestamp_stop); 
    1070                 } else { 
    1071                         $options["month"] = 0; 
    1072                         $options["year"]  = 0; 
    1073                         $q1 = ""; 
    1074                 } 
    1075                 if (array_key_exists("category_id", $options) && $options["category_id"]) 
    1076                         $q1 = sprintf("WHERE aside = 0 AND (categories_ids like '%%,%1\$d' OR categories_ids like '%1\$d,%%' OR categories_ids like '%%,%1\$d,%%' or categories_ids = '%1\$d')", $options["category_id"]); 
     1068                        $postoptions["archive"] = 1; 
     1069                        $postoptions["timestamp_start"] = mktime(0,0,0,$options["month"],1,$options["year"]); 
     1070                        $postoptions["timestamp_stop"]  = mktime(0,0,0,$options["month"]+1,1,$options["year"]); 
     1071                } 
    10771072 
    1078                 $res_count =& $this->db->query("SELECT COUNT(*) FROM articles $q1"); 
    1079                 $counter_r = $res_count->fetchRow(); 
    1080                 $counter = $counter_r[0]; 
    1081                 $this->db->setLimit($options["limit"], $options["top"]); 
    1082                 $res =& $this->db->query("SELECT * FROM articles $q1 ORDER BY ".$this->db_quote("date")." DESC"); 
    1083                 if (PEAR::isError($res)) { 
    1084                         die($res->getDebugInfo()); 
    1085                 } 
     1073                if (array_key_exists("category_id", $options) && $options["category_id"]) { 
     1074                        $postoptions["archive"] = 2; 
     1075                        $postoptions["category_id"] = $options["category_id"]; 
     1076                } 
     1077                $postoptions["start"] = $options["top"]-1; 
     1078                $postoptions["top"]   = $options["top"]; 
     1079                $postoptions["limit"] = $options["limit"]; 
     1080                /* max time is 10 years in the future */ 
     1081                $postoptions["max_time"] = mktime(0, 0, 0, date("m"), date("d"), date("Y")+10); 
     1082 
     1083                $posts = $this->_get_posts($postoptions); 
     1084                $counter = $posts["total_count"]; 
     1085 
    10861086                ?> 
    10871087                <h1 class="log_post_new"><a href="./index.php?action=edit_post&amp;id=0"><?php echo gettext("create new"); ?></a></h1><br /> 
     
    10931093                                <?php 
    10941094                                for ($i=1;$i<=12;$i++) { 
    1095                                         if ($options["month"] == $i) { $selected = " SELECTED"; } else { $selected = ""; } 
     1095                                        if (array_key_exists("month", $options) && $options["month"] == $i) { $selected = " SELECTED"; } else { $selected = ""; } 
    10961096                                        echo "<option value=\"".$i."\"".$selected.">".date("M", mktime(0,0,0,$i,1,0))."</option>\n"; 
    10971097                                } 
     
    11071107                                $row1 = $res1->fetchRow(); 
    11081108                                for ($i=date("Y", $row1[0]);$i<=date("Y");$i++) { 
    1109                                         if ($options["year"] == $i) { $selected1 = " SELECTED"; } else { $selected1 = ""; } 
     1109                                        if (array_key_exists("year", $options) && $options["year"] == $i) { $selected1 = " SELECTED"; } else { $selected1 = ""; } 
    11101110                                        echo "<option value=\"".$i."\"".$selected1.">".$i."</option>\n"; 
    11111111                                } 
     
    11311131                </form> 
    11321132                <?php 
    1133                 while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) { 
     1133                foreach ($posts["posts"] as $row) { 
    11341134                        if (!trim($row["title"])) { 
    11351135                                $row["title"] = "[".gettext("no title")."]"; 
     
    11681168                        <?php 
    11691169                } 
     1170                if (!array_key_exists("month", $options)) 
     1171                        $options["month"] = 0; 
     1172                if (!array_key_exists("year", $options)) 
     1173                        $options["year"] = 0; 
     1174 
    11701175                if ($options["top"]) { 
    11711176                        echo "<a class=\"link_prev\" href=\"index.php?action=show_posts&amp;options[month]=".(int)$options["month"]."&amp;options[year]=".(int)$options["year"]."&amp;options[top]=".($options["top"]-$options["limit"])."\">".gettext("previous")."</a> "; 
  • team/michiel/import_blogs/common/mvblog_common.php

    r640 r652  
    585585                else 
    586586                        $dossier = 0; 
     587 
     588                if (array_key_exists("active", $options)) 
     589                        $active = $options["active"]; 
     590                else 
     591                        $active = 1; 
     592 
     593                if (array_key_exists("public", $options)) 
     594                        $public = $options["public"]; 
     595                else 
     596                        $public = 1; 
     597 
     598                if (array_key_exists("adminmode", $options) && $options["adminmode"]) 
     599                        $adminmode = 1; 
     600                else 
     601                        $adminmode = 0; 
    587602 
    588603                switch ($archive) { 
     
    609624                                        $options["timestamp_end"]   = $time_end; 
    610625                                } 
    611                                 $q = sprintf("AND public=1 AND aside = 0 AND date BETWEEN %d AND %d", $options["timestamp_start"], $options["timestamp_end"]); 
     626                                if ($adminmode) 
     627                                        $q = sprintf("AND date BETWEEN %d AND %d", $options["timestamp_start"], $options["timestamp_end"]); 
     628                                else 
     629                                        $q = sprintf("AND public=%d AND aside = 0 AND date BETWEEN %d AND %d", $public, $options["timestamp_start"], $options["timestamp_end"]); 
    612630                                $title = "<p><h1 class=\"log_archive_h1\">".gettext("Archive of")." ".$archtitle."</h1></p>"; 
    613631                                $url_prev = "?action=archive&amp;m=".date("mY", $options["timestamp_start"])."&amp;top=".($options["top"]-$options["limit"]); 
     
    617635                                if (!array_key_exists("category_id", $options)) 
    618636                                        $options["category_id"] = (int)$_REQUEST["c"]; 
    619                                 $q = sprintf("AND public=1 AND aside = 0 AND date <= %d AND (categories_ids like '%%,%2\$d' OR categories_ids like '%2\$d,%%' OR categories_ids like '%%,%2\$d,%%' or categories_ids = '%2\$d')", $options["max_time"], $options["category_id"]); 
     637                                if ($adminmode) 
     638                                        $q = sprintf("AND aside = 0 AND date <= %d AND (categories_ids like '%%,%2\$d' OR categories_ids like '%2\$d,%%' OR categories_ids like '%%,%2\$d,%%' or categories_ids = '%2\$d')", $options["max_time"], $options["category_id"]); 
     639                                else 
     640                                        $q = sprintf("AND public=%d AND aside = 0 AND date <= %d AND (categories_ids like '%%,%3\$d' OR categories_ids like '%3\$d,%%' OR categories_ids like '%%,%3\$d,%%' or categories_ids = '%3\$d')", $public, $options["max_time"], $options["category_id"]); 
    620641                                $title = "<p><h1 class=\"log_archive_h1\">".gettext("Archive of category")." <i>".$this->categories[$options["category_id"]]["name"]."</i></h1></p>"; 
    621642                                $desc  = "<br /><br /><div class=\"log_dossier_description\">".$this->categories[$options["category_id"]]["desc"]."</div><br />"; 
     
    624645                                break; 
    625646                        case 3 : 
    626                                 $q = sprintf("AND public=1 AND date <= %d AND aside=1", $options["max_time"]); 
     647                                if ($adminmode) 
     648                                        $q = sprintf("AND date <= %d AND aside=1", $options["max_time"]); 
     649                                else 
     650                                        $q = sprintf("AND public=%d AND date <= %d AND aside=1", $public, $options["max_time"]); 
    627651                                $title = "<p><h1 class=\"log_archive_h1\">".gettext("Archive of")." <i>\"asides\"</i></h1></p>"; 
    628652                                $url_prev = "?action=archive_cat&amp;c=aside&amp;top=".($options["top"]-$options["limit"]); 
     
    637661                                        $options["timestamp_start"] = $time_start; 
    638662                                } 
    639                                 $q = sprintf("AND public = 1 AND date <= %d", $options["timestamp_start"]); 
     663                                if ($adminmode) 
     664                                        $q = sprintf("AND date <= %d", $options["timestamp_start"]); 
     665                                else 
     666                                        $q = sprintf("AND public = %d AND date <= %d", $public, $options["timestamp_start"]); 
    640667                                $title = "<p><h1 class=\"log_archive_h1\">".gettext("Archive of articles posted before")."&nbsp;".date("F Y", $options["timestamp_start"])."</h1></p>"; 
    641668                                $url_prev = "?action=archive_old&amp;fromts=".$options["timestamp_start"]."&amp;top=".($options["top"]-$options["limit"]); 
     
    652679                                        $url_prev = "index.php?action=viewdossier&id=$dossier&top=".($options["top"]-$options["limit"]); 
    653680                                        $url_next = "index.php?action=viewdossier&id=$dossier&top=".($options["top"]+$options["limit"]); 
    654                                         $q = sprintf("AND date <= %d AND public=1 AND dossier_id = %d", $options["max_time"], $dossier); 
     681                                        if ($adminmode) 
     682                                                $q = sprintf("AND date <= %d AND dossier_id = %d", $options["max_time"], $dossier); 
     683                                        else 
     684                                                $q = sprintf("AND date <= %d AND public=%d AND dossier_id = %d", $options["max_time"], $public, $dossier); 
    655685                                } else { 
    656                                         $q = sprintf("AND date <= %d AND public=1", $options["max_time"]); 
     686                                        if ($adminmode) 
     687                                                $q = sprintf("AND date <= %d", $options["max_time"]); 
     688                                        else 
     689                                                $q = sprintf("AND date <= %d AND public=%d", $options["max_time"], $public); 
    657690                                        $title = ""; 
    658691                                        $url_prev = "index.php?top=".($options["top"]-$options["limit"]); 
     
    678711 
    679712                if ($options["limit"]) { 
    680                         $res_count =& $this->db->query("SELECT COUNT(*) FROM articles WHERE active=1 $q"); 
     713                        $q_count = sprintf("SELECT COUNT(*) FROM articles WHERE active = 1 %s", $q); 
     714                        $res_count =& $this->db->query($q_count); 
    681715                        if (PEAR::isError($res_count)) 
    682716                                die($res_count->getUserInfo()); 
     
    685719                        $posts["total_count"] = $row[0]; 
    686720                        $this->db->setLimit($options["limit"], $options["start"]); 
    687                         $res =& $this->db->query("SELECT * FROM articles WHERE active=1 $q ORDER BY date DESC"); 
    688                 } else 
    689                         $res =& $this->db->query("SELECT * FROM articles WHERE active=1 $q"); 
     721                        $sql = sprintf("SELECT * FROM articles WHERE active = 1 %s ORDER BY date DESC", $q); 
     722                        $res =& $this->db->query($sql); 
     723                } else { 
     724                        $sql = sprintf("SELECT * FROM articles WHERE active = 1 %s", $q); 
     725                        $res =& $this->db->query($sql); 
     726                } 
    690727 
    691728                if (PEAR::isError($res))