예제 #1
0
파일: response.php 프로젝트: alencarmo/OCF
 function create()
 {
     global $gorumroll;
     $class = strstr($gorumroll->list, "user") ? "user" : "item";
     $this->valid();
     if (Roll::isFormInvalid()) {
         return;
     }
     if (!preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$/i', $this->youremail) || !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$/i', $this->friendsemail)) {
         return Roll::setFormInvalid("invalidEmail");
     }
     G::load($n, Notification_adToAFriend, "notification");
     if ($n->active) {
         $obj = new $class();
         $obj->id = $gorumroll->rollid;
         $obj->getEmailParams($params);
         $params["message"] = $this->mess;
         $params["name"] = $this->yourname;
         $sp = new SendingParameters();
         $sp->to = $this->friendsemail;
         $sp->from = $this->youremail;
         $sp->replyTo = $this->youremail;
         $sp->replyToName = $this->yourname;
         $n->send($sp, $params);
     }
     //TODO: respnum increase
     Roll::setInfoText("mail_fr_sent_{$class}");
 }
예제 #2
0
파일: category.php 프로젝트: alencarmo/OCF
 function modifyRecursive()
 {
     // Vigyazva kell barmit is beepiteni meg ebbe a modify-ba, mert
     // rekurziv is hivodhat.
     $this->wholeName = $this->name;
     $this->permaLink = preg_replace("[\\W]", "_", strtolower($this->name));
     if ($this->up) {
         $father = new AppCategory();
         $father->id = $this->up;
         load($father);
         $this->wholeName = $father->wholeName . " - " . $this->wholeName;
         $this->permaLink = $father->permaLink . "/" . $this->permaLink;
     }
     parent::modify();
     if (!Roll::isFormInvalid()) {
         $children = new AppCategory();
         $query = array("SELECT id, up, name FROM @category WHERE up=#this->id#", $this->id);
         loadObjectsSql($children, $query, $children);
         foreach ($children as $child) {
             $child->modifyRecursive();
             // rekurziv
         }
         // Ez a recursive kavaras azert kell, hogy pontosan ez a fg hivodjon
         // rekurzivan es ne a leszarmaztatt osztaly modify-ja.
     }
 }
예제 #3
0
 function modify($fromInstall = FALSE)
 {
     $this->str = "";
     $this->makeSearchQuery($fromInstall);
     Object::modify();
     if (!Roll::isFormInvalid()) {
         if (!$fromInstall) {
             $this->nextAction =& new AppController("customlist/list");
         }
         if ($this->cache) {
             CacheManager::resetCache($this->id, TRUE, FALSE);
         }
     }
 }
예제 #4
0
 function modify()
 {
     $this->getDefaultValue();
     parent::modify();
     if (!Roll::isFormInvalid()) {
         if (!empty($this->seo)) {
             $this->handleSeoChange();
         }
         if (!empty($this->mainPicture)) {
             $this->handleMainPictureChange();
         }
         $this->handleEnumValueChange();
     }
 }
예제 #5
0
파일: roll.php 프로젝트: alencarmo/OCF
 function afterAction(&$base)
 {
     if (!Roll::isFormInvalid()) {
         $base->setInfoText($this->method);
     }
     LocationHistory::saveInfoText();
     if (Roll::isFormInvalid()) {
         LocationHistory::rollBack(1);
     } else {
         LocationHistory::resetPost();
         CacheManager::resetCache(0, TRUE);
         //performReset
         if (isset($base->nextAction)) {
             LocationHistory::rollBack($base->nextAction);
         } elseif (isset($base->rollBackNum)) {
             LocationHistory::rollBack($base->rollBackNum);
         } else {
             if ($this->method == "delete") {
                 $ctrl =& new AppController(LocationHistory::getBack(2));
                 // ha showdetails-rol mentunk a delete-re, akkor a showdetails elotti oldalra terunk vissza:
                 if ($ctrl->list == $this->list && $ctrl->method == "showdetails" && $ctrl->rollid == $this->rollid) {
                     LocationHistory::rollBack(3);
                 }
             }
             LocationHistory::rollBack(2);
         }
     }
 }
예제 #6
0
파일: object.php 프로젝트: alencarmo/OCF
 function validateAttributes()
 {
     $typ =& $this->getTypeInfo();
     $object_vars = get_object_vars($this);
     foreach ($object_vars as $attr => $value) {
         $this->validAttribute($typ, $attr);
         if (Roll::isFormInvalid()) {
             break;
         }
     }
 }
예제 #7
0
function modify(&$base, $whereFields = "")
{
    global $globQuery;
    if (($ret = $base->valid()) || Roll::isFormInvalid()) {
        return $ret;
    }
    $typ =& $base->getTypeInfo(TRUE);
    $table = $base->get_table();
    $query = "UPDATE @{$table} SET ";
    getCreateSetStr($base, $typ, FALSE, $s, $sqlParams);
    $query .= $s;
    $hasMany = new HasManyAttrs($base);
    $whereExists = FALSE;
    if ($whereFields == "") {
        $whereFields = getPrimaryKey($typ);
    }
    if ($whereFields) {
        $firstField = TRUE;
        foreach ($whereFields as $key) {
            if (isset($base->{$key})) {
                $sqlParams[] = $key;
                $sqlParams[] = $base->{$key};
                if ($firstField) {
                    $whereOK = TRUE;
                    $query .= " WHERE `param`=#param#";
                    $firstField = FALSE;
                    $whereExists = TRUE;
                } else {
                    $query .= " AND `param`=#param#";
                }
            }
        }
    }
    array_unshift($sqlParams, $query);
    $query = $sqlParams;
    $globQuery = $query;
    if ($whereExists) {
        executeQuery($query);
        $hasMany->modify();
    } else {
        trigger_error("Modify without WHERE: " . print_r($query, TRUE), E_USER_ERROR);
    }
    return ok;
}
예제 #8
0
 function validCore($attrInfo, &$field)
 {
     global $lll;
     if (in_array("file", $attrInfo)) {
         if (in_array("media", $attrInfo)) {
             $this->validMedia($field->columnIndex);
         } else {
             $this->validPicture($field->columnIndex);
         }
         if (Roll::isFormInvalid()) {
             Roll::addInfoText("whichPictureAttribute", $lll[$field->columnIndex]);
             return TRUE;
             // to stop iteration
         }
     }
 }
예제 #9
0
파일: item.php 프로젝트: alencarmo/OCF
 function valid()
 {
     parent::valid();
     if (!Roll::isFormInvalid()) {
         Object::valid();
     }
 }
예제 #10
0
파일: user.php 프로젝트: alencarmo/OCF
 function validLogin()
 {
     $user = new User();
     $user->setUniqueValue($this->getUniqueValue());
     if (load($user, array($this->getUniqueAttr())) || $user->id == $user->name) {
         Roll::setFormInvalid();
     } else {
         if (getPassword($this->password) != $user->password && $user->newPassword) {
             if (getPassword($this->password) == $user->newPassword) {
                 executeQuery(array("UPDATE @user SET password='******', newPassword='' WHERE id=#id#", $user->id));
             } else {
                 Roll::setFormInvalid();
             }
         } elseif (getPassword($this->password) != $user->password) {
             Roll::setFormInvalid();
         }
         $this->id = $user->id;
         $this->lastClickTime = $user->lastClickTime;
     }
     if (Roll::isFormInvalid()) {
         Roll::setInfoText("loginInvalid");
     }
     return !Roll::isFormInvalid();
 }
예제 #11
0
파일: category.php 프로젝트: alencarmo/OCF
 function modify($whereFields = "")
 {
     // betoltjuk aregi category-t:
     G::load($oldObject, $this->id, "appcategory");
     $this->handleExpirationFieldsContraversy();
     parent::modify($whereFields);
     // recursive esetben csak a wholeName valtoztatasarol van szo,
     // nincs attachment feltoltes, exp, vagy immediateAppear valtoztatas:
     if (!Roll::isFormInvalid()) {
         $this->storeAttachment();
         $this->handleExpirationChanges($oldObject->expiration);
         $this->handleImmediateAppearChanges($oldObject->immediateAppear);
         CacheManager::resetCache($this->id);
     }
 }
예제 #12
0
파일: itemfield.php 프로젝트: alencarmo/OCF
 function modify()
 {
     list($oldIsCommon, $oldName, $oldColumnIndex, $this->userField) = G::getAttr($this->id, "customfield", "isCommon", "name", "columnIndex", "userField");
     // ha most allitjuk common-ra, uj columnIndex kell:
     if (!$oldIsCommon && $this->isCommon) {
         if ($this->commonFieldAlreadyExists()) {
             return;
         }
         $this->columnIndex = "col_" . CustomField::getNextColumnIndex();
     }
     parent::modify();
     if (!Roll::isFormInvalid() && !$this->isFixField()) {
         if ($oldIsCommon != $this->isCommon) {
             if ($this->isCommon) {
                 load($this);
                 $newColumnAdded = $this->addNewColumnToManagedTable();
                 // az item tablaban minden erteket atmasolunk a regi columnIndexrol az ujba:
                 if ($newColumnAdded) {
                     executeQuery("UPDATE @item SET {$this->columnIndex}={$oldColumnIndex}, {$oldColumnIndex}='' WHERE cid=#cid#", $this->cid);
                     $this->updatePictureNames($oldColumnIndex, $this->cid);
                 }
                 // TODO: a customlistek search felteteleinek update-ezese!
                 $this->nextAction =& new AppController("field/sortfield_form/{$this->cid}");
                 $this->propagateCommonField();
             } else {
                 // a globalis common torlese:
                 executeQuery("DELETE FROM @customfield WHERE cid=0 AND isCommon=1 AND  columnIndex=#ci#", $this->columnIndex);
                 // az osszes tobbi kategoriaban atallitjuk ezt a field-et unique-ra:
                 executeQuery("UPDATE @customfield SET isCommon=0 WHERE cid!=#cid# AND isCommon=1 AND columnIndex=#ci#", $this->cid, $this->columnIndex);
             }
         } elseif ($this->isCommon && $oldName != $this->name) {
             executeQuery("UPDATE @customfield SET name=#name# WHERE cid!=#cid# AND isCommon=1 AND columnIndex=#ci#", $this->name, $this->cid, $this->columnIndex);
         }
     }
     if (!Roll::isFormInvalid()) {
         CacheManager::resetAllCache();
     }
 }