Esempio n. 1
0
 function register_url($url, $file, $url_hanlder, $content_handler = '')
 {
     if (!preg_match('/[^a-zA-Z\\d\\-_\\.%~]/i', $url) && !vivvo_lite_site::get_instance()->is_registered_url($url) && !empty($file) && !empty($url_hanlder)) {
         require_once VIVVO_FS_FRAMEWORK . 'vivvo_post.php';
         require_once VIVVO_FS_FRAMEWORK . 'vivvo_preference.php';
         $config = new preferences();
         $pm = new vivvo_post_master();
         $config->set_variable_name($url);
         $config->set_variable_property('file');
         $config->set_variable_value($file);
         $config->set_module('url_modules');
         $config->set_domain_id(1);
         $pm->set_data_object($config);
         $pm->sql_insert();
         $config->set_variable_name($url);
         $config->set_variable_property('url_handler_function');
         $config->set_variable_value($url_hanlder);
         $config->set_module('url_modules');
         $config->set_domain_id(1);
         $pm->set_data_object($config);
         $pm->sql_insert();
         if (!empty($content_handler)) {
             $config->set_variable_name($url);
             $config->set_variable_property('content_handler_function');
             $config->set_variable_value($content_handler);
             $config->set_module('url_modules');
             $config->set_domain_id(1);
             $pm->set_data_object($config);
             $pm->sql_insert();
         }
         return true;
     }
     return false;
 }
 /**
  * Add configuration data
  *
  * @param string $name		Variable name
  * @param string $property	Variable property name
  * @param string $value		Variable value
  * @param string $module	Module name
  * @param string $reg_exp	Variable value restriction
  * @param string $doamin_id	Doamin restriction
  *
  * @return boolean True on success, false on fail
  */
 function add_conf($name, $property, $value, $module = '', $reg_exp = '', $domain_id = 1)
 {
     require_once VIVVO_FS_FRAMEWORK . 'vivvo_preference.php';
     if (!$this->_post_master) {
         $this->set__post_master();
     }
     $config = new preferences();
     $config->set_variable_name($name);
     $config->set_variable_property($property);
     $config->set_variable_value($value);
     $config->set_module($module);
     $config->set_reg_exp($reg_exp);
     $config->set_domain_id($domain_id);
     $this->_post_master->set_data_object($config);
     $result = $this->_post_master->sql_insert();
     vivvo_cache::get_instance()->delete('configuration');
     return $result;
 }