mirror of
https://gitlab.com/CodeSolutionsProject/CodeShare.git
synced 2026-02-14 09:01:33 +01:00
69 lines
1.9 KiB
PHP
69 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: joselucross
|
|
* Date: 7/07/17
|
|
* Time: 11:42
|
|
*/
|
|
|
|
|
|
/*
|
|
* Methods to get an array to send to twig
|
|
*/
|
|
|
|
function lastToArray($db,&$query,$supported){
|
|
$last = array();
|
|
while($var = dbw_fetch_array($db->conn,$query)){
|
|
$array = array
|
|
( "idc" => $var["IDC"],
|
|
"lang" => $var["Lang"],
|
|
"version" => $var["Version"],
|
|
"name" => $var["Name"],
|
|
"nick" => $var["nick"],
|
|
"lLang" => $supported[$var["Lang"]][0],
|
|
"description" => $var["Description"],
|
|
"code" => html_entity_decode($var["Code"]),
|
|
);
|
|
array_push($last,$array);
|
|
}
|
|
return $last;
|
|
}
|
|
|
|
function allCodeToArray(&$query,$supported){
|
|
$code = array(
|
|
"idc" => $query['IDC'],
|
|
"lang" => $query['Lang'],
|
|
"version" => $query['Version'],
|
|
"name" => $query['Name'],
|
|
"nick" => $query['nick'],
|
|
"idu" => $query['IDU'],
|
|
"lLang" => $supported[$query['Lang']][0],
|
|
"description" => $query['Description'],
|
|
"code" => html_entity_decode($query['Code']),
|
|
"input" => html_entity_decode($query['Input']),
|
|
"output" => html_entity_decode($query['Output']),
|
|
"rows" => substr_count($query['Code'],"\n"),
|
|
"extlib" => $query['UseExtLib'],
|
|
"extlibver" => $query['UseExtLibVer'],
|
|
);
|
|
return $code;
|
|
|
|
}
|
|
|
|
function otherImplementationToArray($db,&$query,$supported){
|
|
$other = array();
|
|
while($var = dbw_fetch_array($db->conn,$query)){
|
|
$array = array
|
|
( "lang" => $var["Lang"],
|
|
"version" => $var["Version"],
|
|
"lLang" => $supported[$var["Lang"]][0],
|
|
"code" => html_entity_decode($var["Code"]),
|
|
);
|
|
array_push($other,$array);
|
|
}
|
|
return $other;
|
|
}
|
|
|
|
function otherVersionToArray($db,$query,$supported){
|
|
return lastToArray($db,$query,$supported);
|
|
} |