Example #1
0
 /**
  * Add a widget, just bin widgets!
  *
  * @param    object   $widget  Widget To add
  * @access   public
  */
 function add(&$widget, $comment = '')
 {
     $name = $widget->getClassName();
     if ($widget->getFamilyWidget() == 'bin' || $name == 'hbox' || $name == 'vbox') {
         array_push($this->_items, array('control' => &$widget, 'comment' => $comment));
     } else {
         die("Sorry, you must add a bin widget (an entry, button, combo, etc) to a FieldSet");
     }
 }
Example #2
0
 /**
  * Add an item to the toolbar
  *
  * @param  object $widget The widget to pack
  * @access public
  */
 function add(&$widget, $identifier = '')
 {
     //.. radio buttons or check buttons are so f* horrible that we should not use them here..
     if (!strpos($widget->getClassName(), 'buttons')) {
         $this->_items[] =& $widget;
     } else {
         die("Sorry, radio/check buttons can't be added to the toolbar");
     }
 }
 /**
  * Actualiza la columna Publish y Privacy con
  * los mismos valores que el objeto relacionado
  * @param object $objeto
  */
 static function sincroniza($objeto)
 {
     $url = new CpanUrlAmigables();
     $rows = $url->cargaCondicion("Id", "Entity='{$objeto->getClassName()}' and IdEntity='{$objeto->getPrimaryKeyValue()}'");
     if ($rows[0]['Id']) {
         $url = new CpanUrlAmigables($rows[0]['Id']);
         $url->queryUpdate(array("Publish" => $objeto->getPublish()->getIDTipo(), "Privacy" => $objeto->getPrivacy()->getIDTipo()));
     }
     unset($url);
 }
Example #4
0
 /**
  * Add an action column
  *
  * @param  object  $column Action Column's Object
  * @access public
  */
 function addActionColumn(&$column)
 {
     if ($column->getClassName() == 'actioncolumn') {
         $this->_actionColumns[] =& $column;
     }
 }
Example #5
0
/**
 * Log a system event related to a specific object.
 *
 * This is called by the event system and should not be called directly.
 *
 * @param object $object The object you're talking about.
 * @param string $event  String The event being logged
 *
 * @return mixed
 */
function system_log($object, $event)
{
    global $CONFIG;
    static $log_cache;
    static $cache_size = 0;
    if ($object instanceof Loggable) {
        // reset cache if it has grown too large
        if (!is_array($log_cache) || $cache_size > 500) {
            $log_cache = array();
            $cache_size = 0;
        }
        // Has loggable interface, extract the necessary information and store
        $object_id = (int) $object->getSystemLogID();
        $object_class = $object->getClassName();
        $object_type = $object->getType();
        $object_subtype = $object->getSubtype();
        $event = sanitise_string($event);
        $time = time();
        $ip_address = sanitise_string($_SERVER['REMOTE_ADDR']);
        $performed_by = elgg_get_logged_in_user_guid();
        if (isset($object->access_id)) {
            $access_id = $object->access_id;
        } else {
            $access_id = ACCESS_PUBLIC;
        }
        if (isset($object->enabled)) {
            $enabled = $object->enabled;
        } else {
            $enabled = 'yes';
        }
        if (isset($object->owner_guid)) {
            $owner_guid = $object->owner_guid;
        } else {
            $owner_guid = 0;
        }
        // Create log if we haven't already created it
        if (!isset($log_cache[$time][$object_id][$event])) {
            $query = "INSERT DELAYED into {$CONFIG->dbprefix}system_log\n\t\t\t\t(object_id, object_class, object_type, object_subtype, event,\n\t\t\t\tperformed_by_guid, owner_guid, access_id, enabled, time_created, ip_address)\n\t\t\tVALUES\n\t\t\t\t('{$object_id}','{$object_class}','{$object_type}', '{$object_subtype}', '{$event}',\n\t\t\t\t{$performed_by}, {$owner_guid}, {$access_id}, '{$enabled}', '{$time}', '{$ip_address}')";
            insert_data($query);
            $log_cache[$time][$object_id][$event] = true;
            $cache_size += 1;
        }
        return true;
    }
}
Example #6
0
 public function displayMenutitle($title = null)
 {
     $title = $title ? $title : ucfirst($this->_object->getClassName('suffix'));
     JToolBarHelper::title(JText::_($title), 'langmanager');
 }
Example #7
0
 /**
  * Add an item, but just bin widgets, fieldsets or form boxes
  *
  * @param     object  $item     The item
  * @param     string  $comment  If item needs a comment (down)
  * @param     string  $warning  If item needs a warning (up)
  * @access    public
  */
 function add(&$item, $comment = '', $warning = '')
 {
     $familyWidget = $item->getFamilyWidget();
     if ($familyWidget == 'container' || $familyWidget == 'bin') {
         if ($item->getClassName() != 'hiddenentry') {
             array_push($this->_items, array('control' => &$item, 'comment' => $comment, 'warning' => $warning));
         } else {
             array_push($this->_hiddenItems, array('control' => &$item));
         }
         if ($familyWidget == 'container') {
             $item->_useTitles = true;
         }
     } else {
         die("Sorry, you can only add bin widgets, fieldsets or form boxes");
     }
 }
Example #8
0
/**
 * Log a system event related to a specific object.
 *
 * This is called by the event system and should not be called directly.
 *
 * @param object $object The object you're talking about.
 * @param string $event  The event being logged
 * @return void
 */
function system_log($object, $event)
{
    global $CONFIG;
    static $log_cache;
    static $cache_size = 0;
    if ($object instanceof Loggable) {
        /* @var ElggEntity|ElggExtender $object */
        if (datalist_get('version') < 2012012000) {
            // this is a site that doesn't have the ip_address column yet
            return;
        }
        // reset cache if it has grown too large
        if (!is_array($log_cache) || $cache_size > 500) {
            $log_cache = array();
            $cache_size = 0;
        }
        // Has loggable interface, extract the necessary information and store
        $object_id = (int) $object->getSystemLogID();
        $object_class = $object->getClassName();
        $object_type = $object->getType();
        $object_subtype = $object->getSubtype();
        $event = sanitise_string($event);
        $time = time();
        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
        } elseif (!empty($_SERVER['HTTP_X_REAL_IP'])) {
            $ip_address = array_pop(explode(',', $_SERVER['HTTP_X_REAL_IP']));
        } else {
            $ip_address = $_SERVER['REMOTE_ADDR'];
        }
        $ip_address = sanitise_string($ip_address);
        $performed_by = elgg_get_logged_in_user_guid();
        if (isset($object->access_id)) {
            $access_id = $object->access_id;
        } else {
            $access_id = ACCESS_PUBLIC;
        }
        if (isset($object->enabled)) {
            $enabled = $object->enabled;
        } else {
            $enabled = 'yes';
        }
        if (isset($object->owner_guid)) {
            $owner_guid = $object->owner_guid;
        } else {
            $owner_guid = 0;
        }
        // Create log if we haven't already created it
        if (!isset($log_cache[$time][$object_id][$event])) {
            $query = "INSERT DELAYED into {$CONFIG->dbprefix}system_log\n\t\t\t\t(object_id, object_class, object_type, object_subtype, event,\n\t\t\t\tperformed_by_guid, owner_guid, access_id, enabled, time_created, ip_address)\n\t\t\tVALUES\n\t\t\t\t('{$object_id}','{$object_class}','{$object_type}', '{$object_subtype}', '{$event}',\n\t\t\t\t{$performed_by}, {$owner_guid}, {$access_id}, '{$enabled}', '{$time}', '{$ip_address}')";
            insert_data($query);
            $log_cache[$time][$object_id][$event] = true;
            $cache_size += 1;
        }
    }
}