Пример #1
0
 /**
  * Deletes a region and all its media
  * @return 
  */
 function DeleteRegion()
 {
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $layoutid = Kit::GetParam('layoutid', _REQUEST, _INT, 0);
     $regionid = Kit::GetParam('regionid', _REQUEST, _STRING);
     if ($layoutid == 0 || $regionid == '') {
         $response->SetError(__("No layout/region information available, please refresh the page and try again."));
         $response->Respond();
     }
     Kit::ClassLoader('region');
     $region = new region($db);
     $ownerId = $region->GetOwnerId($layoutid, $regionid);
     $regionAuth = $this->user->RegionAssignmentAuth($ownerId, $layoutid, $regionid, true);
     if (!$regionAuth->del) {
         trigger_error(__('You do not have permissions to delete this region'), E_USER_ERROR);
     }
     // Remove the permissions
     Kit::ClassLoader('layoutregiongroupsecurity');
     $security = new LayoutRegionGroupSecurity($db);
     $security->UnlinkAll($layoutid, $regionid);
     $db->query(sprintf("DELETE FROM lklayoutmediagroup WHERE layoutid = %d AND RegionID = '%s'", $layoutid, $regionid));
     if (!$region->DeleteRegion($layoutid, $regionid)) {
         //there was an ERROR
         $response->SetError($region->GetErrorMessage());
         $response->Respond();
     }
     $response->SetFormSubmitResponse(__('Region Deleted.'), true, sprintf("index.php?p=layout&layoutid=%d&modify=true", $layoutid));
     $response->Respond();
 }
Пример #2
0
 public function ErrorHandler($errno, $errmsg, $filename, $linenum, $vars)
 {
     // timestamp for the error entry
     $dt = date("Y-m-d H:i:s (T)");
     // define an assoc array of error string
     // in reality the only entries we should
     // consider are E_WARNING, E_NOTICE, E_USER_ERROR,
     // E_USER_WARNING and E_USER_NOTICE
     $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Recoverable Error', 8192 => 'Deprecated Call');
     // set of errors for which a var trace will be saved
     $user_errors_halt = array(E_USER_ERROR);
     $user_errors_inline = array(E_USER_WARNING);
     $err = "<errormsg>" . $errmsg . "</errormsg>\n";
     $err .= "<errornum>" . $errno . "</errornum>\n";
     $err .= "<errortype>" . $errortype[$errno] . "</errortype>\n";
     $err .= "<scriptname>" . $filename . "</scriptname>\n";
     $err .= "<scriptlinenum>" . $linenum . "</scriptlinenum>\n";
     // Log everything
     Debug::LogEntry("error", $err);
     // Test to see if this is a HALT error or not (we do the same if we are in production or not!)
     if (in_array($errno, $user_errors_halt)) {
         // We have a halt error
         Debug::LogEntry('audit', 'Creating a Response Manager to deal with the HALT Error.');
         $response = new ResponseManager();
         $response->SetError($errmsg);
         $response->Respond();
     }
     // Is Debug Enabled? (i.e. Development or Support)
     if (error_reporting() != 0) {
         if (in_array($errno, $user_errors_inline)) {
             // This is an inline error - therefore we really want to pop up a message box with this in it - so we know?
             // For now we treat this like a halt error? Or do we just try and output some javascript to pop up an error
             // surely the javascript idea wont work in ajax?
             // or prehaps we add this to the session errormessage so we see it at a later date?
             echo $errmsg;
             die;
         }
     }
     // Must return false
     return false;
 }
Пример #3
0
 /**
  * Sets the users homepage
  * @return
  */
 function SetUserHomepage()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $response = new ResponseManager();
     if (!$this->user->usertypeid == 1) {
         trigger_error(__('You do not have permission to change this users homepage'));
     }
     $userid = Kit::GetParam('userid', _POST, _INT, 0);
     $homepage = Kit::GetParam('homepage', _POST, _WORD);
     $SQL = sprintf("UPDATE user SET homepage = '%s' WHERE userID = %d", $homepage, $userid);
     if (!$db->query($SQL)) {
         trigger_error($db->error());
         $response->SetError(__('Unknown error setting this users homepage'));
         $response->Respond();
     }
     $response->SetFormSubmitResponse(__('Homepage has been set'));
     $response->Respond();
 }