prepare(' SELECT `project_id`, `project_name`, COALESCE(`project_name_clean`, REPLACE(LOWER(`project_name`), \' \', \'-\')) AS `project_name_clean`, `project_summary`, `project_description`, `project_featured`, `project_order`, `project_homepage`, `project_repository`, `project_forum`, UNIX_TIMESTAMP(`project_archived`) AS `project_archived`, `project_type`, UNIX_TIMESTAMP(`project_created`) AS `project_created`, `project_colour` FROM `fm_projects` WHERE `project_deleted` IS NULL '. ($randomFeatured ? ' AND `project_featured` <> 0 ORDER BY RAND()' : 'ORDER BY `project_order` DESC') ); $getProjects->execute(); $projects = $getProjects->fetchAll(PDO::FETCH_OBJ); $activeProjects = []; $toolProjects = []; $archivedProjects = []; foreach($projects as $project) { if(!empty($project->project_archived)) $archivedProjects[] = $project; elseif($project->project_type === 'Tool') $toolProjects[] = $project; else $activeProjects[] = $project; } $getLanguages = $pdo->prepare(' SELECT pl.`language_id`, pl.`language_name`, pl.`language_colour` FROM `fm_proglangs` AS pl LEFT JOIN `fm_projects_proglangs` AS ppl ON ppl.`language_id` = pl.`language_id` WHERE ppl.`project_id` = :project_id ORDER BY ppl.`priority` '); function fm_project_box(stdClass $project, array $languages): string { $colour = html_colour(isset($languages[0]->language_colour) ? $languages[0]->language_colour : 0x212121); $html = <<

{$project->project_name}

{$project->project_summary}

\r\n HTML; $indent = ' '; foreach($languages as $lang) { $colour = html_colour($lang->language_colour); $html .= "{$indent}
{$lang->language_name}
\r\n"; } $html .= "{$indent}
\r\n"; $links = ''; if(!empty($project->project_homepage)) $links .= " project_homepage}\">\"\" Homepage\r\n"; if(!empty($project->project_repository)) $links .= " project_repository}\">\"\" Source\r\n"; if(!empty($project->project_forum)) $links .= " project_forum}\">\"\" Discussion\r\n"; if(!empty($links)) { $html .= "{$indent}
\r\n"; $html .= "{$indent}{$links}"; $html .= "{$indent}
\r\n"; } $html .= <<
\r\n HTML; return $html; } if(isset($_GET['dump_that_shit'])) { $doConvert = !isset($_GET['noconvert']); $meow = []; $projects = array_merge($activeProjects, $toolProjects, $archivedProjects); foreach($projects as $project) { if($doConvert) { $projKeys = array_keys((array)$project); foreach($projKeys as $key) { $project->{substr($key, 8)} = $project->{$key}; unset($project->{$key}); } } $getLanguages->bindValue('project_id', $project->id ?? $project->project_id); $getLanguages->execute(); $project->languages = $getLanguages->fetchAll(PDO::FETCH_OBJ); if($doConvert) { $langKeys = array_keys((array)$project->languages[0]); for($i = 0; $i < count($project->languages); ++$i) foreach($langKeys as $key) { if(!isset($project->colour)) $project->colour = $project->languages[$i]->language_colour; $project->languages[$i]->{substr($key, 9)} = $project->languages[$i]->{$key}; unset($project->languages[$i]->{$key}); } } if($randomFeatured || !$doConvert) $meow[] = $project; else { $key = $project->archived ? 'archive' : strtolower($project->type); $meow[$key][] = $project; } } header('Content-Type: application/json; charset=utf-8'); echo json_encode($meow); return; } echo html_doctype(); ?> Projects

Active Projects

bindValue('project_id', $project->project_id); $getLanguages->execute(); $languages = $getLanguages->fetchAll(PDO::FETCH_OBJ); echo fm_project_box($project, $languages); } ?>

Tools

bindValue('project_id', $project->project_id); $getLanguages->execute(); $languages = $getLanguages->fetchAll(PDO::FETCH_OBJ); echo fm_project_box($project, $languages); } ?>

Archived Projects

bindValue('project_id', $project->project_id); $getLanguages->execute(); $languages = $getLanguages->fetchAll(PDO::FETCH_OBJ); echo fm_project_box($project, $languages); } ?>