コード例 #1
0
ファイル: poll.php プロジェクト: Parashutik/ReloadCMS
 function startPoll($question, $answers)
 {
     if (empty($question) || empty($answers)) {
         $this->lasterror = __('Empty question or no variants');
         return false;
     }
     if (!$this->copened) {
         $this->openCurrentPolls();
     }
     $data['q'] = $question;
     foreach (explode("\n", preg_replace("/[\n\r]+/", "\n", $answers)) as $variant) {
         if (!empty($variant)) {
             $data['v'][] = $variant;
             $data['c'][] = 0;
         }
     }
     $this->current[rcms_random_string(8)] = $data;
     return true;
 }
コード例 #2
0
ファイル: etc.php プロジェクト: l1ght13aby/Ubilling
 /**
  * Parses message::str [code]..[/code] bbtag
  *
  */
 function parseCodeTag()
 {
     preg_match_all("#[\\s\n\r]*\\[code\\][\\s\n\r]*(.*?)[\\s\n\r]*\\[/code\\][\\s\n\r]*#is", $this->str, $matches);
     foreach ($matches[1] as $oldpart) {
         $newpart = preg_replace("#[\n\r]+#", '', highlight_string(strtr($oldpart, array_flip(get_html_translation_table(HTML_SPECIALCHARS))), true));
         $newpart = preg_replace(array('#\\[#', '#\\]#'), array('[', ']'), $newpart);
         $tmp = '{SR:' . rcms_random_string(6) . '}';
         $this->sr_temp[$tmp] = $newpart;
         $this->str = str_replace($oldpart, $tmp, $this->str);
     }
     $this->str = preg_replace("#[\\s\n\r]*\\[code\\][\\s\n\r]*(.*?)[\\s\n\r]*\\[/code\\][\\s\n\r]*#is", '<div class="codetitle"><b>' . __('Code') . ':</b></div><div class="codetext" style="overflow: auto; white-space: nowrap;">\\1</div>', $this->str);
 }
コード例 #3
0
ファイル: user-classes.php プロジェクト: Parashutik/ReloadCMS
 function recoverPassword($username, $email)
 {
     if (!($data = $this->getUserData($username))) {
         $this->results['passrec'] = __('Cannot open profile');
         return false;
     }
     if ($email != $data['email']) {
         $this->results['passrec'] = __('Your e-mail doesn\'t match e-mail in profile');
         return false;
     }
     $new_password = rcms_random_string(8);
     $site_url = parse_url($this->url);
     $time = time();
     if (!empty($data['last_prr']) && !empty($this->config['pr_flood']) && (int) $time <= (int) $data['last_prr'] + (int) $this->config['pr_flood']) {
         $this->results['passrec'] = __('Too many requests in limited period of time. Try later.');
         $data['last_prr'] = time();
         if (!$this->save_user($username, $data)) {
             $this->results['passrec'] .= '<br />' . __('Cannot save profile');
         }
         rcms_log_put(__('Notification'), $this->user['username'], 'Attempted to recover password for ' . $username);
         return false;
     }
     if (rcms_send_mail($email, 'no_reply@' . $site_url['host'], __('Password'), $this->config['encoding'], __('Your new password at') . ' ' . $site_url['host'], __('Your username at') . ' ' . $site_url['host'] . ': ' . $username . "\r\n" . __('Your new password at') . ' ' . $site_url['host'] . ': ' . $new_password)) {
         $data['password'] = md5($new_password);
         $data['last_prr'] = $time;
         if (!$this->save_user($username, $data)) {
             $this->results['passrec'] = __('Cannot save profile');
             return false;
         }
         $this->results['passrec'] = __('New password has been sent to your e-mail');
         rcms_log_put(__('Notification'), $this->user['username'], 'Recovered password for ' . $username);
         return true;
     } else {
         rcms_log_put(__('Notification'), $this->user['username'], 'Recovered password for ' . $username . '" (BUT E-MAIL WAS NOT SENT)');
         $this->results['passrec'] = __('Cannot send e-mail');
         return false;
     }
 }
コード例 #4
0
ファイル: etc.php プロジェクト: Parashutik/ReloadCMS
 /**
  * Parses message::str [code|code="PHP"]..[/code] bbtag
  *
  */
 function parseCodeTag()
 {
     preg_match_all("#[\\s\n\r]*\\[code(=\"|=&quot;|=|)(.*?)(\"|&quot;|)\\][\\s\n\r]*(.*?)[\\s\n\r]*\\[/code\\][\\s\n\r]*#is", $this->str, $matches);
     if (!empty($matches[3])) {
         foreach ($matches[3] as $key => $lang) {
             $newpart = $this->hightlightCode($matches[4][$key], $lang);
             $newpart = str_replace(array('[', ']'), array('&#91;', '&#93;'), $newpart);
             $tmp = '{SR:' . rcms_random_string(7) . '}';
             $this->sr_temp[$tmp] = $newpart;
             $this->str = str_replace($matches[4][$key], $tmp, $this->str);
         }
         $this->str = preg_replace("#[\\s\n\r]*\\[code(=\"|=&quot;|=|)(.*?)(\"|&quot;|)\\][\\s\n\r]*(.*?)[\\s\n\r]*\\[/code\\][\\s\n\r]*#is", '<table style="width:100% !important;table-layout:fixed;"><tbody><tr><th class="codetitle">' . __('Code') . ': \\2</th></tr><tr><td class="codetext"><pre style="overflow:auto">\\4</pre></td></tr></tbody></table>', $this->str);
     }
 }
コード例 #5
0
ファイル: formsgen.php プロジェクト: l1ght13aby/Ubilling
 function checkbox($name, $value, $caption, $checked = 0, $extra = '')
 {
     $id = rcms_random_string(5);
     return '<input type="checkbox" name="' . $name . '" value="' . $value . '" id="' . $id . '" ' . (!empty($checked) ? 'checked' : '') . ' ' . $extra . ' /><label for="' . $id . '">' . $caption . '</label>';
 }