Esempio n. 1
0
 public function controller_create($args)
 {
     $vars["success"] = null;
     $vars["varname"] = "newdemo";
     $tablename = "demos";
     $objkey = "demoname";
     if (!empty($args["category"]) || !empty($args["newcategory"])) {
         $vars["varname"] = "newcategory";
         $tablename = "demo_categories";
         $objkey = "category";
     }
     if (!empty($args[$vars["varname"]])) {
         $newobj = $args[$vars["varname"]];
         $newobjid = $newobj[$objkey];
         if (!empty($newobj[$objkey]) && !empty($newobj["title"])) {
             $vars["success"] = DataManager::insert("db.demos.{$newobjid}", $tablename, $newobj);
             if (!$vars["success"]) {
                 // insert failed, try an update
                 $vars["success"] = DataManager::update("db.demos.{$newobjid}", $tablename, $newobj, array($objkey => $newobjid));
             }
         }
         $vars["demo"] = $newobj;
     } else {
         if (!empty($args["category"])) {
             $vars["varname"] = "newcategory";
             $demos = DataManager::fetch("db.demos.{$args['category']}", "demo_categories", array($objkey => $args["category"]));
             $vars["demo"] = $demos[0];
         } else {
             if (!empty($args["demoname"])) {
                 $demos = DataManager::fetch("db.demos.{$args['demoname']}", "demos", array("demoname" => $args["demoname"]));
                 $vars["demo"] = $demos[0];
             }
         }
     }
     return $this->GetComponentResponse("./create.tpl", $vars);
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'incoming_mailboxes');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'document_categories');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'config_options');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'modules');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'source_users');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'project_groups');
 }
Esempio n. 8
0
 /**
  * mysql session write handler.
  * Persist the entire portion of $_SESSION["persist"] to DB.
  * Refresh memcache with $_SESSION.
  *
  * @param string session id
  * @param string data to write
  */
 public function write($id, $data)
 {
     Profiler::StartTimer("SessionManager::write", 1);
     // Save user, and all associated lists, settings, etc.
     Profiler::StartTimer("SessionManager::write - save user");
     $user = User::singleton();
     $user->save();
     Profiler::StopTimer("SessionManager::write - save user");
     $pdata = $_SESSION["persist"];
     strip_nulls($pdata);
     // compare the persist data before and after for changes
     $pdata_serialize = serialize($pdata);
     //Logger::Warn($pdata_serialize);
     //$data = $this->cache_obj->get($id);
     $data = DataManager::fetch("memcache.session#{$id}", $id);
     $pdata_before = $data["persist"];
     $pdata_before_serialize = serialize($pdata_before);
     // update the memcache with the entire $_SESSION
     //$session_serialize = serialize($_SESSION);
     //$this->cache_obj->set($id, $_SESSION, 0);
     $data = DataManager::update("memcache.session#{$id}", $id, $_SESSION);
     if (empty($pdata) || is_null($pdata)) {
         $new_crc = 0;
     } else {
         $new_crc = strlen($pdata_serialize) . crc32($pdata_serialize);
     }
     if ($this->crc != $new_crc) {
         // if the user does not have a record already, create one first
         // NOTE from James - removed  '&& (! $pdata["user"]["userid"]' from below, didn't seem to make sense...
         if ($this->has_db_record == false) {
             $this->create_new_persist_record();
             // need to set the session cache again with we set the has_db_record param
             //$session_serialize = serialize($_SESSION);
             //$this->cache_obj->set($id, $_SESSION, 0, $this->session_cache_expire);
             DataManager::update("memcache.session#{$id}", $id, $_SESSION);
         } else {
             $result = $this->data->QueryUpdate($this->sessionsource . "#{$this->fluid}", $this->sessiontable, array($this->fluid => array("data" => $pdata_serialize)), array("fl_uid" => $this->fluid));
             Logger::Info("Updating userdata.usersession record for {$this->fluid}");
         }
     }
     Profiler::StopTimer("SessionManager::write");
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'email_templates');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'page_versions');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'invoice_items');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'assignments');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'activity_logs');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'time_reports');
 }
 /**
  * Update table
  * 
  * $updates is associative array where key is field name and value is new 
  * value
  *
  * @param array $updates
  * @param string $conditions
  * @return boolean
  * @throws DBQueryError
  */
 function update($updates, $conditions = null)
 {
     return DataManager::update($updates, $conditions, TABLE_PREFIX . 'commit_project_objects');
 }