public function updateModelBaseFile($objName, $structure)
 {
     $dependency = new Dependency();
     $dependencies = $dependency->getDependencies($objName);
     $this->_createComponents($objName, $structure, $dependencies);
     $this->_createModelBaseFileStr($objName, $structure);
     $modelBaseFileName = NamingConvention::camelCaseToSnakeCase($objName) . '_base.php';
     $modelBasePath = ROOT . '/app/model/base/' . $modelBaseFileName;
     Debug::out('update: ' . $modelBasePath);
     file_put_contents($modelBasePath, $this->_modelBaseFileStr);
 }
Ejemplo n.º 2
0
 /**
  * @param Dependency $d
  * @return array
  */
 public static function getRequiresDependenciesForFrontend(Dependency $d)
 {
     $user = Zend_Registry::get("pimcore_user");
     $dependencies["hasHidden"] = false;
     $dependencies["requires"] = array();
     // requires
     foreach ($d->getRequires() as $r) {
         if ($e = self::getDependedElement($r)) {
             if ($e->isAllowed("list")) {
                 $dependencies["requires"][] = self::getDependencyForFrontend($e);
             } else {
                 $dependencies["hasHidden"] = true;
             }
         }
     }
     return $dependencies;
 }
Ejemplo n.º 3
0
 /** Is the graph available.  (Are all Dependency available,
  * are all preconditions in the statistics class available, etc.) Always
  * returns true unless overriden by the child class
  * @param &$errormsg Optionnal error message returned by the class
  * @return true or false */
 public function isAvailable(&$errormsg = null)
 {
     $retval = false;
     if (Dependency::check("Image_Graph", $errormsg)) {
         require_once "Image/Graph.php";
         $retval = true;
     }
     return $retval;
 }
Ejemplo n.º 4
0
 /**
  * Constructor.
  *
  * @return void
  */
 public function __construct()
 {
     // Check if PEAR::HTML_Safe is available
     if (Dependency::check("HTML_Safe")) {
         // Load PEAR::HTML_Safe
         require_once 'HTML/Safe.php';
         // Enabled PEAR::HTML_Safe support
         $this->isHtmlSafeEnabled = true;
         // Create a PEAR::HTML_Safe object
         $this->_HtmlSafe = new HTML_Safe();
         // Define list of dangerous tags
         $this->_HtmlSafe->deleteTags = $this->getDeleteTags();
         // Define list of dangerous tags
         $this->_HtmlSafe->deleteTagsContent = $this->getDeleteTagsContent();
         // Define list of dangerous attributes
         $this->_HtmlSafe->attributes = $this->getAttributes();
     }
 }
Ejemplo n.º 5
0
 /**
  * Validates the uploaded file and return a boolean to tell if valid
  * This method should be overridden when you need to write special validation scripts
  *
  * @param string path to input file
  * @param string path to output file (by ref.), making sure you create a struct that matches the $_FILES[][] format
  *
  * @return boolean
  */
 protected function validateUploadedFile($input, &$output)
 {
     $errmsg = null;
     // Only if GD is available, resize to max size
     if (Dependency::check("gd", $errmsg)) {
         // Extract image metadata
         list($width_orig, $height_orig, $type, $attr) = getimagesize($input['tmp_name']);
         // Check if it busts the max size
         if ($width_orig > $this->getMaxDisplayWidth() || $height_orig > $this->getMaxDisplayHeight()) {
             // Init with max values
             $width = $this->getMaxDisplayWidth();
             $height = $this->getMaxDisplayHeight();
             // Compute ratios
             $ratio_orig = $width_orig / $height_orig;
             if ($this->getMaxDisplayWidth() / $this->getMaxDisplayHeight() > $ratio_orig) {
                 $width = $height * $ratio_orig;
             } else {
                 $height = $width / $ratio_orig;
             }
             // Resample
             $image_p = imagecreatetruecolor($width, $height);
             $image = imagecreatefromstring(file_get_contents($input['tmp_name']));
             if (!$image) {
                 pretty_print_r(gd_info());
                 throw new Exception(_("Unable to process image (GD probably doesn't have support for it enabled)"));
             } else {
                 imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
             }
             // Build output metadata struct
             $output = array();
             $output['tmp_name'] = tempnam("/tmp", session_id());
             $output['type'] = "image/png";
             $output['name'] = $input['name'];
             // Output PNG at full compression (no artefact)
             imagepng($image_p, $output['tmp_name'], 9);
             // Write new file size
             $output['size'] = filesize($output['tmp_name']);
         }
     }
     return true;
 }
Ejemplo n.º 6
0
 /**
  * Return if PEAR::Cache_Lite is available and caching has been enabled.
  *
  * @return bool Caching enabled or disabled.
  */
 private function _cachingEnabled()
 {
     // Init values.
     $_doCache = false;
     // Check if PEAR::Cache_Lite is available.
     if (defined("USE_CACHE_LITE") && USE_CACHE_LITE == true && Dependency::check("Cache")) {
         // Check if caching has been enabled in config.php or local.config.php.
         $_doCache = true;
     }
     return $_doCache;
 }
Ejemplo n.º 7
0
 /**
  * @param string $filter
  *
  * @return boolean
  */
 protected function loadFilter($filter)
 {
     static $misses = [];
     if (!in_array($filter, $misses)) {
         try {
             if ($obj = \Dependency::resolve('security.filter.' . strtolower($filter), array($this))) {
                 $this->filters[strtolower($filter)] = $obj;
                 return true;
             }
         } catch (\Fuel\Dependency\ResolveException $e) {
             // we don't have a class for this filter
             $misses[] = $filter;
         }
     }
     return false;
 }
Ejemplo n.º 8
0
 /**
  * @return Dependency
  */
 public function getO_Dependencies()
 {
     if (!$this->o_dependencies) {
         $this->o_dependencies = Dependency::getBySourceId($this->getId(), "object");
     }
     return $this->o_dependencies;
 }
Ejemplo n.º 9
0
 static function display()
 {
     $ret = "";
     $cfg = ConfigManager::singleton();
     $combine = $cfg->servers["dependencies"]["combine"];
     ksort(self::$dependencies);
     foreach (self::$dependencies as $priority => $browsers) {
         foreach ($browsers as $browser => $types) {
             $bret = "";
             foreach ($types as $type => $deps) {
                 $tret = "";
                 if ($type == "component" && $combine) {
                     $combined = array();
                     foreach ($deps as $dep) {
                         if (!empty($dep->subtypes)) {
                             $subtypes = explode(",", $dep->subtypes);
                             $nameparts = explode(".", $dep->name);
                             if (empty($nameparts[1])) {
                                 $nameparts[1] = $nameparts[0];
                             }
                             foreach ($subtypes as $subtype) {
                                 $combined[$subtype][$nameparts[0]][] = $nameparts[1];
                             }
                         }
                     }
                     if (!empty($combined)) {
                         foreach ($combined as $type => $deps) {
                             if ($type == "javascript") {
                                 $url = $cfg->locations["scriptswww"] . "/main";
                             } else {
                                 if ($type == "css") {
                                     $url = $cfg->locations["csswww"] . "/main";
                                 }
                             }
                             $sep = "/";
                             foreach ($deps as $comp => $subcomp) {
                                 $url .= $sep . $comp . "-" . implode("-", array_map(encode_friendly, $subcomp));
                             }
                             $depobj = Dependency::create($type, array("url" => $url));
                             $tret .= $depobj->display(self::$locations, $combined[$type]);
                         }
                     }
                 } else {
                     foreach ($deps as $dep) {
                         $tret .= $dep->display(self::$locations);
                     }
                 }
                 if (!empty($tret)) {
                     // type wrapper
                     $wrapstr = any(self::$formats["types"][$type], "%s");
                     $bret .= sprintf($wrapstr, $tret);
                 }
             }
             if (!empty($bret)) {
                 // browser wrapper
                 $wrapstr = any(self::$formats["browsers"][$browser], "%s");
                 $ret .= sprintf($wrapstr, $bret);
             }
         }
     }
     return $ret;
 }
Ejemplo n.º 10
0
 /**
  * @param Plugin $plugin
  * @param Dependency $dependency
  */
 function __construct($plugin, $dependency)
 {
     parent::__construct('Plugin "' . $plugin->getId() . '" needs an older version of "' . $dependency->getPluginId() . '" to be installed, ' . $dependency->getMaxVersion() . ' at highest!');
 }
Ejemplo n.º 11
0
 /**
  * Returns the set of the custom SugarLogic Dependencies defined in the dependency metadata
  * for a module that are valid for the given action.
  * @static
  * @param string $module Primary module for this action
  * @param string $action name of the action to get dependencies for ("edit", "view", "save", ect)
  * @param string $form name of the form element used on html forms
  * @return array<Dependency>
  */
 public static function getModuleDependenciesForAction($module, $action, $form = "EditView")
 {
     $meta = self::getModuleDependencyMetadata($module);
     $deps = array();
     foreach ($meta as $key => $def) {
         $hooks = empty($def['hooks']) ? array("all") : $def['hooks'];
         if (!is_array($hooks)) {
             $hooks = array($hooks);
         }
         if (in_array('all', $hooks) || in_array($action, $hooks)) {
             self::filterActionDefinitionsForView($def, $action);
             if (empty($def['actions']) && empty($def['notActions'])) {
                 continue;
                 // Skip if no actions left after filtering
             }
             $triggerExp = empty($def['trigger']) ? self::$default_trigger : $def['trigger'];
             $triggerFields = empty($def['triggerFields']) ? Parser::getFieldsFromExpression($triggerExp) : $def['triggerFields'];
             $actions = empty($def['actions']) || !is_array($def['actions']) ? array() : $def['actions'];
             $notActions = empty($def['notActions']) || !is_array($def['notActions']) ? array() : $def['notActions'];
             $dep = new Dependency("{$module}{$form}_{$key}");
             $dep->setTrigger(new Trigger($triggerExp, $triggerFields));
             foreach ($actions as $aDef) {
                 $dep->addAction(ActionFactory::getNewAction($aDef['name'], $aDef['params']));
             }
             foreach ($notActions as $aDef) {
                 $dep->addFalseAction(ActionFactory::getNewAction($aDef['name'], $aDef['params']));
             }
             $dep->setFireOnLoad(!isset($def['onload']) || $def['onload'] !== false);
             $deps[] = $dep;
         }
     }
     return $deps;
 }
Ejemplo n.º 12
0
 protected function __construct($content_id)
 {
     // Init values
     $errmsg = "";
     $row = null;
     parent::__construct($content_id);
     if (Dependency::check("Phlickr", $errmsg) && Dependency::check('curl', $errmsg)) {
         // Defined globals
         $db = AbstractDb::getObject();
         // Load Phlickr classes
         require_once "Phlickr/Api.php";
         require_once "Phlickr/User.php";
         require_once "Phlickr/Group.php";
         $content_id = $db->escapeString($content_id);
         $sql = "SELECT *, EXTRACT(EPOCH FROM AGE(CURRENT_TIMESTAMP, cache_update_timestamp)) as cache_age FROM content_flickr_photostream WHERE flickr_photostream_id='{$content_id}'";
         $db->execSqlUniqueRes($sql, $row, false);
         if ($row == null) {
             /*Since the parent Content exists, the necessary data in content_group had not yet been created */
             $sql = "INSERT INTO content_flickr_photostream (flickr_photostream_id, preferred_size) VALUES ('{$content_id}', '" . self::SIZE_SMALL_240x180 . "')";
             $db->execSqlUpdate($sql, false);
             $sql = "SELECT * FROM content_flickr_photostream WHERE flickr_photostream_id='{$content_id}'";
             $db->execSqlUniqueRes($sql, $row, false);
             if ($row == null) {
                 throw new Exception(_("The content with the following id could not be found in the database: ") . $content_id);
             }
         }
         $this->flickr_photostream_row = $row;
         $this->flickr_api = null;
         $this->mBd =& $db;
         $this->_PhlickrAvailable = true;
     }
 }
Ejemplo n.º 13
0
 /**
  * Recursively resolve dependecies for given plugin
  * 
  * @param Dependency $deps
  */
 private function resolveDependencies(Dependency $deps)
 {
     foreach ($deps->getDependentPackages() as $depPackage) {
         foreach ($deps->getDependentPlugins($depPackage) as $depPlugin) {
             if (!isset($this->loadedPackages[$depPackage]) or !in_array($depPlugin, $this->loadedPackages[$depPackage])) {
                 $this->usePlugin($depPackage, $depPlugin);
             }
         }
     }
 }
Ejemplo n.º 14
0
 /**
  * Get dependencies of plugin
  * 
  * @throws RuntimeException
  * @return Dependency
  */
 public function getDependencies()
 {
     $className = "Dependency{$this->pluginName}";
     try {
         if (!class_exists($className)) {
             if (file_exists(SITE_PACKAGES_PATH . "{$this->packageName}/{$this->pluginName}/{$className}.class.php")) {
                 stingleInclude(SITE_PACKAGES_PATH . "{$this->packageName}/{$this->pluginName}/{$className}.class.php", null, null, true);
             } elseif (file_exists(STINGLE_PATH . "packages/{$this->packageName}/{$this->pluginName}/{$className}.class.php")) {
                 stingleInclude(STINGLE_PATH . "packages/{$this->packageName}/{$this->pluginName}/{$className}.class.php", null, null, true);
             } else {
                 throw new RuntimeException();
             }
         }
         $deps = new $className();
     } catch (RuntimeException $e) {
         $deps = new Dependency();
     }
     if ($this->packageName != $this->pluginName) {
         try {
             $this->packageManager->checkPluginExistance($this->packageName, $this->packageName);
             $deps->addPlugin($this->packageName, $this->packageName);
         } catch (Exception $e) {
         }
     }
     return $deps;
 }
Ejemplo n.º 15
0
// |                                                                   |
// +-------------------------------------------------------------------+
/**
 * @package    WiFiDogAuthServer
 * @author     Benoit Grégoire <*****@*****.**>
 * @copyright  2004-2006 Benoit Grégoire, Technologies Coeus inc.
 * @version    Subversion $Id: SmartyWifidog.php 1421 2009-09-25 15:50:09Z benoitg $
 * @link       http://www.wifidog.org/
 */
/**
 * Load required classes
 */
require_once "classes/WifidogLocale.php";
require_once "classes/Utils.php";
// Check if all mandatory components (such as Smarty) installed, if not redirect user to web-base installation
if (Dependency::checkMandatoryComponents($errmsg)) {
    // Load Smarty library
    require_once SMARTY_PATH . 'Smarty.class.php';
} else {
    // Build the system_path for the auth-server
    print "Redirecting to Wifidog web-based install script since a mandatory Dependency is missing (Error was: {$errmsg})<META HTTP-EQUIV=Refresh CONTENT=\"5; URL=" . BASE_URL_PATH . "/install.php\">";
    exit;
}
require_once "include/smarty.resource.string.php";
/*
* Smarty plugin
* -------------------------------------------------------------
* Type:    modifier
* Name:    fsize_format
* Version:    0.2
* Date:    2003-05-15
Ejemplo n.º 16
0
 /**
  * Final update and stop accounting
  *
  * @param string $conn_id The connection id (the token id) for the
  *                        connection to work on
  * @param string $errmsg  Reference of error message
  *
  * @return bool Returns whether successful or not
  */
 function acctStop($conn_id, &$errmsg = null)
 {
     // Call parent method
     parent::acctStop($conn_id);
     $db = AbstractDb::getObject();
     // Init values
     $info = null;
     $conn_id = $db->escapeString($conn_id);
     if (Dependency::check("Auth_RADIUS", $errmsg)) {
         $db->execSqlUniqueRes("SELECT CURRENT_TIMESTAMP, *, CASE WHEN ((CURRENT_TIMESTAMP - reg_date) > networks.validation_grace_time) THEN true ELSE false END AS validation_grace_time_expired FROM connections JOIN users ON (users.user_id=connections.user_id) JOIN networks ON (users.account_origin = networks.network_id) WHERE connections.conn_id={$conn_id}", $info, false);
         // RADIUS accounting stop
         // Session is completely based on Database time
         $session_time = strtotime($info['now']) - strtotime($info['timestamp_in']);
         $radius_acct = new Auth_RADIUS_Acct_Stop();
         $radius_acct->addServer($this->mRadius_hostname, $this->mRadius_acct_port, $this->mRadius_secret_key);
         // Specify the user for which accounting will be done
         $radius_acct->username = $info['username'];
         $racct->session_time = $session_time;
         // Set the session ID to the generated token
         $radius_acct->session_id = $info['token'];
         $status = $radius_acct->start();
         if (PEAR::isError($status)) {
             $errmsg = "Could not initiate PEAR RADIUS class.";
             return false;
         }
         // Cause of session termination
         $radius_acct->putAttribute(RADIUS_ACCT_TERMINATE_CAUSE, RADIUS_TERM_SESSION_TIMEOUT);
         $result = $radius_acct->send();
         if (PEAR::isError($result)) {
             $errmsg = "Could not send accounting request to RADIUS server.";
             return false;
         } else {
             if ($result !== true) {
                 $radius_acct->close();
                 $errmsg = "Accounting request rejected by RADIUS server.";
                 return false;
             }
         }
         $radius_acct->close();
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 17
0
 /** Retreives the admin interface of this object.
  * @return The HTML fragment for this interface, or null.
  * If it returns null, this object does not support new object creation */
 public static function getAdminUIStatic($userData = null)
 {
     $html = '';
     /* PHP version check */
     $okMsg = '<td ALIGN="CENTER" STYLE="background:lime;">OK</td>';
     $errorMsg = '<td ALIGN="CENTER" STYLE="background:red;">ERROR</td>';
     $warningMsg = '<td ALIGN="CENTER" STYLE="background:yellow;">Warning</td>';
     $html .= "<table BORDER=\"1\">";
     /* PHP version check */
     $requiredPHPVersion = '5.0';
     $phpVersion = phpversion();
     $html .= "<tr><td>PHP</td>";
     if (version_compare($phpVersion, $requiredPHPVersion, ">=")) {
         $html .= "{$okMsg}<td>{$phpVersion}</td>";
         // Version 5.0.0 or later
     } else {
         $html .= "{$errorMsg}<td>" . sprintf(_("Version %s needed"), $requiredPHPVersion) . "</td>";
         // Version < 5.0.0
         $userData['error'] = 1;
     }
     $html .= "</tr>";
     if (function_exists('pg_version')) {
         //Be carefull, postgres version check will also fail if there wasn't a db connexion yet.
         $pgVersionArray = @pg_version();
         $pgVersionArray ? $pgVersion = $pgVersionArray['server'] : ($pgVersion = null);
         if ($pgVersion) {
             $postgresRecommendedVersion = '8.0';
             $postgresRequiredVersion = '7.4';
             $html .= "<tr><td>PostgreSQL</td>";
             if (version_compare($pgVersion, $postgresRecommendedVersion, ">=")) {
                 $html .= "{$okMsg}<td>{$pgVersion}</td>";
                 // Version 5.0.0 or later
             } else {
                 if (version_compare($pgVersion, $postgresRequiredVersion, ">=")) {
                     $html .= "{$warningMsg}<td>" . sprintf(_("%s may work, but version %s is recommended"), $pgVersion, $postgresRecommendedVersion) . "</td>";
                     // Version < 5.0.0
                 } else {
                     $html .= "{$errorMsg}<td>" . sprintf(_("%s is too old, version %s needed"), $pgVersion, $postgresRecommendedVersion) . "</td>";
                     // Version < 5.0.0
                     $userData['error'] = 1;
                 }
             }
             $html .= "</tr>";
         }
     }
     $html .= "</table>";
     $components = Dependency::getDependencies();
     $html .= "<table BORDER=\"1\">\n";
     $html .= "<tr><th>" . _("Component") . '<br/>' . _("Click for the component's website") . "</th>\n";
     $html .= "<th>" . _("Type") . "</th>\n";
     $html .= "<th>" . _("Status") . "</th>\n";
     $html .= "<th>" . _("Information") . "</th>\n";
     $html .= "</tr>\n";
     $even_odd = "odd";
     foreach ($components as $dependency) {
         $even_odd = 'odd' != $even_odd ? 'odd' : 'even';
         $html .= "<tr class=" . $even_odd . ">\n";
         $websiteUrl = $dependency->getWebsiteURL();
         $component_key = $dependency->getId();
         $description = $dependency->getDescription();
         $mandatory = $dependency->isMandatory();
         $type = $dependency->getType();
         if ($websiteUrl) {
             $html .= "<td><A HREF=\"{$websiteUrl}\">{$component_key}</A></td>\n";
         } else {
             $html .= "<td>{$component_key}</td>\n";
         }
         $html .= "<td>{$type}</td>\n";
         $instalMessage = null;
         $dependency->processInstallUI($instalMessage);
         $message = null;
         $available = Dependency::check($component_key, $message);
         if ($available) {
             $html .= "{$okMsg}\n";
         } else {
             if ($mandatory) {
                 $html .= "{$errorMsg}\n";
                 $error = 1;
             } else {
                 $html .= "{$warningMsg}\n";
             }
         }
         $html .= "<td>\n";
         $html .= "<em>" . _("Description") . ":</em> {$description}<br/>\n";
         if ($instalMessage) {
             $html .= "<em>" . _("Install message") . ":</em> {$instalMessage}<br/>\n";
         }
         if ($message) {
             $html .= "<em>" . _("Detection message") . ":</em> {$message}<br/>\n";
         }
         if (!$available) {
             $html .= "<em>" . _("To install") . ":</em> " . $dependency->getInstallUI() . "<br/>\n";
         }
         $html .= "</td></tr>\n";
     }
     $html .= "</table>\n";
     return $html;
 }
Ejemplo n.º 18
0
     * http://server_ip/hotspot_status.php?format=XML&xslt=http://xslt_server/xslt/wifidog_status.xsl
     */
    // If a XSL transform stylesheet has been specified, try to use it.
    if ($format == "XML" && !empty($_REQUEST['xslt'])) {
        if (Dependency::check("xsl")) {
            // Load the XSLT
            if (($xslt_dom = @DomDocument::load(trim($_REQUEST['xslt']))) === false) {
                echo sprintf("Unable to load XSTL : %s", $_REQUEST['xslt']);
            } else {
                $xslt_proc = new XSLTProcessor();
                $xslt_proc->importStyleSheet($xslt_dom);
                // Prepare HTML
                header("Content-Type: text/html; charset=UTF-8");
                echo $xslt_proc->transformToXML($nodeList->getOutput(true));
            }
        } else {
            $dep = Dependency::getObject("xsl");
            echo sprintf("Missing dependency: %s: %s", $dep->getId(), $dep->getDescription());
        }
    } else {
        // Deliver node list
        $nodeList->getOutput();
    }
}
/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
Ejemplo n.º 19
0
        $ui->displayError($e->getMessage());
        exit;
    }
} else {
    $ui = MainUI::getObject();
    $ui->displayError(_("No user id specified!"));
    exit;
}
// Init ALL smarty SWITCH values
$smarty->assign('sectionMAINCONTENT', false);
/*
 * Render output
 */
$ui = MainUI::getObject();
$ui->setTitle(_("User profile"));
if (Dependency::check('php-openid')) {
    require_once 'classes/OpenIdServerWifidog.php';
    $ui->appendHtmlHeadContent("<link rel='openid.server' href='" . OpenIdServerWifidog::getOpenIdServerUrl() . "' />");
}
$ui->setPageName('profile');
//$ui->addContent('left_area_middle', $tool_html);
/*
 * Main content
 */
$welcome_msg = sprintf("<span>%s</span> <em>%s</em>", _("User profile for"), $profile_user->getUsername());
$ui->addContent('page_header', "<h1>{$welcome_msg}</h1>");
if (!empty($profile)) {
    $main_area_middle_html = "";
    $main_area_middle_html .= $profile->getUserUI();
    $ui->addContent('main_area_middle', $main_area_middle_html);
}
Ejemplo n.º 20
0
 /**
  * Attempts to login a user against the authentication source
  *
  * If successfull, returns a User object
  *
  * @param string $username A valid identifying token for the source. Not
  *                         necessarily unique.
  * @param string $password Clear text password.
  * @param string $errmsg   Reference of error message
  *
  * @return object The actual User object if login was successfull, false
  *                otherwise.
  */
 public function login($username, $password, &$errmsg = null)
 {
     $db = AbstractDb::getObject();
     // Init values
     $retval = false;
     $username = $db->EscapeString($username);
     $password = $db->EscapeString($password);
     // Check if php-ldap extension is loaded
     if (Dependency::check("ldap", $errmsg)) {
         if ($this->checkLdapUser($username, $password, $this->mldap_hostname, $this->mldap_o, $this->mldap_filter, $errmsg)) {
             //LDAP Authentication Successful
             $sql = "SELECT user_id, pass FROM users WHERE (username='******') AND account_origin='" . $this->getNetwork()->getId() . "'";
             $db->ExecSqlUniqueRes($sql, $user_info, false);
             if ($user_info != null) {
                 $user = User::getObject($user_info['user_id']);
                 if ($user->isUserValid($errmsg)) {
                     $retval = $user;
                     User::setCurrentUser($user);
                     $errmsg = _("Login successfull");
                 } else {
                     $retval = false;
                     //Error already been set
                 }
             } else {
                 $user = User::createUser(get_guid(), $username, $this->getNetwork(), "", "");
                 $retval =& $user;
                 $user->setAccountStatus(ACCOUNT_STATUS_ALLOWED);
                 $errmsg = _("Login successfull");
             }
         } else {
             $retval = false;
             //Error already been set
         }
     }
     User::setCurrentUser($retval);
     return $retval;
 }
Ejemplo n.º 21
0
 /**
  * @param array $routes роуты для сравнения
  * @param bool $except
  * @param array $config
  */
 public function __construct($routes, $except = false, $config = [])
 {
     $this->_routes = (array) $routes;
     $this->_except = (bool) $except;
     parent::__construct($config);
 }
Ejemplo n.º 22
0
 /**
  * @return Dependency
  */
 public function getDependencies()
 {
     if (!$this->dependencies) {
         $this->dependencies = Dependency::getBySourceId($this->getId(), "asset");
     }
     return $this->dependencies;
 }
Ejemplo n.º 23
0
 /**
  * Recursively resolve dependecies for given plugin
  * 
  * @param Dependency $deps
  */
 private function resolveDependencies(Dependency $deps, $forceLoaderIncludes = false)
 {
     foreach ($deps->getDependentPackages() as $depPackage) {
         foreach ($deps->getDependentPlugins($depPackage) as $depPlugin) {
             if (!isset($this->loadedPackages[$depPackage]) or !in_array($depPlugin, $this->loadedPackages[$depPackage])) {
                 $this->usePlugin($depPackage, $depPlugin, null, false, false, $forceLoaderIncludes);
             }
         }
     }
 }
Ejemplo n.º 24
0
 /**
  * This method contains the interface to add an additional element to a
  * content object.  (For example, a new string in a Langstring)
  * It is called when getNewContentUI has only a single possible object type.
  * It may also be called by the object getAdminUI to avoid code duplication.
  *
  * @param string $contentId      The id of the (possibly not yet created) content object.
  *
  * @param string $userData=null Array of contextual data optionally sent by displayAdminUI(),
  *  and only understood by the class (or subclasses) where getNewUI() is defined.
  *  The function must still function if none of it is present.
  *
  * @return HTML markup or false.  False means that this object does not support this interface.
  */
 public static function getNewUI($contentId, $userData = null)
 {
     $html = '';
     $locale = LocaleList::GetDefault();
     !empty($userData['typeInterface']) ? $typeInterface = $userData['typeInterface'] : ($typeInterface = null);
     $html .= "<div class='admin_element_data'>\n";
     $html .= _("Language") . ": " . LocaleList::GenererFormSelect($locale, "langstrings_" . $contentId . "_substring_new_language", null, TRUE);
     if (Dependency::check("FCKeditor")) {
         // Load FCKeditor class
         require_once 'lib/FCKeditor/fckeditor.php';
         $_FCKeditor = new FCKeditor('langstrings_' . $contentId . '_substring_new_string');
         $_FCKeditor->BasePath = SYSTEM_PATH . "lib/FCKeditor/";
         $_FCKeditor->Config["CustomConfigurationsPath"] = BASE_URL_PATH . "js/HTMLeditor.js";
         $_FCKeditor->Config["AutoDetectLanguage"] = false;
         $_FCKeditor->Config["DefaultLanguage"] = substr(Locale::getCurrentLocale()->getId(), 0, 2);
         $_FCKeditor->Config["StylesXmlPath"] = BASE_URL_PATH . "templates/HTMLeditor/css/" . substr(Locale::getCurrentLocale()->getId(), 0, 2) . ".xml";
         $_FCKeditor->Config["TemplatesXmlPath"] = BASE_URL_PATH . "templates/HTMLeditor/templates/" . substr(Locale::getCurrentLocale()->getId(), 0, 2) . ".xml";
         $_FCKeditor->ToolbarSet = "WiFiDOG";
         $_FCKeditor->Value = "";
         if ($typeInterface == 'LARGE') {
             $_FCKeditor->Height = 400;
         } else {
             $_FCKeditor->Height = 200;
         }
         $_FCKeditor->Width = 386;
         $html .= $_FCKeditor->CreateHtml();
     } else {
         $html .= "<textarea name='langstrings_{$contentId}_substring_new_string' class='textarea' cols='60' rows='3'></textarea>";
     }
     $html .= "</div>\n";
     $html .= "<div class='admin_element_tools'>\n";
     $html .= "<input type='submit' class='submit' name='langstrings_" . $contentId . "_add_new_entry' value='" . _("Add new string") . "'>";
     $html .= "</div>\n";
     return $html;
 }
Ejemplo n.º 25
0
 public function process($param)
 {
     $d = new Dependency(1);
     return $d->process($param);
 }