/** * @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'); }
function addComment() { if ($this->request('hash') != $this->hash()) { return $this->redirect('404'); } $item = new struct_coreresource_comments(); $item->rcm_datetime = now(); $item->rcm_type = 'product'; $item->rcm_active = $this->_premoderation ? 0 : 1; //$item->rcm_parent_id = 0; $item->rcm_parent_id = strip_tags(stripslashes($this->request('parent_id'))); if ($this->getCurrentUser() and $this->getCurrentUser()->u_id) { $item->rcm_nickname = $this->getCurrentUser()->u_login; $item->rcm_user_id = $this->getCurrentUser()->u_id; } else { // @TODO: What really should we do if user is anonymous? $item->rcm_nickname = strip_tags(stripslashes($this->request('nickname'))); $item->rcm_user_id = 0; } $item->rcm_item_id = (int) $this->request('p'); $item->rcm_text = strip_tags(stripslashes($this->request('txt'))); $table = new model_core_table('comments', 'coreresource'); $table->insertItem($item); $item->rcm_id = $table->inserted_id(); $parentComm = $table->getItem($item->rcm_parent_id); $modelUser = rad_instances::get('model_core_users'); if ($parentComm->rcm_user_id != 0) { $userCommParent = $modelUser->getItem($parentComm->rcm_user_id); if (filter_var($userCommParent->u_email, FILTER_VALIDATE_EMAIL)) { //$link_to_comment = $this->makeURL('alias=product&products_action=i&i='.$item->rcm_id); $link_to_comment = $this->makeURL('alias=product&p=' . $item->rcm_item_id); $this->_sendMail($userCommParent->u_email, $item->rcm_text, $parentComm->rcm_text, $link_to_comment); } } //$this->_sendMail($parent->rcm_user_id); }
/** * Saves the type showed fields * @param integer $type_id */ private function saveTypeFieldsShow($type_id) { if ($type_id) { $model = new model_core_table('ct_showing', 'corecatalog'); $model->setState('where', ' cts_vl_id=' . $type_id . ' '); $items = $model->getItems(); if (count($items)) { foreach ($items as $id) { $model->deleteItem($id); } //foreach } //if $added_items = array(); if ($this->_showinlist) { if ($this->request('CTshowing_showinlist_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinlistID)); } } if ($this->_showindetail) { if ($this->request('CTshowing_showindetail_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showindetailID)); } } if ($this->_showinbin) { if ($this->request('CTshowing_showinbin_catalog_option')) { $added_items[] = new struct_corecatalog_ct_showing(array('cts_vl_id' => $type_id, 'cts_show' => $this->_showinbinID)); } } $rows = 0; if (count($added_items)) { foreach ($added_items as $id) { $rows += $model->insertItem($id); } if (!count($rows)) { throw new rad_exception('Can\'t save the showing type! file: ' . __FILE__ . ', line: ' . __LINE__); } return $rows; } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }
private function sendActivationCode($item) { $table = new model_core_table('subscribers_activationurl', 'coremail'); $table->setState('where', 'sac_scrid=' . $item->u_id . ' and sac_type=2'); $item_url = $table->getItem(); if ($item_url->sac_id) { $this->_sendMail($item, 'register_resend', array('url' => $item_url->sac_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); $this->_sendMail($item, 'register_resend', array('url' => $item_url->sac_url)); } }
/** * Edit answer * @return JS */ function editAnswer() { if ($this->request('hash') == $this->hash()) { $item_id = (int) $this->request('vtq_vtid'); if ($item_id) { $item = $this->_getAnswerFromRequest(); $table = new model_core_table('votes_questions', 'coreothers'); if ($item->vtq_id) { $rows = $table->updateItem($item); } else { $rows = $table->insertItem($item); } echo 'RADVotesQuestions.message("' . addslashes($this->lang('insertedrows.system.message ')) . ': ' . $rows . '");'; echo 'RADVotesQuestions.cancelWindowClick();'; if ($rows) { echo 'RADVotesQuestions.refresh();'; } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }
/** * Creates new theme * */ function createTheme() { $theme = trim($this->request('theme')); $alias_id = (int) $this->request('alias_id'); if ($alias_id) { $this->clearAliasCache(rad_instances::get('model_core_aliases')->getItem($alias_id)); if (strlen($theme) and is_dir(THEMESPATH . $theme)) { $table = new model_core_table('themes'); $theme_item = new struct_core_themes(); $theme_item->theme_aliasid = $alias_id; $theme_item->theme_folder = $theme; $table->insertItem($theme_item); } else { //default theme here } } else { $this->securityHoleAlert(__FILE__, __LINE__, $this->getClassName()); } }