/** * @param string|array $with * @return $this */ public function _drop($with = array()) { if (empty($this->_result)) { return $this; } $ids = $this->_field('ID'); foreach (Validation::_getInstance()->getDependencies($this->_('type')) as $objectType => $keys) { foreach ($keys as $key) { _getInstance($objectType)->_get($ids, $key)->_drop($with); } } DB::_getInstance()->drop($this->_('type'), $ids, $this->_lang()); $dropDependenciesQueue = array(); foreach (is_array($with) ? $with : array($with) as $k => $v) { if (is_numeric($k)) { $objectType = $v; $dependencies = array(); } else { $objectType = $k; $dependencies = $v; } if ($ids = $this->_getReferences($objectType)) { $dropDependenciesQueue[] = array('objectType' => $objectType, 'dependencies' => $dependencies, 'ids' => $ids); } } foreach ($dropDependenciesQueue as $dependency) { _getInstance($dependency['objectType'])->_get($dependency['ids'])->_drop($dependency['dependencies']); } return $this; }
* Inititaes controller + view * * * @version 1.0 * @package LySoft * */ define("_PATH", str_replace("loader.php", "", __FILE__)); function __autoload($class_name) { include_once _PATH . 'lib/' . $class_name . '.class.php'; } include "lib/utils.php"; # includes general function //include "lib/utils_checklist.php"; _getInstance($_REQUEST['q']); $instance = _cg("instance"); $host = $_SERVER['HTTP_HOST']; $http_protocol = $_SERVER['HTTPS'] == "on" ? "https://" : "http://"; define('_UPlain', $http_protocol . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') + 1)); if (_cg("url_instance") != '') { define('_U', $http_protocol . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') + 1) . _cg("url_instance") . "/"); } else { define('_U', $http_protocol . $host . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/') + 1)); } define("_MEDIA_URL", _UPlain . "instance/{$instance}/media/"); $db = Db::__d(); include _PATH . "instance/{$instance}/config.inc.php"; $url = _cg("url"); // set from _getInstance function define(_URL, $url);