self PHP Class Code Examples

This page contains top rated real world PHP examples of class self extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: ad.php Project: Wildboard/WbWebApp
0
 /**
  * generate seo title. return the title formatted for the URL
  *
  * @param string title
  * @return $seotitle (unique string)  
  */
 public function gen_seo_title($title)
 {
     $ad = new self();
     // d($title);
     $title = URL::title($title);
     $seotitle = $title;
     //find a ad same seotitle
     $a = $ad->where('seotitle', '=', $seotitle)->and_where('id_ad', '!=', $this->id_ad)->limit(1)->find();
     if ($a->loaded()) {
         $cont = 1;
         $loop = TRUE;
         do {
             $attempt = $title . '-' . $cont;
             $ad = new self();
             unset($a);
             $a = $ad->where('seotitle', '=', $attempt)->limit(1)->find();
             if (!$a->loaded()) {
                 $loop = FALSE;
                 $seotitle = $attempt;
             } else {
                 $cont++;
             }
         } while ($loop);
     }
     return $seotitle;
 }
Example #2
Show file File: infocom.class.php Project: gaforeror/glpi
0
 /**
  * Duplicate infocoms from an item template to its clone
  *
  * @param $itemtype     itemtype of the item
  * @param $oldid        ID of the item to clone
  * @param $newid        ID of the item cloned
  * @param $newitemtype  itemtype of the new item (= $itemtype if empty) (default '')
  **/
 static function cloneItem($itemtype, $oldid, $newid, $newitemtype = '')
 {
     global $DB;
     $ic = new self();
     if ($ic->getFromDBforDevice($itemtype, $oldid)) {
         $input = $ic->fields;
         $input = Toolbox::addslashes_deep($input);
         $input['items_id'] = $newid;
         if (!empty($newitemtype)) {
             $input['itemtype'] = $newitemtype;
         }
         unset($input["id"]);
         if (isset($input["immo_number"])) {
             $input["immo_number"] = autoName($input["immo_number"], "immo_number", 1, 'Infocom', $input['entities_id']);
         }
         $date_fields = array('buy_date', 'delivery_date', 'inventory_date', 'order_date', 'use_date', 'warranty_date');
         foreach ($date_fields as $f) {
             if (empty($input[$f])) {
                 unset($input[$f]);
             }
         }
         $ic2 = new self();
         $ic2->add($input);
     }
 }
Example #3
Show file File: class-wpseo-rank.php Project: Garth619/Femi9
0
 /**
  * Returns a rank for a specific numeric score
  *
  * @param int $score The score to determine a rank for.
  *
  * @return self
  */
 public static function from_numeric_score($score)
 {
     // Set up the default value.
     $rank = new self(self::BAD);
     foreach (self::$ranges as $rank_index => $range) {
         if ($range['start'] <= $score && $score <= $range['end']) {
             $rank = new self($rank_index);
             break;
         }
     }
     return $rank;
 }
Example #4
Show file File: SystemChangeLog.class.php Project: edurbs/sobcontrole
0
 /**
  * Register a change log
  */
 public static function register($activeRecord, $lastState, $currentState)
 {
     $table = $activeRecord->getEntity();
     $pk = $activeRecord->getPrimaryKey();
     TTransaction::open('log');
     foreach ($lastState as $key => $value) {
         if (!isset($currentState[$key])) {
             // deleted
             $log = new self();
             $log->tablename = $table;
             $log->logdate = date('Y-m-d H:i:s');
             $log->login = TSession::getValue('login');
             $log->primarykey = $pk;
             $log->pkvalue = $activeRecord->{$pk};
             $log->operation = 'deleted';
             $log->columnname = $key;
             $log->oldvalue = $value;
             $log->newvalue = '';
             $log->store();
         }
     }
     foreach ($currentState as $key => $value) {
         if (isset($lastState[$key]) and $value != $lastState[$key]) {
             // changed
             $log = new self();
             $log->tablename = $table;
             $log->logdate = date('Y-m-d H:i:s');
             $log->login = TSession::getValue('login');
             $log->primarykey = $pk;
             $log->pkvalue = $activeRecord->{$pk};
             $log->operation = 'changed';
             $log->columnname = $key;
             $log->oldvalue = $lastState[$key];
             $log->newvalue = $value;
             $log->store();
         }
         if (!isset($lastState[$key]) and !empty($value)) {
             // created
             $log = new self();
             $log->tablename = $table;
             $log->logdate = date('Y-m-d H:i:s');
             $log->login = TSession::getValue('login');
             $log->primarykey = $pk;
             $log->pkvalue = $activeRecord->{$pk};
             $log->operation = 'created';
             $log->columnname = $key;
             $log->oldvalue = '';
             $log->newvalue = $value;
             $log->store();
         }
     }
     TTransaction::close();
 }
Example #5
Show file File: InlineStyle.php Project: ganastor/LibraryBox-Custom-MediaBox-
0
 /**
  *    A static function designed to make it easier to get the info
  *
  *    @static
  *    @access public
  *
  *    @param string $query
  *    @param mixed $context
  *    @param array|Traversable $ret - passed by reference
  *
  *    @return array
  */
 public static function find($query, $context, $ret = null)
 {
     $new = array();
     //query using DOMDocument
     if ($context instanceof DOMDocument) {
         $css = new self($context);
         $new = $css->query($query);
     } elseif ($context instanceof DOMNodeList) {
         if ($context->length) {
             $css = new self($context->item(0)->ownerDocument);
             $new = $css->query($query, $context);
         }
     } elseif (!$context instanceof DOMNode && count($context)) {
         $css = new self($context[0]->ownerDocument);
         $new = $css->query($query, $context);
     } else {
         $css = new self($context->ownerDocument);
         $new = $css->query($query, $context);
     }
     //if there is a place to store the newly selected elements
     if ($ret) {
         //append the newly selected elements to the given array|object
         //or if it is an instance of ArrayAccess just push it on to the object
         if (is_array($ret)) {
             $new = array_merge($ret, $new);
             $new = self::unique($new);
             $ret = $new;
         } elseif (is_object($ret)) {
             if ($ret instanceof ArrayAccess) {
                 foreach ($new as $elem) {
                     $ret[count($ret)] = $elem;
                 }
             } elseif ($ret instanceof DOMDocumentFragment) {
                 foreach ($new as $elem) {
                     //appendChild, but don't forget to verify same document
                     $ret->appendChild(!$ret->ownerDocument->isSameNode($elem->ownerDocument) ? $ret->ownerDocument->importNode($elem, true) : $elem);
                 }
             } elseif (($m = method_exists($ret, 'push')) || method_exists($ret, 'add')) {
                 $method = $m ? 'push' : 'add';
                 foreach ($new as $elem) {
                     $ret->{$method}($elem);
                 }
             } elseif (($m = method_exists($ret, 'concat')) || method_exists($ret, 'concatenate')) {
                 $method = $m ? 'concat' : 'concatenate';
                 $ret->{$method}($new);
             }
         } elseif (is_string($ret)) {
             foreach ($new as $elem) {
                 $ret .= $elem->ownerDocument->saveXML($elem);
             }
         }
     }
     return $new;
 }
Example #6
Show file File: Sanitizer.php Project: yocki-s/veritrans-woocommerce
0
 private static function fieldPhone(&$field)
 {
     $plus = substr($field, 0, 1) === '+' ? true : false;
     $self = new self();
     $field = $self->whitelist('\\d\\-\\(\\) ')->maxLength(19)->apply($field);
     if ($plus) {
         $field = '+' . $field;
     }
     $self = new self();
     $field = $self->maxLength(19)->apply($field);
 }
Example #7
Show file File: oledrion_parameters.php Project: osw17/oledrion
0
 /**
  * Méthode qui essaye de faire la même chose que la méthode extend() de jQuery
  *
  * On lui passe les valeurs par défaut que l'on attend et la méthode les compare avec les valeurs actuelles
  * Si des valeurs manquent, elles sont ajoutées
  *
  * @param  oledrion_parameters $defaultValues
  * @return oledrion_parameters
  */
 public function extend(self $defaultValues)
 {
     $result = new self();
     $result = $this;
     foreach ($defaultValues as $key => $value) {
         if (!isset($result[$key])) {
             $result[$key] = $value;
         }
     }
     return $result;
 }
Example #8
Show file File: Task.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 /**
  * this function creates a Tasks_Model_Task and stores it in the database
  * 
  * @param  Tinebase_Model_Container  $container
  * @param  stream|string             $vobjectData
  */
 public static function create(Tinebase_Model_Container $container, $name, $vobjectData, $onlyCurrentUserOrganizer = 'unused')
 {
     if (is_resource($vobjectData)) {
         $vobjectData = stream_get_contents($vobjectData);
     }
     // Converting to UTF-8, if needed
     $vobjectData = Sabre\DAV\StringUtil::ensureUTF8($vobjectData);
     #Sabre_CalDAV_ICalendarUtil::validateICalendarObject($vobjectData, array('VTODO', 'VFREEBUSY'));
     list($backend, $version) = Tasks_Convert_Task_VCalendar_Factory::parseUserAgent($_SERVER['HTTP_USER_AGENT']);
     try {
         $task = Tasks_Convert_Task_VCalendar_Factory::factory($backend, $version)->toTine20Model($vobjectData);
     } catch (Exception $e) {
         Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e);
         Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . " " . $vobjectData);
         throw new Sabre\DAV\Exception\PreconditionFailed($e->getMessage());
     }
     $task->container_id = $container->getId();
     $id = ($pos = strpos($name, '.')) === false ? $name : substr($name, 0, $pos);
     $task->setId($id);
     self::enforceEventParameters($task);
     // check if there is already an existing task with this ID
     // this can happen when the invitation email is faster then the caldav update or
     // or when an task gets moved to another container
     $filter = new Tasks_Model_TaskFilter(array(array('field' => 'is_deleted', 'operator' => 'equals', 'value' => Tinebase_Model_Filter_Bool::VALUE_NOTSET), array('condition' => 'OR', 'filters' => array(array('field' => 'id', 'operator' => 'equals', 'value' => $id), array('field' => 'uid', 'operator' => 'equals', 'value' => $id)))));
     $existingEvent = Tasks_Controller_Task::getInstance()->search($filter, null, false, false, 'sync')->getFirstRecord();
     if ($existingEvent === null) {
         try {
             $task = Tasks_Controller_Task::getInstance()->create($task);
         } catch (Exception $e) {
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' ' . $e);
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . " " . $vobjectData);
             Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . " " . print_r($task->toArray(), true));
             throw new Sabre\DAV\Exception\PreconditionFailed($e->getMessage());
         }
         $vevent = new self($container, $task);
     } else {
         if ($existingEvent->is_deleted) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' recovering already deleted task');
             }
             // @TODO have a undelete/recover workflow beginning in controller
             $existingEvent->is_deleted = 0;
             $existingEvent->deleted_by = NULL;
             $existingEvent->deleted_time = NULL;
             $be = new Tasks_Backend_Sql();
             $be->updateMultiple($existingEvent->getId(), array('is_deleted' => 0, 'deleted_by' => NULL, 'deleted_time' => NULL));
         }
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' update existing task with id: ' . $existingEvent->getId());
         }
         $vevent = new self($container, $existingEvent);
         $vevent->put($vobjectData);
     }
     return $vevent;
 }
Example #9
Show file File: Assertion.php Project: palantirnet/simplesamlphp
0
 /**
  * Handle assertion.
  *
  * This function handles an assertion.
  *
  * @param string $file  The file assert was called from.
  * @param int $line  The line assert was called from.
  * @param mixed $message  The expression which was passed to the assert-function.
  */
 public static function onAssertion($file, $line, $message)
 {
     if (!empty($message)) {
         $exception = new self($message);
     } else {
         $exception = new self();
     }
     $exception->logError();
 }
Example #10
Show file File: Promise.class.php Project: zhanglei/swPromise
0
 public function then($sth)
 {
     if (is_callable($sth)) {
         $future = new Future($sth);
         $nextPromise = new self($future);
         $this->nextPromise = $nextPromise;
         $nextPromise->lastPromise = $this;
         return $nextPromise;
     } elseif ($sth instanceof FutureIntf) {
         $nextPromise = new self($sth);
         $this->nextPromise = $nextPromise;
         $nextPromise->lastPromise = $this;
         return $nextPromise;
     } elseif ($sth instanceof Promise) {
         // 拿到的sth一定是尾promise,把头promise挂上主promise
         $headPromise = $sth->getHeadPromise();
         $this->nextPromise = $headPromise;
         $headPromise->lastPromise = $this;
         return $sth;
     } elseif (is_array($sth)) {
         $nextPromise = PromiseGroup::create($sth);
         $this->nextPromise = $nextPromise;
         $nextPromise->lastPromise = $this;
         return $nextPromise;
     } else {
         throw new Exception('error sth type');
     }
 }
Example #11
Show file File: ilCharSelectorConfig.php Project: arlendotcn/ilias
0
 /**
  * Get the configuration that should be used for the current selector
  * @param	object	(optional) current running test 
  * @return	ilCharSelectorConfig
  */
 static function _getCurrentConfig(ilObjTest $a_test_obj = null)
 {
     global $ilSetting, $ilUser;
     // check configuration from administration settings
     $admin_config = new self(self::CONTEXT_ADMIN, true);
     $admin_config->setAvailability($ilSetting->get('char_selector_availability'));
     $admin_config->setDefinition($ilSetting->get('char_selector_definition'));
     if ($admin_config->getAvailability() == self::INACTIVE) {
         // a globally inactive selector can't be overwritten by users or tests
         return $admin_config;
     }
     // a test configuration is relevant for test runs
     if (isset($a_test_obj)) {
         $test_config = new self(self::CONTEXT_TEST, false);
         $test_config->setAvailability($a_test_obj->getCharSelectorAvailability());
         $test_config->setDefinition($a_test_obj->getCharSelectorDefinition());
         if ($test_config->getAvailability() != self::INHERIT) {
             // a specific test configuration has precedence over user configuration
             return $test_config;
         }
     }
     // check configuration from user settings
     $user_config = new self(self::CONTEXT_USER, true);
     $user_config->setAvailability($ilUser->getPref('char_selector_availability'));
     $user_config->setDefinition($ilUser->getPref('char_selector_definition'));
     if ($user_config->getAvailability() != self::INHERIT) {
         // take user specific config
         return $user_config;
     } else {
         // take admin config as default
         return $admin_config;
     }
 }
Example #12
Show file File: post.php Project: Wildboard/WbWebApp
0
 /**
  * return the title formatted for the URL
  *
  * @param  string $title
  * 
  */
 public function gen_seotitle($seotitle)
 {
     //in case seotitle is really small or null
     if (strlen($seotitle) < 3) {
         $seotitle = $this->title;
     }
     $seotitle = URL::title($seotitle);
     if ($seotitle != $this->seotitle) {
         $cat = new self();
         //find a user same seotitle
         $s = $cat->where('seotitle', '=', $seotitle)->limit(1)->find();
         //found, increment the last digit of the seotitle
         if ($s->loaded()) {
             $cont = 2;
             $loop = TRUE;
             while ($loop) {
                 $attempt = $seotitle . '-' . $cont;
                 $cat = new self();
                 unset($s);
                 $s = $cat->where('seotitle', '=', $attempt)->limit(1)->find();
                 if (!$s->loaded()) {
                     $loop = FALSE;
                     $seotitle = $attempt;
                 } else {
                     $cont++;
                 }
             }
         }
     }
     return $seotitle;
 }
Example #13
Show file File: Extension.php Project: cannking/vtigercrm-debug
0
 /**
  * Function to get instance by using id
  * @param <Integer> $extensionId
  * @param <String> $fileName
  * @return <Settings_ModuleManager_Extension_Model> $extension Model
  */
 public static function getInstanceById($extensionId, $fileName = false)
 {
     $uploadDir = self::getUploadDirectory();
     if ($fileName) {
         if (is_dir($uploadDir)) {
             $uploadFileName = "{$uploadDir}/{$fileName}";
             checkFileAccess(self::getUploadDirectory());
             $extensionModel = new self();
             $extensionModel->setId($extensionId)->setFileName($fileName);
             return $extensionModel;
         }
     } else {
         if (!is_dir($uploadDir)) {
             mkdir($uploadDir);
         }
         $uploadFile = 'usermodule_' . time() . '.zip';
         $uploadFileName = "{$uploadDir}/{$uploadFile}";
         checkFileAccess(self::getUploadDirectory());
         $packageAvailable = Settings_ModuleManager_Extension_Model::download($extensionId, $uploadFileName);
         if ($packageAvailable) {
             $extensionModel = new self();
             $extensionModel->setId($extensionId)->setFileName($uploadFile);
             return $extensionModel;
         }
     }
     return false;
 }
Example #14
Show file File: Member.php Project: cannking/vtigercrm-debug
0
 /**
  * Function to get all the groups
  * @return <Array> - Array of Settings_Groups_Record_Model instances
  */
 public static function getAll($onlyActive = true)
 {
     $members = array();
     $allUsers = Users_Record_Model::getAll($onlyActive);
     foreach ($allUsers as $userId => $userModel) {
         $qualifiedId = self::getQualifiedId(self::MEMBER_TYPE_USERS, $userId);
         $member = new self();
         $members[self::MEMBER_TYPE_USERS][$qualifiedId] = $member->set('id', $qualifiedId)->set('name', $userModel->getName());
     }
     $allGroups = Settings_Groups_Record_Model::getAll();
     foreach ($allGroups as $groupId => $groupModel) {
         $qualifiedId = self::getQualifiedId(self::MEMBER_TYPE_GROUPS, $groupId);
         $member = new self();
         $members[self::MEMBER_TYPE_GROUPS][$qualifiedId] = $member->set('id', $qualifiedId)->set('name', $groupModel->getName());
     }
     $allRoles = Settings_Roles_Record_Model::getAll();
     foreach ($allRoles as $roleId => $roleModel) {
         $qualifiedId = self::getQualifiedId(self::MEMBER_TYPE_ROLES, $roleId);
         $member = new self();
         $members[self::MEMBER_TYPE_ROLES][$qualifiedId] = $member->set('id', $qualifiedId)->set('name', $roleModel->getName());
         $qualifiedId = self::getQualifiedId(self::MEMBER_TYPE_ROLE_AND_SUBORDINATES, $roleId);
         $member = new self();
         $members[self::MEMBER_TYPE_ROLE_AND_SUBORDINATES][$qualifiedId] = $member->set('id', $qualifiedId)->set('name', $roleModel->getName());
     }
     return $members;
 }
Example #15
Show file File: Person.php Project: dragonlet/clearhealth
0
 public static function checkDuplicatePerson(self $person)
 {
     $db = Zend_Registry::get('dbAdapter');
     $lastName = $person->lastName;
     $firstName = $person->firstName;
     $firstInitial = substr($firstName, 0, 1);
     $gender = $person->gender;
     $dob = $person->dateOfBirth;
     $sqlSelect = $db->select()->from($person->_table)->where('last_name LIKE ' . $db->quote($lastName) . ' OR last_name LIKE ' . $db->quote($lastName . '%'))->where('first_name LIKE ' . $db->quote($firstName) . ' OR first_name LIKE ' . $db->quote($firstName . '%') . ' OR (SUBSTRING(first_name,1,1) LIKE ' . $db->quote($firstInitial) . ' AND gender=' . $db->quote($gender) . ') OR date_of_birth=' . $db->quote($dob))->order('last_name')->order('first_name')->order('middle_name')->order('date_of_birth');
     $duplicates = array();
     if ($rows = $db->fetchAll($sqlSelect)) {
         foreach ($rows as $row) {
             $p = new self();
             $p->populateWithArray($row);
             $tmp = array();
             $tmp['personId'] = $p->personId;
             $tmp['name'] = $p->displayName;
             $tmp['dateOfBirth'] = $p->dateOfBirth;
             $tmp['gender'] = $p->displayGender;
             $tmp['ssn'] = $p->identifier;
             $duplicates[] = $tmp;
         }
     }
     return $duplicates;
 }
Example #16
Show file File: RuleMember.php Project: Bergdahls/YetiForceCRM
0
 /**
  * Function to get all the rule members
  * @return <Array> - Array of Settings_SharingAccess_RuleMember_Model instances
  */
 public static function getAll()
 {
     $rules = [];
     $allGroups = Settings_Groups_Record_Model::getAll();
     foreach ($allGroups as $groupId => $groupModel) {
         $qualifiedId = self::getQualifiedId(self::RULE_MEMBER_TYPE_GROUPS, $groupId);
         $rule = new self();
         $rules[self::RULE_MEMBER_TYPE_GROUPS][$qualifiedId] = $rule->set('id', $qualifiedId)->set('name', $groupModel->getName());
     }
     $allRoles = Settings_Roles_Record_Model::getAll();
     foreach ($allRoles as $roleId => $roleModel) {
         $qualifiedId = self::getQualifiedId(self::RULE_MEMBER_TYPE_ROLES, $roleId);
         $rule = new self();
         $rules[self::RULE_MEMBER_TYPE_ROLES][$qualifiedId] = $rule->set('id', $qualifiedId)->set('name', $roleModel->getName());
         $qualifiedId = self::getQualifiedId(self::RULE_MEMBER_TYPE_ROLE_AND_SUBORDINATES, $roleId);
         $rule = new self();
         $rules[self::RULE_MEMBER_TYPE_ROLE_AND_SUBORDINATES][$qualifiedId] = $rule->set('id', $qualifiedId)->set('name', $roleModel->getName());
     }
     $allUsers = Users_Record_Model::getAll();
     foreach ($allUsers as $userId => $userModel) {
         $qualifiedId = self::getQualifiedId(self::RULE_MEMBER_TYPE_USERS, $userId);
         $rule = new self();
         $rules[self::RULE_MEMBER_TYPE_USERS][$qualifiedId] = $rule->set('id', $qualifiedId)->set('name', $userModel->getDisplayName());
     }
     return $rules;
 }
Example #17
Show file File: location.php Project: Wildboard/WbWebApp
0
 /**
  * return the title formatted for the URL
  *
  * @param  string $title
  * 
  */
 public function gen_seoname($seoname)
 {
     //in case seoname is really small or null
     if (strlen($seoname) < 3) {
         $seoname = $this->name;
     }
     $seoname = URL::title($seoname);
     if ($seoname != $this->seoname) {
         $loc = new self();
         //find a user same seoname
         $s = $loc->where('seoname', '=', $seoname)->limit(1)->find();
         //found, increment the last digit of the seoname
         if ($s->loaded()) {
             $cont = 2;
             $loop = TRUE;
             while ($loop) {
                 $attempt = $seoname . '-' . $cont;
                 $loc = new self();
                 unset($s);
                 $s = $loc->where('seoname', '=', $attempt)->limit(1)->find();
                 if (!$s->loaded()) {
                     $loop = FALSE;
                     $seoname = $attempt;
                 } else {
                     $cont++;
                 }
             }
         }
     }
     return $seoname;
 }
Example #18
Show file File: Item.php Project: cnelissen/phalcon-devtools
0
 /**
  * Allows to check whether a version is in a range between two values.
  *
  * @param  string  $initialVersion
  * @param  string  $finalVersion
  * @param  array   $versions       Item[]
  * @return array
  */
 public static function between($initialVersion, $finalVersion, $versions)
 {
     $versions = self::sortAsc($versions);
     if (!is_object($initialVersion)) {
         $initialVersion = new self($initialVersion);
     }
     if (!is_object($finalVersion)) {
         $finalVersion = new self($finalVersion);
     }
     $betweenVersions = array();
     if ($initialVersion->getStamp() == $finalVersion->getStamp()) {
         return $betweenVersions;
         // nothing to do
     }
     if ($initialVersion->getStamp() < $finalVersion->getStamp()) {
         $versions = self::sortAsc($versions);
     } else {
         $versions = self::sortDesc($versions);
         list($initialVersion, $finalVersion) = array($finalVersion, $initialVersion);
     }
     foreach ($versions as $version) {
         /** @var Item $version */
         if ($version->getStamp() >= $initialVersion->getStamp() && $version->getStamp() <= $finalVersion->getStamp()) {
             $betweenVersions[] = $version;
         }
     }
     return $betweenVersions;
 }
Example #19
Show file File: BarcodeMacro.php Project: dragonlet/clearhealth
0
 /**
  * Reorder macro
  */
 public function reorder($from, $to)
 {
     $from = preg_replace('/[^0-9a-z_A-Z- \\.]/', '', $from);
     $to = preg_replace('/[^0-9a-z_A-Z- \\.]/', '', $to);
     $barcodeMacroFrom = new self();
     $barcodeMacroFrom->name = $from;
     $barcodeMacroFrom->populate();
     if (!strlen($barcodeMacroFrom->macro) > 0) {
         return;
     }
     $barcodeMacroTo = new self();
     $barcodeMacroTo->name = $to;
     $barcodeMacroTo->populate();
     if (!strlen($barcodeMacroTo->macro) > 0) {
         return;
     }
     $db = Zend_Registry::get("dbAdapter");
     $db->beginTransaction();
     try {
         $orderFrom = $barcodeMacroFrom->order;
         $barcodeMacroFrom->order = $barcodeMacroTo->order;
         $barcodeMacroFrom->persist();
         $barcodeMacroTo->order = $orderFrom;
         $barcodeMacroTo->persist();
         $db->commit();
     } catch (Exception $e) {
         $db->rollBack();
         trigger_error($e->getMessage(), E_USER_NOTICE);
     }
 }
Example #20
Show file File: CUrlRestriction.class.php Project: fbone/mediboard4
0
 /**
  * @see parent::getAll()
  */
 function getAll()
 {
     $http = "http://";
     if (array_key_exists("HTTPS", $_SERVER)) {
         $http = "https://";
     }
     $address = $_SERVER['SERVER_ADDR'];
     // IPv6 address
     if (strpos($address, ":") !== false) {
         $address = "[{$address}]";
     }
     $url = $http . dirname(dirname($address . $_SERVER['REQUEST_URI']));
     $restrictions = array();
     $restriction = new self();
     $restriction->url = "{$url}/files";
     $restriction->description = "Répertoire des fichiers utilisateur";
     $restrictions[] = $restriction;
     $restriction = new self();
     $restriction->url = "{$url}/tmp";
     $restriction->description = "Répertoire des fichiers temporaires";
     $restrictions[] = $restriction;
     $restriction = new self();
     $restriction->url = "{$url}/tmp/mb-log.html";
     $restriction->description = "Journal d'erreurs système";
     $restrictions[] = $restriction;
     return $restrictions;
 }
Example #21
Show file File: mapping.php Project: philbertphotos/JMapMyLDAP
0
 /**
  * Compare the DN in the parameter against the groups in
  * the ldap groups. This is used to compare if one of the
  * group mapping list dn entries matches any of the ldap user
  * groups and if so returns true.
  *
  * @param   self  $parameter    Group mapping list parameters.
  * @param   self  &$ldapGroups  Ldap user groups.
  *
  * @return  Boolean  True on parameter entry is in the ldap user group.
  *
  * @since   1.0
  */
 public static function compareGroup(self $parameter, self &$ldapGroups)
 {
     $matches = array();
     if ($parameter->dn === false || $ldapGroups->dn === false) {
         // Distinguished Name has invalid syntax
         return false;
     }
     foreach ($ldapGroups->groups as $ldapGroup) {
         /*
          * If there is currently no RDNs (i.e. non validated DN)
          * then we will use a simple string comparison.
          */
         if (count($parameter->rdn)) {
             $explode = SHLdap::explodeDn($ldapGroup, 0);
             if (is_array($explode) && count($explode)) {
                 // We need to convert to lower because escape characters return with uppercase hex ascii codes
                 $explode = array_map('strToLower', SHLdap::explodeDn($ldapGroup, 0));
                 if (self::compareValidatedDN($parameter->rdn, $explode)) {
                     return true;
                 }
             }
         } else {
             // Simple string comparison instead of the validated DN method
             if (strToLower(trim($ldapGroup)) == strToLower(trim($parameter->dn))) {
                 return true;
             }
         }
     }
 }
Example #22
Show file File: HTMLFileCache.php Project: rocLv/conference
0
 public static function clearFileCache($title)
 {
     global $wgUseFileCache;
     if (!$wgUseFileCache) {
         return false;
     }
     $fc = new self($title, 'view');
     @unlink($fc->fileCacheName());
     $fc = new self($title, 'raw');
     @unlink($fc->fileCacheName());
     return true;
 }
Frequently Used Methods