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


PHP displayerror函数代码示例

本文整理汇总了PHP中displayerror函数的典型用法代码示例。如果您正苦于以下问题:PHP displayerror函数的具体用法?PHP displayerror怎么用?PHP displayerror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: displayError

 function displayError()
 {
     displayerror('Error! Could not generate captcha.<br />' . join($this->errors, '<br />'));
     /*
           $iheight     = count($this->errors) * 20 + 10;
           $iheight     = ($iheight < 130) ? 130 : $iheight;
     
           $image       = imagecreate(600, $iheight);
     
           $errorsign   = imagecreatefromjpeg('gfx/errorsign.jpg');
           imagecopy($image, $errorsign, 1, 1, 1, 1, 180, 120);
     
           $bgcolor     = imagecolorallocate($image, 255, 255, 255);
     
           $stringcolor = imagecolorallocate($image, 0, 0, 0);
     
           for ($i = 0; $i < count($this->errors); $i++)
           {
     
             $imx = ($i == 0) ? $i * 20 + 5 : $i * 20;
     
     
             $msg = 'Error[' . $i . ']: ' . $this->errors[$i];
     
             imagestring($image, 5, 190, $imx, $msg, $stringcolor);
     
       	  }
     
           imagepng($image);
     
           imagedestroy($image);*/
 }
开发者ID:ksb1712,项目名称:pragyan,代码行数:32,代码来源:error.class.php

示例2: saveToLog

function saveToLog($query, $elapsed, $results)
{
    global $sph_mysql_table_prefix;
    if ($results == '') {
        $results = 0;
    }
    $query = "insert into " . $sph_mysql_table_prefix . "query_log (query, time, elapsed, results) values ('{$query}', now(), '{$elapsed}', '{$results}')";
    if (!mysql_query($query)) {
        displayerror(mysql_error());
    }
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:11,代码来源:search.lib.php

示例3: execute

 function execute()
 {
     if (isset($this->pv['tablename'])) {
         $this->make_query();
         $fields = explode(";", $this->query);
         foreach ($fields as $tok) {
             if ($tok == "") {
                 continue;
             }
             @($result = mysql_query($tok));
             if (!$result) {
                 displayerror("Error line 42 (tbman_executer.lib.php): " . mysql_error());
                 return;
             }
         }
     }
     require_once "tbman_renderer.lib.php";
     $rendertable = new tbman($this->externalquery);
     $rendertable->formaction = $this->formaction;
     return $rendertable->make_table();
 }
开发者ID:ksb1712,项目名称:pragyan,代码行数:21,代码来源:tbman_executer.lib.php

示例4: moveUserToInternal

 private static function moveUserToInternal($userEmail, $userId)
 {
     $query = "SELECT `page_modulecomponentid` FROM `newsletter_externalusers` WHERE `user_email` = '{$userEmail}'";
     $result = mysql_query($query);
     while ($row = mysql_fetch_row($result)) {
         if (!isInternalUserRegistered($userId, $row[0], false)) {
             $insertQuery = "INSERT INTO `newsletter_users`(`page_modulecomponentid`, `newsletter_subscriptiontype`, `user_id`, `user_joindatetime`) VALUES ({$row[0]}, 'user', {$userId}, NOW())";
             if (!mysql_query($insertQuery)) {
                 displayerror('Could not add user to internal list.');
             } else {
                 $deleteQuery = "DELETE FROM `newsletter_externalusers` WHERE `page_modulecomponentid` = {$row[0]} AND `user_email` = '{$userEmail}'";
                 if (!mysql_query($deleteQuery)) {
                     displayerror('Could not remove user from external list.');
                 }
             }
         } else {
             $deleteQuery = "DELETE FROM `newsletter_externalusers` WHERE `page_modulecomponentid` = {$row[0]} AND `user_email` = '{$userEmail}'";
             if (!mysql_query($deleteQuery)) {
                 displayerror('Could not remove user from external list.');
             }
         }
     }
 }
开发者ID:nobelium,项目名称:pragyan,代码行数:23,代码来源:newsletter.lib.php

示例5: tbman

 function tbman($querystring)
 {
     $this->tablename = $this->get_tablename_from_query($querystring);
     $this->querystring = $querystring;
     //  echo "<br/>querystring in tbman_renderer.lib.php: ".$querystring;
     @($result = mysql_query($querystring));
     //@suppresses error messages
     if (!$result) {
         // and allows to put custom error messages like this one - Error: (used here)
         displayerror("Error(tbman_renderer.lib.php): " . mysql_error());
         return;
     } else {
         $this->result = $result;
     }
     if (stristr($querystring, "select")) {
         $this->editable = "yes";
     }
     global $urlRequestRoot;
     global $cmsFolder, $sourceFolder;
     global $templateFolder;
     $this->imagePath = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/images";
     $this->scriptPath = "{$urlRequestRoot}/{$cmsFolder}/{$templateFolder}/common/scripts";
 }
开发者ID:ksb1712,项目名称:pragyan,代码行数:23,代码来源:tbman_renderer.lib.php

示例6: actionManage

 public function actionManage()
 {
     $display .= "<h2>Manage Polls</h2><br />";
     if (isset($_POST['save'])) {
         if ($_POST['q'] == NULL) {
             displayerror('Enter a Valid Question');
         } else {
             if ($_POST['o1'] == NULL || $_POST['o2'] == NULL) {
                 displayerror('Enter Atleast Two Options');
             } else {
                 if ($_POST['multi'] == NULL) {
                     displayerror('Choose `Yes` or `No` for Multiple Option ');
                 } else {
                     $q = htmlspecialchars(escape($_POST['q']));
                     $multi = escape($_POST['multi']);
                     if ($multi == 'y') {
                         $multi = 1;
                     } else {
                         $multi = 0;
                     }
                     $pid = escape($_POST['pid']);
                     $o1 = htmlspecialchars(escape($_POST['o1']));
                     $o2 = htmlspecialchars(escape($_POST['o2']));
                     $o3 = htmlspecialchars(escape($_POST['o3']));
                     $o4 = htmlspecialchars(escape($_POST['o4']));
                     $o5 = htmlspecialchars(escape($_POST['o5']));
                     $o6 = htmlspecialchars(escape($_POST['o6']));
                     displayinfo('Poll Question Updated Succesfully');
                     $query = "UPDATE `poll_content` SET `ques` = '{$q}',`o1` = '{$o1}',`o2` = '{$o2}',`o3` = '{$o3}',`o4` = '{$o4}',`o5` = '{$o5}',`o6` = '{$o6}',`multiple_opt` = '{$multi}' WHERE `pid` = {$pid} AND `page_modulecomponentid`='{$this->moduleComponentId}'";
                     mysql_query($query);
                 }
             }
         }
         return $this->actionView();
     }
     if (isset($_POST['insert'])) {
         if ($_POST['q'] == NULL) {
             displayerror('Enter a Valid Question');
         } else {
             if ($_POST['o1'] == NULL || $_POST['o2'] == NULL) {
                 displayerror('Enter Atleast Two Options');
             } else {
                 if ($_POST['multi'] == NULL) {
                     displayerror('Choose `Yes` or `No` for Multiple Option ');
                 } else {
                     displayinfo('Poll Question Added Succesfully');
                     $query = "INSERT INTO `poll_content` (`page_modulecomponentid`,`ques` ,`o1` ,`o2` ,`o3` ,`o4` ,`o5` ,`o6` ,`visibility`)\n\t\t\t\t\t\tVALUES ('{$this->moduleComponentId}','" . htmlspecialchars(escape($_POST['q'])) . "','" . htmlspecialchars(escape($_POST['o1'])) . "','" . htmlspecialchars(escape($_POST['o2'])) . "','" . htmlspecialchars(escape($_POST['o3'])) . "','" . htmlspecialchars(escape($_POST['o4'])) . "','" . htmlspecialchars(escape($_POST['o5'])) . "','" . htmlspecialchars(escape($_POST['o6'])) . "','1')";
                     $result = mysql_query($query);
                     if ($_POST['multi'] == 'y') {
                         $query5 = "UPDATE `poll_content` SET `multiple_opt`='1' WHERE `ques`='" . htmlspecialchars(escape($_POST['q'])) . "' AND `page_modulecomponentid`='{$this->moduleComponentId}'";
                         $result5 = mysql_query($query5);
                     }
                     $query0 = "SELECT max(`pid`) from `poll_content` WHERE `page_modulecomponentid`='{$this->moduleComponentId}'";
                     $result0 = mysql_query($query0);
                     $row0 = mysql_fetch_array($result0);
                     $query1 = "INSERT INTO `poll_log` (`pid`,`page_modulecomponentid`) VALUES ('" . $row0[0] . "','{$this->moduleComponentId}')";
                     $result1 = mysql_query($query1);
                 }
             }
         }
     }
     if (isset($_POST['disable'])) {
         $pollid = escape($_POST['ques1']);
         $query3 = "SELECT * FROM `poll_content` WHERE `pid`= '{$pollid}' AND `page_modulecomponentid`='{$this->moduleComponentId}'";
         $result3 = mysql_query($query3);
         $nop = mysql_num_rows($result3);
         if ($nop == 1) {
             $query4 = "UPDATE `poll_content` SET `visibility`='0' WHERE `pid`= '{$pollid}' AND `page_modulecomponentid`='{$this->moduleComponentId}'";
             $result4 = mysql_query($query4);
         }
         displayinfo("Poll Question Disabled");
     }
     if (isset($_POST['edit'])) {
         $pollid = escape($_POST['ques0']);
         $query = "SELECT * FROM `poll_content` WHERE `pid` = '{$pollid}' AND `page_modulecomponentid`='{$this->moduleComponentId}'";
         $row = mysql_fetch_array(mysql_query($query));
         $ques = $row['ques'];
         $o1 = $row['o1'];
         $o2 = $row['o2'];
         $o3 = $row['o3'];
         $o4 = $row['o4'];
         $o5 = $row['o5'];
         $o6 = $row['o6'];
         $m = $row['multiple_opt'];
         $display .= "<table width='100%'><tr><td><h3>&nbsp;&nbsp;Edit</h3>&nbsp;&nbsp;Questions added are 'Enabled/Visible' by default <br /><br />";
         $display .= "<div align='center'><form name='f5' method='POST' action='./+manage'>";
         $display .= "Question:<br /><textarea rows='4' cols='20' name='q'>{$ques}</textarea><br /><br />";
         $display .= "<br />";
         $display .= "Enter the options applicable; leave blank otherwise. <br />";
         $display .= "1.&nbsp;<input type='text' name='o1' value='{$o1}' /><br />";
         $display .= "2.&nbsp;<input type='text' name='o2' value='{$o2}' /><br />";
         $display .= "3.&nbsp;<input type='text' name='o3' value='{$o3}' /><br />";
         $display .= "4.&nbsp;<input type='text' name='o4' value='{$o4}' /><br />";
         $display .= "5.&nbsp;<input type='text' name='o5' value='{$o5}' /><br />";
         $display .= "6.&nbsp;<input type='text' name='o6' value='{$o6}' /><br /><br />";
         $display .= "Can the user choose multiple options?<br />";
         if ($m == 1) {
             $display .= "<input type='radio' name='multi' value='y' checked> Yes &nbsp;&nbsp;&nbsp;&nbsp;";
             $display .= "<input type='radio' name='multi' value='n'> No <br /><br />";
         } else {
//.........这里部分代码省略.........
开发者ID:nobelium,项目名称:pragyan,代码行数:101,代码来源:poll.lib.php

示例7: submitQuestionEditForm

/**
 * function submitQuestionEditForm:
 * updates question properties in database when a question edit form is submitted.
 * for objective answers also the options are updated
 */
function submitQuestionEditForm($quizId, $sectionId, $questionId)
{
    $updates = array();
    $done = true;
    if (isset($_POST['txtQuestion'])) {
        $updates[] = "`quiz_question` = '" . escape($_POST['txtQuestion']) . "'";
    }
    if (isset($_POST['selQuestionType']) && in_array($_POST['selQuestionType'], array_keys(getQuestionTypes()))) {
        $updates[] = "`quiz_questiontype` = '" . escape($_POST['selQuestionType']) . "'";
    } else {
        displayerror('No or invalid question type specified.');
        return false;
    }
    if (isset($_POST['txtQuestionWeight']) && is_numeric($_POST['txtQuestionWeight']) && $_POST['txtQuestionWeight'] > 0) {
        $updates[] = "`quiz_questionweight` = " . escape($_POST['txtQuestionWeight']);
    }
    deleteQuestionOptions($quizId, $sectionId, $questionId);
    $questionType = escape($_POST['selQuestionType']);
    if ($questionType != 'subjective') {
        $i = 0;
        $rightAnswer = array();
        while (true) {
            if (!isset($_POST['txtOptionText' . $i]) || $_POST["txtOptionText{$i}"] == '') {
                break;
            }
            $optionText = escape($_POST['txtOptionText' . $i]);
            $insertQuery = "INSERT INTO `quiz_objectiveoptions`(`page_modulecomponentid`, `quiz_sectionid`, `quiz_questionid`, `quiz_optiontext`, `quiz_optionrank`) " . "SELECT '{$quizId}', '{$sectionId}', '{$questionId}', '{$optionText}', IFNULL(MAX(`quiz_optionrank`), 0) + 1 FROM `quiz_objectiveoptions` WHERE `page_modulecomponentid` = '{$quizId}' AND `quiz_sectionid` = '{$sectionId}' AND `quiz_questionid` = '{$questionId}' LIMIT 1";
            if (!mysql_query($insertQuery)) {
                displayerror('Database Error. Could not insert options.');
                return false;
            }
            $optionId = mysql_insert_id();
            if ($questionType == 'sso' && isset($_POST['optOption']) && $_POST['optOption'] == $i || $questionType == 'mso' && isset($_POST['chkOption' . $i])) {
                $rightAnswer[] = $optionId;
            }
            ++$i;
        }
        if (!isset($rightAnswer[0])) {
            displayerror('No options specified for objective answer');
            $done = false;
        }
        $rightAnswer = implode('|', $rightAnswer);
    } else {
        $rightAnswer = isset($_POST['txtRightAnswer']) ? safe_html($_POST['txtRightAnswer']) : '';
    }
    $updates[] = "`quiz_rightanswer` = '{$rightAnswer}'";
    $updateQuery = "UPDATE `quiz_questions` SET " . implode(', ', $updates) . " WHERE `page_modulecomponentid` = {$quizId} AND `quiz_sectionid` = '{$sectionId}' AND `quiz_questionid` = '{$questionId}'";
    if (!mysql_query($updateQuery)) {
        displayerror('Database Error. Could not save section details. ' . $updateQuery . ' ' . mysql_error());
        return false;
    }
    return $done;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:58,代码来源:quizedit.php

示例8: handleUserMgmt

function handleUserMgmt()
{
    global $urlRequestRoot, $cmsFolder, $moduleFolder, $templateFolder, $sourceFolder;
    require_once "{$sourceFolder}/{$moduleFolder}/form/viewregistrants.php";
    if (isset($_GET['userid'])) {
        $_GET['userid'] = escape($_GET['userid']);
    }
    if (isset($_POST['editusertype'])) {
        $_POST['editusertype'] = escape($_POST['editusertype']);
    }
    if (isset($_POST['user_selected_activate'])) {
        foreach ($_POST as $key => $var) {
            if (substr($key, 0, 9) == "selected_") {
                if (!mysql_query("UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=1 WHERE user_id='" . substr($key, 9) . "'")) {
                    $result = mysql_query("SELECT `user_fullname` FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id`='" . substr($key, 9) . "'");
                    if ($result) {
                        $row = mysql_fetch_assoc($result);
                        displayerror("Couldn't activate user, {$row['user_fullname']}");
                    }
                }
            }
        }
        return registeredUsersList($_POST['editusertype'], "edit", false);
    }
    if (isset($_POST['user_selected_deactivate'])) {
        foreach ($_POST as $key => $var) {
            if (substr($key, 0, 9) == "selected_") {
                if ((int) substr($key, 9) == ADMIN_USERID) {
                    displayerror("You cannot deactivate administrator!");
                    continue;
                }
                if (!mysql_query("UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=0 WHERE user_id='" . substr($key, 9) . "'")) {
                    $result = mysql_query("SELECT `user_fullname` FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id`='" . substr($key, 9) . "'");
                    if ($result) {
                        $row = mysql_fetch_assoc($result);
                        displayerror("Couldn't deactivate user, {$row['user_fullname']}");
                    }
                }
            }
        }
        return registeredUsersList($_POST['editusertype'], "edit", false);
    }
    if (isset($_POST['user_selected_delete'])) {
        $done = true;
        foreach ($_POST as $key => $var) {
            if (substr($key, 0, 9) == "selected_") {
                if ((int) substr($key, 9) == ADMIN_USERID) {
                    displayerror("You cannot delete administrator!");
                    continue;
                }
                $query = "DELETE FROM `" . MYSQL_DATABASE_PREFIX . "users` WHERE `user_id` = '" . substr($key, 9) . "'";
                if (mysql_query($query)) {
                    $query = "DELETE FROM `" . MYSQL_DATABASE_PREFIX . "openid_users` WHERE `user_id` = '" . substr($key, 9) . "'";
                    if (!mysql_query($query)) {
                        $done = false;
                    }
                } else {
                    $done = false;
                }
            }
        }
        if (!$done) {
            displayerror("Some problem in deleting selected users");
        }
        return registeredUsersList($_POST['editusertype'], "edit", false);
    }
    if (isset($_POST['user_activate'])) {
        $query = "UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=1 WHERE user_id='{$_GET['userid']}'";
        if (mysql_query($query)) {
            displayInfo("User Successfully Activated!");
        } else {
            displayerror("User Not Activated!");
        }
        return registeredUsersList($_POST['editusertype'], "edit", false);
    } else {
        if (isset($_POST['activate_all_users'])) {
            $query = "UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=1";
            if (mysql_query($query)) {
                displayInfo("All users activated successfully!");
            } else {
                displayerror("Users Not Deactivated!");
            }
            return;
        } else {
            if (isset($_POST['user_deactivate'])) {
                if ($_GET['userid'] == ADMIN_USERID) {
                    displayError("You cannot deactivate administrator!");
                    return registeredUsersList($_POST['editusertype'], "edit", false);
                }
                $query = "UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=0 WHERE user_id='{$_GET['userid']}'";
                if (mysql_query($query)) {
                    displayInfo("User Successfully Deactivated!");
                } else {
                    displayerror("User Not Deactivated!");
                }
                return registeredUsersList($_POST['editusertype'], "edit", false);
            } else {
                if (isset($_POST['deactivate_all_users'])) {
                    $query = "UPDATE " . MYSQL_DATABASE_PREFIX . "users SET user_activated=0 WHERE user_id != " . ADMIN_USERID;
                    if (mysql_query($query)) {
//.........这里部分代码省略.........
开发者ID:ksb1712,项目名称:pragyan,代码行数:101,代码来源:users.lib.php

示例9: while

    //Form_value_id=-2 -> Event Name
    while ($getValues = mysql_fetch_assoc($getCertiDetailsRes)) {
        //User Rank
        if ($getValues['form_value_id'] == -1) {
            imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $userRank);
        } else {
            if ($getValues['form_value_id'] == -2) {
                //Get Event Name
                $getEventNameQuery = "SELECT `event_name` FROM `events_details` WHERE `event_id` = '{$eventId}' AND `page_moduleComponentId` '{$pmcId}'";
                $getEventNameRes = mysql_query($getEventNameQuery) or displayerror(mysql_error());
                $eventName = mysql_result($getEventNameRes, 0);
                imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $eventName);
            } else {
                //Check if modified value exists in events_edited_form
                $getFormValuesQuery = "SELECT `events_edited_form`.`form_elementdata` FROM `events_edited_form` INNER JOIN `events_form` ON `events_edited_form`.`form_id`=`events_form`.`form_id`\n\t\t\t\tAND `events_form`.`event_id`='{$event_id}' AND `events_form`.`page_moduleComponentId`='{$pmcId}' AND `events_edited_form`.`user_id`='{$userId}' AND `events_edited_form`.`page_moduleComponentId`='{$pmcId}' AND \n\t\t\t\t`events_edited_form`.`form_elementid`='{$getValues['form_value_id']}'";
                $getFormValuesRes = mysql_query($getFormValuesQuery) or displayerror(mysql_error());
                if (mysql_num_rows($getFormValuesRes) == 0) {
                    //Else get value from form_elementdata
                    $getFormValuesQuery = "SELECT `form_elementdata`.`form_elementdata` FROM `form_elementdata` INNER JOIN `events_form` ON `form_elementdata`.`page_moduleComponentId`=`events_form`.`form_id` \n\t\t\t\t\tAND `events_form`.`event_id`='{$eventId}' AND `events_form`.`page_moduleComponentId`='{$pmcId}' AND `form_elementdata`.`user_id`='{$userId}' AND `form_elementdata`.`form_elementid`='{$getValues['form_value_id']}'";
                    $getFormValuesRes = mysql_query($getFormValuesQuery) or displayerror(mysql_error());
                }
                while ($formData = mysql_fetch_assos($getFormValuesRes)) {
                    imagettftext($rotatedImage, 20, 90, $getValues['certificate_posx'], $getValues['certificate_posy'], $color, $font, $formData['form_elementdata']);
                }
            }
        }
    }
}
//imagettftext($rotatedImage, 15, 90, 216, 512, $color, $font, $getCertiImgQuery);
header("Content-type:image/jpeg");
imagejpeg($rotatedImage);
开发者ID:ksb1712,项目名称:pragyan,代码行数:31,代码来源:events_certi_image.php

示例10: getNewQuizObject

 /**
  * function getNewQuizObject:
  * returns a object of this quiztype
  */
 private function getNewQuizObject()
 {
     $quizRow = getQuizRow($this->moduleComponentId);
     $quizType = $quizRow['quiz_quiztype'];
     $quizObjectType = ucfirst($quizType) . 'Quiz';
     if (!class_exists($quizObjectType)) {
         displayerror('Error. This type of quiz has not been implemented yet.');
         return false;
     }
     $quizObject = new $quizObjectType($this->moduleComponentId);
     return $quizObject;
 }
开发者ID:nobelium,项目名称:pragyan,代码行数:16,代码来源:quiz.lib.php

示例11: submitFileUploadForm

/**
 * Submits the file upload from 
 * @param $moduleComponentId page_modulecomponentid.
 * @param $moduleName The module which is calling this function.
 * @param $userId The user who is uploading the files.
 * @param $maxFileSizeInBytes the maximum permissible size of the files that can be uploaded.
 * @param $uploadableFileTypesArray An array that contains the file types that has been permitted to be uploaded on that page.
 * @param $uploadableFieldName The name of the variable used in forms to upload the file
 *
 * @return mixed : true if any error is found in the upload otherwise array of filenames uploaded
 */
function submitFileUploadForm($moduleComponentId, $moduleName, $userId, $maxFileSizeInBytes = false, $uploadableFileTypesArray = false, $uploadFieldName = 'fileUploadField')
{
    if ($maxFileSizeInBytes === false) {
        $maxFileSizeInBytes = 2 * 1024 * 1024;
    }
    if (isset($_FILES[$uploadFieldName]['error'][0])) {
        $errorCode = $_FILES[$uploadFieldName]['error'][0];
        if ($errorCode == UPLOAD_ERR_NO_FILE) {
            return true;
        }
        if ($errorCode != 0) {
            displayerror("Error in uploading file. " . getFileUploadError($errorCode));
            return true;
        }
        $uploadedFiles = upload($moduleComponentId, $moduleName, $userId, $uploadFieldName, $maxFileSizeInBytes, $uploadableFileTypesArray);
        if (is_array($uploadedFiles) && count($uploadedFiles) > 0) {
            displayinfo("Successfully uploaded file(s) " . join($uploadedFiles, "; ") . ".");
        }
        return $uploadedFiles;
    } else {
        return true;
    }
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:34,代码来源:upload.lib.php

示例12: getContent

function getContent($pageId, $action, $userId, $permission, $recursed = 0)
{
    if ($action == "login") {
        if ($userId == 0) {
            ///Commented the requirement of login.lib.php because it is already included in /index.php
            //require_once("login.lib.php");
            $newUserId = login();
            if (is_numeric($newUserId)) {
                return getContent($pageId, "view", $newUserId, getPermissions($newUserId, $pageId, "view"), 0);
            } else {
                return $newUserId;
            }
            ///<The login page
        } else {
            displayinfo("You are logged in as " . getUserName($userId) . "! Click <a href=\"./+logout\">here</a> to logout.");
        }
        return getContent($pageId, "view", $userId, getPermissions($userId, $pageId, "view"), $recursed = 0);
    }
    if ($action == "profile") {
        if ($userId != 0) {
            require_once "profile.lib.php";
            return profile($userId);
        } else {
            displayinfo("You need to <a href=\"./+login\">login</a> to view your profile.!");
        }
    }
    if ($action == "logout") {
        if ($userId != 0) {
            $newUserId = resetAuth();
            displayinfo("You have been logged out!");
            global $openid_enabled;
            if ($openid_enabled == 'true') {
                displaywarning("If you logged in via Open ID, make sure you also log out from your Open ID service provider's website. Until then your session in this website will remain active !");
            }
            return getContent($pageId, "view", $newUserId, getPermissions($newUserId, $pageId, "view"), 0);
        } else {
            displayinfo("You need to <a href=\"./+login\">login</a> first to logout!");
        }
    }
    if ($action == "search") {
        require_once "search.lib.php";
        $ret = getSearchBox();
        if (isset($_POST['query'])) {
            $ret .= getSearchResultString($_POST['query']);
        } elseif (isset($_GET['query'])) {
            $ret .= getSearchResultString($_GET['query']);
        }
        return $ret;
    }
    if (isset($_GET['subaction']) && $_GET['subaction'] == 'getchildren') {
        if (isset($_GET['parentpath'])) {
            global $urlRequestRoot;
            require_once 'menu.lib.php';
            $pidarr = array();
            parseUrlReal(escape($_GET['parentpath']), $pidarr);
            $pid = $pidarr[count($pidarr) - 1];
            $children = getChildren($pid, $userId);
            $response = array();
            $response['path'] = escape($_GET['parentpath']);
            $response['items'] = array();
            foreach ($children as $child) {
                $response['items'][] = array($urlRequestRoot . '/home' . escape($_GET['parentpath']) . $child[1], $child[2]);
            }
            //echo json_encode($response);
            exit;
        }
    }
    if ($permission != true) {
        if ($userId == 0) {
            $suggestion = "(Try <a href=\"./+login\">logging in?</a>)";
        } else {
            $suggestion = "";
        }
        displayerror("You do not have the permissions to view this page. {$suggestion}<br /><input type=\"button\" onclick=\"history.go(-1)\" value=\"Go back\" />");
        return '';
    }
    if ($action == "admin") {
        require_once "admin.lib.php";
        return admin($pageId, $userId);
    }
    ///default actions also to be defined here (and not outside)
    /// Coz work to be done after these actions do involve the page
    $pagetype_query = "SELECT page_module, page_modulecomponentid FROM " . MYSQL_DATABASE_PREFIX . "pages WHERE page_id='" . escape($pageId) . "'";
    $pagetype_result = mysql_query($pagetype_query);
    $pagetype_values = mysql_fetch_assoc($pagetype_result);
    if (!$pagetype_values) {
        displayerror("The requested page does not exist.");
        return "";
    }
    $moduleType = $pagetype_values['page_module'];
    $moduleComponentId = $pagetype_values['page_modulecomponentid'];
    if ($action == "settings") {
        ///<done here because we needed to check if the page exists for sure.
        require_once "pagesettings.lib.php";
        return pagesettings($pageId, $userId);
    }
    if ($action == "widgets") {
        return handleWidgetPageSettings($pageId);
    }
    if ($recursed == 0) {
//.........这里部分代码省略.........
开发者ID:rubulh,项目名称:pragyan,代码行数:101,代码来源:content.lib.php

示例13: submitNewUserThirdPartyRegistrationForm

 private function submitNewUserThirdPartyRegistrationForm()
 {
     if (isset($_POST['txtUserEmail']) && isset($_POST['txtUserPhone']) && isset($_POST['txtUserInstitution']) && isset($_POST['txtUserPassword']) && isset($_POST['txtUserConfirmPassword'])) {
         if (getUserIdFromEmail(escape($_POST['txtUserEmail']))) {
             displayerror('The given E-mail Id is already registered on the website. Please use the respective forms\' Edit Registrants view to register the user to events.');
             return;
         }
         if ($_POST['txtUserEmail'] == '' || $_POST['txtUserPassword'] == '') {
             displayerror("Blank e-mail/password NOT allowed");
             return;
         } elseif (!eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$", $_POST['txtUserEmail'])) {
             displayerror("Invalid Email Id");
             return;
         } elseif ($_POST['txtUserPassword'] != $_POST['txtUserConfirmPassword']) {
             displayerror("Passwords are not same");
             return;
         }
         $userIdQuery = 'SELECT MAX(`user_id`) FROM `' . MYSQL_DATABASE_PREFIX . 'users`';
         $userIdResult = mysql_query($userIdQuery);
         $userIdRow = mysql_fetch_row($userIdResult);
         $newUserId = 1;
         if (!is_null($userIdRow[0])) {
             $newUserId = $userIdRow[0] + 1;
         }
         $userEmail = escape(trim($_POST['txtUserEmail']));
         $userPassword = $_POST['txtUserPassword'];
         $userContactNumber = escape($_POST['txtUserPhone']);
         $userInstitute = escape($_POST['txtUserInstitution']);
         $userFullName = escape($_POST['txtUserFullName']);
         $insertQuery = 'INSERT INTO `' . MYSQL_DATABASE_PREFIX . 'users`(`user_id`, `user_name`, `user_email`, `user_fullname`, `user_password`, `user_regdate`, `user_lastlogin`, `user_activated`) ' . "VALUES({$newUserId}, '{$userFullName}', '{$userEmail}', '{$userFullName}', MD5('{$userPassword}'), NOW(), NOW(), 1)";
         $insertResult = mysql_query($insertQuery);
         if (!$insertResult) {
             displayerror('Error. Could not add user to database.');
             return;
         }
         $contactElementId = 3;
         $instituteElementId = 4;
         $contactInsertQuery = "INSERT INTO `form_elementdata` (`user_id`, `page_modulecomponentid`, `form_elementid`, `form_elementdata`) " . "VALUES " . "({$newUserId}, 0, {$contactElementId}, '{$userContactNumber}'), " . "({$newUserId}, 0, {$instituteElementId}, '{$userInstitute}')";
         $contactInsertResult = mysql_query($contactInsertQuery);
         if (!$contactInsertResult) {
             displayerror('Could not save the contact number of the user.');
         } else {
             displayinfo("User {$userEmail} has been registered to the pragyan website.");
         }
     } else {
         displayerror('Invalid form submit data.');
     }
 }
开发者ID:ksb1712,项目名称:pragyan,代码行数:48,代码来源:pr.lib.php

示例14: actionHead

    public function actionHead()
    {
        global $urlRequestRoot, $moduleFolder, $cmsFolder, $templateFolder, $sourceFolder, $STARTSCRIPTS;
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/qaos_common.php";
        require_once $sourceFolder . "/upload.lib.php";
        require_once $sourceFolder . "/" . $moduleFolder . "/qaos1/excel.php";
        $mcid = $this->moduleComponentId;
        if (isset($_POST['downloadFormatExcel'])) {
            displayEventFormatExcel();
        }
        if (isset($_FILES['fileUploadField']['name'])) {
            $date = date_create();
            $timeStamp = date_timestamp_get($date);
            $tempVar = $sourceFolder . "/uploads/temp/" . $timeStamp . $_FILES['fileUploadField']['name'][0];
            move_uploaded_file($_FILES["fileUploadField"]["tmp_name"][0], $tempVar);
            $excelData = readExcelSheet($tempVar);
            $success = 1;
            for ($i = 2; $i <= count($excelData); $i++) {
                if ($excelData[$i][1] == NULL) {
                    continue;
                }
                $checkIfExistQuery = "SELECT * FROM `qaos1_events` WHERE `events_name`='{$excelData[$i][1]}' AND `page_modulecomponentid`={$mcid}";
                $checkIfExistRes = mysql_query($checkIfExistQuery) or displayerror(mysql_error());
                if (mysql_num_rows($checkIfExistRes)) {
                    continue;
                }
                $insertIntoEventTableQuery = "INSERT IGNORE INTO `qaos1_events` (events_name,page_modulecomponentid) VALUES ('{$excelData[$i][1]}',{$mcid})";
                $res = mysql_query($insertIntoEventTableQuery) or displayerror(mysql_error());
                if ($res == "") {
                    $success = 0;
                }
            }
            if (!$success) {
                displayerror("Datas are not inserted");
            }
        }
        if (isset($_POST['uploadEventName'])) {
        }
        if (isset($_POST['hid'])) {
            $_POST["hid2"] = addslashes($_POST["hid2"]);
            $_POST["hid1"] = addslashes($_POST["hid1"]);
            $_POST["hid"] = addslashes($_POST["hid"]);
            if ($_POST["hid"] < 3 && $_POST["hid"] >= 0) {
                if ($_POST["hid"] != 2 || $_POST["hid1"] != "") {
                    $query = "update qaos1_evtproc set evtproc_Status = '{$_POST["hid"]}',evtproc_Desc ='{$_POST["hid1"]}' where evtproc_Id ='{$_POST["hid2"]}' AND modulecomponentid={$this->moduleComponentId}";
                    $res = mysql_query($query);
                }
            }
        }
        if (isset($_GET['subaction']) && $_GET['subaction'] == "apFundReq" && isset($_POST['qhid'])) {
            $_POST["qhid2"] = addslashes($_POST["qhid2"]);
            $_POST["qhid1"] = addslashes($_POST["qhid1"]);
            $_POST["qhid"] = addslashes($_POST["qhid"]);
            if ($_POST["qhid"] < 3 && $_POST["qhid"] >= 0) {
                if ($_POST["qhid"] != 2 || $_POST["qhid1"] != "") {
                    $query = "update qaos1_fundreq set fundreq_Status = '{$_POST["qhid"]}',fundreq_Desc ='{$_POST["qhid1"]}' where fundreq_Id ='{$_POST["qhid2"]}' AND modulecomponentid={$this->moduleComponentId}";
                    $res = mysql_query($query);
                }
            }
        }
        $query = "SELECT * FROM qaos1_evtproc WHERE modulecomponentid={$this->moduleComponentId}";
        $res = mysql_query($query);
        $query1 = "SELECT * FROM qaos1_fundreq WHERE modulecomponentid={$this->moduleComponentId}";
        $res1 = mysql_query($query1);
        $css1 = $urlRequestRoot . "/" . $cmsFolder . "/" . $moduleFolder . "/qaos1/styles/main.css";
        $smarttablestuff = smarttable::render(array('table_evtprocrequest', 'table_fundreqform', 'table_eventproc_head', 'table_funreq_head'), null);
        $STARTSCRIPTS .= "initSmartTable();";
        $headaction = <<<AB
\t\t  {$smarttablestuff}
\t\t\t\t<link href="{$css1}" rel="stylesheet">

\t     \t  \t    <script type="text/javascript">
\t     \t     \t       function qaosproc(a)
                       \t\t{
\t\t\t\t\tvar k=document.getElementById("status"+a+"1");
\t\t     \t\t\tvar k1=document.getElementById("status"+a+"2");
\t\t     \t\t\tif(k.checked) document.getElementById("hid"+a).value=1;
\t\t     \t\t\telse if(k1.checked) document.getElementById("hid"+a).value=2;
\t\t     \t\t\telse {alert("select any one of button");return false;}
\t\t     \t\t\tdocument.getElementById("hi1d"+a).value=document.getElementById("description"+a).value;
\t\t\t\t
\t\t\t\t\t\$.ajax({
\t\t\t\t\ttype: "POST",
\t\t\t\t  \turl: "./+head&subaction=apEventProc",
\t\t\t\t  \tdata: "hid="+\$("#hid"+a).val()+"&hid1="+\$("#hi1d"+a).val()+"&hid2="+\$("#hi2d"+a).val()
\t\t\t      \t\t});
\t\t\t\t
\t\t\t\t\t\$("#tr"+a).css({'display':'none'});      
\t     \t\t\t\treturn false;
\t\t\t\t}
\t\t\t       function qaosfund(a)
       \t\t       \t\t{
\t\t\t\t\tvar k=document.getElementById("qstatus"+a+"1");
       \t\t\t\t\tvar k1=document.getElementById("qstatus"+a+"2");
      \t\t\t\t\tif(k.checked) document.getElementById("qhid"+a).value=1;
       \t\t\t\t\telse if(k1.checked) document.getElementById("qhid"+a).value=2;
      \t\t\t\t\telse {alert("select any one of button");return false;}
\t\t       \t\t\tdocument.getElementById("qhi1d"+a).value=document.getElementById("qdescription"+a).value;
\t\t\t\t\t
\t\t\t\t\t\$.ajax({
//.........这里部分代码省略.........
开发者ID:ksb1712,项目名称:pragyan,代码行数:101,代码来源:qaos1.lib.php

示例15: installModule

function installModule($uploadId, $type)
{
    global $sourceFolder;
    $result = mysql_fetch_assoc(mysql_query("SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "tempuploads` WHERE `id` = '{$uploadId}'"));
    if ($result != NULL) {
        $zipFile = $result['filePath'];
        $temp = explode(";", $result['info']);
        $extractedPath = $temp[0];
        $moduleActualPath = $temp[1];
        $moduleName = $temp[2];
    }
    $function = "checkFor{$type}Issues";
    $issueType = $function($moduleActualPath, $moduleName, $issues);
    if ($issues == "") {
        return finalizeInstallation($uploadId, $type);
    }
    $issues = "\n\t<table name='issues_table'>\n\t<tr><th>S.No.</th><th>Issue Details</th><th>Issue Type</th><th>Ignore ?</th></tr>\n\t{$issues}\n\t</table>\n\t<b>Installation cannot proceed for the above mentioned issues, fix them and <a href='./+admin&subaction=widgets&subsubaction=installwidget'>try again</a>.</b>";
    delDir($extractedPath);
    unlink($zipFile);
    mysql_query("DELETE FROM `" . MYSQL_DATABASE_PREFIX . "tempuploads` WHERE `id` = '{$uploadId}'") or displayerror(mysql_error());
    return $issues;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:22,代码来源:module.lib.php


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