当前位置: 首页>>代码示例>>PHP>>正文


PHP RMUtilities::randomString方法代码示例

本文整理汇总了PHP中RMUtilities::randomString方法的典型用法代码示例。如果您正苦于以下问题:PHP RMUtilities::randomString方法的具体用法?PHP RMUtilities::randomString怎么用?PHP RMUtilities::randomString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RMUtilities的用法示例。


在下文中一共展示了RMUtilities::randomString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendPostcard

/**
* @desc Envia la postal
*/
function sendPostcard()
{
    global $tpl, $xoopsModule, $xoopsModuleConfig, $rmc_config, $mc, $xoopsUser, $xoopsConfig, $util;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if (!$xoopsUser) {
        redirect_header(XOOPS_URL . '/user.php#register', 1, _MS_GS_ERRUSR);
        die;
    }
    $img = new GSImage($img);
    if ($img->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRIMG);
        die;
    }
    // Recaptcha check
    if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
        redirect_header(GSFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'postcard/new/img/' . $img->id() . '/' : '?postcard=new&img=' . $img->id()), 1, __('Please check the security words and write it correctly!', 'contact'));
        die;
    }
    $post = new GSPostcard();
    $post->setTitle($title);
    $post->setMessage($msg);
    $post->setDate(time());
    $post->setToName($tname);
    $post->setToEmail($tmail);
    $post->setImage($img->id());
    $post->setName($fname);
    $post->setEmail($fmail);
    $post->setUid($uid);
    $post->setIp($_SERVER['REMOTE_ADDR']);
    $post->setViewed(0);
    //Generamos el código de la postal
    $post->setCode(RMUtilities::randomString(10, 1, false, 1, 1));
    if (!$post->save()) {
        redirect_header(base64_decode($return), 2, __('Unable to send e-card. Please try again!', 'galleries'));
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $ectpl = is_file(XOOPS_ROOT_PATH . '/modules/galleries/lang/' . 'postcard-' . $rmc_config['language'] . '.tpl') ? $rmc_config['language'] . '.tpl' : 'postcard-en_US.tpl';
    $xoopsMailer->setTemplate($ectpl);
    $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
    $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
    $xoopsMailer->assign('FNAME', $fname);
    $xoopsMailer->assign('FMAIL', $fmail);
    $xoopsMailer->assign('TNAME', $tname);
    $xoopsMailer->assign('MODULE_LINK', GSfunctions::get_url());
    $xoopsMailer->assign('POSTAL_LINK', GSfunctions::get_url() . ($mc['urlmode'] ? 'postcard/view/id/' . $post->code() . '/' : '?postcard=view&id=' . $post->code()));
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/galleries/lang/");
    $xoopsMailer->setFromEmail($fmail);
    $xoopsMailer->setFromName($fname);
    $xoopsMailer->setToEmails($tmail);
    $xoopsMailer->setSubject(sprintf(_MS_GS_SUBJECT, $tname));
    if (!$xoopsMailer->send(true)) {
        redirect_header(base64_decode($return), 2, $xoopsMailer->getErrors());
    } else {
        redirect_header($user->userURL() . 'img/' . $img->id() . '/', 1, __('E-card sent successfully!', 'galleries'));
    }
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:63,代码来源:postcard.php


注:本文中的RMUtilities::randomString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。