[SATLUG] PHP Debugging Help Needed

Ed Coates edcoates at gmail.com
Sun Aug 14 19:09:32 CDT 2011


Hi All,

Is there anyone out there with any php that might want to take a look
at something for me?  It's an older recipe web page that I don't think
is supported anymore, but if I can get past a couple of errors, it has
a few nice features that I'm hope to use.

When I try and access the web page, nothing comes up, but when I try
php from the command line, I get this error:

PHP Deprecated:  Function set_magic_quotes_runtime() is deprecated in
/usr/local/lib/koch-suite/setup.inc on line 61
PHP Fatal error:  Cannot re-assign $this in
/usr/local/lib/koch-suite/functions.inc on line 238

Here is the function that is having problems.  I don't know anything
about php so don't know where to being here, any insight would be
appreciated:

 function exec_search ($str, $where, $param = '') {

    $return          = array();
    $return_is_empty = true;

    /*
     * (future) Grammer:
     * split by 'AND', then split by 'OR' and finally lookout for 'NOT'
     * 'AND' has a higher priority then 'OR'.
     * i.e.: 'Muffins AND Choc OR Strawberry' searches for all Choclate or
     *       Strawberry-Muffins.
     *
     * current status: 'AND' only.
     */

    $and = split(" AND ", $str);
    foreach ($and as $this) {

      switch ($where) {
        case 'title':
          if ($param == 1) {
            $result = get_mid_by_name("");
          } else if (is_string ($param) and !is_numeric($param) and
strlen($param) == 1) {
            $result = get_mid_by_name("$param", 1);
          } else {
            $result = get_mid_by_name("$this");
          }
          break;
        case 'cat':
          $result = get_mid_by_cat($this);
          break;
        case 'ingred':
          $result = get_mid_by_ingred($this);
          break;
        case 'Source':
        case 'Recorder':
          $result = get_mid_by_meta($where, $this);
          break;
      }

      /* Intersection with an empty array is empty. So we need to catch
       * this situation first.
       */
      if (!$return_is_empty) {
        $return = KS_array_intersect($return, $result);
      } else {
        $return = $result;
        $return_is_empty = false;
      }
    }

    /* We are done here, sort and return the result. */
    if (isset($return)) {
      uasort($return, "cmp_menu");
      return $return;
    } else {
      return false;
    }
  }


More information about the SATLUG mailing list