예제 #1
0
 function saveItem()
 {
     //Saves the comment
     if ($this->request('hash') != $this->hash()) {
         $this->redirect('404');
     }
     if ((int) $this->request('i')) {
         $table = new model_core_table('comments', 'coreresource');
         $item = $table->getItem((int) $this->request('i'));
         $item->rcm_text = stripslashes($this->request('c_txt'));
         $item->rcm_active = (int) (bool) $this->request('active');
         $table->updateItem($item);
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
예제 #2
0
 /**
  * Changes the position of the answer
  * @return JS
  */
 function moveAnswer()
 {
     if ($this->request('hash') == $this->hash()) {
         $item_id = (int) $this->request('id');
         if ($item_id) {
             $table = new model_core_table('votes_questions', 'coreothers');
             $item = $table->getItem($item_id);
             $item->vtq_position = (int) $this->request('v');
             if ($item->vtq_position and $item_id) {
                 $table->updateItem($item);
                 echo 'RADVotesQuestions.message("' . addslashes($this->lang('updatedrows.system.message ')) . ': 1");';
                 echo 'RADVotesQuestions.refresh();';
             }
         } else {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }
예제 #3
0
 /**
  * @param struct_core_users $item
  */
 private function sendActivationCode($item)
 {
     rad_instances::get('model_coremail_subscribes')->removeExpired();
     $table = new model_core_table('subscribers_activationurl', 'coremail');
     $table->setStates(array('sac_scrid' => $item->u_id, 'sac_type' => 2, 'email' => $item->u_email, 'date_confirmed' => 0));
     $item_url = $table->getItem();
     if ($item_url->sac_id) {
         if ($item_url->date_created + 300 > time()) {
             // wow, spam
             return;
         }
         $item_url->date_created = time();
         $table->updateItem($item_url);
     } else {
         $item_url = new struct_coremail_subscribers_activationurl();
         $item_url->sac_url = md5(rad_session::genereCode(31) . now() . $item->u_id);
         $item_url->sac_scrid = $item->u_id;
         $item_url->sac_type = 2;
         $item_url->email = $item->u_email;
         $item_url->date_created = time();
         $table->insertItem($item_url);
     }
     rad_mailtemplate::send($item->u_email, $this->config('activate_email.template'), array('user' => $item, 'link' => $this->makeURL('alias=register&c=' . urlencode($item_url->sac_url)), 'clearpass' => ''), 'html');
 }
예제 #4
0
 /**
  * Saves the description to the alias
  * @return JavaScript
  */
 function saveDescription()
 {
     if ($this->redirect('hash') == $this->hash()) {
         $descriptiontxt = $this->request('descriptiontxt');
         $description_ids = $this->request('id_description_for');
         $alias_id = (int) $this->request('alias_id');
         if (count($descriptiontxt) and $alias_id) {
             $table = new model_core_table('aliases_description');
             $rows = 0;
             foreach ($descriptiontxt as $lng_id => $description) {
                 $description = trim($description);
                 if (strlen($description)) {
                     $item = new struct_core_aliases_description();
                     $item->ald_aliasid = $alias_id;
                     $item->ald_langid = $lng_id;
                     $item->ald_txt = stripslashes($description);
                     if (isset($description_ids[$lng_id]) and $description_ids[$lng_id] > 0) {
                         //UPDATE
                         $item->ald_id = (int) $description_ids[$lng_id];
                         $rows += $table->updateItem($item);
                     } else {
                         //INSERT
                         $rows += $table->insertItem($item);
                         echo '$("id_description_for_' . $lng_id . '").value="' . $table->inserted_id() . '";';
                     }
                 }
             }
             echo 'RADAliDescr.message("' . str_replace('"', '\\\\"', $this->lang('-updated')) . ': ' . $rows . '");';
         } else {
             $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
         }
     } else {
         $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName());
     }
 }