Exemple #1
0
 function init($args = array())
 {
     parent::init($args);
     // $attachPoints = array('init','on_first_time','on_every_time','pre_show_form','post_show_form','no_show_form','pre_error_check_actions','run_error_checks','post_error_check_actions','post_error_checks','process','where_to');
     // foreach ($attachPoints as $ap) { $this->parentContentManager->add_callback(array($this, 'discoEventTester_' . $ap), $ap); }
     // $this->parentContentManager->add_callback(array($this, 'discoEventTester'), "on_first_time");
     // $this->parentContentManager->add_callback(array($this, 'discoEventTester2'), "on_every_time");
     // echo "<HR>INITING FLASH.PHP<HR>";
     // $this->ensure_temp_db_table_exists();
     if (!$this->can_run()) {
         trigger_error('thor needs a db connection name (thor_db_conn_name)');
         return;
     }
     include_once CARL_UTIL_INC . 'db/db.php';
     $this->original_db_conn_name = get_current_db_connection_name();
     $this->set($this->value);
     return true;
     /*
     		// if $this->value doesn't contain an xml declaration,assume it's a tmp_id
     		if ( strpos($this->value, '<' . '?xml') === false )
     		{
     			prp('in init, matches number');
     			prp($this->value, 'this->value, in init (early)');
     			$this->tmp_id = $this->value;
     			// Use file('getXML.php'), instead of a direct call to
     			// the database, because connecting to the test
     			// database here seems to screw up the connection to
     			// cms. Possibly only one mysql link can be open at
     			// once.
     			$this->value = implode("\n", file('http://'.HTTP_HOST_NAME.THOR_HTTP_PATH.'getXML.php?tmp_id=' . $this->tmp_id));
     			prp($this->value, 'this->value, in init (late)');
     		}
     		// otherwise, assume $this->value contains the XML
     		else
     		{
     			connectDB($this->thor_db_conn_name);
     			include_once(CARL_UTIL_INC . 'db/sqler.php');
     			$sqler = new SQLER;
     			$sqler->insert('thor', Array('content' => $this->value));
     			$this->tmp_id = mysql_insert_id();
     			connectDB($this->original_db_conn_name);
     		}
     */
 }
Exemple #2
0
 function init($args = array())
 {
     parent::init($args);
     if (!$this->can_run()) {
         trigger_error('thor needs a db connection name (thor_db_conn_name)');
         return;
     }
     include_once CARL_UTIL_INC . 'db/db.php';
     $this->original_db_conn_name = get_current_db_connection_name();
     $this->set($this->value);
     return true;
     // if $this->value doesn't contain an xml declaration,assume it's a tmp_id
     if (strpos($this->value, '<' . '?xml') === false) {
         prp('in init, matches number');
         prp($this->value, 'this->value, in init (early)');
         $this->tmp_id = $this->value;
         // Use file('getXML.php'), instead of a direct call to
         // the database, because connecting to the test
         // database here seems to screw up the connection to
         // cms. Possibly only one mysql link can be open at
         // once.
         $this->value = implode("\n", file('http://' . HTTP_HOST_NAME . THOR_HTTP_PATH . 'getXML.php?tmp_id=' . $this->tmp_id));
         prp($this->value, 'this->value, in init (late)');
     } else {
         connectDB($this->thor_db_conn_name);
         include_once CARL_UTIL_INC . 'db/sqler.php';
         $sqler = new SQLER();
         $sqler->insert('thor', array('content' => $this->value));
         $this->tmp_id = mysql_insert_id();
         connectDB($this->original_db_conn_name);
     }
 }