/** * Parses JSON object for tweets, gets sentiment object & writes to file with date * @param array of JSON data, number of tweets to analyze */ function parseData($arr, $num) { global $path; $count = 0; $flag = file_exists($path); $res = array(); //for debug $ind = 0; foreach ($arr as $tweet) { if ($flag == true) { $flag = false; continue; } $date = getTweetDate($tweet); $id = getTweetID($tweet); $str = getTweetText($tweet); $str = cleanTweet($str); if (strlen($str) < 5) { continue; } //using alchamy $sentiment = getTweetSentiment($str); $result = array(); $result[0] = $id; $result[1] = $date; $result[2] = $str; $result[3] = $sentiment->type; $result[4] = $sentiment->score; $resultString = getCacheString($result); writeInfo($result); writeData($resultString); $res[$ind++] = $resultString; if ($count > $num) { break; } $count++; } return $res; }
<?php /** * create a folder * @author Logan Cai (cailongqun [at] yahoo [dot] com [dot] cn) * @link www.phpletter.com * @since 22/May/2007 * */ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "inc" . DIRECTORY_SEPARATOR . "config.php"; @ob_start(); displayArray($_POST); writeInfo(@ob_get_clean()); echo "{"; $error = ""; $info = ""; /* $_POST['new_folder'] = substr(md5(time()), 1, 5); $_POST['currentFolderPath'] = "../../uploaded/";*/ if (CONFIG_SYS_VIEW_ONLY || !CONFIG_OPTIONS_NEWFOLDER) { $error = SYS_DISABLED; } elseif (empty($_POST['new_folder'])) { $error = ERR_FOLDER_NAME_EMPTY; } elseif (!preg_match("/^[a-zA-Z0-9_\\- ]+\$/", $_POST['new_folder'])) { $error = ERR_FOLDER_FORMAT; } else { if (empty($_POST['currentFolderPath']) || !isUnderRoot($_POST['currentFolderPath'])) { $error = ERR_FOLDER_PATH_NOT_ALLOWED; } elseif (file_exists(addTrailingSlash($_POST['currentFolderPath']) . $_POST['new_folder'])) { $error = ERR_FOLDER_EXISTS; } else { include_once CLASS_FILE;
# # # ## # compinfo-view.php :: View & edit company info ## # get settings require "settings.php"; require "https_urlsettings.php"; if (isset($_POST["key"])) { switch ($_POST["key"]) { case "confirm": $OUTPUT = confirmInfo($_POST); break; case "write": $OUTPUT = writeInfo($_POST); break; default: $OUTPUT = showInfo(); } } else { $OUTPUT = showInfo(); } # display output require "template.php"; # print Info from db function showInfo() { # connect to db db_connect(); $sql = "SELECT * FROM compinfo WHERE div = '" . USER_DIV . "'";