/** * @return bool */ public function update_file_path_and_mode() { if (!($this->type && $this->id && $this->relative_path)) { return false; } $SQL = "UPDATE {$this->type}\n SET File_Path = '{$this->relative_path}',\n File_Mode = 1\n WHERE {$this->type}_ID = {$this->id}"; return $this->db->query($SQL); }
public function get_alternative_link() { $nc_core = nc_Core::get_object(); $current_catalogue = $nc_core->catalogue->get_current(); $current_sub = $nc_core->subdivision->get_current(); if ($current_catalogue['ncMobile'] == 1) { $Catalogue_ID = $current_catalogue['ncMobileSrc']; $SQL = "SELECT Sub_Class_ID,\n Subdivision_ID,\n SrcMirror\n FROM Sub_Class\n WHERE Subdivision_ID = " . $current_sub['Subdivision_ID']; $result = (array) $this->db->get_results($SQL); $sub_class_id = null; foreach ($result as $row) { if ($row->SrcMirror) { $sub_class_id = $row->SrcMirror; break; } } if ($sub_class_id) { $Hidden_URL = $nc_core->sub_class->get_by_id($sub_class_id, 'Hidden_URL'); } } else { $Catalogue_ID = $this->db->get_var("SELECT Catalogue_ID FROM Catalogue WHERE ncMobileSrc = " . $current_catalogue['Catalogue_ID']); $SQL = "SELECT Sub_Class_ID,\n Subdivision_ID,\n SrcMirror\n FROM Sub_Class\n WHERE SrcMirror IN (SELECT Sub_Class_ID FROM Sub_Class WHERE Subdivision_ID = {$current_sub['Subdivision_ID']})"; $result = (array) $this->db->get_row($SQL, ARRAY_A); if ($result['Sub_Class_ID']) { $Hidden_URL = $nc_core->sub_class->get_by_id($result['Sub_Class_ID'], 'Hidden_URL'); } } $Domain = $nc_core->catalogue->get_by_id($Catalogue_ID, 'Domain'); $suffix = ''; global $action; switch ($action) { case 'full': global $f_Keyword, $cc_keyword, $message; $suffix = $f_Keyword ? $f_Keyword : $cc_keyword . "_" . $message; $suffix .= '.html'; break; } $REQUEST_URI = (string) $_SERVER['REQUEST_URI']; if (!$Hidden_URL && ($REQUEST_URI = !'/')) { $Hidden_URL = $REQUEST_URI; if ($REQUEST_URI[strlen($REQUEST_URI) - 1] != '/') { $url_array = explode('/', $REQUEST_URI); array_pop($url_array); $Hidden_URL = join('/', $url_array) . '/'; } $SQL = "SELECT COUNT(*)\n FROM Subdivision\n WHERE Hidden_URL = '{$Hidden_URL}'\n AND Catalogue_ID = " . $Catalogue_ID; $result = $this->db->get_var($SQL); $url = $result ? $Domain . $Hidden_URL . $suffix : $Domain; } else { $url = $Domain . $Hidden_URL . $suffix; } return $url; }
public function InsideAdminAccess() { global $current_user, $AUTH_USER_ID; return $this->modules->get_by_keyword('auth') && $current_user['InsideAdminAccess'] || !$this->modules->get_by_keyword('auth') && $this->db->get_var("SELECT `InsideAdminAccess` FROM `User` WHERE `User_ID`='" . intval($AUTH_USER_ID) . "'"); }