Created
December 7, 2012 08:26
-
-
Save MaximKeegan/4231780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$path_node = explode("?", substr($_SERVER["REQUEST_URI"],count(dirname($_SERVER["PHP_SELF"])))); | |
$path_node = urldecode($path_node[0]); | |
$path_chains = explode("/", $path_node); | |
function fucking_drupal_cant_load_node_by_url($path_node) { | |
// такой изподвыпердный изврат для получения PATH_INFO требуетя из-за разных настроек серверов | |
$query = "SELECT src FROM {url_alias} WHERE dst = '%s';"; | |
// fuckig php have't closure! | |
$_result = db_query($query, $path_node); | |
$_result = db_fetch_object($_result); | |
$_result = array_reverse(explode('/', $_result->src)); | |
$_result = $_result[0]; | |
$node = node_load(array('nid'=>$_result)); | |
return $node; | |
} | |
$node = fucking_drupal_cant_load_node_by_url($path_node); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment