Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/controllers/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function Record() {
$cursor = $this->getModel()->find($this->db, $this->collection, $query, $fields, $limit, $skip, $type);

$ordeBy = $this->getSort($this->request->getParam('order_by', false), $this->request->getParam('orders', false));
if ($ordeBy)
if ($ordeBy && is_object($cursor))
$cursor->sort($ordeBy);

$record = $cryptography->decode($cursor, $type);
Expand Down
6 changes: 5 additions & 1 deletion application/views/Collection/_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
echo '&nbsp<a href="' . Theme::URL('Collection/DeleteRecord', array('db' => $this->db, 'collection' => $this->collection, 'id' => $this->data['record']['document'][$i]['_id'], 'id_type' => gettype($this->data['record']['document'][$i]['_id']))) . '" class="icon-remove" title="Delete">' . I18n::t('') . '</a>';
}
echo "<pre>";
print_r($cursor);
if ($format == 'document') {
echo htmlspecialchars(print_r($cursor, true));
} else {
print_r($cursor);
}
echo "</pre>";
}
?>
Expand Down
8 changes: 7 additions & 1 deletion system/Cryptography.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ public function arrayToString($array, $tab = "") {
$string.="\"$key\"" . '=>' . $this->objectToString($value);
} else if (is_numeric($value)) {
$string.="\"$key\"" . '=>' . $value;
} else if (is_bool($value)) {
$string.="\"$key\"" . '=>' . ($value ? 'true' : 'false');
} else {
$string.="\"$key\"" . '=>' . "\"$value\"";
$string.="\"$key\"" . '=>' . "'".str_replace(array('\\', '\''), array('\\\\', '\\\''), $value)."'";
}
$string.=',';
}
Expand Down Expand Up @@ -122,6 +124,8 @@ function arrayToJSON($array, $tab = "") {
$value = $this->objectToJSON($value);
} else if (is_double($value)) {
$value = "NumberLong(" . addslashes($value) . ")";
} else if (is_bool($value)) {
$value = $value ? 'true' : 'false';
} else if (!is_numeric($value) || is_string($value)) {
$value = "'" . addslashes($value) . "'";
}
Expand All @@ -139,6 +143,8 @@ function arrayToJSON($array, $tab = "") {
$value = $this->arrayToJSON($value, "$tab\t");
} else if (is_object($value)) {
$value = $this->objectToJSON($value);
} else if (is_bool($value)) {
$value = $value ? 'true' : 'false';
} else if (!is_numeric($value) || is_string($value)) {
$value = "'" . addslashes($value) . "'";
}
Expand Down