if ($depth >= 30) { return false; } /* step through inArray */ foreach ($inArray as $key => $val) { if (is_array($val)) { /* recurse on array elements */ $newArray[$key] = utf8json($val); } else { /* encode string values */ $newArray[$key] = utf8_encode($val); } } /* return utf8 encoded array */ return $newArray; } switch ($action) { case "vote": include_once "stream.php"; $main_class = new stream(1); $main_class->add_vote($json_data); break; case "get_tweets": include_once "classify.php"; include_once "stream.php"; $main_class = new stream(1); $main_class->get_tweets($json_data); break; default: break; }
break; case "classify": include_once "classify.php"; $main_class = new classify(); $main_class->add_tweets(); $db->query("SELECT * FROM `init_tweets`"); while ($tweet = $db->fetch_row()) { $db->query("UPDATE `init_tweets` SET `guess`='" . $main_class->classify_tweet($tweet['tweet']) . "' WHERE `id`=" . $tweet['id'], true); } break; default: $page = "tweet_display"; include_once "classify.php"; include_once "stream.php"; $main_class = new stream(); $main_class->get_tweets(); break; } // include global js if (is_array($config['global_js']) && sizeof($config['global_js']) != 0) { foreach ($config['global_js'] as $js_includes) { $tmpl_header->assign('include_path', $js_includes); $tmpl_header->parse('header.javascript_includes'); } } // include page specific js if (is_array($main_class->js_includes) && sizeof($main_class->js_includes) != 0) { foreach ($main_class->js_includes as $js_includes) { $tmpl_header->assign('include_path', $js_includes); $tmpl_header->parse('header.javascript_includes'); }