/** * Loads an array of all package xml files (optionally of one type). */ public static function loadProductXmlList($type = '', $typekey = false) { $rootDir = DIR . DIRECTORY_SEPARATOR . 'includes'; $packagesDir = DIR . DIRECTORY_SEPARATOR . 'packages'; $folders = vB_Api_Extensions::getPackages($packagesDir, $rootDir); $list = array(); if ($folders) { foreach ($folders as $package) { if (strrpos($package, DIRECTORY_SEPARATOR)) { $xmlDir = $package . DIRECTORY_SEPARATOR . 'xml'; } else { $xmlDir = $packagesDir . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . 'xml'; } $res = self::loadProductXml($xmlDir, $package, $type, $typekey); $list = array_merge($list, $res); } } return $list; }
public function __call($method, $arguments) { try { // check if API method is enabled // @TODO this is a temp fix, fix as part of VBV-10619 // performing checkApiState for those being called through callNamed is definitive // Also Skip state check for the 'getRoute' and 'checkBeforeView' api calls, because // this state check uses the route info from getRoute and calls checkBeforeView to // determine state. See VBV-11808 and the vB5_ApplicationAbstract::checkState calls // in vB5_Frontend_Routing::setRoutes. if (!in_array($method, array('callNamed', 'getRoute', 'checkBeforeView'))) { if (!$this->api->checkApiState($method)) { return false; } } $result = null; $type = $this->validateCall($this->api, $method, $arguments); if ($type) { if (is_callable(array($this->api, $method))) { $call = call_user_func_array(array(&$this->api, $method), $arguments); if ($call !== null) { $result = $call; } } } if ($elist = vB_Api_Extensions::getExtensions($this->controller)) { foreach ($elist as $class) { if (is_callable(array($class, $method))) { $args = $arguments; array_unshift($args, $result); $call = call_user_func_array(array($class, $method), $args); if ($call !== null) { $result = $call; } } } } return $result; } catch (vB_Exception_Api $e) { $errors = $e->get_errors(); $config = vB::getConfig(); if (!empty($config['Misc']['debug'])) { $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString(); $errors[] = array("exception_trace", $trace); } return array('errors' => $errors); } catch (vB_Exception_Database $e) { $config = vB::getConfig(); if (!empty($config['Misc']['debug']) or vB::getUserContext()->hasAdminPermission('cancontrolpanel')) { $errors = array('Error ' . $e->getMessage()); $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString(); $errors[] = array("exception_trace", $trace); return array('errors' => $errors); } else { // This text is purposely hard-coded since we don't have // access to the database to get a phrase return array('errors' => array(array('There has been a database error, and the current page cannot be displayed. Site staff have been notified.'))); } } catch (Exception $e) { $errors = array(array('unexpected_error', $e->getMessage())); $config = vB::getConfig(); if (!empty($config['Misc']['debug'])) { $trace = '## ' . $e->getFile() . '(' . $e->getLine() . ") Exception Thrown \n" . $e->getTraceAsString(); $errors[] = array("exception_trace", $trace); } return array('errors' => $errors); } }
private static function clearFolders() { self::$folders = array(); self::$foldersLoaded = false; }
$doc = get_product_export_xml($vbulletin->GPC['productid']); } catch (vB_Exception_AdminStopMessage $e) { //move print_stop_message calls from install_product so we //can use it places where said calls aren't appropriate. call_user_func_array('print_stop_message', $e->getParams()); } require_once DIR . '/includes/functions_file.php'; file_download($doc, "product_" . $vbulletin->GPC['productid'] . '.xml', 'text/xml'); } // ############################################################################# if ($_REQUEST['do'] == 'extensions') { print_table_start(); print_table_header(construct_phrase($vbphrase['list_extensions_version'], $vbulletin->options['templateversion']), 7); print_cells_row(array($vbphrase['title'] . ' (' . $vbphrase['version_products'] . ')', $vbphrase['class'], $vbphrase['active'], $vbphrase['minver'], $vbphrase['maxver'], $vbphrase['compatible'], $vbphrase['order']), true, false, 0.5); $failed = array(); $extensions = vB_Api_Extensions::loadAllExtensions(); if ($extensions) { $product = ''; foreach ($extensions as $extn) { if (isset($extn['__failed'])) { $result = each($extn['__failed']); $failed[] = array('dir' => $result['key'], 'file' => $result['value'][0]); continue; } if ($product != $extn['product']) { print_description_row($vbphrase['package'] . ': ' . ucfirst(strtolower($extn['package'])), false, 7, 'boldrow'); $product = $extn['product']; } if (!$vbulletin->options['enablehooks'] or defined('DISABLE_HOOKS')) { $extn['enabled'] = false; }
/** * Checks if method returns false response only when API is disabled. * * @param string API method to check. * @return bool Indicates whether method returns false response only. */ protected function isDisableFalseReturnOnly($method) { if (!is_string($method)) { return false; } // extensions check if ($elist = vB_Api_Extensions::getExtensions($this->controller)) { foreach ($elist as $class) { if (in_array($method, $class->disableFalseReturnOnly)) { return true; } } } return in_array($method, $this->disableFalseReturnOnly); }