} if (isset($_GET['term'])) { $action = 'autocomplete'; $term = $_GET['term']; } if (isset($action)) { switch ($action) { case "add_new_relationship": // do something. $subject_1_name = $_POST['subject_1_name']; $subject_2_name = $_POST['subject_2_name']; $description = $_POST['relationship_description']; $subject_1 = new Subject(); $subject_1->load_from_name($subject_1_name); $subject_2 = new Subject(); $subject_2->load_from_name($subject_2_name); $new_rel = new Relationship(); $new_rel->subject_id_1 = $subject_1->id; $new_rel->subject_id_2 = $subject_2->id; $new_rel->description = $description; if ($new_rel->save()) { return true; } else { return false; } break; case "autocomplete": $a_json = array(); $a_json_row = array(); $db = Database::get_instance(); $query = $db->prepare("SELECT description FROM relationships WHERE description LIKE ? ORDER BY description");
*/ if (!isset($APP)) { die; } $default_controller = $APP['controller_path'] . '/news_controller.php'; $constraint = NULL; $id = NULL; if (isset($_GET['constraint'])) { $constraint = trim($_GET['constraint']); } if (isset($_GET['id'])) { $id = (int) trim($_GET['id']); } $post_data = 'action: "view_subject"'; $news_feeds = new Subject(); $news_feeds->load_from_name('News Feeds'); $feeds_object_array = $news_feeds->to_array(); $feeds_string = ''; foreach ($feeds_object_array['aspects'] as $x) { $feeds_string .= '"' . $x['aspect_data'] . '",'; } $feeds_string = rtrim($feeds_string, ","); ?> <div class="col-xs-12" id="main_view"> <h3>Today's News</h3> <div id="feed_display" class="feed_stage" style="padding: 0px;"></div> </div> <script type="text/javascript">
* @since File included in initial release * */ // bootstrap the rest of the codebase. require_once '../config.php'; csfr_protection(); $db = Database::get_instance(); $action = NULL; if (isset($_POST['action'])) { $action = trim($_POST['action']); } if (isset($action)) { switch ($action) { case "view_dash": break; case "inspire_me": $sayings = new Subject(); $sayings->load_from_name('Inspirations'); $sayings_array = $sayings->to_array(); $output = $sayings_array['aspects'][array_rand($sayings_array['aspects'])]['aspect_data']; // print_r($inspirational_sayings); echo $output; break; default: new LogEntry(__FILE__ . " was hit with an invalid action, from IP: " . $_SERVER['REMOTE_ADDR']); echo 'There was an error. It has been logged.'; } } else { new LogEntry(__FILE__ . " was hit with no action, from IP: " . $_SERVER['REMOTE_ADDR']); echo 'There was an error. It has been logged.'; }