Loudblog PHP Cross Reference Blogging Systems

Source: /loudblog/inc/functions_organisation.php - 534 lines - 19747 bytes - Summary - Text - Print

   1  <?php
   2  
   3  function savepostedcats () {
   4  
   5  global $settings;
   6  $countcat = max_id("lb_categories");
   7      
   8  //delete or update existing categories
   9  for ($j=1; $j<=$countcat; $j++) {
  10      
  11      //preparing looped post-array-things
  12      $tempcat = "cat" . $j; 
  13      $tempdesc = "desc" . $j;
  14      $tempdel = "del" . $j;
  15      
  16      //delete categories, if requested
  17      if (isset($_POST[$tempdel])) {
  18          $dosql = "DELETE FROM ".$GLOBALS['prefix']."lb_categories 
  19                    WHERE id = '" . $j . "';";
  20          $GLOBALS['lbdata']->Execute($dosql);
  21          
  22      } else {
  23          
  24          //or update existing categories    
  25          if (isset($_POST[$tempcat])) {
  26          
  27              $putcat = htmlentities($_POST[$tempcat], ENT_QUOTES, "UTF-8");
  28              $putdes = htmlentities($_POST[$tempdesc], ENT_QUOTES, "UTF-8");
  29              
  30              $dosql = "UPDATE ".$GLOBALS['prefix']."lb_categories SET
  31                        name        = '" . $putcat . "',
  32                        description = '" . $putdes . "'
  33                        WHERE id = '" . $j . "';";
  34              $GLOBALS['lbdata']->Execute($dosql);
  35  
  36          }
  37      }
  38  }
  39  
  40  //add new categories
  41  if (isset($_POST['newcat']) AND ($_POST['newcat'] != "")) {
  42  
  43      $putcat = htmlentities($_POST['newcat'], ENT_QUOTES, "UTF-8");
  44      $putdes = htmlentities($_POST['newdesc'], ENT_QUOTES, "UTF-8");
  45      
  46      $dosql = "INSERT INTO ".$GLOBALS['prefix']."lb_categories
  47                  (name, description)
  48                  VALUES (
  49                  '" . $putcat . "', '" . $putdes . "' );";
  50      $GLOBALS['lbdata']->Execute($dosql);
  51  }
  52  
  53  echo "<p class=\"msg\">";
  54  echo bla("msg_successcatsupdate")."</p>";
  55  
  56  }
  57  
  58  // ----------------------------------------------------------------
  59  
  60  function savepostedauthordata ($editid) {
  61  
  62  global $settings;
  63  $message = "";
  64  $return = true;
  65  $message = bla("msg_savesuccess");
  66  $changepass = false;
  67  
  68  
  69  //preparing posted data for saving
  70  $putnick = htmlentities($_POST['nickname'], ENT_QUOTES, "UTF-8");
  71  $putreal = htmlentities($_POST['realname'], ENT_QUOTES, "UTF-8");
  72  $putmail = htmlentities($_POST['mail'], ENT_QUOTES, "UTF-8");
  73  if (isset($_POST['edit_own']))    $putright1 = "1"; else $putright1 = "0";
  74  if (isset($_POST['publish_own'])) $putright2 = "1"; else $putright2 = "0";
  75  if (isset($_POST['edit_all']))    $putright3 = "1"; else $putright3 = "0";
  76  if (isset($_POST['publish_all'])) $putright4 = "1"; else $putright4 = "0";
  77  if (isset($_POST['admin']))       $putright5 = "1"; else $putright5 = "0";
  78  
  79  //you cannot degrade yourself, if you're an administrator!!
  80  if (($putright5 == "0") AND ($editid == getuserid($_SESSION['nickname']))) {
  81      $putright5 = "1";
  82      $message = bla("msg_admindegrade");
  83      $return = false;
  84  }
  85  
  86  //prepare password-change
  87  if (($_POST['password'] != "default") 
  88  AND ($_POST['password'] == $_POST['password2'])) {
  89  
  90      $putpass = "password = '" . md5($_POST['password']) . "',";
  91      $return = true;
  92      $changepass = true;
  93  
  94  } else { 
  95      $putpass = "";
  96      if ($_POST['password'] != $_POST['password2']) {
  97      $message = bla("msg_errorpassconfirm");
  98      $return = false;
  99      }
 100  }
 101      
 102  $dosql = "UPDATE ".$GLOBALS['prefix']."lb_authors SET
 103            " . $putpass . "
 104            nickname    = '" . $putnick . "',
 105            realname    = '" . $putreal . "',
 106            mail        = '" . $putmail . "',
 107            edit_own    = '" . $putright1 . "',
 108            publish_own = '" . $putright2 . "',
 109            edit_all    = '" . $putright3 . "',
 110            publish_all = '" . $putright4 . "',
 111            admin       = '" . $putright5 . "'
 112            
 113            WHERE id = '" . $editid . "';";
 114  $GLOBALS['lbdata']->Execute($dosql);
 115  
 116  echo "<p class=\"msg\">". $message . "</p>";
 117  
 118  //set fresh cookies, if user is editing his own data
 119  if ($editid == getuserid($_SESSION['nickname'])) {
 120      $_SESSION['nickname'] = $putnick;
 121      if ($changepass) {
 122          $_SESSION['password'] = md5($_POST['password']);
 123      }
 124  }
 125  
 126  return $return;
 127  
 128  }
 129  
 130  // ----------------------------------------------------------------
 131  
 132  function deleteauthor ($delid) {
 133  
 134  global $settings;
 135  //delete author from database
 136  $dosql = "DELETE FROM ".$GLOBALS['prefix']."lb_authors 
 137            WHERE id = '". $delid . "';";
 138  $GLOBALS['lbdata']->Execute($dosql);
 139  }         
 140  
 141  
 142  // ----------------------------------------------------------------
 143  
 144  function showauthor ($editid, $new) {
 145  
 146  global $settings;
 147  if ($new) {
 148      $tempdate = date('Y-m-d H:i:s');
 149  
 150      //insert a new row to the database and fill it with empty data
 151      $dosql = "INSERT INTO ".$GLOBALS['prefix']."lb_authors
 152               (joined, nickname, realname, mail, password,
 153               edit_own, publish_own, edit_all, publish_all, admin)   
 154               VALUES
 155               (
 156               '".$tempdate."', '".$_POST['newnick']."', 
 157               '".$_POST['newname']."', '".$_POST['newmail']."', 
 158               '', '1', '0', '0', '0', '0'
 159               )";
 160      $GLOBALS['lbdata']->Execute($dosql);
 161  
 162      //finding the id of the new entry
 163      $dosql = "SELECT id FROM ".$GLOBALS['prefix']."lb_authors 
 164                WHERE joined = '".$tempdate."';";
 165      $row = $GLOBALS['lbdata']->GetArray($dosql);
 166      $editid = $row[0]['id'];
 167  }
 168  
 169  //getting data for requested author-id from authors-table
 170  $dosql = "SELECT * FROM ".$GLOBALS['prefix']."lb_authors 
 171            WHERE id = '" . $editid . "';";
 172  $result = $GLOBALS['lbdata']->GetArray($dosql);
 173  $author = $result[0];
 174  
 175  echo "<div id=\"authordetails\">\n";
 176  echo "<h2>".bla("org_authordetails")." ".$author['nickname']."</h2>\n";
 177  
 178  //start the form
 179  echo "<form action=\"index.php?page=organisation&amp;do=saveauthor&amp;id=". $editid;
 180  echo "\" method=\"post\" enctype=\"multipart/form-data\">\n\n";
 181  
 182  echo "<table>\n\n";
 183  
 184  //showing date/time of joining
 185  $dateformat = $settings['dateformat'];
 186  $showdate = date($dateformat , strtotime($author['joined']));
 187  echo "<tr><td class=\"left\">".bla("org_joined").":</td><td>" . $showdate . "</td></tr>\n";
 188  
 189  //nickname
 190  echo "<tr><td class=\"left\">".bla("org_nickname").":</td><td>";
 191  echo "<input type=\"text\" name=\"nickname\" value=\"";
 192  echo $author['nickname'] . "\" /></td></tr>\n";
 193  
 194  //real name
 195  echo "<tr><td class=\"left\">".bla("org_fullname").":</td><td>";
 196  echo "<input type=\"text\" name=\"realname\" value=\"";
 197  echo $author['realname'] . "\" /></td></tr>\n";
 198  
 199  //email-adress
 200  echo "<tr><td class=\"left\">".bla("org_mail").":</td><td>";
 201  echo "<input type=\"text\" name=\"mail\" value=\"";
 202  echo $author['mail'] . "\" /></td></tr>\n";
 203  
 204  //show the author's publication-rights
 205  echo "<tr><td class=\"left\">".bla("org_rightshort1").":</td>\n<td class=\"explain\">";
 206  echo "<input name=\"edit_own\" type=\"checkbox\" ";
 207  echo checker($author['edit_own']) . " /> ";
 208  echo bla("org_right1")."</td></tr>\n";
 209  
 210  echo "<tr><td class=\"left\">".bla("org_rightshort2").":</td>\n<td class=\"explain\">";
 211  echo "<input name=\"publish_own\" type=\"checkbox\" ";
 212  echo checker($author['publish_own']) . " /> ";
 213  echo bla("org_right2")."</td></tr>\n";
 214  
 215  echo "<tr><td class=\"left\">".bla("org_rightshort3").":</td>\n<td class=\"explain\">";
 216  echo "<input name=\"edit_all\" type=\"checkbox\" ";
 217  echo checker($author['edit_all']) . " /> ";
 218  echo bla("org_right3")."</td></tr>\n";
 219  
 220  echo "<tr><td class=\"left\">".bla("org_rightshort4").":</td>\n<td class=\"explain\">";
 221  echo "<input name=\"publish_all\" type=\"checkbox\" ";
 222  echo checker($author['publish_all']) . " /> ";
 223  echo bla("org_right4")."</td></tr>\n";
 224  
 225  echo "<tr><td class=\"left\">".bla("org_rightshort5").":</td>\n<td class=\"explain\">";
 226  echo "<input name=\"admin\" type=\"checkbox\" ";
 227  echo checker($author['admin']) . " /> ";
 228  echo bla("org_right5")."</td></tr>\n";
 229  
 230  
 231  //password with password-confirm
 232  if ($new) { $hiddenpass = ""; } else { $hiddenpass = "default"; }
 233  
 234  echo "<tr><td class=\"left\">".bla("org_changepass1").":</td>\n<td>";
 235  echo "<input type=\"password\" name=\"password\" value=\"";
 236  echo $hiddenpass . "\" /></td></tr>\n";
 237  
 238  echo "<tr><td class=\"left\">".bla("org_changepass2").":</td>\n<td>";
 239  echo "<input type=\"password\" name=\"password2\" value=\"";
 240  echo $hiddenpass . "\" /></td></tr>\n";
 241  
 242  //update-button
 243  echo "<tr><td class=\"left\"></td><td>";
 244  echo "<input type=\"submit\" name=\"update\" value=\"".bla("but_save")."\" /></td></tr>\n";
 245  
 246  echo "</table>";
 247  
 248  //finish the form
 249  echo "</form>";
 250  
 251  echo "</div>";
 252  
 253  }
 254  
 255  // ----------------------------------------------------------------
 256  
 257  function showcatsandauthors () {
 258  
 259  global $settings;
 260  
 261  //-------------------- authors-list ----------
 262  
 263  echo "<div id=\"authors\">\n";
 264  echo "<h2>".bla("org_editauthors")."</h2>\n\n";
 265  
 266  //starting the table
 267  echo "<table>\n\n";
 268  echo "<tr><th>".bla("org_nickname")."</th><th>".bla("org_fullname")."</th><th>".bla("org_mail")."</th>";
 269  echo "<th>".bla("org_rights")."</th><th></th></tr>";
 270  
 271  //getting all data from authors-table
 272  $dosql = "SELECT * FROM ".$GLOBALS['prefix']."lb_authors ORDER BY id";
 273  $result = $GLOBALS['lbdata']->GetArray($dosql);
 274  $i = 1;
 275  foreach ($result as $row) {
 276  
 277  echo "<tr>\n";
 278  
 279  /*
 280  //showing date/time of joining
 281  $dateformat = $settings['dateformat'];
 282  $showdate = date($dateformat , strtotime($row['joined']));
 283  echo "<td>" . $showdate . "</td>\n";
 284  */
 285  
 286  echo "<td><a href=\"index.php?page=organisation&amp;do=editauthor&amp;id=".$row['id'];
 287  echo "\">" . $row['nickname'] . "</a></td>\n";
 288  echo "<td><a href=\"index.php?page=organisation&amp;do=editauthor&amp;id=".$row['id'];
 289  echo "\">" . $row['realname'] . "</a></td>\n";
 290  echo "<td><a href=\"mailto:".$row['mail']."\">".$row['mail']."</a></td>\n";
 291  
 292  //show the author's publication-rights
 293  echo "<td>\n";
 294  echo "<input type=\"checkbox\" disabled=\"disabled\" ";
 295  echo checker($row['edit_own']) . " title=\"".bla("org_right1")."\" />\n";
 296  echo "<input type=\"checkbox\" disabled=\"disabled\" ";
 297  echo checker($row['publish_own']) . " title=\"".bla("org_right2")."\" />\n";
 298  echo "<input type=\"checkbox\" disabled=\"disabled\" ";
 299  echo checker($row['edit_all']) . " title=\"".bla("org_right3")."\" />\n";
 300  echo "<input type=\"checkbox\" disabled=\"disabled\" ";
 301  echo checker($row['publish_all']) . " title=\"".bla("org_right4")."\" />\n";
 302  echo "<input type=\"checkbox\" disabled=\"disabled\" ";
 303  echo checker($row['admin']) . " title=\"".bla("org_right5")."\" />\n</td>\n";
 304  
 305  
 306  //a simple delete button
 307  echo "<td class=\"right\">\n";
 308  echo "<form method=\"post\" enctype=\"multipart/form-data\" 
 309        action=\"index.php?page=organisation&amp;do=delauthor&amp;id=".$row['id'];
 310  echo "\" onSubmit=\"return yesno('".bla("alert_deleteauthor")."')\">\n";
 311  echo "<input type=\"submit\" value=\"".bla("but_delete")."\" />\n</form>\n</td>\n";
 312  
 313  
 314  echo "</tr>\n\n";
 315  
 316  $i += 1;
 317  }
 318  
 319  //button for new author
 320  echo "<form method=\"post\" enctype=\"multipart/form-data\" 
 321        action=\"index.php?page=organisation&amp;do=newauthor\">";
 322        echo "<tr>\n";
 323  echo "<td><input type=\"text\" name=\"newnick\" value=\"\" /></td>\n";
 324  echo "<td><input type=\"text\" name=\"newname\" value=\"\" /></td>\n";
 325  echo "<td><input type=\"text\" name=\"newmail\" value=\"\" /></td>\n";
 326  echo "<td></td>\n<td class=\"right\">\n";
 327  echo "<input type=\"submit\" value=\"".bla("but_new")."\" />\n";
 328  
 329  echo "</td>\n</tr>\n</form>\n</table>\n";
 330  echo "</div>\n\n\n";
 331  
 332  
 333  //-------------------- categories ----------
 334  
 335  echo "<div id=\"categories\">\n";
 336  echo "<h2>".bla("org_editcats")."</h2>\n\n";
 337  
 338  //getting all data from category-table
 339  $dosql = "SELECT * FROM ".$GLOBALS['prefix']."lb_categories ORDER BY id;";
 340  $result = $GLOBALS['lbdata']->GetArray($dosql);
 341  $i = 1;
 342  foreach ($result as $row) {
 343      $cats[$i] = $row;
 344      $i += 1;
 345  }
 346  
 347  //start the form
 348  echo "<form action=\"index.php?page=organisation&amp;do=savecats\"";
 349  echo " method=\"post\" enctype=\"multipart/form-data\">\n\n";
 350  
 351  //show all items in each list
 352  echo "<table>\n";
 353  echo "<tr><th>".bla("org_catname")."</th><th>".bla("org_catdesc")."</th><th></th></tr>";
 354  
 355  $i = 1;
 356  foreach ($cats as $showcat) {
 357  
 358      //show category
 359      echo "<tr>\n<td>\n";
 360      echo "<input class=\"cat\" type=\"text\" value=\"" . $cats[$i]['name'];
 361      echo "\" name=\"cat" . $cats[$i]['id'] . "\" />\n</td>\n<td>";
 362      
 363      //show description
 364      echo "<input class=\"desc\" type=\"text\" value=\"" . $cats[$i]['description'];
 365      echo "\" name=\"desc" . $cats[$i]['id'] . "\" />\n</td>\n";
 366      
 367      //show delete button
 368      echo "<td class=\"right\"><input onClick=\"return yesno('".bla("msg_deletecategory")."')\" type=\"submit\" value=\"".bla("but_delete")."\" ";
 369      echo "name=\"del" . $cats[$i]['id'] . "\" />\n</td>\n</tr>\n\n";
 370      
 371      $i += 1;
 372  }
 373  
 374  //show a new category, which is to be filled
 375  echo "<tr>\n<td>";
 376  echo "<input class=\"cat\" name=\"newcat\" type=\"text\" value=\"\" /></td>\n";
 377  echo "<td><input class=\"desc\"name=\"newdesc\" type=\"text\" value=\"\" />";
 378  echo "</td><td class=\"right\"><<< ".bla("org_addnew")."&nbsp;</td>\n";
 379  echo "</tr>\n";
 380  echo "<tr class=\"last\"><td colspan=\"2\"></td>";
 381  echo "<td class=\"right\"><input type=\"submit\" value=\"".bla("but_saveall")."\" /></td>";
 382  
 383  echo "</table>";
 384  
 385  
 386  
 387  echo "</form>\n";
 388  
 389  // -----                Tags   -----------------------//
 390  echo "\n\n<h2>".bla("org_cattag")."</h2>\n\n";
 391  
 392  echo "<table><tr><th>".bla("org_cat")."</th><th>".bla("org_newtag")."</th><th></th></tr>";
 393  echo "<form action=\"index.php?page=organisation&amp;do=tagfromcat\"";
 394  echo " method=\"post\" enctype=\"multipart/form-data\">\n\n";
 395  echo "<tr><td>";
 396  echo "<select name=\"catname\" class=\"cat\">";
 397  $i = 1;
 398  
 399  foreach ($cats as $showcat) {
 400  echo "<option value=\"".$cats[$i]['id']."\">".$cats[$i]['name']."</option>";
 401  $i+=1;
 402        }
 403  echo "</select>";
 404  echo "</td><td>";
 405  echo "<input type=\"text\" name=\"newtagname\" value=\"\" class=\"tag\" />";
 406  echo "</td><td>";
 407  echo "<input type=\"submit\" value=\"Make tag\" />";
 408  echo "</td></tr>";
 409  echo "</table>";
 410  
 411  echo "</form>";
 412  echo "<p>".bla("org_cattag_help")."</p>\n";
 413  echo "\n\n<h2>".bla("org_managetags")."</h2>\n\n";
 414  echo "<table><tr><th>".bla("org_tag")."</th><th>".bla("org_action")."</th><th>".bla("org_newname")."</th></tr>";
 415  echo "<form action=\"index.php?page=organisation&amp;do=edittag\"";
 416  echo " method=\"post\" enctype=\"multipart/form-data\">\n\n";
 417  echo "<tr><td>";
 418  echo "<select name=\"tagnames\" class=\"cat\">";
 419  $taglist = gettaglist();
 420  foreach($taglist as $tag)  {
 421    echo "<option value=\"".$tag."\">".$tag."</option>\n";
 422  }
 423  echo "</td><td><input type=\"radio\" name=\"tagaction\" value=\"deletetag\"> ".bla("org_deletetag")."</td><td></td></tr>\n";
 424  
 425  echo "<tr><td></td><td><input type=\"radio\" name=\"tagaction\" value=\"amendtag\"> ".bla("org_replacetag")." >>></td>\n";
 426  
 427  echo "<td><input type=\"text\" name=\"newtagname\" class=\"tag\" /></td></tr>";
 428  echo "<tr><td></td><td><input type=\"radio\" name=\"tagaction\" value=\"createcat\"> ".bla("org_tagtocat")." >>></td>\n";
 429  echo "<td><select name=\"catname\" class=\"tag\">";
 430  $i = 1;
 431  
 432  foreach ($cats as $showcat) {
 433  echo "<option value=\"".$cats[$i]['id']."\">".$cats[$i]['name']."</option>";
 434  $i+=1;
 435        }
 436  echo "</select></td></tr>";
 437  echo "<tr><td></td><td></td><td><input onClick=\"return yesno('".bla("org_confirmchange")."')\" type=\"submit\" value=\"Submit\" /></td></tr>";
 438  echo "</form></table>\n";
 439  echo "<p>".bla("org_managetags_help")."</p>";
 440  echo "</div>\n\n";
 441  
 442  } 
 443  
 444  function amendtags($criteria,$action,$oldtag,$newtag)   {
 445   if ($action == "add") {$message = bla("msg_addtag_1").$newtag.bla("msg_addtag_2");}
 446   if ($action ==  "delete") {$message = bla("msg_deletetag").$oldtag."'";}
 447   if ($action == "replace") {$message = bla("msg_replacetag_1").$oldtag.bla("msg_replacetag_2").$newtag."'";}
 448   if (($action == "replace")AND(veryempty($newtag))) {$message = bla("msg_no_tag");}
 449   if (($action == "add")AND(veryempty($newtag))) {$message = bla("msg_no_tag");}
 450  //we want to add, delete or replace $oldtag - so lets get tag info for all posts
 451    $dosql = "SELECT id, tags FROM ".$GLOBALS['prefix']."lb_postings".$criteria;
 452    $tagarray = $GLOBALS['lbdata'] -> GetArray($dosql);
 453    $i = 0;
 454  //go through the posts one by one
 455     foreach ((array)$tagarray as $tagline)  {
 456                $newtagline = "";
 457                $tags = explode(" ",$tagarray[$i]['tags']);
 458  //if 'add' and $newtag is not already present, add it
 459                      if (($action == "add")AND(!in_array($newtag,$tags)))
 460                                  {$newtagline = $tagline['tags']." ".$newtag;
 461                                  }
 462                                  else {
 463                                  foreach ($tags as $t)  {
 464  //if 'delete' and we find $oldtag, then delete it
 465                                          if (($action == "delete")AND($t == $oldtag))
 466                                          {continue;}
 467  //if 'replace' and we find $oldtag, replace it with $newtag (unless $newtag is an empty string)
 468                                          if (($action == "replace")AND($t == $oldtag)AND(!veryempty($newtag)))
 469                                          {$t = $newtag;}
 470                                          $newtagline.= " ".$t;
 471                                                        }
 472                                          }
 473  //replace the old tag line in the array with the new tag line
 474             $tagarray[$i]['tags'] = trim($newtagline);
 475  //go back for the next line
 476             $i +=1;
 477           }
 478  //and post the new taglines in the database
 479   foreach ((array)$tagarray as $tagline)   {
 480         $tagline['tags'] = htmlentities($tagline['tags'], ENT_QUOTES, "UTF-8");
 481           $dosql = "UPDATE ".$GLOBALS['prefix']."lb_postings SET tags = '".$tagline['tags']."' WHERE id = '".$tagline['id']."'";
 482           if (!$GLOBALS['lbdata']->Execute($dosql)) {$message = bla("msg_database_error");}
 483         }
 484   message($message);
 485  
 486   }
 487   function catfromtag($category,$newtag) {
 488     $message = bla("msg_cat_1").$newtag.bla("msg_cat_2");
 489  //we want to add every post with tag $newtag to the category $category
 490  //get information about tags and categories for all posts
 491     $dosql = "SELECT id, tags, category1_id, category2_id, category3_id, category4_id FROM ".$GLOBALS['prefix']."lb_postings";
 492     $tagarray = $GLOBALS['lbdata'] ->GetArray($dosql);
 493     $i = 0;
 494  //examine the information about each post
 495        foreach ($tagarray as $tagline)   {
 496  //assume that we should add this posting to $category
 497               $include = "yes";
 498  //is $newtag in the tag-string? No? Then we don't put this post into $category
 499               $tags = explode(" ",$tagline['tags']);
 500               if(!in_array($newtag,$tags))  {
 501                     $include = "no"; }
 502  //and is the post already in $category? Yes? Then we don't want to do it again
 503                     else { $catarray = array_slice($tagline,2,4);
 504                            if (in_array($category,$catarray))  {
 505                              $include = "no";   }
 506                          }
 507              if ($include == "yes")   {
 508  //find the first empty category slot - category1_id, category2_id etc
 509            for ($j = 1, $where = 0; ($where == 0)AND($j <5); $j++)  {
 510                $catlocation = "category".$j."_id";
 511                $where = $j*($tagline[$catlocation] == 0);
 512                 }
 513  //if there are no empty category slots, then we can't add this post to $category
 514         if ($where == 0)  {$include = "no";} }
 515         if($include == "yes")  {
 516  //write $category into the database in the empty category_id slot which we have found
 517         $dosql = "UPDATE ".$GLOBALS['prefix']."lb_postings
 518                  set category".$where."_id = '".$category."' WHERE id = '".$tagline['id']."'";
 519         if (!$GLOBALS['lbdata'] -> Execute($dosql)) $message = bla("msg_database_error");
 520       }
 521  //and go back for the next posting
 522     $i++;
 523            }
 524   message($message);
 525  
 526  }
 527  
 528  function message($content)   {
 529    //a very crude way to blank out any existing message
 530  echo "<p class=\"msg\">                                                                          </p>";
 531    //and a slightly more elegant way of putting a new message on the page
 532  echo "<p class=\"msg\">".$content."</p>";
 533  }
 534  

title

Description

title

Description

title

Description

title

title

Body